diff --git a/app/dockcorona.cpp b/app/dockcorona.cpp index 15c945b07..c6e53f4ed 100644 --- a/app/dockcorona.cpp +++ b/app/dockcorona.cpp @@ -180,6 +180,7 @@ void DockCorona::loadLatteLayout(QString layoutPath) qDebug() << "corona is unloading the interface..."; unload(); qDebug() << "loading layout:" << layoutPath; + cleanupOnStartup(layoutPath); loadLayout(layoutPath); m_firstContainmentWithTasks = -1; @@ -191,6 +192,50 @@ void DockCorona::loadLatteLayout(QString layoutPath) } } +//! support Latte v0.8 layout file that have different Action Plugin +//! and at the same time cleaup deprecated containments +void DockCorona::cleanupOnStartup(QString path) +{ + KSharedConfigPtr filePtr = KSharedConfig::openConfig(path); + + KConfigGroup actionGroups = KConfigGroup(filePtr, "ActionPlugins"); + + QStringList deprecatedActionGroup; + + foreach (auto actId, actionGroups.groupList()) { + QString pluginId = actionGroups.group(actId).readEntry("RightButton;NoModifier", ""); + + if (pluginId == "org.kde.latte.contextmenu") { + deprecatedActionGroup << actId; + } + } + + foreach (auto pId, deprecatedActionGroup) { + qDebug() << "!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!! REMOVING :::: " << pId; + actionGroups.group(pId).deleteGroup(); + } + + KConfigGroup containmentGroups = KConfigGroup(filePtr, "Containments"); + + QStringList removeContaimentsList; + + foreach (auto cId, containmentGroups.groupList()) { + QString pluginId = containmentGroups.group(cId).readEntry("plugin", ""); + + if (pluginId == "org.kde.desktopcontainment") { //!must remove ghost containments first + removeContaimentsList << cId; + } + } + + foreach (auto cId, removeContaimentsList) { + containmentGroups.group(cId).deleteGroup(); + } + + + actionGroups.sync(); + containmentGroups.sync(); +} + void DockCorona::setupWaylandIntegration() { using namespace KWayland::Client; diff --git a/app/dockcorona.h b/app/dockcorona.h index 0ccfe250b..49620ce67 100644 --- a/app/dockcorona.h +++ b/app/dockcorona.h @@ -122,6 +122,7 @@ private slots: private: void cleanConfig(); + void cleanupOnStartup(QString path); void qmlRegisterTypes() const; void setupWaylandIntegration();