Tag: cws_src680_kaddrbook
User: ebischoff
Date: 05/12/06 06:48:58

Modified:
 /dba/connectivity/source/drivers/kab/
  KDriver.cxx

Log:
 Runtime check that the library is available.
 I'm wondering whether I should unload the library in disposing() method.

File Changes:

Directory: /dba/connectivity/source/drivers/kab/
================================================

File [changed]: KDriver.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KDriver.cxx?r1=1.1.2.5&r2=1.1.2.6
Delta lines:  +15 -4
--------------------
--- KDriver.cxx 2 Dec 2005 20:19:12 -0000       1.1.2.5
+++ KDriver.cxx 6 Dec 2005 14:48:55 -0000       1.1.2.6
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: KDriver.cxx,v $
  *
- *  $Revision: 1.1.2.5 $
+ *  $Revision: 1.1.2.6 $
  *
- *  last change: $Author: ebischoff $ $Date: 2005/12/02 20:19:12 $
+ *  last change: $Author: ebischoff $ $Date: 2005/12/06 14:48:55 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -45,6 +45,9 @@
 #ifndef _OSL_PROCESS_H_
 #include <osl/process.h>
 #endif
+#ifndef _OSL_MODULE_H_
+#include <osl/module.h>
+#endif
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -153,8 +156,16 @@
 sal_Bool SAL_CALL KabDriver::acceptsURL( const ::rtl::OUString& url ) 
                throw(SQLException, RuntimeException)
 {
-       // here we have to look whether we support this URL format
-       return 
(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:address:kab:"), 16));
+       // we look whether we support this URL format
+       if 
(url.compareTo(::rtl::OUString::createFromAscii("sdbc:address:kab:"), 16))
+               return sal_False;
+
+       // we check that the KDE address book library is available
+       ::rtl::OUString sLibraryName = 
::rtl::OUString::createFromAscii("libkabc.so");
+       oslModule kabLib = osl_loadModule(sLibraryName.pData, 
SAL_LOADMODULE_DEFAULT); 
+       if (!kabLib) return sal_False;
+
+       return sal_True;
 }
 // 
--------------------------------------------------------------------------------
 Sequence< DriverPropertyInfo > SAL_CALL KabDriver::getPropertyInfo( const 
::rtl::OUString& url, const Sequence< PropertyValue >& info ) 
throw(SQLException, RuntimeException)




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

Reply via email to