diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-02-17 10:12:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-17 10:53:36 +0000 |
commit | 41630e9aed81220ce77088826d62cf17ae2adb85 (patch) | |
tree | 656ee37e5bee64e3e7a68b0a09d2e2ed56763130 /dbaccess/source | |
parent | a51929600789af4d67e4f52226f8f5ae13ed58ba (diff) |
convert select data source dialog to .ui
Change-Id: I1506f59dc6e6b6bd2b9cb1a7dd36044bef7f40e2
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/ui/dlg/dsselect.cxx | 65 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dsselect.hrc | 35 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dsselect.hxx | 16 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dsselect.src | 98 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbu_resource.hrc | 1 |
5 files changed, 38 insertions, 177 deletions
diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx index e12703739eea..45c56059fce7 100644 --- a/dbaccess/source/ui/dlg/dsselect.cxx +++ b/dbaccess/source/ui/dlg/dsselect.cxx @@ -18,7 +18,6 @@ */ #include "dsselect.hxx" -#include "dsselect.hrc" #include "dbu_dlg.hrc" #include <vcl/msgbox.hxx> #include "localresaccess.hxx" @@ -49,26 +48,26 @@ using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::ui::dialogs; using namespace ::comphelper; ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringBag& _rDatasources, SfxItemSet* _pOutputSet) - :ModalDialog(_pParent, ModuleRes(DLG_DATASOURCE_SELECTION)) - ,m_aDescription (this, ModuleRes(FT_DESCRIPTION)) - ,m_aDatasource (this, ModuleRes(LB_DATASOURCE)) - ,m_aOk (this, ModuleRes(PB_OK)) - ,m_aCancel (this, ModuleRes(PB_CANCEL)) - ,m_aHelp (this, ModuleRes(PB_HELP)) -#ifdef HAVE_ODBC_ADMINISTRATION - ,m_aManageDatasources (this, ModuleRes(PB_MANAGE)) -#endif - ,m_pOutputSet(_pOutputSet) + : ModalDialog(_pParent, "ChooseDataSourceDialog", + "dbaccess/ui/choosedatasourcedialog.ui") + , m_pOutputSet(_pOutputSet) { + get(m_pDatasource, "treeview"); + m_pDatasource->set_height_request(m_pDatasource->GetTextHeight() * 6); + get(m_pOk, "ok"); + get(m_pCancel, "cancel"); + fillListBox(_rDatasources); #ifdef HAVE_ODBC_ADMINISTRATION + get(m_pManageDatasources, "organize"); + m_pManageDatasources->Show(); + // allow ODBC datasource managenment - m_aManageDatasources.Show(); - m_aManageDatasources.Enable(); - m_aManageDatasources.SetClickHdl(LINK(this,ODatasourceSelectDialog,ManageClickHdl)); + m_pManageDatasources->Show(); + m_pManageDatasources->Enable(); + m_pManageDatasources->SetClickHdl(LINK(this,ODatasourceSelectDialog,ManageClickHdl)); #endif - m_aDatasource.SetDoubleClickHdl(LINK(this,ODatasourceSelectDialog,ListDblClickHdl)); - FreeResource(); + m_pDatasource->SetDoubleClickHdl(LINK(this,ODatasourceSelectDialog,ListDblClickHdl)); } ODatasourceSelectDialog::~ODatasourceSelectDialog() @@ -101,15 +100,15 @@ IMPL_LINK_NOARG(ODatasourceSelectDialog, ManageClickHdl) if ( !m_pODBCManagement->manageDataSources_async() ) { // TODO: error message - m_aDatasource.GrabFocus(); - m_aManageDatasources.Disable(); + m_pDatasource->GrabFocus(); + m_pManageDatasources->Disable(); return 1L; } - m_aDatasource.Disable(); - m_aOk.Disable(); - m_aCancel.Disable(); - m_aManageDatasources.Disable(); + m_pDatasource->Disable(); + m_pOk->Disable(); + m_pCancel->Disable(); + m_pManageDatasources->Disable(); OSL_POSTCOND( m_pODBCManagement->isRunning(), "ODatasourceSelectDialog::ManageClickHdl: success, but not running - you were *fast*!" ); return 0L; @@ -122,10 +121,10 @@ IMPL_LINK( ODatasourceSelectDialog, ManageProcessFinished, void*, /**/ ) aEnumeration.getDatasourceNames( aOdbcDatasources ); fillListBox( aOdbcDatasources ); - m_aDatasource.Enable(); - m_aOk.Enable(); - m_aCancel.Enable(); - m_aManageDatasources.Enable(); + m_pDatasource->Enable(); + m_pOk->Enable(); + m_pCancel->Enable(); + m_pManageDatasources->Enable(); return 0L; } @@ -134,24 +133,24 @@ IMPL_LINK( ODatasourceSelectDialog, ManageProcessFinished, void*, /**/ ) void ODatasourceSelectDialog::fillListBox(const StringBag& _rDatasources) { OUString sSelected; - if (m_aDatasource.GetEntryCount()) - sSelected = m_aDatasource.GetSelectEntry(); - m_aDatasource.Clear(); + if (m_pDatasource->GetEntryCount()) + sSelected = m_pDatasource->GetSelectEntry(); + m_pDatasource->Clear(); // fill the list for ( StringBag::const_iterator aDS = _rDatasources.begin(); aDS != _rDatasources.end(); ++aDS ) { - m_aDatasource.InsertEntry( *aDS ); + m_pDatasource->InsertEntry( *aDS ); } - if (m_aDatasource.GetEntryCount()) + if (m_pDatasource->GetEntryCount()) { if (!sSelected.isEmpty()) - m_aDatasource.SelectEntry(sSelected); + m_pDatasource->SelectEntry(sSelected); else // select the first entry - m_aDatasource.SelectEntryPos(0); + m_pDatasource->SelectEntryPos(0); } } diff --git a/dbaccess/source/ui/dlg/dsselect.hrc b/dbaccess/source/ui/dlg/dsselect.hrc deleted file mode 100644 index f0058ce85d43..000000000000 --- a/dbaccess/source/ui/dlg/dsselect.hrc +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _DBAUI_DSSELECT_HRC_ -#define _DBAUI_DSSELECT_HRC_ - -#define LB_DATASOURCE 1 -#define PB_OK 2 -#define PB_CANCEL 3 -#define PB_HELP 4 -#define PB_MANAGE 5 -#define FT_DESCRIPTION 6 -#define STR_LOCAL_DATASOURCES 7 -#define PB_CREATE 9 -#define STR_DESCRIPTION2 10 - -#endif // _DBAUI_DSSELECT_HRC_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/dlg/dsselect.hxx b/dbaccess/source/ui/dlg/dsselect.hxx index 338eb34c915d..6623766a6a09 100644 --- a/dbaccess/source/ui/dlg/dsselect.hxx +++ b/dbaccess/source/ui/dlg/dsselect.hxx @@ -41,16 +41,12 @@ namespace dbaui class ODatasourceSelectDialog : public ModalDialog { protected: - FixedText m_aDescription; - ListBox m_aDatasource; - OKButton m_aOk; - CancelButton m_aCancel; - HelpButton m_aHelp; -#ifdef HAVE_ODBC_ADMINISTRATION - PushButton m_aManageDatasources; -#endif + ListBox* m_pDatasource; + OKButton* m_pOk; + CancelButton* m_pCancel; SfxItemSet* m_pOutputSet; #ifdef HAVE_ODBC_ADMINISTRATION + PushButton* m_pManageDatasources; ::std::auto_ptr< OOdbcManagement > m_pODBCManagement; #endif @@ -59,8 +55,8 @@ public: ODatasourceSelectDialog( Window* _pParent, const StringBag& _rDatasources, SfxItemSet* _pOutputSet = NULL ); ~ODatasourceSelectDialog(); - inline OUString GetSelected() const { return m_aDatasource.GetSelectEntry();} - void Select( const OUString& _rEntry ) { m_aDatasource.SelectEntry(_rEntry); } + OUString GetSelected() const { return m_pDatasource->GetSelectEntry();} + void Select( const OUString& _rEntry ) { m_pDatasource->SelectEntry(_rEntry); } virtual sal_Bool Close(); diff --git a/dbaccess/source/ui/dlg/dsselect.src b/dbaccess/source/ui/dlg/dsselect.src deleted file mode 100644 index ee89e6af57eb..000000000000 --- a/dbaccess/source/ui/dlg/dsselect.src +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "dsselect.hrc" -#include "dbu_dlg.hrc" - -ModalDialog DLG_DATASOURCE_SELECTION -{ - HelpID = "dbaccess:ModalDialog:DLG_DATASOURCE_SELECTION"; - OutputSize = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 218 , 118 ) ; - Text [ en-US ] = "Data Source" ; - - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 154 , 10 ) ; - Text [ en-US ] = "Choose a data source:"; - }; - ListBox LB_DATASOURCE - { - HelpID = "dbaccess:ListBox:DLG_DATASOURCE_SELECTION:LB_DATASOURCE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 19 ) ; - Size = MAP_APPFONT ( 154 , 94 ) ; - TabStop = TRUE ; - HScroll = TRUE ; - Sort = TRUE ; - }; - - OKButton PB_OK - { - Pos = MAP_APPFONT ( 166 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 166 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 166 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton PB_MANAGE - { - HelpID = "dbaccess:PushButton:DLG_DATASOURCE_SELECTION:PB_MANAGE"; - Pos = MAP_APPFONT ( 166 , 99 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Disable = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Organize..." ; - }; - PushButton PB_CREATE - { - HelpID = "dbaccess:PushButton:DLG_DATASOURCE_SELECTION:PB_CREATE"; - Pos = MAP_APPFONT ( 166 , 99 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Create..." ; - }; - String STR_LOCAL_DATASOURCES - { - Text [ en-US ] = "Local Databases" ; - }; - String STR_DESCRIPTION2 - { - Text [ en-US ] = "Choose a database"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index 1532133a1119..e766ed7d0809 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -78,7 +78,6 @@ #define DLG_DBASE_INDEXES RID_DIALOG_START + 1 #define DLG_SQLEXCEPTIONCHAIN RID_DIALOG_START + 3 -#define DLG_DATASOURCE_SELECTION RID_DIALOG_START + 4 #define DLG_PARAMETERS RID_DIALOG_START + 5 #define DLG_JOIN_TABADD RID_DIALOG_START + 14 |