remember the last created ConfigView per layout

pull/6/head
Michail Vourlakos 6 years ago
parent be90ca6269
commit 7cd3b6201d

@ -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<Latte::View> m_lastSettingsView;
QPointer<SharedLayout> m_sharedLayout;
QList<QMetaObject::Connection> m_sharedConnections;

@ -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) {

@ -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<Latte::View> m_lastConfigViewFor;
QStringList m_unloadedContainmentsIds;
QPointer<Storage> m_storage;

@ -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;
}

@ -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);
}
}

@ -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<Latte::Corona *>(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

@ -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);

Loading…
Cancel
Save