From db15f8b24366a66529050c181ab78fcfb9917104 Mon Sep 17 00:00:00 2001 From: Albert Mkhitaryan Date: Mon, 2 Mar 2026 10:50:33 +0000 Subject: contextmenusettingspage: add hint for context menu shortcuts in contex menu settings page * added link button in Context Menu Settings to Shortcuts for Context Menu Actions as shown below * removed the text above the search bar, which said "Select which services should be shown in the context menu:" since the check-boxes are clear enough * instead of "Download New Services" the link to download services now just says "Download Services" for brevity. ![context_menu_text_buttons.png](/uploads/1af045ab8aae9daf527b30cf1b1dcbba/context_menu_text_buttons.png){width="602" height="600"} before: ![image.png](/uploads/08615dfcc102880f8e5cb080f2491c9c/image.png){width=768 height=600} --- .../contextmenu/contextmenusettingspage.cpp | 46 +++++++++++++--------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'src/settings/contextmenu/contextmenusettingspage.cpp') diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp index eaa636db4..9c29e77f4 100644 --- a/src/settings/contextmenu/contextmenusettingspage.cpp +++ b/src/settings/contextmenu/contextmenusettingspage.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -53,16 +55,36 @@ ContextMenuSettingsPage::ContextMenuSettingsPage(QWidget *parent, const KActionC { QVBoxLayout *topLayout = new QVBoxLayout(this); - QLabel *label = new QLabel(i18nc("@label:textbox", - "Select which services should " - "be shown in the context menu:"), - this); - label->setWordWrap(true); + auto *searchLayout = new QHBoxLayout(); m_searchLineEdit = new QLineEdit(this); m_searchLineEdit->setPlaceholderText(i18nc("@label:textbox", "Search…")); connect(m_searchLineEdit, &QLineEdit::textChanged, this, [this](const QString &filter) { m_sortModel->setFilterFixedString(filter); }); + searchLayout->addWidget(m_searchLineEdit); + +#ifndef Q_OS_WIN + using NewStuffButton = KNSWidgets::Button; + auto *downloadButton = new NewStuffButton(i18nc("@action:button", "Download Services…"), QStringLiteral("servicemenu.knsrc"), this); + connect(downloadButton, &NewStuffButton::dialogFinished, this, [this](const auto &changedEntries) { + if (!changedEntries.isEmpty()) { + m_serviceModel->clear(); + loadServices(); + } + }); + searchLayout->addWidget(downloadButton); +#endif // Q_OS_WIN + +#if KIO_VERSION >= QT_VERSION_CHECK(6, 24, 0) + auto *shortcutsButton = new QPushButton(QIcon::fromTheme(QStringLiteral("configure-shortcuts")), i18nc("@action:button", "Shortcuts…"), this); + connect(shortcutsButton, &QPushButton::clicked, this, [this] { + if (auto *action = m_actions->action(KStandardAction::name(KStandardAction::KeyBindings))) { + action->trigger(); + } + }); + searchLayout->addWidget(shortcutsButton); +#endif + topLayout->addLayout(searchLayout); m_listView = new QListView(this); QScroller::grabGesture(m_listView->viewport(), QScroller::TouchGesture); @@ -78,22 +100,8 @@ ContextMenuSettingsPage::ContextMenuSettingsPage(QWidget *parent, const KActionC m_listView->setVerticalScrollMode(QListView::ScrollPerPixel); connect(m_listView, &QListView::clicked, this, &ContextMenuSettingsPage::changed); - topLayout->addWidget(label); - topLayout->addWidget(m_searchLineEdit); topLayout->addWidget(m_listView); -#ifndef Q_OS_WIN - using NewStuffButton = KNSWidgets::Button; - auto *downloadButton = new NewStuffButton(i18nc("@action:button", "Download New Services…"), QStringLiteral("servicemenu.knsrc"), this); - connect(downloadButton, &NewStuffButton::dialogFinished, this, [this](const auto &changedEntries) { - if (!changedEntries.isEmpty()) { - m_serviceModel->clear(); - loadServices(); - } - }); - topLayout->addWidget(downloadButton); -#endif // Q_OS_WIN - m_enabledVcsPlugins = VersionControlSettings::enabledPlugins(); std::sort(m_enabledVcsPlugins.begin(), m_enabledVcsPlugins.end()); } -- cgit v1.3