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

Subscribers

People subscribed via source and target branches