[Libreoffice-commits] core.git: 4 commits - svx/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed Oct 12 13:32:51 UTC 2016


 svx/source/dialog/SafeModeDialog.cxx |   39 ++++++++++++++++++++++++++++++++++-
 svx/source/dialog/SafeModeDialog.hxx |    4 +++
 svx/source/dialog/crashreportdlg.cxx |   22 +++++++++++--------
 svx/source/dialog/crashreportdlg.hxx |    2 +
 4 files changed, 57 insertions(+), 10 deletions(-)

New commits:
commit a8030ce8be1c6d7dca9159374fc875c7165b6e41
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Oct 12 15:27:14 2016 +0200

    CrashReportDialog: Enter safemode only after sending crash report
    
    Change-Id: I2c78431f839050ca74b082f7c790d0c59fba6513

diff --git a/svx/source/dialog/crashreportdlg.cxx b/svx/source/dialog/crashreportdlg.cxx
index 1692a44..ed56b67 100644
--- a/svx/source/dialog/crashreportdlg.cxx
+++ b/svx/source/dialog/crashreportdlg.cxx
@@ -60,6 +60,19 @@ void CrashReportDialog::dispose()
     Dialog::dispose();
 }
 
+bool CrashReportDialog::Close()
+{
+    // Check whether to go to safe mode
+    if (mpCBSafeMode->IsChecked())
+    {
+        sfx2::SafeMode::putFlag();
+        css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext())->requestRestart(
+            css::uno::Reference< css::task::XInteractionHandler >());
+    }
+
+    return Dialog::Close();
+}
+
 IMPL_LINK(CrashReportDialog, BtnHdl, Button*, pBtn, void)
 {
     if (pBtn == mpBtnSend.get())
@@ -101,15 +114,6 @@ IMPL_LINK(CrashReportDialog, BtnHdl, Button*, pBtn, void)
     {
         Close();
     }
-
-    // Check whether to go to safe mode
-    if (mpCBSafeMode->IsChecked())
-    {
-        sfx2::SafeMode::putFlag();
-        css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
-        css::task::OfficeRestartManager::get(xContext)->requestRestart(
-            css::uno::Reference< css::task::XInteractionHandler >());
-    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/crashreportdlg.hxx b/svx/source/dialog/crashreportdlg.hxx
index ecdd445..b001436 100644
--- a/svx/source/dialog/crashreportdlg.hxx
+++ b/svx/source/dialog/crashreportdlg.hxx
@@ -26,6 +26,8 @@ public:
 
     virtual void dispose() override;
 
+    virtual bool Close() override;
+
 private:
 
     VclPtr<Button> mpBtnSend;
commit a9b56780cec06ca9545b2ba554e405fe061fed57
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Oct 12 13:35:52 2016 +0200

    SafeModeDialog: Enable restart button only for active selections
    
    Change-Id: Ic5c9d1a0001e8324aa007c3f7bc0e58e13afbbbf

diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx
index 46e9d2f..1da58a0 100644
--- a/svx/source/dialog/SafeModeDialog.cxx
+++ b/svx/source/dialog/SafeModeDialog.cxx
@@ -35,6 +35,13 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent):
     mpBtnContinue->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl));
     mpBtnQuit->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl));
     mpBtnRestart->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl));
+
+    mpCBCustomizations->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
+    mpCBExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
+    mpCBFull->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
+
+    // Disable restart btn until some checkbox is active
+    mpBtnRestart->Disable();
 }
 
 SafeModeDialog::~SafeModeDialog()
@@ -94,4 +101,10 @@ IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void)
     }
 }
 
+IMPL_LINK(SafeModeDialog, CheckBoxHdl, CheckBox&, /*pCheckBox*/, void)
+{
+    bool bEnable = mpCBCustomizations->IsChecked() || mpCBExtensions->IsChecked() || mpCBFull->IsChecked();
+    mpBtnRestart->Enable(bEnable);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx
index 44e6b18..dd0036e 100644
--- a/svx/source/dialog/SafeModeDialog.hxx
+++ b/svx/source/dialog/SafeModeDialog.hxx
@@ -41,6 +41,7 @@ private:
     static void terminateOffice();
     static void applyChanges();
 
+    DECL_LINK(CheckBoxHdl, CheckBox&, void);
     DECL_LINK(BtnHdl, Button*, void);
 };
 
