diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-03-17 09:40:56 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-03-17 09:40:56 +0000 |
commit | ec669b4e5fb893328e334425609b324266a3f304 (patch) | |
tree | 901fdc41a1871ba8dcb9a1114111b09df7651cec /connectivity | |
parent | 1c4f39e675717e4b164b3e2b50fb402bc08cc39c (diff) |
INTEGRATION: CWS mozab03 (1.2.86); FILE MERGED
2003/11/26 14:03:47 yl146652 1.2.86.1: #21912 mapping mozilla mailing lists as sdbc views
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/mozab/MConfigAccess.cxx | 76 | ||||
-rw-r--r-- | connectivity/source/drivers/mozab/MConfigAccess.hxx | 8 |
2 files changed, 80 insertions, 4 deletions
diff --git a/connectivity/source/drivers/mozab/MConfigAccess.cxx b/connectivity/source/drivers/mozab/MConfigAccess.cxx index b80f9b487e92..7154f1e538ad 100644 --- a/connectivity/source/drivers/mozab/MConfigAccess.cxx +++ b/connectivity/source/drivers/mozab/MConfigAccess.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MConfigAccess.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hr $ $Date: 2003-03-19 16:38:28 $ + * last change: $Author: obo $ $Date: 2004-03-17 10:40:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -160,6 +160,39 @@ namespace connectivity } //----------------------------------------------------------------- + ::rtl::OUString getDescription(const sal_Char* sNode,const ::rtl::OUString & sDefault) + { + ::rtl::OUString sPreferredName; + ::rtl::OUString sDescription; + + Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory(); + OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" ); + if ( xFactory.is() ) + { + try + { + Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory ); + Reference< XPropertySet > xMozPrefsNode; + if ( xDriverNode.is() ) + xDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii( "MozillaPreferences" ) ) >>= xMozPrefsNode; + OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" ); + if ( xMozPrefsNode.is() ) + xMozPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii( "ProfileName" ) ) >>= sPreferredName; + if ( xMozPrefsNode.is() ) + xMozPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii(sNode) ) >>= sDescription; + if (sDescription.getLength() == 0) + sDescription = sDefault; + } + catch( const Exception& ) + { + OSL_ENSURE( sal_False, "getDescription: caught an exception!" ); + } + } + if (sDescription.getLength() == 0) + sDescription = sDefault; + return sDescription; + } + //----------------------------------------------------------------- ::rtl::OUString getPreferredProfileName( ) { ::rtl::OUString sPreferredName; @@ -203,6 +236,45 @@ extern "C" const sal_Unicode* SAL_CALL getUserProfile( void ) return sUserProfile.getStr(); } +//------------------------------------------------------------------------ +extern "C" const sal_Char* SAL_CALL getPabDescription( void ) +{ + static sal_Bool bReadConfig = sal_False; + static ::rtl::OUString usPabDescription; + static ::rtl::OString sPabDescription; + + if ( !bReadConfig ) + { + usPabDescription = ::connectivity::mozab::getDescription( + "PabDescription" , + ::rtl::OUString::createFromAscii( "Personal Address Book" )); + sPabDescription = ::rtl::OUStringToOString( usPabDescription, + RTL_TEXTENCODING_ASCII_US); + bReadConfig = sal_True; + } + + return sPabDescription.getStr(); +} + +//------------------------------------------------------------------------- +extern "C" const sal_Char* SAL_CALL getHisDescription( void ) +{ + static sal_Bool bReadConfig = sal_False; + static ::rtl::OUString usHisDescription; + static ::rtl::OString sHisDescription; + + if ( !bReadConfig ) + { + usHisDescription = ::connectivity::mozab::getDescription( + "HisDescription" , + ::rtl::OUString::createFromAscii( "Collected Addresses" )); + sHisDescription = ::rtl::OUStringToOString( usHisDescription, + RTL_TEXTENCODING_ASCII_US); + bReadConfig = sal_True; + } + + return sHisDescription.getStr(); +} //------------------------------------------------------------------------- extern "C" void SAL_CALL setMozabServiceFactory( void* _pFactory ) diff --git a/connectivity/source/drivers/mozab/MConfigAccess.hxx b/connectivity/source/drivers/mozab/MConfigAccess.hxx index 6e7e66be2d35..903289042a06 100644 --- a/connectivity/source/drivers/mozab/MConfigAccess.hxx +++ b/connectivity/source/drivers/mozab/MConfigAccess.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MConfigAccess.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hr $ $Date: 2003-03-19 16:38:29 $ + * last change: $Author: obo $ $Date: 2004-03-17 10:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,5 +67,9 @@ extern "C" const sal_Unicode* SAL_CALL getUserProfile( void ); +extern "C" const sal_Char* SAL_CALL getPabDescription( void ); + +extern "C" const sal_Char* SAL_CALL getHisDescription( void ); + #endif // CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX |