diff options
-rw-r--r-- | cui/source/options/optinet2.cxx | 27 | ||||
-rw-r--r-- | cui/source/options/optinet2.hxx | 2 | ||||
-rw-r--r-- | cui/source/options/securityoptions.cxx | 96 | ||||
-rw-r--r-- | cui/source/options/securityoptions.hxx | 60 | ||||
-rw-r--r-- | cui/uiconfig/ui/securityoptionsdialog.ui | 26 |
5 files changed, 105 insertions, 106 deletions
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 99ddbae652e8..0118938f53b5 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -559,7 +559,6 @@ IMPL_STATIC_LINK( SvxProxyTabPage, LoseFocusHdl_Impl, Control&, rControl, void ) SvxSecurityTabPage::SvxSecurityTabPage(vcl::Window* pParent, const SfxItemSet& rSet) : SfxTabPage(pParent, "OptSecurityPage", "cui/ui/optsecuritypage.ui", &rSet) , mpSecOptions(new SvtSecurityOptions) - , mpSecOptDlg(nullptr) , mpCertPathDlg(nullptr) { get(m_pSecurityOptionsPB, "options"); @@ -611,7 +610,7 @@ void SvxSecurityTabPage::dispose() delete mpSecOptions; mpSecOptions = nullptr; mpCertPathDlg.disposeAndClear(); - mpSecOptDlg.clear(); + m_xSecOptDlg.reset(); m_pSecurityOptionsPB.clear(); m_pSavePasswordsCB.clear(); m_pShowConnectionsPB.clear(); @@ -630,9 +629,9 @@ void SvxSecurityTabPage::dispose() IMPL_LINK_NOARG(SvxSecurityTabPage, SecurityOptionsHdl, Button*, void) { - if ( !mpSecOptDlg ) - mpSecOptDlg = VclPtr<svx::SecurityOptionsDialog>::Create( this, mpSecOptions ); - mpSecOptDlg->Execute(); + if (!m_xSecOptDlg) + m_xSecOptDlg.reset(new svx::SecurityOptionsDialog(GetFrameWeld(), mpSecOptions)); + m_xSecOptDlg->run(); } IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl, Button*, void) @@ -898,16 +897,16 @@ bool SvxSecurityTabPage::FillItemSet( SfxItemSet* ) { bool bModified = false; - if ( mpSecOptDlg ) + if (m_xSecOptDlg) { - CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnSaveOrSend, mpSecOptDlg->IsSaveOrSendDocsChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnSigning, mpSecOptDlg->IsSignDocsChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnPrint, mpSecOptDlg->IsPrintDocsChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnCreatePdf, mpSecOptDlg->IsCreatePdfChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, mpSecOptDlg->IsRemovePersInfoChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnRecommendPassword, mpSecOptDlg->IsRecommPasswdChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::CtrlClickHyperlink, mpSecOptDlg->IsCtrlHyperlinkChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, mpSecOptDlg->IsBlockUntrustedRefererLinksChecked(), bModified ); + CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnSaveOrSend, m_xSecOptDlg->IsSaveOrSendDocsChecked(), bModified ); + CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnSigning, m_xSecOptDlg->IsSignDocsChecked(), bModified ); + CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnPrint, m_xSecOptDlg->IsPrintDocsChecked(), bModified ); + CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnCreatePdf, m_xSecOptDlg->IsCreatePdfChecked(), bModified ); + CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, m_xSecOptDlg->IsRemovePersInfoChecked(), bModified ); + CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnRecommendPassword, m_xSecOptDlg->IsRecommPasswdChecked(), bModified ); + CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::CtrlClickHyperlink, m_xSecOptDlg->IsCtrlHyperlinkChecked(), bModified ); + CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, m_xSecOptDlg->IsBlockUntrustedRefererLinksChecked(), bModified ); } return bModified; diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx index 634975e91f6b..cd402a4513bd 100644 --- a/cui/source/options/optinet2.hxx +++ b/cui/source/options/optinet2.hxx @@ -127,7 +127,7 @@ private: VclPtr<PushButton> m_pTSAURLsPB; SvtSecurityOptions* mpSecOptions; - VclPtr<svx::SecurityOptionsDialog> mpSecOptDlg; + std::unique_ptr<svx::SecurityOptionsDialog> m_xSecOptDlg; VclPtr<CertPathDialog> mpCertPathDlg; diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx index 8bf3c66d0a39..ab4b1dd3d5a7 100644 --- a/cui/source/options/securityoptions.cxx +++ b/cui/source/options/securityoptions.cxx @@ -18,74 +18,64 @@ */ #include <unotools/securityoptions.hxx> +#include <vcl/svapp.hxx> #include <dialmgr.hxx> #include "securityoptions.hxx" namespace { - bool enableAndSet( const SvtSecurityOptions& rOptions, - SvtSecurityOptions::EOption eOption, - CheckBox& rCheckBox, FixedImage& rFixedImage ) + bool enableAndSet(const SvtSecurityOptions& rOptions, + SvtSecurityOptions::EOption eOption, + weld::CheckButton& rCheckBox, weld::Widget& rFixedImage) { - bool bEnable = rOptions.IsOptionEnabled( eOption ); - rCheckBox.Enable( bEnable ); - rFixedImage.Show( !bEnable ); - rCheckBox.Check( rOptions.IsOptionSet( eOption ) ); + bool bEnable = rOptions.IsOptionEnabled(eOption); + rCheckBox.set_sensitive(bEnable); + rFixedImage.show(!bEnable); + rCheckBox.set_active(rOptions.IsOptionSet(eOption)); return bEnable; } } - namespace svx { - -SecurityOptionsDialog::SecurityOptionsDialog(vcl::Window* pParent, SvtSecurityOptions const * pOptions) - : ModalDialog(pParent, "SecurityOptionsDialog", "cui/ui/securityoptionsdialog.ui") +SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent, SvtSecurityOptions const * pOptions) + : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/securityoptionsdialog.ui")) + , m_xDialog(m_xBuilder->weld_dialog("SecurityOptionsDialog")) + , m_xSaveOrSendDocsCB(m_xBuilder->weld_check_button("savesenddocs")) + , m_xSaveOrSendDocsImg(m_xBuilder->weld_widget("locksavesenddocs")) + , m_xSignDocsCB(m_xBuilder->weld_check_button("whensigning")) + , m_xSignDocsImg(m_xBuilder->weld_widget("lockwhensigning")) + , m_xPrintDocsCB(m_xBuilder->weld_check_button("whenprinting")) + , m_xPrintDocsImg(m_xBuilder->weld_widget("lockwhenprinting")) + , m_xCreatePdfCB(m_xBuilder->weld_check_button("whenpdf")) + , m_xCreatePdfImg(m_xBuilder->weld_widget("lockwhenpdf")) + , m_xRemovePersInfoCB(m_xBuilder->weld_check_button("removepersonal")) + , m_xRemovePersInfoImg(m_xBuilder->weld_widget("lockremovepersonal")) + , m_xRecommPasswdCB(m_xBuilder->weld_check_button("password")) + , m_xRecommPasswdImg(m_xBuilder->weld_widget("lockpassword")) + , m_xCtrlHyperlinkCB(m_xBuilder->weld_check_button("ctrlclick")) + , m_xCtrlHyperlinkImg(m_xBuilder->weld_widget("lockctrlclick")) + , m_xBlockUntrustedRefererLinksCB(m_xBuilder->weld_check_button("blockuntrusted")) + , m_xBlockUntrustedRefererLinksImg(m_xBuilder->weld_widget("lockblockuntrusted")) { DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" ); - get(m_pSaveOrSendDocsCB, "savesenddocs"); - enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnSaveOrSend, *m_pSaveOrSendDocsCB, - *get<FixedImage>("locksavesenddocs")); - get(m_pSignDocsCB, "whensigning"); - enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnSigning, *m_pSignDocsCB, - *get<FixedImage>("lockwhensigning")); - get(m_pPrintDocsCB, "whenprinting"); - enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnPrint, *m_pPrintDocsCB, - *get<FixedImage>("lockwhenprinting")); - get(m_pCreatePdfCB, "whenpdf"); - enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnCreatePdf, *m_pCreatePdfCB, - *get<FixedImage>("lockwhenpdf")); - get(m_pRemovePersInfoCB, "removepersonal"); - enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, *m_pRemovePersInfoCB, - *get<FixedImage>("lockremovepersonal")); - get(m_pRecommPasswdCB, "password"); - enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnRecommendPassword, *m_pRecommPasswdCB, - *get<FixedImage>("lockpassword")); - get(m_pCtrlHyperlinkCB, "ctrlclick"); - enableAndSet(*pOptions, SvtSecurityOptions::EOption::CtrlClickHyperlink, *m_pCtrlHyperlinkCB, - *get<FixedImage>("lockctrlclick")); - get(m_pBlockUntrustedRefererLinksCB, "blockuntrusted"); - enableAndSet(*pOptions, SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, *m_pBlockUntrustedRefererLinksCB, - *get<FixedImage>("lockblockuntrusted")); -} - -SecurityOptionsDialog::~SecurityOptionsDialog() -{ - disposeOnce(); -} - -void SecurityOptionsDialog::dispose() -{ - m_pSaveOrSendDocsCB.clear(); - m_pSignDocsCB.clear(); - m_pPrintDocsCB.clear(); - m_pCreatePdfCB.clear(); - m_pRemovePersInfoCB.clear(); - m_pRecommPasswdCB.clear(); - m_pCtrlHyperlinkCB.clear(); - m_pBlockUntrustedRefererLinksCB.clear(); - ModalDialog::dispose(); + enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnSaveOrSend, *m_xSaveOrSendDocsCB, + *m_xSaveOrSendDocsImg); + enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnSigning, *m_xSignDocsCB, + *m_xSignDocsImg); + enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnPrint, *m_xPrintDocsCB, + *m_xPrintDocsImg); + enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnCreatePdf, *m_xCreatePdfCB, + *m_xCreatePdfImg); + enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, *m_xRemovePersInfoCB, + *m_xRemovePersInfoImg); + enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnRecommendPassword, *m_xRecommPasswdCB, + *m_xRecommPasswdImg); + enableAndSet(*pOptions, SvtSecurityOptions::EOption::CtrlClickHyperlink, *m_xCtrlHyperlinkCB, + *m_xCtrlHyperlinkImg); + enableAndSet(*pOptions, SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, *m_xBlockUntrustedRefererLinksCB, + *m_xBlockUntrustedRefererLinksImg); } } diff --git a/cui/source/options/securityoptions.hxx b/cui/source/options/securityoptions.hxx index 8665416f971b..f88e8164ca2e 100644 --- a/cui/source/options/securityoptions.hxx +++ b/cui/source/options/securityoptions.hxx @@ -19,49 +19,53 @@ #ifndef INCLUDED_CUI_SOURCE_OPTIONS_SECURITYOPTIONS_HXX #define INCLUDED_CUI_SOURCE_OPTIONS_SECURITYOPTIONS_HXX -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/fixed.hxx> - +#include <vcl/weld.hxx> class SvtSecurityOptions; - namespace svx { - class SecurityOptionsDialog : public ModalDialog + class SecurityOptionsDialog { private: - VclPtr<CheckBox> m_pSaveOrSendDocsCB; - VclPtr<CheckBox> m_pSignDocsCB; - VclPtr<CheckBox> m_pPrintDocsCB; - VclPtr<CheckBox> m_pCreatePdfCB; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Dialog> m_xDialog; - VclPtr<CheckBox> m_pRemovePersInfoCB; - VclPtr<CheckBox> m_pRecommPasswdCB; - VclPtr<CheckBox> m_pCtrlHyperlinkCB; - VclPtr<CheckBox> m_pBlockUntrustedRefererLinksCB; + std::unique_ptr<weld::CheckButton> m_xSaveOrSendDocsCB; + std::unique_ptr<weld::Widget> m_xSaveOrSendDocsImg; + std::unique_ptr<weld::CheckButton> m_xSignDocsCB; + std::unique_ptr<weld::Widget> m_xSignDocsImg; + std::unique_ptr<weld::CheckButton> m_xPrintDocsCB; + std::unique_ptr<weld::Widget> m_xPrintDocsImg; + std::unique_ptr<weld::CheckButton> m_xCreatePdfCB; + std::unique_ptr<weld::Widget> m_xCreatePdfImg; - public: - SecurityOptionsDialog( vcl::Window* pParent, SvtSecurityOptions const * pOptions ); - virtual ~SecurityOptionsDialog() override; - virtual void dispose() override; + std::unique_ptr<weld::CheckButton> m_xRemovePersInfoCB; + std::unique_ptr<weld::Widget> m_xRemovePersInfoImg; + std::unique_ptr<weld::CheckButton> m_xRecommPasswdCB; + std::unique_ptr<weld::Widget> m_xRecommPasswdImg; + std::unique_ptr<weld::CheckButton> m_xCtrlHyperlinkCB; + std::unique_ptr<weld::Widget> m_xCtrlHyperlinkImg; + std::unique_ptr<weld::CheckButton> m_xBlockUntrustedRefererLinksCB; + std::unique_ptr<weld::Widget> m_xBlockUntrustedRefererLinksImg; - bool IsSaveOrSendDocsChecked() const { return m_pSaveOrSendDocsCB->IsChecked(); } - bool IsSignDocsChecked() const { return m_pSignDocsCB->IsChecked(); } - bool IsPrintDocsChecked() const { return m_pPrintDocsCB->IsChecked(); } - bool IsCreatePdfChecked() const { return m_pCreatePdfCB->IsChecked(); } - bool IsRemovePersInfoChecked() const { return m_pRemovePersInfoCB->IsChecked(); } - bool IsRecommPasswdChecked() const { return m_pRecommPasswdCB->IsChecked(); } - bool IsCtrlHyperlinkChecked() const { return m_pCtrlHyperlinkCB->IsChecked(); } - bool IsBlockUntrustedRefererLinksChecked() const { return m_pBlockUntrustedRefererLinksCB->IsChecked(); } - }; + public: + SecurityOptionsDialog(weld::Window* pParent, SvtSecurityOptions const * pOptions); + short run() { return m_xDialog->run(); } + bool IsSaveOrSendDocsChecked() const { return m_xSaveOrSendDocsCB->get_active(); } + bool IsSignDocsChecked() const { return m_xSignDocsCB->get_active(); } + bool IsPrintDocsChecked() const { return m_xPrintDocsCB->get_active(); } + bool IsCreatePdfChecked() const { return m_xCreatePdfCB->get_active(); } + bool IsRemovePersInfoChecked() const { return m_xRemovePersInfoCB->get_active(); } + bool IsRecommPasswdChecked() const { return m_xRecommPasswdCB->get_active(); } + bool IsCtrlHyperlinkChecked() const { return m_xCtrlHyperlinkCB->get_active(); } + bool IsBlockUntrustedRefererLinksChecked() const { return m_xBlockUntrustedRefererLinksCB->get_active(); } + }; } - #endif // INCLUDED_CUI_SOURCE_OPTIONS_SECURITYOPTIONS_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/uiconfig/ui/securityoptionsdialog.ui b/cui/uiconfig/ui/securityoptionsdialog.ui index 87642daf616a..2030a527d09a 100644 --- a/cui/uiconfig/ui/securityoptionsdialog.ui +++ b/cui/uiconfig/ui/securityoptionsdialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="cui"> <requires lib="gtk+" version="3.0"/> <object class="GtkDialog" id="SecurityOptionsDialog"> @@ -7,6 +7,9 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="securityoptionsdialog|SecurityOptionsDialog">Security Options and Warnings</property> <property name="resizable">False</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -166,7 +169,7 @@ <property name="no_show_all">True</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">res/lock.png</property> + <property name="icon_name">res/lock.png</property> </object> <packing> <property name="left_attach">0</property> @@ -179,7 +182,7 @@ <property name="no_show_all">True</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">res/lock.png</property> + <property name="icon_name">res/lock.png</property> </object> <packing> <property name="left_attach">0</property> @@ -192,7 +195,7 @@ <property name="no_show_all">True</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">res/lock.png</property> + <property name="icon_name">res/lock.png</property> </object> <packing> <property name="left_attach">2</property> @@ -205,7 +208,7 @@ <property name="no_show_all">True</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">res/lock.png</property> + <property name="icon_name">res/lock.png</property> </object> <packing> <property name="left_attach">2</property> @@ -223,8 +226,8 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="securityoptionsdialog|label3">Warn if document contains recorded changes, versions, hidden information or notes:</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -341,7 +344,7 @@ <property name="no_show_all">True</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">res/lock.png</property> + <property name="icon_name">res/lock.png</property> </object> <packing> <property name="left_attach">0</property> @@ -353,7 +356,7 @@ <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">res/lock.png</property> + <property name="icon_name">res/lock.png</property> </object> <packing> <property name="left_attach">0</property> @@ -365,7 +368,7 @@ <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">res/lock.png</property> + <property name="icon_name">res/lock.png</property> </object> <packing> <property name="left_attach">0</property> @@ -377,7 +380,7 @@ <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">res/lock.png</property> + <property name="icon_name">res/lock.png</property> </object> <packing> <property name="left_attach">0</property> @@ -419,5 +422,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |