User: rt      
Date: 2007-07-24 12:07:54+0000
Modified:
   dba/dbaccess/source/ui/dlg/dsselect.cxx

Log:
 INTEGRATION: CWS dba23b (1.19.14); FILE MERGED
 2007/07/11 11:53:25 fs 1.19.14.3: RESYNC: (1.19-1.20); FILE MERGED
 2007/07/04 11:48:28 fs 1.19.14.2: #i10000#
 2007/07/04 10:34:29 fs 1.19.14.1: #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.20&r2=1.21
Delta lines:  +44 -17
---------------------
--- dsselect.cxx        2007-07-06 08:16:45+0000        1.20
+++ dsselect.cxx        2007-07-24 12:07:51+0000        1.21
@@ -36,10 +36,6 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_dbaccess.hxx"
 
-#ifndef _DBAUI_ODBC_CONFIG_HXX_
-#include "odbcconfig.hxx"
-#endif
-
 #ifndef _DBAUI_DSSELECT_HXX_
 #include "dsselect.hxx"
 #endif
@@ -132,7 +128,9 @@
         ,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_aCreateAdabasDB             (this, ModuleRes(PB_CREATE))
         ,m_pOutputSet(_pOutputSet)
 {
@@ -186,6 +184,11 @@
 }
 
 // -----------------------------------------------------------------------
+ODatasourceSelectDialog::~ODatasourceSelectDialog()
+{
+}
+
+// -----------------------------------------------------------------------
 IMPL_LINK( ODatasourceSelectDialog, ListDblClickHdl, ListBox *, pListBox )
 {
        if (pListBox->GetSelectEntryCount())
@@ -249,33 +252,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)




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to