Tag: cws_src680_dba23b User: fs Date: 2007-07-04 10:34:32+0000 Modified: dba/dbaccess/source/ui/dlg/dsselect.cxx dba/dbaccess/source/ui/dlg/dsselect.hxx
Log: #i78733# managing data sources now done by an external process File Changes: Directory: /dba/dbaccess/source/ui/dlg/ ======================================= File [changed]: dsselect.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/dsselect.cxx?r1=1.19&r2=1.19.14.1 Delta lines: +45 -16 --------------------- --- dsselect.cxx 2007-04-26 08:00:01+0000 1.19 +++ dsselect.cxx 2007-07-04 10:34:29+0000 1.19.14.1 @@ -4,9 +4,9 @@ * * $RCSfile: dsselect.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.19.14.1 $ * - * last change: $Author: rt $ $Date: 2007/04/26 08:00:01 $ + * last change: $Author: fs $ $Date: 2007/07/04 10:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -189,6 +189,11 @@ } // ----------------------------------------------------------------------- +ODatasourceSelectDialog::~ODatasourceSelectDialog() +{ +} + +// ----------------------------------------------------------------------- IMPL_LINK( ODatasourceSelectDialog, ListDblClickHdl, ListBox *, pListBox ) { if (pListBox->GetSelectEntryCount()) @@ -252,33 +257,57 @@ } return 0L; } + +// ----------------------------------------------------------------------- +BOOL ODatasourceSelectDialog::Close() +{ +#ifdef HAVE_ODBC_ADMINISTRATION + if ( m_pODBCManagement.get() && m_pODBCManagement->isRunning() ) + return FALSE; +#endif + + return ModalDialog::Close(); +} + // ----------------------------------------------------------------------- #ifdef HAVE_ODBC_ADMINISTRATION IMPL_LINK( ODatasourceSelectDialog, ManageClickHdl, PushButton*, EMPTYARG ) { - OOdbcManagement aOdbcConfig; - if (!aOdbcConfig.isLoaded()) + if ( !m_pODBCManagement.get() ) + m_pODBCManagement.reset( new OOdbcManagement( LINK( this, ODatasourceSelectDialog, ManageProcessFinished ) ) ); + + if ( !m_pODBCManagement->manageDataSources_async() ) { - // show an error message - LocalResourceAccess aLocRes(DLG_DATASOURCE_SELECTION, RSC_MODALDIALOG); - String sError(ModuleRes(STR_COULDNOTLOAD_CONFIGLIB)); - sError.SearchAndReplaceAscii("#lib#", aOdbcConfig.getLibraryName()); - ErrorBox aDialog(this, WB_OK, sError); - aDialog.Execute(); + // TODO: error message m_aDatasource.GrabFocus(); m_aManageDatasources.Disable(); return 1L; } - aOdbcConfig.manageDataSources(GetSystemData()->hWnd); - // now we have to look if there are any new datasources added + m_aDatasource.Disable(); + m_aOk.Disable(); + m_aCancel.Disable(); + m_aManageDatasources.Disable(); + + OSL_POSTCOND( m_pODBCManagement->isRunning(), "ODatasourceSelectDialog::ManageClickHdl: success, but not running - you were *fast*!" ); + return 0L; +} + +IMPL_LINK( ODatasourceSelectDialog, ManageProcessFinished, void*, /**/ ) +{ StringBag aOdbcDatasources; OOdbcEnumeration aEnumeration; - aEnumeration.getDatasourceNames(aOdbcDatasources); - fillListBox(aOdbcDatasources); + aEnumeration.getDatasourceNames( aOdbcDatasources ); + fillListBox( aOdbcDatasources ); + + m_aDatasource.Enable(); + m_aOk.Enable(); + m_aCancel.Enable(); + m_aManageDatasources.Enable(); return 0L; } + #endif // ----------------------------------------------------------------------------- void ODatasourceSelectDialog::fillListBox(const StringBag& _rDatasources) File [changed]: dsselect.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/dsselect.hxx?r1=1.6&r2=1.6.282.1 Delta lines: +13 -4 -------------------- --- dsselect.hxx 2005-09-08 15:03:18+0000 1.6 +++ dsselect.hxx 2007-07-04 10:34:29+0000 1.6.282.1 @@ -4,9 +4,9 @@ * * $RCSfile: dsselect.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.6.282.1 $ * - * last change: $Author: rt $ $Date: 2005/09/08 15:03:18 $ + * last change: $Author: fs $ $Date: 2007/07/04 10:34:29 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,12 +61,15 @@ #include "commontypes.hxx" #endif +#include <memory> + class SfxItemSet; //......................................................................... namespace dbaui { //......................................................................... +class OOdbcManagement; //========================================================================= //= ODatasourceSelector //========================================================================= @@ -81,16 +84,22 @@ PushButton m_aManageDatasources; PushButton m_aCreateAdabasDB; SfxItemSet* m_pOutputSet; + ::std::auto_ptr< OOdbcManagement > + m_pODBCManagement; public: - ODatasourceSelectDialog(Window* _pParent, const StringBag& _rDatasources, DATASOURCE_TYPE _eType,SfxItemSet* _pOutputSet = NULL); + ODatasourceSelectDialog( Window* _pParent, const StringBag& _rDatasources, DATASOURCE_TYPE _eType,SfxItemSet* _pOutputSet = NULL ); + ~ODatasourceSelectDialog(); inline String GetSelected() const { return m_aDatasource.GetSelectEntry();} void Select( const String& _rEntry ) { m_aDatasource.SelectEntry(_rEntry); } + virtual BOOL Close(); + protected: DECL_LINK( ListDblClickHdl, ListBox * ); DECL_LINK( ManageClickHdl, PushButton * ); + DECL_LINK( ManageProcessFinished, void* ); DECL_LINK( CreateDBClickHdl, PushButton * ); void fillListBox(const StringBag& _rDatasources); }; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
