svx/source/tbxctrls/tbcontrl.cxx  |   12 ------------
 svx/uiconfig/ui/currencywindow.ui |   29 +----------------------------
 2 files changed, 1 insertion(+), 40 deletions(-)

New commits:
commit b4c73cfc5deee4eb718bf102cb028433527e28a1
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Tue Jan 7 13:58:11 2025 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Wed Mar 5 05:56:39 2025 +0100

    Improve UX of currency dropdown
    
    - single click activation
    - no additional ok button in the dropdown
    - no label
    
    It's not common that dropdown has to be confirmed using button
    
    Signed-off-by: Szymon Kłos <szymon.k...@collabora.com>
    Change-Id: Ib5ad5509f99466710cd898bf0baedeac8fdb49ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182511

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 30dbf142cd93..3f726d149179 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -3915,16 +3915,13 @@ namespace
     {
     private:
         rtl::Reference<SvxCurrencyToolBoxControl> m_xControl;
-        std::unique_ptr<weld::Label> m_xLabel;
         std::unique_ptr<weld::TreeView> m_xCurrencyLb;
-        std::unique_ptr<weld::Button> m_xOkBtn;
         OUString&       m_rSelectedFormat;
         LanguageType&   m_eSelectedLanguage;
 
         std::vector<OUString> m_aFormatEntries;
         LanguageType          m_eFormatLanguage;
         DECL_LINK(RowActivatedHdl, weld::TreeView&, bool);
-        DECL_LINK(OKHdl, weld::Button&, void);
 
         virtual void GrabFocus() override;
 
@@ -3932,9 +3929,7 @@ namespace
         SvxCurrencyList_Impl(SvxCurrencyToolBoxControl* pControl, 
weld::Widget* pParent, OUString& rSelectedFormat, LanguageType& 
eSelectedLanguage)
             : WeldToolbarPopup(pControl->getFrameInterface(), pParent, 
u"svx/ui/currencywindow.ui"_ustr, u"CurrencyWindow"_ustr)
             , m_xControl(pControl)
-            , m_xLabel(m_xBuilder->weld_label(u"label"_ustr))
             , m_xCurrencyLb(m_xBuilder->weld_tree_view(u"currency"_ustr))
-            , m_xOkBtn(m_xBuilder->weld_button(u"ok"_ustr))
             , m_rSelectedFormat(rSelectedFormat)
             , m_eSelectedLanguage(eSelectedLanguage)
         {
@@ -4001,9 +3996,7 @@ namespace
             // enable multiple selection enabled so we can start with nothing 
selected
             m_xCurrencyLb->set_selection_mode(SelectionMode::Multiple);
             m_xCurrencyLb->connect_row_activated( LINK( this, 
SvxCurrencyList_Impl, RowActivatedHdl ) );
-            m_xLabel->set_label(SvxResId(RID_SVXSTR_TBLAFMT_CURRENCY));
             m_xCurrencyLb->select( nSelectedPos );
-            m_xOkBtn->connect_clicked(LINK(this, SvxCurrencyList_Impl, OKHdl));
 
             // gtk will initially make a best guess depending on the first few 
entries, so copy the probable
             // longest entry to the start temporarily and force in the width 
at this point
@@ -4018,11 +4011,6 @@ namespace
         m_xCurrencyLb->grab_focus();
     }
 
-    IMPL_LINK_NOARG(SvxCurrencyList_Impl, OKHdl, weld::Button&, void)
-    {
-        RowActivatedHdl(*m_xCurrencyLb);
-    }
-
     IMPL_LINK_NOARG(SvxCurrencyList_Impl, RowActivatedHdl, weld::TreeView&, 
bool)
     {
         if (!m_xControl.is())
diff --git a/svx/uiconfig/ui/currencywindow.ui 
b/svx/uiconfig/ui/currencywindow.ui
index 7f0008888338..141652b52981 100644
--- a/svx/uiconfig/ui/currencywindow.ui
+++ b/svx/uiconfig/ui/currencywindow.ui
@@ -21,20 +21,6 @@
         <property name="can-focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="label">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="use-underline">True</property>
-            <property name="mnemonic-widget">currency</property>
-            <property name="xalign">0</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
           <object class="GtkScrolledWindow">
             <property name="visible">True</property>
@@ -45,6 +31,7 @@
             <property name="shadow-type">in</property>
             <child>
               <object class="GtkTreeView" id="currency">
+                <property name="activate_on_single_click">True</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="hexpand">True</property>
@@ -76,20 +63,6 @@
             <property name="position">1</property>
           </packing>
         </child>
-        <child>
-          <object class="GtkButton" id="ok">
-            <property name="label" translatable="yes" 
context="stock">_OK</property>
-            <property name="visible">True</property>
-            <property name="can-focus">True</property>
-            <property name="receives-default">True</property>
-            <property name="use-underline">True</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
       </object>
     </child>
   </object>

Reply via email to