78 getter_AddRefs(list)); |
78 getter_AddRefs(list)); |
79 if (!list) |
79 if (!list) |
80 return NS_OK; |
80 return NS_OK; |
81 |
81 |
82 bool hasMore; |
82 bool hasMore; |
83 @@ -932,17 +951,17 @@ static nsresult pref_LoadPrefsInDirList( |
83 @@ -921,17 +940,17 @@ static nsresult pref_LoadPrefsInDirList( |
84 |
84 |
85 nsCAutoString leaf; |
85 nsCAutoString leaf; |
86 path->GetNativeLeafName(leaf); |
86 path->GetNativeLeafName(leaf); |
87 |
87 |
88 // Do we care if a file provided by this process fails to load? |
88 // Do we care if a file provided by this process fails to load? |
89 if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi"))) |
89 if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi"))) |
90 ReadExtensionPrefs(path); |
90 ReadExtensionPrefs(path); |
91 else |
91 else |
92 - pref_LoadPrefsInDir(path, nsnull, 0); |
92 - pref_LoadPrefsInDir(path, nullptr, 0); |
93 + pref_LoadPrefsInDir(path, specialFiles, NS_ARRAY_LENGTH(specialFiles)); |
93 + pref_LoadPrefsInDir(path, specialFiles, NS_ARRAY_LENGTH(specialFiles)); |
94 } |
94 } |
95 return NS_OK; |
95 return NS_OK; |
96 } |
96 } |
97 |
97 |
98 static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name) |
98 static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name) |
99 { |
99 { |
100 nsZipItemPtr<char> manifest(jarReader, name, true); |
100 nsZipItemPtr<char> manifest(jarReader, name, true); |
101 NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE); |
101 NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE); |
102 @@ -1036,28 +1055,40 @@ static nsresult pref_InitInitialObjects( |
102 @@ -1025,28 +1044,40 @@ static nsresult pref_InitInitialObjects( |
103 /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */ |
103 /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */ |
104 static const char* specialFiles[] = { |
104 static const char* specialFiles[] = { |
105 #if defined(XP_MACOSX) |
105 #if defined(XP_MACOSX) |
106 "macprefs.js" |
106 "macprefs.js" |
107 #elif defined(XP_WIN) |
107 #elif defined(XP_WIN) |
196 + GetDisplayName( displayName ); |
196 + GetDisplayName( displayName ); |
197 + command.AppendElement( nsCAutoString( ToNewUTF8String( displayName ))); |
197 + command.AppendElement( nsCAutoString( ToNewUTF8String( displayName ))); |
198 + nsKDEUtils::command( command ); |
198 + nsKDEUtils::command( command ); |
199 + } else { |
199 + } else { |
200 + // begin non-KDE block |
200 + // begin non-KDE block |
201 PRInt32 alertInterval = 2000; |
201 int32_t alertInterval = 2000; |
202 if (pref) |
202 if (pref) |
203 pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval); |
203 pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval); |
204 |
204 |
205 PRInt64 alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC; |
205 int64_t alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC; |
206 PRInt64 goat = PR_Now() - mStartTime; |
206 int64_t goat = PR_Now() - mStartTime; |
207 showTaskbarAlert = goat > alertIntervalUSec; |
207 showTaskbarAlert = goat > alertIntervalUSec; |
208 |
208 |
209 @@ -2266,19 +2279,20 @@ nsDownload::SetState(DownloadState aStat |
209 @@ -2266,19 +2279,20 @@ nsDownload::SetState(DownloadState aStat |
210 // If downloads are automatically removed per the user's |
210 // If downloads are automatically removed per the user's |
211 // retention policy, there's no reason to make the text clickable |
211 // retention policy, there's no reason to make the text clickable |
2066 +# PrefWindow I (June 4, 1999) |
2066 +# PrefWindow I (June 4, 1999) |
2067 +# |
2067 +# |
2068 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
2068 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
2069 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
2069 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
2070 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
2070 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
2071 @@ -12,16 +12,18 @@ |
2071 @@ -13,16 +13,19 @@ |
2072 #include "nsArrayUtils.h" |
|
2073 #include "prnetdb.h" |
2072 #include "prnetdb.h" |
2074 #include "prenv.h" |
2073 #include "prenv.h" |
2075 #include "nsPrintfCString.h" |
2074 #include "nsPrintfCString.h" |
2076 #include "nsNetUtil.h" |
2075 #include "nsNetUtil.h" |
2077 #include "nsISupportsPrimitives.h" |
2076 #include "nsISupportsPrimitives.h" |
2078 #include "nsIGSettingsService.h" |
2077 #include "nsIGSettingsService.h" |
2079 #include "nsInterfaceHashtable.h" |
2078 #include "nsInterfaceHashtable.h" |
|
2079 #include "mozilla/Attributes.h" |
2080 +#include "nsVoidArray.h" |
2080 +#include "nsVoidArray.h" |
2081 +#include "nsKDEUtils.h" |
2081 +#include "nsKDEUtils.h" |
2082 |
2082 + |
2083 class nsUnixSystemProxySettings : public nsISystemProxySettings { |
2083 |
|
2084 class nsUnixSystemProxySettings MOZ_FINAL : public nsISystemProxySettings { |
2084 public: |
2085 public: |
2085 NS_DECL_ISUPPORTS |
2086 NS_DECL_ISUPPORTS |
2086 NS_DECL_NSISYSTEMPROXYSETTINGS |
2087 NS_DECL_NSISYSTEMPROXYSETTINGS |
2087 |
2088 |
2088 nsUnixSystemProxySettings() {} |
2089 nsUnixSystemProxySettings() {} |
2089 nsresult Init(); |
2090 nsresult Init(); |
2090 @@ -33,16 +35,17 @@ private: |
2091 @@ -34,16 +37,17 @@ private: |
2091 nsCOMPtr<nsIGSettingsService> mGSettings; |
2092 nsCOMPtr<nsIGSettingsService> mGSettings; |
2092 nsCOMPtr<nsIGSettingsCollection> mProxySettings; |
2093 nsCOMPtr<nsIGSettingsCollection> mProxySettings; |
2093 nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings; |
2094 nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings; |
2094 bool IsProxyMode(const char* aMode); |
2095 bool IsProxyMode(const char* aMode); |
2095 nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult); |
2096 nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult); |
2096 nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
2097 nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult); |
2097 nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
2098 nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult); |
2098 nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult); |
2099 nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult); |
2099 + nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
2100 + nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
2100 }; |
2101 }; |
2101 |
2102 |
2102 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
2103 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
2103 |
2104 |
2104 nsresult |
2105 nsresult |
2105 nsUnixSystemProxySettings::Init() |
2106 nsUnixSystemProxySettings::Init() |
2106 { |
2107 { |
2107 // If this is a GNOME session, load gconf and try to use its preferences. |
2108 // If this is a GNOME session, load gconf and try to use its preferences. |
2108 @@ -495,16 +498,19 @@ nsUnixSystemProxySettings::GetProxyForUR |
2109 @@ -496,16 +500,19 @@ nsUnixSystemProxySettings::GetProxyForUR |
2109 nsCAutoString host; |
2110 nsCAutoString host; |
2110 rv = aURI->GetHost(host); |
2111 rv = aURI->GetHost(host); |
2111 NS_ENSURE_SUCCESS(rv, rv); |
2112 NS_ENSURE_SUCCESS(rv, rv); |
2112 |
2113 |
2113 PRInt32 port; |
2114 int32_t port; |
2114 rv = aURI->GetPort(&port); |
2115 rv = aURI->GetPort(&port); |
2115 NS_ENSURE_SUCCESS(rv, rv); |
2116 NS_ENSURE_SUCCESS(rv, rv); |
2116 |
2117 |
2117 + if( nsKDEUtils::kdeSupport()) |
2118 + if( nsKDEUtils::kdeSupport()) |
2118 + return GetProxyFromKDE(scheme, host, port, aResult); |
2119 + return GetProxyFromKDE(scheme, host, port, aResult); |
2934 + nsTArray<nsCString> output; |
2935 + nsTArray<nsCString> output; |
2935 + if( nsKDEUtils::command( command, &output ) && output.Length() == 3 ) |
2936 + if( nsKDEUtils::command( command, &output ) && output.Length() == 3 ) |
2936 + { |
2937 + { |
2937 + nsCString mimetype = output[ 0 ]; |
2938 + nsCString mimetype = output[ 0 ]; |
2938 + nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype ); |
2939 + nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype ); |
2939 + NS_ENSURE_TRUE(mimeInfo, nsnull); |
2940 + NS_ENSURE_TRUE(mimeInfo, nullptr); |
2940 + nsCString description = output[ 1 ]; |
2941 + nsCString description = output[ 1 ]; |
2941 + mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); |
2942 + mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); |
2942 + nsCString handlerAppName = output[ 2 ]; |
2943 + nsCString handlerAppName = output[ 2 ]; |
2943 + mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); |
2944 + mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); |
2944 + mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); |
2945 + mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); |
2945 + nsMIMEInfoBase* retval; |
2946 + nsMIMEInfoBase* retval; |
2946 + NS_ADDREF((retval = mimeInfo)); |
2947 + NS_ADDREF((retval = mimeInfo)); |
2947 + return retval; |
2948 + return retval; |
2948 + } |
2949 + } |
2949 + return nsnull; |
2950 + return nullptr; |
2950 +} |
2951 +} |
2951 diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h |
2952 diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h |
2952 new file mode 100644 |
2953 new file mode 100644 |
2953 --- /dev/null |
2954 --- /dev/null |
2954 +++ b/uriloader/exthandler/unix/nsKDERegistry.h |
2955 +++ b/uriloader/exthandler/unix/nsKDERegistry.h |
3205 |
3206 |
3206 rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), |
3207 rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), |
3207 majorType, |
3208 majorType, |
3208 @@ -1391,17 +1391,17 @@ nsOSHelperAppService::GetFromType(const |
3209 @@ -1391,17 +1391,17 @@ nsOSHelperAppService::GetFromType(const |
3209 #ifdef MOZ_WIDGET_GTK2 |
3210 #ifdef MOZ_WIDGET_GTK2 |
3210 nsMIMEInfoBase *gnomeInfo = nsnull; |
3211 nsMIMEInfoBase *gnomeInfo = nullptr; |
3211 if (handler.IsEmpty()) { |
3212 if (handler.IsEmpty()) { |
3212 // No useful data yet. Check the GNOME registry. Unfortunately, newer |
3213 // No useful data yet. Check the GNOME registry. Unfortunately, newer |
3213 // GNOME versions no longer have type-to-extension mappings, so we might |
3214 // GNOME versions no longer have type-to-extension mappings, so we might |
3214 // get back a MIMEInfo without any extensions set. In that case we'll have |
3215 // get back a MIMEInfo without any extensions set. In that case we'll have |
3215 // to look in our mime.types files for the extensions. |
3216 // to look in our mime.types files for the extensions. |
3300 CopyUTF16toUTF8(aFilter, filter); |
3301 CopyUTF16toUTF8(aFilter, filter); |
3301 CopyUTF16toUTF8(aTitle, name); |
3302 CopyUTF16toUTF8(aTitle, name); |
3302 |
3303 |
3303 mFilters.AppendElement(filter); |
3304 mFilters.AppendElement(filter); |
3304 mFilterNames.AppendElement(name); |
3305 mFilterNames.AppendElement(name); |
3305 @@ -357,16 +361,19 @@ nsFilePicker::GetFiles(nsISimpleEnumerat |
3306 @@ -369,16 +373,19 @@ nsFilePicker::GetFiles(nsISimpleEnumerat |
3306 return NS_ERROR_FAILURE; |
3307 return NS_ERROR_FAILURE; |
3307 } |
3308 } |
3308 |
3309 |
3309 NS_IMETHODIMP |
3310 NS_IMETHODIMP |
3310 nsFilePicker::Show(PRInt16 *aReturn) |
3311 nsFilePicker::Show(int16_t *aReturn) |
3311 { |
3312 { |
3312 NS_ENSURE_ARG_POINTER(aReturn); |
3313 NS_ENSURE_ARG_POINTER(aReturn); |
3313 |
3314 |
3314 + if( nsKDEUtils::kdeSupport()) |
3315 + if( nsKDEUtils::kdeSupport()) |
3315 + return kdeFileDialog(aReturn); |
3316 + return kdeFileDialog(aReturn); |
3316 + |
3317 + |
3317 nsXPIDLCString title; |
3318 nsresult rv = Open(nullptr); |
3318 title.Adopt(ToNewUTF8String(mTitle)); |
3319 if (NS_FAILED(rv)) |
3319 |
3320 return rv; |
3320 GtkWindow *parent_widget = get_gtk_window_for_nsiwidget(mParentWidget); |
3321 |
3321 |
3322 while (mRunning) { |
3322 GtkFileChooserAction action = GetGtkFileChooserAction(mMode); |
3323 g_main_context_iteration(nullptr, TRUE); |
3323 const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE) |
|
3324 ? GTK_STOCK_SAVE : GTK_STOCK_OPEN; |
|
3325 @@ -505,8 +512,234 @@ nsFilePicker::Show(PRInt16 *aReturn) |
|
3326 *aReturn = nsIFilePicker::returnCancel; |
|
3327 break; |
|
3328 } |
3324 } |
3329 |
3325 |
3330 gtk_widget_destroy(file_chooser); |
3326 @@ -587,8 +594,235 @@ nsFilePicker::Done(GtkWidget* file_choos |
3331 |
3327 if (mCallback) { |
3332 return NS_OK; |
3328 mCallback->Done(result); |
|
3329 mCallback = nullptr; |
|
3330 } else { |
|
3331 mResult = result; |
|
3332 } |
|
3333 NS_RELEASE_THIS(); |
3333 } |
3334 } |
3334 + |
3335 + |
3335 +nsCString nsFilePicker::kdeMakeFilter( int index ) |
3336 +nsCString nsFilePicker::kdeMakeFilter( int index ) |
3336 + { |
3337 + { |
3337 + nsCString buf = mFilters[ index ]; |
3338 + nsCString buf = mFilters[ index ]; |