include/sfx2/tabdlg.hxx       |    2 ++
 sfx2/source/dialog/tabdlg.cxx |    7 ++++++-
 sw/source/ui/fldui/flddb.cxx  |    4 ++++
 sw/source/ui/fldui/flddb.hxx  |    1 +
 4 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 64f98e467794f98836a99719ecde51bf6a8f8bad
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Mar 14 14:42:15 2021 +0300
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Mar 17 19:34:43 2021 +0100

    tdf#141011: Postpone SwFieldDBPage::Reset to tab activation
    
    This way, it will only ask for password when dialog is switched to that tab.
    
    Change-Id: Ie2a453b0b6867ceb1ef3728a8565de4f6cbf4757
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112469
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 0adf52a644aaf85ba2bd666147c62c134234ffbb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112516
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 0d770572f051..50f378d14dc4 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -208,6 +208,8 @@ public:
 
     virtual bool        FillItemSet( SfxItemSet* );
     virtual void        Reset( const SfxItemSet* );
+    // Allows to postpone some initialization to the first activation
+    virtual bool        DeferResetToFirstActivation();
 
     bool                HasExchangeSupport() const
                             { return bHasExchangeSupport; }
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 22acd6791b25..484b431a690e 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -168,6 +168,8 @@ void SfxTabPage::Reset( const SfxItemSet* )
 {
 }
 
+bool SfxTabPage::DeferResetToFirstActivation() { return false; }
+
 void SfxTabPage::ActivatePage( const SfxItemSet& )
 /*  [Description]
 
@@ -919,7 +921,10 @@ void SfxTabDialogController::CreatePages()
         pDataObject->xTabPage->SetUserData(sUserData);
 
         PageCreated(pDataObject->sId, *pDataObject->xTabPage);
-        pDataObject->xTabPage->Reset(m_pSet.get());
+        if (pDataObject->xTabPage->DeferResetToFirstActivation())
+            pDataObject->bRefresh = true; // Reset will be called in 
ActivatePageHdl
+        else
+            pDataObject->xTabPage->Reset(m_pSet.get());
     }
 }
 
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index e2097cb77291..220ccbb58302 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -178,6 +178,10 @@ void SwFieldDBPage::Reset(const SfxItemSet*)
     }
 }
 
+// SwFieldDBPage may ask for password to select current document's data source,
+// so only do that when activating the page, not when dialog is creating all 
pages
+bool SwFieldDBPage::DeferResetToFirstActivation() { return true; }
+
 bool SwFieldDBPage::FillItemSet(SfxItemSet* )
 {
     OUString sTableName;
diff --git a/sw/source/ui/fldui/flddb.hxx b/sw/source/ui/fldui/flddb.hxx
index e507fcb86ee0..b25c38699234 100644
--- a/sw/source/ui/fldui/flddb.hxx
+++ b/sw/source/ui/fldui/flddb.hxx
@@ -70,6 +70,7 @@ public:
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
+    virtual bool        DeferResetToFirstActivation() override;
 
     virtual void        FillUserData() override;
     void                ActivateMailMergeAddress();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to