1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-25 14:03:58 +03:00

complete containmentactions support

--this way the Layouts menu in now accesible
even from plasma taskmanagers. The codebase is also
the same for every component that is showing its
menus.
This commit is contained in:
Michail Vourlakos 2018-02-04 02:43:30 +02:00
parent f9afa1bc1f
commit 43cc5da6fa
3 changed files with 27 additions and 4 deletions

View File

@ -111,10 +111,6 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen, bool dockWindo
m_visibility = new VisibilityManager(this);
}
//! Only way to be sure that actions are set correctly because of the old way to expose the menu actions
//! an alternative would be for Layout to remove on startup ActionPlugins that are old style...
this->containment()->setContainmentActions(QString("RightButton;NoModifier"), QString("org.kde.latte.contextmenu"));
connect(this->containment(), SIGNAL(statusChanged(Plasma::Types::ItemStatus)), SLOT(statusChanged(Plasma::Types::ItemStatus)));
}, Qt::DirectConnection);

View File

@ -554,6 +554,7 @@ void LayoutManager::loadLatteLayout(QString layoutPath)
}
if (!layoutPath.isEmpty() && m_corona->containments().size() == 0) {
cleanupOnStartup(layoutPath);
qDebug() << "LOADING CORONA LAYOUT:" << layoutPath;
m_corona->loadLayout(layoutPath);
@ -584,6 +585,31 @@ void LayoutManager::loadLatteLayout(QString layoutPath)
}
}
void LayoutManager::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.contextmenu") {
deprecatedActionGroup << actId;
}
}
foreach (auto pId, deprecatedActionGroup) {
qDebug() << "!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!! REMOVING :::: " << pId;
actionGroups.group(pId).deleteGroup();
}
actionGroups.sync();
}
void LayoutManager::showAboutDialog()
{
m_corona->aboutApplication();

View File

@ -138,6 +138,7 @@ private slots:
void syncMultipleLayoutsToActivities(QString layoutForOrphans = QString());
private:
void cleanupOnStartup(QString path); //!remove deprecated or oldstyle config options
void clearUnloadedContainmentsFromLinkedFile(QStringList containmentsIds, bool bypassChecks = false);
void confirmDynamicSwitch();
//! it is used just in order to provide translations for the presets