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

Improve Contextmenu

Summary:
- Display Dock Settings/Panel Settings instead of View Settings
- Hide View Settings when configuring
- Create `Alt+A`, `Alt+S`, `Alt+L` shortcuts for actions.

Reviewers: #latte_dock, mvourlakos

Reviewed By: #latte_dock, mvourlakos

Subscribers: mvourlakos, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D18976
This commit is contained in:
Tranter Madi 2019-02-13 19:43:55 +02:00 committed by Michail Vourlakos
parent d2ea33e236
commit c893ab3d22

View File

@ -67,7 +67,7 @@ void Menu::makeActions()
qDebug() << "Action Trigerred !!!";
});
m_addWidgetsAction = new QAction(QIcon::fromTheme("add"), i18n("Add Widgets..."), this);
m_addWidgetsAction = new QAction(QIcon::fromTheme("add"), i18n("&Add Widgets..."), this);
m_addWidgetsAction->setStatusTip(i18n("Show Plasma Widget Explorer"));
connect(m_addWidgetsAction, &QAction::triggered, [ = ]() {
QDBusInterface iface("org.kde.plasmashell", "/PlasmaShell", "", QDBusConnection::sessionBus());
@ -77,13 +77,19 @@ void Menu::makeActions()
}
});
m_configureAction = new QAction(QIcon::fromTheme("configure"), i18nc("view settings window", "View Settings..."), this);
m_configureAction->setShortcut(QKeySequence());
m_configureAction = new QAction(QIcon::fromTheme("configure"), i18nc("view settings window", "View &Settings..."), this);
connect(m_configureAction, &QAction::triggered, this, &Menu::requestConfiguration);
connect(this->containment(), &Plasma::Containment::userConfiguringChanged, this, [&](bool configuring){
m_configureAction->setVisible(!configuring);
// because sometimes it's disabled unexpectedly
// we should enable it
m_configureAction->setEnabled(true);
});
m_switchLayoutsMenu = new QMenu;
m_layoutsAction = m_switchLayoutsMenu->menuAction();
m_layoutsAction->setText(i18n("Layouts"));
m_layoutsAction->setText(i18n("&Layouts"));
m_layoutsAction->setIcon(QIcon::fromTheme("user-identity"));
m_layoutsAction->setStatusTip(i18n("Switch to another layout"));
@ -132,6 +138,9 @@ QList<QAction *> Menu::contextualActions()
viewType = static_cast<Latte::Types::ViewType>((m_data[2]).toInt());
}
const QString configureActionText = (viewType == Latte::Types::DockView) ? i18nc("dock settings window", "Dock &Settings...") : i18nc("panel settings window", "Panel &Settings...");
m_configureAction->setText(configureActionText);
return actions;
}