┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-06-28 18:42:51 +0000
committerPeter Penz <[email protected]>2008-06-28 18:42:51 +0000
commitc446e29bc39d136c913df87635a5c36b9f077b3e (patch)
treed9396aa2b445f5ee57ab0771b70b76235e11df32
parent15979f49c00ef380a1d19f38c0467283e5841ec5 (diff)
Don't check for "kompare" each time 2 items are selected (thanks to Andreas Scherf). As Albert Astals Cid pointed out it might be nicer to use a menu plugin instead of hardcoding "kompare" (> KDE 4.1).
CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=825587
-rw-r--r--src/dolphinmainwindow.cpp16
-rw-r--r--src/dolphinmainwindow.h2
2 files changed, 16 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()
{
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index 71d7b52d1..db8034139 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -383,6 +383,8 @@ private:
/** Returns the name of the tab for the URL \a url. */
QString tabName(const KUrl& url) const;
+ bool isKompareInstalled() const;
+
private:
/**
* Implements a custom error handling for the undo manager. This