[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - include/sfx2 sfx2/source

2022-03-31 Thread Caolán McNamara (via logerrit)
 include/sfx2/strings.hrc |2 ++
 include/sfx2/viewfrm.hxx |1 +
 sfx2/source/view/viewfrm.cxx |   38 ++
 3 files changed, 41 insertions(+)

New commits:
commit c5d01b11db3c83cb4a89d3b388d78e20dd3990b5
Author: Caolán McNamara 
AuthorDate: Wed Mar 23 13:03:30 2022 +
Commit: Christian Lohmaier 
CommitDate: Thu Mar 31 15:37:55 2022 +0200

add infobar to prompt to refresh to replace old format

Change-Id: Id99cbf2b50a4ebf289dae6fc67e22e20afcda35b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131976
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit bbd196ff82bda9f66b4ba32a412f10cefe6da60e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132307
Reviewed-by: Sophie Gautier 
Reviewed-by: Christian Lohmaier 

diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index 0967a31c1109..3972509c32b0 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -295,6 +295,8 @@
 #define STR_SIGNATURE_SHOW  NC_("STR_SIGNATURE_SHOW", 
"Show Signatures")
 #define STR_TRACK_CHANGES_BUTTON
NC_("STR_TRACK_CHANGES_BUTTON", "Show Toolbar")
 #define STR_TRACK_CHANGES_BUTTON_HIDE   
NC_("STR_TRACK_CHANGES_BUTTON_HIDE", "Hide Toolbar")
+#define STR_REFRESH_MASTER_PASSWORD 
NC_("STR_REFRESH_MASTER_PASSWORD", "The master password is stored in an 
outdated format, you should refresh it")
+#define STR_REFRESH_PASSWORDNC_("STR_REFRESH_PASSWORD", 
"Refresh Password")
 
 #define STR_CLOSE_PANE  NC_("STR_CLOSE_PANE", "Close 
Pane")
 
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index 4585b722e487..ae38b1a88f4e 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -71,6 +71,7 @@ protected:
 DECL_LINK(SwitchReadOnlyHandler, weld::Button&, void);
 DECL_LINK(SignDocumentHandler, weld::Button&, void);
 DECL_LINK(HiddenTrackChangesHandler, weld::Button&, void);
+DECL_DLLPRIVATE_LINK(RefreshMasterPasswordHdl, weld::Button&, void);
 SAL_DLLPRIVATE void KillDispatcher_Impl();
 
 virtual ~SfxViewFrame() override;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index cb5761301379..251234477315 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1478,6 +1479,22 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, 
const SfxHint& rHint )
 batch->commit();
 }
 
+if (officecfg::Office::Common::Passwords::HasMaster::get() &&
+
officecfg::Office::Common::Passwords::StorageVersion::get() == 0)
+{
+// master password stored in deprecated format
+VclPtr pOldMasterPasswordInfoBar =
+AppendInfoBar("oldmasterpassword", "",
+  SfxResId(STR_REFRESH_MASTER_PASSWORD), 
InfobarType::DANGER, false);
+if (pOldMasterPasswordInfoBar)
+{
+weld::Button& rButton = 
pOldMasterPasswordInfoBar->addButton();
+rButton.set_label(SfxResId(STR_REFRESH_PASSWORD));
+rButton.connect_clicked(LINK(this,
+   SfxViewFrame, 
RefreshMasterPasswordHdl));
+}
+}
+
 // read-only infobar if necessary
 const SfxViewShell *pVSh;
 const SfxShell *pFSh;
@@ -1672,6 +1689,27 @@ IMPL_LINK(SfxViewFrame, HiddenTrackChangesHandler, 
weld::Button&, rButton, void)
 }
 }
 
