From 9f9e195dbabe07244622924bf609ab4676f16993 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Wed, 18 Oct 2023 11:05:50 +0200 Subject: tdf#157484 UI: Add UI controls for personal information to be kept or removed upon save. With the new options button we can keep the security infos upon save such as (even if we set the remove personal infos): - RedLine Info - Document User Info - Author and date of notes - Document version infos Also on the infobar, if we have a warning, clicking on the infobar button the security option dialog will open where we can set/modify these options. follow-up of: 1f440348eb0892fd2c9597806d87b5fe9d60d49a (tdf#157482 UI: Turn Security Warnings popup windows into infobars) Change-Id: I8d5d944d76dbdd31653401246113de097ca6d57b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158112 Tested-by: Jenkins Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen --- cui/source/options/optinet2.cxx | 4 + cui/source/options/securityoptions.cxx | 39 +++ cui/source/options/securityoptions.hxx | 20 +- cui/uiconfig/ui/securityoptionsdialog.ui | 406 ++++++++++++++++++++----------- 4 files changed, 325 insertions(+), 144 deletions(-) (limited to 'cui') diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 22cd480eb6a2..8ca6a5488a78 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -897,6 +897,10 @@ bool SvxSecurityTabPage::FillItemSet( SfxItemSet* ) CheckAndSave( SvtSecurityOptions::EOption::DocWarnPrint, m_xSecOptDlg->IsPrintDocsChecked(), bModified ); CheckAndSave( SvtSecurityOptions::EOption::DocWarnCreatePdf, m_xSecOptDlg->IsCreatePdfChecked(), bModified ); CheckAndSave( SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, m_xSecOptDlg->IsRemovePersInfoChecked(), bModified ); + CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo, m_xSecOptDlg->IsRemoveRedlineInfoChecked(), bModified ); + CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo, m_xSecOptDlg->IsRemoveDocUserInfoChecked(), bModified ); + CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo, m_xSecOptDlg->IsRemoveNoteAuthorInfoChecked(), bModified ); + CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo, m_xSecOptDlg->IsRemoveDocVersionInfoChecked(), bModified ); CheckAndSave( SvtSecurityOptions::EOption::DocWarnRecommendPassword, m_xSecOptDlg->IsRecommPasswdChecked(), bModified ); CheckAndSave( SvtSecurityOptions::EOption::CtrlClickHyperlink, m_xSecOptDlg->IsCtrlHyperlinkChecked(), bModified ); CheckAndSave( SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, m_xSecOptDlg->IsBlockUntrustedRefererLinksChecked(), bModified ); diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx index 4b00176ab490..d583f626183e 100644 --- a/cui/source/options/securityoptions.cxx +++ b/cui/source/options/securityoptions.cxx @@ -54,6 +54,25 @@ SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent) , m_xCtrlHyperlinkImg(m_xBuilder->weld_widget("lockctrlclick")) , m_xBlockUntrustedRefererLinksCB(m_xBuilder->weld_check_button("blockuntrusted")) , m_xBlockUntrustedRefererLinksImg(m_xBuilder->weld_widget("lockblockuntrusted")) + , m_xRedlineinfoCB(m_xBuilder->weld_check_button("redlineinfo")) + , m_xRedlineinfoImg(m_xBuilder->weld_widget("lockredlineinfo")) + , m_xDocPropertiesCB(m_xBuilder->weld_check_button("docproperties")) + , m_xDocPropertiesImg(m_xBuilder->weld_widget("lockdocproperties")) + , m_xNoteAuthorCB(m_xBuilder->weld_check_button("noteauthor")) + , m_xNoteAuthorImg(m_xBuilder->weld_widget("locknoteauthor")) + , m_xDocumentVersionCB(m_xBuilder->weld_check_button("documentversion")) + , m_xDocumentVersionImg(m_xBuilder->weld_widget("lockdocumentversion")) +{ + m_xRemovePersInfoCB->connect_toggled(LINK(this, SecurityOptionsDialog, ShowPersonalInfosToggle)); + init(); +} + +IMPL_LINK_NOARG(SecurityOptionsDialog, ShowPersonalInfosToggle, weld::Toggleable&, void) +{ + changeKeepSecurityInfosEnabled(); +} + +void SecurityOptionsDialog::init() { enableAndSet(SvtSecurityOptions::EOption::DocWarnSaveOrSend, *m_xSaveOrSendDocsCB, *m_xSaveOrSendDocsImg); @@ -65,12 +84,32 @@ SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent) *m_xCreatePdfImg); enableAndSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, *m_xRemovePersInfoCB, *m_xRemovePersInfoImg); + enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo, *m_xRedlineinfoCB, + *m_xRedlineinfoImg); + enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo, *m_xDocPropertiesCB, + *m_xDocPropertiesImg); + enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo, *m_xNoteAuthorCB, + *m_xNoteAuthorImg); + enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo, *m_xDocumentVersionCB, + *m_xDocumentVersionImg); enableAndSet(SvtSecurityOptions::EOption::DocWarnRecommendPassword, *m_xRecommPasswdCB, *m_xRecommPasswdImg); enableAndSet(SvtSecurityOptions::EOption::CtrlClickHyperlink, *m_xCtrlHyperlinkCB, *m_xCtrlHyperlinkImg); enableAndSet(SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, *m_xBlockUntrustedRefererLinksCB, *m_xBlockUntrustedRefererLinksImg); + + if (!SvtSecurityOptions::IsReadOnly(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo)) + changeKeepSecurityInfosEnabled(); +} + +void SecurityOptionsDialog::changeKeepSecurityInfosEnabled() +{ + bool bEnable = m_xRemovePersInfoCB->get_active(); + m_xRedlineinfoCB->set_sensitive(bEnable); + m_xDocPropertiesCB->set_sensitive(bEnable); + m_xNoteAuthorCB->set_sensitive(bEnable); + m_xDocumentVersionCB->set_sensitive(bEnable); } } diff --git a/cui/source/options/securityoptions.hxx b/cui/source/options/securityoptions.hxx index dc05f5bb8150..7884ccfbd30e 100644 --- a/cui/source/options/securityoptions.hxx +++ b/cui/source/options/securityoptions.hxx @@ -22,7 +22,6 @@ namespace svx { - class SecurityOptionsDialog : public weld::GenericDialogController { private: @@ -44,17 +43,36 @@ namespace svx std::unique_ptr m_xBlockUntrustedRefererLinksCB; std::unique_ptr m_xBlockUntrustedRefererLinksImg; + std::unique_ptr m_xRedlineinfoCB; + std::unique_ptr m_xRedlineinfoImg; + std::unique_ptr m_xDocPropertiesCB; + std::unique_ptr m_xDocPropertiesImg; + std::unique_ptr m_xNoteAuthorCB; + std::unique_ptr m_xNoteAuthorImg; + std::unique_ptr m_xDocumentVersionCB; + std::unique_ptr m_xDocumentVersionImg; + public: SecurityOptionsDialog(weld::Window* pParent); + void init(); + 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 IsRemoveRedlineInfoChecked() const { return m_xRedlineinfoCB->get_active(); } + bool IsRemoveDocUserInfoChecked() const { return m_xDocPropertiesCB->get_active(); } + bool IsRemoveNoteAuthorInfoChecked() const { return m_xNoteAuthorCB->get_active(); } + bool IsRemoveDocVersionInfoChecked() const { return m_xDocumentVersionCB->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(); } + + DECL_LINK(ShowPersonalInfosToggle, weld::Toggleable&, void); + + void changeKeepSecurityInfosEnabled(); }; } diff --git a/cui/uiconfig/ui/securityoptionsdialog.ui b/cui/uiconfig/ui/securityoptionsdialog.ui index 6367621a68b5..c6f9221a6053 100644 --- a/cui/uiconfig/ui/securityoptionsdialog.ui +++ b/cui/uiconfig/ui/securityoptionsdialog.ui @@ -1,33 +1,33 @@ - + - False - 6 + False + 6 Security Options and Warnings False True - 0 - 0 - dialog + 0 + 0 + dialog - False + False vertical 12 - False - end + False + end _OK True - True - True - True - True + True + True + True + True True @@ -40,8 +40,8 @@ _Cancel True - True - True + True + True True @@ -54,8 +54,8 @@ _Help True - True - True + True + True True @@ -69,46 +69,46 @@ False True - end + end 0 True - False + False vertical 12 True - False + False True - 0 - none + 0 + none - + True - False - 6 + False 12 6 + 6 - + True - False - 6 - 12 + False + 6 + 12 _When saving or sending True - True - False - True - True + True + False + True + True Select to see a warning dialog when you try to save or send a document that contains recorded changes, versions, or comments. @@ -116,18 +116,18 @@ - 1 - 0 + 1 + 0 When _signing True - True - False - True - True + True + False + True + True Select to see a warning dialog when you try to sign a document that contains recorded changes, versions, fields, references to other sources (for example linked sections or linked pictures), or comments. @@ -135,18 +135,18 @@ - 3 - 0 + 3 + 0 When _printing True - True - False - True - True + True + False + True + True Select to see a warning dialog when you try to print a document that contains recorded changes or comments. @@ -154,18 +154,18 @@ - 1 - 1 + 1 + 1 When creating PDF _files True - True - False - True - True + True + False + True + True Select to see a warning dialog when you try to export a document to PDF format that displays recorded changes in Writer, or that displays comments. @@ -173,79 +173,79 @@ - 3 - 1 + 3 + 1 - False - True + False + True center center - res/lock.png + res/lock.png - 0 - 1 + 0 + 1 - False - True + False + True center center - res/lock.png + res/lock.png - 0 - 0 + 0 + 0 - False - True + False + True center center - res/lock.png + res/lock.png - 2 - 0 + 2 + 0 - False - True + False + True center center - res/lock.png + res/lock.png - 2 - 1 + 2 + 1 - 0 - 1 + 0 + 1 True - False + False True Warn if document contains recorded changes, versions or notes: 0 - 0 - 0 + 0 + 0 @@ -253,7 +253,7 @@ True - False + False Security Warnings @@ -270,28 +270,28 @@ True - False + False True - 0 - none + 0 + none - + True - False - 6 - 12 + False 12 6 + 6 + 12 _Remove personal information on saving True - True - False + True + False True - True - True + True + True Select to always remove user data from the file properties. If this option is not selected, you can still remove the personal information for the current document with the Reset Properties button on File - Properties - General. @@ -299,39 +299,64 @@ - 1 - 0 + 1 + 0 - - Recommend password protection on sa_ving + + False + True + center + center + res/lock.png + + + 0 + 0 + + + + + Block any links from documents not among the trusted locations (see Macro Security) True - True - False + True + False True - True - True + True + True - - Select to always enable the Save with password option in the file save dialogs. Deselect the option to save files by default without password. + + Blocks the use of linked images by documents not in the trusted locations defined on the Trusted Sources tab of the Macro Security dialog. - 1 - 1 + 1 + 7 + + + + + False + center + center + res/lock.png + + + 0 + 7 Ctrl-click required _to open hyperlinks True - True - False + True + False True - True - True + True + True If enabled, you must hold down the Ctrl key while clicking a hyperlink to follow that link. If not enabled, a click opens the hyperlink. @@ -339,77 +364,172 @@ - 1 - 2 + 1 + 6 - - Block any links from documents not among the trusted locations (see Macro Security) + + False + center + center + res/lock.png + + + 0 + 6 + + + + + Recommend password protection on sa_ving True - True - False + True + False True - True - True + True + True - - Blocks the use of linked images by documents not in the trusted locations defined on the Trusted Sources tab of the Macro Security dialog. + + Select to always enable the Save with password option in the file save dialogs. Deselect the option to save files by default without password. - 1 - 3 + 1 + 5 - - False - True + + False center center - res/lock.png + res/lock.png - 0 - 0 + 0 + 5 - - False + + Keep track changes information + True + True + False + 20 + True + True + True + + + 1 + 1 + + + + + Keep document user informations + True + True + False + 20 + True + True + True + + + 1 + 2 + + + + + Keep author name and date of notes + True + True + False + 20 + True + True + True + + + 1 + 3 + + + + + Keep document version information + True + True + False + 20 + True + True + True + + + 1 + 4 + + + + + False + True center center - res/lock.png + 20 + res/lock.png - 0 - 1 + 0 + 1 - - False + + False + True center center - res/lock.png + 20 + res/lock.png - 0 - 2 + 0 + 2 - - False + + False + True center center - res/lock.png + 20 + res/lock.png - 0 - 3 + 0 + 3 + + + + + False + True + center + center + 20 + res/lock.png + + + 0 + 4 @@ -417,7 +537,7 @@ True - False + False Security Options @@ -431,6 +551,9 @@ 1 + + + False @@ -445,9 +568,6 @@ cancel help - - - Set security related options and warnings about hidden information in documents. -- cgit