]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Currently, when changing Version Control settings in Configure -> Context Menu, it
authorBlaster goo <blastergoo@outlook.com>
Mon, 11 Oct 2021 17:41:42 +0000 (17:41 +0000)
committerNate Graham <nate@kde.org>
Mon, 11 Oct 2021 17:41:42 +0000 (17:41 +0000)
tells you to restart to apply those settings. This commit changes that by asking you
if you would like to restart now or later.

FEATURE: 441192
FIXED-IN: 21.12

src/settings/contextmenu/contextmenusettingspage.cpp

index c92bad43e61b70cc7925c9a8fd928f5b9135c3b6..8ebac2e12242f15dcb7efe10ebe28e4d2e7fcae8 100644 (file)
@@ -11,6 +11,7 @@
 #include "dolphin_contextmenusettings.h"
 #include "settings/serviceitemdelegate.h"
 #include "settings/servicemodel.h"
+#include "global.h"
 
 #include <KDesktopFile>
 #include <KLocalizedString>
@@ -30,6 +31,7 @@
 #include <QShowEvent>
 #include <QSortFilterProxyModel>
 #include <QLineEdit>
+#include <QApplication>
 
 namespace
 {
@@ -37,6 +39,8 @@ namespace
     const char VersionControlServicePrefix[] = "_version_control_";
     const char DeleteService[] = "_delete";
     const char CopyToMoveToService[] ="_copy_to_move_to";
+
+    bool laterSelected = false;
 }
 
 ContextMenuSettingsPage::ContextMenuSettingsPage(QWidget* parent,
@@ -192,11 +196,21 @@ void ContextMenuSettingsPage::applySettings()
         VersionControlSettings::setEnabledPlugins(enabledPlugins);
         VersionControlSettings::self()->save();
 
-        KMessageBox::information(window(),
-                                 i18nc("@info", "Dolphin must be restarted to apply the "
-                                                "updated version control systems settings."),
-                                 QString(), // default title
-                                 QStringLiteral("ShowVcsRestartInformation"));
+        if (!laterSelected) {
+            KMessageBox::ButtonCode promptRestart = KMessageBox::questionYesNo(window(),
+                                    i18nc("@info", "Dolphin must be restarted to apply the "
+                                                "updated version control system settings."),
+                                    i18nc("@info", "Restart now?"),
+                                    KGuiItem(QApplication::translate("KStandardGuiItem", "&Restart"), QStringLiteral("dialog-restart")),
+                                    KGuiItem(QApplication::translate("KStandardGuiItem", "&Later"), QStringLiteral("dialog-later"))
+                        );
+            if (promptRestart == KMessageBox::ButtonCode::Yes) {
+                Dolphin::openNewWindow();
+                qApp->quit();
+            } else {
+                laterSelected = true;
+            }
+        }
     }
 }