summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSabin Frandes <Sabin.Frandes@cib.de>2017-09-15 16:51:36 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2017-09-18 14:29:36 +0200
commit2b74f20c67bc23f3321d8d9425300d363646f594 (patch)
tree02a64ca13eb7a4705c045f5ab636ff2015a465d5
parentf7c3d1a1a75c68147641caee805d36b847c23fab (diff)
tdf#106945 TSA Dialog: Disable delete button
Change-Id: Idce5ccc36254d80aaf4b5d5f81cfe201e5c27a5f Reviewed-on: https://gerrit.libreoffice.org/42315 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r--cui/source/options/tsaurls.cxx15
-rw-r--r--cui/source/options/tsaurls.hxx3
2 files changed, 18 insertions, 0 deletions
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;