[Libreoffice-commits] core.git: cui/inc cui/source include/svtools svtools/source svtools/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 12 15:21:11 UTC 2018


 cui/inc/strings.hrc                      |    2 --
 cui/source/options/optopencl.cxx         |   19 ++++---------------
 include/svtools/restartdialog.hxx        |   25 +++++++++++++++----------
 svtools/source/dialogs/restartdialog.cxx |    3 +++
 svtools/uiconfig/ui/restartdialog.ui     |   17 ++++++++++++++++-
 5 files changed, 38 insertions(+), 28 deletions(-)

New commits:
commit 2b6bd096f5bd9d250e4590d7150190086ad282b2
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Dec 12 15:24:47 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Dec 12 16:20:47 2018 +0100

    tdf#104277 follow-up: use svtools::executeRestartDialog
    
    This harmonizes this setting's prompt with other places asking for restart.
    Related obsolete strings are removed.
    
    Change-Id: I2da63585747056714eb688681194acd35550e1c7
    Reviewed-on: https://gerrit.libreoffice.org/65022
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 7b4d692108c4..0359680e678d 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -317,7 +317,6 @@
 
 #define RID_SVXSTR_JRE_NOT_RECOGNIZED               NC_("RID_SVXSTR_JRE_NOT_RECOGNIZED", "The folder you selected does not contain a Java runtime environment.\nPlease select a different folder.")
 #define RID_SVXSTR_JRE_FAILED_VERSION               NC_("RID_SVXSTR_JRE_FAILED_VERSION", "The Java runtime environment you selected is not the required version.\nPlease select a different folder.")
-#define RID_SVXSTR_OPTIONS_RESTART                  NC_("RID_SVXSTR_OPTIONS_RESTART", "Please restart %PRODUCTNAME now so the new or modified values can take effect.")
 #define RID_SVXSTR_JAVA_START_PARAM                 NC_("RID_SVXSTR_JAVA_START_PARAM", "Edit Parameter")
 
 #define RID_SVXSTR_OPT_PROXYPORTS                   NC_("RID_SVXSTR_OPT_PROXYPORTS", "Invalid value!\n\nThe maximum value for a port number is 65535.")
@@ -391,7 +390,6 @@
 #define RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT          NC_("RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT", "Cast Shadow to Bottom Left")
 #define RID_SVXSTR_SHADOW_STYLE_TOPLEFT             NC_("RID_SVXSTR_SHADOW_STYLE_TOPLEFT", "Cast Shadow to Top Left")
 #define RID_SVXSTR_SIGNATURELINE_SIGNED_BY          NC_("RID_SVXSTR_SIGNATURELINE_SIGNED_BY", "Signed by: %1")
-#define RID_SVXSTR_OPENCL_RESTART                   NC_("RID_SVXSTR_OPENCL_RESTART", "For the OpenCL changes to take effect, %PRODUCTNAME must be restarted.")
 
 #define RID_SVXSTR_FILTER_ALL                       NC_("RID_SVXSTR_FILTER_ALL", "All files")
 
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index 816d09ccfcde..3535711e6f38 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -26,6 +26,7 @@
 #include <opencl/openclconfig.hxx>
 #include <opencl/openclwrapper.hxx>
 #include <officecfg/Office/Common.hxx>
+#include <svtools/restartdialog.hxx>
 #include <svtools/simptabl.hxx>
 #include "optHeaderTabListbox.hxx"
 
@@ -34,9 +35,6 @@
 #include <com/sun/star/ui/dialogs/FolderPicker.hpp>
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 #include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/task/OfficeRestartManager.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <strings.hrc>
 #include <dialmgr.hxx>
