1 --- mozilla/chrome/src/Makefile.in.sav 2009-09-14 10:00:21.000000000 +0200 |
|
2 +++ mozilla/chrome/src/Makefile.in 2009-09-14 10:04:14.000000000 +0200 |
|
3 @@ -86,6 +86,7 @@ EXTRA_DSO_LDOPTS = \ |
|
4 |
|
5 ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT))) |
|
6 EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) |
|
7 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
|
8 endif |
|
9 |
|
10 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) |
|
11 --- mozilla/chrome/src/nsChromeRegistry.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
12 +++ mozilla/chrome/src/nsChromeRegistry.cpp 2009-09-14 10:04:14.000000000 +0200 |
|
13 @@ -114,6 +114,7 @@ |
|
14 #include "nsIXULAppInfo.h" |
|
15 #include "nsIXULRuntime.h" |
|
16 #include "nsPresShellIterator.h" |
|
17 +#include "nsKDEUtils.h" |
|
18 |
|
19 #ifdef MOZ_XUL |
|
20 // keep all the RDF stuff together, in case we can remove it in the far future |
|
21 @@ -2208,6 +2209,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
22 NS_NAMED_LITERAL_STRING(kAppVersion, "appversion"); |
|
23 NS_NAMED_LITERAL_STRING(kOs, "os"); |
|
24 NS_NAMED_LITERAL_STRING(kOsVersion, "osversion"); |
|
25 + NS_NAMED_LITERAL_STRING(kDesktop, "desktop"); |
|
26 |
|
27 nsCOMPtr<nsIIOService> io (do_GetIOService()); |
|
28 if (!io) return NS_ERROR_FAILURE; |
|
29 @@ -2251,6 +2253,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
30 } |
|
31 |
|
32 nsAutoString osVersion; |
|
33 + nsAutoString desktop; |
|
34 #if defined(XP_WIN) |
|
35 OSVERSIONINFO info = { sizeof(OSVERSIONINFO) }; |
|
36 if (GetVersionEx(&info)) { |
|
37 @@ -2258,6 +2261,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
38 info.dwMajorVersion, |
|
39 info.dwMinorVersion); |
|
40 } |
|
41 + desktop = NS_LITERAL_STRING("win"); |
|
42 #elif defined(XP_MACOSX) |
|
43 long majorVersion, minorVersion; |
|
44 if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) && |
|
45 @@ -2266,10 +2270,12 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
46 majorVersion, |
|
47 minorVersion); |
|
48 } |
|
49 + desktop = NS_LITERAL_STRING("macosx"); |
|
50 #elif defined(MOZ_WIDGET_GTK2) |
|
51 nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(), |
|
52 gtk_major_version, |
|
53 gtk_minor_version); |
|
54 + desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome"); // TODO others? |
|
55 #endif |
|
56 |
|
57 char *token; |
|
58 @@ -2313,6 +2319,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
59 TriState stApp = eUnspecified; |
|
60 TriState stOsVersion = eUnspecified; |
|
61 TriState stOs = eUnspecified; |
|
62 + TriState stDesktop = eUnspecified; |
|
63 |
|
64 PRBool badFlag = PR_FALSE; |
|
65 |
|
66 @@ -2326,6 +2333,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
67 CheckFlag(kContentAccessible, wtoken, contentAccessible) || |
|
68 CheckStringFlag(kApplication, wtoken, appID, stApp) || |
|
69 CheckStringFlag(kOs, wtoken, osTarget, stOs) || |
|
70 + CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || |
|
71 CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) || |
|
72 CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion)) |
|
73 continue; |
|
74 @@ -2337,7 +2345,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
75 } |
|
76 |
|
77 if (badFlag || stApp == eBad || stAppVersion == eBad || |
|
78 - stOs == eBad || stOsVersion == eBad) |
|
79 + stOs == eBad || stOsVersion == eBad || stDesktop == eBad) |
|
80 continue; |
|
81 |
|
82 nsCOMPtr<nsIURI> resolved; |
|
83 @@ -2398,6 +2406,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
84 TriState stApp = eUnspecified; |
|
85 TriState stOs = eUnspecified; |
|
86 TriState stOsVersion = eUnspecified; |
|
87 + TriState stDesktop = eUnspecified; |
|
88 |
|
89 PRBool badFlag = PR_FALSE; |
|
90 |
|
91 @@ -2408,6 +2417,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
92 |
|
93 if (CheckStringFlag(kApplication, wtoken, appID, stApp) || |
|
94 CheckStringFlag(kOs, wtoken, osTarget, stOs) || |
|
95 + CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || |
|
96 CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) || |
|
97 CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion)) |
|
98 continue; |
|
99 @@ -2419,7 +2429,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
100 } |
|
101 |
|
102 if (badFlag || stApp == eBad || stAppVersion == eBad || |
|
103 - stOs == eBad || stOsVersion == eBad) |
|
104 + stOs == eBad || stOsVersion == eBad || stDesktop == eBad) |
|
105 continue; |
|
106 |
|
107 nsCOMPtr<nsIURI> resolved; |
|
108 @@ -2460,6 +2470,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
109 TriState stApp = eUnspecified; |
|
110 TriState stOs = eUnspecified; |
|
111 TriState stOsVersion = eUnspecified; |
|
112 + TriState stDesktop = eUnspecified; |
|
113 |
|
114 PRBool badFlag = PR_FALSE; |
|
115 |
|
116 @@ -2470,6 +2481,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
117 |
|
118 if (CheckStringFlag(kApplication, wtoken, appID, stApp) || |
|
119 CheckStringFlag(kOs, wtoken, osTarget, stOs) || |
|
120 + CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || |
|
121 CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) || |
|
122 CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion)) |
|
123 continue; |
|
124 @@ -2481,7 +2493,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
125 } |
|
126 |
|
127 if (badFlag || stApp == eBad || stAppVersion == eBad || |
|
128 - stOs == eBad || stOsVersion == eBad) |
|
129 + stOs == eBad || stOsVersion == eBad || stDesktop == eBad) |
|
130 continue; |
|
131 |
|
132 nsCOMPtr<nsIURI> resolved; |
|
133 @@ -2524,6 +2536,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
134 TriState stApp = eUnspecified; |
|
135 TriState stOs = eUnspecified; |
|
136 TriState stOsVersion = eUnspecified; |
|
137 + TriState stDesktop = eUnspecified; |
|
138 |
|
139 PRBool badFlag = PR_FALSE; |
|
140 |
|
141 @@ -2534,6 +2547,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
142 |
|
143 if (CheckStringFlag(kApplication, wtoken, appID, stApp) || |
|
144 CheckStringFlag(kOs, wtoken, osTarget, stOs) || |
|
145 + CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || |
|
146 CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) || |
|
147 CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion)) |
|
148 continue; |
|
149 @@ -2545,7 +2559,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
150 } |
|
151 |
|
152 if (badFlag || stApp == eBad || stAppVersion == eBad || |
|
153 - stOs == eBad || stOsVersion == eBad) |
|
154 + stOs == eBad || stOsVersion == eBad || stDesktop == eBad) |
|
155 continue; |
|
156 |
|
157 nsCOMPtr<nsIURI> baseuri, overlayuri; |
|
158 @@ -2580,6 +2594,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
159 TriState stApp = eUnspecified; |
|
160 TriState stOs = eUnspecified; |
|
161 TriState stOsVersion = eUnspecified; |
|
162 + TriState stDesktop = eUnspecified; |
|
163 |
|
164 PRBool badFlag = PR_FALSE; |
|
165 |
|
166 @@ -2590,6 +2605,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
167 |
|
168 if (CheckStringFlag(kApplication, wtoken, appID, stApp) || |
|
169 CheckStringFlag(kOs, wtoken, osTarget, stOs) || |
|
170 + CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || |
|
171 CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) || |
|
172 CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion)) |
|
173 continue; |
|
174 @@ -2601,7 +2617,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
175 } |
|
176 |
|
177 if (badFlag || stApp == eBad || stAppVersion == eBad || |
|
178 - stOs == eBad || stOsVersion == eBad) |
|
179 + stOs == eBad || stOsVersion == eBad || stDesktop == eBad) |
|
180 continue; |
|
181 |
|
182 nsCOMPtr<nsIURI> baseuri, overlayuri; |
|
183 @@ -2640,6 +2656,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
184 TriState stApp = eUnspecified; |
|
185 TriState stOs = eUnspecified; |
|
186 TriState stOsVersion = eUnspecified; |
|
187 + TriState stDesktop = eUnspecified; |
|
188 |
|
189 PRBool badFlag = PR_FALSE; |
|
190 |
|
191 @@ -2650,6 +2667,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
192 |
|
193 if (CheckStringFlag(kApplication, wtoken, appID, stApp) || |
|
194 CheckStringFlag(kOs, wtoken, osTarget, stOs) || |
|
195 + CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || |
|
196 CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) || |
|
197 CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion)) |
|
198 continue; |
|
199 @@ -2661,7 +2679,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
200 } |
|
201 |
|
202 if (badFlag || stApp == eBad || stAppVersion == eBad || |
|
203 - stOs == eBad || stOsVersion == eBad) |
|
204 + stOs == eBad || stOsVersion == eBad || stDesktop == eBad) |
|
205 continue; |
|
206 |
|
207 nsCOMPtr<nsIURI> chromeuri, resolveduri; |
|
208 @@ -2702,6 +2720,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
209 TriState stApp = eUnspecified; |
|
210 TriState stOsVersion = eUnspecified; |
|
211 TriState stOs = eUnspecified; |
|
212 + TriState stDesktop = eUnspecified; |
|
213 |
|
214 PRBool badFlag = PR_FALSE; |
|
215 |
|
216 @@ -2712,6 +2731,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
217 |
|
218 if (CheckStringFlag(kApplication, wtoken, appID, stApp) || |
|
219 CheckStringFlag(kOs, wtoken, osTarget, stOs) || |
|
220 + CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || |
|
221 CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) || |
|
222 CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion)) |
|
223 continue; |
|
224 @@ -2723,7 +2743,7 @@ nsChromeRegistry::ProcessManifestBuffer( |
|
225 } |
|
226 |
|
227 if (badFlag || stApp == eBad || stAppVersion == eBad || |
|
228 - stOs == eBad || stOsVersion == eBad) |
|
229 + stOs == eBad || stOsVersion == eBad || stDesktop == eBad) |
|
230 continue; |
|
231 |
|
232 nsDependentCString host(package); |
|
233 --- mozilla/modules/libpref/src/Makefile.in.sav 2009-09-14 10:00:21.000000000 +0200 |
|
234 +++ mozilla/modules/libpref/src/Makefile.in 2009-09-14 10:04:14.000000000 +0200 |
|
235 @@ -97,3 +97,5 @@ nsPrefService.$(OBJ_SUFFIX): nsPrefServi |
|
236 @$(MAKE_DEPS_AUTO_CXX) |
|
237 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS) |
|
238 endif |
|
239 + |
|
240 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
|
241 --- mozilla/modules/libpref/src/nsPrefService.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
242 +++ mozilla/modules/libpref/src/nsPrefService.cpp 2009-09-14 10:04:14.000000000 +0200 |
|
243 @@ -51,6 +51,7 @@ |
|
244 #include "nsCOMArray.h" |
|
245 #include "nsXPCOMCID.h" |
|
246 #include "nsAutoPtr.h" |
|
247 +#include "nsKDEUtils.h" |
|
248 |
|
249 #include "nsQuickSort.h" |
|
250 #include "prmem.h" |
|
251 @@ -606,7 +607,8 @@ pref_LoadPrefsInDir(nsIFile* aDir, char |
|
252 return rv; |
|
253 } |
|
254 |
|
255 -static nsresult pref_LoadPrefsInDirList(const char *listId) |
|
256 +static nsresult pref_LoadPrefsInDirList(const char *listId, |
|
257 + char const *const *aSpecialFiles = NULL, PRUint32 aSpecialFilesCount = 0) |
|
258 { |
|
259 nsresult rv; |
|
260 nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); |
|
261 @@ -625,7 +627,7 @@ static nsresult pref_LoadPrefsInDirList( |
|
262 nsCOMPtr<nsIFile> dir = do_QueryInterface(elem); |
|
263 if (dir) { |
|
264 // Do we care if a file provided by this process fails to load? |
|
265 - pref_LoadPrefsInDir(dir, nsnull, 0); |
|
266 + pref_LoadPrefsInDir(dir, aSpecialFiles, aSpecialFilesCount); |
|
267 } |
|
268 } |
|
269 } |
|
270 @@ -676,6 +678,7 @@ static nsresult pref_InitInitialObjects( |
|
271 #if defined(MOZ_WIDGET_PHOTON) |
|
272 , "photon.js" |
|
273 #endif |
|
274 + , "" // placeholder for KDE (empty is otherwise harmless) |
|
275 #elif defined(XP_OS2) |
|
276 "os2pref.js" |
|
277 #elif defined(XP_BEOS) |
|
278 @@ -683,12 +686,23 @@ static nsresult pref_InitInitialObjects( |
|
279 #endif |
|
280 }; |
|
281 |
|
282 + if( nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper? |
|
283 + for( int i = 0; |
|
284 + i < NS_ARRAY_LENGTH(specialFiles); |
|
285 + ++i ) { |
|
286 + if( *specialFiles[ i ] == '\0' ) { |
|
287 + specialFiles[ i ] = "kde.js"; |
|
288 + break; |
|
289 + } |
|
290 + } |
|
291 + } |
|
292 + |
|
293 rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); |
|
294 if (NS_FAILED(rv)) { |
|
295 NS_WARNING("Error parsing application default preferences."); |
|
296 } |
|
297 |
|
298 - rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST); |
|
299 + rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST, specialFiles, NS_ARRAY_LENGTH(specialFiles)); |
|
300 NS_ENSURE_SUCCESS(rv, rv); |
|
301 |
|
302 NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, |
|
303 --- mozilla/toolkit/components/downloads/src/Makefile.in.sav 2009-09-14 10:00:21.000000000 +0200 |
|
304 +++ mozilla/toolkit/components/downloads/src/Makefile.in 2009-09-14 10:04:14.000000000 +0200 |
|
305 @@ -100,3 +100,4 @@ include $(topsrcdir)/config/rules.mk |
|
306 |
|
307 EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) |
|
308 |
|
309 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
|
310 --- mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
311 +++ mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp 2009-09-14 10:04:14.000000000 +0200 |
|
312 @@ -85,6 +85,7 @@ |
|
313 #include "nsDocShellCID.h" |
|
314 #include "nsIPrivateBrowsingService.h" |
|
315 #include "nsNetCID.h" |
|
316 +#include "nsKDEUtils.h" |
|
317 |
|
318 #if defined(XP_WIN) && !defined(WINCE) |
|
319 #include <shlobj.h> |
|
320 @@ -2299,6 +2300,15 @@ nsDownload::SetState(DownloadState aStat |
|
321 pref->GetBoolPref(PREF_BDM_SHOWALERTONCOMPLETE, &showTaskbarAlert); |
|
322 |
|
323 if (showTaskbarAlert) { |
|
324 + if( nsKDEUtils::kdeSupport()) { |
|
325 + nsCStringArray command; |
|
326 + command.AppendCString( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" )); |
|
327 + nsAutoString displayName; |
|
328 + GetDisplayName( displayName ); |
|
329 + command.AppendCString( nsCAutoString( ToNewUTF8String( displayName ))); |
|
330 + nsKDEUtils::command( command ); |
|
331 + } else { |
|
332 + // begin non-KDE block |
|
333 PRInt32 alertInterval = 2000; |
|
334 if (pref) |
|
335 pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval); |
|
336 @@ -2334,6 +2344,7 @@ nsDownload::SetState(DownloadState aStat |
|
337 EmptyString()); |
|
338 } |
|
339 } |
|
340 + } // end non-KDE block |
|
341 } |
|
342 #if defined(XP_WIN) && !defined(WINCE) |
|
343 nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget); |
|
344 --- mozilla/toolkit/content/jar.mn.sav 2009-09-14 10:00:21.000000000 +0200 |
|
345 +++ mozilla/toolkit/content/jar.mn 2009-09-14 10:04:14.000000000 +0200 |
|
346 @@ -43,6 +43,8 @@ toolkit.jar: |
|
347 *+ content/global/bindings/colorpicker.xml (widgets/colorpicker.xml) |
|
348 *+ content/global/bindings/datetimepicker.xml (widgets/datetimepicker.xml) |
|
349 *+ content/global/bindings/dialog.xml (widgets/dialog.xml) |
|
350 +*+ content/global/bindings/dialog-kde.xml (widgets/dialog-kde.xml) |
|
351 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde |
|
352 *+ content/global/bindings/editor.xml (widgets/editor.xml) |
|
353 * content/global/bindings/expander.xml (widgets/expander.xml) |
|
354 * content/global/bindings/filefield.xml (widgets/filefield.xml) |
|
355 @@ -56,6 +58,8 @@ toolkit.jar: |
|
356 *+ content/global/bindings/numberbox.xml (widgets/numberbox.xml) |
|
357 *+ content/global/bindings/popup.xml (widgets/popup.xml) |
|
358 *+ content/global/bindings/preferences.xml (widgets/preferences.xml) |
|
359 +*+ content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml) |
|
360 +% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde |
|
361 *+ content/global/bindings/progressmeter.xml (widgets/progressmeter.xml) |
|
362 *+ content/global/bindings/radio.xml (widgets/radio.xml) |
|
363 *+ content/global/bindings/resizer.xml (widgets/resizer.xml) |
|
364 --- mozilla/toolkit/content/widgets/dialog-kde.xml.sav 2009-09-14 10:00:21.000000000 +0200 |
|
365 +++ mozilla/toolkit/content/widgets/dialog-kde.xml 2009-09-14 10:04:14.000000000 +0200 |
|
366 @@ -19,7 +19,7 @@ |
|
367 |
|
368 <xul:hbox class="dialog-button-box" anonid="buttons" |
|
369 xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient" |
|
370 -#ifdef XP_UNIX |
|
371 +#ifdef XP_UNIX_GNOME |
|
372 > |
|
373 <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
|
374 <xul:button dlgtype="help" class="dialog-button" hidden="true"/> |
|
375 @@ -28,6 +28,15 @@ |
|
376 <xul:spacer anonid="spacer" flex="1"/> |
|
377 <xul:button dlgtype="cancel" class="dialog-button"/> |
|
378 <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/> |
|
379 +#elif XP_UNIX |
|
380 + pack="end"> |
|
381 + <xul:button dlgtype="help" class="dialog-button" hidden="true"/> |
|
382 + <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
|
383 + <xul:spacer anonid="spacer" flex="1" hidden="true"/> |
|
384 + <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/> |
|
385 + <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/> |
|
386 + <xul:button dlgtype="cancel" class="dialog-button"/> |
|
387 + <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
|
388 #else |
|
389 pack="end"> |
|
390 <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
|
391 --- mozilla/toolkit/content/widgets/preferences-kde.xml.sav 2009-09-14 10:00:21.000000000 +0200 |
|
392 +++ mozilla/toolkit/content/widgets/preferences-kde.xml 2009-09-14 10:04:14.000000000 +0200 |
|
393 @@ -573,7 +573,7 @@ |
|
394 </xul:deck> |
|
395 </xul:hbox> |
|
396 <xul:hbox anonid="dlg-buttons" class="prefWindow-dlgbuttons" |
|
397 -#ifdef XP_UNIX |
|
398 +#ifdef XP_UNIX_GNOME |
|
399 > |
|
400 <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
|
401 <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/> |
|
402 @@ -582,6 +582,15 @@ |
|
403 <xul:spacer anonid="spacer" flex="1"/> |
|
404 <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/> |
|
405 <xul:button dlgtype="accept" class="dialog-button" icon="accept"/> |
|
406 +#elif XP_UNIX |
|
407 + pack="end"> |
|
408 + <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/> |
|
409 + <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
|
410 + <xul:spacer anonid="spacer" flex="1"/> |
|
411 + <xul:button dlgtype="accept" class="dialog-button" icon="accept"/> |
|
412 + <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/> |
|
413 + <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/> |
|
414 + <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
|
415 #else |
|
416 pack="end"> |
|
417 <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
|
418 --- mozilla/toolkit/system/unixproxy/Makefile.in.sav 2009-09-14 10:00:21.000000000 +0200 |
|
419 +++ mozilla/toolkit/system/unixproxy/Makefile.in 2009-09-14 10:04:14.000000000 +0200 |
|
420 @@ -64,4 +64,6 @@ CPPSRCS = \ |
|
421 nsUnixSystemProxySettings.cpp \ |
|
422 $(NULL) |
|
423 |
|
424 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
|
425 + |
|
426 include $(topsrcdir)/config/rules.mk |
|
427 --- mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
428 +++ mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp 2009-09-14 10:04:14.000000000 +0200 |
|
429 @@ -49,6 +49,8 @@ |
|
430 #include "nsPrintfCString.h" |
|
431 #include "nsNetUtil.h" |
|
432 #include "nsISupportsPrimitives.h" |
|
433 +#include "nsVoidArray.h" |
|
434 +#include "nsKDEUtils.h" |
|
435 |
|
436 class nsUnixSystemProxySettings : public nsISystemProxySettings { |
|
437 public: |
|
438 @@ -65,6 +67,7 @@ private: |
|
439 PRBool IsProxyMode(const char* aMode); |
|
440 nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult); |
|
441 nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
|
442 + nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
|
443 }; |
|
444 |
|
445 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
|
446 @@ -412,6 +415,9 @@ nsUnixSystemProxySettings::GetProxyForUR |
|
447 rv = aURI->GetPort(&port); |
|
448 NS_ENSURE_SUCCESS(rv, rv); |
|
449 |
|
450 + if( nsKDEUtils::kdeSupport()) |
|
451 + return GetProxyFromKDE( scheme, host, port, aResult ); |
|
452 + |
|
453 if (!mGConf) |
|
454 return GetProxyFromEnvironment(scheme, host, port, aResult); |
|
455 |
|
456 @@ -432,3 +438,28 @@ static const nsModuleComponentInfo compo |
|
457 }; |
|
458 |
|
459 NS_IMPL_NSGETMODULE(nsUnixProxyModule, components) |
|
460 + |
|
461 +nsresult |
|
462 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme, |
|
463 + const nsACString& aHost, |
|
464 + PRInt32 aPort, |
|
465 + nsACString& aResult) |
|
466 +{ |
|
467 + nsCAutoString url; |
|
468 + url = aScheme; |
|
469 + url += "://"; |
|
470 + url += aHost; |
|
471 + if( aPort >= 0 ) |
|
472 + { |
|
473 + url += ":"; |
|
474 + url += nsPrintfCString("%d", aPort); |
|
475 + } |
|
476 + nsCStringArray command; |
|
477 + command.AppendCString( NS_LITERAL_CSTRING( "GETPROXY" )); |
|
478 + command.AppendCString( url ); |
|
479 + nsCStringArray result; |
|
480 + if( !nsKDEUtils::command( command, &result ) || result.Count() != 1 ) |
|
481 + return NS_ERROR_FAILURE; |
|
482 + aResult = *result[ 0 ]; |
|
483 + return NS_OK; |
|
484 +} |
|
485 --- mozilla/toolkit/xre/Makefile.in.sav 2009-09-14 10:00:21.000000000 +0200 |
|
486 +++ mozilla/toolkit/xre/Makefile.in 2009-09-14 10:04:14.000000000 +0200 |
|
487 @@ -98,6 +98,7 @@ endif |
|
488 EXPORTS = \ |
|
489 xrecore.h \ |
|
490 nsXULAppAPI.h \ |
|
491 + nsKDEUtils.h \ |
|
492 $(NULL) |
|
493 |
|
494 CPPSRCS = \ |
|
495 @@ -133,7 +134,7 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),beos) |
|
496 CPPSRCS += nsNativeAppSupportBeOS.cpp |
|
497 else |
|
498 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) |
|
499 -CPPSRCS += nsNativeAppSupportUnix.cpp |
|
500 +CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp |
|
501 else |
|
502 CPPSRCS += nsNativeAppSupportDefault.cpp |
|
503 endif |
|
504 --- mozilla/toolkit/xre/nsKDEUtils.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
505 +++ mozilla/toolkit/xre/nsKDEUtils.cpp 2009-09-14 10:04:14.000000000 +0200 |
|
506 @@ -0,0 +1,329 @@ |
|
507 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
508 +/* ***** BEGIN LICENSE BLOCK ***** |
|
509 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|
510 + * |
|
511 + * The contents of this file are subject to the Mozilla Public License Version |
|
512 + * 1.1 (the "License"); you may not use this file except in compliance with |
|
513 + * the License. You may obtain a copy of the License at |
|
514 + * http://www.mozilla.org/MPL/ |
|
515 + * |
|
516 + * Software distributed under the License is distributed on an "AS IS" basis, |
|
517 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
518 + * for the specific language governing rights and limitations under the |
|
519 + * License. |
|
520 + * |
|
521 + * The Original Code is Unix Native App Support. |
|
522 + * |
|
523 + * The Initial Developer of the Original Code is |
|
524 + * Mozilla Corporation. |
|
525 + * Portions created by the Initial Developer are Copyright (C) 2007 |
|
526 + * the Initial Developer. All Rights Reserved. |
|
527 + * |
|
528 + * Contributor(s): |
|
529 + * |
|
530 + * Alternatively, the contents of this file may be used under the terms of |
|
531 + * either the GNU General Public License Version 2 or later (the "GPL"), or |
|
532 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
533 + * in which case the provisions of the GPL or the LGPL are applicable instead |
|
534 + * of those above. If you wish to allow use of your version of this file only |
|
535 + * under the terms of either the GPL or the LGPL, and not to allow others to |
|
536 + * use your version of this file under the terms of the MPL, indicate your |
|
537 + * decision by deleting the provisions above and replace them with the notice |
|
538 + * and other provisions required by the GPL or the LGPL. If you do not delete |
|
539 + * the provisions above, a recipient may use your version of this file under |
|
540 + * the terms of any one of the MPL, the GPL or the LGPL. |
|
541 + * |
|
542 + * ***** END LICENSE BLOCK ***** */ |
|
543 + |
|
544 +#include "nsKDEUtils.h" |
|
545 +#include "nsIWidget.h" |
|
546 + |
|
547 +#include <gtk/gtkwindow.h> |
|
548 +#include <gtk/gtkmain.h> |
|
549 + |
|
550 +#include <limits.h> |
|
551 +#include <stdio.h> |
|
552 +#include <sys/wait.h> |
|
553 +#include <unistd.h> |
|
554 +#include <X11/Xlib.h> |
|
555 + |
|
556 +//#define DEBUG_KDE |
|
557 +#ifdef DEBUG_KDE |
|
558 +#define KMOZILLAHELPER "kmozillahelper" |
|
559 +#else |
|
560 +// not need for lib64, it's a binary |
|
561 +#define KMOZILLAHELPER "/usr/lib/mozilla/kmozillahelper" |
|
562 +#endif |
|
563 + |
|
564 +#define KMOZILLAHELPER_VERSION 5 |
|
565 +#define MAKE_STR2( n ) #n |
|
566 +#define MAKE_STR( n ) MAKE_STR2( n ) |
|
567 + |
|
568 +static bool getKdeSession() |
|
569 + { |
|
570 + Display* dpy = XOpenDisplay( NULL ); |
|
571 + if( dpy == NULL ) |
|
572 + return false; |
|
573 + Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True ); |
|
574 + bool kde = false; |
|
575 + if( kde_full_session != None ) |
|
576 + { |
|
577 + int cnt; |
|
578 + if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt )) |
|
579 + { |
|
580 + for( int i = 0; |
|
581 + i < cnt; |
|
582 + ++i ) |
|
583 + { |
|
584 + if( props[ i ] == kde_full_session ) |
|
585 + { |
|
586 + kde = true; |
|
587 +#ifdef DEBUG_KDE |
|
588 + fprintf( stderr, "KDE SESSION %d\n", kde ); |
|
589 +#endif |
|
590 + break; |
|
591 + } |
|
592 + } |
|
593 + XFree( props ); |
|
594 + } |
|
595 + } |
|
596 + XCloseDisplay( dpy ); |
|
597 + return kde; |
|
598 + } |
|
599 + |
|
600 +static bool getKdeSupport() |
|
601 + { |
|
602 + nsCStringArray command; |
|
603 + command.AppendCString( NS_LITERAL_CSTRING( "CHECK" )); |
|
604 + command.AppendCString( NS_LITERAL_CSTRING( MAKE_STR( KMOZILLAHELPER_VERSION ))); |
|
605 + bool kde = nsKDEUtils::command( command ); |
|
606 +#ifdef DEBUG_KDE |
|
607 + fprintf( stderr, "KDE RUNNING %d\n", kde ); |
|
608 +#endif |
|
609 + return kde; |
|
610 + } |
|
611 + |
|
612 +nsKDEUtils::nsKDEUtils() |
|
613 + : commandFile( NULL ) |
|
614 + , replyFile( NULL ) |
|
615 + { |
|
616 + } |
|
617 + |
|
618 +nsKDEUtils::~nsKDEUtils() |
|
619 + { |
|
620 +// closeHelper(); not actually useful, exiting will close the fd too |
|
621 + } |
|
622 + |
|
623 +nsKDEUtils* nsKDEUtils::self() |
|
624 + { |
|
625 + static nsKDEUtils s; |
|
626 + return &s; |
|
627 + } |
|
628 + |
|
629 +static bool helperRunning = false; |
|
630 +static bool helperFailed = false; |
|
631 + |
|
632 +bool nsKDEUtils::kdeSession() |
|
633 + { |
|
634 + static bool session = getKdeSession(); |
|
635 + return session; |
|
636 + } |
|
637 + |
|
638 +bool nsKDEUtils::kdeSupport() |
|
639 + { |
|
640 + static bool support = kdeSession() && getKdeSupport(); |
|
641 + return support && helperRunning; |
|
642 + } |
|
643 + |
|
644 +struct nsKDECommandData |
|
645 + { |
|
646 + FILE* file; |
|
647 + nsCStringArray* output; |
|
648 + GMainLoop* loop; |
|
649 + bool success; |
|
650 + }; |
|
651 + |
|
652 +static gboolean kdeReadFunc( GIOChannel*, GIOCondition, gpointer data ) |
|
653 + { |
|
654 + nsKDECommandData* p = static_cast< nsKDECommandData* >( data ); |
|
655 + char buf[ 8192 ]; // TODO big enough |
|
656 + bool command_done = false; |
|
657 + bool command_failed = false; |
|
658 + while( !command_done && !command_failed && fgets( buf, 8192, p->file ) != NULL ) |
|
659 + { // TODO what if the kernel splits a line into two chunks? |
|
660 +//#ifdef DEBUG_KDE |
|
661 +// fprintf( stderr, "READ: %s %d\n", buf, feof( p->file )); |
|
662 +//#endif |
|
663 + if( char* eol = strchr( buf, '\n' )) |
|
664 + *eol = '\0'; |
|
665 + command_done = ( strcmp( buf, "\\1" ) == 0 ); |
|
666 + command_failed = ( strcmp( buf, "\\0" ) == 0 ); |
|
667 + nsCAutoString line( buf ); |
|
668 + line.ReplaceSubstring( "\\n", "\n" ); |
|
669 + line.ReplaceSubstring( "\\" "\\", "\\" ); // \\ -> \ , i.e. unescape |
|
670 + if( p->output && !( command_done || command_failed )) |
|
671 + p->output->AppendCString( nsCString( buf )); // TODO utf8? |
|
672 + } |
|
673 + bool quit = false; |
|
674 + if( feof( p->file ) || command_failed ) |
|
675 + { |
|
676 + quit = true; |
|
677 + p->success = false; |
|
678 + } |
|
679 + if( command_done ) |
|
680 + { // reading one reply finished |
|
681 + quit = true; |
|
682 + p->success = true; |
|
683 + } |
|
684 + if( quit ) |
|
685 + { |
|
686 + if( p->loop ) |
|
687 + g_main_loop_quit( p->loop ); |
|
688 + return FALSE; |
|
689 + } |
|
690 + return TRUE; |
|
691 + } |
|
692 + |
|
693 +bool nsKDEUtils::command( const nsCStringArray& command, nsCStringArray* output ) |
|
694 + { |
|
695 + return self()->internalCommand( command, NULL, false, output ); |
|
696 + } |
|
697 + |
|
698 +bool nsKDEUtils::commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output ) |
|
699 + { |
|
700 + return self()->internalCommand( command, parent, true, output ); |
|
701 + } |
|
702 + |
|
703 +bool nsKDEUtils::internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool blockUi, |
|
704 + nsCStringArray* output ) |
|
705 + { |
|
706 + if( !startHelper()) |
|
707 + return false; |
|
708 + feedCommand( command ); |
|
709 + // do not store the data in 'this' but in extra structure, just in case there |
|
710 + // is reentrancy (can there be? the event loop is re-entered) |
|
711 + nsKDECommandData data; |
|
712 + data.file = replyFile; |
|
713 + data.output = output; |
|
714 + data.success = false; |
|
715 + if( blockUi ) |
|
716 + { |
|
717 + data.loop = g_main_loop_new( NULL, FALSE ); |
|
718 + GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); |
|
719 + if( parent && parent->group ) |
|
720 + gtk_window_group_add_window( parent->group, GTK_WINDOW( window )); |
|
721 + gtk_widget_realize( window ); |
|
722 + gtk_widget_set_sensitive( window, TRUE ); |
|
723 + gtk_grab_add( window ); |
|
724 + GIOChannel* channel = g_io_channel_unix_new( fileno( data.file )); |
|
725 + g_io_add_watch( channel, static_cast< GIOCondition >( G_IO_IN | G_IO_ERR | G_IO_HUP ), kdeReadFunc, &data ); |
|
726 + g_io_channel_unref( channel ); |
|
727 + g_main_loop_run( data.loop ); |
|
728 + g_main_loop_unref( data.loop ); |
|
729 + gtk_grab_remove( window ); |
|
730 + gtk_widget_destroy( window ); |
|
731 + } |
|
732 + else |
|
733 + { |
|
734 + data.loop = NULL; |
|
735 + while( kdeReadFunc( NULL, static_cast< GIOCondition >( 0 ), &data )) |
|
736 + ; |
|
737 + } |
|
738 + return data.success; |
|
739 + } |
|
740 + |
|
741 +bool nsKDEUtils::startHelper() |
|
742 + { |
|
743 + if( helperRunning ) |
|
744 + return true; |
|
745 + if( helperFailed ) |
|
746 + return false; |
|
747 + helperFailed = true; |
|
748 + int fdcommand[ 2 ]; |
|
749 + int fdreply[ 2 ]; |
|
750 + if( pipe( fdcommand ) < 0 ) |
|
751 + return false; |
|
752 + if( pipe( fdreply ) < 0 ) |
|
753 + { |
|
754 + close( fdcommand[ 0 ] ); |
|
755 + close( fdcommand[ 1 ] ); |
|
756 + return false; |
|
757 + } |
|
758 + char* args[ 2 ] = { const_cast< char* >( KMOZILLAHELPER ), NULL }; |
|
759 + switch( fork()) |
|
760 + { |
|
761 + case -1: |
|
762 + { |
|
763 + close( fdcommand[ 0 ] ); |
|
764 + close( fdcommand[ 1 ] ); |
|
765 + close( fdreply[ 0 ] ); |
|
766 + close( fdreply[ 1 ] ); |
|
767 + return false; |
|
768 + } |
|
769 + case 0: // child |
|
770 + { |
|
771 + if( dup2( fdcommand[ 0 ], STDIN_FILENO ) < 0 ) |
|
772 + _exit( 1 ); |
|
773 + if( dup2( fdreply[ 1 ], STDOUT_FILENO ) < 0 ) |
|
774 + _exit( 1 ); |
|
775 + int maxfd = 1024; // close all other fds |
|
776 + struct rlimit rl; |
|
777 + if( getrlimit( RLIMIT_NOFILE, &rl ) == 0 ) |
|
778 + maxfd = rl.rlim_max; |
|
779 + for( int i = 3; |
|
780 + i < maxfd; |
|
781 + ++i ) |
|
782 + close( i ); |
|
783 +#ifdef DEBUG_KDE |
|
784 + execvp( KMOZILLAHELPER, args ); |
|
785 +#else |
|
786 + execv( KMOZILLAHELPER, args ); |
|
787 +#endif |
|
788 + _exit( 1 ); // failed |
|
789 + } |
|
790 + default: // parent |
|
791 + { |
|
792 + commandFile = fdopen( fdcommand[ 1 ], "w" ); |
|
793 + replyFile = fdopen( fdreply[ 0 ], "r" ); |
|
794 + close( fdcommand[ 0 ] ); |
|
795 + close( fdreply[ 1 ] ); |
|
796 + if( commandFile == NULL || replyFile == NULL ) |
|
797 + { |
|
798 + closeHelper(); |
|
799 + return false; |
|
800 + } |
|
801 + // ok, helper ready, getKdeRunning() will check if it works |
|
802 + } |
|
803 + } |
|
804 + helperFailed = false; |
|
805 + helperRunning = true; |
|
806 + return true; |
|
807 + } |
|
808 + |
|
809 +void nsKDEUtils::closeHelper() |
|
810 + { |
|
811 + if( commandFile != NULL ) |
|
812 + fclose( commandFile ); // this will also make the helper quit |
|
813 + if( replyFile != NULL ) |
|
814 + fclose( replyFile ); |
|
815 + helperRunning = false; |
|
816 + } |
|
817 + |
|
818 +void nsKDEUtils::feedCommand( const nsCStringArray& command ) |
|
819 + { |
|
820 + for( int i = 0; |
|
821 + i < command.Count(); |
|
822 + ++i ) |
|
823 + { |
|
824 + nsCString line = *command[ i ]; |
|
825 + line.ReplaceSubstring( "\\", "\\" "\\" ); // \ -> \\ , i.e. escape |
|
826 + line.ReplaceSubstring( "\n", "\\n" ); |
|
827 +#ifdef DEBUG_KDE |
|
828 + fprintf( stderr, "COMM: %s\n", line.get()); |
|
829 +#endif |
|
830 + fputs( line.get(), commandFile ); |
|
831 + fputs( "\n", commandFile ); |
|
832 + } |
|
833 + fputs( "\\E\n", commandFile ); // done as \E, so it cannot happen in normal data |
|
834 + fflush( commandFile ); |
|
835 + } |
|
836 --- mozilla/toolkit/xre/nsKDEUtils.h.sav 2009-09-14 10:00:21.000000000 +0200 |
|
837 +++ mozilla/toolkit/xre/nsKDEUtils.h 2009-09-14 10:04:15.000000000 +0200 |
|
838 @@ -0,0 +1,77 @@ |
|
839 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
840 + * |
|
841 + * ***** BEGIN LICENSE BLOCK ***** |
|
842 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|
843 + * |
|
844 + * The contents of this file are subject to the Mozilla Public License Version |
|
845 + * 1.1 (the "License"); you may not use this file except in compliance with |
|
846 + * the License. You may obtain a copy of the License at |
|
847 + * http://www.mozilla.org/MPL/ |
|
848 + * |
|
849 + * Software distributed under the License is distributed on an "AS IS" basis, |
|
850 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
851 + * for the specific language governing rights and limitations under the |
|
852 + * License. |
|
853 + * |
|
854 + * The Original Code is Mozilla Communicator client code. |
|
855 + * |
|
856 + * The Initial Developer of the Original Code is |
|
857 + * Netscape Communications Corporation. |
|
858 + * Portions created by the Initial Developer are Copyright (C) 1998 |
|
859 + * the Initial Developer. All Rights Reserved. |
|
860 + * |
|
861 + * Contributor(s): |
|
862 + * |
|
863 + * Alternatively, the contents of this file may be used under the terms of |
|
864 + * either of the GNU General Public License Version 2 or later (the "GPL"), |
|
865 + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
866 + * in which case the provisions of the GPL or the LGPL are applicable instead |
|
867 + * of those above. If you wish to allow use of your version of this file only |
|
868 + * under the terms of either the GPL or the LGPL, and not to allow others to |
|
869 + * use your version of this file under the terms of the MPL, indicate your |
|
870 + * decision by deleting the provisions above and replace them with the notice |
|
871 + * and other provisions required by the GPL or the LGPL. If you do not delete |
|
872 + * the provisions above, a recipient may use your version of this file under |
|
873 + * the terms of any one of the MPL, the GPL or the LGPL. |
|
874 + * |
|
875 + * ***** END LICENSE BLOCK ***** */ |
|
876 + |
|
877 +#ifndef nsKDEUtils_h__ |
|
878 +#define nsKDEUtils_h__ |
|
879 + |
|
880 +#include "nsStringGlue.h" |
|
881 +#include "nsVoidArray.h" |
|
882 +#include <stdio.h> |
|
883 + |
|
884 +typedef struct _GtkWindow GtkWindow; |
|
885 + |
|
886 +class NS_EXPORT nsKDEUtils |
|
887 + { |
|
888 + public: |
|
889 + /* Returns true if running inside a KDE session (regardless of whether there is KDE |
|
890 + support available for Firefox). This should be used e.g. when determining |
|
891 + dialog button order but not for code that requires the KDE support. */ |
|
892 + static bool kdeSession(); |
|
893 + /* Returns true if running inside a KDE session and KDE support is available |
|
894 + for Firefox. This should be used everywhere where the external helper is needed. */ |
|
895 + static bool kdeSupport(); |
|
896 + /* Executes the given helper command, returns true if helper returned success. */ |
|
897 + static bool command( const nsCStringArray& command, nsCStringArray* output = NULL ); |
|
898 + /* Like command(), but additionally blocks the parent widget like if there was |
|
899 + a modal dialog shown and enters the event loop (i.e. there are still paint updates, |
|
900 + this is for commands that take long). */ |
|
901 + static bool commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output = NULL ); |
|
902 + private: |
|
903 + nsKDEUtils(); |
|
904 + ~nsKDEUtils(); |
|
905 + static nsKDEUtils* self(); |
|
906 + bool startHelper(); |
|
907 + void closeHelper(); |
|
908 + void feedCommand( const nsCStringArray& command ); |
|
909 + bool internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool isParent, |
|
910 + nsCStringArray* output ); |
|
911 + FILE* commandFile; |
|
912 + FILE* replyFile; |
|
913 + }; |
|
914 + |
|
915 +#endif // nsKDEUtils |
|
916 --- mozilla/uriloader/exthandler/Makefile.in.sav 2009-09-14 10:00:21.000000000 +0200 |
|
917 +++ mozilla/uriloader/exthandler/Makefile.in 2009-09-14 10:04:15.000000000 +0200 |
|
918 @@ -109,8 +109,9 @@ endif |
|
919 LOCAL_INCLUDES = -I$(srcdir) |
|
920 |
|
921 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) |
|
922 -OSHELPER += nsGNOMERegistry.cpp |
|
923 +OSHELPER += nsCommonRegistry.cpp nsGNOMERegistry.cpp nsKDERegistry.cpp |
|
924 OSHELPER += nsMIMEInfoUnix.cpp |
|
925 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
|
926 endif |
|
927 |
|
928 ifeq ($(MOZ_WIDGET_TOOLKIT),qt) |
|
929 --- mozilla/uriloader/exthandler/unix/nsCommonRegistry.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
930 +++ mozilla/uriloader/exthandler/unix/nsCommonRegistry.cpp 2009-09-14 10:04:15.000000000 +0200 |
|
931 @@ -0,0 +1,87 @@ |
|
932 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
933 +/* ***** BEGIN LICENSE BLOCK ***** |
|
934 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|
935 + * |
|
936 + * The contents of this file are subject to the Mozilla Public License Version |
|
937 + * 1.1 (the "License"); you may not use this file except in compliance with |
|
938 + * the License. You may obtain a copy of the License at |
|
939 + * http://www.mozilla.org/MPL/ |
|
940 + * |
|
941 + * Software distributed under the License is distributed on an "AS IS" basis, |
|
942 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
943 + * for the specific language governing rights and limitations under the |
|
944 + * License. |
|
945 + * |
|
946 + * The Original Code is the GNOME helper app implementation. |
|
947 + * |
|
948 + * The Initial Developer of the Original Code is |
|
949 + * IBM Corporation. |
|
950 + * Portions created by the Initial Developer are Copyright (C) 2003 |
|
951 + * the Initial Developer. All Rights Reserved. |
|
952 + * |
|
953 + * Contributor(s): |
|
954 + * Brian Ryner <bryner@brianryner.com> (Original Author) |
|
955 + * |
|
956 + * Alternatively, the contents of this file may be used under the terms of |
|
957 + * either the GNU General Public License Version 2 or later (the "GPL"), or |
|
958 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
959 + * in which case the provisions of the GPL or the LGPL are applicable instead |
|
960 + * of those above. If you wish to allow use of your version of this file only |
|
961 + * under the terms of either the GPL or the LGPL, and not to allow others to |
|
962 + * use your version of this file under the terms of the MPL, indicate your |
|
963 + * decision by deleting the provisions above and replace them with the notice |
|
964 + * and other provisions required by the GPL or the LGPL. If you do not delete |
|
965 + * the provisions above, a recipient may use your version of this file under |
|
966 + * the terms of any one of the MPL, the GPL or the LGPL. |
|
967 + * |
|
968 + * ***** END LICENSE BLOCK ***** */ |
|
969 + |
|
970 +#include "nsCommonRegistry.h" |
|
971 + |
|
972 +#include "nsGNOMERegistry.h" |
|
973 +#include "nsKDERegistry.h" |
|
974 +#include "nsString.h" |
|
975 +#include "nsVoidArray.h" |
|
976 +#include "nsKDEUtils.h" |
|
977 + |
|
978 +/* static */ PRBool |
|
979 +nsCommonRegistry::HandlerExists(const char *aProtocolScheme) |
|
980 +{ |
|
981 + if( nsKDEUtils::kdeSupport()) |
|
982 + return nsKDERegistry::HandlerExists( aProtocolScheme ); |
|
983 + return nsGNOMERegistry::HandlerExists( aProtocolScheme ); |
|
984 +} |
|
985 + |
|
986 +/* static */ nsresult |
|
987 +nsCommonRegistry::LoadURL(nsIURI *aURL) |
|
988 +{ |
|
989 + if( nsKDEUtils::kdeSupport()) |
|
990 + return nsKDERegistry::LoadURL( aURL ); |
|
991 + return nsGNOMERegistry::LoadURL( aURL ); |
|
992 +} |
|
993 + |
|
994 +/* static */ void |
|
995 +nsCommonRegistry::GetAppDescForScheme(const nsACString& aScheme, |
|
996 + nsAString& aDesc) |
|
997 +{ |
|
998 + if( nsKDEUtils::kdeSupport()) |
|
999 + return nsKDERegistry::GetAppDescForScheme( aScheme, aDesc ); |
|
1000 + return nsGNOMERegistry::GetAppDescForScheme( aScheme, aDesc ); |
|
1001 +} |
|
1002 + |
|
1003 + |
|
1004 +/* static */ already_AddRefed<nsMIMEInfoBase> |
|
1005 +nsCommonRegistry::GetFromExtension(const nsACString& aFileExt) |
|
1006 +{ |
|
1007 + if( nsKDEUtils::kdeSupport()) |
|
1008 + return nsKDERegistry::GetFromExtension( aFileExt ); |
|
1009 + return nsGNOMERegistry::GetFromExtension( aFileExt ); |
|
1010 +} |
|
1011 + |
|
1012 +/* static */ already_AddRefed<nsMIMEInfoBase> |
|
1013 +nsCommonRegistry::GetFromType(const nsACString& aMIMEType) |
|
1014 +{ |
|
1015 + if( nsKDEUtils::kdeSupport()) |
|
1016 + return nsKDERegistry::GetFromType( aMIMEType ); |
|
1017 + return nsGNOMERegistry::GetFromType( aMIMEType ); |
|
1018 +} |
|
1019 --- mozilla/uriloader/exthandler/unix/nsCommonRegistry.h.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1020 +++ mozilla/uriloader/exthandler/unix/nsCommonRegistry.h 2009-09-14 10:04:15.000000000 +0200 |
|
1021 @@ -0,0 +1,56 @@ |
|
1022 +/* ***** BEGIN LICENSE BLOCK ***** |
|
1023 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|
1024 + * |
|
1025 + * The contents of this file are subject to the Mozilla Public License Version |
|
1026 + * 1.1 (the "License"); you may not use this file except in compliance with |
|
1027 + * the License. You may obtain a copy of the License at |
|
1028 + * http://www.mozilla.org/MPL/ |
|
1029 + * |
|
1030 + * Software distributed under the License is distributed on an "AS IS" basis, |
|
1031 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
1032 + * for the specific language governing rights and limitations under the |
|
1033 + * License. |
|
1034 + * |
|
1035 + * The Original Code is the GNOME helper app implementation. |
|
1036 + * |
|
1037 + * The Initial Developer of the Original Code is |
|
1038 + * IBM Corporation. |
|
1039 + * Portions created by the Initial Developer are Copyright (C) 2003 |
|
1040 + * the Initial Developer. All Rights Reserved. |
|
1041 + * |
|
1042 + * Contributor(s): |
|
1043 + * Brian Ryner <bryner@brianryner.com> (Original Author) |
|
1044 + * |
|
1045 + * Alternatively, the contents of this file may be used under the terms of |
|
1046 + * either the GNU General Public License Version 2 or later (the "GPL"), or |
|
1047 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
1048 + * in which case the provisions of the GPL or the LGPL are applicable instead |
|
1049 + * of those above. If you wish to allow use of your version of this file only |
|
1050 + * under the terms of either the GPL or the LGPL, and not to allow others to |
|
1051 + * use your version of this file under the terms of the MPL, indicate your |
|
1052 + * decision by deleting the provisions above and replace them with the notice |
|
1053 + * and other provisions required by the GPL or the LGPL. If you do not delete |
|
1054 + * the provisions above, a recipient may use your version of this file under |
|
1055 + * the terms of any one of the MPL, the GPL or the LGPL. |
|
1056 + * |
|
1057 + * ***** END LICENSE BLOCK ***** */ |
|
1058 + |
|
1059 +#include "nsIURI.h" |
|
1060 +#include "nsCOMPtr.h" |
|
1061 + |
|
1062 +class nsMIMEInfoBase; |
|
1063 + |
|
1064 +class nsCommonRegistry |
|
1065 +{ |
|
1066 + public: |
|
1067 + static PRBool HandlerExists(const char *aProtocolScheme); |
|
1068 + |
|
1069 + static nsresult LoadURL(nsIURI *aURL); |
|
1070 + |
|
1071 + static void GetAppDescForScheme(const nsACString& aScheme, |
|
1072 + nsAString& aDesc); |
|
1073 + |
|
1074 + static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsACString& aFileExt); |
|
1075 + |
|
1076 + static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType); |
|
1077 +}; |
|
1078 --- mozilla/uriloader/exthandler/unix/nsKDERegistry.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1079 +++ mozilla/uriloader/exthandler/unix/nsKDERegistry.cpp 2009-09-14 10:04:15.000000000 +0200 |
|
1080 @@ -0,0 +1,119 @@ |
|
1081 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
1082 +/* ***** BEGIN LICENSE BLOCK ***** |
|
1083 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|
1084 + * |
|
1085 + * The contents of this file are subject to the Mozilla Public License Version |
|
1086 + * 1.1 (the "License"); you may not use this file except in compliance with |
|
1087 + * the License. You may obtain a copy of the License at |
|
1088 + * http://www.mozilla.org/MPL/ |
|
1089 + * |
|
1090 + * Software distributed under the License is distributed on an "AS IS" basis, |
|
1091 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
1092 + * for the specific language governing rights and limitations under the |
|
1093 + * License. |
|
1094 + * |
|
1095 + * The Original Code is the GNOME helper app implementation. |
|
1096 + * |
|
1097 + * The Initial Developer of the Original Code is |
|
1098 + * IBM Corporation. |
|
1099 + * Portions created by the Initial Developer are Copyright (C) 2003 |
|
1100 + * the Initial Developer. All Rights Reserved. |
|
1101 + * |
|
1102 + * Contributor(s): |
|
1103 + * Brian Ryner <bryner@brianryner.com> (Original Author) |
|
1104 + * |
|
1105 + * Alternatively, the contents of this file may be used under the terms of |
|
1106 + * either the GNU General Public License Version 2 or later (the "GPL"), or |
|
1107 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
1108 + * in which case the provisions of the GPL or the LGPL are applicable instead |
|
1109 + * of those above. If you wish to allow use of your version of this file only |
|
1110 + * under the terms of either the GPL or the LGPL, and not to allow others to |
|
1111 + * use your version of this file under the terms of the MPL, indicate your |
|
1112 + * decision by deleting the provisions above and replace them with the notice |
|
1113 + * and other provisions required by the GPL or the LGPL. If you do not delete |
|
1114 + * the provisions above, a recipient may use your version of this file under |
|
1115 + * the terms of any one of the MPL, the GPL or the LGPL. |
|
1116 + * |
|
1117 + * ***** END LICENSE BLOCK ***** */ |
|
1118 + |
|
1119 +#include "nsKDERegistry.h" |
|
1120 +#include "prlink.h" |
|
1121 +#include "prmem.h" |
|
1122 +#include "nsString.h" |
|
1123 +#include "nsILocalFile.h" |
|
1124 +#include "nsMIMEInfoUnix.h" |
|
1125 +#include "nsAutoPtr.h" |
|
1126 +#include "nsKDEUtils.h" |
|
1127 + |
|
1128 +/* static */ PRBool |
|
1129 +nsKDERegistry::HandlerExists(const char *aProtocolScheme) |
|
1130 +{ |
|
1131 + nsCStringArray command; |
|
1132 + command.AppendCString( NS_LITERAL_CSTRING( "HANDLEREXISTS" )); |
|
1133 + command.AppendCString( nsCAutoString( aProtocolScheme )); |
|
1134 + return nsKDEUtils::command( command ); |
|
1135 +} |
|
1136 + |
|
1137 +/* static */ nsresult |
|
1138 +nsKDERegistry::LoadURL(nsIURI *aURL) |
|
1139 +{ |
|
1140 + nsCStringArray command; |
|
1141 + command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
|
1142 + nsCString url; |
|
1143 + aURL->GetSpec( url ); |
|
1144 + command.AppendCString( url ); |
|
1145 + return nsKDEUtils::command( command ); |
|
1146 +} |
|
1147 + |
|
1148 +/* static */ void |
|
1149 +nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme, |
|
1150 + nsAString& aDesc) |
|
1151 +{ |
|
1152 + nsCStringArray command; |
|
1153 + command.AppendCString( NS_LITERAL_CSTRING( "GETAPPDESCFORSCHEME" )); |
|
1154 + command.AppendCString( aScheme ); |
|
1155 + nsCStringArray output; |
|
1156 + if( nsKDEUtils::command( command, &output ) && output.Count() == 1 ) |
|
1157 + CopyUTF8toUTF16( *output[ 0 ], aDesc ); |
|
1158 +} |
|
1159 + |
|
1160 + |
|
1161 +/* static */ already_AddRefed<nsMIMEInfoBase> |
|
1162 +nsKDERegistry::GetFromExtension(const nsACString& aFileExt) |
|
1163 +{ |
|
1164 + NS_ASSERTION(aFileExt[0] != '.', "aFileExt shouldn't start with a dot"); |
|
1165 + nsCStringArray command; |
|
1166 + command.AppendCString( NS_LITERAL_CSTRING( "GETFROMEXTENSION" )); |
|
1167 + command.AppendCString( aFileExt ); |
|
1168 + return GetFromHelper( command ); |
|
1169 +} |
|
1170 + |
|
1171 +/* static */ already_AddRefed<nsMIMEInfoBase> |
|
1172 +nsKDERegistry::GetFromType(const nsACString& aMIMEType) |
|
1173 +{ |
|
1174 + nsCStringArray command; |
|
1175 + command.AppendCString( NS_LITERAL_CSTRING( "GETFROMTYPE" )); |
|
1176 + command.AppendCString( aMIMEType ); |
|
1177 + return GetFromHelper( command ); |
|
1178 +} |
|
1179 + |
|
1180 +/* static */ already_AddRefed<nsMIMEInfoBase> |
|
1181 +nsKDERegistry::GetFromHelper(const nsCStringArray& command) |
|
1182 +{ |
|
1183 + nsCStringArray output; |
|
1184 + if( nsKDEUtils::command( command, &output ) && output.Count() == 3 ) |
|
1185 + { |
|
1186 + nsCString mimetype = *output[ 0 ]; |
|
1187 + nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype ); |
|
1188 + NS_ENSURE_TRUE(mimeInfo, nsnull); |
|
1189 + nsCString description = *output[ 1 ]; |
|
1190 + mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); |
|
1191 + nsCString handlerAppName = *output[ 2 ]; |
|
1192 + mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); |
|
1193 + mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); |
|
1194 + nsMIMEInfoBase* retval; |
|
1195 + NS_ADDREF((retval = mimeInfo)); |
|
1196 + return retval; |
|
1197 + } |
|
1198 + return nsnull; |
|
1199 +} |
|
1200 --- mozilla/uriloader/exthandler/unix/nsKDERegistry.h.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1201 +++ mozilla/uriloader/exthandler/unix/nsKDERegistry.h 2009-09-14 10:04:15.000000000 +0200 |
|
1202 @@ -0,0 +1,61 @@ |
|
1203 +/* ***** BEGIN LICENSE BLOCK ***** |
|
1204 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|
1205 + * |
|
1206 + * The contents of this file are subject to the Mozilla Public License Version |
|
1207 + * 1.1 (the "License"); you may not use this file except in compliance with |
|
1208 + * the License. You may obtain a copy of the License at |
|
1209 + * http://www.mozilla.org/MPL/ |
|
1210 + * |
|
1211 + * Software distributed under the License is distributed on an "AS IS" basis, |
|
1212 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
1213 + * for the specific language governing rights and limitations under the |
|
1214 + * License. |
|
1215 + * |
|
1216 + * The Original Code is the GNOME helper app implementation. |
|
1217 + * |
|
1218 + * The Initial Developer of the Original Code is |
|
1219 + * IBM Corporation. |
|
1220 + * Portions created by the Initial Developer are Copyright (C) 2003 |
|
1221 + * the Initial Developer. All Rights Reserved. |
|
1222 + * |
|
1223 + * Contributor(s): |
|
1224 + * Brian Ryner <bryner@brianryner.com> (Original Author) |
|
1225 + * |
|
1226 + * Alternatively, the contents of this file may be used under the terms of |
|
1227 + * either the GNU General Public License Version 2 or later (the "GPL"), or |
|
1228 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
1229 + * in which case the provisions of the GPL or the LGPL are applicable instead |
|
1230 + * of those above. If you wish to allow use of your version of this file only |
|
1231 + * under the terms of either the GPL or the LGPL, and not to allow others to |
|
1232 + * use your version of this file under the terms of the MPL, indicate your |
|
1233 + * decision by deleting the provisions above and replace them with the notice |
|
1234 + * and other provisions required by the GPL or the LGPL. If you do not delete |
|
1235 + * the provisions above, a recipient may use your version of this file under |
|
1236 + * the terms of any one of the MPL, the GPL or the LGPL. |
|
1237 + * |
|
1238 + * ***** END LICENSE BLOCK ***** */ |
|
1239 + |
|
1240 +#include "nsIURI.h" |
|
1241 +#include "nsCOMPtr.h" |
|
1242 + |
|
1243 +class nsMIMEInfoBase; |
|
1244 +class nsCAutoString; |
|
1245 +class nsCStringArray; |
|
1246 + |
|
1247 +class nsKDERegistry |
|
1248 +{ |
|
1249 + public: |
|
1250 + static PRBool HandlerExists(const char *aProtocolScheme); |
|
1251 + |
|
1252 + static nsresult LoadURL(nsIURI *aURL); |
|
1253 + |
|
1254 + static void GetAppDescForScheme(const nsACString& aScheme, |
|
1255 + nsAString& aDesc); |
|
1256 + |
|
1257 + static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsACString& aFileExt); |
|
1258 + |
|
1259 + static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType); |
|
1260 + private: |
|
1261 + static already_AddRefed<nsMIMEInfoBase> GetFromHelper(const nsCStringArray& command); |
|
1262 + |
|
1263 +}; |
|
1264 --- mozilla/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp.sav 2009-09-14 10:02:42.000000000 +0200 |
|
1265 +++ mozilla/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp 2009-09-14 10:07:10.000000000 +0200 |
|
1266 @@ -44,18 +44,19 @@ |
|
1267 |
|
1268 |
|
1269 #include "nsMIMEInfoUnix.h" |
|
1270 -#include "nsGNOMERegistry.h" |
|
1271 +#include "nsCommonRegistry.h" |
|
1272 #include "nsIGnomeVFSService.h" |
|
1273 #include "nsAutoPtr.h" |
|
1274 #ifdef MOZ_ENABLE_DBUS |
|
1275 #include "nsDBusHandlerApp.h" |
|
1276 #endif |
|
1277 +#include "nsKDEUtils.h" |
|
1278 |
|
1279 |
|
1280 nsresult |
|
1281 nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI) |
|
1282 { |
|
1283 - nsresult rv = nsGNOMERegistry::LoadURL(aURI); |
|
1284 + nsresult rv = nsCommonRegistry::LoadURL(aURI); |
|
1285 #ifdef MOZ_PLATFORM_HILDON |
|
1286 if (NS_FAILED(rv)){ |
|
1287 HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull); |
|
1288 @@ -75,11 +76,11 @@ NS_IMETHODIMP |
|
1289 nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval) |
|
1290 { |
|
1291 *_retval = PR_FALSE; |
|
1292 - nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mType); |
|
1293 + nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mType); |
|
1294 if (!mimeInfo) { |
|
1295 nsCAutoString ext; |
|
1296 GetPrimaryExtension(ext); |
|
1297 - mimeInfo = nsGNOMERegistry::GetFromExtension(ext); |
|
1298 + mimeInfo = nsCommonRegistry::GetFromExtension(ext); |
|
1299 } |
|
1300 |
|
1301 if (mimeInfo) |
|
1302 @@ -106,6 +107,19 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns |
|
1303 { |
|
1304 nsCAutoString nativePath; |
|
1305 aFile->GetNativePath(nativePath); |
|
1306 + |
|
1307 + if( nsKDEUtils::kdeSupport()) |
|
1308 + { |
|
1309 + nsCStringArray command; |
|
1310 + command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
|
1311 + command.AppendCString( nativePath ); |
|
1312 + if( nsKDEUtils::command( command )) |
|
1313 + return NS_OK; |
|
1314 + if (!mDefaultApplication) |
|
1315 + return NS_ERROR_FILE_NOT_FOUND; |
|
1316 + |
|
1317 + return LaunchWithIProcess(mDefaultApplication, nativePath); |
|
1318 + } |
|
1319 |
|
1320 nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
|
1321 |
|
1322 @@ -116,7 +130,7 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns |
|
1323 |
|
1324 // If we haven't got an app we try to get a valid one by searching for the |
|
1325 // extension mapped type |
|
1326 - nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath); |
|
1327 + nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath); |
|
1328 if (mimeInfo) { |
|
1329 nsCAutoString type; |
|
1330 mimeInfo->GetType(type); |
|
1331 --- mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp.sav 2009-09-14 10:02:42.000000000 +0200 |
|
1332 +++ mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp 2009-09-14 10:04:15.000000000 +0200 |
|
1333 @@ -44,7 +44,7 @@ |
|
1334 #include "nsOSHelperAppService.h" |
|
1335 #include "nsMIMEInfoUnix.h" |
|
1336 #ifdef MOZ_WIDGET_GTK2 |
|
1337 -#include "nsGNOMERegistry.h" |
|
1338 +#include "nsCommonRegistry.h" |
|
1339 #endif |
|
1340 #include "nsISupports.h" |
|
1341 #include "nsString.h" |
|
1342 @@ -1210,7 +1210,7 @@ nsresult nsOSHelperAppService::OSProtoco |
|
1343 |
|
1344 #ifdef MOZ_WIDGET_GTK2 |
|
1345 // Check the GConf registry for a protocol handler |
|
1346 - *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme); |
|
1347 + *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme); |
|
1348 #endif |
|
1349 |
|
1350 return NS_OK; |
|
1351 @@ -1219,7 +1219,7 @@ nsresult nsOSHelperAppService::OSProtoco |
|
1352 NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval) |
|
1353 { |
|
1354 #ifdef MOZ_WIDGET_GTK2 |
|
1355 - nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval); |
|
1356 + nsCommonRegistry::GetAppDescForScheme(aScheme, _retval); |
|
1357 return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK; |
|
1358 #else |
|
1359 return NS_ERROR_NOT_AVAILABLE; |
|
1360 @@ -1315,7 +1315,7 @@ nsOSHelperAppService::GetFromExtension(c |
|
1361 |
|
1362 #ifdef MOZ_WIDGET_GTK2 |
|
1363 LOG(("Looking in GNOME registry\n")); |
|
1364 - nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromExtension(aFileExt).get(); |
|
1365 + nsMIMEInfoBase *gnomeInfo = nsCommonRegistry::GetFromExtension(aFileExt).get(); |
|
1366 if (gnomeInfo) { |
|
1367 LOG(("Got MIMEInfo from GNOME registry\n")); |
|
1368 return gnomeInfo; |
|
1369 @@ -1441,7 +1441,7 @@ nsOSHelperAppService::GetFromType(const |
|
1370 // get back a MIMEInfo without any extensions set. In that case we'll have |
|
1371 // to look in our mime.types files for the extensions. |
|
1372 LOG(("Looking in GNOME registry\n")); |
|
1373 - gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType).get(); |
|
1374 + gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType).get(); |
|
1375 if (gnomeInfo && gnomeInfo->HasExtensions()) { |
|
1376 LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n")); |
|
1377 return gnomeInfo; |
|
1378 --- mozilla/widget/src/gtk2/Makefile.in.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1379 +++ mozilla/widget/src/gtk2/Makefile.in 2009-09-14 10:04:15.000000000 +0200 |
|
1380 @@ -182,6 +182,8 @@ INCLUDES += \ |
|
1381 -I$(topsrcdir)/other-licenses/atk-1.0 \ |
|
1382 $(NULL) |
|
1383 |
|
1384 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
|
1385 + |
|
1386 test_container: mozdrawingarea.o mozcontainer.o test_container.c |
|
1387 $(CC) $(MOZ_GTK2_CFLAGS) -o test_container test_container.c \ |
|
1388 mozdrawingarea.o mozcontainer.o \ |
|
1389 --- mozilla/widget/src/gtk2/nsFilePicker.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1390 +++ mozilla/widget/src/gtk2/nsFilePicker.cpp 2009-09-14 10:04:15.000000000 +0200 |
|
1391 @@ -40,6 +40,7 @@ |
|
1392 #include <gtk/gtkstock.h> |
|
1393 #include <gtk/gtkmessagedialog.h> |
|
1394 #include <gtk/gtkimage.h> |
|
1395 +#include <gdk/gdkx.h> |
|
1396 |
|
1397 #include "nsIFileURL.h" |
|
1398 #include "nsIURI.h" |
|
1399 @@ -59,6 +60,7 @@ |
|
1400 |
|
1401 #include "nsFilePicker.h" |
|
1402 #include "nsAccessibilityHelper.h" |
|
1403 +#include "nsKDEUtils.h" |
|
1404 |
|
1405 #define DECL_FUNC_PTR(func) static _##func##_fn _##func |
|
1406 #define GTK_FILE_CHOOSER(widget) ((GtkFileChooser*) widget) |
|
1407 @@ -95,6 +97,7 @@ typedef GtkWidget* (*_gtk_file_chooser_d |
|
1408 GtkFileChooserAction action, |
|
1409 const gchar *first_button_text, |
|
1410 ...); |
|
1411 +typedef void (*_gtk_dialog_set_alternative_button_order_fn)(GtkDialog *dialog, gint first_response_id, ...); |
|
1412 typedef void (*_gtk_file_chooser_set_select_multiple_fn)(GtkFileChooser* chooser, gboolean truth); |
|
1413 typedef void (*_gtk_file_chooser_set_do_overwrite_confirmation_fn)(GtkFileChooser* chooser, gboolean do_confirm); |
|
1414 typedef void (*_gtk_file_chooser_set_current_name_fn)(GtkFileChooser* chooser, const gchar* name); |
|
1415 @@ -119,6 +122,7 @@ DECL_FUNC_PTR(gtk_file_chooser_get_filen |
|
1416 DECL_FUNC_PTR(gtk_file_chooser_get_uri); |
|
1417 DECL_FUNC_PTR(gtk_file_chooser_get_uris); |
|
1418 DECL_FUNC_PTR(gtk_file_chooser_dialog_new); |
|
1419 +DECL_FUNC_PTR(gtk_dialog_set_alternative_button_order); |
|
1420 DECL_FUNC_PTR(gtk_file_chooser_set_select_multiple); |
|
1421 DECL_FUNC_PTR(gtk_file_chooser_set_do_overwrite_confirmation); |
|
1422 DECL_FUNC_PTR(gtk_file_chooser_set_current_name); |
|
1423 @@ -214,6 +218,7 @@ nsFilePicker::LoadSymbolsGTK24() |
|
1424 GET_LIBGTK_FUNC(gtk_file_chooser_get_uri); |
|
1425 GET_LIBGTK_FUNC(gtk_file_chooser_get_uris); |
|
1426 GET_LIBGTK_FUNC(gtk_file_chooser_dialog_new); |
|
1427 + GET_LIBGTK_FUNC(gtk_dialog_set_alternative_button_order); |
|
1428 GET_LIBGTK_FUNC(gtk_file_chooser_set_select_multiple); |
|
1429 GET_LIBGTK_FUNC_OPT(gtk_file_chooser_set_do_overwrite_confirmation); |
|
1430 GET_LIBGTK_FUNC(gtk_file_chooser_set_current_name); |
|
1431 @@ -442,7 +447,8 @@ nsFilePicker::AppendFilter(const nsAStri |
|
1432 { |
|
1433 if (aFilter.EqualsLiteral("..apps")) { |
|
1434 // No platform specific thing we can do here, really.... |
|
1435 - return NS_OK; |
|
1436 + if( mMode != modeOpen || !nsKDEUtils::kdeSupport()) |
|
1437 + return NS_OK; |
|
1438 } |
|
1439 |
|
1440 nsCAutoString filter, name; |
|
1441 @@ -590,6 +596,9 @@ confirm_overwrite_file (GtkWidget *paren |
|
1442 NS_IMETHODIMP |
|
1443 nsFilePicker::Show(PRInt16 *aReturn) |
|
1444 { |
|
1445 + if( nsKDEUtils::kdeSupport()) |
|
1446 + return kdeFileDialog( aReturn ); |
|
1447 + |
|
1448 NS_ENSURE_ARG_POINTER(aReturn); |
|
1449 |
|
1450 nsXPIDLCString title; |
|
1451 @@ -605,6 +614,12 @@ nsFilePicker::Show(PRInt16 *aReturn) |
|
1452 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
|
1453 accept_button, GTK_RESPONSE_ACCEPT, |
|
1454 NULL); |
|
1455 + |
|
1456 + _gtk_dialog_set_alternative_button_order(GTK_DIALOG(file_chooser), |
|
1457 + GTK_RESPONSE_ACCEPT, |
|
1458 + GTK_RESPONSE_CANCEL, |
|
1459 + -1); |
|
1460 + |
|
1461 if (mAllowURLs) { |
|
1462 _gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(file_chooser), FALSE); |
|
1463 } |
|
1464 @@ -727,3 +742,221 @@ nsFilePicker::Show(PRInt16 *aReturn) |
|
1465 |
|
1466 return NS_OK; |
|
1467 } |
|
1468 + |
|
1469 +nsCString nsFilePicker::kdeMakeFilter( int index ) |
|
1470 + { |
|
1471 + nsCString buf = *mFilters[ index ]; |
|
1472 + for( PRUint32 i = 0; |
|
1473 + i < buf.Length(); |
|
1474 + ++i ) |
|
1475 + if( buf[ i ] == ';' ) // KDE separates just using spaces |
|
1476 + buf.SetCharAt( ' ', i ); |
|
1477 + if (!mFilterNames[index]->IsEmpty()) |
|
1478 + { |
|
1479 + buf += "|"; |
|
1480 + buf += mFilterNames[index]->get(); |
|
1481 + } |
|
1482 + return buf; |
|
1483 + } |
|
1484 + |
|
1485 +static PRInt32 windowToXid( nsIWidget* widget ) |
|
1486 + { |
|
1487 + GtkWindow *parent_widget = get_gtk_window_for_nsiwidget( widget ); |
|
1488 + GdkWindow* gdk_window = gtk_widget_get_window( gtk_widget_get_toplevel( GTK_WIDGET( parent_widget ))); |
|
1489 + return GDK_WINDOW_XID( gdk_window ); |
|
1490 + } |
|
1491 + |
|
1492 +NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn) |
|
1493 + { |
|
1494 + NS_ENSURE_ARG_POINTER(aReturn); |
|
1495 + |
|
1496 + if( mMode == modeOpen && mFilters.Count() == 1 && mFilters[ 0 ]->EqualsLiteral( "..apps" )) |
|
1497 + return kdeAppsDialog( aReturn ); |
|
1498 + |
|
1499 + nsXPIDLCString title; |
|
1500 + title.Adopt(ToNewUTF8String(mTitle)); |
|
1501 + |
|
1502 + const char* arg = NULL; |
|
1503 + if( mAllowURLs ) |
|
1504 + { |
|
1505 + switch( mMode ) |
|
1506 + { |
|
1507 + case nsIFilePicker::modeOpen: |
|
1508 + case nsIFilePicker::modeOpenMultiple: |
|
1509 + arg = "GETOPENURL"; |
|
1510 + break; |
|
1511 + case nsIFilePicker::modeSave: |
|
1512 + arg = "GETSAVEURL"; |
|
1513 + break; |
|
1514 + case nsIFilePicker::modeGetFolder: |
|
1515 + arg = "GETDIRECTORYURL"; |
|
1516 + break; |
|
1517 + } |
|
1518 + } |
|
1519 + else |
|
1520 + { |
|
1521 + switch( mMode ) |
|
1522 + { |
|
1523 + case nsIFilePicker::modeOpen: |
|
1524 + case nsIFilePicker::modeOpenMultiple: |
|
1525 + arg = "GETOPENFILENAME"; |
|
1526 + break; |
|
1527 + case nsIFilePicker::modeSave: |
|
1528 + arg = "GETSAVEFILENAME"; |
|
1529 + break; |
|
1530 + case nsIFilePicker::modeGetFolder: |
|
1531 + arg = "GETDIRECTORYFILENAME"; |
|
1532 + break; |
|
1533 + } |
|
1534 + } |
|
1535 + |
|
1536 + nsCAutoString directory; |
|
1537 + if (mDisplayDirectory) { |
|
1538 + mDisplayDirectory->GetNativePath(directory); |
|
1539 + } else if (mPrevDisplayDirectory) { |
|
1540 + mPrevDisplayDirectory->GetNativePath(directory); |
|
1541 + } |
|
1542 + |
|
1543 + nsCAutoString startdir; |
|
1544 + if (!directory.IsEmpty()) { |
|
1545 + startdir = directory; |
|
1546 + } |
|
1547 + if (mMode == nsIFilePicker::modeSave) { |
|
1548 + if( !startdir.IsEmpty()) |
|
1549 + { |
|
1550 + startdir += "/"; |
|
1551 + startdir += ToNewUTF8String(mDefault); |
|
1552 + } |
|
1553 + else |
|
1554 + startdir = ToNewUTF8String(mDefault); |
|
1555 + } |
|
1556 + if( startdir.IsEmpty()) |
|
1557 + startdir = "."; |
|
1558 + |
|
1559 + nsCAutoString filters; |
|
1560 + PRInt32 count = mFilters.Count(); |
|
1561 + if( count == 0 ) //just in case |
|
1562 + filters = "*"; |
|
1563 + else |
|
1564 + { |
|
1565 + filters = kdeMakeFilter( 0 ); |
|
1566 + for (PRInt32 i = 1; i < count; ++i) |
|
1567 + { |
|
1568 + filters += "\n"; |
|
1569 + filters += kdeMakeFilter( i ); |
|
1570 + } |
|
1571 + } |
|
1572 + |
|
1573 + nsCStringArray command; |
|
1574 + command.AppendCString( nsCAutoString( arg )); |
|
1575 + command.AppendCString( startdir ); |
|
1576 + if( mMode != nsIFilePicker::modeGetFolder ) |
|
1577 + { |
|
1578 + command.AppendCString( filters ); |
|
1579 + nsCAutoString selected; |
|
1580 + selected.AppendInt( mSelectedType ); |
|
1581 + command.AppendCString( selected ); |
|
1582 + } |
|
1583 + command.AppendCString( title ); |
|
1584 + if( mMode == nsIFilePicker::modeOpenMultiple ) |
|
1585 + command.AppendCString( NS_LITERAL_CSTRING( "MULTIPLE" )); |
|
1586 + if( PRInt32 xid = windowToXid( mParentWidget )) |
|
1587 + { |
|
1588 + command.AppendCString( NS_LITERAL_CSTRING( "PARENT" )); |
|
1589 + nsCAutoString parent; |
|
1590 + parent.AppendInt( xid ); |
|
1591 + command.AppendCString( parent ); |
|
1592 + } |
|
1593 + |
|
1594 + nsCStringArray output; |
|
1595 + if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
|
1596 + { |
|
1597 + *aReturn = nsIFilePicker::returnOK; |
|
1598 + mFiles.Clear(); |
|
1599 + if( mMode != nsIFilePicker::modeGetFolder ) |
|
1600 + { |
|
1601 + mSelectedType = atoi( output[ 0 ]->get()); |
|
1602 + output.RemoveCStringAt( 0 ); |
|
1603 + } |
|
1604 + if (mMode == nsIFilePicker::modeOpenMultiple) |
|
1605 + { |
|
1606 + mFileURL.Truncate(); |
|
1607 + PRUint32 count = output.Count(); |
|
1608 + for( PRUint32 i = 0; |
|
1609 + i < count; |
|
1610 + ++i ) |
|
1611 + { |
|
1612 + nsCOMPtr<nsILocalFile> localfile; |
|
1613 + nsresult rv = NS_NewNativeLocalFile( *output[ i ], |
|
1614 + PR_FALSE, |
|
1615 + getter_AddRefs(localfile)); |
|
1616 + if (NS_SUCCEEDED(rv)) |
|
1617 + mFiles.AppendObject(localfile); |
|
1618 + } |
|
1619 + } |
|
1620 + else |
|
1621 + { |
|
1622 + mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString(); |
|
1623 + } |
|
1624 + // Remember last used directory. |
|
1625 + nsCOMPtr<nsILocalFile> file; |
|
1626 + GetFile(getter_AddRefs(file)); |
|
1627 + if (file) { |
|
1628 + nsCOMPtr<nsIFile> dir; |
|
1629 + file->GetParent(getter_AddRefs(dir)); |
|
1630 + nsCOMPtr<nsILocalFile> localDir(do_QueryInterface(dir)); |
|
1631 + if (localDir) { |
|
1632 + localDir.swap(mPrevDisplayDirectory); |
|
1633 + } |
|
1634 + } |
|
1635 + if (mMode == nsIFilePicker::modeSave) |
|
1636 + { |
|
1637 + nsCOMPtr<nsILocalFile> file; |
|
1638 + GetFile(getter_AddRefs(file)); |
|
1639 + if (file) |
|
1640 + { |
|
1641 + PRBool exists = PR_FALSE; |
|
1642 + file->Exists(&exists); |
|
1643 + if (exists) // TODO do overwrite check in the helper app |
|
1644 + *aReturn = nsIFilePicker::returnReplace; |
|
1645 + } |
|
1646 + } |
|
1647 + } |
|
1648 + else |
|
1649 + { |
|
1650 + *aReturn = nsIFilePicker::returnCancel; |
|
1651 + } |
|
1652 + return NS_OK; |
|
1653 + } |
|
1654 + |
|
1655 + |
|
1656 +NS_IMETHODIMP nsFilePicker::kdeAppsDialog(PRInt16 *aReturn) |
|
1657 + { |
|
1658 + NS_ENSURE_ARG_POINTER(aReturn); |
|
1659 + |
|
1660 + nsXPIDLCString title; |
|
1661 + title.Adopt(ToNewUTF8String(mTitle)); |
|
1662 + |
|
1663 + nsCStringArray command; |
|
1664 + command.AppendCString( NS_LITERAL_CSTRING( "APPSDIALOG" )); |
|
1665 + command.AppendCString( title ); |
|
1666 + if( PRInt32 xid = windowToXid( mParentWidget )) |
|
1667 + { |
|
1668 + command.AppendCString( NS_LITERAL_CSTRING( "PARENT" )); |
|
1669 + nsCAutoString parent; |
|
1670 + parent.AppendInt( xid ); |
|
1671 + command.AppendCString( parent ); |
|
1672 + } |
|
1673 + |
|
1674 + nsCStringArray output; |
|
1675 + if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
|
1676 + { |
|
1677 + *aReturn = nsIFilePicker::returnOK; |
|
1678 + mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString(); |
|
1679 + } |
|
1680 + else |
|
1681 + { |
|
1682 + *aReturn = nsIFilePicker::returnCancel; |
|
1683 + } |
|
1684 + return NS_OK; |
|
1685 + } |
|
1686 --- mozilla/widget/src/gtk2/nsFilePicker.h.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1687 +++ mozilla/widget/src/gtk2/nsFilePicker.h 2009-09-14 10:04:15.000000000 +0200 |
|
1688 @@ -98,6 +98,12 @@ protected: |
|
1689 private: |
|
1690 static nsILocalFile *mPrevDisplayDirectory; |
|
1691 static PRLibrary *mGTK24; |
|
1692 + |
|
1693 + bool kdeRunning(); |
|
1694 + bool getKdeRunning(); |
|
1695 + NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn); |
|
1696 + NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn); |
|
1697 + nsCString kdeMakeFilter( int index ); |
|
1698 }; |
|
1699 |
|
1700 #endif |
|
1701 --- mozilla/widget/src/gtk2/nsPrintDialogGTK.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1702 +++ mozilla/widget/src/gtk2/nsPrintDialogGTK.cpp 2009-09-14 10:04:15.000000000 +0200 |
|
1703 @@ -145,6 +145,10 @@ ShowCustomDialog(GtkComboBox *changed_bo |
|
1704 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, |
|
1705 NULL); |
|
1706 gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog), GTK_RESPONSE_ACCEPT); |
|
1707 + gtk_dialog_set_alternative_button_order(GTK_DIALOG(prompt_dialog), |
|
1708 + GTK_RESPONSE_ACCEPT, |
|
1709 + GTK_RESPONSE_REJECT, |
|
1710 + -1); |
|
1711 |
|
1712 printBundle->GetStringFromName(NS_LITERAL_STRING("customHeaderFooterPrompt").get(), getter_Copies(intlString)); |
|
1713 GtkWidget* custom_label = gtk_label_new(NS_ConvertUTF16toUTF8(intlString).get()); |
|
1714 --- mozilla/xpcom/io/Makefile.in.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1715 +++ mozilla/xpcom/io/Makefile.in 2009-09-14 10:04:15.000000000 +0200 |
|
1716 @@ -199,3 +199,4 @@ endif |
|
1717 endif |
|
1718 |
|
1719 LOCAL_INCLUDES = -I.. |
|
1720 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
|
1721 --- mozilla/xpcom/io/nsLocalFileUnix.cpp.sav 2009-09-14 10:00:21.000000000 +0200 |
|
1722 +++ mozilla/xpcom/io/nsLocalFileUnix.cpp 2009-09-14 10:04:15.000000000 +0200 |
|
1723 @@ -84,6 +84,7 @@ |
|
1724 |
|
1725 #ifdef MOZ_WIDGET_GTK2 |
|
1726 #include "nsIGnomeVFSService.h" |
|
1727 +#include "nsKDEUtils.h" |
|
1728 #endif |
|
1729 |
|
1730 #include "nsNativeCharsetUtils.h" |
|
1731 @@ -1666,16 +1667,13 @@ NS_IMETHODIMP |
|
1732 nsLocalFile::Reveal() |
|
1733 { |
|
1734 #ifdef MOZ_WIDGET_GTK2 |
|
1735 - nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
|
1736 - if (!vfs) |
|
1737 - return NS_ERROR_FAILURE; |
|
1738 - |
|
1739 + nsCAutoString url; |
|
1740 PRBool isDirectory; |
|
1741 if (NS_FAILED(IsDirectory(&isDirectory))) |
|
1742 return NS_ERROR_FAILURE; |
|
1743 |
|
1744 if (isDirectory) { |
|
1745 - return vfs->ShowURIForInput(mPath); |
|
1746 + url = mPath; |
|
1747 } else { |
|
1748 nsCOMPtr<nsIFile> parentDir; |
|
1749 nsCAutoString dirPath; |
|
1750 @@ -1684,8 +1682,21 @@ nsLocalFile::Reveal() |
|
1751 if (NS_FAILED(parentDir->GetNativePath(dirPath))) |
|
1752 return NS_ERROR_FAILURE; |
|
1753 |
|
1754 - return vfs->ShowURIForInput(dirPath); |
|
1755 + url = dirPath; |
|
1756 } |
|
1757 + |
|
1758 + if( nsKDEUtils::kdeSupport()) { |
|
1759 + nsCStringArray command; |
|
1760 + command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
|
1761 + command.AppendCString( url ); |
|
1762 + return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
|
1763 + } |
|
1764 + |
|
1765 + nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
|
1766 + if (!vfs) |
|
1767 + return NS_ERROR_FAILURE; |
|
1768 + return vfs->ShowURIForInput(url); |
|
1769 + |
|
1770 #else |
|
1771 return NS_ERROR_FAILURE; |
|
1772 #endif |
|
1773 @@ -1695,6 +1706,13 @@ NS_IMETHODIMP |
|
1774 nsLocalFile::Launch() |
|
1775 { |
|
1776 #ifdef MOZ_WIDGET_GTK2 |
|
1777 + if( nsKDEUtils::kdeSupport()) { |
|
1778 + nsCStringArray command; |
|
1779 + command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
|
1780 + command.AppendCString( mPath ); |
|
1781 + return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
|
1782 + } |
|
1783 + |
|
1784 nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
|
1785 if (!vfs) |
|
1786 return NS_ERROR_FAILURE; |
|
1787 |
|