Kaydet (Commit) 6f34143d authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

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/26782Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 8448d093
......@@ -117,6 +117,8 @@ public:
private:
void textfieldChanged();
VclPtr<FindTextFieldControl> m_pFindTextFieldControl;
sal_uInt16 m_nDownSearchId; // item position of findbar
......
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment