[Libreoffice-commits] core.git: sfx2/source uui/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 16 10:55:57 UTC 2020


 sfx2/source/view/viewfrm.cxx  |    6 ++++--
 uui/source/iahndl-locking.cxx |    9 +++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 10136818b4ef138fc2d5ec3af194beffed009480
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Mar 16 10:40:13 2020 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Mar 16 11:55:23 2020 +0100

    Some more places to check for AllowOverrideLocking option
    
    Change-Id: Id09f691ef7e3fbae03771a43af1c7b1d940365bc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90554
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 3bf812e439a6..8616da00b358 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -169,13 +169,15 @@ private:
 public:
     SfxQueryOpenAsTemplate(weld::Window* pParent, bool bAllowIgnoreLock, LockFileEntry& rLockData)
         : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question,
-                                                       VclButtonsType::NONE,
-                                                       QueryString(bAllowIgnoreLock, rLockData)))
+                                                       VclButtonsType::NONE, ""))
     {
         m_xQueryBox->add_button(SfxResId(STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN), RET_YES);
+        bAllowIgnoreLock
+            = bAllowIgnoreLock && officecfg::Office::Common::Misc::AllowOverrideLocking::get();
         if (bAllowIgnoreLock)
             m_xQueryBox->add_button(SfxResId(STR_QUERY_OPENASTEMPLATE_OPEN_BTN), RET_IGNORE);
         m_xQueryBox->add_button(GetStandardText( StandardButtonType::Cancel ), RET_CANCEL);
+        m_xQueryBox->set_primary_text(QueryString(bAllowIgnoreLock, rLockData));
         m_xQueryBox->set_default_response(RET_YES);
     }
     short run() { return m_xQueryBox->run(); }
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
index 07a69699e9b8..52b9d2108347 100644
--- a/uui/source/iahndl-locking.cxx
+++ b/uui/source/iahndl-locking.cxx
@@ -79,13 +79,14 @@ handleLockedDocumentRequest_(
     std::vector< OUString > aArguments;
     aArguments.push_back( aDocumentURL );
 
+    bool bAllowOverride = xRetry.is() && officecfg::Office::Common::Misc::AllowOverrideLocking::get();
+
     sal_Int32 nResult = RET_CANCEL;
     if ( nMode == UUI_DOC_LOAD_LOCK )
     {
         aArguments.push_back( !aInfo.isEmpty()
                               ? aInfo
                               : Translate::get( STR_UNKNOWNUSER, aResLocale) );
-        bool bAllowOverride = xRetry.is() && officecfg::Office::Common::Misc::AllowOverrideLocking::get();
         aArguments.push_back( bAllowOverride
                               ? Translate::get( STR_OPENLOCKED_ALLOWIGNORE_MSG, aResLocale )
                               : "" );
@@ -93,7 +94,7 @@ handleLockedDocumentRequest_(
         aMessage = UUIInteractionHelper::replaceMessageWithArguments(
             aMessage, aArguments );
 
-        OpenLockedQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is());
+        OpenLockedQueryBox aDialog(pParent, aResLocale, aMessage, bAllowOverride);
         nResult = aDialog.run();
     }
     else if ( nMode == UUI_DOC_SAVE_LOCK )
@@ -102,12 +103,12 @@ handleLockedDocumentRequest_(
                               ? aInfo
                               : Translate::get( STR_UNKNOWNUSER,
                                            aResLocale ) );
-        aMessage = Translate::get(xRetry.is() ? STR_OVERWRITE_IGNORELOCK_MSG : STR_TRYLATER_MSG,
+        aMessage = Translate::get(bAllowOverride ? STR_OVERWRITE_IGNORELOCK_MSG : STR_TRYLATER_MSG,
             aResLocale);
         aMessage = UUIInteractionHelper::replaceMessageWithArguments(
             aMessage, aArguments );
 
-        TryLaterQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is());
+        TryLaterQueryBox aDialog(pParent, aResLocale, aMessage, bAllowOverride);
         nResult = aDialog.run();
     }
     else if ( nMode == UUI_DOC_OWN_LOAD_LOCK ||


More information about the Libreoffice-commits mailing list