┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 57926d33e..14c086339 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -209,8 +209,7 @@ void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
QAction* compareFilesAction = actionCollection()->action("compare_files");
if (selectedUrlsCount == 2) {
- const bool kompareInstalled = !KGlobal::dirs()->findExe("kompare").isEmpty();
- compareFilesAction->setEnabled(selectedUrlsCount == 2 && kompareInstalled);
+ compareFilesAction->setEnabled(isKompareInstalled());
} else {
compareFilesAction->setEnabled(false);
}
@@ -1210,6 +1209,19 @@ QString DolphinMainWindow::tabName(const KUrl& url) const
return name;
}
+bool DolphinMainWindow::isKompareInstalled() const
+{
+ static bool initialized = false;
+ static bool installed = false;
+ if (!initialized) {
+ // TODO: maybe replace this approach later by using a menu
+ // plugin like kdiff3plugin.cpp
+ installed = !KGlobal::dirs()->findExe("kompare").isEmpty();
+ initialized = true;
+ }
+ return installed;
+}
+
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
KIO::FileUndoManager::UiInterface()
{