From 01e60e0aabb8f92b7694789d92585ae7cf97bd6b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 18 May 2021 22:07:42 +0300 Subject: [PATCH] update layout viewsScreens function --use Layout::views() function to implement this --- app/layout/genericlayout.cpp | 31 ++++++------------------------- app/layouts/storage.cpp | 21 --------------------- app/layouts/storage.h | 3 --- 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/app/layout/genericlayout.cpp b/app/layout/genericlayout.cpp index 7eb1bb739..5c41c33dd 100644 --- a/app/layout/genericlayout.cpp +++ b/app/layout/genericlayout.cpp @@ -1516,36 +1516,17 @@ QList GenericLayout::subContainmentsOf(Plasma::Containment *containment) co QList GenericLayout::viewsScreens() { + Data::ViewsTable views = viewsTable(); QList screens; - if (isActive()) { - for (const auto containment : m_containments) { - if (Layouts::Storage::self()->isLatteContainment(containment)) { - int screenId{Layouts::Storage::IDNULL}; - - //! valid screen id - if (latteViewExists(containment)) { - screenId = m_latteViews[containment]->positioner()->currentScreenId(); - } else { - screenId = containment->screen(); - - if (!Layouts::Storage::isValid(screenId)) { - screenId = containment->lastScreen(); - } - } - - if (Layouts::Storage::isValid(screenId) && !screens.contains(screenId)) { - screens << screenId; - } - } + for (int i=0; iviewsScreens(file()); } -} + return screens; +} //! STORAGE diff --git a/app/layouts/storage.cpp b/app/layouts/storage.cpp index 0eab2b0e5..ab4df3153 100644 --- a/app/layouts/storage.cpp +++ b/app/layouts/storage.cpp @@ -1733,26 +1733,5 @@ Data::ViewsTable Storage::views(const QString &file) return vtable; } -QList Storage::viewsScreens(const QString &file) -{ - QList screens; - - KSharedConfigPtr lFile = KSharedConfig::openConfig(file); - - KConfigGroup containmentGroups = KConfigGroup(lFile, "Containments"); - - for (const auto &cId : containmentGroups.groupList()) { - if (Layouts::Storage::self()->isLatteContainment(containmentGroups.group(cId))) { - int screenId = containmentGroups.group(cId).readEntry("lastScreen", IDNULL); - - if (isValid(screenId) && !screens.contains(screenId)) { - screens << screenId; - } - } - } - - return screens; -} - } } diff --git a/app/layouts/storage.h b/app/layouts/storage.h index 69ac6c2e5..a09e8d83b 100644 --- a/app/layouts/storage.h +++ b/app/layouts/storage.h @@ -102,9 +102,6 @@ public: Data::AppletsTable plugins(const Layout::GenericLayout *layout, const int containmentid = IDNULL); Data::AppletsTable plugins(const QString &layoutfile, const int containmentid = IDNULL); - //! list - QList viewsScreens(const QString &file); - Data::GenericTable subcontainments(const KConfigGroup &containmentGroup); Data::GenericTable subcontainments(const Layout::GenericLayout *layout, const Plasma::Containment *lattecontainment) const; Data::View view(const KConfigGroup &containmentGroup);