From 36026a6ae5d2f42db5fa262a358a3bc8e33e036c Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sun, 30 Sep 2012 19:53:40 +0200 Subject: mork driver: add list tables and unit test Change-Id: I594b24341eb38c05523f578c1dc2e43d90544f30 --- connectivity/source/drivers/mork/MConnection.cxx | 28 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'connectivity/source/drivers/mork/MConnection.cxx') diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx index a35badddc2c8..47525d2f946b 100644 --- a/connectivity/source/drivers/mork/MConnection.cxx +++ b/connectivity/source/drivers/mork/MConnection.cxx @@ -85,11 +85,11 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV nLen = url.indexOf(':',nLen+1); OSL_ENSURE( url.copy( 0, nLen ) == "sdbc:address", "OConnection::construct: invalid start of the URI - should never have survived XDriver::acceptsURL!" ); - ::rtl::OUString aAddrbookURI(url.copy(nLen+1)); + OUString aAddrbookURI(url.copy(nLen+1)); // Get Scheme nLen = aAddrbookURI.indexOf(':'); - ::rtl::OUString aAddrbookScheme; - ::rtl::OUString sAdditionalInfo; + OUString aAddrbookScheme; + OUString sAdditionalInfo; if ( nLen == -1 ) { // There isn't any subschema: - but could be just subschema @@ -112,13 +112,23 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV SAL_INFO("connectivity.mork", "URI = " << aAddrbookURI ); SAL_INFO("connectivity.mork", "Scheme = " << aAddrbookScheme ); - ::rtl::OUString defaultProfile = m_pProfileAccess->getDefaultProfile(::com::sun::star::mozilla::MozillaProductType_Thunderbird); - SAL_INFO("connectivity.mork", "DefaultProfile: " << defaultProfile); + OUString path; + const OUString UNITTEST_URL = "thunderbird:unittest:"; + sal_Int32 unittestIndex = url.indexOf(UNITTEST_URL); - ::rtl::OUString path = m_pProfileAccess->getProfilePath(::com::sun::star::mozilla::MozillaProductType_Thunderbird, defaultProfile); - SAL_INFO("connectivity.mork", "ProfilePath: " << path); - - path += rtl::OUString( "/abook.mab" ); + // production? + if (unittestIndex == -1) + { + OUString defaultProfile = m_pProfileAccess->getDefaultProfile(::com::sun::star::mozilla::MozillaProductType_Thunderbird); + path = m_pProfileAccess->getProfilePath(::com::sun::star::mozilla::MozillaProductType_Thunderbird, defaultProfile); + SAL_INFO("connectivity.mork", "DefaultProfile: " << defaultProfile); + SAL_INFO("connectivity.mork", "ProfilePath: " << path); + path += rtl::OUString( "/abook.mab" ); + } + else + { + path = aAddrbookURI.replaceFirst(UNITTEST_URL, ""); + } SAL_INFO("connectivity.mork", "AdressbookPath: " << path); -- cgit