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