summarylogtreecommitdiffstats
path: root/dolphin-meld.patch
blob: 6e2a45e993dbe4f7614599852c7d0719d2cffe58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 5741e8943..63253e681 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -330,7 +330,7 @@ void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
     const int selectedUrlsCount = m_tabWidget->currentTabPage()->selectedItemsCount();
 
     QAction* compareFilesAction = actionCollection()->action(QStringLiteral("compare_files"));
-    if (selectedUrlsCount == 2) {
+    if (selectedUrlsCount == 2 || selectedUrlsCount == 3) {
         compareFilesAction->setEnabled(isKompareInstalled());
     } else {
         compareFilesAction->setEnabled(false);
@@ -925,7 +925,7 @@ void DolphinMainWindow::goHomeInNewTab()
 void DolphinMainWindow::compareFiles()
 {
     const KFileItemList items = m_tabWidget->currentTabPage()->selectedItems();
-    if (items.count() != 2) {
+    if (items.count() != 2 && items.count() != 3) {
         // The action is disabled in this case, but it could have been triggered
         // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
         return;
@@ -934,14 +934,20 @@ void DolphinMainWindow::compareFiles()
     QUrl urlA = items.at(0).url();
     QUrl urlB = items.at(1).url();
 
-    QString command(QStringLiteral("kompare -c \""));
+    QString command(QStringLiteral("meld \""));
     command.append(urlA.toDisplayString(QUrl::PreferLocalFile));
     command.append("\" \"");
     command.append(urlB.toDisplayString(QUrl::PreferLocalFile));
     command.append('\"');
+    if (items.count() == 3) {
+        QUrl urlC = items.at(2).url();
+        command.append(" \"");
+        command.append(urlC.toDisplayString(QUrl::PreferLocalFile));
+        command.append('\"');
+    }
 
     KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(command, this);
-    job->setDesktopName(QStringLiteral("org.kde.kompare"));
+    job->setDesktopName(QStringLiteral("org.gnome.meld"));
     job->start();
 }
 
@@ -1549,7 +1555,7 @@ void DolphinMainWindow::setupActions()
 
     QAction* compareFiles = actionCollection()->addAction(QStringLiteral("compare_files"));
     compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files"));
-    compareFiles->setIcon(QIcon::fromTheme(QStringLiteral("kompare")));
+    compareFiles->setIcon(QIcon::fromTheme(QStringLiteral("meld")));
     compareFiles->setEnabled(false);
     connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles);
 
@@ -2151,7 +2157,7 @@ bool DolphinMainWindow::isKompareInstalled() const
     if (!initialized) {
         // TODO: maybe replace this approach later by using a menu
         // plugin like kdiff3plugin.cpp
-        installed = !QStandardPaths::findExecutable(QStringLiteral("kompare")).isEmpty();
+        installed = !QStandardPaths::findExecutable(QStringLiteral("meld")).isEmpty();
         initialized = true;
     }
     return installed;