Merge lp:~jr/firefox/firefox-3.6.head into lp:firefox/3.6

Proposed by Jonathan Riddell
Status: Merged
Approved by: Alexander Sack
Approved revision: 530
Merged at revision: not available
Proposed branch: lp:~jr/firefox/firefox-3.6.head
Merge into: lp:firefox/3.6
Diff against target: 2323 lines (+2275/-1)
6 files modified
debian/changelog (+12/-0)
debian/control (+1/-1)
debian/patches/firefox-kde.patch (+468/-0)
debian/patches/mozilla-kde.patch (+1787/-0)
debian/patches/series (+2/-0)
debian/rules (+5/-0)
To merge this branch: bzr merge lp:~jr/firefox/firefox-3.6.head
Reviewer Review Type Date Requested Status
Alexander Sack (community) Approve
Review via email: mp+19580@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jonathan Riddell (jr) wrote :

  * Apply KDE integration from openSUSE (LP: #494067)
    - add debian/patches/mozilla-kde.patch
    - add debian/patches/firefox-kde.patch
    - update debian/patches/series
    - update debian/rules
  * Add kmozillahelper to suggests of firefox
    - update debian/control

Revision history for this message
Alexander Sack (asac) wrote :

please dont change changelog lines in future that dont belong to your changes ... thanks! approved/merging.

review: Approve
Revision history for this message
Alexander Sack (asac) wrote :

also ... please provide a follow up merge request for the copying in debian/rules ... this needs to happen in a postcommand of the orig-source creation ... otherwise creating/maintaining patches becomes a pain. Thanks!

review: Approve

Preview Diff

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

Subscribers

People subscribed via source and target branches