diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-05 10:02:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-05 12:20:47 +0200 |
commit | f6eee4f7966e09be82b51554ead4c4aac8c47457 (patch) | |
tree | c47b06cb3c2e9f99ec3fda35738d80a1a62d9bfc /dbaccess/source/ui/dlg | |
parent | faf6b466ab510ccee540953eebb790b6a57386e6 (diff) |
weld QueryPropertiesDialog
Change-Id: Id523fdb25a24e2ef205bd24e594c8e01772d7a58
Reviewed-on: https://gerrit.libreoffice.org/61406
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui/dlg')
-rw-r--r-- | dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx b/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx index 6b5ffe5dc08f..41ed0e867c4b 100644 --- a/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx +++ b/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx @@ -8,37 +8,54 @@ */ #include <QueryPropertiesDialog.hxx> +#include <strings.hrc> +#include <core_resource.hxx> + +#define ALL_STRING DBA_RES(STR_QUERY_LIMIT_ALL) +#define ALL_INT -1 namespace dbaui { QueryPropertiesDialog::QueryPropertiesDialog( - vcl::Window* pParent, const bool bDistinct, const sal_Int64 nLimit ) - : ModalDialog(pParent, "QueryPropertiesDialog", "dbaccess/ui/querypropertiesdialog.ui") - , m_pRB_Distinct( nullptr ) - , m_pRB_NonDistinct( nullptr ) - , m_pLB_Limit( nullptr ) + weld::Window* pParent, const bool bDistinct, const sal_Int64 nLimit ) + : GenericDialogController(pParent, "dbaccess/ui/querypropertiesdialog.ui", "QueryPropertiesDialog") + , m_xRB_Distinct(m_xBuilder->weld_radio_button("distinct")) + , m_xRB_NonDistinct(m_xBuilder->weld_radio_button("nondistinct")) + , m_xLB_Limit(m_xBuilder->weld_combo_box("limitbox")) { - get( m_pRB_Distinct, "distinct" ); - get( m_pRB_NonDistinct, "nondistinct" ); - get( m_pLB_Limit, "limitbox" ); - - m_pRB_Distinct->Check( bDistinct ); - m_pRB_NonDistinct->Check( !bDistinct ); - m_pLB_Limit->SetValue( nLimit ); + m_xRB_Distinct->set_active(bDistinct); + m_xRB_NonDistinct->set_active(!bDistinct); + + m_xLB_Limit->append(OUString::number(ALL_INT), ALL_STRING); + /// Default values + sal_Int64 const aDefLimitAry[] = + { + 5, + 10, + 20, + 50 + }; + for (auto a : aDefLimitAry) + m_xLB_Limit->append(OUString::number(a), OUString::number(a)); + OUString sInitial = OUString::number(nLimit); + auto nPos = m_xLB_Limit->find_id(sInitial); + if (nPos != -1) + m_xLB_Limit->set_active(nPos); + else + m_xLB_Limit->set_entry_text(OUString::number(nLimit)); } -QueryPropertiesDialog::~QueryPropertiesDialog() +sal_Int64 QueryPropertiesDialog::getLimit() const { - disposeOnce(); + OUString sSelectedId = m_xLB_Limit->get_active_id(); + if (!sSelectedId.isEmpty()) + return sSelectedId.toInt64(); + return m_xLB_Limit->get_active_text().toInt64(); } -void QueryPropertiesDialog::dispose() +QueryPropertiesDialog::~QueryPropertiesDialog() { - m_pRB_Distinct.clear(); - m_pRB_NonDistinct.clear(); - m_pLB_Limit.clear(); - ModalDialog::dispose(); } } ///dbaui namespace |