[Libreoffice-commits] core.git: cui/source

Sabin Frandes Sabin.Frandes at cib.de
Mon Sep 18 12:30:02 UTC 2017


 cui/source/options/tsaurls.cxx |   15 +++++++++++++++
 cui/source/options/tsaurls.hxx |    3 +++
 2 files changed, 18 insertions(+)

New commits:
commit 2b74f20c67bc23f3321d8d9425300d363646f594
Author: Sabin Frandes <Sabin.Frandes at cib.de>
Date:   Fri Sep 15 16:51:36 2017 +0200

    tdf#106945 TSA Dialog: Disable delete button
    
    Change-Id: Idce5ccc36254d80aaf4b5d5f81cfe201e5c27a5f
    Reviewed-on: https://gerrit.libreoffice.org/42315
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
index ea206fb44fd8..215a63454919 100644
--- a/cui/source/options/tsaurls.cxx
+++ b/cui/source/options/tsaurls.cxx
@@ -32,6 +32,7 @@ TSAURLsDialog::TSAURLsDialog(vcl::Window* pParent)
     m_pAddBtn->SetClickHdl( LINK( this, TSAURLsDialog, AddHdl_Impl ) );
     m_pDeleteBtn->SetClickHdl( LINK( this, TSAURLsDialog, DeleteHdl_Impl ) );
     m_pOKBtn->SetClickHdl( LINK( this, TSAURLsDialog, OKHdl_Impl ) );
+    m_pURLListBox->SetSelectHdl( LINK( this, TSAURLsDialog, SelectHdl ) );
 
     try
     {
@@ -49,6 +50,11 @@ TSAURLsDialog::TSAURLsDialog(vcl::Window* pParent)
     {
         SAL_WARN("cui.options", "TSAURLsDialog::TSAURLsDialog(): caught exception" << e.Message);
     }
+
+    if ( m_pURLListBox->GetSelectEntryCount() == 0 )
+    {
+        m_pDeleteBtn->Disable();
+    }
 }
 
 IMPL_LINK_NOARG(TSAURLsDialog, OKHdl_Impl, Button*, void)
@@ -106,6 +112,13 @@ IMPL_LINK_NOARG(TSAURLsDialog, AddHdl_Impl, Button*, void)
         AddTSAURL(aURL);
         m_pOKBtn->Enable();
     }
+    // After operations in a ListBox we have nothing selected
+    m_pDeleteBtn->Disable();
+}
+
+IMPL_LINK_NOARG(TSAURLsDialog, SelectHdl, ListBox&, void)
+{
+    m_pDeleteBtn->Enable();
 }
 
 IMPL_LINK_NOARG(TSAURLsDialog, DeleteHdl_Impl, Button*, void)
@@ -117,6 +130,8 @@ IMPL_LINK_NOARG(TSAURLsDialog, DeleteHdl_Impl, Button*, void)
 
     m_aURLs.erase(m_pURLListBox->GetEntry(nSel));
     m_pURLListBox->RemoveEntry(nSel);
+    // After operations in a ListBox we have nothing selected
+    m_pDeleteBtn->Disable();
     m_pOKBtn->Enable();
 }
 
diff --git a/cui/source/options/tsaurls.hxx b/cui/source/options/tsaurls.hxx
index 0ab0cf81d0b0..6fc28b0b83e8 100644
--- a/cui/source/options/tsaurls.hxx
+++ b/cui/source/options/tsaurls.hxx
@@ -24,6 +24,9 @@ private:
     DECL_LINK(AddHdl_Impl, Button*, void);
     DECL_LINK(DeleteHdl_Impl, Button*, void);
     DECL_LINK(OKHdl_Impl, Button*, void);
+    // After operations in a ListBox we have nothing selected
+    // Is Selected element handler for the ListBox
+    DECL_LINK(SelectHdl, ListBox&, void);
 
     std::set<OUString> m_aURLs;
 


More information about the Libreoffice-commits mailing list