commit 9e30dcd46d2ad31be6a9dcafaa6505e8301b8694
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Oct 12 13:26:10 2016 +0200

    SafeModeDialog: Handle restart button event
    
    Change-Id: I6b55f79ea153aaeb8b67879bdafb6774fd91455c

diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx
index 9358177..46e9d2f 100644
--- a/svx/source/dialog/SafeModeDialog.cxx
+++ b/svx/source/dialog/SafeModeDialog.cxx
@@ -17,6 +17,8 @@
 
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/XDesktop2.hpp>
+#include <com/sun/star/task/OfficeRestartManager.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
 
 using namespace css;
 
@@ -66,6 +68,15 @@ void SafeModeDialog::terminateOffice()
     xDesktop->terminate();
 }
 
+void SafeModeDialog::applyChanges()
+{
+    // TODO: Apply apply changes
+
+    // Then restart
+    css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext())->requestRestart(
+        css::uno::Reference< css::task::XInteractionHandler >());
+}
+
 IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void)
 {
     if (pBtn == mpBtnContinue.get())
@@ -79,6 +90,7 @@ IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void)
     else if (pBtn == mpBtnRestart.get())
     {
         Close();
+        applyChanges();
     }
 }
 
diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx
index d91b50d..44e6b18 100644
--- a/svx/source/dialog/SafeModeDialog.hxx
+++ b/svx/source/dialog/SafeModeDialog.hxx
@@ -39,6 +39,7 @@ private:
     VclPtr<CheckBox> mpCBFull;
 
     static void terminateOffice();
+    static void applyChanges();
 
     DECL_LINK(BtnHdl, Button*, void);
 };
commit d1f01dd44813af7a10523b4d4a5171bcb12a8f5d
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Oct 12 13:01:15 2016 +0200

    SafeModeDialog: Handle quit button event
    
    Change-Id: Id24e9cb526bc0143a663e8d39a5dda59f929f8bf

diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx
index 549a62f..9358177 100644
--- a/svx/source/dialog/SafeModeDialog.cxx
+++ b/svx/source/dialog/SafeModeDialog.cxx
@@ -12,8 +12,14 @@
 #include <config_folders.h>
 #include <rtl/bootstrap.hxx>
 #include <osl/file.hxx>
+#include <comphelper/processfactory.hxx>
 #include <sfx2/safemode.hxx>
 
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
+
+using namespace css;
+
 SafeModeDialog::SafeModeDialog(vcl::Window* pParent):
     Dialog(pParent, "SafeModeDialog", "svx/ui/safemodedialog.ui")
 {
@@ -54,6 +60,12 @@ bool SafeModeDialog::Close()
     return Dialog::Close();
 }
 
+void SafeModeDialog::terminateOffice()
+{
+    uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create( comphelper::getProcessComponentContext() );
+    xDesktop->terminate();
+}
+
 IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void)
 {
     if (pBtn == mpBtnContinue.get())
@@ -62,7 +74,7 @@ IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void)
     }
     else if (pBtn == mpBtnQuit.get())
     {
-        Close();
+        terminateOffice();
     }
     else if (pBtn == mpBtnRestart.get())
     {
diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx
index 41acc1f..d91b50d 100644
--- a/svx/source/dialog/SafeModeDialog.hxx
+++ b/svx/source/dialog/SafeModeDialog.hxx
@@ -38,6 +38,8 @@ private:
     VclPtr<CheckBox> mpCBCustomizations;
     VclPtr<CheckBox> mpCBFull;
 
+    static void terminateOffice();
+
     DECL_LINK(BtnHdl, Button*, void);
 };
 


More information about the Libreoffice-commits mailing list