1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-08 13:18:09 +03:00

update layout viewsScreens function

--use Layout::views() function to implement this
This commit is contained in:
Michail Vourlakos 2021-05-18 22:07:42 +03:00
parent 40496ca32f
commit 01e60e0aab
3 changed files with 6 additions and 49 deletions

View File

@ -1516,36 +1516,17 @@ QList<int> GenericLayout::subContainmentsOf(Plasma::Containment *containment) co
QList<int> GenericLayout::viewsScreens()
{
Data::ViewsTable views = viewsTable();
QList<int> 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; i<views.rowCount(); ++i) {
if (!views[i].onPrimary && !screens.contains(views[i].screen)) {
screens << views[i].screen;
}
return screens;
} else {
return Layouts::Storage::self()->viewsScreens(file());
}
}
return screens;
}
//! STORAGE

View File

@ -1733,26 +1733,5 @@ Data::ViewsTable Storage::views(const QString &file)
return vtable;
}
QList<int> Storage::viewsScreens(const QString &file)
{
QList<int> 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;
}
}
}

View File

@ -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<screens ids>
QList<int> viewsScreens(const QString &file);
Data::GenericTable<Data::Generic> subcontainments(const KConfigGroup &containmentGroup);
Data::GenericTable<Data::Generic> subcontainments(const Layout::GenericLayout *layout, const Plasma::Containment *lattecontainment) const;
Data::View view(const KConfigGroup &containmentGroup);