diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-01-26 14:35:54 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@novell.com> | 2011-01-26 14:37:54 +0100 |
commit | a70df88b2c909228eef492da32672149b808eb48 (patch) | |
tree | 984d3afa31c0baaad82f74e648cb293c6f9353ce | |
parent | 0f5327324e4d3033bcc48ffc8f2018f6a2572b2d (diff) |
dba34a: #i107809# drop support for old Mozilla profile format, support new-style SeaMonkey profiles
(cherry-picked from hg 272071:d5b3bb5ca529)
6 files changed, 9 insertions, 147 deletions
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx index 7db552d230..e9589a0582 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx @@ -52,14 +52,6 @@ using namespace ::com::sun::star::mozilla; namespace { - #if defined(XP_MAC) || defined(XP_MACOSX) || defined(MACOSX) - #define APP_REGISTRY_NAME "Application Registry" - #elif defined(XP_WIN) || defined(XP_OS2) - #define APP_REGISTRY_NAME "registry.dat" - #else - #define APP_REGISTRY_NAME "appreg" - #endif - // ------------------------------------------------------------------- static ::rtl::OUString lcl_getUserDataDirectory() { @@ -74,15 +66,15 @@ namespace static const char* DefaultProductDir[3][3] = { #if defined(XP_WIN) - { "Mozilla/", NULL, NULL }, + { "Mozilla/SeaMonkey/", NULL, NULL }, { "Mozilla/Firefox/", NULL, NULL }, { "Thunderbird/", "Mozilla/Thunderbird/", NULL } #elif(MACOSX) - { "../Mozilla/", NULL, NULL }, + { "../Mozilla/SeaMonkey/", NULL, NULL }, { "Firefox/", NULL, NULL }, { "../Thunderbird/", NULL, NULL } #else - { ".mozilla/", NULL, NULL }, + { ".mozilla/seamonkey/", NULL, NULL }, { ".mozilla/firefox/", NULL, NULL }, { ".thunderbird/", ".mozilla-thunderbird/", ".mozilla/thunderbird/" } #endif @@ -116,7 +108,7 @@ namespace else { ::rtl::OUString sProductDirCandidate; - const char* pProfileRegistry = ( _product == MozillaProductType_Mozilla ) ? APP_REGISTRY_NAME : "profiles.ini"; + const char* pProfileRegistry = "profiles.ini"; // check all possible candidates for ( size_t i=0; i<3; ++i ) @@ -160,15 +152,5 @@ namespace return lcl_guessProfileRoot( product ); } -#ifndef MINIMAL_PROFILEDISCOVER -// ----------------------------------------------------------------------- -::rtl::OUString getRegistryFileName(MozillaProductType product) -{ - if (product == MozillaProductType_Default) - return ::rtl::OUString(); - - return getRegistryDir(product) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APP_REGISTRY_NAME)); -} -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx index 3ddf002c34..a3a52f68e8 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx @@ -37,9 +37,6 @@ #include <rtl/ustring.hxx> ::rtl::OUString getRegistryDir(::com::sun::star::mozilla::MozillaProductType product); -#ifndef MINIMAL_PROFILEDISCOVER -::rtl::OUString getRegistryFileName(::com::sun::star::mozilla::MozillaProductType product); -#endif #endif diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx index f620c90f33..42d6a9c9c7 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx @@ -144,12 +144,9 @@ namespace connectivity sal_Int32 ProfileAccess::LoadProductsInfo() { -#ifndef MINIMAL_PROFILEDISCOVER - //load mozilla profiles to m_ProductProfileList - LoadMozillaProfiles(); -#endif - sal_Int32 count=static_cast<sal_Int32>(m_ProductProfileList[MozillaProductType_Mozilla].mProfileList.size()); - + //load SeaMonkey 2 profiles to m_ProductProfileList + sal_Int32 count = LoadXPToolkitProfiles(MozillaProductType_Mozilla); + //load thunderbird profiles to m_ProductProfileList count += LoadXPToolkitProfiles(MozillaProductType_Thunderbird); @@ -158,117 +155,6 @@ namespace connectivity count += LoadXPToolkitProfiles(MozillaProductType_Firefox); return count; } -#ifndef MINIMAL_PROFILEDISCOVER - nsresult ProfileAccess::LoadMozillaProfiles() - { - sal_Int32 index=MozillaProductType_Mozilla; - ProductStruct &m_Product = m_ProductProfileList[index]; - nsresult rv = NS_OK; - - //step 1 : get mozilla registry file - nsCOMPtr<nsILocalFile> localFile; - ::rtl::OUString regDir( getRegistryFileName( MozillaProductType_Mozilla ) ); - // PRUnichar != sal_Unicode in mingw - nsAutoString registryDir(reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr())); - rv = NS_NewLocalFile(registryDir, PR_TRUE, - getter_AddRefs(localFile)); - NS_ENSURE_SUCCESS(rv,rv); - PRBool bExist; - rv = localFile->Exists(&bExist); - NS_ENSURE_SUCCESS(rv,rv); - if (!bExist) - return rv; - nsCOMPtr<nsIRegistry> registry(do_CreateInstance(NS_REGISTRY_CONTRACTID, &rv)); - NS_ENSURE_SUCCESS(rv,rv); - //step 2: open mozilla registry file - rv = registry->Open(localFile); - NS_ENSURE_SUCCESS(rv,rv); - - nsCOMPtr<nsIEnumerator> enumKeys; - nsRegistryKey profilesTreeKey; - - //step 3:Enumerator it - rv = registry->GetKey(nsIRegistry::Common, - // PRUnichar != sal_Unicode in mingw - reinterpret_cast_mingw_only<const PRUnichar *>(szProfileSubtreeString.getStr()), - &profilesTreeKey); - if (NS_FAILED(rv)) return rv; - - nsXPIDLString tmpCurrentProfile; - - // Get the current profile - rv = registry->GetString(profilesTreeKey, - // PRUnichar != sal_Unicode in mingw - reinterpret_cast_mingw_only<const PRUnichar *>(szCurrentProfileString.getStr()), - getter_Copies(tmpCurrentProfile)); - - if (tmpCurrentProfile) - { - // PRUnichar != sal_Unicode in mingw - m_Product.setCurrentProfile ( reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, tmpCurrentProfile))); - } - - - rv = registry->EnumerateSubtrees( profilesTreeKey, getter_AddRefs(enumKeys)); - NS_ENSURE_SUCCESS(rv,rv); - - rv = enumKeys->First(); - NS_ENSURE_SUCCESS(rv,rv); - - while (NS_OK != enumKeys->IsDone()) - { - nsCOMPtr<nsISupports> base; - - rv = enumKeys->CurrentItem( getter_AddRefs(base) ); - NS_ENSURE_SUCCESS(rv,rv); - rv = enumKeys->Next(); - NS_ENSURE_SUCCESS(rv,rv); - - // Get specific interface. - nsCOMPtr <nsIRegistryNode> node; - nsIID nodeIID = NS_IREGISTRYNODE_IID; - - rv = base->QueryInterface( nodeIID, getter_AddRefs(node)); - if (NS_FAILED(rv)) continue; - - // Get node name. - nsXPIDLString profile; - rv = node->GetName(getter_Copies(profile)); - if (NS_FAILED(rv)) continue; - - nsRegistryKey profKey; - rv = node->GetKey(&profKey); - if (NS_FAILED(rv)) continue; - - - nsCOMPtr<nsILocalFile> tempLocal; - - nsXPIDLString regData; - rv = registry->GetString(profKey, - // PRUnichar != sal_Unicode in mingw - reinterpret_cast_mingw_only<const PRUnichar *>(szDirectoryString.getStr()), - getter_Copies(regData)); - if (NS_FAILED(rv)) continue; - -#if defined(XP_MAC) || defined(XP_MACOSX) || defined(MACOSX) - rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(tempLocal)); - if (NS_SUCCEEDED(rv)) - rv = tempLocal->SetPersistentDescriptor(NS_LossyConvertUCS2toASCII(regData)); -#else - rv = NS_NewLocalFile(regData, PR_TRUE, getter_AddRefs(tempLocal)); -#endif - //Add found profile to profile lists - if (NS_SUCCEEDED(rv) && tempLocal) - { - // PRUnichar != sal_Unicode in mingw - ProfileStruct* profileItem = new ProfileStruct(MozillaProductType_Mozilla,reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, profile)),tempLocal); - m_Product.mProfileList[profileItem->getProfileName()] = profileItem; - } - - } - return rv; - } -#endif //Thunderbird and firefox profiles are saved in profiles.ini sal_Int32 ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product) { diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx index 1ce1617bad..5a9e61ebf8 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx @@ -115,9 +115,6 @@ namespace connectivity protected: ProductStruct m_ProductProfileList[4]; sal_Int32 LoadProductsInfo(); -#ifndef MINIMAL_PROFILEDISCOVER - nsresult LoadMozillaProfiles(); -#endif sal_Int32 LoadXPToolkitProfiles(MozillaProductType product); #ifndef MINIMAL_PROFILEDISCOVER //used by isProfileLocked diff --git a/connectivity/source/drivers/mozab/mozab.xcu b/connectivity/source/drivers/mozab/mozab.xcu index 837e180ba5..638cbeb2c0 100755 --- a/connectivity/source/drivers/mozab/mozab.xcu +++ b/connectivity/source/drivers/mozab/mozab.xcu @@ -62,7 +62,7 @@ <value>com.sun.star.comp.sdbc.MozabDriver</value> </prop> <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Mozilla Address Book</value> + <value xml:lang="en-US">SeaMonkey Address Book</value> </prop> <node oor:name="Features"> <node oor:name="EscapeDateTime" oor:op="replace"> diff --git a/connectivity/source/drivers/mozab/mozab2.xcu b/connectivity/source/drivers/mozab/mozab2.xcu index 898c099fc7..18cb3c1eaf 100755 --- a/connectivity/source/drivers/mozab/mozab2.xcu +++ b/connectivity/source/drivers/mozab/mozab2.xcu @@ -32,7 +32,7 @@ <value>com.sun.star.comp.sdbc.MozabDriver</value> </prop> <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Mozilla Address Book</value> + <value xml:lang="en-US">SeaMonkey Address Book</value> </prop> <node oor:name="MetaData"> <node oor:name="SupportsBrowsing" oor:op="replace"> |