]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Use a faster way to determine kio-stash isn't installed
authorEike Hein <hein@kde.org>
Mon, 28 Dec 2020 16:57:44 +0000 (17:57 +0100)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Mon, 28 Dec 2020 16:59:14 +0000 (17:59 +0100)
Summary:
Dolphin needs to figure out whether or not kio-stash is installed
to set the enabled state of a UI action.

When KProtocolInfo::isKnownProtocol can't find a protocol it gets
worried its protocol cache might be out of date, so it rebuilds it
(doing plenty of disk I/O) and looks again. kio-stash is currently
not yet installed on many systems, so this means most Dolphin
startups out there.

This patch switches to using QDBusConnectionInterface::isServiceRegistered
instead to determine whether the stash notifier daemon is running,
which should be faster than doing disk I/O.

Reviewers: davidedmundson, elvisangelaccio, shortstheory

Subscribers: emmanuelp, alexeymin, ngraham, #dolphin

Differential Revision: https://phabricator.kde.org/D9094

src/dolphinmainwindow.cpp

index 96ca3d448eac67fb4d4a4783ee444f7b14eafcc0..096429f732a04eea28b0afaf0f9940d52a65fc13 100644 (file)
@@ -1523,7 +1523,7 @@ void DolphinMainWindow::setupActions()
     stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
     stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
     stashSplit->setCheckable(false);
-    stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash"));
+    stashSplit->setVisible(QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier")));
     connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash);
 
     KStandardAction::redisplay(this, &DolphinMainWindow::reloadView, actionCollection());