1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +03:00

fix last config view tracking for multiple layouts

This commit is contained in:
Michail Vourlakos 2020-08-26 00:41:13 +03:00
parent 6dec2e378e
commit 527f865eda
3 changed files with 18 additions and 1 deletions

View File

@ -367,7 +367,17 @@ void GenericLayout::setLastConfigViewFor(Latte::View *view)
} }
m_lastConfigViewFor = view; m_lastConfigViewFor = view;
emit lastConfigViewForChanged(view);
if (view) {
emit lastConfigViewForChanged(view);
}
}
void GenericLayout::onLastConfigViewChangedFrom(Latte::View *view)
{
if (!m_latteViews.values().contains(view)) {
setLastConfigViewFor(nullptr);
}
} }
Latte::View *GenericLayout::viewForContainment(uint id) const Latte::View *GenericLayout::viewForContainment(uint id) const
@ -972,6 +982,9 @@ bool GenericLayout::initToCorona(Latte::Corona *corona)
connect(m_corona, &Plasma::Corona::containmentAdded, this, &GenericLayout::addContainment); connect(m_corona, &Plasma::Corona::containmentAdded, this, &GenericLayout::addContainment);
connect(this, &GenericLayout::lastConfigViewForChanged, m_corona->layoutsManager(), &Layouts::Manager::lastConfigViewChangedFrom);
connect(m_corona->layoutsManager(), &Layouts::Manager::lastConfigViewChangedFrom, this, &GenericLayout::onLastConfigViewChangedFrom);
//!connect signals after adding the containment //!connect signals after adding the containment
connect(this, &GenericLayout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRectChanged); connect(this, &GenericLayout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRectChanged);
connect(this, &GenericLayout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRegionChanged); connect(this, &GenericLayout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRegionChanged);

View File

@ -180,6 +180,7 @@ private slots:
void appletCreated(Plasma::Applet *applet); void appletCreated(Plasma::Applet *applet);
void destroyedChanged(bool destroyed); void destroyedChanged(bool destroyed);
void containmentDestroyed(QObject *cont); void containmentDestroyed(QObject *cont);
void onLastConfigViewChangedFrom(Latte::View *view);
private: private:
//! It can be used in order for LatteViews to not be created automatically when //! It can be used in order for LatteViews to not be created automatically when

View File

@ -123,6 +123,9 @@ signals:
void currentLayoutIsSwitching(QString layoutName); void currentLayoutIsSwitching(QString layoutName);
//! used from ConfigView(s) in order to be informed which is one should be shown
void lastConfigViewChangedFrom(Latte::View *view);
private: private:
void cleanupOnStartup(QString path); //!remove deprecated or oldstyle config options void cleanupOnStartup(QString path); //!remove deprecated or oldstyle config options
void clearUnloadedContainmentsFromLinkedFile(QStringList containmentsIds, bool bypassChecks = false); void clearUnloadedContainmentsFromLinkedFile(QStringList containmentsIds, bool bypassChecks = false);