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 | |
parent | a51929600789af4d67e4f52226f8f5ae13ed58ba (diff) |
convert select data source dialog to .ui
Change-Id: I1506f59dc6e6b6bd2b9cb1a7dd36044bef7f40e2
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/AllLangResTarget_dbu.mk | 1 | ||||
-rw-r--r-- | dbaccess/UIConfig_dbaccess.mk | 1 | ||||
-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 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/choosedatasourcedialog.ui | 125 |
8 files changed, 164 insertions, 178 deletions
diff --git a/dbaccess/AllLangResTarget_dbu.mk b/dbaccess/AllLangResTarget_dbu.mk index f0b87a0ecb65..af9c757f1559 100644 --- a/dbaccess/AllLangResTarget_dbu.mk +++ b/dbaccess/AllLangResTarget_dbu.mk @@ -45,7 +45,6 @@ $(eval $(call gb_SrsTarget_add_files,dbaccess/dbu,\ dbaccess/source/ui/dlg/dbadmin.src \ dbaccess/source/ui/dlg/dbfindex.src \ dbaccess/source/ui/dlg/directsql.src \ - dbaccess/source/ui/dlg/dsselect.src \ dbaccess/source/ui/dlg/indexdialog.src \ dbaccess/source/ui/dlg/paramdialog.src \ dbaccess/source/ui/dlg/RelationDlg.src \ diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk index 0d5ff656878c..ce70f561ba2e 100644 --- a/dbaccess/UIConfig_dbaccess.mk +++ b/dbaccess/UIConfig_dbaccess.mk @@ -12,6 +12,7 @@ $(eval $(call gb_UIConfig_UIConfig,dbaccess)) $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \ dbaccess/uiconfig/ui/admindialog \ dbaccess/uiconfig/ui/advancedsettingsdialog \ + dbaccess/uiconfig/ui/choosedatasourcedialog \ dbaccess/uiconfig/ui/colwidthdialog \ dbaccess/uiconfig/ui/directsqldialog \ dbaccess/uiconfig/ui/fielddialog \ 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 diff --git a/dbaccess/uiconfig/ui/choosedatasourcedialog.ui b/dbaccess/uiconfig/ui/choosedatasourcedialog.ui new file mode 100644 index 000000000000..b6202f82bab8 --- /dev/null +++ b/dbaccess/uiconfig/ui/choosedatasourcedialog.ui @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.16.1 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <object class="GtkDialog" id="ChooseDataSourceDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Data Source</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="organize"> + <property name="label" translatable="yes">Or_ganize...</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="no_show_all">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> + <property name="secondary">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkTreeView" id="treeview:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Choose a data source:</property> + <attributes> + <attribute name="weight" value="semibold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + </action-widgets> + </object> +</interface> |