1 # HG changeset patch |
1 # HG changeset patch |
2 # Parent 564e9441f71b5bc368c33697428f756f5914eb04 |
2 # Parent 1fccdb56cf307cef5ddd39ece2ac58c93fe706b8 |
3 Description: Add KDE integration to Firefox (toolkit parts) |
3 Description: Add KDE integration to Firefox (toolkit parts) |
4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org> |
4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org> |
5 Author: Lubos Lunak <lunak@suse.com> |
5 Author: Lubos Lunak <lunak@suse.com> |
6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 |
6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 |
7 https://bugzilla.novell.com/show_bug.cgi?id=170055 |
7 https://bugzilla.novell.com/show_bug.cgi?id=170055 |
25 |
25 |
26 #include "prefapi.h" |
26 #include "prefapi.h" |
27 #include "prefread.h" |
27 #include "prefread.h" |
28 #include "prefapi_private_data.h" |
28 #include "prefapi_private_data.h" |
29 |
29 |
30 @@ -1174,16 +1175,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char |
30 @@ -1199,16 +1200,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char |
31 |
31 |
32 static nsresult pref_LoadPrefsInDirList(const char *listId) |
32 static nsresult pref_LoadPrefsInDirList(const char *listId) |
33 { |
33 { |
34 nsresult rv; |
34 nsresult rv; |
35 nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); |
35 nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); |
60 getter_AddRefs(list)); |
60 getter_AddRefs(list)); |
61 if (!list) |
61 if (!list) |
62 return NS_OK; |
62 return NS_OK; |
63 |
63 |
64 bool hasMore; |
64 bool hasMore; |
65 @@ -1199,17 +1218,17 @@ static nsresult pref_LoadPrefsInDirList( |
65 @@ -1224,17 +1243,17 @@ static nsresult pref_LoadPrefsInDirList( |
66 |
66 |
67 nsAutoCString leaf; |
67 nsAutoCString leaf; |
68 path->GetNativeLeafName(leaf); |
68 path->GetNativeLeafName(leaf); |
69 |
69 |
70 // Do we care if a file provided by this process fails to load? |
70 // Do we care if a file provided by this process fails to load? |
79 |
79 |
80 static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name) |
80 static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name) |
81 { |
81 { |
82 nsZipItemPtr<char> manifest(jarReader, name, true); |
82 nsZipItemPtr<char> manifest(jarReader, name, true); |
83 NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE); |
83 NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE); |
84 @@ -1303,24 +1322,36 @@ static nsresult pref_InitInitialObjects( |
84 @@ -1328,24 +1347,36 @@ static nsresult pref_InitInitialObjects( |
85 /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */ |
85 /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */ |
86 static const char* specialFiles[] = { |
86 static const char* specialFiles[] = { |
87 #if defined(XP_MACOSX) |
87 #if defined(XP_MACOSX) |
88 "macprefs.js" |
88 "macprefs.js" |
89 #elif defined(XP_WIN) |
89 #elif defined(XP_WIN) |
2167 +# PrefWindow I (June 4, 1999) |
2167 +# PrefWindow I (June 4, 1999) |
2168 +# |
2168 +# |
2169 diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js |
2169 diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js |
2170 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js |
2170 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js |
2171 +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js |
2171 +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js |
2172 @@ -627,17 +627,17 @@ nsUnknownContentTypeDialog.prototype = { |
2172 @@ -629,17 +629,17 @@ nsUnknownContentTypeDialog.prototype = { |
2173 else |
2173 else |
2174 typeString = mimeInfo.MIMEType; |
2174 typeString = mimeInfo.MIMEType; |
2175 } |
2175 } |
2176 // When the length is unknown, contentLength would be -1 |
2176 // When the length is unknown, contentLength would be -1 |
2177 if (this.mLauncher.contentLength >= 0) { |
2177 if (this.mLauncher.contentLength >= 0) { |
2186 type.value = typeString; |
2186 type.value = typeString; |
2187 } |
2187 } |
2188 }, |
2188 }, |
2189 |
2189 |
2190 // Returns true if opening the default application makes sense. |
2190 // Returns true if opening the default application makes sense. |
2191 @@ -801,17 +801,17 @@ nsUnknownContentTypeDialog.prototype = { |
2191 @@ -803,17 +803,17 @@ nsUnknownContentTypeDialog.prototype = { |
2192 switch (this.dialogElement("openHandler").selectedIndex) { |
2192 switch (this.dialogElement("openHandler").selectedIndex) { |
2193 case 0: |
2193 case 0: |
2194 // No app need be specified in this case. |
2194 // No app need be specified in this case. |
2195 ok = true; |
2195 ok = true; |
2196 break; |
2196 break; |
2205 |
2205 |
2206 // Enable Ok button if ok to press. |
2206 // Enable Ok button if ok to press. |
2207 this.mDialog.document.documentElement.getButton("accept").disabled = !ok; |
2207 this.mDialog.document.documentElement.getButton("accept").disabled = !ok; |
2208 }, |
2208 }, |
2209 |
2209 |
2210 @@ -1068,30 +1068,56 @@ nsUnknownContentTypeDialog.prototype = { |
2210 @@ -1070,30 +1070,56 @@ nsUnknownContentTypeDialog.prototype = { |
2211 params.handlerApp.executable && |
2211 params.handlerApp.executable && |
2212 params.handlerApp.executable.isFile()) { |
2212 params.handlerApp.executable.isFile()) { |
2213 // Remember the file they chose to run. |
2213 // Remember the file they chose to run. |
2214 this.chosenApp = params.handlerApp; |
2214 this.chosenApp = params.handlerApp; |
2215 } |
2215 } |
3176 #include "nsReadableUtils.h" |
3176 #include "nsReadableUtils.h" |
3177 #include "nsUnicharUtils.h" |
3177 #include "nsUnicharUtils.h" |
3178 #include "nsXPIDLString.h" |
3178 #include "nsXPIDLString.h" |
3179 #include "nsIURL.h" |
3179 #include "nsIURL.h" |
3180 #include "nsIFileStreams.h" |
3180 #include "nsIFileStreams.h" |
3181 @@ -1146,26 +1146,26 @@ nsresult nsOSHelperAppService::OSProtoco |
3181 @@ -1147,26 +1147,26 @@ nsresult nsOSHelperAppService::OSProtoco |
3182 ContentAction::Action::defaultActionForScheme(QString(aProtocolScheme) + ':'); |
3182 ContentAction::Action::defaultActionForScheme(QString(aProtocolScheme) + ':'); |
3183 |
3183 |
3184 if (action.isValid()) |
3184 if (action.isValid()) |
3185 *aHandlerExists = true; |
3185 *aHandlerExists = true; |
3186 #endif |
3186 #endif |
3205 #endif |
3205 #endif |
3206 } |
3206 } |
3207 |
3207 |
3208 nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile) |
3208 nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile) |
3209 { |
3209 { |
3210 @@ -1252,17 +1252,17 @@ nsOSHelperAppService::GetFromExtension(c |
3210 @@ -1253,17 +1253,17 @@ nsOSHelperAppService::GetFromExtension(c |
3211 mime_types_description, |
3211 mime_types_description, |
3212 true); |
3212 true); |
3213 |
3213 |
3214 if (NS_FAILED(rv) || majorType.IsEmpty()) { |
3214 if (NS_FAILED(rv) || majorType.IsEmpty()) { |
3215 |
3215 |
3224 } |
3224 } |
3225 #endif |
3225 #endif |
3226 |
3226 |
3227 rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), |
3227 rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), |
3228 majorType, |
3228 majorType, |
3229 @@ -1373,17 +1373,17 @@ nsOSHelperAppService::GetFromType(const |
3229 @@ -1374,17 +1374,17 @@ nsOSHelperAppService::GetFromType(const |
3230 nsAutoString extensions, mime_types_description; |
3230 nsAutoString extensions, mime_types_description; |
3231 LookUpExtensionsAndDescription(majorType, |
3231 LookUpExtensionsAndDescription(majorType, |
3232 minorType, |
3232 minorType, |
3233 extensions, |
3233 extensions, |
3234 mime_types_description); |
3234 mime_types_description); |
3621 |
3621 |
3622 #endif |
3622 #endif |
3623 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp |
3623 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp |
3624 --- a/xpcom/components/ManifestParser.cpp |
3624 --- a/xpcom/components/ManifestParser.cpp |
3625 +++ b/xpcom/components/ManifestParser.cpp |
3625 +++ b/xpcom/components/ManifestParser.cpp |
3626 @@ -32,16 +32,17 @@ |
3626 @@ -33,16 +33,17 @@ |
3627 #include "nsTextFormatter.h" |
3627 #include "nsTextFormatter.h" |
3628 #include "nsVersionComparator.h" |
3628 #include "nsVersionComparator.h" |
3629 #include "nsXPCOMCIDInternal.h" |
3629 #include "nsXPCOMCIDInternal.h" |
3630 |
3630 |
3631 #include "nsIConsoleService.h" |
3631 #include "nsIConsoleService.h" |
3639 struct ManifestDirective |
3639 struct ManifestDirective |
3640 { |
3640 { |
3641 const char* directive; |
3641 const char* directive; |
3642 int argc; |
3642 int argc; |
3643 |
3643 |
3644 @@ -472,16 +473,17 @@ ParseManifest(NSLocationType aType, File |
3644 @@ -466,16 +467,17 @@ ParseManifest(NSLocationType aType, File |
3645 NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled"); |
3645 NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled"); |
3646 NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired"); |
3646 NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired"); |
3647 NS_NAMED_LITERAL_STRING(kApplication, "application"); |
3647 NS_NAMED_LITERAL_STRING(kApplication, "application"); |
3648 NS_NAMED_LITERAL_STRING(kAppVersion, "appversion"); |
3648 NS_NAMED_LITERAL_STRING(kAppVersion, "appversion"); |
3649 NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion"); |
3649 NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion"); |
3657 #endif |
3657 #endif |
3658 |
3658 |
3659 NS_NAMED_LITERAL_STRING(kMain, "main"); |
3659 NS_NAMED_LITERAL_STRING(kMain, "main"); |
3660 NS_NAMED_LITERAL_STRING(kContent, "content"); |
3660 NS_NAMED_LITERAL_STRING(kContent, "content"); |
3661 |
3661 |
3662 @@ -532,44 +534,49 @@ ParseManifest(NSLocationType aType, File |
3662 @@ -526,44 +528,49 @@ ParseManifest(NSLocationType aType, File |
3663 CopyUTF8toUTF16(s, abi); |
3663 CopyUTF8toUTF16(s, abi); |
3664 abi.Insert(char16_t('_'), 0); |
3664 abi.Insert(char16_t('_'), 0); |
3665 abi.Insert(osTarget, 0); |
3665 abi.Insert(osTarget, 0); |
3666 } |
3666 } |
3667 } |
3667 } |
3707 process = kContent; |
3707 process = kContent; |
3708 } else { |
3708 } else { |
3709 process = kMain; |
3709 process = kMain; |
3710 } |
3710 } |
3711 |
3711 |
3712 @@ -672,25 +679,27 @@ ParseManifest(NSLocationType aType, File |
3712 @@ -666,25 +673,27 @@ ParseManifest(NSLocationType aType, File |
3713 TriState stOsVersion = eUnspecified; |
3713 TriState stOsVersion = eUnspecified; |
3714 TriState stOs = eUnspecified; |
3714 TriState stOs = eUnspecified; |
3715 TriState stABI = eUnspecified; |
3715 TriState stABI = eUnspecified; |
3716 TriState stProcess = eUnspecified; |
3716 TriState stProcess = eUnspecified; |
3717 #if defined(MOZ_WIDGET_ANDROID) |
3717 #if defined(MOZ_WIDGET_ANDROID) |
3735 CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion)) { |
3735 CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion)) { |
3736 continue; |
3736 continue; |
3737 } |
3737 } |
3738 |
3738 |
3739 #if defined(MOZ_WIDGET_ANDROID) |
3739 #if defined(MOZ_WIDGET_ANDROID) |
3740 @@ -740,16 +749,17 @@ ParseManifest(NSLocationType aType, File |
3740 @@ -734,16 +743,17 @@ ParseManifest(NSLocationType aType, File |
3741 } |
3741 } |
3742 |
3742 |
3743 if (!ok || |
3743 if (!ok || |
3744 stApp == eBad || |
3744 stApp == eBad || |
3745 stAppVersion == eBad || |
3745 stAppVersion == eBad || |
3756 } |
3756 } |
3757 |
3757 |
3758 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build |
3758 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build |
3759 --- a/xpcom/components/moz.build |
3759 --- a/xpcom/components/moz.build |
3760 +++ b/xpcom/components/moz.build |
3760 +++ b/xpcom/components/moz.build |
3761 @@ -43,12 +43,13 @@ FINAL_LIBRARY = 'xul' |
3761 @@ -50,12 +50,13 @@ FINAL_LIBRARY = 'xul' |
3762 LOCAL_INCLUDES += [ |
3762 LOCAL_INCLUDES += [ |
3763 '!..', |
3763 '!..', |
3764 '../base', |
3764 '../base', |
3765 '../build', |
3765 '../build', |
3766 '../ds', |
3766 '../ds', |
3791 #include <Carbon/Carbon.h> |
3791 #include <Carbon/Carbon.h> |
3792 #include "CocoaFileUtils.h" |
3792 #include "CocoaFileUtils.h" |
3793 #include "prmem.h" |
3793 #include "prmem.h" |
3794 #include "plbase64.h" |
3794 #include "plbase64.h" |
3795 |
3795 |
3796 @@ -1949,42 +1950,52 @@ nsLocalFile::SetPersistentDescriptor(con |
3796 @@ -1948,59 +1949,74 @@ nsLocalFile::SetPersistentDescriptor(con |
3797 return InitWithNativePath(aPersistentDescriptor); |
3797 return InitWithNativePath(aPersistentDescriptor); |
3798 #endif |
3798 #endif |
3799 } |
3799 } |
3800 |
3800 |
3801 NS_IMETHODIMP |
3801 NS_IMETHODIMP |
3815 |
3815 |
3816 + nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); |
3816 + nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); |
3817 if (isDirectory) { |
3817 if (isDirectory) { |
3818 - return giovfs->ShowURIForInput(mPath); |
3818 - return giovfs->ShowURIForInput(mPath); |
3819 + url = mPath; |
3819 + url = mPath; |
3820 } else if (NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) { |
3820 } |
|
3821 if (NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) { |
3821 return NS_OK; |
3822 return NS_OK; |
3822 } else { |
|
3823 nsCOMPtr<nsIFile> parentDir; |
|
3824 nsAutoCString dirPath; |
|
3825 if (NS_FAILED(GetParent(getter_AddRefs(parentDir)))) { |
|
3826 return NS_ERROR_FAILURE; |
|
3827 } |
|
3828 if (NS_FAILED(parentDir->GetNativePath(dirPath))) { |
|
3829 return NS_ERROR_FAILURE; |
|
3830 } |
|
3831 |
|
3832 - return giovfs->ShowURIForInput(dirPath); |
|
3833 + url = dirPath; |
|
3834 } |
3823 } |
3835 + |
3824 nsCOMPtr<nsIFile> parentDir; |
3836 + if(nsKDEUtils::kdeSupport()) { |
3825 nsAutoCString dirPath; |
3837 + nsTArray<nsCString> command; |
3826 if (NS_FAILED(GetParent(getter_AddRefs(parentDir)))) { |
3838 + command.AppendElement( NS_LITERAL_CSTRING("REVEAL") ); |
3827 return NS_ERROR_FAILURE; |
3839 + command.AppendElement( mPath ); |
3828 } |
3840 + return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
3829 if (NS_FAILED(parentDir->GetNativePath(dirPath))) { |
3841 + } |
3830 return NS_ERROR_FAILURE; |
3842 + |
3831 } |
3843 + if (!giovfs) |
3832 |
3844 + return NS_ERROR_FAILURE; |
3833 - return giovfs->ShowURIForInput(dirPath); |
3845 + |
3834 + url = dirPath; |
3846 + return giovfs->ShowURIForInput(url); |
|
3847 #elif defined(MOZ_WIDGET_COCOA) |
3835 #elif defined(MOZ_WIDGET_COCOA) |
3848 CFURLRef url; |
3836 CFURLRef url; |
3849 if (NS_SUCCEEDED(GetCFURL(&url))) { |
3837 if (NS_SUCCEEDED(GetCFURL(&url))) { |
3850 nsresult rv = CocoaFileUtils::RevealFileInFinder(url); |
3838 nsresult rv = CocoaFileUtils::RevealFileInFinder(url); |
3851 ::CFRelease(url); |
3839 ::CFRelease(url); |
3852 return rv; |
3840 return rv; |
3853 } |
3841 } |
3854 return NS_ERROR_FAILURE; |
3842 return NS_ERROR_FAILURE; |
3855 @@ -1992,16 +2003,22 @@ nsLocalFile::Reveal() |
3843 #else |
3856 return NS_ERROR_FAILURE; |
3844 return NS_ERROR_FAILURE; |
3857 #endif |
3845 #endif |
|
3846 + if(nsKDEUtils::kdeSupport()) { |
|
3847 + nsTArray<nsCString> command; |
|
3848 + command.AppendElement( NS_LITERAL_CSTRING("REVEAL") ); |
|
3849 + command.AppendElement( mPath ); |
|
3850 + return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
|
3851 + } |
|
3852 + |
|
3853 + if (!giovfs) |
|
3854 + return NS_ERROR_FAILURE; |
|
3855 + |
|
3856 + return giovfs->ShowURIForInput(url); |
3858 } |
3857 } |
3859 |
3858 |
3860 NS_IMETHODIMP |
3859 NS_IMETHODIMP |
3861 nsLocalFile::Launch() |
3860 nsLocalFile::Launch() |
3862 { |
3861 { |