svx/source/dialog/srchdlg.cxx                  |   17 +++++++++++++++++
 svx/source/inc/findtextfield.hxx               |    1 +
 svx/source/tbxctrls/tbunosearchcontrollers.cxx |    5 +++++
 3 files changed, 23 insertions(+)

New commits:
commit 982c262b479a5326925c13dfb7fb258901c6f348
Author:     Heiko Tietze <[email protected]>
AuthorDate: Mon Jul 8 16:50:37 2024 +0200
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Mon Jul 15 02:36:52 2024 +0200

    Resolves tdf#161568 - Feedback for QFS in floating mode
    
    As band-aid for the lack of proper toolbar resizing,
    feedback is given via entry message type
    
    Change-Id: Ic2b2a2aff93040f558775d63c18c21370fabcb39
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170167
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <[email protected]>
    (cherry picked from commit 4e606c5b38139c4424fe9334aed32515c7547418)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170119
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index bb66ecde8343..dcb7e7d87a7b 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -72,6 +72,8 @@
 #include <cstdlib>
 #include <memory>
 
+#include <findtextfield.hxx>
+
 #include <svx/labelitemwindow.hxx>
 #include <svx/xdef.hxx>
 #include <officecfg/Office/Common.hxx>
@@ -576,6 +578,9 @@ void SvxSearchDialog::SetSearchLabel(const OUString& rStr)
         m_xSearchBox->set_size_request(-1, aSize.Height());
         m_xSearchBox->set_background(COL_TRANSPARENT);
     }
+
+    if (rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND))
+        m_xSearchLB->set_entry_message_type(weld::EntryMessageType::Error);
 }
 
 void SvxSearchDialog::ApplyTransliterationFlags_Impl( TransliterationFlags 
nSettings )
@@ -2373,6 +2378,18 @@ static void lcl_SetSearchLabelWindow(const OUString& 
rStr, SfxViewFrame& rViewFr
             pSearchLabel->set_label(rStr, LabelItemWindowType::Info);
             pSearchLabel->SetOptimalSize();
         }
+
+        if (pToolBox->IsFloatingMode() && pToolBox->GetItemCommand(id) == 
".uno:FindText")
+        {
+            FindTextFieldControl* pFindText = 
dynamic_cast<FindTextFieldControl*>(pToolBox->GetItemWindow(id));
+            assert(pFindText);
+            if (rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND))
+                
pFindText->set_entry_message_type(weld::EntryMessageType::Error);
+            else if (rStr == SvxResId(RID_SVXSTR_SEARCH_END) || rStr == 
SvxResId(RID_SVXSTR_SEARCH_START))
+                
pFindText->set_entry_message_type(weld::EntryMessageType::Warning);
+            else
+                
pFindText->set_entry_message_type(weld::EntryMessageType::Normal);
+        }
     }
     xLayoutManager->doLayout();
     pToolBox->Resize();
diff --git a/svx/source/inc/findtextfield.hxx b/svx/source/inc/findtextfield.hxx
index 9d15a0d8b47d..2c79a529b3f4 100644
--- a/svx/source/inc/findtextfield.hxx
+++ b/svx/source/inc/findtextfield.hxx
@@ -47,6 +47,7 @@ public:
     OUString get_text(int nIndex) const;
     OUString get_active_text() const;
     void append_text(const OUString& rText);
+    void set_entry_message_type(weld::EntryMessageType eType);
 
 private:
     ImplSVEvent* m_nAsyncGetFocusId;
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx 
b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index c2070618d69e..47031df35524 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -436,6 +436,11 @@ OUString FindTextFieldControl::get_active_text() const
     return m_xWidget->get_active_text();
 }
 
+void FindTextFieldControl::set_entry_message_type(weld::EntryMessageType eType)
+{
+    m_xWidget->set_entry_message_type(eType);
+}
+
 void FindTextFieldControl::append_text(const OUString& rText)
 {
     m_xWidget->append_text(rText);

Reply via email to