+IMPL_LINK_NOARG(SfxViewFrame, RefreshMasterPasswordHdl, weld::Button&, void)
+{
+bool bChanged = false;
+try
+{
+Reference< task::XPasswordContainer2 > xMasterPasswd(
+
task::PasswordContainer::create(comphelper::getProcessComponentContext()));
+
+css::uno::Reference xFrame = 
GetFrame().GetFrameInterface();
+css::uno::Reference xContainerWindow = 
xFrame->getContainerWindow();
+
+uno::Reference 
xTmpHandler(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(),
+  
xContainerWindow));
+bChanged = xMasterPasswd->changeMasterPassword(xTmpHandler);
+}
+catch (const Exception&)
+{}
+if (bChanged)
+RemoveInfoBar(u"oldmasterpassword");
+}
+
 void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh )
 {
 m_pImpl->bResizeInToOut = true;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - include/sfx2 sfx2/source

2021-09-03 Thread Caolán McNamara (via logerrit)
 include/sfx2/sidebar/Deck.hxx |1 +
 sfx2/source/sidebar/Deck.cxx  |   18 ++
 2 files changed, 19 insertions(+)

New commits:
commit 95b3e2a0a4407a3e09efbacef5987ff6d69bc400
Author: Caolán McNamara 
AuthorDate: Tue Aug 31 10:25:08 2021 +0100
Commit: Michael Weghorn 
CommitDate: Fri Sep 3 11:52:24 2021 +0200

tdf#142458 minimal width not including extra width needed by scrolledwindow

its only including the width of the panels and not the extra space
possibly required by the container window. Which is 2x the
m_nBorderWidth of 1pixel of VclScrolledWindow in this case.

Change-Id: I56775c7183d7a8b87af263ddc8bb17373779e9ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121290
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index a3d3a63aff01..47a33ab17d2c 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -74,6 +74,7 @@ private:
 private:
 const OUString msId;
 sal_Int32 mnMinimalWidth;
+sal_Int32 mnScrolledWindowExtraWidth;
 sal_Int32 mnMinimalHeight;
 SharedPanelContainer maPanels;
 
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 074a0bad7466..dd7f7c6716c3 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -46,6 +46,7 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, 
SidebarDockingWindow* pParentW
 : InterimItemWindow(pParentWindow, "sfx/ui/deck.ui", "Deck")
 , msId(rDeckDescriptor.msId)
 , mnMinimalWidth(0)
+, mnScrolledWindowExtraWidth(0)
 , mnMinimalHeight(0)
 , maPanels()
 , mxParentWindow(pParentWindow)
@@ -59,6 +60,15 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, 
SidebarDockingWindow* pParentW
 
 mxVerticalScrollBar->vadjustment_set_step_increment(10);
 mxVerticalScrollBar->vadjustment_set_page_increment(100);
+
+// tdf#142458 Measure the preferred width of an empty ScrolledWindow
+// to add to the width of the union of panel widths when calculating
+// the minimal width of the deck
+mxVerticalScrollBar->set_hpolicy(VclPolicyType::NEVER);
+mxVerticalScrollBar->set_vpolicy(VclPolicyType::NEVER);
+mnScrolledWindowExtraWidth = 
mxVerticalScrollBar->get_preferred_size().Width();
+mxVerticalScrollBar->set_hpolicy(VclPolicyType::AUTOMATIC);
+mxVerticalScrollBar->set_vpolicy(VclPolicyType::AUTOMATIC);
 }
 
 Deck::~Deck()
@@ -202,6 +212,14 @@ void Deck::RequestLayoutInternal()
 DeckLayouter::LayoutDeck(mxParentWindow.get(), GetContentArea(),
  mnMinimalWidth, mnMinimalHeight, maPanels,
  *GetTitleBar(), *mxVerticalScrollBar);
+
+if (mnMinimalWidth)
+{
+// tdf#142458 at this point mnMinimalWidth contains the width required
+// by the panels, but extra space may be needed by the scrolledwindow
+// that will contain the panels
+mnMinimalWidth += mnScrolledWindowExtraWidth;
+}
 }
 
 void Deck::RequestLayout()