[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - svx/inc svx/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Thu Jun 30 08:23:35 UTC 2016


 svx/inc/tbunosearchcontrollers.hxx             |    2 +
 svx/source/tbxctrls/tbunosearchcontrollers.cxx |   29 +++++++------------------
 2 files changed, 11 insertions(+), 20 deletions(-)

New commits:
commit 2e171fa809495120a5b944ce7b1f77099dbb9a4a
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Jun 29 22:50:22 2016 +0200

    tdf#89616 Find toolbar: Activate search arrows when input has text
    
    Not only when input is modfified
    
    Change-Id: Ic6b94dbfba34ec6eb88c9c385aaa36a7bac19de7
    Reviewed-on: https://gerrit.libreoffice.org/26782
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 6f34143dfb061cb8dda76b9e4f449f1e6b4fc181)
    Reviewed-on: https://gerrit.libreoffice.org/26788
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index efa07be..5b38ff7 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -117,6 +117,8 @@ public:
 
 private:
 
+    void textfieldChanged();
+
     VclPtr<FindTextFieldControl> m_pFindTextFieldControl;
 
     sal_uInt16 m_nDownSearchId; // item position of findbar
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index f050ca6..77c7474 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -450,15 +450,9 @@ void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< c
         {
             OUString sItemCommand = pToolBox->GetItemCommand(i);
             if ( sItemCommand == COMMAND_DOWNSEARCH )
-            {
-                pToolBox->EnableItem(i, false);
                 m_nDownSearchId = i;
-            }
             else if ( sItemCommand == COMMAND_UPSEARCH )
-            {
-                pToolBox->EnableItem(i, false);
                 m_nUpSearchId = i;
-            }
         }
     }
 
@@ -497,29 +491,24 @@ void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::Featur
     {
         m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText());
     }
+    // enable up/down buttons in case there is already text (from the search history)
+    textfieldChanged();
 }
 
 IMPL_LINK_NOARG_TYPED(FindTextToolbarController, EditModifyHdl, Edit&, void)
 {
+    textfieldChanged();
+}
+
+void FindTextToolbarController::textfieldChanged() {
     // enable or disable item DownSearch/UpSearch of findbar
     vcl::Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
     ToolBox* pToolBox = static_cast<ToolBox*>(pWindow);
     if ( pToolBox && m_pFindTextFieldControl )
     {
-        if (!m_pFindTextFieldControl->GetText().isEmpty())
-        {
-            if ( !pToolBox->IsItemEnabled(m_nDownSearchId) )
-                pToolBox->EnableItem(m_nDownSearchId);
-            if ( !pToolBox->IsItemEnabled(m_nUpSearchId) )
-                pToolBox->EnableItem(m_nUpSearchId);
-        }
-        else
-        {
-            if ( pToolBox->IsItemEnabled(m_nDownSearchId) )
-                pToolBox->EnableItem(m_nDownSearchId, false);
-            if ( pToolBox->IsItemEnabled(m_nUpSearchId) )
-                pToolBox->EnableItem(m_nUpSearchId, false);
-        }
+        bool enableButtons = !m_pFindTextFieldControl->GetText().isEmpty();
+        pToolBox->EnableItem(m_nDownSearchId, enableButtons);
+        pToolBox->EnableItem(m_nUpSearchId, enableButtons);
     }
 }
 


More information about the Libreoffice-commits mailing list