diff --git a/app/layout/centrallayout.h b/app/layout/centrallayout.h index 6656ad68f..8dcad6b24 100644 --- a/app/layout/centrallayout.h +++ b/app/layout/centrallayout.h @@ -67,6 +67,8 @@ public: QStringList activities() const; void setActivities(QStringList activities); + Latte::View *lastSettingsView(); + SharedLayout *sharedLayout() const; void setSharedLayout(SharedLayout *layout); @@ -118,6 +120,8 @@ private: QString m_sharedLayoutName; QStringList m_activities; + QPointer m_lastSettingsView; + QPointer m_sharedLayout; QList m_sharedConnections; diff --git a/app/layout/genericlayout.cpp b/app/layout/genericlayout.cpp index af349a384..4af022f25 100644 --- a/app/layout/genericlayout.cpp +++ b/app/layout/genericlayout.cpp @@ -612,6 +612,21 @@ void GenericLayout::renameLayout(QString newName) } } +Latte::View *GenericLayout::lastConfigViewFor() +{ + return m_lastConfigViewFor; +} + +void GenericLayout::setLastConfigViewFor(Latte::View *view) +{ + if (m_lastConfigViewFor == view) { + return; + } + + m_lastConfigViewFor = view; + emit lastConfigViewForChanged(view); +} + void GenericLayout::addNewView() { if (!m_corona) { diff --git a/app/layout/genericlayout.h b/app/layout/genericlayout.h index fd4a56943..457c9ff7f 100644 --- a/app/layout/genericlayout.h +++ b/app/layout/genericlayout.h @@ -105,6 +105,9 @@ public: void unloadLatteViews(); void unlock(); //! make it writable which it should be the default + void setLastConfigViewFor(Latte::View *view); + Latte::View *lastConfigViewFor(); + //! this function needs the layout to have first set the corona through initToCorona() function virtual void addView(Plasma::Containment *containment, bool forceOnPrimary = false, int explicitScreen = -1, Layout::ViewsMap *occupied = nullptr); void copyView(Plasma::Containment *containment); @@ -136,7 +139,7 @@ signals: void viewEdgeChanged(); //! used from ConfigView(s) in order to be informed which is one should be shown - void configViewCreated(QQuickView *configView); + void lastConfigViewForChanged(Latte::View *view); //! used from LatteView(s) in order to exist only one each time that has the highest priority //! to use the global shortcuts activations @@ -176,6 +179,8 @@ private: private: bool m_blockAutomaticLatteViewCreation{false}; + QPointer m_lastConfigViewFor; + QStringList m_unloadedContainmentsIds; QPointer m_storage; diff --git a/app/shortcuts/globalshortcuts.cpp b/app/shortcuts/globalshortcuts.cpp index 84bb788fb..ae113fca3 100644 --- a/app/shortcuts/globalshortcuts.cpp +++ b/app/shortcuts/globalshortcuts.cpp @@ -725,7 +725,7 @@ void GlobalShortcuts::showSettings() //! check if there is a view with opened settings window for (int i = 0; i < sortedViews.size(); ++i) { - if (sortedViews[i]->settingsWindowIsShown()) { + if (sortedViews[i] == currentLayout->lastConfigViewFor()) { openSettings = i; break; } diff --git a/app/view/settings/primaryconfigview.cpp b/app/view/settings/primaryconfigview.cpp index 5229efdc4..0217caf90 100644 --- a/app/view/settings/primaryconfigview.cpp +++ b/app/view/settings/primaryconfigview.cpp @@ -115,7 +115,7 @@ PrimaryConfigView::PrimaryConfigView(Plasma::Containment *containment, Latte::Vi } if (m_latteView->layout()) { - emit m_latteView->layout()->configViewCreated(this); + emit m_latteView->layout()->setLastConfigViewFor(m_latteView); } } diff --git a/app/view/view.cpp b/app/view/view.cpp index 1a8965fb1..dafd75ace 100644 --- a/app/view/view.cpp +++ b/app/view/view.cpp @@ -836,7 +836,7 @@ void View::setLayout(Layout::GenericLayout *layout) }); connectionsLayout << connect(m_layout, &Layout::GenericLayout::preferredViewForShortcutsChanged, this, &View::preferredViewForShortcutsChangedSlot); - connectionsLayout << connect(m_layout, &Layout::GenericLayout::configViewCreated, this, &View::configViewCreated); + connectionsLayout << connect(m_layout, &Layout::GenericLayout::lastConfigViewForChanged, this, &View::configViewCreatedFor); Latte::Corona *latteCorona = qobject_cast(this->corona()); @@ -947,9 +947,9 @@ void View::setBlockHiding(bool block) } } -void View::configViewCreated(QQuickView *configView) +void View::configViewCreatedFor(Latte::View *view) { - if (m_configView && m_configView!=configView) { + if (view!=this && m_configView) { //! for each layout only one dock should show its configuration windows //! otherwise we could reach a point that because a settings window //! is below another Latte View its options are not reachable diff --git a/app/view/view.h b/app/view/view.h index 5d79f4d71..759abdad1 100644 --- a/app/view/view.h +++ b/app/view/view.h @@ -269,7 +269,7 @@ signals: private slots: void availableScreenRectChangedFrom(View *origin); - void configViewCreated(QQuickView *configView); + void configViewCreatedFor(Latte::View *view); void hideWindowsForSlidingOut(); void preferredViewForShortcutsChangedSlot(Latte::View *view); void statusChanged(Plasma::Types::ItemStatus);