@@ -94,19 +92,10 @@ bool SvxOpenCLTabPage::FillItemSet( SfxItemSet* )
 
     if (bModified)
     {
-        std::unique_ptr<weld::MessageDialog> xWarnBox(Application::CreateMessageDialog(GetFrameWeld(),
-                                                      VclMessageType::Question, VclButtonsType::NONE,
-                                                      CuiResId(RID_SVXSTR_OPENCL_RESTART)));
-        xWarnBox->add_button("Restart Now",RET_YES);
-        xWarnBox->add_button("Restart Later",RET_NO);
-        sal_uInt16 nRet = xWarnBox->run();
         batch->commit();
-        if (nRet == RET_YES)
-        {
-            css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext())->requestRestart(
-            css::uno::Reference< css::task::XInteractionHandler >());
-        }
-
+        SolarMutexGuard aGuard;
+        svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr,
+                                      svtools::RESTART_REASON_OPENCL);
     }
 
     return bModified;
diff --git a/include/svtools/restartdialog.hxx b/include/svtools/restartdialog.hxx
index 750542a37459..29a7673d8dcd 100644
--- a/include/svtools/restartdialog.hxx
+++ b/include/svtools/restartdialog.hxx
@@ -23,37 +23,42 @@ namespace com { namespace sun { namespace star { namespace uno {
 namespace svtools {
 
 enum RestartReason {
-    RESTART_REASON_JAVA,
         // "For the selected Java runtime environment to work properly,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT,
+    RESTART_REASON_JAVA,
         // For the modified default print job format to take effect,
         // %PRODUCTNAME must be restarted.
-    RESTART_REASON_BIBLIOGRAPHY_INSTALL,
+    RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT,
         // "For the bibliography to work properly,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_MAILMERGE_INSTALL,
+    RESTART_REASON_BIBLIOGRAPHY_INSTALL,
         // "For the mail merge to work properly,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_LANGUAGE_CHANGE,
+    RESTART_REASON_MAILMERGE_INSTALL,
         // "For the updated language settings to take effect,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_ADDING_PATH,
+    RESTART_REASON_LANGUAGE_CHANGE,
         // "For the added path to take effect,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_ASSIGNING_JAVAPARAMETERS,
+    RESTART_REASON_ADDING_PATH,
         // "For the assigned java parameters to take effect,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_ASSIGNING_FOLDERS,
+    RESTART_REASON_ASSIGNING_JAVAPARAMETERS,
         // "For the assigned folders and archives to take effect,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_EXP_FEATURES,
+    RESTART_REASON_ASSIGNING_FOLDERS,
         // "For the modified experimental features to take effect,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_EXTENSION_INSTALL,
+    RESTART_REASON_EXP_FEATURES,
         // "For the extension to work properly,
         // %PRODUCTNAME must be restarted."
+    RESTART_REASON_EXTENSION_INSTALL,
+        // For the OpenGL changes to take effect,
+        // %PRODUCTNAME must be restarted.
     RESTART_REASON_OPENGL,
+        // For the OpenCL changes to take effect,
+        // %PRODUCTNAME must be restarted.
+    RESTART_REASON_OPENCL,
         // No particular reason
     RESTART_REASON_NONE
 };
diff --git a/svtools/source/dialogs/restartdialog.cxx b/svtools/source/dialogs/restartdialog.cxx
index 1de2e09cc014..460267c2dde3 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -62,6 +62,9 @@ public:
         case svtools::RESTART_REASON_OPENGL:
             reason_ = m_xBuilder->weld_widget("reason_opengl");
             break;
+        case svtools::RESTART_REASON_OPENCL:
+            reason_ = m_xBuilder->weld_widget("reason_opencl");
+            break;
         default:
             assert(false); // this cannot happen
         }
diff --git a/svtools/uiconfig/ui/restartdialog.ui b/svtools/uiconfig/ui/restartdialog.ui
index f9c4ebc95b28..ab8dfa14f69e 100644
--- a/svtools/uiconfig/ui/restartdialog.ui
+++ b/svtools/uiconfig/ui/restartdialog.ui
@@ -229,6 +229,21 @@
               </packing>
             </child>
             <child>
+              <object class="GtkLabel" id="reason_opencl">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes" context="restartdialog|reason_opencl">For the OpenCL changes to take effect, %PRODUCTNAME must be restarted.</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">50</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">11</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkLabel" id="label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -239,7 +254,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">11</property>
+                <property name="position">12</property>
               </packing>
             </child>
           </object>


More information about the Libreoffice-commits mailing list