From 54e9fcdcec4349097fb3adb74edafcd219a83823 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 17 Apr 2021 12:37:10 +0300 Subject: [PATCH] storage:adjustments to newUniquedIdsFile --- app/layouts/storage.cpp | 16 ++++++++++------ app/layouts/storage.h | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/layouts/storage.cpp b/app/layouts/storage.cpp index b0ebd1283..ab02e65da 100644 --- a/app/layouts/storage.cpp +++ b/app/layouts/storage.cpp @@ -260,7 +260,7 @@ void Storage::importToCorona(const Layout::GenericLayout *layout) copyGroup.sync(); //! update ids to unique ones - QString temp2File = newUniqueIdsLayoutFromFile(temp1FilePath, layout); + QString temp2File = newUniqueIdsFile(temp1FilePath, layout); //! Finally import the configuration importLayoutFile(layout, temp2File); @@ -295,9 +295,9 @@ bool Storage::appletGroupIsValid(const KConfigGroup &appletGroup) && appletGroup.group("Configuration").hasKey("PreloadWeight") ); } -QString Storage::newUniqueIdsLayoutFromFile(QString originFile, const Layout::GenericLayout *destinationLayout, QString destinationFile) +QString Storage::newUniqueIdsFile(QString originFile, const Layout::GenericLayout *destinationLayout, QString destinationFile) { - if (!destinationLayout || !destinationLayout->corona()) { + if (destinationFile.isEmpty() && (!destinationLayout || !destinationLayout->corona())) { return QString(); } @@ -437,8 +437,12 @@ QString Storage::newUniqueIdsLayoutFromFile(QString originFile, const Layout::Ge } } - if (destinationLayout->corona()->layoutsManager()->memoryUsage() == MemoryUsage::MultipleLayouts) { + if (destinationFile.isEmpty() && destinationLayout->corona()->layoutsManager()->memoryUsage() == MemoryUsage::MultipleLayouts) { + //! will be added in main corona multiple layouts file investigate_conts.group(cId).writeEntry("layoutId", destinationLayout->name()); + } else { + //! will be added in inactive layout + investigate_conts.group(cId).writeEntry("layoutId", QString()); } } @@ -558,7 +562,7 @@ ViewDelayedCreationData Storage::newView(const Layout::GenericLayout *destinatio QFile(templateFile).copy(templateTmpAbsolutePath); //! update ids to unique ones - QString temp2File = newUniqueIdsLayoutFromFile(templateTmpAbsolutePath, destination); + QString temp2File = newUniqueIdsFile(templateTmpAbsolutePath, destination); //! Finally import the configuration QList importedViews = importLayoutFile(destination, temp2File); @@ -821,7 +825,7 @@ ViewDelayedCreationData Storage::copyView(const Layout::GenericLayout *layout, P //! end of subcontainments specific code //! update ids to unique ones - QString temp2File = newUniqueIdsLayoutFromFile(temp1File, layout); + QString temp2File = newUniqueIdsFile(temp1File, layout); //! Finally import the configuration QList importedDocks = importLayoutFile(layout, temp2File); diff --git a/app/layouts/storage.h b/app/layouts/storage.h index 3bbf2dd7c..3646059e9 100644 --- a/app/layouts/storage.h +++ b/app/layouts/storage.h @@ -129,7 +129,7 @@ private: //! provides a new file path based the provided file. The new file //! has updated ids for containments and applets based on the corona //! loaded ones - QString newUniqueIdsLayoutFromFile(QString originFile, const Layout::GenericLayout *destinationLayout = nullptr, QString destinationFile = QString()); + QString newUniqueIdsFile(QString originFile, const Layout::GenericLayout *destinationLayout = nullptr, QString destinationFile = QString()); //! imports a layout file and returns the containments for the docks QList importLayoutFile(const Layout::GenericLayout *layout, QString file);