From 73082d2e42180d3795014738499109c839705622 Mon Sep 17 00:00:00 2001 From: Blaster goo Date: Mon, 11 Oct 2021 17:41:42 +0000 Subject: [PATCH] Currently, when changing Version Control settings in Configure -> Context Menu, it 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 --- .../contextmenu/contextmenusettingspage.cpp | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp index c92bad43e..8ebac2e12 100644 --- a/src/settings/contextmenu/contextmenusettingspage.cpp +++ b/src/settings/contextmenu/contextmenusettingspage.cpp @@ -11,6 +11,7 @@ #include "dolphin_contextmenusettings.h" #include "settings/serviceitemdelegate.h" #include "settings/servicemodel.h" +#include "global.h" #include #include @@ -30,6 +31,7 @@ #include #include #include +#include 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; + } + } } } -- 2.47.3