[Libreoffice-commits] core.git: Branch 'feature/mailmerge-toolbar' - sw/source

Jan Holesovsky kendy at collabora.com
Mon Dec 21 11:43:28 PST 2015


 sw/source/uibase/app/apphdl.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit fcda259af9295df7dc935bf2a93d1b32b5844bf9
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Dec 21 20:41:33 2015 +0100

    mailmerge: Enable/disable the first/prev/next/last mailmerge entry buttons.
    
    Change-Id: I48f0972b52c0c39e3ba691f4037412622927638b

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 6b4b26f..676f639 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -207,12 +207,9 @@ void SwModule::StateOther(SfxItemSet &rSet)
             case FN_MAILMERGE_NEXT_ENTRY:
             case FN_MAILMERGE_LAST_ENTRY:
             {
-                /*
                 SwView* pView = ::GetActiveView();
                 SwMailMergeConfigItem* pConfigItem = pView->GetMailMergeConfigItem();
-                if (!pConfigItem)
-                    rSet.DisableItem(nWhich);
-                else
+                if (pConfigItem)
                 {
                     bool bFirst, bLast;
                     bool bValid = pConfigItem->IsResultSetFirstLast(bFirst, bLast);
@@ -223,12 +220,7 @@ void SwModule::StateOther(SfxItemSet &rSet)
                     {
                         rSet.DisableItem(nWhich);
                     }
-                    else
-                    {
-                        rSet.Put(SfxVoidItem(nWhich));
-                    }
                 }
-                */
             }
             break;
             default:
@@ -749,7 +741,7 @@ void SwModule::ExecOther(SfxRequest& rReq)
                 default: break;
             }
 
-            //now the record has to be merged into the source document
+            // now the record has to be merged into the source document
             const SwDBData& rDBData = pConfigItem->GetCurrentDBData();
             uno::Sequence<uno::Any> vSelection({ uno::makeAny(pConfigItem->GetResultSetPosition()) });
             svx::ODataAccessDescriptor aDescriptor(::comphelper::InitPropertySequence({
@@ -766,6 +758,14 @@ void SwModule::ExecOther(SfxRequest& rReq)
             SwWrtShell& rSh = pActView->GetWrtShell();
             SwMergeDescriptor aMergeDesc(DBMGR_MERGE, rSh, aDescriptor);
             rSh.GetDBManager()->MergeNew(aMergeDesc);
+
+            // update enabled / disabled status of the buttons in the toolbar
+            SfxBindings& rBindings = rSh.GetView().GetViewFrame()->GetBindings();
+            rBindings.Invalidate(FN_MAILMERGE_FIRST_ENTRY);
+            rBindings.Invalidate(FN_MAILMERGE_PREV_ENTRY);
+            rBindings.Invalidate(FN_MAILMERGE_NEXT_ENTRY);
+            rBindings.Invalidate(FN_MAILMERGE_LAST_ENTRY);
+            rBindings.Update();
         }
         break;
 #endif


More information about the Libreoffice-commits mailing list