From eb0c52c52b40a667b26c2876ce127448d93679be Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 10 Jul 2019 17:10:31 +0300 Subject: [PATCH] improve settings windows shown trigerring behavior --when the user uses Meta+A to cycle between the Views configuration windows then in such case when NO Config window is shown the LAST ONE USED should be shown again. IF a Config View is already shown then the NEXT should be shown afterwards --- app/layout/centrallayout.cpp | 10 ++++++++++ app/layout/centrallayout.h | 3 +-- app/layout/genericlayout.cpp | 11 +++++++++++ app/layout/genericlayout.h | 2 ++ app/shortcuts/globalshortcuts.cpp | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/layout/centrallayout.cpp b/app/layout/centrallayout.cpp index 337eb380b..b90341f47 100644 --- a/app/layout/centrallayout.cpp +++ b/app/layout/centrallayout.cpp @@ -292,6 +292,16 @@ void CentralLayout::addView(Plasma::Containment *containment, bool forceOnPrimar } } +bool CentralLayout::configViewIsShown() const +{ + bool genericShown = GenericLayout::configViewIsShown(); + if (m_sharedLayout) { + return (m_sharedLayout->configViewIsShown() || genericShown); + } + + return genericShown; +} + const QStringList CentralLayout::appliedActivities() { if (!m_corona) { diff --git a/app/layout/centrallayout.h b/app/layout/centrallayout.h index 8dcad6b24..c578481be 100644 --- a/app/layout/centrallayout.h +++ b/app/layout/centrallayout.h @@ -67,8 +67,6 @@ public: QStringList activities() const; void setActivities(QStringList activities); - Latte::View *lastSettingsView(); - SharedLayout *sharedLayout() const; void setSharedLayout(SharedLayout *layout); @@ -76,6 +74,7 @@ public: void addView(Plasma::Containment *containment, bool forceOnPrimary = false, int explicitScreen = -1, Layout::ViewsMap *occupied = nullptr); void syncLatteViewsToScreens(Layout::ViewsMap *occupiedMap = nullptr) override; void unloadContainments() override; + bool configViewIsShown() const override; const QStringList appliedActivities() override; Types::ViewType latteViewType(int containmentId) const override; QList latteViews() override; diff --git a/app/layout/genericlayout.cpp b/app/layout/genericlayout.cpp index ff90ecf50..f3e401e05 100644 --- a/app/layout/genericlayout.cpp +++ b/app/layout/genericlayout.cpp @@ -139,6 +139,17 @@ void GenericLayout::setBlockAutomaticLatteViewCreation(bool block) m_blockAutomaticLatteViewCreation = block; } +bool GenericLayout::configViewIsShown() const +{ + for (const auto view : m_latteViews) { + if (view && view->settingsWindowIsShown()) { + return true; + } + } + + return false; +} + bool GenericLayout::isActive() const { if (!m_corona) { diff --git a/app/layout/genericlayout.h b/app/layout/genericlayout.h index 3ebea935c..1e7570a5b 100644 --- a/app/layout/genericlayout.h +++ b/app/layout/genericlayout.h @@ -76,6 +76,8 @@ public: bool isWritable() const; bool layoutIsBroken() const; + virtual bool configViewIsShown() const; + virtual int viewsCount(int screen) const; virtual int viewsCount(QScreen *screen) const; virtual int viewsCount() const; diff --git a/app/shortcuts/globalshortcuts.cpp b/app/shortcuts/globalshortcuts.cpp index 510d4ce2f..966437448 100644 --- a/app/shortcuts/globalshortcuts.cpp +++ b/app/shortcuts/globalshortcuts.cpp @@ -732,7 +732,7 @@ void GlobalShortcuts::showSettings() } if (openSettings >= 0 && sortedViews.count() > 1) { - openSettings = openSettings + 1; + openSettings = currentLayout->configViewIsShown() ? openSettings + 1 : openSettings; if (openSettings >= sortedViews.size()) { openSettings = 0;