┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorPiotr Henryk Dabrowski <[email protected]>2020-05-24 08:25:14 -0600
committerNate Graham <[email protected]>2020-05-24 08:26:25 -0600
commit29e6cf01df755724a629203964c9b61cd2f383c4 (patch)
tree0b4c59439a511886d9427a72d43a26e69a561ca9 /src/dolphinmainwindow.cpp
parent99cf24c03def1c0722ba8dbd86a27b9dbc521f43 (diff)
use KSycoca for updating OpenPreferredSearchTool action
Summary: Remove all random updates of OpenPreferredSearchTool action, and use KSycoca for updating it as discussed in https://phabricator.kde.org/D22594#663847 Enhancement for D29441 for bug #420911 caused by D22594. The bug was fixed by D29442. CCBUG: 420911 Test Plan: ``` $ cd ${KDE_INSTALL_DIR}/usr/share/applications $ sudo mv org.kde.kfind.desktop org.kde.kfind.desktop_ $ kbuildsycoca5 $ sudo mv org.kde.kfind.desktop_ org.kde.kfind.desktop $ kbuildsycoca5 ``` Reviewers: broulik, elvisangelaccio, ngraham, #dolphin Reviewed By: elvisangelaccio, #dolphin Subscribers: anthonyfieroni, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D29568
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp29
1 files changed, 4 insertions, 25 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index f374db41d..dd1dcdac5 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -65,6 +65,7 @@
#include <KShell>
#include <KStandardAction>
#include <KStartupInfo>
+#include <KSycoca>
#include <KToggleAction>
#include <KToolBar>
#include <KToolBarPopupAction>
@@ -203,7 +204,9 @@ DolphinMainWindow::DolphinMainWindow() :
setupWhatsThis();
- QTimer::singleShot(0, this, &DolphinMainWindow::setupUpdateOpenPreferredSearchToolAction);
+ connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
+
+ QTimer::singleShot(0, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
}
DolphinMainWindow::~DolphinMainWindow()
@@ -969,29 +972,6 @@ QPointer<QAction> DolphinMainWindow::preferredSearchTool()
return action;
}
-void DolphinMainWindow::setupUpdateOpenPreferredSearchToolAction()
-{
- QAction* openPreferredSearchTool = actionCollection()->action(QStringLiteral("open_preferred_search_tool"));
- const QList<QWidget*> widgets = openPreferredSearchTool->associatedWidgets();
- for (QWidget* widget : widgets) {
- QMenu* menu = qobject_cast<QMenu*>(widget);
- if (menu) {
- connect(menu, &QMenu::aboutToShow, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
- }
- }
-
- // Update the open_preferred_search_tool action *before* the Configure Shortcuts window is shown,
- // since this action is then listed in that window and it should be up-to-date when it is displayed.
- // This update is instantaneous if user made no changes to the search tools in the meantime.
- // Maybe all KStandardActions should defer calls to their slots, so that we could simply connect() to trigger()?
- connect(
- actionCollection()->action(KStandardAction::name(KStandardAction::KeyBindings)), &QAction::hovered,
- this, &DolphinMainWindow::updateOpenPreferredSearchToolAction
- );
-
- updateOpenPreferredSearchToolAction();
-}
-
void DolphinMainWindow::updateOpenPreferredSearchToolAction()
{
QAction* openPreferredSearchTool = actionCollection()->action(QStringLiteral("open_preferred_search_tool"));
@@ -1165,7 +1145,6 @@ void DolphinMainWindow::updateControlMenu()
addActionToMenu(ac->action(QStringLiteral("show_filter_bar")), menu);
addActionToMenu(ac->action(QStringLiteral("open_preferred_search_tool")), menu);
addActionToMenu(ac->action(QStringLiteral("open_terminal")), menu);
- connect(menu, &QMenu::aboutToShow, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
menu->addSeparator();