1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-27 14:50:21 +03:00

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.
This commit is contained in:
Michail Vourlakos 2018-02-28 17:56:14 +02:00
parent f98c679575
commit e46a0295ba
2 changed files with 46 additions and 0 deletions

View File

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

View File

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