1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-02-02 21:47:22 +03:00

do not break user view template file on first use

This commit is contained in:
Michail Vourlakos 2021-02-27 18:34:06 +02:00
parent 2b59a085e4
commit 373b8c5b56

View File

@ -535,8 +535,17 @@ ViewDelayedCreationData Storage::newView(const Layout::GenericLayout *destinatio
//! Setting mutable for create a containment
destination->corona()->setImmutability(Plasma::Types::Mutable);
//! copy view template path in temp file
QString templateTmpAbsolutePath = m_storageTmpDir.path() + "/" + QFileInfo(templateFile).fileName() + ".newids";
if (QFile(templateTmpAbsolutePath).exists()) {
QFile(templateTmpAbsolutePath).remove();
}
QFile(templateFile).copy(templateTmpAbsolutePath);
//! update ids to unique ones
QString temp2File = newUniqueIdsLayoutFromFile(destination, templateFile);
QString temp2File = newUniqueIdsLayoutFromFile(destination, templateTmpAbsolutePath);
//! Finally import the configuration
QList<Plasma::Containment *> importedViews = importLayoutFile(destination, temp2File);