support v0.8 layout files

--in v0.8 Latte is using its own containmentactions
that are published through the layout files. This patch
provides support in order such extracted layouts to
be able to be loaded properly.
v0.7
Michail Vourlakos 7 years ago
parent f98c679575
commit e46a0295ba

@ -180,6 +180,7 @@ void DockCorona::loadLatteLayout(QString layoutPath)
qDebug() << "corona is unloading the interface..."; qDebug() << "corona is unloading the interface...";
unload(); unload();
qDebug() << "loading layout:" << layoutPath; qDebug() << "loading layout:" << layoutPath;
cleanupOnStartup(layoutPath);
loadLayout(layoutPath); loadLayout(layoutPath);
m_firstContainmentWithTasks = -1; 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() void DockCorona::setupWaylandIntegration()
{ {
using namespace KWayland::Client; using namespace KWayland::Client;

@ -122,6 +122,7 @@ private slots:
private: private:
void cleanConfig(); void cleanConfig();
void cleanupOnStartup(QString path);
void qmlRegisterTypes() const; void qmlRegisterTypes() const;
void setupWaylandIntegration(); void setupWaylandIntegration();

Loading…
Cancel
Save