summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-12-06 23:36:04 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-12-12 00:46:22 +0100
commit1ae5f5274011e42dfa85dca5f472ff8bbeecaa4e (patch)
tree50be6ac93b69bb51c7fbc94aa3b1db5e8eb84455 /sw/source
parent1c34812c11248649321b7106dfdc22f1d75091a9 (diff)
tdf#121606: displaying Mail Merge toolbar shouldn't activate connection
At least I think so. Thus now the code that queries the state of the toolbar controls only queries dataset if connection is active. Operating the navigation buttons (next/prev) will, naturally, activate connection if not yet active. This should also enable the other controls that may be initially disabled: create/save/print/email documents. Thus, the navigation controls also check if they have activated the connection, and invalidate said document creation controls state. Possibly there's a better place for the invalidation of the controls, but I was unable to find one. Regression after commit 5c2c5ff01c23e4f7a8947746afc13a46cbef5bec Change-Id: I76f895c871718c9c761339ba03963baf6837b592 Reviewed-on: https://gerrit.libreoffice.org/64738 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 60714a814847f6d10f00aa6809a3896a48741e0b) Reviewed-on: https://gerrit.libreoffice.org/64746 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> (cherry picked from commit b27a9058c706d70adddc71544b74b1f9607185bb) Reviewed-on: https://gerrit.libreoffice.org/64959 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/app/apphdl.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 8bd7c3b62a63..5ffb6f06c4ca 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -187,7 +187,8 @@ void SwModule::StateOther(SfxItemSet &rSet)
xConfigItem = pView->GetMailMergeConfigItem();
if (!xConfigItem)
rSet.DisableItem(nWhich);
- else
+ else if (xConfigItem->GetConnection().is()
+ && !xConfigItem->GetConnection()->isClosed())
{
bool bFirst, bLast;
bool bValid = xConfigItem->IsResultSetFirstLast(bFirst, bLast);
@@ -240,6 +241,8 @@ void SwModule::StateOther(SfxItemSet &rSet)
// #i51949# hide e-Mail option if e-Mail is not supported
// #i63267# printing might be disabled
if (!xConfigItem ||
+ !xConfigItem->GetConnection().is() ||
+ xConfigItem->GetConnection()->isClosed() ||
!xConfigItem->GetResultSet().is() ||
xConfigItem->GetCurrentDBData().sDataSource.isEmpty() ||
xConfigItem->GetCurrentDBData().sCommand.isEmpty() ||
@@ -778,6 +781,9 @@ void SwModule::ExecOther(SfxRequest& rReq)
if (!xConfigItem)
return;
+ const bool bHadConnection
+ = xConfigItem->GetConnection().is() && !xConfigItem->GetConnection()->isClosed();
+
sal_Int32 nPos = xConfigItem->GetResultSetPosition();
switch (nWhich)
{
@@ -815,6 +821,15 @@ void SwModule::ExecOther(SfxRequest& rReq)
rBindings.Invalidate(FN_MAILMERGE_LAST_ENTRY);
rBindings.Invalidate(FN_MAILMERGE_CURRENT_ENTRY);
rBindings.Invalidate(FN_MAILMERGE_EXCLUDE_ENTRY);
+ if (!bHadConnection && xConfigItem->GetConnection().is()
+ && !xConfigItem->GetConnection()->isClosed())
+ {
+ // The connection has been activated. Update controls that were disabled
+ rBindings.Invalidate(FN_MAILMERGE_CREATE_DOCUMENTS);
+ rBindings.Invalidate(FN_MAILMERGE_SAVE_DOCUMENTS);
+ rBindings.Invalidate(FN_MAILMERGE_PRINT_DOCUMENTS);
+ rBindings.Invalidate(FN_MAILMERGE_EMAIL_DOCUMENTS);
+ }
rBindings.Update();
}
break;