changeset 1113 | 8e9195853a32 |
parent 1112 | 8a4f5aea2475 |
child 1119 | 4c5d44d40a03 |
1088:84cdfb476431 | 1113:8e9195853a32 |
---|---|
1 # HG changeset patch |
1 # HG changeset patch |
2 # Parent ff3da33eabc1d8760ec41a87afbaf44ded300ede |
2 # User msirringhaus@suse.de |
3 # Date 1559294891 -7200 |
|
4 # Fri May 31 11:28:11 2019 +0200 |
|
5 # Node ID c2aa7198fb925e7fde96abf65b6f68b9b755f112 |
|
6 # Parent 86d7ace0b36abf542e56fbb702a5f9b308b9bf77 |
|
3 Description: Add KDE integration to Firefox (toolkit parts) |
7 Description: Add KDE integration to Firefox (toolkit parts) |
4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org> |
8 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org> |
5 Author: Lubos Lunak <lunak@suse.com> |
9 Author: Lubos Lunak <lunak@suse.com> |
6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 |
10 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 |
7 https://bugzilla.novell.com/show_bug.cgi?id=170055 |
11 https://bugzilla.novell.com/show_bug.cgi?id=170055 |
8 |
12 |
9 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp |
13 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp |
10 --- a/modules/libpref/Preferences.cpp |
14 --- a/modules/libpref/Preferences.cpp |
11 +++ b/modules/libpref/Preferences.cpp |
15 +++ b/modules/libpref/Preferences.cpp |
12 @@ -81,16 +81,17 @@ |
16 @@ -88,16 +88,17 @@ |
13 #include "nsXPCOMCID.h" |
|
14 #include "nsXPCOM.h" |
17 #include "nsXPCOM.h" |
15 #include "nsXULAppAPI.h" |
18 #include "nsXULAppAPI.h" |
16 #include "nsZipArchive.h" |
19 #include "nsZipArchive.h" |
17 #include "plbase64.h" |
20 #include "plbase64.h" |
18 #include "PLDHashTable.h" |
21 #include "PLDHashTable.h" |
19 #include "plstr.h" |
22 #include "plstr.h" |
20 #include "prlink.h" |
23 #include "prlink.h" |
24 #include "xpcpublic.h" |
|
21 +#include "nsKDEUtils.h" |
25 +#include "nsKDEUtils.h" |
22 |
26 |
27 #ifdef DEBUG |
|
28 # include <map> |
|
29 #endif |
|
30 |
|
23 #ifdef MOZ_MEMORY |
31 #ifdef MOZ_MEMORY |
24 #include "mozmemory.h" |
32 # include "mozmemory.h" |
25 #endif |
33 #endif |
26 |
34 @@ -4542,25 +4543,37 @@ nsresult Preferences::InitInitialObjects |
27 #ifdef XP_WIN |
|
28 #include "windows.h" |
|
29 #endif |
|
30 @@ -4466,25 +4467,37 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co |
|
31 // application pref files for backwards compatibility. |
35 // application pref files for backwards compatibility. |
32 static const char* specialFiles[] = { |
36 static const char* specialFiles[] = { |
33 #if defined(XP_MACOSX) |
37 #if defined(XP_MACOSX) |
34 "macprefs.js" |
38 "macprefs.js" |
35 #elif defined(XP_WIN) |
39 #elif defined(XP_WIN) |
36 "winpref.js" |
40 "winpref.js" |
37 #elif defined(XP_UNIX) |
41 #elif defined(XP_UNIX) |
38 "unix.js" |
42 "unix.js" |
39 + , "" // placeholder for KDE (empty is otherwise harmless) |
43 + , "" // placeholder for KDE (empty is otherwise harmless) |
40 #if defined(_AIX) |
44 # if defined(_AIX) |
41 , |
45 , |
42 "aix.js" |
46 "aix.js" |
43 #endif |
47 # endif |
44 #elif defined(XP_BEOS) |
48 #elif defined(XP_BEOS) |
45 "beos.js" |
49 "beos.js" |
46 #endif |
50 #endif |
47 }; |
51 }; |
48 |
52 |
63 NS_WARNING("Error parsing application default preferences."); |
67 NS_WARNING("Error parsing application default preferences."); |
64 } |
68 } |
65 |
69 |
66 // Load jar:$app/omni.jar!/defaults/preferences/*.js |
70 // Load jar:$app/omni.jar!/defaults/preferences/*.js |
67 // or jar:$gre/omni.jar!/defaults/preferences/*.js. |
71 // or jar:$gre/omni.jar!/defaults/preferences/*.js. |
68 @@ -4532,17 +4545,17 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co |
72 @@ -4606,17 +4619,17 @@ nsresult Preferences::InitInitialObjects |
69 } |
73 } |
70 |
74 |
71 nsCOMPtr<nsIFile> path = do_QueryInterface(elem); |
75 nsCOMPtr<nsIFile> path = do_QueryInterface(elem); |
72 if (!path) { |
76 if (!path) { |
73 continue; |
77 continue; |
85 |
89 |
86 NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, nullptr, |
90 NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, nullptr, |
87 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build |
91 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build |
88 --- a/modules/libpref/moz.build |
92 --- a/modules/libpref/moz.build |
89 +++ b/modules/libpref/moz.build |
93 +++ b/modules/libpref/moz.build |
90 @@ -31,16 +31,20 @@ EXPORTS.mozilla += [ |
94 @@ -110,16 +110,20 @@ EXPORTS.mozilla += [ |
91 'StaticPrefs.h', |
|
92 ] |
95 ] |
96 EXPORTS.mozilla += sorted(['!' + g for g in gen_h]) |
|
93 |
97 |
94 UNIFIED_SOURCES += [ |
98 UNIFIED_SOURCES += [ |
95 'Preferences.cpp', |
99 'Preferences.cpp', |
96 'SharedPrefMap.cpp', |
100 'SharedPrefMap.cpp', |
97 ] |
101 ] |
98 |
102 |
99 +LOCAL_INCLUDES += [ |
103 +LOCAL_INCLUDES += [ |
100 + '/toolkit/xre' |
104 + '/toolkit/xre' |
101 +] |
105 +] |
102 + |
106 + |
103 include('/ipc/chromium/chromium-config.mozbuild') |
107 gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs) |
104 |
108 |
105 FINAL_LIBRARY = 'xul' |
109 GENERATED_FILES += [gen_all_tuple] |
106 |
110 |
107 DEFINES['OS_ARCH'] = CONFIG['OS_ARCH'] |
111 static_pref_list = GENERATED_FILES[gen_all_tuple] |
108 DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT'] |
112 static_pref_list.script = 'init/generate_static_pref_list.py:emit_code' |
109 if CONFIG['MOZ_ENABLE_WEBRENDER']: |
113 static_pref_list.inputs = ['init/StaticPrefList.yaml'] |
110 DEFINES['MOZ_ENABLE_WEBRENDER'] = True |
114 |
111 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py |
115 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py |
112 --- a/python/mozbuild/mozpack/chrome/flags.py |
116 --- a/python/mozbuild/mozpack/chrome/flags.py |
113 +++ b/python/mozbuild/mozpack/chrome/flags.py |
117 +++ b/python/mozbuild/mozpack/chrome/flags.py |
114 @@ -220,16 +220,17 @@ class Flags(OrderedDict): |
118 @@ -227,16 +227,17 @@ class Flags(OrderedDict): |
115 'contentaccessible': Flag, |
119 'contentaccessible': Flag, |
116 'os': StringFlag, |
120 'os': StringFlag, |
117 'osversion': VersionFlag, |
121 'osversion': VersionFlag, |
118 'abi': StringFlag, |
122 'abi': StringFlag, |
119 'platform': Flag, |
123 'platform': Flag, |
130 flags = Flags('contentaccessible=yes', 'appversion>=3.5') |
134 flags = Flags('contentaccessible=yes', 'appversion>=3.5') |
131 ''' |
135 ''' |
132 diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py |
136 diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py |
133 --- a/python/mozbuild/mozpack/chrome/manifest.py |
137 --- a/python/mozbuild/mozpack/chrome/manifest.py |
134 +++ b/python/mozbuild/mozpack/chrome/manifest.py |
138 +++ b/python/mozbuild/mozpack/chrome/manifest.py |
135 @@ -39,16 +39,17 @@ class ManifestEntry(object): |
139 @@ -36,16 +36,17 @@ class ManifestEntry(object): |
136 'platformversion', |
140 'platformversion', |
137 'os', |
141 'os', |
138 'osversion', |
142 'osversion', |
139 'abi', |
143 'abi', |
140 'xpcnativewrappers', |
144 'xpcnativewrappers', |
151 self.base = base |
155 self.base = base |
152 self.flags = Flags(*flags) |
156 self.flags = Flags(*flags) |
153 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build |
157 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build |
154 --- a/toolkit/components/downloads/moz.build |
158 --- a/toolkit/components/downloads/moz.build |
155 +++ b/toolkit/components/downloads/moz.build |
159 +++ b/toolkit/components/downloads/moz.build |
156 @@ -41,10 +41,14 @@ EXTRA_JS_MODULES += [ |
160 @@ -41,10 +41,14 @@ XPCOM_MANIFESTS += [ |
157 |
161 |
158 if CONFIG['MOZ_PLACES']: |
162 if CONFIG['MOZ_PLACES']: |
159 EXTRA_JS_MODULES += [ |
163 EXTRA_JS_MODULES += [ |
160 'DownloadHistory.jsm', |
164 'DownloadHistory.jsm', |
161 ] |
165 ] |
166 + '/toolkit/xre' |
170 + '/toolkit/xre' |
167 +] |
171 +] |
168 + |
172 + |
169 with Files('**'): |
173 with Files('**'): |
170 BUG_COMPONENT = ('Toolkit', 'Downloads API') |
174 BUG_COMPONENT = ('Toolkit', 'Downloads API') |
171 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn |
175 diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm |
172 --- a/toolkit/content/jar.mn |
176 --- a/toolkit/mozapps/downloads/HelperAppDlg.jsm |
173 +++ b/toolkit/content/jar.mn |
177 +++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm |
174 @@ -67,16 +67,18 @@ toolkit.jar: |
178 @@ -1199,36 +1199,66 @@ nsUnknownContentTypeDialog.prototype = { |
175 content/global/bindings/calendar.js (widgets/calendar.js) |
179 params.handlerApp && |
176 content/global/bindings/checkbox.xml (widgets/checkbox.xml) |
180 params.handlerApp.executable && |
177 content/global/bindings/datekeeper.js (widgets/datekeeper.js) |
181 params.handlerApp.executable.isFile() |
178 content/global/bindings/datepicker.js (widgets/datepicker.js) |
182 ) { |
179 content/global/bindings/datetimepopup.xml (widgets/datetimepopup.xml) |
|
180 content/global/bindings/datetimebox.xml (widgets/datetimebox.xml) |
|
181 content/global/bindings/datetimebox.css (widgets/datetimebox.css) |
|
182 * content/global/bindings/dialog.xml (widgets/dialog.xml) |
|
183 +* content/global/bindings/dialog-kde.xml (widgets/dialog-kde.xml) |
|
184 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde |
|
185 content/global/bindings/general.xml (widgets/general.xml) |
|
186 content/global/bindings/menu.xml (widgets/menu.xml) |
|
187 content/global/bindings/menulist.xml (widgets/menulist.xml) |
|
188 content/global/bindings/notification.xml (widgets/notification.xml) |
|
189 content/global/bindings/numberbox.xml (widgets/numberbox.xml) |
|
190 content/global/bindings/popup.xml (widgets/popup.xml) |
|
191 content/global/bindings/radio.xml (widgets/radio.xml) |
|
192 content/global/bindings/richlistbox.xml (widgets/richlistbox.xml) |
|
193 diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml |
|
194 new file mode 100644 |
|
195 --- /dev/null |
|
196 +++ b/toolkit/content/widgets/dialog-kde.xml |
|
197 @@ -0,0 +1,477 @@ |
|
198 +<?xml version="1.0"?> |
|
199 +<!-- This Source Code Form is subject to the terms of the Mozilla Public |
|
200 + - License, v. 2.0. If a copy of the MPL was not distributed with this |
|
201 + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
|
202 + |
|
203 +<!DOCTYPE bindings [ |
|
204 + <!ENTITY % globalKeysDTD SYSTEM "chrome://global/locale/globalKeys.dtd"> |
|
205 + %globalKeysDTD; |
|
206 +]> |
|
207 + |
|
208 +<bindings id="dialogBindings" |
|
209 + xmlns="http://www.mozilla.org/xbl" |
|
210 + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
211 + xmlns:xbl="http://www.mozilla.org/xbl"> |
|
212 + |
|
213 + <binding id="dialog"> |
|
214 + <content> |
|
215 + <xul:vbox class="box-inherit dialog-content-box" flex="1"> |
|
216 + <children/> |
|
217 + </xul:vbox> |
|
218 + |
|
219 + <xul:hbox class="dialog-button-box" anonid="buttons" |
|
220 + xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient" |
|
221 +#ifdef XP_UNIX_GNOME |
|
222 + > |
|
223 + <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
|
224 + <xul:button dlgtype="help" class="dialog-button" hidden="true"/> |
|
225 + <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
|
226 + <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/> |
|
227 + <xul:spacer anonid="spacer" flex="1"/> |
|
228 + <xul:button dlgtype="cancel" class="dialog-button"/> |
|
229 + <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/> |
|
230 +#elif XP_UNIX |
|
231 + > |
|
232 + <xul:button dlgtype="help" class="dialog-button" hidden="true"/> |
|
233 + <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
|
234 + <xul:spacer anonid="spacer" flex="1"/> |
|
235 + <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/> |
|
236 + <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/> |
|
237 + <xul:button dlgtype="cancel" class="dialog-button"/> |
|
238 + <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
|
239 +#else |
|
240 + pack="end"> |
|
241 + <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
|
242 + <xul:spacer anonid="spacer" flex="1" hidden="true"/> |
|
243 + <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/> |
|
244 + <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/> |
|
245 + <xul:button dlgtype="cancel" class="dialog-button"/> |
|
246 + <xul:button dlgtype="help" class="dialog-button" hidden="true"/> |
|
247 + <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
|
248 +#endif |
|
249 + </xul:hbox> |
|
250 + |
|
251 + <xul:keyset> |
|
252 + <xul:key phase="capturing" oncommand="document.documentElement.openHelp(event)" |
|
253 +#ifdef XP_MACOSX |
|
254 + key="&openHelpMac.commandkey;" modifiers="accel"/> |
|
255 +#else |
|
256 + keycode="&openHelp.commandkey;"/> |
|
257 +#endif |
|
258 + </xul:keyset> |
|
259 + |
|
260 + </content> |
|
261 + |
|
262 + <implementation> |
|
263 + <field name="_mStrBundle">null</field> |
|
264 + <field name="_closeHandler">(function(event) { |
|
265 + if (!document.documentElement.cancelDialog()) |
|
266 + event.preventDefault(); |
|
267 + })</field> |
|
268 + |
|
269 + <property name="buttons" |
|
270 + onget="return this.getAttribute('buttons');" |
|
271 + onset="this._configureButtons(val); return val;"/> |
|
272 + |
|
273 + <property name="defaultButton"> |
|
274 + <getter> |
|
275 + <![CDATA[ |
|
276 + if (this.hasAttribute("defaultButton")) |
|
277 + return this.getAttribute("defaultButton"); |
|
278 + return "accept"; // default to the accept button |
|
279 + ]]> |
|
280 + </getter> |
|
281 + <setter> |
|
282 + <![CDATA[ |
|
283 + this._setDefaultButton(val); |
|
284 + return val; |
|
285 + ]]> |
|
286 + </setter> |
|
287 + </property> |
|
288 + |
|
289 + <method name="acceptDialog"> |
|
290 + <body> |
|
291 + <![CDATA[ |
|
292 + return this._doButtonCommand("accept"); |
|
293 + ]]> |
|
294 + </body> |
|
295 + </method> |
|
296 + |
|
297 + <method name="cancelDialog"> |
|
298 + <body> |
|
299 + <![CDATA[ |
|
300 + return this._doButtonCommand("cancel"); |
|
301 + ]]> |
|
302 + </body> |
|
303 + </method> |
|
304 + |
|
305 + <method name="getButton"> |
|
306 + <parameter name="aDlgType"/> |
|
307 + <body> |
|
308 + <![CDATA[ |
|
309 + return this._buttons[aDlgType]; |
|
310 + ]]> |
|
311 + </body> |
|
312 + </method> |
|
313 + |
|
314 + <method name="moveToAlertPosition"> |
|
315 + <body> |
|
316 + <![CDATA[ |
|
317 + // hack. we need this so the window has something like its final size |
|
318 + if (window.outerWidth == 1) { |
|
319 + dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n"); |
|
320 + sizeToContent(); |
|
321 + } |
|
322 + |
|
323 + if (opener) { |
|
324 + var xOffset = (opener.outerWidth - window.outerWidth) / 2; |
|
325 + var yOffset = opener.outerHeight / 5; |
|
326 + |
|
327 + var newX = opener.screenX + xOffset; |
|
328 + var newY = opener.screenY + yOffset; |
|
329 + } else { |
|
330 + newX = (screen.availWidth - window.outerWidth) / 2; |
|
331 + newY = (screen.availHeight - window.outerHeight) / 2; |
|
332 + } |
|
333 + |
|
334 + // ensure the window is fully onscreen (if smaller than the screen) |
|
335 + if (newX < screen.availLeft) |
|
336 + newX = screen.availLeft + 20; |
|
337 + if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth)) |
|
338 + newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20; |
|
339 + |
|
340 + if (newY < screen.availTop) |
|
341 + newY = screen.availTop + 20; |
|
342 + if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight)) |
|
343 + newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60; |
|
344 + |
|
345 + window.moveTo( newX, newY ); |
|
346 + ]]> |
|
347 + </body> |
|
348 + </method> |
|
349 + |
|
350 + <method name="centerWindowOnScreen"> |
|
351 + <body> |
|
352 + <![CDATA[ |
|
353 + var xOffset = screen.availWidth / 2 - window.outerWidth / 2; |
|
354 + var yOffset = screen.availHeight / 2 - window.outerHeight / 2; |
|
355 + |
|
356 + xOffset = xOffset > 0 ? xOffset : 0; |
|
357 + yOffset = yOffset > 0 ? yOffset : 0; |
|
358 + window.moveTo(xOffset, yOffset); |
|
359 + ]]> |
|
360 + </body> |
|
361 + </method> |
|
362 + |
|
363 + <constructor> |
|
364 + <![CDATA[ |
|
365 + this._configureButtons(this.buttons); |
|
366 + |
|
367 + // listen for when window is closed via native close buttons |
|
368 + window.addEventListener("close", this._closeHandler); |
|
369 + |
|
370 + // for things that we need to initialize after onload fires |
|
371 + window.addEventListener("load", this.postLoadInit); |
|
372 + |
|
373 + window.moveToAlertPosition = this.moveToAlertPosition; |
|
374 + window.centerWindowOnScreen = this.centerWindowOnScreen; |
|
375 + ]]> |
|
376 + </constructor> |
|
377 + |
|
378 + <method name="postLoadInit"> |
|
379 + <parameter name="aEvent"/> |
|
380 + <body> |
|
381 + <![CDATA[ |
|
382 + function focusInit() { |
|
383 + const dialog = document.documentElement; |
|
384 + const defaultButton = dialog.getButton(dialog.defaultButton); |
|
385 + // give focus to the first focusable element in the dialog |
|
386 + if (!document.commandDispatcher.focusedElement) { |
|
387 + document.commandDispatcher.advanceFocusIntoSubtree(dialog); |
|
388 + |
|
389 + var focusedElt = document.commandDispatcher.focusedElement; |
|
390 + if (focusedElt) { |
|
391 + var initialFocusedElt = focusedElt; |
|
392 + while (focusedElt.localName == "tab" || |
|
393 + focusedElt.getAttribute("noinitialfocus") == "true") { |
|
394 + document.commandDispatcher.advanceFocusIntoSubtree(focusedElt); |
|
395 + focusedElt = document.commandDispatcher.focusedElement; |
|
396 + if (focusedElt == initialFocusedElt) { |
|
397 + if (focusedElt.getAttribute("noinitialfocus") == "true") { |
|
398 + focusedElt.blur(); |
|
399 + } |
|
400 + break; |
|
401 + } |
|
402 + } |
|
403 + |
|
404 + if (initialFocusedElt.localName == "tab") { |
|
405 + if (focusedElt.hasAttribute("dlgtype")) { |
|
406 + // We don't want to focus on anonymous OK, Cancel, etc. buttons, |
|
407 + // so return focus to the tab itself |
|
408 + initialFocusedElt.focus(); |
|
409 + } |
|
410 + } else if (!/Mac/.test(navigator.platform) && |
|
411 + focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) { |
|
412 + defaultButton.focus(); |
|
413 + } |
|
414 + } |
|
415 + } |
|
416 + |
|
417 + try { |
|
418 + if (defaultButton) |
|
419 + window.notifyDefaultButtonLoaded(defaultButton); |
|
420 + } catch (e) { } |
|
421 + } |
|
422 + |
|
423 + // Give focus after onload completes, see bug 103197. |
|
424 + setTimeout(focusInit, 0); |
|
425 + ]]> |
|
426 + </body> |
|
427 + </method> |
|
428 + |
|
429 + <method name="openHelp"> |
|
430 + <parameter name="event"/> |
|
431 + <body> |
|
432 + <![CDATA[ |
|
433 + var helpButton = document.documentElement.getButton("help"); |
|
434 + if (helpButton.disabled || helpButton.hidden) |
|
435 + return; |
|
436 + this._fireButtonEvent("help"); |
|
437 + event.stopPropagation(); |
|
438 + event.preventDefault(); |
|
439 + ]]> |
|
440 + </body> |
|
441 + </method> |
|
442 + |
|
443 + <property name="mStrBundle"> |
|
444 + <getter> |
|
445 + <![CDATA[ |
|
446 + if (!this._mStrBundle) { |
|
447 + // need to create string bundle manually instead of using <xul:stringbundle/> |
|
448 + // see bug 63370 for details |
|
449 + this._mStrBundle = Cc["@mozilla.org/intl/stringbundle;1"] |
|
450 + .getService(Ci.nsIStringBundleService) |
|
451 + .createBundle("chrome://global/locale/dialog.properties"); |
|
452 + } |
|
453 + return this._mStrBundle; |
|
454 + ]]></getter> |
|
455 + </property> |
|
456 + |
|
457 + <method name="_configureButtons"> |
|
458 + <parameter name="aButtons"/> |
|
459 + <body> |
|
460 + <![CDATA[ |
|
461 + // by default, get all the anonymous button elements |
|
462 + var buttons = {}; |
|
463 + this._buttons = buttons; |
|
464 + buttons.accept = document.getAnonymousElementByAttribute(this, "dlgtype", "accept"); |
|
465 + buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel"); |
|
466 + buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1"); |
|
467 + buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2"); |
|
468 + buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help"); |
|
469 + buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure"); |
|
470 + |
|
471 + // look for any overriding explicit button elements |
|
472 + var exBtns = this.getElementsByAttribute("dlgtype", "*"); |
|
473 + var dlgtype; |
|
474 + var i; |
|
475 + for (i = 0; i < exBtns.length; ++i) { |
|
476 + dlgtype = exBtns[i].getAttribute("dlgtype"); |
|
477 + buttons[dlgtype].hidden = true; // hide the anonymous button |
|
478 + buttons[dlgtype] = exBtns[i]; |
|
479 + } |
|
480 + |
|
481 + // add the label and oncommand handler to each button |
|
482 + for (dlgtype in buttons) { |
|
483 + var button = buttons[dlgtype]; |
|
484 + button.addEventListener("command", this._handleButtonCommand, true); |
|
485 + |
|
486 + // don't override custom labels with pre-defined labels on explicit buttons |
|
487 + if (!button.hasAttribute("label")) { |
|
488 + // dialog attributes override the default labels in dialog.properties |
|
489 + if (this.hasAttribute("buttonlabel" + dlgtype)) { |
|
490 + button.setAttribute("label", this.getAttribute("buttonlabel" + dlgtype)); |
|
491 + if (this.hasAttribute("buttonaccesskey" + dlgtype)) |
|
492 + button.setAttribute("accesskey", this.getAttribute("buttonaccesskey" + dlgtype)); |
|
493 + } else if (dlgtype != "extra1" && dlgtype != "extra2") { |
|
494 + button.setAttribute("label", this.mStrBundle.GetStringFromName("button-" + dlgtype)); |
|
495 + var accessKey = this.mStrBundle.GetStringFromName("accesskey-" + dlgtype); |
|
496 + if (accessKey) |
|
497 + button.setAttribute("accesskey", accessKey); |
|
498 + } else if (this.hasAttribute("buttonid" + dlgtype)) { |
|
499 + document.l10n.setAttributes(button, this.getAttribute("buttonid" + dlgtype)); |
|
500 + } |
|
501 + } |
|
502 + // allow specifying alternate icons in the dialog header |
|
503 + if (!button.hasAttribute("icon")) { |
|
504 + // if there's an icon specified, use that |
|
505 + if (this.hasAttribute("buttonicon" + dlgtype)) |
|
506 + button.setAttribute("icon", this.getAttribute("buttonicon" + dlgtype)); |
|
507 + // otherwise set defaults |
|
508 + else |
|
509 + switch (dlgtype) { |
|
510 + case "accept": |
|
511 + button.setAttribute("icon", "accept"); |
|
512 + break; |
|
513 + case "cancel": |
|
514 + button.setAttribute("icon", "cancel"); |
|
515 + break; |
|
516 + case "disclosure": |
|
517 + button.setAttribute("icon", "properties"); |
|
518 + break; |
|
519 + case "help": |
|
520 + button.setAttribute("icon", "help"); |
|
521 + break; |
|
522 + default: |
|
523 + break; |
|
524 + } |
|
525 + } |
|
526 + } |
|
527 + |
|
528 + // ensure that hitting enter triggers the default button command |
|
529 + this.defaultButton = this.defaultButton; |
|
530 + |
|
531 + // if there is a special button configuration, use it |
|
532 + if (aButtons) { |
|
533 + // expect a comma delimited list of dlgtype values |
|
534 + var list = aButtons.split(","); |
|
535 + |
|
536 + // mark shown dlgtypes as true |
|
537 + var shown = { accept: false, cancel: false, help: false, |
|
538 + disclosure: false, extra1: false, extra2: false }; |
|
539 + for (i = 0; i < list.length; ++i) |
|
540 + shown[list[i].replace(/ /g, "")] = true; |
|
541 + |
|
542 + // hide/show the buttons we want |
|
543 + for (dlgtype in buttons) |
|
544 + buttons[dlgtype].hidden = !shown[dlgtype]; |
|
545 + |
|
546 + // show the spacer on Windows only when the extra2 button is present |
|
547 + if (/Win/.test(navigator.platform)) { |
|
548 + var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer"); |
|
549 + spacer.removeAttribute("hidden"); |
|
550 + spacer.setAttribute("flex", shown.extra2 ? "1" : "0"); |
|
551 + } |
|
552 + } |
|
553 + ]]> |
|
554 + </body> |
|
555 + </method> |
|
556 + |
|
557 + <method name="_setDefaultButton"> |
|
558 + <parameter name="aNewDefault"/> |
|
559 + <body> |
|
560 + <![CDATA[ |
|
561 + // remove the default attribute from the previous default button, if any |
|
562 + var oldDefaultButton = this.getButton(this.defaultButton); |
|
563 + if (oldDefaultButton) |
|
564 + oldDefaultButton.removeAttribute("default"); |
|
565 + |
|
566 + var newDefaultButton = this.getButton(aNewDefault); |
|
567 + if (newDefaultButton) { |
|
568 + this.setAttribute("defaultButton", aNewDefault); |
|
569 + newDefaultButton.setAttribute("default", "true"); |
|
570 + } else { |
|
571 + this.setAttribute("defaultButton", "none"); |
|
572 + if (aNewDefault != "none") |
|
573 + dump("invalid new default button: " + aNewDefault + ", assuming: none\n"); |
|
574 + } |
|
575 + ]]> |
|
576 + </body> |
|
577 + </method> |
|
578 + |
|
579 + <method name="_handleButtonCommand"> |
|
580 + <parameter name="aEvent"/> |
|
581 + <body> |
|
582 + <![CDATA[ |
|
583 + return document.documentElement._doButtonCommand( |
|
584 + aEvent.target.getAttribute("dlgtype")); |
|
585 + ]]> |
|
586 + </body> |
|
587 + </method> |
|
588 + |
|
589 + <method name="_doButtonCommand"> |
|
590 + <parameter name="aDlgType"/> |
|
591 + <body> |
|
592 + <![CDATA[ |
|
593 + var button = this.getButton(aDlgType); |
|
594 + if (!button.disabled) { |
|
595 + var noCancel = this._fireButtonEvent(aDlgType); |
|
596 + if (noCancel) { |
|
597 + if (aDlgType == "accept" || aDlgType == "cancel") { |
|
598 + var closingEvent = new CustomEvent("dialogclosing", { |
|
599 + bubbles: true, |
|
600 + detail: { button: aDlgType }, |
|
601 + }); |
|
602 + this.dispatchEvent(closingEvent); |
|
603 + window.close(); |
|
604 + } |
|
605 + } |
|
606 + return noCancel; |
|
607 + } |
|
608 + return true; |
|
609 + ]]> |
|
610 + </body> |
|
611 + </method> |
|
612 + |
|
613 + <method name="_fireButtonEvent"> |
|
614 + <parameter name="aDlgType"/> |
|
615 + <body> |
|
616 + <![CDATA[ |
|
617 + var event = document.createEvent("Events"); |
|
618 + event.initEvent("dialog" + aDlgType, true, true); |
|
619 + |
|
620 + // handle dom event handlers |
|
621 + var noCancel = this.dispatchEvent(event); |
|
622 + |
|
623 + // handle any xml attribute event handlers |
|
624 + var handler = this.getAttribute("ondialog" + aDlgType); |
|
625 + if (handler != "") { |
|
626 + var fn = new Function("event", handler); |
|
627 + var returned = fn(event); |
|
628 + // eslint-disable-next-line mozilla/no-compare-against-boolean-literals |
|
629 + if (returned == false) |
|
630 + noCancel = false; |
|
631 + } |
|
632 + |
|
633 + return noCancel; |
|
634 + ]]> |
|
635 + </body> |
|
636 + </method> |
|
637 + |
|
638 + <method name="_hitEnter"> |
|
639 + <parameter name="evt"/> |
|
640 + <body> |
|
641 + <![CDATA[ |
|
642 + if (evt.defaultPrevented) |
|
643 + return; |
|
644 + |
|
645 + var btn = this.getButton(this.defaultButton); |
|
646 + if (btn) |
|
647 + this._doButtonCommand(this.defaultButton); |
|
648 + ]]> |
|
649 + </body> |
|
650 + </method> |
|
651 + |
|
652 + </implementation> |
|
653 + |
|
654 + <handlers> |
|
655 + <handler event="keypress" keycode="VK_RETURN" |
|
656 + group="system" action="this._hitEnter(event);"/> |
|
657 + <handler event="keypress" keycode="VK_ESCAPE" group="system"> |
|
658 + if (!event.defaultPrevented) |
|
659 + this.cancelDialog(); |
|
660 + </handler> |
|
661 +#ifdef XP_MACOSX |
|
662 + <handler event="keypress" key="." modifiers="meta" phase="capturing" action="this.cancelDialog();"/> |
|
663 +#else |
|
664 + <handler event="focus" phase="capturing"> |
|
665 + var btn = this.getButton(this.defaultButton); |
|
666 + if (btn) |
|
667 + btn.setAttribute("default", event.originalTarget == btn || !(event.originalTarget instanceof Ci.nsIDOMXULButtonElement)); |
|
668 + </handler> |
|
669 +#endif |
|
670 + </handlers> |
|
671 + |
|
672 + </binding> |
|
673 + |
|
674 +</bindings> |
|
675 diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js |
|
676 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js |
|
677 +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js |
|
678 @@ -1030,30 +1030,60 @@ nsUnknownContentTypeDialog.prototype = { |
|
679 |
|
680 if (params.handlerApp && |
|
681 params.handlerApp.executable && |
|
682 params.handlerApp.executable.isFile()) { |
|
683 // Remember the file they chose to run. |
183 // Remember the file they chose to run. |
684 this.chosenApp = params.handlerApp; |
184 this.chosenApp = params.handlerApp; |
685 } |
185 } |
686 } else if ("@mozilla.org/applicationchooser;1" in Cc) { |
186 } else if ("@mozilla.org/applicationchooser;1" in Cc) { |
687 - var nsIApplicationChooser = Ci.nsIApplicationChooser; |
187 - var nsIApplicationChooser = Ci.nsIApplicationChooser; |
688 - var appChooser = Cc["@mozilla.org/applicationchooser;1"] |
188 - var appChooser = Cc["@mozilla.org/applicationchooser;1"].createInstance( |
689 - .createInstance(nsIApplicationChooser); |
189 - nsIApplicationChooser |
690 - appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle")); |
190 - ); |
191 - appChooser.init( |
|
192 - this.mDialog, |
|
193 - this.dialogElement("strings").getString("chooseAppFilePickerTitle") |
|
194 - ); |
|
691 - var contentTypeDialogObj = this; |
195 - var contentTypeDialogObj = this; |
692 - let appChooserCallback = function appChooserCallback_done(aResult) { |
196 - let appChooserCallback = function appChooserCallback_done(aResult) { |
693 - if (aResult) { |
197 - if (aResult) { |
694 - contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp); |
198 - contentTypeDialogObj.chosenApp = aResult.QueryInterface( |
199 - Ci.nsILocalHandlerApp |
|
200 - ); |
|
695 - } |
201 - } |
696 - contentTypeDialogObj.finishChooseApp(); |
202 - contentTypeDialogObj.finishChooseApp(); |
697 - }; |
203 - }; |
698 - appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback); |
204 - appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback); |
699 - // The finishChooseApp is called from appChooserCallback |
205 - // The finishChooseApp is called from appChooserCallback |
726 + } |
232 + } |
727 + this.finishChooseApp(); |
233 + this.finishChooseApp(); |
728 + }); |
234 + }); |
729 + } else { |
235 + } else { |
730 + var nsIApplicationChooser = Ci.nsIApplicationChooser; |
236 + var nsIApplicationChooser = Ci.nsIApplicationChooser; |
731 + var appChooser = Cc["@mozilla.org/applicationchooser;1"] |
237 + var appChooser = Cc["@mozilla.org/applicationchooser;1"].createInstance( |
732 + .createInstance(nsIApplicationChooser); |
238 + nsIApplicationChooser |
733 + appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle")); |
239 + ); |
240 + appChooser.init( |
|
241 + this.mDialog, |
|
242 + this.dialogElement("strings").getString("chooseAppFilePickerTitle") |
|
243 + ); |
|
734 + var contentTypeDialogObj = this; |
244 + var contentTypeDialogObj = this; |
735 + let appChooserCallback = function appChooserCallback_done(aResult) { |
245 + let appChooserCallback = function appChooserCallback_done(aResult) { |
736 + if (aResult) { |
246 + if (aResult) { |
737 + contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp); |
247 + contentTypeDialogObj.chosenApp = aResult.QueryInterface( |
248 + Ci.nsILocalHandlerApp |
|
249 + ); |
|
738 + } |
250 + } |
739 + contentTypeDialogObj.finishChooseApp(); |
251 + contentTypeDialogObj.finishChooseApp(); |
740 + }; |
252 + }; |
741 + appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback); |
253 + appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback); |
742 + // The finishChooseApp is called from appChooserCallback |
254 + // The finishChooseApp is called from appChooserCallback |
743 + return; |
255 + return; |
744 + } |
256 + } |
745 } else { |
257 } else { |
746 var nsIFilePicker = Ci.nsIFilePicker; |
258 var nsIFilePicker = Ci.nsIFilePicker; |
747 var fp = Cc["@mozilla.org/filepicker;1"] |
259 var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); |
748 .createInstance(nsIFilePicker); |
260 fp.init( |
749 fp.init(this.mDialog, |
261 this.mDialog, |
750 this.dialogElement("strings").getString("chooseAppFilePickerTitle"), |
262 this.dialogElement("strings").getString("chooseAppFilePickerTitle"), |
751 nsIFilePicker.modeOpen); |
263 nsIFilePicker.modeOpen |
752 |
264 ); |
753 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
265 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
754 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
266 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
755 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
267 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
756 @@ -15,16 +15,17 @@ |
268 @@ -14,16 +14,17 @@ |
757 #include "nsPrintfCString.h" |
269 #include "nsPrintfCString.h" |
758 #include "nsNetCID.h" |
270 #include "nsNetCID.h" |
759 #include "nsNetUtil.h" |
271 #include "nsNetUtil.h" |
760 #include "nsISupportsPrimitives.h" |
272 #include "nsISupportsPrimitives.h" |
761 #include "nsIGSettingsService.h" |
273 #include "nsIGSettingsService.h" |
762 #include "nsInterfaceHashtable.h" |
274 #include "nsInterfaceHashtable.h" |
763 #include "mozilla/Attributes.h" |
275 #include "mozilla/Attributes.h" |
764 #include "nsIURI.h" |
276 #include "nsIURI.h" |
765 +#include "nsKDEUtils.h" |
277 +#include "nsKDEUtils.h" |
766 |
278 |
279 using namespace mozilla; |
|
280 |
|
767 class nsUnixSystemProxySettings final : public nsISystemProxySettings { |
281 class nsUnixSystemProxySettings final : public nsISystemProxySettings { |
768 public: |
282 public: |
769 NS_DECL_ISUPPORTS |
283 NS_DECL_ISUPPORTS |
770 NS_DECL_NSISYSTEMPROXYSETTINGS |
284 NS_DECL_NSISYSTEMPROXYSETTINGS |
771 |
285 |
772 nsUnixSystemProxySettings() : mSchemeProxySettings(4) {} |
286 @@ -37,16 +38,18 @@ class nsUnixSystemProxySettings final : |
773 nsresult Init(); |
287 nsCOMPtr<nsIGSettingsCollection> mProxySettings; |
774 @@ -42,16 +43,18 @@ class nsUnixSystemProxySettings final : |
288 nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> |
775 nsACString& aResult); |
289 mSchemeProxySettings; |
776 nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, |
|
777 int32_t aPort, nsACString& aResult); |
|
778 nsresult GetProxyFromGSettings(const nsACString& aScheme, |
290 nsresult GetProxyFromGSettings(const nsACString& aScheme, |
779 const nsACString& aHost, int32_t aPort, |
291 const nsACString& aHost, int32_t aPort, |
780 nsACString& aResult); |
292 nsACString& aResult); |
781 nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, |
293 nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, |
782 nsACString& aResult); |
294 nsACString& aResult); |
788 |
300 |
789 NS_IMETHODIMP |
301 NS_IMETHODIMP |
790 nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) { |
302 nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) { |
791 // dbus prevents us from being threadsafe, but this routine should not block |
303 // dbus prevents us from being threadsafe, but this routine should not block |
792 // anyhow |
304 // anyhow |
793 @@ -488,16 +491,19 @@ nsresult nsUnixSystemProxySettings::GetP |
305 @@ -381,21 +384,50 @@ nsresult nsUnixSystemProxySettings::GetP |
794 return NS_OK; |
306 return NS_OK; |
795 } |
307 } |
796 |
308 |
797 nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec, |
309 nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec, |
798 const nsACString& aScheme, |
310 const nsACString& aScheme, |
804 + |
316 + |
805 if (mProxySettings) { |
317 if (mProxySettings) { |
806 nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult); |
318 nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult); |
807 if (NS_SUCCEEDED(rv)) return rv; |
319 if (NS_SUCCEEDED(rv)) return rv; |
808 } |
320 } |
809 if (mGConf) return GetProxyFromGConf(aScheme, aHost, aPort, aResult); |
|
810 |
321 |
811 return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult); |
322 return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult); |
812 } |
323 } |
813 @@ -521,8 +527,34 @@ static const mozilla::Module::CIDEntry k |
324 |
814 static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = { |
|
815 {NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID}, |
|
816 {nullptr}}; |
|
817 |
|
818 static const mozilla::Module kUnixProxyModule = { |
|
819 mozilla::Module::kVersion, kUnixProxyCIDs, kUnixProxyContracts}; |
|
820 |
|
821 NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule; |
|
822 + |
|
823 +nsresult |
325 +nsresult |
824 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme, |
326 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme, |
825 + const nsACString& aHost, |
327 + const nsACString& aHost, |
826 + PRInt32 aPort, |
328 + PRInt32 aPort, |
827 + nsACString& aResult) |
329 + nsACString& aResult) |
843 + return NS_ERROR_FAILURE; |
345 + return NS_ERROR_FAILURE; |
844 + aResult = result[0]; |
346 + aResult = result[0]; |
845 + return NS_OK; |
347 + return NS_OK; |
846 +} |
348 +} |
847 + |
349 + |
350 + |
|
351 NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) { |
|
352 auto result = MakeRefPtr<nsUnixSystemProxySettings>(); |
|
353 result->Init(); |
|
354 return result.forget().downcast<nsISupports>(); |
|
355 } |
|
848 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build |
356 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build |
849 --- a/toolkit/xre/moz.build |
357 --- a/toolkit/xre/moz.build |
850 +++ b/toolkit/xre/moz.build |
358 +++ b/toolkit/xre/moz.build |
851 @@ -73,17 +73,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co |
359 @@ -85,17 +85,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co |
852 '../components/printingui', |
360 '../components/printingui', |
853 ] |
361 ] |
854 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit': |
362 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit': |
855 UNIFIED_SOURCES += [ |
363 UNIFIED_SOURCES += [ |
856 'nsNativeAppSupportDefault.cpp', |
364 'nsNativeAppSupportDefault.cpp', |
857 'UIKitDirProvider.mm', |
365 'UIKitDirProvider.mm', |
858 ] |
366 ] |
859 elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: |
367 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': |
860 + EXPORTS += ['nsKDEUtils.h'] |
368 + EXPORTS += ['nsKDEUtils.h'] |
861 UNIFIED_SOURCES += [ |
369 UNIFIED_SOURCES += [ |
862 + 'nsKDEUtils.cpp', |
370 + 'nsKDEUtils.cpp', |
863 'nsNativeAppSupportUnix.cpp', |
371 'nsNativeAppSupportUnix.cpp', |
864 ] |
372 ] |
865 else: |
373 else: |
866 UNIFIED_SOURCES += [ |
374 UNIFIED_SOURCES += [ |
867 'nsNativeAppSupportDefault.cpp', |
375 'nsNativeAppSupportDefault.cpp', |
868 ] |
376 ] |
869 |
377 |
870 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3': |
378 if CONFIG['MOZ_HAS_REMOTE']: |
871 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
379 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
872 new file mode 100644 |
380 new file mode 100644 |
873 --- /dev/null |
381 --- /dev/null |
874 +++ b/toolkit/xre/nsKDEUtils.cpp |
382 +++ b/toolkit/xre/nsKDEUtils.cpp |
875 @@ -0,0 +1,344 @@ |
383 @@ -0,0 +1,344 @@ |
914 +static bool getKdeSession() |
422 +static bool getKdeSession() |
915 + { |
423 + { |
916 + Display* dpy = XOpenDisplay( NULL ); |
424 + Display* dpy = XOpenDisplay( NULL ); |
917 + if( dpy == NULL ) |
425 + if( dpy == NULL ) |
918 + return false; |
426 + return false; |
919 + Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True ); |
427 + Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", true ); |
920 + bool kde = false; |
428 + bool kde = false; |
921 + if( kde_full_session != None ) |
429 + if( kde_full_session != None ) |
922 + { |
430 + { |
923 + int cnt; |
431 + int cnt; |
924 + if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt )) |
432 + if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt )) |
1271 + |
779 + |
1272 +#endif // nsKDEUtils |
780 +#endif // nsKDEUtils |
1273 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp |
781 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp |
1274 --- a/uriloader/exthandler/HandlerServiceParent.cpp |
782 --- a/uriloader/exthandler/HandlerServiceParent.cpp |
1275 +++ b/uriloader/exthandler/HandlerServiceParent.cpp |
783 +++ b/uriloader/exthandler/HandlerServiceParent.cpp |
1276 @@ -1,16 +1,16 @@ |
784 @@ -7,17 +7,17 @@ |
785 #include "mozilla/ipc/ProtocolUtils.h" |
|
1277 #include "mozilla/Logging.h" |
786 #include "mozilla/Logging.h" |
1278 #include "HandlerServiceParent.h" |
787 #include "HandlerServiceParent.h" |
1279 #include "nsIHandlerService.h" |
788 #include "nsIHandlerService.h" |
1280 #include "nsIMIMEInfo.h" |
789 #include "nsIMIMEInfo.h" |
1281 #include "ContentHandlerService.h" |
790 #include "ContentHandlerService.h" |
1282 #include "nsStringEnumerator.h" |
791 #include "nsStringEnumerator.h" |
1283 #ifdef MOZ_WIDGET_GTK |
792 #ifdef MOZ_WIDGET_GTK |
1284 -#include "unix/nsGNOMERegistry.h" |
793 -# include "unix/nsGNOMERegistry.h" |
1285 +#include "unix/nsCommonRegistry.h" |
794 +# include "unix/nsCommonRegistry.h" |
1286 #endif |
795 #endif |
1287 |
796 |
1288 using mozilla::dom::ContentHandlerService; |
797 using mozilla::dom::ContentHandlerService; |
1289 using mozilla::dom::HandlerApp; |
798 using mozilla::dom::HandlerApp; |
1290 using mozilla::dom::HandlerInfo; |
799 using mozilla::dom::HandlerInfo; |
1291 using mozilla::dom::RemoteHandlerApp; |
800 using mozilla::dom::RemoteHandlerApp; |
1292 |
801 |
1293 namespace { |
802 namespace { |
1294 @@ -246,17 +246,17 @@ mozilla::ipc::IPCResult HandlerServicePa |
803 @@ -288,17 +288,17 @@ mozilla::ipc::IPCResult HandlerServicePa |
1295 handlerSvc->Exists(info, exists); |
804 mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocolOS( |
1296 return IPC_OK(); |
|
1297 } |
|
1298 |
|
1299 mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocol( |
|
1300 const nsCString& aProtocolScheme, bool* aHandlerExists) { |
805 const nsCString& aProtocolScheme, bool* aHandlerExists) { |
806 if (aProtocolScheme.Length() > MAX_SCHEME_LENGTH) { |
|
807 *aHandlerExists = false; |
|
808 return IPC_OK(); |
|
809 } |
|
1301 #ifdef MOZ_WIDGET_GTK |
810 #ifdef MOZ_WIDGET_GTK |
1302 // Check the GNOME registry for a protocol handler |
811 // Check the GNOME registry for a protocol handler |
1303 - *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get()); |
812 - *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get()); |
1304 + *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get()); |
813 + *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get()); |
1305 #else |
814 #else |
1306 *aHandlerExists = false; |
815 *aHandlerExists = false; |
1307 #endif |
816 #endif |
1308 return IPC_OK(); |
817 return IPC_OK(); |
1309 } |
818 } |
1310 |
819 |
1311 mozilla::ipc::IPCResult HandlerServiceParent::RecvGetTypeFromExtension( |
820 /* |
1312 const nsCString& aFileExtension, nsCString* type) { |
821 * Check if a handler exists for the provided protocol. Check the datastore |
822 @@ -317,17 +317,17 @@ mozilla::ipc::IPCResult HandlerServicePa |
|
823 nsCOMPtr<nsIExternalProtocolService> protoSvc = |
|
824 do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, &rv); |
|
825 if (NS_WARN_IF(NS_FAILED(rv))) { |
|
826 *aHandlerExists = false; |
|
827 return IPC_OK(); |
|
828 } |
|
829 rv = protoSvc->ExternalProtocolHandlerExists(aProtocolScheme.get(), |
|
830 aHandlerExists); |
|
831 - |
|
832 +## |
|
833 if (NS_WARN_IF(NS_FAILED(rv))) { |
|
834 *aHandlerExists = false; |
|
835 } |
|
836 #else |
|
837 MOZ_RELEASE_ASSERT(false, "No implementation on this platform."); |
|
838 *aHandlerExists = false; |
|
839 #endif |
|
840 return IPC_OK(); |
|
1313 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build |
841 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build |
1314 --- a/uriloader/exthandler/moz.build |
842 --- a/uriloader/exthandler/moz.build |
1315 +++ b/uriloader/exthandler/moz.build |
843 +++ b/uriloader/exthandler/moz.build |
1316 @@ -76,17 +76,19 @@ else: |
844 @@ -83,17 +83,19 @@ else: |
1317 SOURCES += [ |
845 SOURCES += [ |
1318 osdir + '/nsOSHelperAppService.cpp', |
846 osdir + '/nsOSHelperAppService.cpp', |
1319 ] |
847 ] |
1320 if CONFIG['CC_TYPE'] in ('clang', 'gcc'): |
848 if CONFIG['CC_TYPE'] in ('clang', 'gcc'): |
1321 CXXFLAGS += ['-Wno-error=shadow'] |
849 CXXFLAGS += ['-Wno-error=shadow'] |
1322 |
850 |
1323 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: |
851 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': |
1324 UNIFIED_SOURCES += [ |
852 UNIFIED_SOURCES += [ |
1325 + 'unix/nsCommonRegistry.cpp', |
853 + 'unix/nsCommonRegistry.cpp', |
1326 'unix/nsGNOMERegistry.cpp', |
854 'unix/nsGNOMERegistry.cpp', |
1327 + 'unix/nsKDERegistry.cpp', |
855 + 'unix/nsKDERegistry.cpp', |
1328 'unix/nsMIMEInfoUnix.cpp', |
856 'unix/nsMIMEInfoUnix.cpp', |
1331 UNIFIED_SOURCES += [ |
859 UNIFIED_SOURCES += [ |
1332 'android/nsAndroidHandlerApp.cpp', |
860 'android/nsAndroidHandlerApp.cpp', |
1333 'android/nsExternalURLHandlerService.cpp', |
861 'android/nsExternalURLHandlerService.cpp', |
1334 'android/nsMIMEInfoAndroid.cpp', |
862 'android/nsMIMEInfoAndroid.cpp', |
1335 ] |
863 ] |
1336 @@ -120,16 +122,17 @@ include('/ipc/chromium/chromium-config.m |
864 @@ -133,16 +135,17 @@ include('/ipc/chromium/chromium-config.m |
1337 FINAL_LIBRARY = 'xul' |
865 FINAL_LIBRARY = 'xul' |
1338 |
866 |
1339 LOCAL_INCLUDES += [ |
867 LOCAL_INCLUDES += [ |
1340 '/docshell/base', |
868 '/docshell/base', |
1341 '/dom/base', |
869 '/dom/base', |
1347 |
875 |
1348 if CONFIG['MOZ_ENABLE_DBUS']: |
876 if CONFIG['MOZ_ENABLE_DBUS']: |
1349 CXXFLAGS += CONFIG['TK_CFLAGS'] |
877 CXXFLAGS += CONFIG['TK_CFLAGS'] |
1350 CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS'] |
878 CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS'] |
1351 |
879 |
1352 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3': |
880 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': |
1353 CXXFLAGS += CONFIG['TK_CFLAGS'] |
881 CXXFLAGS += CONFIG['TK_CFLAGS'] |
1354 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp |
882 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp |
1355 new file mode 100644 |
883 new file mode 100644 |
1356 --- /dev/null |
884 --- /dev/null |
1357 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp |
885 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp |
1589 #include "nsIGIOService.h" |
1117 #include "nsIGIOService.h" |
1590 #include "nsNetCID.h" |
1118 #include "nsNetCID.h" |
1591 #include "nsIIOService.h" |
1119 #include "nsIIOService.h" |
1592 #include "nsAutoPtr.h" |
1120 #include "nsAutoPtr.h" |
1593 #ifdef MOZ_ENABLE_DBUS |
1121 #ifdef MOZ_ENABLE_DBUS |
1594 #include "nsDBusHandlerApp.h" |
1122 # include "nsDBusHandlerApp.h" |
1595 #endif |
1123 #endif |
1596 +#if defined(XP_UNIX) && !defined(XP_MACOSX) |
1124 +#if defined(XP_UNIX) && !defined(XP_MACOSX) |
1597 +#include "nsKDEUtils.h" |
1125 +#include "nsKDEUtils.h" |
1598 +#endif |
1126 +#endif |
1599 |
1127 |
1600 nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI *aURI) { |
1128 nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI* aURI) { |
1601 - return nsGNOMERegistry::LoadURL(aURI); |
1129 - return nsGNOMERegistry::LoadURL(aURI); |
1602 + return nsCommonRegistry::LoadURL(aURI); |
1130 + return nsCommonRegistry::LoadURL(aURI); |
1603 } |
1131 } |
1604 |
1132 |
1605 NS_IMETHODIMP |
1133 NS_IMETHODIMP |
1606 nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval) { |
1134 nsMIMEInfoUnix::GetHasDefaultHandler(bool* _retval) { |
1607 // if mDefaultApplication is set, it means the application has been set from |
1135 // if mDefaultApplication is set, it means the application has been set from |
1608 // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to |
1136 // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to |
1609 // give the GNOME answer. |
1137 // give the GNOME answer. |
1610 if (mDefaultApplication) return nsMIMEInfoImpl::GetHasDefaultHandler(_retval); |
1138 if (mDefaultApplication) return nsMIMEInfoImpl::GetHasDefaultHandler(_retval); |
1611 |
1139 |
1676 #include <sys/stat.h> |
1204 #include <sys/stat.h> |
1677 |
1205 |
1678 #include "nsOSHelperAppService.h" |
1206 #include "nsOSHelperAppService.h" |
1679 #include "nsMIMEInfoUnix.h" |
1207 #include "nsMIMEInfoUnix.h" |
1680 #ifdef MOZ_WIDGET_GTK |
1208 #ifdef MOZ_WIDGET_GTK |
1681 -#include "nsGNOMERegistry.h" |
1209 -# include "nsGNOMERegistry.h" |
1682 +#include "nsCommonRegistry.h" |
1210 +# include "nsCommonRegistry.h" |
1683 #endif |
1211 #endif |
1684 #include "nsISupports.h" |
1212 #include "nsISupports.h" |
1685 #include "nsString.h" |
1213 #include "nsString.h" |
1686 #include "nsReadableUtils.h" |
1214 #include "nsReadableUtils.h" |
1687 #include "nsUnicharUtils.h" |
1215 #include "nsUnicharUtils.h" |
1688 #include "nsIURL.h" |
1216 #include "nsIURL.h" |
1689 #include "nsIFileStreams.h" |
1217 #include "nsIFileStreams.h" |
1690 #include "nsILineInputStream.h" |
1218 #include "nsILineInputStream.h" |
1691 @@ -1031,17 +1031,17 @@ nsresult nsOSHelperAppService::GetHandle |
1219 @@ -1025,17 +1025,17 @@ nsresult nsOSHelperAppService::GetHandle |
1692 |
1220 |
1693 nsresult nsOSHelperAppService::OSProtocolHandlerExists( |
1221 nsresult nsOSHelperAppService::OSProtocolHandlerExists( |
1694 const char* aProtocolScheme, bool* aHandlerExists) { |
1222 const char* aProtocolScheme, bool* aHandlerExists) { |
1695 nsresult rv = NS_OK; |
1223 nsresult rv = NS_OK; |
1696 |
1224 |
1705 } else { |
1233 } else { |
1706 *aHandlerExists = false; |
1234 *aHandlerExists = false; |
1707 nsCOMPtr<nsIHandlerService> handlerSvc = |
1235 nsCOMPtr<nsIHandlerService> handlerSvc = |
1708 do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv); |
1236 do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv); |
1709 if (NS_SUCCEEDED(rv) && handlerSvc) { |
1237 if (NS_SUCCEEDED(rv) && handlerSvc) { |
1710 @@ -1051,17 +1051,17 @@ nsresult nsOSHelperAppService::OSProtoco |
1238 @@ -1045,17 +1045,17 @@ nsresult nsOSHelperAppService::OSProtoco |
1711 } |
1239 } |
1712 |
1240 |
1713 return rv; |
1241 return rv; |
1714 } |
1242 } |
1715 |
1243 |
1724 #endif |
1252 #endif |
1725 } |
1253 } |
1726 |
1254 |
1727 nsresult nsOSHelperAppService::GetFileTokenForPath( |
1255 nsresult nsOSHelperAppService::GetFileTokenForPath( |
1728 const char16_t* platformAppPath, nsIFile** aFile) { |
1256 const char16_t* platformAppPath, nsIFile** aFile) { |
1729 @@ -1142,17 +1142,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel |
1257 @@ -1136,17 +1136,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel |
1730 nsresult rv = |
1258 nsresult rv = |
1731 LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType, |
1259 LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType, |
1732 minorType, mime_types_description, true); |
1260 minorType, mime_types_description, true); |
1733 |
1261 |
1734 if (NS_FAILED(rv) || majorType.IsEmpty()) { |
1262 if (NS_FAILED(rv) || majorType.IsEmpty()) { |
1743 } |
1271 } |
1744 #endif |
1272 #endif |
1745 |
1273 |
1746 rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType, |
1274 rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType, |
1747 minorType, mime_types_description, false); |
1275 minorType, mime_types_description, false); |
1748 @@ -1254,17 +1254,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel |
1276 @@ -1248,17 +1248,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel |
1749 |
1277 |
1750 // Now look up our extensions |
1278 // Now look up our extensions |
1751 nsAutoString extensions, mime_types_description; |
1279 nsAutoString extensions, mime_types_description; |
1752 LookUpExtensionsAndDescription(majorType, minorType, extensions, |
1280 LookUpExtensionsAndDescription(majorType, minorType, extensions, |
1753 mime_types_description); |
1281 mime_types_description); |
1765 NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?"); |
1293 NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?"); |
1766 gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions)); |
1294 gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions)); |
1767 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build |
1295 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build |
1768 --- a/widget/gtk/moz.build |
1296 --- a/widget/gtk/moz.build |
1769 +++ b/widget/gtk/moz.build |
1297 +++ b/widget/gtk/moz.build |
1770 @@ -116,16 +116,17 @@ include('/ipc/chromium/chromium-config.m |
1298 @@ -126,16 +126,17 @@ include('/ipc/chromium/chromium-config.m |
1771 |
1299 |
1772 FINAL_LIBRARY = 'xul' |
1300 FINAL_LIBRARY = 'xul' |
1773 |
1301 |
1774 LOCAL_INCLUDES += [ |
1302 LOCAL_INCLUDES += [ |
1775 '/layout/base', |
1303 '/layout/base', |
1786 '/widget/x11', |
1314 '/widget/x11', |
1787 ] |
1315 ] |
1788 diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp |
1316 diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp |
1789 --- a/widget/gtk/nsFilePicker.cpp |
1317 --- a/widget/gtk/nsFilePicker.cpp |
1790 +++ b/widget/gtk/nsFilePicker.cpp |
1318 +++ b/widget/gtk/nsFilePicker.cpp |
1791 @@ -4,32 +4,34 @@ |
1319 @@ -4,16 +4,17 @@ |
1792 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
1320 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
1793 |
1321 |
1794 #include "mozilla/Types.h" |
1322 #include "mozilla/Types.h" |
1795 #include <sys/types.h> |
1323 #include <sys/types.h> |
1796 #include <sys/stat.h> |
1324 #include <sys/stat.h> |
1799 #include <gtk/gtk.h> |
1327 #include <gtk/gtk.h> |
1800 +#include <gdk/gdkx.h> |
1328 +#include <gdk/gdkx.h> |
1801 |
1329 |
1802 #include "nsGtkUtils.h" |
1330 #include "nsGtkUtils.h" |
1803 #include "nsIFileURL.h" |
1331 #include "nsIFileURL.h" |
1332 #include "nsIGIOService.h" |
|
1804 #include "nsIURI.h" |
1333 #include "nsIURI.h" |
1805 #include "nsIWidget.h" |
1334 #include "nsIWidget.h" |
1806 #include "nsIFile.h" |
1335 #include "nsIFile.h" |
1807 #include "nsIStringBundle.h" |
1336 #include "nsIStringBundle.h" |
1808 |
1337 @@ -21,16 +22,17 @@ |
1809 #include "nsArrayEnumerator.h" |
1338 #include "nsArrayEnumerator.h" |
1810 #include "nsMemory.h" |
1339 #include "nsMemory.h" |
1811 #include "nsEnumeratorUtils.h" |
1340 #include "nsEnumeratorUtils.h" |
1812 #include "nsNetUtil.h" |
1341 #include "nsNetUtil.h" |
1813 #include "nsReadableUtils.h" |
1342 #include "nsReadableUtils.h" |
1820 |
1349 |
1821 #define MAX_PREVIEW_SIZE 180 |
1350 #define MAX_PREVIEW_SIZE 180 |
1822 // bug 1184009 |
1351 // bug 1184009 |
1823 #define MAX_PREVIEW_SOURCE_SIZE 4096 |
1352 #define MAX_PREVIEW_SOURCE_SIZE 4096 |
1824 |
1353 |
1825 nsIFile *nsFilePicker::mPrevDisplayDirectory = nullptr; |
1354 nsIFile* nsFilePicker::mPrevDisplayDirectory = nullptr; |
1826 @@ -227,17 +229,19 @@ nsFilePicker::AppendFilters(int32_t aFil |
1355 @@ -228,17 +230,19 @@ nsFilePicker::AppendFilters(int32_t aFil |
1827 mAllowURLs = !!(aFilterMask & filterAllowURLs); |
1356 mAllowURLs = !!(aFilterMask & filterAllowURLs); |
1828 return nsBaseFilePicker::AppendFilters(aFilterMask); |
1357 return nsBaseFilePicker::AppendFilters(aFilterMask); |
1829 } |
1358 } |
1830 |
1359 |
1831 NS_IMETHODIMP |
1360 NS_IMETHODIMP |
1832 nsFilePicker::AppendFilter(const nsAString &aTitle, const nsAString &aFilter) { |
1361 nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) { |
1833 if (aFilter.EqualsLiteral("..apps")) { |
1362 if (aFilter.EqualsLiteral("..apps")) { |
1834 // No platform specific thing we can do here, really.... |
1363 // No platform specific thing we can do here, really.... |
1835 - return NS_OK; |
1364 - return NS_OK; |
1836 + // Unless it's KDE. |
1365 + // Unless it's KDE. |
1837 + if( mMode != modeOpen || !nsKDEUtils::kdeSupport()) |
1366 + if( mMode != modeOpen || !nsKDEUtils::kdeSupport()) |
1842 CopyUTF16toUTF8(aFilter, filter); |
1371 CopyUTF16toUTF8(aFilter, filter); |
1843 CopyUTF16toUTF8(aTitle, name); |
1372 CopyUTF16toUTF8(aTitle, name); |
1844 |
1373 |
1845 mFilters.AppendElement(filter); |
1374 mFilters.AppendElement(filter); |
1846 mFilterNames.AppendElement(name); |
1375 mFilterNames.AppendElement(name); |
1847 @@ -337,16 +341,39 @@ nsresult nsFilePicker::Show(int16_t *aRe |
1376 @@ -338,16 +342,39 @@ nsresult nsFilePicker::Show(int16_t* aRe |
1848 return NS_OK; |
1377 return NS_OK; |
1849 } |
1378 } |
1850 |
1379 |
1851 NS_IMETHODIMP |
1380 NS_IMETHODIMP |
1852 nsFilePicker::Open(nsIFilePickerShownCallback *aCallback) { |
1381 nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) { |
1853 // Can't show two dialogs concurrently with the same filepicker |
1382 // Can't show two dialogs concurrently with the same filepicker |
1854 if (mRunning) return NS_ERROR_NOT_AVAILABLE; |
1383 if (mRunning) return NS_ERROR_NOT_AVAILABLE; |
1855 |
1384 |
1856 + // KDE file picker is not handled via callback |
1385 + // KDE file picker is not handled via callback |
1857 + if( nsKDEUtils::kdeSupport()) { |
1386 + if( nsKDEUtils::kdeSupport()) { |
1877 + } |
1406 + } |
1878 + |
1407 + |
1879 nsCString title; |
1408 nsCString title; |
1880 title.Adopt(ToNewUTF8String(mTitle)); |
1409 title.Adopt(ToNewUTF8String(mTitle)); |
1881 |
1410 |
1882 GtkWindow *parent_widget = |
1411 GtkWindow* parent_widget = |
1883 GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET)); |
1412 GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET)); |
1884 |
1413 |
1885 GtkFileChooserAction action = GetGtkFileChooserAction(mMode); |
1414 GtkFileChooserAction action = GetGtkFileChooserAction(mMode); |
1886 |
1415 |
1887 @@ -571,16 +598,240 @@ void nsFilePicker::Done(void *file_choos |
1416 @@ -573,16 +600,240 @@ void nsFilePicker::Done(void* file_choos |
1888 mCallback->Done(result); |
1417 mCallback->Done(result); |
1889 mCallback = nullptr; |
1418 mCallback = nullptr; |
1890 } else { |
1419 } else { |
1891 mResult = result; |
1420 mResult = result; |
1892 } |
1421 } |
2116 + } |
1645 + } |
2117 + return NS_OK; |
1646 + return NS_OK; |
2118 + } |
1647 + } |
2119 + |
1648 + |
2120 // All below functions available as of GTK 3.20+ |
1649 // All below functions available as of GTK 3.20+ |
2121 void *nsFilePicker::GtkFileChooserNew(const gchar *title, GtkWindow *parent, |
1650 void* nsFilePicker::GtkFileChooserNew(const gchar* title, GtkWindow* parent, |
2122 GtkFileChooserAction action, |
1651 GtkFileChooserAction action, |
2123 const gchar *accept_label) { |
1652 const gchar* accept_label) { |
2124 static auto sGtkFileChooserNativeNewPtr = |
1653 static auto sGtkFileChooserNativeNewPtr = |
2125 (void *(*)(const gchar *, GtkWindow *, GtkFileChooserAction, |
1654 (void* (*)(const gchar*, GtkWindow*, GtkFileChooserAction, const gchar*, |
2126 const gchar *, |
1655 const gchar*))dlsym(RTLD_DEFAULT, |
2127 const gchar *))dlsym(RTLD_DEFAULT, |
1656 "gtk_file_chooser_native_new"); |
2128 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h |
1657 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h |
2129 --- a/widget/gtk/nsFilePicker.h |
1658 --- a/widget/gtk/nsFilePicker.h |
2130 +++ b/widget/gtk/nsFilePicker.h |
1659 +++ b/widget/gtk/nsFilePicker.h |
2131 @@ -67,16 +67,22 @@ class nsFilePicker : public nsBaseFilePi |
1660 @@ -67,16 +67,22 @@ class nsFilePicker : public nsBaseFilePi |
2132 nsString mDefaultExtension; |
1661 nsString mDefaultExtension; |
2133 |
1662 |
2134 nsTArray<nsCString> mFilters; |
1663 nsTArray<nsCString> mFilters; |
2135 nsTArray<nsCString> mFilterNames; |
1664 nsTArray<nsCString> mFilterNames; |
2136 |
1665 |
2137 private: |
1666 private: |
2138 static nsIFile *mPrevDisplayDirectory; |
1667 static nsIFile* mPrevDisplayDirectory; |
2139 |
1668 |
2140 + bool kdeRunning(); |
1669 + bool kdeRunning(); |
2141 + bool getKdeRunning(); |
1670 + bool getKdeRunning(); |
2142 + NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn); |
1671 + NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn); |
2143 + NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn); |
1672 + NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn); |
2144 + nsCString kdeMakeFilter( int index ); |
1673 + nsCString kdeMakeFilter( int index ); |
2145 + |
1674 + |
2146 void *GtkFileChooserNew(const gchar *title, GtkWindow *parent, |
1675 void* GtkFileChooserNew(const gchar* title, GtkWindow* parent, |
2147 GtkFileChooserAction action, |
1676 GtkFileChooserAction action, |
2148 const gchar *accept_label); |
1677 const gchar* accept_label); |
2149 void GtkFileChooserShow(void *file_chooser); |
1678 void GtkFileChooserShow(void* file_chooser); |
2150 void GtkFileChooserDestroy(void *file_chooser); |
1679 void GtkFileChooserDestroy(void* file_chooser); |
2151 void GtkFileChooserSetModal(void *file_chooser, GtkWindow *parent_widget, |
1680 void GtkFileChooserSetModal(void* file_chooser, GtkWindow* parent_widget, |
2152 gboolean modal); |
1681 gboolean modal); |
2153 |
1682 |
2154 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp |
1683 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp |
2155 --- a/xpcom/components/ManifestParser.cpp |
1684 --- a/xpcom/components/ManifestParser.cpp |
2156 +++ b/xpcom/components/ManifestParser.cpp |
1685 +++ b/xpcom/components/ManifestParser.cpp |
2170 struct ManifestDirective { |
1699 struct ManifestDirective { |
2171 const char* directive; |
1700 const char* directive; |
2172 int argc; |
1701 int argc; |
2173 |
1702 |
2174 bool ischrome; |
1703 bool ischrome; |
2175 @@ -392,16 +393,17 @@ void ParseManifest(NSLocationType aType, |
1704 @@ -393,16 +394,17 @@ void ParseManifest(NSLocationType aType, |
2176 NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled"); |
1705 NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled"); |
2177 NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired"); |
1706 NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired"); |
2178 NS_NAMED_LITERAL_STRING(kApplication, "application"); |
1707 NS_NAMED_LITERAL_STRING(kApplication, "application"); |
2179 NS_NAMED_LITERAL_STRING(kAppVersion, "appversion"); |
1708 NS_NAMED_LITERAL_STRING(kAppVersion, "appversion"); |
2180 NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion"); |
1709 NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion"); |
2188 #endif |
1717 #endif |
2189 |
1718 |
2190 NS_NAMED_LITERAL_STRING(kMain, "main"); |
1719 NS_NAMED_LITERAL_STRING(kMain, "main"); |
2191 NS_NAMED_LITERAL_STRING(kContent, "content"); |
1720 NS_NAMED_LITERAL_STRING(kContent, "content"); |
2192 |
1721 |
2193 @@ -447,39 +449,44 @@ void ParseManifest(NSLocationType aType, |
1722 @@ -448,39 +450,44 @@ void ParseManifest(NSLocationType aType, |
2194 CopyUTF8toUTF16(s, abi); |
1723 CopyUTF8toUTF16(s, abi); |
2195 abi.Insert(char16_t('_'), 0); |
1724 abi.Insert(char16_t('_'), 0); |
2196 abi.Insert(osTarget, 0); |
1725 abi.Insert(osTarget, 0); |
2197 } |
1726 } |
2198 } |
1727 } |
2199 } |
1728 } |
2200 |
1729 |
2201 nsAutoString osVersion; |
1730 nsAutoString osVersion; |
2202 + nsAutoString desktop; |
1731 + nsAutoString desktop; |
2203 #if defined(XP_WIN) |
1732 #if defined(XP_WIN) |
2204 #pragma warning(push) |
1733 # pragma warning(push) |
2205 #pragma warning(disable : 4996) // VC12+ deprecates GetVersionEx |
1734 # pragma warning(disable : 4996) // VC12+ deprecates GetVersionEx |
2206 OSVERSIONINFO info = {sizeof(OSVERSIONINFO)}; |
1735 OSVERSIONINFO info = {sizeof(OSVERSIONINFO)}; |
2207 if (GetVersionEx(&info)) { |
1736 if (GetVersionEx(&info)) { |
2208 nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", info.dwMajorVersion, |
1737 nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", info.dwMajorVersion, |
2209 info.dwMinorVersion); |
1738 info.dwMinorVersion); |
2210 } |
1739 } |
2211 + desktop = NS_LITERAL_STRING("win"); |
1740 + desktop = NS_LITERAL_STRING("win"); |
2212 #pragma warning(pop) |
1741 # pragma warning(pop) |
2213 #elif defined(MOZ_WIDGET_COCOA) |
1742 #elif defined(MOZ_WIDGET_COCOA) |
2214 SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor(); |
1743 SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor(); |
2215 SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor(); |
1744 SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor(); |
2216 nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", majorVersion, minorVersion); |
1745 nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", majorVersion, minorVersion); |
2217 + desktop = NS_LITERAL_STRING("macosx"); |
1746 + desktop = NS_LITERAL_STRING("macosx"); |
2233 process = kContent; |
1762 process = kContent; |
2234 } else { |
1763 } else { |
2235 process = kMain; |
1764 process = kMain; |
2236 } |
1765 } |
2237 |
1766 |
2238 @@ -566,25 +573,27 @@ void ParseManifest(NSLocationType aType, |
1767 @@ -567,25 +574,27 @@ void ParseManifest(NSLocationType aType, |
2239 TriState stOsVersion = eUnspecified; |
1768 TriState stOsVersion = eUnspecified; |
2240 TriState stOs = eUnspecified; |
1769 TriState stOs = eUnspecified; |
2241 TriState stABI = eUnspecified; |
1770 TriState stABI = eUnspecified; |
2242 TriState stProcess = eUnspecified; |
1771 TriState stProcess = eUnspecified; |
2243 #if defined(MOZ_WIDGET_ANDROID) |
1772 #if defined(MOZ_WIDGET_ANDROID) |
2261 CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, |
1790 CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, |
2262 stGeckoVersion)) { |
1791 stGeckoVersion)) { |
2263 continue; |
1792 continue; |
2264 } |
1793 } |
2265 |
1794 |
2266 @@ -621,17 +630,17 @@ void ParseManifest(NSLocationType aType, |
1795 @@ -622,17 +631,17 @@ void ParseManifest(NSLocationType aType, |
2267 } |
1796 } |
2268 |
1797 |
2269 LogMessageWithContext( |
1798 LogMessageWithContext( |
2270 aFile, line, "Unrecognized chrome manifest modifier '%s'.", token); |
1799 aFile, line, "Unrecognized chrome manifest modifier '%s'.", token); |
2271 ok = false; |
1800 ok = false; |
2283 |
1812 |
2284 if (directive->regfunc) { |
1813 if (directive->regfunc) { |
2285 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build |
1814 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build |
2286 --- a/xpcom/components/moz.build |
1815 --- a/xpcom/components/moz.build |
2287 +++ b/xpcom/components/moz.build |
1816 +++ b/xpcom/components/moz.build |
2288 @@ -44,12 +44,13 @@ LOCAL_INCLUDES += [ |
1817 @@ -66,16 +66,17 @@ LOCAL_INCLUDES += [ |
2289 '!..', |
1818 '!..', |
2290 '../base', |
1819 '../base', |
2291 '../build', |
1820 '../build', |
2292 '../ds', |
1821 '../ds', |
2293 '/chrome', |
1822 '/chrome', |
2295 '/layout/build', |
1824 '/layout/build', |
2296 '/modules/libjar', |
1825 '/modules/libjar', |
2297 + '/toolkit/xre', |
1826 + '/toolkit/xre', |
2298 ] |
1827 ] |
2299 |
1828 |
2300 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: |
1829 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': |
2301 CXXFLAGS += CONFIG['TK_CFLAGS'] |
1830 CXXFLAGS += CONFIG['TK_CFLAGS'] |
1831 |
|
1832 if CONFIG['MOZ_LAYOUT_DEBUGGER']: |
|
1833 DEFINES['MOZ_LAYOUT_DEBUGGER'] = True |
|
1834 |
|
2302 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp |
1835 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp |
2303 --- a/xpcom/io/nsLocalFileUnix.cpp |
1836 --- a/xpcom/io/nsLocalFileUnix.cpp |
2304 +++ b/xpcom/io/nsLocalFileUnix.cpp |
1837 +++ b/xpcom/io/nsLocalFileUnix.cpp |
2305 @@ -47,16 +47,17 @@ |
1838 @@ -47,16 +47,17 @@ |
2306 #include "prproces.h" |
1839 #include "prproces.h" |
2308 #include "nsSimpleEnumerator.h" |
1841 #include "nsSimpleEnumerator.h" |
2309 #include "private/pprio.h" |
1842 #include "private/pprio.h" |
2310 #include "prlink.h" |
1843 #include "prlink.h" |
2311 |
1844 |
2312 #ifdef MOZ_WIDGET_GTK |
1845 #ifdef MOZ_WIDGET_GTK |
2313 #include "nsIGIOService.h" |
1846 # include "nsIGIOService.h" |
2314 +#include "nsKDEUtils.h" |
1847 +# include "nsKDEUtils.h" |
2315 #endif |
1848 #endif |
2316 |
1849 |
2317 #ifdef MOZ_WIDGET_COCOA |
1850 #ifdef MOZ_WIDGET_COCOA |
2318 #include <Carbon/Carbon.h> |
1851 # include <Carbon/Carbon.h> |
2319 #include "CocoaFileUtils.h" |
1852 # include "CocoaFileUtils.h" |
2320 #include "prmem.h" |
1853 # include "prmem.h" |
2321 #include "plbase64.h" |
1854 # include "plbase64.h" |
2322 |
1855 |
2323 @@ -1902,62 +1903,77 @@ nsLocalFile::SetPersistentDescriptor(con |
1856 @@ -1902,62 +1903,77 @@ nsLocalFile::SetPersistentDescriptor(con |
2324 |
1857 |
2325 NS_IMETHODIMP |
1858 NS_IMETHODIMP |
2326 nsLocalFile::Reveal() { |
1859 nsLocalFile::Reveal() { |