166 |
166 |
167 #ifdef ANDROID |
167 #ifdef ANDROID |
168 #include "AndroidBridge.h" |
168 #include "AndroidBridge.h" |
169 #endif |
169 #endif |
170 |
170 |
171 @@ -2203,16 +2207,25 @@ nsDownload::SetState(DownloadState aStat |
171 @@ -2214,16 +2218,25 @@ nsDownload::SetState(DownloadState aStat |
172 nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID)); |
172 nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID)); |
173 |
173 |
174 // Master pref to control this function. |
174 // Master pref to control this function. |
175 PRBool showTaskbarAlert = PR_TRUE; |
175 bool showTaskbarAlert = true; |
176 if (pref) |
176 if (pref) |
177 pref->GetBoolPref(PREF_BDM_SHOWALERTONCOMPLETE, &showTaskbarAlert); |
177 pref->GetBoolPref(PREF_BDM_SHOWALERTONCOMPLETE, &showTaskbarAlert); |
178 |
178 |
179 if (showTaskbarAlert) { |
179 if (showTaskbarAlert) { |
180 + if( nsKDEUtils::kdeSupport()) { |
180 + if( nsKDEUtils::kdeSupport()) { |
181 + nsCStringArray command; |
181 + nsTArray<nsCString> command; |
182 + command.AppendCString( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" )); |
182 + command.AppendElement( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" )); |
183 + nsAutoString displayName; |
183 + nsAutoString displayName; |
184 + GetDisplayName( displayName ); |
184 + GetDisplayName( displayName ); |
185 + command.AppendCString( nsCAutoString( ToNewUTF8String( displayName ))); |
185 + command.AppendElement( nsCAutoString( ToNewUTF8String( displayName ))); |
186 + nsKDEUtils::command( command ); |
186 + nsKDEUtils::command( command ); |
187 + } else { |
187 + } else { |
188 + // begin non-KDE block |
188 + // begin non-KDE block |
189 PRInt32 alertInterval = 2000; |
189 PRInt32 alertInterval = 2000; |
190 if (pref) |
190 if (pref) |
191 pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval); |
191 pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval); |
192 |
192 |
193 PRInt64 alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC; |
193 PRInt64 alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC; |
194 PRInt64 goat = PR_Now() - mStartTime; |
194 PRInt64 goat = PR_Now() - mStartTime; |
195 showTaskbarAlert = goat > alertIntervalUSec; |
195 showTaskbarAlert = goat > alertIntervalUSec; |
196 |
196 |
197 @@ -2236,19 +2249,20 @@ nsDownload::SetState(DownloadState aStat |
197 @@ -2247,19 +2260,20 @@ nsDownload::SetState(DownloadState aStat |
198 // If downloads are automatically removed per the user's |
198 // If downloads are automatically removed per the user's |
199 // retention policy, there's no reason to make the text clickable |
199 // retention policy, there's no reason to make the text clickable |
200 // because if it is, they'll click open the download manager and |
200 // because if it is, they'll click open the download manager and |
201 // the items they downloaded will have been removed. |
201 // the items they downloaded will have been removed. |
202 alerts->ShowAlertNotification( |
202 alerts->ShowAlertNotification( |
2108 |
2108 |
2109 private: |
2109 private: |
2110 ~nsUnixSystemProxySettings() {} |
2110 ~nsUnixSystemProxySettings() {} |
2111 |
2111 |
2112 nsCOMPtr<nsIGConfService> mGConf; |
2112 nsCOMPtr<nsIGConfService> mGConf; |
2113 PRBool IsProxyMode(const char* aMode); |
2113 bool IsProxyMode(const char* aMode); |
2114 nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult); |
2114 nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult); |
2115 nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
2115 nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
2116 + nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
2116 + nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
2117 }; |
2117 }; |
2118 |
2118 |
2119 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
2119 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
2120 |
2120 |
2121 nsresult |
2121 nsresult |
2122 nsUnixSystemProxySettings::Init() |
2122 nsUnixSystemProxySettings::Init() |
2123 { |
2123 { |
2124 // If this is a GNOME session, load gconf and try to use its preferences. |
2124 mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
2125 @@ -407,16 +410,19 @@ nsUnixSystemProxySettings::GetProxyForUR |
2125 @@ -408,16 +411,19 @@ nsUnixSystemProxySettings::GetProxyForUR |
2126 nsCAutoString host; |
2126 nsCAutoString host; |
2127 rv = aURI->GetHost(host); |
2127 rv = aURI->GetHost(host); |
2128 NS_ENSURE_SUCCESS(rv, rv); |
2128 NS_ENSURE_SUCCESS(rv, rv); |
2129 |
2129 |
2130 PRInt32 port; |
2130 PRInt32 port; |
2165 + if( aPort >= 0 ) |
2165 + if( aPort >= 0 ) |
2166 + { |
2166 + { |
2167 + url += ":"; |
2167 + url += ":"; |
2168 + url += nsPrintfCString("%d", aPort); |
2168 + url += nsPrintfCString("%d", aPort); |
2169 + } |
2169 + } |
2170 + nsCStringArray command; |
2170 + nsTArray<nsCString> command; |
2171 + command.AppendCString( NS_LITERAL_CSTRING( "GETPROXY" )); |
2171 + command.AppendElement( NS_LITERAL_CSTRING( "GETPROXY" )); |
2172 + command.AppendCString( url ); |
2172 + command.AppendElement( url ); |
2173 + nsCStringArray result; |
2173 + nsTArray<nsCString> result; |
2174 + if( !nsKDEUtils::command( command, &result ) || result.Count() != 1 ) |
2174 + if( !nsKDEUtils::command( command, &result ) || result.Count() != 1 ) |
2175 + return NS_ERROR_FAILURE; |
2175 + return NS_ERROR_FAILURE; |
2176 + aResult = *result[ 0 ]; |
2176 + aResult = *result[ 0 ]; |
2177 + return NS_OK; |
2177 + return NS_OK; |
2178 +} |
2178 +} |
2179 + |
2179 + |
2180 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in |
2180 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in |
2181 --- a/toolkit/xre/Makefile.in |
2181 --- a/toolkit/xre/Makefile.in |
2182 +++ b/toolkit/xre/Makefile.in |
2182 +++ b/toolkit/xre/Makefile.in |
2183 @@ -94,17 +94,18 @@ EXPORTS = nsWindowsDllInterceptor.h |
2183 @@ -95,17 +95,18 @@ else |
2184 else |
|
2185 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) |
2184 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) |
2186 CMMSRCS = nsNativeAppSupportCocoa.mm |
2185 CMMSRCS = nsNativeAppSupportCocoa.mm |
|
2186 EXPORTS = MacQuirks.h |
2187 else |
2187 else |
2188 ifeq ($(MOZ_WIDGET_TOOLKIT),os2) |
2188 ifeq ($(MOZ_WIDGET_TOOLKIT),os2) |
2189 CPPSRCS += nsNativeAppSupportOS2.cpp |
2189 CPPSRCS += nsNativeAppSupportOS2.cpp |
2190 else |
2190 else |
2191 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) |
2191 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) |
2193 +CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp |
2193 +CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp |
2194 +EXPORTS += nsKDEUtils.h |
2194 +EXPORTS += nsKDEUtils.h |
2195 else |
2195 else |
2196 ifeq ($(MOZ_WIDGET_TOOLKIT),qt) |
2196 ifeq ($(MOZ_WIDGET_TOOLKIT),qt) |
2197 MOCSRCS += moc_nsNativeAppSupportQt.cpp |
2197 MOCSRCS += moc_nsNativeAppSupportQt.cpp |
2198 $(NULL) |
|
2199 CPPSRCS += $(MOCSRCS) |
2198 CPPSRCS += $(MOCSRCS) |
2200 CPPSRCS += nsNativeAppSupportQt.cpp |
2199 CPPSRCS += nsNativeAppSupportQt.cpp |
2201 CPPSRCS += nsQAppInstance.cpp |
2200 CPPSRCS += nsQAppInstance.cpp |
2202 EXPORTS += nsQAppInstance.h |
2201 EXPORTS += nsQAppInstance.h |
|
2202 else |
2203 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
2203 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
2204 new file mode 100644 |
2204 new file mode 100644 |
2205 --- /dev/null |
2205 --- /dev/null |
2206 +++ b/toolkit/xre/nsKDEUtils.cpp |
2206 +++ b/toolkit/xre/nsKDEUtils.cpp |
2207 @@ -0,0 +1,328 @@ |
2207 @@ -0,0 +1,330 @@ |
2208 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2208 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2209 +/* ***** BEGIN LICENSE BLOCK ***** |
2209 +/* ***** BEGIN LICENSE BLOCK ***** |
2210 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
2210 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
2211 + * |
2211 + * |
2212 + * The contents of this file are subject to the Mozilla Public License Version |
2212 + * The contents of this file are subject to the Mozilla Public License Version |
2388 + return FALSE; |
2388 + return FALSE; |
2389 + } |
2389 + } |
2390 + return TRUE; |
2390 + return TRUE; |
2391 + } |
2391 + } |
2392 + |
2392 + |
2393 +bool nsKDEUtils::command( const nsCStringArray& command, nsCStringArray* output ) |
2393 +bool nsKDEUtils::command( const nsTArray<nsCString>& command, nsTArray<nsCString>* output ) |
2394 + { |
2394 + { |
2395 + return self()->internalCommand( command, NULL, false, output ); |
2395 + return self()->internalCommand( command, NULL, false, output ); |
2396 + } |
2396 + } |
2397 + |
2397 + |
2398 +bool nsKDEUtils::commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output ) |
2398 +bool nsKDEUtils::commandBlockUi( const nsTArray<nsCString>& command, const GtkWindow* parent, nsTArray<nsCString>* output ) |
2399 + { |
2399 + { |
2400 + return self()->internalCommand( command, parent, true, output ); |
2400 + return self()->internalCommand( command, parent, true, output ); |
2401 + } |
2401 + } |
2402 + |
2402 + |
2403 +bool nsKDEUtils::internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool blockUi, |
2403 +bool nsKDEUtils::internalCommand( const nsTArray<nsCString>& command, const GtkWindow* parent, bool blockUi, |
2404 + nsCStringArray* output ) |
2404 + nsTArray<nsCString>* output ) |
2405 + { |
2405 + { |
|
2406 + nsCString internal_command; |
|
2407 + internal_command.AssignLiteral(command); |
2406 + if( !startHelper()) |
2408 + if( !startHelper()) |
2407 + return false; |
2409 + return false; |
2408 + feedCommand( command ); |
2410 + feedCommand(internal_command); |
2409 + // do not store the data in 'this' but in extra structure, just in case there |
2411 + // do not store the data in 'this' but in extra structure, just in case there |
2410 + // is reentrancy (can there be? the event loop is re-entered) |
2412 + // is reentrancy (can there be? the event loop is re-entered) |
2411 + nsKDECommandData data; |
2413 + nsKDECommandData data; |
2412 + data.file = replyFile; |
2414 + data.file = replyFile; |
2413 + data.output = output; |
2415 + data.output = output; |
2513 + if( replyFile != NULL ) |
2515 + if( replyFile != NULL ) |
2514 + fclose( replyFile ); |
2516 + fclose( replyFile ); |
2515 + helperRunning = false; |
2517 + helperRunning = false; |
2516 + } |
2518 + } |
2517 + |
2519 + |
2518 +void nsKDEUtils::feedCommand( const nsCStringArray& command ) |
2520 +void nsKDEUtils::feedCommand( const nsTArray<nsCString>& command ) |
2519 + { |
2521 + { |
2520 + for( int i = 0; |
2522 + for( int i = 0; |
2521 + i < command.Count(); |
2523 + i < command.Length(); |
2522 + ++i ) |
2524 + ++i ) |
2523 + { |
2525 + { |
2524 + nsCString line = *command[ i ]; |
2526 + nsCString line = command[ i ]; |
2525 + line.ReplaceSubstring( "\\", "\\" "\\" ); // \ -> \\ , i.e. escape |
2527 + line.ReplaceSubstring( "\\", "\\" "\\" ); // \ -> \\ , i.e. escape |
2526 + line.ReplaceSubstring( "\n", "\\n" ); |
2528 + line.ReplaceSubstring( "\n", "\\n" ); |
2527 +#ifdef DEBUG_KDE |
2529 +#ifdef DEBUG_KDE |
2528 + fprintf( stderr, "COMM: %s\n", line.get()); |
2530 + fprintf( stderr, "COMM: %s\n", line.get()); |
2529 +#endif |
2531 +#endif |
2594 + static bool kdeSession(); |
2596 + static bool kdeSession(); |
2595 + /* Returns true if running inside a KDE session and KDE support is available |
2597 + /* Returns true if running inside a KDE session and KDE support is available |
2596 + for Firefox. This should be used everywhere where the external helper is needed. */ |
2598 + for Firefox. This should be used everywhere where the external helper is needed. */ |
2597 + static bool kdeSupport(); |
2599 + static bool kdeSupport(); |
2598 + /* Executes the given helper command, returns true if helper returned success. */ |
2600 + /* Executes the given helper command, returns true if helper returned success. */ |
2599 + static bool command( const nsCStringArray& command, nsCStringArray* output = NULL ); |
2601 + static bool command( const nsTArray<nsCString>& command, nsTArray<nsCString>* output = NULL ); |
2600 + /* Like command(), but additionally blocks the parent widget like if there was |
2602 + /* Like command(), but additionally blocks the parent widget like if there was |
2601 + a modal dialog shown and enters the event loop (i.e. there are still paint updates, |
2603 + a modal dialog shown and enters the event loop (i.e. there are still paint updates, |
2602 + this is for commands that take long). */ |
2604 + this is for commands that take long). */ |
2603 + static bool commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output = NULL ); |
2605 + static bool commandBlockUi( const nsTArray<nsCString>& command, const GtkWindow* parent, nsTArray<nsCString>* output = NULL ); |
|
2606 + |
2604 + private: |
2607 + private: |
2605 + nsKDEUtils(); |
2608 + nsKDEUtils(); |
2606 + ~nsKDEUtils(); |
2609 + ~nsKDEUtils(); |
2607 + static nsKDEUtils* self(); |
2610 + static nsKDEUtils* self(); |
2608 + bool startHelper(); |
2611 + bool startHelper(); |
2609 + void closeHelper(); |
2612 + void closeHelper(); |
2610 + void feedCommand( const nsCStringArray& command ); |
2613 + void feedCommand( const nsTArray<nsCString>& command ); |
2611 + bool internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool isParent, |
2614 + bool internalCommand( const nsTArray<nsCString>& command, const GtkWindow* parent, bool isParent, |
2612 + nsCStringArray* output ); |
2615 + nsTArray<nsCString>* output ); |
2613 + FILE* commandFile; |
2616 + FILE* commandFile; |
2614 + FILE* replyFile; |
2617 + FILE* replyFile; |
2615 + }; |
2618 + }; |
2616 + |
2619 + |
2617 +#endif // nsKDEUtils |
2620 +#endif // nsKDEUtils |
2845 +#include "nsKDEUtils.h" |
2848 +#include "nsKDEUtils.h" |
2846 + |
2849 + |
2847 +/* static */ PRBool |
2850 +/* static */ PRBool |
2848 +nsKDERegistry::HandlerExists(const char *aProtocolScheme) |
2851 +nsKDERegistry::HandlerExists(const char *aProtocolScheme) |
2849 +{ |
2852 +{ |
2850 + nsCStringArray command; |
2853 + nsTArray<nsCString> command; |
2851 + command.AppendCString( NS_LITERAL_CSTRING( "HANDLEREXISTS" )); |
2854 + command.AppendElement( NS_LITERAL_CSTRING( "HANDLEREXISTS" )); |
2852 + command.AppendCString( nsCAutoString( aProtocolScheme )); |
2855 + command.AppendElement( nsCAutoString( aProtocolScheme )); |
2853 + return nsKDEUtils::command( command ); |
2856 + return nsKDEUtils::command( command ); |
2854 +} |
2857 +} |
2855 + |
2858 + |
2856 +/* static */ nsresult |
2859 +/* static */ nsresult |
2857 +nsKDERegistry::LoadURL(nsIURI *aURL) |
2860 +nsKDERegistry::LoadURL(nsIURI *aURL) |
2858 +{ |
2861 +{ |
2859 + nsCStringArray command; |
2862 + nsTArray<nsCString> command; |
2860 + command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
2863 + command.AppendElement( NS_LITERAL_CSTRING( "OPEN" )); |
2861 + nsCString url; |
2864 + nsCString url; |
2862 + aURL->GetSpec( url ); |
2865 + aURL->GetSpec( url ); |
2863 + command.AppendCString( url ); |
2866 + command.AppendElement( url ); |
2864 + return nsKDEUtils::command( command ); |
2867 + return nsKDEUtils::command( command ); |
2865 +} |
2868 +} |
2866 + |
2869 + |
2867 +/* static */ void |
2870 +/* static */ void |
2868 +nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme, |
2871 +nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme, |
2869 + nsAString& aDesc) |
2872 + nsAString& aDesc) |
2870 +{ |
2873 +{ |
2871 + nsCStringArray command; |
2874 + nsTArray<nsCString> command; |
2872 + command.AppendCString( NS_LITERAL_CSTRING( "GETAPPDESCFORSCHEME" )); |
2875 + command.AppendElement( NS_LITERAL_CSTRING( "GETAPPDESCFORSCHEME" )); |
2873 + command.AppendCString( aScheme ); |
2876 + command.AppendElement( aScheme ); |
2874 + nsCStringArray output; |
2877 + nsTArray<nsCString> output; |
2875 + if( nsKDEUtils::command( command, &output ) && output.Count() == 1 ) |
2878 + if( nsKDEUtils::command( command, &output ) && output.Length() == 1 ) |
2876 + CopyUTF8toUTF16( *output[ 0 ], aDesc ); |
2879 + CopyUTF8toUTF16( output[ 0 ], aDesc ); |
2877 +} |
2880 +} |
2878 + |
2881 + |
2879 + |
2882 + |
2880 +/* static */ already_AddRefed<nsMIMEInfoBase> |
2883 +/* static */ already_AddRefed<nsMIMEInfoBase> |
2881 +nsKDERegistry::GetFromExtension(const nsACString& aFileExt) |
2884 +nsKDERegistry::GetFromExtension(const nsACString& aFileExt) |
2882 +{ |
2885 +{ |
2883 + NS_ASSERTION(aFileExt[0] != '.', "aFileExt shouldn't start with a dot"); |
2886 + NS_ASSERTION(aFileExt[0] != '.', "aFileExt shouldn't start with a dot"); |
2884 + nsCStringArray command; |
2887 + nsTArray<nsCString> command; |
2885 + command.AppendCString( NS_LITERAL_CSTRING( "GETFROMEXTENSION" )); |
2888 + command.AppendElement( NS_LITERAL_CSTRING( "GETFROMEXTENSION" )); |
2886 + command.AppendCString( aFileExt ); |
2889 + command.AppendElement( aFileExt ); |
2887 + return GetFromHelper( command ); |
2890 + return GetFromHelper( command ); |
2888 +} |
2891 +} |
2889 + |
2892 + |
2890 +/* static */ already_AddRefed<nsMIMEInfoBase> |
2893 +/* static */ already_AddRefed<nsMIMEInfoBase> |
2891 +nsKDERegistry::GetFromType(const nsACString& aMIMEType) |
2894 +nsKDERegistry::GetFromType(const nsACString& aMIMEType) |
2892 +{ |
2895 +{ |
2893 + nsCStringArray command; |
2896 + nsTArray<nsCString> command; |
2894 + command.AppendCString( NS_LITERAL_CSTRING( "GETFROMTYPE" )); |
2897 + command.AppendElement( NS_LITERAL_CSTRING( "GETFROMTYPE" )); |
2895 + command.AppendCString( aMIMEType ); |
2898 + command.AppendElement( aMIMEType ); |
2896 + return GetFromHelper( command ); |
2899 + return GetFromHelper( command ); |
2897 +} |
2900 +} |
2898 + |
2901 + |
2899 +/* static */ already_AddRefed<nsMIMEInfoBase> |
2902 +/* static */ already_AddRefed<nsMIMEInfoBase> |
2900 +nsKDERegistry::GetFromHelper(const nsCStringArray& command) |
2903 +nsKDERegistry::GetFromHelper(const nsTArray<nsCString>& command) |
2901 +{ |
2904 +{ |
2902 + nsCStringArray output; |
2905 + nsTArray<nsCString> output; |
2903 + if( nsKDEUtils::command( command, &output ) && output.Count() == 3 ) |
2906 + if( nsKDEUtils::command( command, &output ) && output.Length() == 3 ) |
2904 + { |
2907 + { |
2905 + nsCString mimetype = *output[ 0 ]; |
2908 + nsCString mimetype = output[ 0 ]; |
2906 + nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype ); |
2909 + nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype ); |
2907 + NS_ENSURE_TRUE(mimeInfo, nsnull); |
2910 + NS_ENSURE_TRUE(mimeInfo, nsnull); |
2908 + nsCString description = *output[ 1 ]; |
2911 + nsCString description = output[ 1 ]; |
2909 + mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); |
2912 + mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); |
2910 + nsCString handlerAppName = *output[ 2 ]; |
2913 + nsCString handlerAppName = output[ 2 ]; |
2911 + mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); |
2914 + mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); |
2912 + mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); |
2915 + mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); |
2913 + nsMIMEInfoBase* retval; |
2916 + nsMIMEInfoBase* retval; |
2914 + NS_ADDREF((retval = mimeInfo)); |
2917 + NS_ADDREF((retval = mimeInfo)); |
2915 + return retval; |
2918 + return retval; |
3054 } |
3058 } |
3055 return NS_ERROR_FAILURE; |
3059 return NS_ERROR_FAILURE; |
3056 #endif |
3060 #endif |
3057 |
3061 |
3058 + if( nsKDEUtils::kdeSupport()) { |
3062 + if( nsKDEUtils::kdeSupport()) { |
3059 + PRBool supports; |
3063 + bool supports; |
3060 + if( NS_SUCCEEDED( GetHasDefaultHandler( &supports )) && supports ) { |
3064 + if( NS_SUCCEEDED( GetHasDefaultHandler( &supports )) && supports ) { |
3061 + nsCStringArray command; |
3065 + nsTArray<nsCString> command; |
3062 + command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
3066 + command.AppendElement( NS_LITERAL_CSTRING( "OPEN" )); |
3063 + command.AppendCString( nativePath ); |
3067 + command.AppendElement( nativePath ); |
3064 + command.AppendCString( NS_LITERAL_CSTRING( "MIMETYPE" )); |
3068 + command.AppendElement( NS_LITERAL_CSTRING( "MIMETYPE" )); |
3065 + command.AppendCString( mSchemeOrType ); |
3069 + command.AppendElement( mSchemeOrType ); |
3066 + if( nsKDEUtils::command( command )) |
3070 + if( nsKDEUtils::command( command )) |
3067 + return NS_OK; |
3071 + return NS_OK; |
3068 + } |
3072 + } |
3069 + if (!mDefaultApplication) |
3073 + if (!mDefaultApplication) |
3070 + return NS_ERROR_FILE_NOT_FOUND; |
3074 + return NS_ERROR_FILE_NOT_FOUND; |
3210 INCLUDES += -I$(srcdir)/../shared/x11 |
3214 INCLUDES += -I$(srcdir)/../shared/x11 |
3211 endif |
3215 endif |
3212 diff --git a/widget/src/gtk2/nsFilePicker.cpp b/widget/src/gtk2/nsFilePicker.cpp |
3216 diff --git a/widget/src/gtk2/nsFilePicker.cpp b/widget/src/gtk2/nsFilePicker.cpp |
3213 --- a/widget/src/gtk2/nsFilePicker.cpp |
3217 --- a/widget/src/gtk2/nsFilePicker.cpp |
3214 +++ b/widget/src/gtk2/nsFilePicker.cpp |
3218 +++ b/widget/src/gtk2/nsFilePicker.cpp |
3215 @@ -31,16 +31,17 @@ |
3219 @@ -33,16 +33,17 @@ |
3216 * decision by deleting the provisions above and replace them with the notice |
|
3217 * and other provisions required by the GPL or the LGPL. If you do not delete |
|
3218 * the provisions above, a recipient may use your version of this file under |
3220 * the provisions above, a recipient may use your version of this file under |
3219 * the terms of any one of the MPL, the GPL or the LGPL. |
3221 * the terms of any one of the MPL, the GPL or the LGPL. |
3220 * |
3222 * |
3221 * ***** END LICENSE BLOCK ***** */ |
3223 * ***** END LICENSE BLOCK ***** */ |
|
3224 |
|
3225 #include "mozilla/Util.h" |
3222 |
3226 |
3223 #include <gtk/gtk.h> |
3227 #include <gtk/gtk.h> |
3224 +#include <gdk/gdkx.h> |
3228 +#include <gdk/gdkx.h> |
3225 |
3229 |
3226 #include "nsIFileURL.h" |
3230 #include "nsIFileURL.h" |
3401 + filters += "\n"; |
3405 + filters += "\n"; |
3402 + filters += kdeMakeFilter( i ); |
3406 + filters += kdeMakeFilter( i ); |
3403 + } |
3407 + } |
3404 + } |
3408 + } |
3405 + |
3409 + |
3406 + nsCStringArray command; |
3410 + nsTArray<nsCString> command; |
3407 + command.AppendCString( nsCAutoString( arg )); |
3411 + command.AppendElement( nsCAutoString( arg )); |
3408 + command.AppendCString( startdir ); |
3412 + command.AppendElement( startdir ); |
3409 + if( mMode != nsIFilePicker::modeGetFolder ) |
3413 + if( mMode != nsIFilePicker::modeGetFolder ) |
3410 + { |
3414 + { |
3411 + command.AppendCString( filters ); |
3415 + command.AppendElement( filters ); |
3412 + nsCAutoString selected; |
3416 + nsCAutoString selected; |
3413 + selected.AppendInt( mSelectedType ); |
3417 + selected.AppendInt( mSelectedType ); |
3414 + command.AppendCString( selected ); |
3418 + command.AppendElement( selected ); |
3415 + } |
3419 + } |
3416 + command.AppendCString( title ); |
3420 + command.AppendElement( title ); |
3417 + if( mMode == nsIFilePicker::modeOpenMultiple ) |
3421 + if( mMode == nsIFilePicker::modeOpenMultiple ) |
3418 + command.AppendCString( NS_LITERAL_CSTRING( "MULTIPLE" )); |
3422 + command.AppendElement( NS_LITERAL_CSTRING( "MULTIPLE" )); |
3419 + if( PRInt32 xid = windowToXid( mParentWidget )) |
3423 + if( PRInt32 xid = windowToXid( mParentWidget )) |
3420 + { |
3424 + { |
3421 + command.AppendCString( NS_LITERAL_CSTRING( "PARENT" )); |
3425 + command.AppendElement( NS_LITERAL_CSTRING( "PARENT" )); |
3422 + nsCAutoString parent; |
3426 + nsCAutoString parent; |
3423 + parent.AppendInt( xid ); |
3427 + parent.AppendInt( xid ); |
3424 + command.AppendCString( parent ); |
3428 + command.AppendElement( parent ); |
3425 + } |
3429 + } |
3426 + |
3430 + |
3427 + nsCStringArray output; |
3431 + nsTArray<nsCString> output; |
3428 + if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
3432 + if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
3429 + { |
3433 + { |
3430 + *aReturn = nsIFilePicker::returnOK; |
3434 + *aReturn = nsIFilePicker::returnOK; |
3431 + mFiles.Clear(); |
3435 + mFiles.Clear(); |
3432 + if( mMode != nsIFilePicker::modeGetFolder ) |
3436 + if( mMode != nsIFilePicker::modeGetFolder ) |
3433 + { |
3437 + { |
3434 + mSelectedType = atoi( output[ 0 ]->get()); |
3438 + mSelectedType = atoi( output[ 0 ].get()); |
3435 + output.RemoveCStringAt( 0 ); |
3439 + output.RemoveElementAt( 0 ); |
3436 + } |
3440 + } |
3437 + if (mMode == nsIFilePicker::modeOpenMultiple) |
3441 + if (mMode == nsIFilePicker::modeOpenMultiple) |
3438 + { |
3442 + { |
3439 + mFileURL.Truncate(); |
3443 + mFileURL.Truncate(); |
3440 + PRUint32 count = output.Count(); |
3444 + PRUint32 count = output.Length(); |
3441 + for( PRUint32 i = 0; |
3445 + for( PRUint32 i = 0; |
3442 + i < count; |
3446 + i < count; |
3443 + ++i ) |
3447 + ++i ) |
3444 + { |
3448 + { |
3445 + nsCOMPtr<nsILocalFile> localfile; |
3449 + nsCOMPtr<nsILocalFile> localfile; |
3446 + nsresult rv = NS_NewNativeLocalFile( *output[ i ], |
3450 + nsresult rv = NS_NewNativeLocalFile( output[ i ], |
3447 + PR_FALSE, |
3451 + PR_FALSE, |
3448 + getter_AddRefs(localfile)); |
3452 + getter_AddRefs(localfile)); |
3449 + if (NS_SUCCEEDED(rv)) |
3453 + if (NS_SUCCEEDED(rv)) |
3450 + mFiles.AppendObject(localfile); |
3454 + mFiles.AppendObject(localfile); |
3451 + } |
3455 + } |
3452 + } |
3456 + } |
3453 + else |
3457 + else |
3454 + { |
3458 + { |
3455 + if( output.Count() == 0 ) |
3459 + if( output.Length() == 0 ) |
3456 + mFileURL = nsCString(); |
3460 + mFileURL = nsCString(); |
3457 + else if( mAllowURLs ) |
3461 + else if( mAllowURLs ) |
3458 + mFileURL = *output[ 0 ]; |
3462 + mFileURL = output[ 0 ]; |
3459 + else // GetFile() actually requires it to be url even for local files :-/ |
3463 + else // GetFile() actually requires it to be url even for local files :-/ |
3460 + { |
3464 + { |
3461 + mFileURL = nsCString( "file://" ); |
3465 + mFileURL = nsCString( "file://" ); |
3462 + mFileURL.Append( *output[ 0 ] ); |
3466 + mFileURL.Append( output[ 0 ] ); |
3463 + } |
3467 + } |
3464 + } |
3468 + } |
3465 + // Remember last used directory. |
3469 + // Remember last used directory. |
3466 + nsCOMPtr<nsILocalFile> file; |
3470 + nsCOMPtr<nsILocalFile> file; |
3467 + GetFile(getter_AddRefs(file)); |
3471 + GetFile(getter_AddRefs(file)); |
3499 + NS_ENSURE_ARG_POINTER(aReturn); |
3503 + NS_ENSURE_ARG_POINTER(aReturn); |
3500 + |
3504 + |
3501 + nsXPIDLCString title; |
3505 + nsXPIDLCString title; |
3502 + title.Adopt(ToNewUTF8String(mTitle)); |
3506 + title.Adopt(ToNewUTF8String(mTitle)); |
3503 + |
3507 + |
3504 + nsCStringArray command; |
3508 + nsTArray<nsCString> command; |
3505 + command.AppendCString( NS_LITERAL_CSTRING( "APPSDIALOG" )); |
3509 + command.AppendElement( NS_LITERAL_CSTRING( "APPSDIALOG" )); |
3506 + command.AppendCString( title ); |
3510 + command.AppendElement( title ); |
3507 + if( PRInt32 xid = windowToXid( mParentWidget )) |
3511 + if( PRInt32 xid = windowToXid( mParentWidget )) |
3508 + { |
3512 + { |
3509 + command.AppendCString( NS_LITERAL_CSTRING( "PARENT" )); |
3513 + command.AppendElement( NS_LITERAL_CSTRING( "PARENT" )); |
3510 + nsCAutoString parent; |
3514 + nsCAutoString parent; |
3511 + parent.AppendInt( xid ); |
3515 + parent.AppendInt( xid ); |
3512 + command.AppendCString( parent ); |
3516 + command.AppendElement( parent ); |
3513 + } |
3517 + } |
3514 + |
3518 + |
3515 + nsCStringArray output; |
3519 + nsTArray<nsCString> output; |
3516 + if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
3520 + if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
3517 + { |
3521 + { |
3518 + *aReturn = nsIFilePicker::returnOK; |
3522 + *aReturn = nsIFilePicker::returnOK; |
3519 + mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString(); |
3523 + mFileURL = output.Length() > 0 ? output[ 0 ] : nsCString(); |
3520 + } |
3524 + } |
3521 + else |
3525 + else |
3522 + { |
3526 + { |
3523 + *aReturn = nsIFilePicker::returnCancel; |
3527 + *aReturn = nsIFilePicker::returnCancel; |
3524 + } |
3528 + } |
3561 CXXFLAGS += $(MOZ_GTK2_CFLAGS) |
3565 CXXFLAGS += $(MOZ_GTK2_CFLAGS) |
3562 endif |
3566 endif |
3563 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp |
3567 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp |
3564 --- a/xpcom/components/ManifestParser.cpp |
3568 --- a/xpcom/components/ManifestParser.cpp |
3565 +++ b/xpcom/components/ManifestParser.cpp |
3569 +++ b/xpcom/components/ManifestParser.cpp |
3566 @@ -60,16 +60,17 @@ |
3570 @@ -62,16 +62,17 @@ |
3567 #include "nsTextFormatter.h" |
3571 #include "nsTextFormatter.h" |
3568 #include "nsVersionComparator.h" |
3572 #include "nsVersionComparator.h" |
3569 #include "nsXPCOMCIDInternal.h" |
3573 #include "nsXPCOMCIDInternal.h" |
3570 |
3574 |
3571 #include "nsIConsoleService.h" |
3575 #include "nsIConsoleService.h" |
3572 #include "nsIScriptError.h" |
3576 #include "nsIScriptError.h" |
3573 #include "nsIXULAppInfo.h" |
3577 #include "nsIXULAppInfo.h" |
3574 #include "nsIXULRuntime.h" |
3578 #include "nsIXULRuntime.h" |
3575 +#include "nsKDEUtils.h" |
3579 +#include "nsKDEUtils.h" |
3576 |
3580 |
|
3581 using namespace mozilla; |
|
3582 |
3577 struct ManifestDirective |
3583 struct ManifestDirective |
3578 { |
3584 { |
3579 const char* directive; |
3585 const char* directive; |
3580 int argc; |
3586 int argc; |
3581 |
3587 |
3582 // Some directives should only be delivered for NS_COMPONENT_LOCATION |
3588 @@ -434,16 +435,17 @@ ParseManifestCommon(NSLocationType aType |
3583 // manifests. |
|
3584 @@ -430,16 +431,17 @@ ParseManifestCommon(NSLocationType aType |
|
3585 NS_NAMED_LITERAL_STRING(kPlatform, "platform"); |
3589 NS_NAMED_LITERAL_STRING(kPlatform, "platform"); |
3586 NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible"); |
3590 NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible"); |
3587 NS_NAMED_LITERAL_STRING(kApplication, "application"); |
3591 NS_NAMED_LITERAL_STRING(kApplication, "application"); |
3588 NS_NAMED_LITERAL_STRING(kAppVersion, "appversion"); |
3592 NS_NAMED_LITERAL_STRING(kAppVersion, "appversion"); |
3589 NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion"); |
3593 NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion"); |
3712 ifdef MOZ_PLATFORM_MAEMO |
3716 ifdef MOZ_PLATFORM_MAEMO |
3713 CFLAGS += $(MOZ_PLATFORM_MAEMO_CFLAGS) $(MOZ_QT_CFLAGS) |
3717 CFLAGS += $(MOZ_PLATFORM_MAEMO_CFLAGS) $(MOZ_QT_CFLAGS) |
3714 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp |
3718 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp |
3715 --- a/xpcom/io/nsLocalFileUnix.cpp |
3719 --- a/xpcom/io/nsLocalFileUnix.cpp |
3716 +++ b/xpcom/io/nsLocalFileUnix.cpp |
3720 +++ b/xpcom/io/nsLocalFileUnix.cpp |
3717 @@ -87,16 +87,17 @@ |
3721 @@ -90,16 +90,17 @@ |
3718 #include "nsXPIDLString.h" |
|
3719 #include "prproces.h" |
3722 #include "prproces.h" |
3720 #include "nsIDirectoryEnumerator.h" |
3723 #include "nsIDirectoryEnumerator.h" |
3721 #include "nsISimpleEnumerator.h" |
3724 #include "nsISimpleEnumerator.h" |
|
3725 #include "private/pprio.h" |
3722 |
3726 |
3723 #ifdef MOZ_WIDGET_GTK2 |
3727 #ifdef MOZ_WIDGET_GTK2 |
3724 #include "nsIGIOService.h" |
3728 #include "nsIGIOService.h" |
3725 #include "nsIGnomeVFSService.h" |
3729 #include "nsIGnomeVFSService.h" |
3726 +#include "nsKDEUtils.h" |
3730 +#include "nsKDEUtils.h" |
3727 #endif |
3731 #endif |
3728 |
3732 |
3729 #ifdef XP_MACOSX |
3733 #ifdef MOZ_WIDGET_COCOA |
3730 #include <Carbon/Carbon.h> |
3734 #include <Carbon/Carbon.h> |
3731 #include "CocoaFileUtils.h" |
3735 #include "CocoaFileUtils.h" |
3732 #include "prmem.h" |
3736 #include "prmem.h" |
3733 #include "plbase64.h" |
3737 #include "plbase64.h" |
3734 |
3738 |
3735 @@ -1785,44 +1786,50 @@ nsLocalFile::SetPersistentDescriptor(con |
3739 @@ -1795,44 +1796,51 @@ nsLocalFile::SetPersistentDescriptor(con |
3736 return InitWithNativePath(aPersistentDescriptor); |
3740 return InitWithNativePath(aPersistentDescriptor); |
3737 #endif |
3741 #endif |
3738 } |
3742 } |
3739 |
3743 |
3740 NS_IMETHODIMP |
3744 NS_IMETHODIMP |
3787 + |
3791 + |
3788 + if (giovfs) |
3792 + if (giovfs) |
3789 + return giovfs->ShowURIForInput(url); |
3793 + return giovfs->ShowURIForInput(url); |
3790 + else |
3794 + else |
3791 + return gnomevfs->ShowURIForInput(url); |
3795 + return gnomevfs->ShowURIForInput(url); |
3792 #elif defined(XP_MACOSX) |
3796 + |
|
3797 #elif defined(MOZ_WIDGET_COCOA) |
3793 CFURLRef url; |
3798 CFURLRef url; |
3794 if (NS_SUCCEEDED(GetCFURL(&url))) { |
3799 if (NS_SUCCEEDED(GetCFURL(&url))) { |
3795 nsresult rv = CocoaFileUtils::RevealFileInFinder(url); |
3800 nsresult rv = CocoaFileUtils::RevealFileInFinder(url); |
3796 ::CFRelease(url); |
3801 ::CFRelease(url); |
3797 return rv; |
3802 return rv; |
3798 } |
3803 } |
3799 return NS_ERROR_FAILURE; |
3804 return NS_ERROR_FAILURE; |
3800 @@ -1848,16 +1855,23 @@ nsLocalFile::Launch() |
3805 @@ -1858,16 +1866,23 @@ nsLocalFile::Launch() |
3801 |
3806 |
3802 if (nsnull == connection) |
3807 if (nsnull == connection) |
3803 return NS_ERROR_FAILURE; |
3808 return NS_ERROR_FAILURE; |
3804 |
3809 |
3805 if (hildon_mime_open_file(connection, mPath.get()) != kHILDON_SUCCESS) |
3810 if (hildon_mime_open_file(connection, mPath.get()) != kHILDON_SUCCESS) |
3806 return NS_ERROR_FAILURE; |
3811 return NS_ERROR_FAILURE; |
3807 return NS_OK; |
3812 return NS_OK; |
3808 #else |
3813 #else |
3809 + if( nsKDEUtils::kdeSupport()) { |
3814 + if( nsKDEUtils::kdeSupport()) { |
3810 + nsCStringArray command; |
3815 + nsTArray<nsCString> command; |
3811 + command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
3816 + command.AppendElement( NS_LITERAL_CSTRING("OPEN") ); |
3812 + command.AppendCString( mPath ); |
3817 + command.AppendElement( mPath ); |
3813 + return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
3818 + return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
3814 + } |
3819 + } |
3815 + |
3820 + |
3816 nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); |
3821 nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); |
3817 nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
3822 nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |