Merge lp:~debfx/firefox/firefox-4.0-kde into lp:firefox/trunk
- firefox-4.0-kde
- Merge into firefox-trunk.head
Status: | Superseded |
---|---|
Proposed branch: | lp:~debfx/firefox/firefox-4.0-kde |
Merge into: | lp:firefox/trunk |
Diff against target: |
2187 lines (+2124/-2) 7 files modified
debian/changelog (+10/-0) debian/control (+1/-1) debian/control.pp (+1/-1) debian/patches/firefox-kde.patch (+458/-0) debian/patches/mozilla-kde.patch (+1647/-0) debian/patches/series (+2/-0) debian/rules (+5/-0) |
To merge this branch: | bzr merge lp:~debfx/firefox/firefox-4.0-kde |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mozilla Team | Pending | ||
Review via email: mp+36791@code.launchpad.net |
Commit message
Description of the change
* Re-add KDE integration
- add debian/
- add debian/
- update debian/
- update debian/rules
* Make firefox-4.0 and abrowser-4.0 suggest firefox-kde-support
- update debian/control
- 672. By Chris Coulson
-
* Add support for running debhelper files through the Mozilla text
preprocessor. This means we'll be able to support the different build
configurations without having a huge debian/rules with lots of logic in
- update debian/rules - 673. By Chris Coulson
-
* Some cosmetic changes to debian/rules - the includes are all near to the top now, where people expect them to be
* Generate the pre-processed packaging files earlier in the build, else it fails - 674. By Chris Coulson
-
* Fix DEB_MIN_SYSDEPS again, so it should be possible to build with either option again. Note that FF-on-XR is totally untested
- 675. By Chris Coulson
-
* Install Ubuntu preferences as vendor.js
- 676. By Chris Coulson
-
* Create the buildsymbols in common-
install- arch, and move the installation in to debhelper files
- update debian/rules
- update debian/firefox- core.install. pp
- add debian/firefox- mozsymbols. install. pp
* Remember to preprocess firefox.dirs.in and abrowser.dirs.in
- update debian/rules - 677. By Chris Coulson
-
Merge from lp:firefox
- 678. By Chris Coulson
-
* Blacklist plugin-container in Apport for DEB_MIN_SYSDEPS builds
- rename debian/apport/ firefox. in => debian/ apport/ firefox. pp
- update debian/apport/ firefox. pp - 679. By Chris Coulson
-
* Refresh patches
- update debian/patches/ browser_ branding. patch
- update ebian/patches/bz591331_ att469858_ breakpad_ allow_ptrace. patch
- update debian/patches/ lp548866_ bz467766_ att351173- dont-reset- user-prefs- on-upgrade. patch - 680. By Chris Coulson
-
* Disable more IPC tests which are causing the builds to hang
- update debian/testsuite.mk - 681. By Chris Coulson
-
* Preprocess the debhelper files as a dependency of pre-build rather than common-
install- arch. I only moved it when I was including config/automake.mk (which assumes that the configure is already done)
- update debian/rules - 682. By Chris Coulson
-
* Build with "make -f client.mk" and using a mozconfig, rather than the
autoconf/configure/ make steps used previously. The client.mk contains the
sequencing for doing PGO builds
- update debian/firefox- mozsymbols. install. pp
- add debian/mozconfig.pp
- update debian/rules - 683. By Chris Coulson
-
* Create the build symbols after running make install, else dh_strip fails later on
- update debian/rules - 684. By Chris Coulson
-
* Export MOZILLA_OFFICIAL to the environment rather than putting it in mozconfig (which doesn't work)
- update debian/rules
- update debian/mozconfig.pp - 685. By Chris Coulson
-
* Don't hardcode MOZ_OBJDIR and DEB_BUILDDIR in the various places it is used
- update debian/rules
- update debian/firefox- mozsymbols. install. pp - 686. By Chris Coulson
-
* Drop the functionality to disable patches on a pre-release basis - we're not actually using it in this branch yet. We can always bring it back again if we need it
- 687. By Chris Coulson
-
* Don't export @BINREAL@ from debian/rules - this was an unnecessary hack not needed now we are using a preprocessor
- update debian/rules
- update debian/apport/ firefox. pp - 688. By Chris Coulson
-
* Tidy up the testsuite code a little
- 689. By Chris Coulson
-
Oops, MOZ_OBJDIR needs to be defined before including testsuite.mk
- 690. By Chris Coulson
-
B'ah! Set MOZ_OBJDIR correctly now
- 691. By Chris Coulson
-
* Merge 2 targets in debian/rules (again). Move the installation of the desktop files and Apparmor profile in to the debhelper files
- update debian/rules
- update debian/firefox. install. pp
- remove debian/firefox. dirs.in
- update debian/firefox- core.install. pp
- update debian/abrowser. install. pp
- remove debian/abrowser. dirs.in - 692. By Chris Coulson
-
* Don't use relative paths in testsuite.mk - especially for , as this breaks the testsuite
- update debian/testsuite.mk - 693. By Chris Coulson
-
* Improve dependency tracking in the build, which also means the test-suite doesn't run twice
- update debian/testsuite.mk
- update debian/rules - 694. By Chris Coulson
-
* Fix an issue with a missing leading slash on some paths, caused by r691
- update debian/usr.bin. firefox. apparmor. 10.10
- update debian/usr.bin. firefox. apparmor. 10.04
- update debian/usr.bin. firefox. apparmor. 9.10
- update debian/firefox. sh.in
- update debian/rules - 695. By Chris Coulson
-
* General tidy-ups in debian/rules
- 696. By Chris Coulson
-
* Fix an issue substituting the branding name in to the desktop file. The intention was that the pre-release versions would have the version number in the name
- update debian/rules - 697. By Chris Coulson
-
* Add support for building with PGO. Add a build option (DEB_BUILD_PGO)
which will run the build with make -f client.mk profiledbuild. This is
off by default, and requires GCC 4.5 anyway
- update debian/rules
- update debian/mozconfig.pp - 698. By Chris Coulson
-
* Disable some new IPC tests
- update debian/testsuite.mk - 699. By Chris Coulson
-
* Drop debian/
patches/ bz591331_ att469858_ breakpad_ allow_ptrace. patch again now it's landed upstream - 700. By Jamie Strandboge
-
AppArmor: allow mmap for temporary files that we own (LP: #662918)
- 701. By Jamie Strandboge
-
* AppArmor
- add owner read to environ and auxv in @{PROC} as well as
/etc/lsb-release read and expr ix for the crash reporter - 702. By Jamie Strandboge
-
update path for Xubuntu default settings (LP: #664093)
- 703. By Chris Coulson
-
* Refresh patches after landing of (bmo: 601830) aka app.update.
url.manual for
nightly builds should point to the nightly builds
- update debian/patches/ firefox- profilename. patch - 704. By Chris Coulson
-
* Fix a typo
- 705. By Chris Coulson
-
* Add temporary change to clean up rogue Apparmor profile on upgrade for
current nightly testers
- update debian/firefox- core.preinst. in - 706. By Chris Coulson
-
* Disable gnomevfs support on >= 11.04 (LP: #661287)
- update debian/rules
- update debian/mozconfig.pp - 707. By Chris Coulson
-
* Run all pre-processed files through the Mozilla preprocessor, rather than having 2 steps (using sed)
- 708. By Chris Coulson
-
* Drop abrowser from the Firefox source package:
- remove debian/abrowser- gnome-support. install. in
- remove debian/abrowser- gnome-support. postinst. in
- remove debian/abrowser- gnome-support. prerm.in
- remove debian/abrowser. desktop. in
- remove debian/abrowser. install. in
- remove debian/abrowser. links.in
- remove debian/abrowser. xml.in
- update debian/control
- rename debian/firefox- core.dirs. in => debian/ firefox. dirs.in
- rename debian/firefox- core.docs. in => debian/ firefox. docs.in
- remove debian/firefox. install. in
- rename debian/firefox- core.install. in => debian/ firefox. install. in
- update debian/firefox. install. in
- remove debian/firefox. links.in
- rename debian/firefox- core.links. in => debian/ firefox. links.in
- update debian/firefox. links.in
- rename debian/firefox- core.postinst. in => debian/ firefox. postinst. in
- rename debian/firefox- core.postrm. in => debian/ firefox. postrm. in
- rename debian/firefox- core.preinst. in => debian/ firefox. preinst. in
- rename debian/firefox- core.prerm. in => debian/ firefox. prerm.in
- update debian/firefox. sh.in
- update debian/mozclient/ firefox- 4.0.conf
- remove debian/patches/ awesome_ branding_ updates. patch
- remove debian/patches/ browser_ branding. patch
- update debian/patches/ series
- update debian/rules
- remove debian/ubuntu- abrowser. js.in - 709. By Chris Coulson
-
* New upstream snapshot 4.0 B8 HG20101103r56843
- 710. By Chris Coulson
-
* Don't build with -pie on Natty (LP: #663294)
- update debian/rules - 711. By Chris Coulson
-
* Fix a couple of small errors
- 712. By Chris Coulson
-
Revert r707 for now, as the preprocessor chokes on the include's in the apparmor profile
- 713. By Chris Coulson
-
* Revert a change from r711 too
- 714. By Chris Coulson
-
* Auto-generate debian/control in the clean target, auto-populating
the build-depends
- add debian/control.pp
- update debian/rules
- update debian/mozconfig.pp - 715. By Chris Coulson
-
* Don't autogenerate debian/control automatically, it's too fragile. And work around a CDBS issue. *sigh*
- 716. By Chris Coulson
-
* Actually, revert the last commit. We should autogenerate debian/control in the clean target
- 717. By Chris Coulson
-
* Fix the logic for switching off gnomevfs support
- 718. By Chris Coulson
-
* Enable GIO support
- update debian/mozconfig.pp - 719. By Chris Coulson
-
* Fix the case where gnomevfs is disabled
- 720. By Chris Coulson
-
* Drop unneeded patches
- remove debian/patches/ bz386904_ config_ rules_install_ dist_files. patch
- remove debian/patches/ ftbfs_crashrepo rter.patch
- update debian/patches/ series - 721. By Chris Coulson
-
* Rewrite the launcher script to not wrap around the upstream start
scripts, but start the Firefox binary directly. The upstream start scripts
contain a lot of complexity for dealing with things that we don't need to
worry about, and are quite slow. Also, add in the hooks for the new
profile migrator
- update debian/firefox. sh.in - 722. By Chris Coulson
-
* Replace the old profile migrator. The previous one relied on hard-coded
values and fragile shell script that isn't really scalable enough
now that stable Ubuntu releases see new major Firefox versions. The
new profile migrator doesn't require any hard-coded values, and should
be lower maintenance
- add debian/migrator/ xulapp- profilemigrator
- remove debian/migrator/ main.c
- update debian/rules
- update debian/firefox. sh.in
- update debian/firefox. install. pp
- update debian/control - 723. By Chris Coulson
-
* Don't run debian/control through the pre-processor, to avoid having to run pre-build as part of clean
- 724. By Chris Coulson
-
* Add a license header to the profile migrator
- 725. By Chris Coulson
-
* Fix a small error
- 726. By Chris Coulson
-
* Automate the checking of the version-compare logic in the profile migrator
- 727. By Chris Coulson
-
* Fix python-gtk2 depends
- 728. By Chris Coulson
-
* Display the StartupWMClass as the browser name in the profile migrator
- 729. By Chris Coulson
-
* Set WM Class and icon name on the dialog, and also make the primary text bigger
- 730. By Chris Coulson
-
* Add quotes around STARTUP_WM_CLASS in debian/
firefox. sh.in, just in case the implementation has spaces in it - 731. By Chris Coulson
-
* Refresh patches after landing of bmo: 596075 aka Move First-Run Video To
Be A Tab Pointing To A Mozilla-Hosted Web Page
- update debian/patches/ firefox- profilename
* Refresh patches after landing of bmo: 588410 aka Fix make install to
work with omnijar
- remove debian/patches/ bz588410_ fix_make_ install_ with_omnijar. patch
- update debian/patches/ series
* Don't install run-mozilla.sh and upstream firefox shell script
- update debian/firefox. install. pp
* Fix launcher script to work with FF-on-XR builds
- rename debian/firefox. sh.in => debian/ firefox. sh.pp
- update debian/firefox. sh.pp - 732. By Chris Coulson
-
* When importing settings from a beta profile, don't abandon the source profile. This was only necessary with the previous profile migrator because it triggered the dialog on discovery of non-abandoned beta profiles. The new one doesn't require this.
This means that the profile migrator now supports persistently named profiles, such as firefox-next and firefox-trunk, without breaking them every time the branch series is updated
- 733. By Chris Coulson
-
* Add another hunk for the last commit
- 734. By Chris Coulson
-
* Make the ASKLATER option in the profile migrator work correctly by writing the old series version to the state file if it doesn't already exists, so it triggers the migrator again on the next run
- 735. By Chris Coulson
-
* Fix some syntax errors in various places
- 736. By Chris Coulson
-
* Port bz460917_
att350845_ reload_ new_plugins to Firefox 4 so that
we can start the plugin installer without throwing an exception
- update debian/patches/ bz460917_ att350845_ reload_ new_plugins. patch - 737. By Chris Coulson
-
* Revert the compile-time checks to run-time checks in the launcher
script, as the preprocessor removes the #!/bin/sh line
- rename debian/firefox. sh.pp => debian/ firefox. sh.in
- update debian/firefox. sh.in
- update debian/rules - 738. By Chris Coulson
-
* Change the marker used by the preprocessor to %% (rather than #). This means we can run everything through the preprocessor without removing comments or other import lines from shell scripts, and means we drop the second step of running everythinh through sed
- 739. By Chris Coulson
-
* Remove an unneeded step from clean
- 740. By Chris Coulson
-
* Don't use update-notifier for the restart required notification - it
is redundant having 2 separate mechanisms, and the update-notifier
notification was never translated properly anyway. This means we rely
on the in-browser notification from ubufox
- remove debian/firefox- restart- required. update- notifier. in
- update debian/firefox. install. in
- update debian/firefox. postinst. in
- update debian/rules - 741. By Chris Coulson
-
* Build with --enable-jsd in the hope that Venkman might start working
- update debian/mozconfig.in - 742. By Chris Coulson
-
* Make sure our vendor.js preferences are included in the build
- rename debian/ubuntu- firefox. js.in => debian/vendor.js.in
- update debian/rules
- update debian/patches/ install_ ubuntu_ prefs.patch - 743. By Chris Coulson
-
* Don't build with --enable-jsd, venkman is just totally broken on FF4.0 right now
- 744. By Chris Coulson
-
* Really don't build with -pie this time
- 745. By Chris Coulson
-
* Rebase patches after landing of bmo: 606289 aka Fix logo link in about:
- update debian/patches/ firefox- profilename - 746. By Chris Coulson
-
* Add x-scheme-handler magic to desktop files
- update debian/firefox. desktop. in
- update debian/firefox- beta.desktop. in
- update debian/firefox- nightly. desktop. in
- update debian/firefox- unofficial. desktop. in - 747. By Chris Coulson
-
* Revert r708 and add abrowser again
- 748. By Chris Coulson
-
* New upstream snapshot 4.0 B8 HG 20101115r57519
- 749. By Chris Coulson
-
* Consolidate some of the variables used in the debhelper files
* Add a fix for dealing with unversioned source packages
* Drop part of firefox-fsh to not hard-code the install locations to Firefox. This guarantees that we'll
remain parallel installable with Firefox in Natty for now - 750. By Chris Coulson
-
* Fix the profile migrator to not crash on profiles where
'LastVersion=Safe Mode' (LP: #674607)
- update debian/migrator/ xulapp- profilemigrator - 751. By Chris Coulson
-
* Bump minimum NSS / NSPR version
- update debian/rules
* Fix the profile migrator to not hang when ~/.mozilla doesn't exist, and
other improvements- update debian/migrator/ xulapp- profilemigrator
- update debian/migrator/ xulapp- profilemigrator
* Build with --enable-startup- notification again, this got dropped
in the 3.6 => 4.0 update
- update debian/mozconfig.in
* Ship the testpilot extension for beta as per the official builds, based
on the discussion on #developers. We achieve this by building with
--enable-update- channel= beta for the beta milestones only. The update
channel isn't used anywhere at runtime because we disable the updater.
This means that Ubuntu users can participate in testpilot user studies
in Natty
- update debian/rules
- update debian/firefox- core.install. in
- update debian/mozconfig.in
* Add a hack to the launcher to handle being launched from an alternative,
which is a symlink to the launcher script, and breaks the current launch
mechanism. Also remove a useless stat() from the current script
- update debian/firefox. sh.in
* Re-add patch that got dropped to not remove and re-add search plugins
during upgrade
- add debian/patches/ bz534663_ attXXX_ normalize_ distribution_ searchplugins. patch
- update debian/patches/ series - 752. By Chris Coulson
-
Really add patch this time
- 753. By Jamie Strandboge
-
pull in natty apparmor changes
- 754. By Chris Coulson
-
* Move libmozgnome.so to the main package in common-
binary- predeb- arch.
The previous method of deleting it from -gnome-support and copying it to
the main package from debian/tmp in each of the binary-predeb targets
meant that we were shipping an unstripped copy, which caused a lintian
error. This new method ensures we retain the stripped SO and we still
only move it after dh_shlibdeps has run
- update debian/rules - 755. By Chris Coulson
-
* Refresh patches
- 756. By Jamie Strandboge
-
update AppArmor profiles to what is in firefox-4.0
- 757. By Micah Gersten
-
* Change xubuntu applications defaults list in natty apparmor profile; Path
changed in xubuntu-default- settings (11.04.0)
- update usr.bin.firefox. apparmor. 11.04 - 758. By Jamie Strandboge
-
debian/
usr.bin. firefox. apparmor. 11.04: remove redundant abstractions - 759. By Chris Coulson
-
* Merge from lp:~debfx/firefox/firefox-4.0-kde
- 760. By Chris Coulson
-
* Generate the en-US xpi at build time again for importing in to Launchpad
- update debian/rules
- update debian/translation- support/ install. rdf.in - 761. By Felix Geyer
-
Refresh KDE patches
Unmerged revisions
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2010-11-16 22:53:52 +0000 |
3 | +++ debian/changelog 2010-11-19 17:04:04 +0000 |
4 | @@ -585,6 +585,16 @@ |
5 | - update debian/control |
6 | - update debian/rules |
7 | |
8 | + [ Felix Geyer <debfx-pkg@fobos.de> ] |
9 | + * Re-add KDE integration |
10 | + - add debian/patches/mozilla-kde.patch |
11 | + - add debian/patches/firefox-kde.patch |
12 | + - update debian/patches/series |
13 | + - update debian/rules |
14 | + * Make firefox-4.0 suggest firefox-kde-support |
15 | + - update debian/control |
16 | + - update debian/control.pp |
17 | + |
18 | -- Chris Coulson <chris.coulson@canonical.com> Tue, 16 Nov 2010 22:53:20 +0000 |
19 | |
20 | firefox-3.6 (3.6~a2~hg20090810r31291+nobinonly-0ubuntu1) UNRELEASED; urgency=low |
21 | |
22 | === modified file 'debian/control' |
23 | --- debian/control 2010-11-05 22:16:57 +0000 |
24 | +++ debian/control 2010-11-19 17:04:04 +0000 |
25 | @@ -59,7 +59,7 @@ |
26 | kubuntu-firefox-installer, |
27 | firefox-4.0-gnome-support, |
28 | firefox-4.0-core |
29 | -Suggests: firefox-4.0-gnome-support (= ${binary:Version}), |
30 | +Suggests: firefox-4.0-gnome-support (= ${binary:Version}) | firefox-kde-support, |
31 | latex-xft-fonts, |
32 | libthai0 |
33 | XB-Xul-AppId: {ec8030f7-c20a-464f-9b0e-13a3a9e97384} |
34 | |
35 | === modified file 'debian/control.pp' |
36 | --- debian/control.pp 2010-11-15 17:52:02 +0000 |
37 | +++ debian/control.pp 2010-11-19 17:04:04 +0000 |
38 | @@ -50,7 +50,7 @@ |
39 | @APPNAME_OTHER@ |
40 | Replaces: firefox-4.0-branding, |
41 | kubuntu-firefox-installer |
42 | -Suggests: @APPNAME@-gnome-support (= ${binary:Version}) |
43 | +Suggests: @APPNAME@-gnome-support (= ${binary:Version}) | firefox-kde-support |
44 | XB-Xul-AppId: {ec8030f7-c20a-464f-9b0e-13a3a9e97384} |
45 | Description: Safe and easy web browser from Mozilla |
46 | Firefox delivers safe, easy web browsing. A familiar user interface, |
47 | |
48 | === added file 'debian/patches/firefox-kde.patch' |
49 | --- debian/patches/firefox-kde.patch 1970-01-01 00:00:00 +0000 |
50 | +++ debian/patches/firefox-kde.patch 2010-11-19 17:04:04 +0000 |
51 | @@ -0,0 +1,458 @@ |
52 | +diff -Nur a/browser/app/Makefile.in b/browser/app/Makefile.in |
53 | +--- a/browser/app/Makefile.in |
54 | ++++ b/browser/app/Makefile.in |
55 | +@@ -49,6 +49,7 @@ |
56 | + |
57 | + PREF_JS_EXPORTS = $(srcdir)/profile/firefox.js \ |
58 | + $(srcdir)/profile/channel-prefs.js \ |
59 | ++ $(srcdir)/profile/kde.js \ |
60 | + $(NULL) |
61 | + |
62 | + |
63 | +diff -Nur a/browser/base/content/browser-kde.xul b/browser/base/content/browser-kde.xul |
64 | +--- a/browser/base/content/browser-kde.xul |
65 | ++++ b/browser/base/content/browser-kde.xul |
66 | +@@ -194,7 +194,7 @@ |
67 | + </row> |
68 | + <vbox id="editBookmarkPanelContent" flex="1" hidden="true"/> |
69 | + <hbox id="editBookmarkPanelBottomButtons" pack="end"> |
70 | +-#ifndef XP_UNIX |
71 | ++#ifdef XP_UNIX |
72 | + <button id="editBookmarkPanelDoneButton" |
73 | + class="editBookmarkPanelBottomButton" |
74 | + label="&editBookmark.done.label;" |
75 | +diff -Nur a/browser/base/jar.mn b/browser/base/jar.mn |
76 | +--- a/browser/base/jar.mn |
77 | ++++ b/browser/base/jar.mn |
78 | +@@ -25,6 +25,8 @@ |
79 | + * content/browser/browser.css (content/browser.css) |
80 | + * content/browser/browser.js (content/browser.js) |
81 | + * content/browser/browser.xul (content/browser.xul) |
82 | ++* content/browser/browser-kde.xul (content/browser-kde.xul) |
83 | ++% override chrome://browser/content/browser.xul chrome://browser/content/browser-kde.xul desktop=kde |
84 | + * content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml) |
85 | + * content/browser/fullscreen-video.xhtml (content/fullscreen-video.xhtml) |
86 | + * content/browser/inspector.html (content/inspector.html) |
87 | +diff -Nur a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp |
88 | +--- a/browser/components/build/nsModule.cpp |
89 | ++++ b/browser/components/build/nsModule.cpp |
90 | +@@ -46,7 +46,7 @@ |
91 | + #elif defined(XP_MACOSX) |
92 | + #include "nsMacShellService.h" |
93 | + #elif defined(MOZ_WIDGET_GTK2) |
94 | +-#include "nsGNOMEShellService.h" |
95 | ++#include "nsUnixShellService.h" |
96 | + #endif |
97 | + |
98 | + #ifndef WINCE |
99 | +@@ -89,8 +89,6 @@ |
100 | + NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService) |
101 | + #elif defined(XP_MACOSX) |
102 | + NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService) |
103 | +-#elif defined(MOZ_WIDGET_GTK2) |
104 | +-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init) |
105 | + #endif |
106 | + |
107 | + #ifndef WINCE |
108 | +@@ -156,7 +154,7 @@ |
109 | + #if defined(XP_WIN) |
110 | + { &kNS_SHELLSERVICE_CID, false, NULL, nsWindowsShellServiceConstructor }, |
111 | + #elif defined(MOZ_WIDGET_GTK2) |
112 | +- { &kNS_SHELLSERVICE_CID, false, NULL, nsGNOMEShellServiceConstructor }, |
113 | ++ { &kNS_SHELLSERVICE_CID, false, NULL, nsUnixShellServiceConstructor }, |
114 | + #endif |
115 | + { &kNS_FEEDSNIFFER_CID, false, NULL, nsFeedSnifferConstructor }, |
116 | + { &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, NULL, AboutRedirector::Create }, |
117 | +diff -Nur a/browser/components/shell/src/Makefile.in b/browser/components/shell/src/Makefile.in |
118 | +--- a/browser/components/shell/src/Makefile.in |
119 | ++++ b/browser/components/shell/src/Makefile.in |
120 | +@@ -57,7 +57,8 @@ |
121 | + CPPSRCS = nsMacShellService.cpp |
122 | + else |
123 | + ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2) |
124 | +-CPPSRCS = nsGNOMEShellService.cpp |
125 | ++CPPSRCS = nsUnixShellService.cpp nsGNOMEShellService.cpp nsKDEShellService.cpp |
126 | ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
127 | + endif |
128 | + endif |
129 | + endif |
130 | +diff -Nur a/browser/components/shell/src/nsKDEShellService.cpp b/browser/components/shell/src/nsKDEShellService.cpp |
131 | +--- a/browser/components/shell/src/nsKDEShellService.cpp |
132 | ++++ b/browser/components/shell/src/nsKDEShellService.cpp |
133 | +@@ -0,0 +1,193 @@ |
134 | ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
135 | ++/* ***** BEGIN LICENSE BLOCK ***** |
136 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
137 | ++ * |
138 | ++ * The contents of this file are subject to the Mozilla Public License Version |
139 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
140 | ++ * the License. You may obtain a copy of the License at |
141 | ++ * http://www.mozilla.org/MPL/ |
142 | ++ * |
143 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
144 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
145 | ++ * for the specific language governing rights and limitations under the |
146 | ++ * License. |
147 | ++ * |
148 | ++ * The Original Code is Shell Service. |
149 | ++ * |
150 | ++ * The Initial Developer of the Original Code is mozilla.org. |
151 | ++ * Portions created by the Initial Developer are Copyright (C) 2004 |
152 | ++ * the Initial Developer. All Rights Reserved. |
153 | ++ * |
154 | ++ * Contributor(s): |
155 | ++ * |
156 | ++ * Alternatively, the contents of this file may be used under the terms of |
157 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
158 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
159 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
160 | ++ * of those above. If you wish to allow use of your version of this file only |
161 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
162 | ++ * use your version of this file under the terms of the MPL, indicate your |
163 | ++ * decision by deleting the provisions above and replace them with the notice |
164 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
165 | ++ * the provisions above, a recipient may use your version of this file under |
166 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
167 | ++ * |
168 | ++ * ***** END LICENSE BLOCK ***** */ |
169 | ++ |
170 | ++#include "nsKDEShellService.h" |
171 | ++#include "nsShellService.h" |
172 | ++#include "nsKDEUtils.h" |
173 | ++#include "nsCOMPtr.h" |
174 | ++#include "nsIPrefService.h" |
175 | ++#include "nsIProcess.h" |
176 | ++#include "nsILocalFile.h" |
177 | ++#include "nsServiceManagerUtils.h" |
178 | ++#include "nsComponentManagerUtils.h" |
179 | ++ |
180 | ++nsresult |
181 | ++nsKDEShellService::Init() |
182 | ++ { |
183 | ++ if( !nsKDEUtils::kdeSupport()) |
184 | ++ return NS_ERROR_NOT_AVAILABLE; |
185 | ++ return NS_OK; |
186 | ++ } |
187 | ++ |
188 | ++NS_IMPL_ISUPPORTS1(nsKDEShellService, nsIShellService) |
189 | ++ |
190 | ++NS_IMETHODIMP |
191 | ++nsKDEShellService::IsDefaultBrowser(PRBool aStartupCheck, |
192 | ++ PRBool* aIsDefaultBrowser) |
193 | ++ { |
194 | ++ *aIsDefaultBrowser = PR_FALSE; |
195 | ++ if (aStartupCheck) |
196 | ++ mCheckedThisSession = PR_TRUE; |
197 | ++ nsCStringArray command; |
198 | ++ command.AppendCString( NS_LITERAL_CSTRING( "ISDEFAULTBROWSER" )); |
199 | ++ if( nsKDEUtils::command( command )) |
200 | ++ *aIsDefaultBrowser = PR_TRUE; |
201 | ++ return NS_OK; |
202 | ++ } |
203 | ++ |
204 | ++NS_IMETHODIMP |
205 | ++nsKDEShellService::SetDefaultBrowser(PRBool aClaimAllTypes, |
206 | ++ PRBool aForAllUsers) |
207 | ++ { |
208 | ++ nsCStringArray command; |
209 | ++ command.AppendCString( NS_LITERAL_CSTRING( "SETDEFAULTBROWSER" )); |
210 | ++ command.AppendCString( aClaimAllTypes ? NS_LITERAL_CSTRING( "ALLTYPES" ) : NS_LITERAL_CSTRING( "NORMAL" )); |
211 | ++ return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
212 | ++ } |
213 | ++ |
214 | ++NS_IMETHODIMP |
215 | ++nsKDEShellService::GetShouldCheckDefaultBrowser(PRBool* aResult) |
216 | ++{ |
217 | ++ // If we've already checked, the browser has been started and this is a |
218 | ++ // new window open, and we don't want to check again. |
219 | ++ if (mCheckedThisSession) { |
220 | ++ *aResult = PR_FALSE; |
221 | ++ return NS_OK; |
222 | ++ } |
223 | ++ |
224 | ++ nsCOMPtr<nsIPrefBranch> prefs; |
225 | ++ nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID)); |
226 | ++ if (pserve) |
227 | ++ pserve->GetBranch("", getter_AddRefs(prefs)); |
228 | ++ |
229 | ++ if (prefs) |
230 | ++ prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult); |
231 | ++ |
232 | ++ return NS_OK; |
233 | ++} |
234 | ++ |
235 | ++NS_IMETHODIMP |
236 | ++nsKDEShellService::SetShouldCheckDefaultBrowser(PRBool aShouldCheck) |
237 | ++{ |
238 | ++ nsCOMPtr<nsIPrefBranch> prefs; |
239 | ++ nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID)); |
240 | ++ if (pserve) |
241 | ++ pserve->GetBranch("", getter_AddRefs(prefs)); |
242 | ++ |
243 | ++ if (prefs) |
244 | ++ prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck); |
245 | ++ |
246 | ++ return NS_OK; |
247 | ++} |
248 | ++ |
249 | ++NS_IMETHODIMP |
250 | ++nsKDEShellService::SetDesktopBackground(nsIDOMElement* aElement, |
251 | ++ PRInt32 aPosition) |
252 | ++ { |
253 | ++ return NS_ERROR_NOT_IMPLEMENTED; |
254 | ++ } |
255 | ++ |
256 | ++NS_IMETHODIMP |
257 | ++nsKDEShellService::GetDesktopBackgroundColor(PRUint32 *aColor) |
258 | ++ { |
259 | ++ return NS_ERROR_NOT_IMPLEMENTED; |
260 | ++ } |
261 | ++ |
262 | ++NS_IMETHODIMP |
263 | ++nsKDEShellService::SetDesktopBackgroundColor(PRUint32 aColor) |
264 | ++ { |
265 | ++ return NS_ERROR_NOT_IMPLEMENTED; |
266 | ++ } |
267 | ++ |
268 | ++NS_IMETHODIMP |
269 | ++nsKDEShellService::OpenApplication(PRInt32 aApplication) |
270 | ++ { |
271 | ++ nsCStringArray command; |
272 | ++ if( aApplication == APPLICATION_MAIL ) |
273 | ++ command.AppendCString( NS_LITERAL_CSTRING( "OPENMAIL" )); |
274 | ++ else if( aApplication == APPLICATION_NEWS ) |
275 | ++ command.AppendCString( NS_LITERAL_CSTRING( "OPENNEWS" )); |
276 | ++ else |
277 | ++ return NS_ERROR_NOT_IMPLEMENTED; |
278 | ++ return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
279 | ++ } |
280 | ++ |
281 | ++NS_IMETHODIMP |
282 | ++nsKDEShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const nsACString& aURI) |
283 | ++ { |
284 | ++ nsCStringArray command; |
285 | ++ command.AppendCString( NS_LITERAL_CSTRING( "RUN" )); |
286 | ++ nsCString app; |
287 | ++ nsresult rv = aApplication->GetNativePath( app ); |
288 | ++ NS_ENSURE_SUCCESS( rv, rv ); |
289 | ++ command.AppendCString( app ); |
290 | ++ command.AppendCString( aURI ); |
291 | ++ return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
292 | ++ } |
293 | ++ |
294 | ++NS_IMETHODIMP |
295 | ++nsKDEShellService::GetDefaultFeedReader(nsILocalFile** _retval) |
296 | ++ { |
297 | ++ *_retval = nsnull; |
298 | ++ |
299 | ++ nsCStringArray command; |
300 | ++ command.AppendCString( NS_LITERAL_CSTRING( "GETDEFAULTFEEDREADER" )); |
301 | ++ nsCStringArray output; |
302 | ++ if( !nsKDEUtils::command( command, &output ) || output.Count() != 1 ) |
303 | ++ return NS_ERROR_FAILURE; |
304 | ++ |
305 | ++ nsCString path; |
306 | ++ path = *output[ 0 ]; |
307 | ++ if (path.IsEmpty()) |
308 | ++ return NS_ERROR_FAILURE; |
309 | ++ |
310 | ++ nsresult rv; |
311 | ++ nsCOMPtr<nsILocalFile> defaultReader = |
312 | ++ do_CreateInstance("@mozilla.org/file/local;1", &rv); |
313 | ++ NS_ENSURE_SUCCESS(rv, rv); |
314 | ++ |
315 | ++ rv = defaultReader->InitWithNativePath(path); |
316 | ++ NS_ENSURE_SUCCESS(rv, rv); |
317 | ++ |
318 | ++ PRBool exists; |
319 | ++ rv = defaultReader->Exists(&exists); |
320 | ++ NS_ENSURE_SUCCESS(rv, rv); |
321 | ++ if (!exists) |
322 | ++ return NS_ERROR_FAILURE; |
323 | ++ |
324 | ++ NS_ADDREF(*_retval = defaultReader); |
325 | ++ return NS_OK; |
326 | ++ } |
327 | +diff -Nur a/browser/components/shell/src/nsKDEShellService.h b/browser/components/shell/src/nsKDEShellService.h |
328 | +--- a/browser/components/shell/src/nsKDEShellService.h |
329 | ++++ b/browser/components/shell/src/nsKDEShellService.h |
330 | +@@ -0,0 +1,59 @@ |
331 | ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
332 | ++/* ***** BEGIN LICENSE BLOCK ***** |
333 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
334 | ++ * |
335 | ++ * The contents of this file are subject to the Mozilla Public License Version |
336 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
337 | ++ * the License. You may obtain a copy of the License at |
338 | ++ * http://www.mozilla.org/MPL/ |
339 | ++ * |
340 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
341 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
342 | ++ * for the specific language governing rights and limitations under the |
343 | ++ * License. |
344 | ++ * |
345 | ++ * The Original Code is Shell Service. |
346 | ++ * |
347 | ++ * The Initial Developer of the Original Code is mozilla.org. |
348 | ++ * Portions created by the Initial Developer are Copyright (C) 2004 |
349 | ++ * the Initial Developer. All Rights Reserved. |
350 | ++ * |
351 | ++ * Contributor(s): |
352 | ++ * |
353 | ++ * Alternatively, the contents of this file may be used under the terms of |
354 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
355 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
356 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
357 | ++ * of those above. If you wish to allow use of your version of this file only |
358 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
359 | ++ * use your version of this file under the terms of the MPL, indicate your |
360 | ++ * decision by deleting the provisions above and replace them with the notice |
361 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
362 | ++ * the provisions above, a recipient may use your version of this file under |
363 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
364 | ++ * |
365 | ++ * ***** END LICENSE BLOCK ***** */ |
366 | ++ |
367 | ++#ifndef nskdeshellservice_h____ |
368 | ++#define nskdeshellservice_h____ |
369 | ++ |
370 | ++#include "nsIShellService.h" |
371 | ++#include "nsStringAPI.h" |
372 | ++ |
373 | ++class nsKDEShellService : public nsIShellService |
374 | ++{ |
375 | ++public: |
376 | ++ nsKDEShellService() : mCheckedThisSession(PR_FALSE) { } |
377 | ++ |
378 | ++ NS_DECL_ISUPPORTS |
379 | ++ NS_DECL_NSISHELLSERVICE |
380 | ++ |
381 | ++ nsresult Init() NS_HIDDEN; |
382 | ++ |
383 | ++private: |
384 | ++ ~nsKDEShellService() {} |
385 | ++ |
386 | ++ PRPackedBool mCheckedThisSession; |
387 | ++}; |
388 | ++ |
389 | ++#endif // nskdeshellservice_h____ |
390 | +diff -Nur a/browser/components/shell/src/nsUnixShellService.cpp b/browser/components/shell/src/nsUnixShellService.cpp |
391 | +--- a/browser/components/shell/src/nsUnixShellService.cpp |
392 | ++++ b/browser/components/shell/src/nsUnixShellService.cpp |
393 | +@@ -0,0 +1,52 @@ |
394 | ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
395 | ++/* ***** BEGIN LICENSE BLOCK ***** |
396 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
397 | ++ * |
398 | ++ * The contents of this file are subject to the Mozilla Public License Version |
399 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
400 | ++ * the License. You may obtain a copy of the License at |
401 | ++ * http://www.mozilla.org/MPL/ |
402 | ++ * |
403 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
404 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
405 | ++ * for the specific language governing rights and limitations under the |
406 | ++ * License. |
407 | ++ * |
408 | ++ * The Original Code is Shell Service. |
409 | ++ * |
410 | ++ * The Initial Developer of the Original Code is mozilla.org. |
411 | ++ * Portions created by the Initial Developer are Copyright (C) 2004 |
412 | ++ * the Initial Developer. All Rights Reserved. |
413 | ++ * |
414 | ++ * Contributor(s): |
415 | ++ * |
416 | ++ * Alternatively, the contents of this file may be used under the terms of |
417 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
418 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
419 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
420 | ++ * of those above. If you wish to allow use of your version of this file only |
421 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
422 | ++ * use your version of this file under the terms of the MPL, indicate your |
423 | ++ * decision by deleting the provisions above and replace them with the notice |
424 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
425 | ++ * the provisions above, a recipient may use your version of this file under |
426 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
427 | ++ * |
428 | ++ * ***** END LICENSE BLOCK ***** */ |
429 | ++ |
430 | ++#include "nsUnixShellService.h" |
431 | ++#include "nsGNOMEShellService.h" |
432 | ++#include "nsKDEShellService.h" |
433 | ++#include "nsKDEUtils.h" |
434 | ++#include "mozilla/ModuleUtils.h" |
435 | ++ |
436 | ++NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init) |
437 | ++NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsKDEShellService, Init) |
438 | ++ |
439 | ++NS_METHOD |
440 | ++nsUnixShellServiceConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) |
441 | ++{ |
442 | ++ if( nsKDEUtils::kdeSupport()) |
443 | ++ return nsKDEShellServiceConstructor( aOuter, aIID, aResult ); |
444 | ++ return nsGNOMEShellServiceConstructor( aOuter, aIID, aResult ); |
445 | ++} |
446 | +diff -Nur a/browser/components/shell/src/nsUnixShellService.h b/browser/components/shell/src/nsUnixShellService.h |
447 | +--- a/browser/components/shell/src/nsUnixShellService.h |
448 | ++++ b/browser/components/shell/src/nsUnixShellService.h |
449 | +@@ -0,0 +1,45 @@ |
450 | ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
451 | ++/* ***** BEGIN LICENSE BLOCK ***** |
452 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
453 | ++ * |
454 | ++ * The contents of this file are subject to the Mozilla Public License Version |
455 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
456 | ++ * the License. You may obtain a copy of the License at |
457 | ++ * http://www.mozilla.org/MPL/ |
458 | ++ * |
459 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
460 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
461 | ++ * for the specific language governing rights and limitations under the |
462 | ++ * License. |
463 | ++ * |
464 | ++ * The Original Code is Shell Service. |
465 | ++ * |
466 | ++ * The Initial Developer of the Original Code is mozilla.org. |
467 | ++ * Portions created by the Initial Developer are Copyright (C) 2004 |
468 | ++ * the Initial Developer. All Rights Reserved. |
469 | ++ * |
470 | ++ * Contributor(s): |
471 | ++ * |
472 | ++ * Alternatively, the contents of this file may be used under the terms of |
473 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
474 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
475 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
476 | ++ * of those above. If you wish to allow use of your version of this file only |
477 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
478 | ++ * use your version of this file under the terms of the MPL, indicate your |
479 | ++ * decision by deleting the provisions above and replace them with the notice |
480 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
481 | ++ * the provisions above, a recipient may use your version of this file under |
482 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
483 | ++ * |
484 | ++ * ***** END LICENSE BLOCK ***** */ |
485 | ++ |
486 | ++#ifndef nsunixshellservice_h____ |
487 | ++#define nsunixshellservice_h____ |
488 | ++ |
489 | ++#include "nsIShellService.h" |
490 | ++ |
491 | ++NS_METHOD |
492 | ++nsUnixShellServiceConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult); |
493 | ++ |
494 | ++#endif // nsunixshellservice_h____ |
495 | +diff -Nur a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in |
496 | +--- a/browser/installer/package-manifest.in |
497 | ++++ b/browser/installer/package-manifest.in |
498 | +@@ -437,6 +437,7 @@ |
499 | + @BINPATH@/@PREF_DIR@/firefox.js |
500 | + @BINPATH@/@PREF_DIR@/firefox-branding.js |
501 | + @BINPATH@/@PREF_DIR@/channel-prefs.js |
502 | ++@BINPATH@/@PREF_DIR@/kde.js |
503 | + #ifdef MOZ_SERVICES_SYNC |
504 | + @BINPATH@/@PREF_DIR@/services-sync.js |
505 | + #endif |
506 | +--- /dev/null |
507 | ++++ b/browser/app/profile/kde.js |
508 | +@@ -0,0 +1 @@ |
509 | ++pref("browser.preferences.instantApply", false); |
510 | |
511 | === added file 'debian/patches/mozilla-kde.patch' |
512 | --- debian/patches/mozilla-kde.patch 1970-01-01 00:00:00 +0000 |
513 | +++ debian/patches/mozilla-kde.patch 2010-11-19 17:04:04 +0000 |
514 | @@ -0,0 +1,1647 @@ |
515 | +diff -Nur a/modules/libpref/src/Makefile.in b/modules/libpref/src/Makefile.in |
516 | +--- a/modules/libpref/src/Makefile.in 2010-11-15 21:39:52.000000000 +0100 |
517 | ++++ b/modules/libpref/src/Makefile.in 2010-11-18 12:18:51.850643351 +0100 |
518 | +@@ -95,6 +95,8 @@ |
519 | + $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS) |
520 | + endif |
521 | + |
522 | ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
523 | ++ |
524 | + |
525 | + greprefs.js: $(GREPREF_FILES) |
526 | + $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $^ > $@ |
527 | +diff -Nur a/modules/libpref/src/nsPrefService.cpp b/modules/libpref/src/nsPrefService.cpp |
528 | +--- a/modules/libpref/src/nsPrefService.cpp 2010-11-15 21:41:29.000000000 +0100 |
529 | ++++ b/modules/libpref/src/nsPrefService.cpp 2010-11-18 12:18:51.850643351 +0100 |
530 | +@@ -60,6 +60,7 @@ |
531 | + #include "nsCOMArray.h" |
532 | + #include "nsXPCOMCID.h" |
533 | + #include "nsAutoPtr.h" |
534 | ++#include "nsKDEUtils.h" |
535 | + |
536 | + #include "nsQuickSort.h" |
537 | + #include "prmem.h" |
538 | +@@ -765,6 +766,24 @@ |
539 | + nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); |
540 | + if (NS_FAILED(rv)) return rv; |
541 | + |
542 | ++ // make sure we load these special files after all the others |
543 | ++ static const char* specialFiles[] = { |
544 | ++#if defined(XP_UNIX) |
545 | ++ "" |
546 | ++#endif |
547 | ++ }; |
548 | ++ |
549 | ++ if (nsKDEUtils::kdeSession()) { |
550 | ++ for(int i = 0; |
551 | ++ i < NS_ARRAY_LENGTH(specialFiles); |
552 | ++ ++i ) { |
553 | ++ if (*specialFiles[ i ] == '\0') { |
554 | ++ specialFiles[ i ] = "kde.js"; |
555 | ++ break; |
556 | ++ } |
557 | ++ } |
558 | ++ } |
559 | ++ |
560 | + nsCOMPtr<nsISimpleEnumerator> dirList; |
561 | + dirSvc->Get(listId, |
562 | + NS_GET_IID(nsISimpleEnumerator), |
563 | +@@ -778,7 +797,7 @@ |
564 | + nsCOMPtr<nsIFile> dir = do_QueryInterface(elem); |
565 | + if (dir) { |
566 | + // Do we care if a file provided by this process fails to load? |
567 | +- pref_LoadPrefsInDir(dir, nsnull, 0); |
568 | ++ pref_LoadPrefsInDir(dir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); |
569 | + } |
570 | + } |
571 | + } |
572 | +@@ -819,6 +838,7 @@ |
573 | + "winpref.js" |
574 | + #elif defined(XP_UNIX) |
575 | + "unix.js" |
576 | ++ , "" // placeholder for KDE (empty is otherwise harmless) |
577 | + #if defined(VMS) |
578 | + , "openvms.js" |
579 | + #elif defined(_AIX) |
580 | +@@ -831,6 +851,17 @@ |
581 | + #endif |
582 | + }; |
583 | + |
584 | ++ if(nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper? |
585 | ++ for( int i = 0; |
586 | ++ i < NS_ARRAY_LENGTH(specialFiles); |
587 | ++ ++i ) { |
588 | ++ if( *specialFiles[ i ] == '\0' ) { |
589 | ++ specialFiles[ i ] = "kde.js"; |
590 | ++ break; |
591 | ++ } |
592 | ++ } |
593 | ++ } |
594 | ++ |
595 | + rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); |
596 | + if (NS_FAILED(rv)) { |
597 | + NS_WARNING("Error parsing application default preferences."); |
598 | +diff -Nur a/toolkit/components/downloads/src/Makefile.in b/toolkit/components/downloads/src/Makefile.in |
599 | +--- a/toolkit/components/downloads/src/Makefile.in 2010-11-15 21:40:13.000000000 +0100 |
600 | ++++ b/toolkit/components/downloads/src/Makefile.in 2010-11-18 12:18:51.850643351 +0100 |
601 | +@@ -76,3 +76,4 @@ |
602 | + |
603 | + EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) |
604 | + |
605 | ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
606 | +diff -Nur a/toolkit/components/downloads/src/nsDownloadManager.cpp b/toolkit/components/downloads/src/nsDownloadManager.cpp |
607 | +--- a/toolkit/components/downloads/src/nsDownloadManager.cpp 2010-11-15 21:40:13.000000000 +0100 |
608 | ++++ b/toolkit/components/downloads/src/nsDownloadManager.cpp 2010-11-18 12:18:51.850643351 +0100 |
609 | +@@ -76,6 +76,10 @@ |
610 | + #endif |
611 | + #endif |
612 | + |
613 | ++#if defined(XP_UNIX) && !defined(XP_MACOSX) |
614 | ++#include "nsKDEUtils.h" |
615 | ++#endif |
616 | ++ |
617 | + #ifdef XP_MACOSX |
618 | + #include <CoreFoundation/CoreFoundation.h> |
619 | + #endif |
620 | +@@ -2195,6 +2199,15 @@ |
621 | + pref->GetBoolPref(PREF_BDM_SHOWALERTONCOMPLETE, &showTaskbarAlert); |
622 | + |
623 | + if (showTaskbarAlert) { |
624 | ++ if( nsKDEUtils::kdeSupport()) { |
625 | ++ nsCStringArray command; |
626 | ++ command.AppendCString( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" )); |
627 | ++ nsAutoString displayName; |
628 | ++ GetDisplayName( displayName ); |
629 | ++ command.AppendCString( nsCAutoString( ToNewUTF8String( displayName ))); |
630 | ++ nsKDEUtils::command( command ); |
631 | ++ } else { |
632 | ++ // begin non-KDE block |
633 | + PRInt32 alertInterval = 2000; |
634 | + if (pref) |
635 | + pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval); |
636 | +@@ -2230,6 +2243,7 @@ |
637 | + EmptyString()); |
638 | + } |
639 | + } |
640 | ++ } // end non-KDE block |
641 | + } |
642 | + |
643 | + #if (defined(XP_WIN) && !defined(WINCE)) || defined(XP_MACOSX) |
644 | +diff -Nur a/toolkit/content/jar.mn b/toolkit/content/jar.mn |
645 | +--- a/toolkit/content/jar.mn 2010-11-15 21:40:16.000000000 +0100 |
646 | ++++ b/toolkit/content/jar.mn 2010-11-18 12:18:51.850643351 +0100 |
647 | +@@ -45,6 +45,8 @@ |
648 | + *+ content/global/bindings/colorpicker.xml (widgets/colorpicker.xml) |
649 | + *+ content/global/bindings/datetimepicker.xml (widgets/datetimepicker.xml) |
650 | + *+ content/global/bindings/dialog.xml (widgets/dialog.xml) |
651 | ++*+ content/global/bindings/dialog-kde.xml (widgets/dialog-kde.xml) |
652 | ++% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde |
653 | + *+ content/global/bindings/editor.xml (widgets/editor.xml) |
654 | + * content/global/bindings/expander.xml (widgets/expander.xml) |
655 | + * content/global/bindings/filefield.xml (widgets/filefield.xml) |
656 | +@@ -58,6 +60,8 @@ |
657 | + *+ content/global/bindings/numberbox.xml (widgets/numberbox.xml) |
658 | + *+ content/global/bindings/popup.xml (widgets/popup.xml) |
659 | + *+ content/global/bindings/preferences.xml (widgets/preferences.xml) |
660 | ++*+ content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml) |
661 | ++% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde |
662 | + *+ content/global/bindings/progressmeter.xml (widgets/progressmeter.xml) |
663 | + *+ content/global/bindings/radio.xml (widgets/radio.xml) |
664 | + *+ content/global/bindings/resizer.xml (widgets/resizer.xml) |
665 | +diff -Nur a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml |
666 | +--- a/toolkit/content/widgets/dialog-kde.xml 2010-11-15 21:40:17.000000000 +0100 |
667 | ++++ b/toolkit/content/widgets/dialog-kde.xml 2010-11-18 12:18:51.850643351 +0100 |
668 | +@@ -16,7 +16,7 @@ |
669 | + |
670 | + <xul:hbox class="dialog-button-box" anonid="buttons" |
671 | + xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient" |
672 | +-#ifdef XP_UNIX |
673 | ++#ifdef XP_UNIX_GNOME |
674 | + > |
675 | + <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
676 | + <xul:button dlgtype="help" class="dialog-button" hidden="true"/> |
677 | +@@ -25,6 +25,15 @@ |
678 | + <xul:spacer anonid="spacer" flex="1"/> |
679 | + <xul:button dlgtype="cancel" class="dialog-button"/> |
680 | + <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/> |
681 | ++#elif XP_UNIX |
682 | ++ pack="end"> |
683 | ++ <xul:button dlgtype="help" class="dialog-button" hidden="true"/> |
684 | ++ <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
685 | ++ <xul:spacer anonid="spacer" flex="1" hidden="true"/> |
686 | ++ <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/> |
687 | ++ <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/> |
688 | ++ <xul:button dlgtype="cancel" class="dialog-button"/> |
689 | ++ <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
690 | + #else |
691 | + pack="end"> |
692 | + <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
693 | +diff -Nur a/toolkit/content/widgets/preferences-kde.xml b/toolkit/content/widgets/preferences-kde.xml |
694 | +--- a/toolkit/content/widgets/preferences-kde.xml 2010-11-15 21:40:17.000000000 +0100 |
695 | ++++ b/toolkit/content/widgets/preferences-kde.xml 2010-11-18 12:18:51.860642952 +0100 |
696 | +@@ -573,7 +573,7 @@ |
697 | + </xul:deck> |
698 | + </xul:hbox> |
699 | + <xul:hbox anonid="dlg-buttons" class="prefWindow-dlgbuttons" |
700 | +-#ifdef XP_UNIX |
701 | ++#ifdef XP_UNIX_GNOME |
702 | + > |
703 | + <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
704 | + <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/> |
705 | +@@ -582,6 +582,15 @@ |
706 | + <xul:spacer anonid="spacer" flex="1"/> |
707 | + <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/> |
708 | + <xul:button dlgtype="accept" class="dialog-button" icon="accept"/> |
709 | ++#elif XP_UNIX |
710 | ++ pack="end"> |
711 | ++ <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/> |
712 | ++ <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
713 | ++ <xul:spacer anonid="spacer" flex="1"/> |
714 | ++ <xul:button dlgtype="accept" class="dialog-button" icon="accept"/> |
715 | ++ <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/> |
716 | ++ <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/> |
717 | ++ <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/> |
718 | + #else |
719 | + pack="end"> |
720 | + <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/> |
721 | +diff -Nur a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
722 | +--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp 2010-11-15 21:40:41.000000000 +0100 |
723 | ++++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp 2010-11-18 12:18:51.860642952 +0100 |
724 | +@@ -49,6 +49,8 @@ |
725 | + #include "nsPrintfCString.h" |
726 | + #include "nsNetUtil.h" |
727 | + #include "nsISupportsPrimitives.h" |
728 | ++#include "nsVoidArray.h" |
729 | ++#include "nsKDEUtils.h" |
730 | + |
731 | + class nsUnixSystemProxySettings : public nsISystemProxySettings { |
732 | + public: |
733 | +@@ -65,6 +67,7 @@ |
734 | + PRBool IsProxyMode(const char* aMode); |
735 | + nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult); |
736 | + nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
737 | ++ nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); |
738 | + }; |
739 | + |
740 | + NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
741 | +@@ -406,12 +409,40 @@ |
742 | + rv = aURI->GetPort(&port); |
743 | + NS_ENSURE_SUCCESS(rv, rv); |
744 | + |
745 | ++ if( nsKDEUtils::kdeSupport()) |
746 | ++ return GetProxyFromKDE( scheme, host, port, aResult ); |
747 | ++ |
748 | + if (!mGConf) |
749 | + return GetProxyFromEnvironment(scheme, host, port, aResult); |
750 | + |
751 | + return GetProxyFromGConf(scheme, host, port, aResult); |
752 | + } |
753 | + |
754 | ++nsresult |
755 | ++nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme, |
756 | ++ const nsACString& aHost, |
757 | ++ PRInt32 aPort, |
758 | ++ nsACString& aResult) |
759 | ++{ |
760 | ++ nsCAutoString url; |
761 | ++ url = aScheme; |
762 | ++ url += "://"; |
763 | ++ url += aHost; |
764 | ++ if( aPort >= 0 ) |
765 | ++ { |
766 | ++ url += ":"; |
767 | ++ url += nsPrintfCString("%d", aPort); |
768 | ++ } |
769 | ++ nsCStringArray command; |
770 | ++ command.AppendCString( NS_LITERAL_CSTRING( "GETPROXY" )); |
771 | ++ command.AppendCString( url ); |
772 | ++ nsCStringArray result; |
773 | ++ if( !nsKDEUtils::command( command, &result ) || result.Count() != 1 ) |
774 | ++ return NS_ERROR_FAILURE; |
775 | ++ aResult = *result[ 0 ]; |
776 | ++ return NS_OK; |
777 | ++} |
778 | ++ |
779 | + #define NS_UNIXSYSTEMPROXYSERVICE_CID /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\ |
780 | + { 0x0fa3158c, 0xd5a7, 0x43de, \ |
781 | + {0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 } } |
782 | +diff -Nur a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in |
783 | +--- a/toolkit/xre/Makefile.in 2010-11-15 21:41:30.000000000 +0100 |
784 | ++++ b/toolkit/xre/Makefile.in 2010-11-18 12:18:51.860642952 +0100 |
785 | +@@ -102,7 +102,8 @@ |
786 | + CPPSRCS += nsNativeAppSupportBeOS.cpp |
787 | + else |
788 | + ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) |
789 | +-CPPSRCS += nsNativeAppSupportUnix.cpp |
790 | ++CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp |
791 | ++EXPORTS += nsKDEUtils.h |
792 | + else |
793 | + ifeq ($(MOZ_WIDGET_TOOLKIT),qt) |
794 | + CPPSRCS += nsNativeAppSupportQt.cpp |
795 | +diff -Nur a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp |
796 | +--- a/toolkit/xre/nsKDEUtils.cpp 1970-01-01 01:00:00.000000000 +0100 |
797 | ++++ b/toolkit/xre/nsKDEUtils.cpp 2010-11-18 12:18:51.860642952 +0100 |
798 | +@@ -0,0 +1,334 @@ |
799 | ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
800 | ++/* ***** BEGIN LICENSE BLOCK ***** |
801 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
802 | ++ * |
803 | ++ * The contents of this file are subject to the Mozilla Public License Version |
804 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
805 | ++ * the License. You may obtain a copy of the License at |
806 | ++ * http://www.mozilla.org/MPL/ |
807 | ++ * |
808 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
809 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
810 | ++ * for the specific language governing rights and limitations under the |
811 | ++ * License. |
812 | ++ * |
813 | ++ * The Original Code is Unix Native App Support. |
814 | ++ * |
815 | ++ * The Initial Developer of the Original Code is |
816 | ++ * Mozilla Corporation. |
817 | ++ * Portions created by the Initial Developer are Copyright (C) 2007 |
818 | ++ * the Initial Developer. All Rights Reserved. |
819 | ++ * |
820 | ++ * Contributor(s): |
821 | ++ * |
822 | ++ * Alternatively, the contents of this file may be used under the terms of |
823 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
824 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
825 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
826 | ++ * of those above. If you wish to allow use of your version of this file only |
827 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
828 | ++ * use your version of this file under the terms of the MPL, indicate your |
829 | ++ * decision by deleting the provisions above and replace them with the notice |
830 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
831 | ++ * the provisions above, a recipient may use your version of this file under |
832 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
833 | ++ * |
834 | ++ * ***** END LICENSE BLOCK ***** */ |
835 | ++ |
836 | ++#include "nsKDEUtils.h" |
837 | ++#include "nsIWidget.h" |
838 | ++ |
839 | ++#include <gtk/gtk.h> |
840 | ++ |
841 | ++#include <limits.h> |
842 | ++#include <stdio.h> |
843 | ++#include <sys/wait.h> |
844 | ++#include <unistd.h> |
845 | ++#include <X11/Xlib.h> |
846 | ++ |
847 | ++//#define DEBUG_KDE |
848 | ++#ifdef DEBUG_KDE |
849 | ++#define KMOZILLAHELPER "kmozillahelper" |
850 | ++#else |
851 | ++// not need for lib64, it's a binary |
852 | ++#define KMOZILLAHELPER "/usr/lib/mozilla/kmozillahelper" |
853 | ++#endif |
854 | ++ |
855 | ++#define KMOZILLAHELPER_VERSION 6 |
856 | ++#define MAKE_STR2( n ) #n |
857 | ++#define MAKE_STR( n ) MAKE_STR2( n ) |
858 | ++ |
859 | ++static bool getKdeSession() |
860 | ++ { |
861 | ++ Display* dpy = XOpenDisplay( NULL ); |
862 | ++ if( dpy == NULL ) |
863 | ++ return false; |
864 | ++ Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True ); |
865 | ++ bool kde = false; |
866 | ++ if( kde_full_session != None ) |
867 | ++ { |
868 | ++ int cnt; |
869 | ++ if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt )) |
870 | ++ { |
871 | ++ for( int i = 0; |
872 | ++ i < cnt; |
873 | ++ ++i ) |
874 | ++ { |
875 | ++ if( props[ i ] == kde_full_session ) |
876 | ++ { |
877 | ++ kde = true; |
878 | ++#ifdef DEBUG_KDE |
879 | ++ fprintf( stderr, "KDE SESSION %d\n", kde ); |
880 | ++#endif |
881 | ++ break; |
882 | ++ } |
883 | ++ } |
884 | ++ XFree( props ); |
885 | ++ } |
886 | ++ } |
887 | ++ XCloseDisplay( dpy ); |
888 | ++ return kde; |
889 | ++ } |
890 | ++ |
891 | ++static bool getKdeSupport() |
892 | ++ { |
893 | ++ nsCStringArray command; |
894 | ++ command.AppendCString( NS_LITERAL_CSTRING( "CHECK" )); |
895 | ++ command.AppendCString( NS_LITERAL_CSTRING( MAKE_STR( KMOZILLAHELPER_VERSION ))); |
896 | ++ bool kde = nsKDEUtils::command( command ); |
897 | ++#ifdef DEBUG_KDE |
898 | ++ fprintf( stderr, "KDE RUNNING %d\n", kde ); |
899 | ++#endif |
900 | ++ return kde; |
901 | ++ } |
902 | ++ |
903 | ++nsKDEUtils::nsKDEUtils() |
904 | ++ : commandFile( NULL ) |
905 | ++ , replyFile( NULL ) |
906 | ++ { |
907 | ++ } |
908 | ++ |
909 | ++nsKDEUtils::~nsKDEUtils() |
910 | ++ { |
911 | ++// closeHelper(); not actually useful, exiting will close the fd too |
912 | ++ } |
913 | ++ |
914 | ++nsKDEUtils* nsKDEUtils::self() |
915 | ++ { |
916 | ++ static nsKDEUtils s; |
917 | ++ return &s; |
918 | ++ } |
919 | ++ |
920 | ++static bool helperRunning = false; |
921 | ++static bool helperFailed = false; |
922 | ++ |
923 | ++bool nsKDEUtils::kdeSession() |
924 | ++ { |
925 | ++ static bool session = getKdeSession(); |
926 | ++ return session; |
927 | ++ } |
928 | ++ |
929 | ++bool nsKDEUtils::kdeSupport() |
930 | ++ { |
931 | ++ static bool support = kdeSession() && getKdeSupport(); |
932 | ++ return support && helperRunning; |
933 | ++ } |
934 | ++ |
935 | ++struct nsKDECommandData |
936 | ++ { |
937 | ++ FILE* file; |
938 | ++ nsCStringArray* output; |
939 | ++ GMainLoop* loop; |
940 | ++ bool success; |
941 | ++ }; |
942 | ++ |
943 | ++static gboolean kdeReadFunc( GIOChannel*, GIOCondition, gpointer data ) |
944 | ++ { |
945 | ++ nsKDECommandData* p = static_cast< nsKDECommandData* >( data ); |
946 | ++ char buf[ 8192 ]; // TODO big enough |
947 | ++ bool command_done = false; |
948 | ++ bool command_failed = false; |
949 | ++ while( !command_done && !command_failed && fgets( buf, 8192, p->file ) != NULL ) |
950 | ++ { // TODO what if the kernel splits a line into two chunks? |
951 | ++//#ifdef DEBUG_KDE |
952 | ++// fprintf( stderr, "READ: %s %d\n", buf, feof( p->file )); |
953 | ++//#endif |
954 | ++ if( char* eol = strchr( buf, '\n' )) |
955 | ++ *eol = '\0'; |
956 | ++ command_done = ( strcmp( buf, "\\1" ) == 0 ); |
957 | ++ command_failed = ( strcmp( buf, "\\0" ) == 0 ); |
958 | ++ nsCAutoString line( buf ); |
959 | ++ line.ReplaceSubstring( "\\n", "\n" ); |
960 | ++ line.ReplaceSubstring( "\\" "\\", "\\" ); // \\ -> \ , i.e. unescape |
961 | ++ if( p->output && !( command_done || command_failed )) |
962 | ++ p->output->AppendCString( nsCString( buf )); // TODO utf8? |
963 | ++ } |
964 | ++ bool quit = false; |
965 | ++ if( feof( p->file ) || command_failed ) |
966 | ++ { |
967 | ++ quit = true; |
968 | ++ p->success = false; |
969 | ++ } |
970 | ++ if( command_done ) |
971 | ++ { // reading one reply finished |
972 | ++ quit = true; |
973 | ++ p->success = true; |
974 | ++ } |
975 | ++ if( quit ) |
976 | ++ { |
977 | ++ if( p->loop ) |
978 | ++ g_main_loop_quit( p->loop ); |
979 | ++ return FALSE; |
980 | ++ } |
981 | ++ return TRUE; |
982 | ++ } |
983 | ++ |
984 | ++bool nsKDEUtils::command( const nsCStringArray& command, nsCStringArray* output ) |
985 | ++ { |
986 | ++ return self()->internalCommand( command, NULL, false, output ); |
987 | ++ } |
988 | ++ |
989 | ++bool nsKDEUtils::commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output ) |
990 | ++ { |
991 | ++ return self()->internalCommand( command, parent, true, output ); |
992 | ++ } |
993 | ++ |
994 | ++bool nsKDEUtils::internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool blockUi, |
995 | ++ nsCStringArray* output ) |
996 | ++ { |
997 | ++ if( !startHelper()) |
998 | ++ return false; |
999 | ++ // if Gtk has meanwhile gotten a grab (bnc#555202, somehow the file dialog |
1000 | ++ // is called with a delay), then do not do anything, as this app would keep |
1001 | ++ // the grabs but block waiting for the helper, which would be unable to do |
1002 | ++ // anything because of the grab |
1003 | ++ if( blockUi && gdk_pointer_is_grabbed()) |
1004 | ++ return false; |
1005 | ++ feedCommand( command ); |
1006 | ++ // do not store the data in 'this' but in extra structure, just in case there |
1007 | ++ // is reentrancy (can there be? the event loop is re-entered) |
1008 | ++ nsKDECommandData data; |
1009 | ++ data.file = replyFile; |
1010 | ++ data.output = output; |
1011 | ++ data.success = false; |
1012 | ++ if( blockUi ) |
1013 | ++ { |
1014 | ++ data.loop = g_main_loop_new( NULL, FALSE ); |
1015 | ++ GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); |
1016 | ++ if( parent && parent->group ) |
1017 | ++ gtk_window_group_add_window( parent->group, GTK_WINDOW( window )); |
1018 | ++ gtk_widget_realize( window ); |
1019 | ++ gtk_widget_set_sensitive( window, TRUE ); |
1020 | ++ gtk_grab_add( window ); |
1021 | ++ GIOChannel* channel = g_io_channel_unix_new( fileno( data.file )); |
1022 | ++ g_io_add_watch( channel, static_cast< GIOCondition >( G_IO_IN | G_IO_ERR | G_IO_HUP ), kdeReadFunc, &data ); |
1023 | ++ g_io_channel_unref( channel ); |
1024 | ++ g_main_loop_run( data.loop ); |
1025 | ++ g_main_loop_unref( data.loop ); |
1026 | ++ gtk_grab_remove( window ); |
1027 | ++ gtk_widget_destroy( window ); |
1028 | ++ } |
1029 | ++ else |
1030 | ++ { |
1031 | ++ data.loop = NULL; |
1032 | ++ while( kdeReadFunc( NULL, static_cast< GIOCondition >( 0 ), &data )) |
1033 | ++ ; |
1034 | ++ } |
1035 | ++ return data.success; |
1036 | ++ } |
1037 | ++ |
1038 | ++bool nsKDEUtils::startHelper() |
1039 | ++ { |
1040 | ++ if( helperRunning ) |
1041 | ++ return true; |
1042 | ++ if( helperFailed ) |
1043 | ++ return false; |
1044 | ++ helperFailed = true; |
1045 | ++ int fdcommand[ 2 ]; |
1046 | ++ int fdreply[ 2 ]; |
1047 | ++ if( pipe( fdcommand ) < 0 ) |
1048 | ++ return false; |
1049 | ++ if( pipe( fdreply ) < 0 ) |
1050 | ++ { |
1051 | ++ close( fdcommand[ 0 ] ); |
1052 | ++ close( fdcommand[ 1 ] ); |
1053 | ++ return false; |
1054 | ++ } |
1055 | ++ char* args[ 2 ] = { const_cast< char* >( KMOZILLAHELPER ), NULL }; |
1056 | ++ switch( fork()) |
1057 | ++ { |
1058 | ++ case -1: |
1059 | ++ { |
1060 | ++ close( fdcommand[ 0 ] ); |
1061 | ++ close( fdcommand[ 1 ] ); |
1062 | ++ close( fdreply[ 0 ] ); |
1063 | ++ close( fdreply[ 1 ] ); |
1064 | ++ return false; |
1065 | ++ } |
1066 | ++ case 0: // child |
1067 | ++ { |
1068 | ++ if( dup2( fdcommand[ 0 ], STDIN_FILENO ) < 0 ) |
1069 | ++ _exit( 1 ); |
1070 | ++ if( dup2( fdreply[ 1 ], STDOUT_FILENO ) < 0 ) |
1071 | ++ _exit( 1 ); |
1072 | ++ int maxfd = 1024; // close all other fds |
1073 | ++ struct rlimit rl; |
1074 | ++ if( getrlimit( RLIMIT_NOFILE, &rl ) == 0 ) |
1075 | ++ maxfd = rl.rlim_max; |
1076 | ++ for( int i = 3; |
1077 | ++ i < maxfd; |
1078 | ++ ++i ) |
1079 | ++ close( i ); |
1080 | ++#ifdef DEBUG_KDE |
1081 | ++ execvp( KMOZILLAHELPER, args ); |
1082 | ++#else |
1083 | ++ execv( KMOZILLAHELPER, args ); |
1084 | ++#endif |
1085 | ++ _exit( 1 ); // failed |
1086 | ++ } |
1087 | ++ default: // parent |
1088 | ++ { |
1089 | ++ commandFile = fdopen( fdcommand[ 1 ], "w" ); |
1090 | ++ replyFile = fdopen( fdreply[ 0 ], "r" ); |
1091 | ++ close( fdcommand[ 0 ] ); |
1092 | ++ close( fdreply[ 1 ] ); |
1093 | ++ if( commandFile == NULL || replyFile == NULL ) |
1094 | ++ { |
1095 | ++ closeHelper(); |
1096 | ++ return false; |
1097 | ++ } |
1098 | ++ // ok, helper ready, getKdeRunning() will check if it works |
1099 | ++ } |
1100 | ++ } |
1101 | ++ helperFailed = false; |
1102 | ++ helperRunning = true; |
1103 | ++ return true; |
1104 | ++ } |
1105 | ++ |
1106 | ++void nsKDEUtils::closeHelper() |
1107 | ++ { |
1108 | ++ if( commandFile != NULL ) |
1109 | ++ fclose( commandFile ); // this will also make the helper quit |
1110 | ++ if( replyFile != NULL ) |
1111 | ++ fclose( replyFile ); |
1112 | ++ helperRunning = false; |
1113 | ++ } |
1114 | ++ |
1115 | ++void nsKDEUtils::feedCommand( const nsCStringArray& command ) |
1116 | ++ { |
1117 | ++ for( int i = 0; |
1118 | ++ i < command.Count(); |
1119 | ++ ++i ) |
1120 | ++ { |
1121 | ++ nsCString line = *command[ i ]; |
1122 | ++ line.ReplaceSubstring( "\\", "\\" "\\" ); // \ -> \\ , i.e. escape |
1123 | ++ line.ReplaceSubstring( "\n", "\\n" ); |
1124 | ++#ifdef DEBUG_KDE |
1125 | ++ fprintf( stderr, "COMM: %s\n", line.get()); |
1126 | ++#endif |
1127 | ++ fputs( line.get(), commandFile ); |
1128 | ++ fputs( "\n", commandFile ); |
1129 | ++ } |
1130 | ++ fputs( "\\E\n", commandFile ); // done as \E, so it cannot happen in normal data |
1131 | ++ fflush( commandFile ); |
1132 | ++ } |
1133 | +diff -Nur a/toolkit/xre/nsKDEUtils.h b/toolkit/xre/nsKDEUtils.h |
1134 | +--- a/toolkit/xre/nsKDEUtils.h 1970-01-01 01:00:00.000000000 +0100 |
1135 | ++++ b/toolkit/xre/nsKDEUtils.h 2010-11-18 12:18:51.860642952 +0100 |
1136 | +@@ -0,0 +1,77 @@ |
1137 | ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
1138 | ++ * |
1139 | ++ * ***** BEGIN LICENSE BLOCK ***** |
1140 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
1141 | ++ * |
1142 | ++ * The contents of this file are subject to the Mozilla Public License Version |
1143 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
1144 | ++ * the License. You may obtain a copy of the License at |
1145 | ++ * http://www.mozilla.org/MPL/ |
1146 | ++ * |
1147 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
1148 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
1149 | ++ * for the specific language governing rights and limitations under the |
1150 | ++ * License. |
1151 | ++ * |
1152 | ++ * The Original Code is Mozilla Communicator client code. |
1153 | ++ * |
1154 | ++ * The Initial Developer of the Original Code is |
1155 | ++ * Netscape Communications Corporation. |
1156 | ++ * Portions created by the Initial Developer are Copyright (C) 1998 |
1157 | ++ * the Initial Developer. All Rights Reserved. |
1158 | ++ * |
1159 | ++ * Contributor(s): |
1160 | ++ * |
1161 | ++ * Alternatively, the contents of this file may be used under the terms of |
1162 | ++ * either of the GNU General Public License Version 2 or later (the "GPL"), |
1163 | ++ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
1164 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
1165 | ++ * of those above. If you wish to allow use of your version of this file only |
1166 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
1167 | ++ * use your version of this file under the terms of the MPL, indicate your |
1168 | ++ * decision by deleting the provisions above and replace them with the notice |
1169 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
1170 | ++ * the provisions above, a recipient may use your version of this file under |
1171 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
1172 | ++ * |
1173 | ++ * ***** END LICENSE BLOCK ***** */ |
1174 | ++ |
1175 | ++#ifndef nsKDEUtils_h__ |
1176 | ++#define nsKDEUtils_h__ |
1177 | ++ |
1178 | ++#include "nsStringGlue.h" |
1179 | ++#include "nsVoidArray.h" |
1180 | ++#include <stdio.h> |
1181 | ++ |
1182 | ++typedef struct _GtkWindow GtkWindow; |
1183 | ++ |
1184 | ++class NS_EXPORT nsKDEUtils |
1185 | ++ { |
1186 | ++ public: |
1187 | ++ /* Returns true if running inside a KDE session (regardless of whether there is KDE |
1188 | ++ support available for Firefox). This should be used e.g. when determining |
1189 | ++ dialog button order but not for code that requires the KDE support. */ |
1190 | ++ static bool kdeSession(); |
1191 | ++ /* Returns true if running inside a KDE session and KDE support is available |
1192 | ++ for Firefox. This should be used everywhere where the external helper is needed. */ |
1193 | ++ static bool kdeSupport(); |
1194 | ++ /* Executes the given helper command, returns true if helper returned success. */ |
1195 | ++ static bool command( const nsCStringArray& command, nsCStringArray* output = NULL ); |
1196 | ++ /* Like command(), but additionally blocks the parent widget like if there was |
1197 | ++ a modal dialog shown and enters the event loop (i.e. there are still paint updates, |
1198 | ++ this is for commands that take long). */ |
1199 | ++ static bool commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output = NULL ); |
1200 | ++ private: |
1201 | ++ nsKDEUtils(); |
1202 | ++ ~nsKDEUtils(); |
1203 | ++ static nsKDEUtils* self(); |
1204 | ++ bool startHelper(); |
1205 | ++ void closeHelper(); |
1206 | ++ void feedCommand( const nsCStringArray& command ); |
1207 | ++ bool internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool isParent, |
1208 | ++ nsCStringArray* output ); |
1209 | ++ FILE* commandFile; |
1210 | ++ FILE* replyFile; |
1211 | ++ }; |
1212 | ++ |
1213 | ++#endif // nsKDEUtils |
1214 | +diff -Nur a/uriloader/exthandler/Makefile.in b/uriloader/exthandler/Makefile.in |
1215 | +--- a/uriloader/exthandler/Makefile.in 2010-11-15 21:40:50.000000000 +0100 |
1216 | ++++ b/uriloader/exthandler/Makefile.in 2010-11-18 12:18:51.860642952 +0100 |
1217 | +@@ -99,8 +99,9 @@ |
1218 | + endif |
1219 | + |
1220 | + ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) |
1221 | +-OSHELPER += nsGNOMERegistry.cpp |
1222 | ++OSHELPER += nsCommonRegistry.cpp nsGNOMERegistry.cpp nsKDERegistry.cpp |
1223 | + OSHELPER += nsMIMEInfoUnix.cpp |
1224 | ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
1225 | + endif |
1226 | + |
1227 | + ifeq ($(MOZ_WIDGET_TOOLKIT),android) |
1228 | +diff -Nur a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp |
1229 | +--- a/uriloader/exthandler/unix/nsCommonRegistry.cpp 1970-01-01 01:00:00.000000000 +0100 |
1230 | ++++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp 2010-11-18 12:18:51.860642952 +0100 |
1231 | +@@ -0,0 +1,87 @@ |
1232 | ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
1233 | ++/* ***** BEGIN LICENSE BLOCK ***** |
1234 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
1235 | ++ * |
1236 | ++ * The contents of this file are subject to the Mozilla Public License Version |
1237 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
1238 | ++ * the License. You may obtain a copy of the License at |
1239 | ++ * http://www.mozilla.org/MPL/ |
1240 | ++ * |
1241 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
1242 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
1243 | ++ * for the specific language governing rights and limitations under the |
1244 | ++ * License. |
1245 | ++ * |
1246 | ++ * The Original Code is the GNOME helper app implementation. |
1247 | ++ * |
1248 | ++ * The Initial Developer of the Original Code is |
1249 | ++ * IBM Corporation. |
1250 | ++ * Portions created by the Initial Developer are Copyright (C) 2003 |
1251 | ++ * the Initial Developer. All Rights Reserved. |
1252 | ++ * |
1253 | ++ * Contributor(s): |
1254 | ++ * Brian Ryner <bryner@brianryner.com> (Original Author) |
1255 | ++ * |
1256 | ++ * Alternatively, the contents of this file may be used under the terms of |
1257 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
1258 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
1259 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
1260 | ++ * of those above. If you wish to allow use of your version of this file only |
1261 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
1262 | ++ * use your version of this file under the terms of the MPL, indicate your |
1263 | ++ * decision by deleting the provisions above and replace them with the notice |
1264 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
1265 | ++ * the provisions above, a recipient may use your version of this file under |
1266 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
1267 | ++ * |
1268 | ++ * ***** END LICENSE BLOCK ***** */ |
1269 | ++ |
1270 | ++#include "nsCommonRegistry.h" |
1271 | ++ |
1272 | ++#include "nsGNOMERegistry.h" |
1273 | ++#include "nsKDERegistry.h" |
1274 | ++#include "nsString.h" |
1275 | ++#include "nsVoidArray.h" |
1276 | ++#include "nsKDEUtils.h" |
1277 | ++ |
1278 | ++/* static */ PRBool |
1279 | ++nsCommonRegistry::HandlerExists(const char *aProtocolScheme) |
1280 | ++{ |
1281 | ++ if( nsKDEUtils::kdeSupport()) |
1282 | ++ return nsKDERegistry::HandlerExists( aProtocolScheme ); |
1283 | ++ return nsGNOMERegistry::HandlerExists( aProtocolScheme ); |
1284 | ++} |
1285 | ++ |
1286 | ++/* static */ nsresult |
1287 | ++nsCommonRegistry::LoadURL(nsIURI *aURL) |
1288 | ++{ |
1289 | ++ if( nsKDEUtils::kdeSupport()) |
1290 | ++ return nsKDERegistry::LoadURL( aURL ); |
1291 | ++ return nsGNOMERegistry::LoadURL( aURL ); |
1292 | ++} |
1293 | ++ |
1294 | ++/* static */ void |
1295 | ++nsCommonRegistry::GetAppDescForScheme(const nsACString& aScheme, |
1296 | ++ nsAString& aDesc) |
1297 | ++{ |
1298 | ++ if( nsKDEUtils::kdeSupport()) |
1299 | ++ return nsKDERegistry::GetAppDescForScheme( aScheme, aDesc ); |
1300 | ++ return nsGNOMERegistry::GetAppDescForScheme( aScheme, aDesc ); |
1301 | ++} |
1302 | ++ |
1303 | ++ |
1304 | ++/* static */ already_AddRefed<nsMIMEInfoBase> |
1305 | ++nsCommonRegistry::GetFromExtension(const nsACString& aFileExt) |
1306 | ++{ |
1307 | ++ if( nsKDEUtils::kdeSupport()) |
1308 | ++ return nsKDERegistry::GetFromExtension( aFileExt ); |
1309 | ++ return nsGNOMERegistry::GetFromExtension( aFileExt ); |
1310 | ++} |
1311 | ++ |
1312 | ++/* static */ already_AddRefed<nsMIMEInfoBase> |
1313 | ++nsCommonRegistry::GetFromType(const nsACString& aMIMEType) |
1314 | ++{ |
1315 | ++ if( nsKDEUtils::kdeSupport()) |
1316 | ++ return nsKDERegistry::GetFromType( aMIMEType ); |
1317 | ++ return nsGNOMERegistry::GetFromType( aMIMEType ); |
1318 | ++} |
1319 | +diff -Nur a/uriloader/exthandler/unix/nsCommonRegistry.h b/uriloader/exthandler/unix/nsCommonRegistry.h |
1320 | +--- a/uriloader/exthandler/unix/nsCommonRegistry.h 1970-01-01 01:00:00.000000000 +0100 |
1321 | ++++ b/uriloader/exthandler/unix/nsCommonRegistry.h 2010-11-18 12:18:51.860642952 +0100 |
1322 | +@@ -0,0 +1,56 @@ |
1323 | ++/* ***** BEGIN LICENSE BLOCK ***** |
1324 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
1325 | ++ * |
1326 | ++ * The contents of this file are subject to the Mozilla Public License Version |
1327 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
1328 | ++ * the License. You may obtain a copy of the License at |
1329 | ++ * http://www.mozilla.org/MPL/ |
1330 | ++ * |
1331 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
1332 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
1333 | ++ * for the specific language governing rights and limitations under the |
1334 | ++ * License. |
1335 | ++ * |
1336 | ++ * The Original Code is the GNOME helper app implementation. |
1337 | ++ * |
1338 | ++ * The Initial Developer of the Original Code is |
1339 | ++ * IBM Corporation. |
1340 | ++ * Portions created by the Initial Developer are Copyright (C) 2003 |
1341 | ++ * the Initial Developer. All Rights Reserved. |
1342 | ++ * |
1343 | ++ * Contributor(s): |
1344 | ++ * Brian Ryner <bryner@brianryner.com> (Original Author) |
1345 | ++ * |
1346 | ++ * Alternatively, the contents of this file may be used under the terms of |
1347 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
1348 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
1349 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
1350 | ++ * of those above. If you wish to allow use of your version of this file only |
1351 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
1352 | ++ * use your version of this file under the terms of the MPL, indicate your |
1353 | ++ * decision by deleting the provisions above and replace them with the notice |
1354 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
1355 | ++ * the provisions above, a recipient may use your version of this file under |
1356 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
1357 | ++ * |
1358 | ++ * ***** END LICENSE BLOCK ***** */ |
1359 | ++ |
1360 | ++#include "nsIURI.h" |
1361 | ++#include "nsCOMPtr.h" |
1362 | ++ |
1363 | ++class nsMIMEInfoBase; |
1364 | ++ |
1365 | ++class nsCommonRegistry |
1366 | ++{ |
1367 | ++ public: |
1368 | ++ static PRBool HandlerExists(const char *aProtocolScheme); |
1369 | ++ |
1370 | ++ static nsresult LoadURL(nsIURI *aURL); |
1371 | ++ |
1372 | ++ static void GetAppDescForScheme(const nsACString& aScheme, |
1373 | ++ nsAString& aDesc); |
1374 | ++ |
1375 | ++ static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsACString& aFileExt); |
1376 | ++ |
1377 | ++ static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType); |
1378 | ++}; |
1379 | +diff -Nur a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp |
1380 | +--- a/uriloader/exthandler/unix/nsKDERegistry.cpp 1970-01-01 01:00:00.000000000 +0100 |
1381 | ++++ b/uriloader/exthandler/unix/nsKDERegistry.cpp 2010-11-18 12:18:51.860642952 +0100 |
1382 | +@@ -0,0 +1,119 @@ |
1383 | ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
1384 | ++/* ***** BEGIN LICENSE BLOCK ***** |
1385 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
1386 | ++ * |
1387 | ++ * The contents of this file are subject to the Mozilla Public License Version |
1388 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
1389 | ++ * the License. You may obtain a copy of the License at |
1390 | ++ * http://www.mozilla.org/MPL/ |
1391 | ++ * |
1392 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
1393 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
1394 | ++ * for the specific language governing rights and limitations under the |
1395 | ++ * License. |
1396 | ++ * |
1397 | ++ * The Original Code is the GNOME helper app implementation. |
1398 | ++ * |
1399 | ++ * The Initial Developer of the Original Code is |
1400 | ++ * IBM Corporation. |
1401 | ++ * Portions created by the Initial Developer are Copyright (C) 2003 |
1402 | ++ * the Initial Developer. All Rights Reserved. |
1403 | ++ * |
1404 | ++ * Contributor(s): |
1405 | ++ * Brian Ryner <bryner@brianryner.com> (Original Author) |
1406 | ++ * |
1407 | ++ * Alternatively, the contents of this file may be used under the terms of |
1408 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
1409 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
1410 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
1411 | ++ * of those above. If you wish to allow use of your version of this file only |
1412 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
1413 | ++ * use your version of this file under the terms of the MPL, indicate your |
1414 | ++ * decision by deleting the provisions above and replace them with the notice |
1415 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
1416 | ++ * the provisions above, a recipient may use your version of this file under |
1417 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
1418 | ++ * |
1419 | ++ * ***** END LICENSE BLOCK ***** */ |
1420 | ++ |
1421 | ++#include "nsKDERegistry.h" |
1422 | ++#include "prlink.h" |
1423 | ++#include "prmem.h" |
1424 | ++#include "nsString.h" |
1425 | ++#include "nsILocalFile.h" |
1426 | ++#include "nsMIMEInfoUnix.h" |
1427 | ++#include "nsAutoPtr.h" |
1428 | ++#include "nsKDEUtils.h" |
1429 | ++ |
1430 | ++/* static */ PRBool |
1431 | ++nsKDERegistry::HandlerExists(const char *aProtocolScheme) |
1432 | ++{ |
1433 | ++ nsCStringArray command; |
1434 | ++ command.AppendCString( NS_LITERAL_CSTRING( "HANDLEREXISTS" )); |
1435 | ++ command.AppendCString( nsCAutoString( aProtocolScheme )); |
1436 | ++ return nsKDEUtils::command( command ); |
1437 | ++} |
1438 | ++ |
1439 | ++/* static */ nsresult |
1440 | ++nsKDERegistry::LoadURL(nsIURI *aURL) |
1441 | ++{ |
1442 | ++ nsCStringArray command; |
1443 | ++ command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
1444 | ++ nsCString url; |
1445 | ++ aURL->GetSpec( url ); |
1446 | ++ command.AppendCString( url ); |
1447 | ++ return nsKDEUtils::command( command ); |
1448 | ++} |
1449 | ++ |
1450 | ++/* static */ void |
1451 | ++nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme, |
1452 | ++ nsAString& aDesc) |
1453 | ++{ |
1454 | ++ nsCStringArray command; |
1455 | ++ command.AppendCString( NS_LITERAL_CSTRING( "GETAPPDESCFORSCHEME" )); |
1456 | ++ command.AppendCString( aScheme ); |
1457 | ++ nsCStringArray output; |
1458 | ++ if( nsKDEUtils::command( command, &output ) && output.Count() == 1 ) |
1459 | ++ CopyUTF8toUTF16( *output[ 0 ], aDesc ); |
1460 | ++} |
1461 | ++ |
1462 | ++ |
1463 | ++/* static */ already_AddRefed<nsMIMEInfoBase> |
1464 | ++nsKDERegistry::GetFromExtension(const nsACString& aFileExt) |
1465 | ++{ |
1466 | ++ NS_ASSERTION(aFileExt[0] != '.', "aFileExt shouldn't start with a dot"); |
1467 | ++ nsCStringArray command; |
1468 | ++ command.AppendCString( NS_LITERAL_CSTRING( "GETFROMEXTENSION" )); |
1469 | ++ command.AppendCString( aFileExt ); |
1470 | ++ return GetFromHelper( command ); |
1471 | ++} |
1472 | ++ |
1473 | ++/* static */ already_AddRefed<nsMIMEInfoBase> |
1474 | ++nsKDERegistry::GetFromType(const nsACString& aMIMEType) |
1475 | ++{ |
1476 | ++ nsCStringArray command; |
1477 | ++ command.AppendCString( NS_LITERAL_CSTRING( "GETFROMTYPE" )); |
1478 | ++ command.AppendCString( aMIMEType ); |
1479 | ++ return GetFromHelper( command ); |
1480 | ++} |
1481 | ++ |
1482 | ++/* static */ already_AddRefed<nsMIMEInfoBase> |
1483 | ++nsKDERegistry::GetFromHelper(const nsCStringArray& command) |
1484 | ++{ |
1485 | ++ nsCStringArray output; |
1486 | ++ if( nsKDEUtils::command( command, &output ) && output.Count() == 3 ) |
1487 | ++ { |
1488 | ++ nsCString mimetype = *output[ 0 ]; |
1489 | ++ nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype ); |
1490 | ++ NS_ENSURE_TRUE(mimeInfo, nsnull); |
1491 | ++ nsCString description = *output[ 1 ]; |
1492 | ++ mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); |
1493 | ++ nsCString handlerAppName = *output[ 2 ]; |
1494 | ++ mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); |
1495 | ++ mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); |
1496 | ++ nsMIMEInfoBase* retval; |
1497 | ++ NS_ADDREF((retval = mimeInfo)); |
1498 | ++ return retval; |
1499 | ++ } |
1500 | ++ return nsnull; |
1501 | ++} |
1502 | +diff -Nur a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h |
1503 | +--- a/uriloader/exthandler/unix/nsKDERegistry.h 1970-01-01 01:00:00.000000000 +0100 |
1504 | ++++ b/uriloader/exthandler/unix/nsKDERegistry.h 2010-11-18 12:18:51.860642952 +0100 |
1505 | +@@ -0,0 +1,61 @@ |
1506 | ++/* ***** BEGIN LICENSE BLOCK ***** |
1507 | ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
1508 | ++ * |
1509 | ++ * The contents of this file are subject to the Mozilla Public License Version |
1510 | ++ * 1.1 (the "License"); you may not use this file except in compliance with |
1511 | ++ * the License. You may obtain a copy of the License at |
1512 | ++ * http://www.mozilla.org/MPL/ |
1513 | ++ * |
1514 | ++ * Software distributed under the License is distributed on an "AS IS" basis, |
1515 | ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
1516 | ++ * for the specific language governing rights and limitations under the |
1517 | ++ * License. |
1518 | ++ * |
1519 | ++ * The Original Code is the GNOME helper app implementation. |
1520 | ++ * |
1521 | ++ * The Initial Developer of the Original Code is |
1522 | ++ * IBM Corporation. |
1523 | ++ * Portions created by the Initial Developer are Copyright (C) 2003 |
1524 | ++ * the Initial Developer. All Rights Reserved. |
1525 | ++ * |
1526 | ++ * Contributor(s): |
1527 | ++ * Brian Ryner <bryner@brianryner.com> (Original Author) |
1528 | ++ * |
1529 | ++ * Alternatively, the contents of this file may be used under the terms of |
1530 | ++ * either the GNU General Public License Version 2 or later (the "GPL"), or |
1531 | ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
1532 | ++ * in which case the provisions of the GPL or the LGPL are applicable instead |
1533 | ++ * of those above. If you wish to allow use of your version of this file only |
1534 | ++ * under the terms of either the GPL or the LGPL, and not to allow others to |
1535 | ++ * use your version of this file under the terms of the MPL, indicate your |
1536 | ++ * decision by deleting the provisions above and replace them with the notice |
1537 | ++ * and other provisions required by the GPL or the LGPL. If you do not delete |
1538 | ++ * the provisions above, a recipient may use your version of this file under |
1539 | ++ * the terms of any one of the MPL, the GPL or the LGPL. |
1540 | ++ * |
1541 | ++ * ***** END LICENSE BLOCK ***** */ |
1542 | ++ |
1543 | ++#include "nsIURI.h" |
1544 | ++#include "nsCOMPtr.h" |
1545 | ++ |
1546 | ++class nsMIMEInfoBase; |
1547 | ++class nsCAutoString; |
1548 | ++class nsCStringArray; |
1549 | ++ |
1550 | ++class nsKDERegistry |
1551 | ++{ |
1552 | ++ public: |
1553 | ++ static PRBool HandlerExists(const char *aProtocolScheme); |
1554 | ++ |
1555 | ++ static nsresult LoadURL(nsIURI *aURL); |
1556 | ++ |
1557 | ++ static void GetAppDescForScheme(const nsACString& aScheme, |
1558 | ++ nsAString& aDesc); |
1559 | ++ |
1560 | ++ static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsACString& aFileExt); |
1561 | ++ |
1562 | ++ static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType); |
1563 | ++ private: |
1564 | ++ static already_AddRefed<nsMIMEInfoBase> GetFromHelper(const nsCStringArray& command); |
1565 | ++ |
1566 | ++}; |
1567 | +diff -Nur a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp |
1568 | +--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp 2010-11-15 21:40:50.000000000 +0100 |
1569 | ++++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp 2010-11-18 12:18:51.860642952 +0100 |
1570 | +@@ -53,18 +53,21 @@ |
1571 | + #endif |
1572 | + |
1573 | + #include "nsMIMEInfoUnix.h" |
1574 | +-#include "nsGNOMERegistry.h" |
1575 | ++#include "nsCommonRegistry.h" |
1576 | + #include "nsIGIOService.h" |
1577 | + #include "nsIGnomeVFSService.h" |
1578 | + #include "nsAutoPtr.h" |
1579 | + #ifdef MOZ_ENABLE_DBUS |
1580 | + #include "nsDBusHandlerApp.h" |
1581 | + #endif |
1582 | ++#if defined(XP_UNIX) && !defined(XP_MACOSX) |
1583 | ++#include "nsKDEUtils.h" |
1584 | ++#endif |
1585 | + |
1586 | + nsresult |
1587 | + nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI) |
1588 | + { |
1589 | +- nsresult rv = nsGNOMERegistry::LoadURL(aURI); |
1590 | ++ nsresult rv = nsCommonRegistry::LoadURL(aURI); |
1591 | + |
1592 | + #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) |
1593 | + if (NS_FAILED(rv)){ |
1594 | +@@ -96,12 +99,12 @@ |
1595 | + nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval) |
1596 | + { |
1597 | + *_retval = PR_FALSE; |
1598 | +- nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mSchemeOrType); |
1599 | ++ nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mSchemeOrType); |
1600 | + if (!mimeInfo) { |
1601 | + nsCAutoString ext; |
1602 | + nsresult rv = GetPrimaryExtension(ext); |
1603 | + if (NS_SUCCEEDED(rv)) { |
1604 | +- mimeInfo = nsGNOMERegistry::GetFromExtension(ext); |
1605 | ++ mimeInfo = nsCommonRegistry::GetFromExtension(ext); |
1606 | + } |
1607 | + } |
1608 | + if (mimeInfo) |
1609 | +@@ -154,6 +157,23 @@ |
1610 | + return NS_ERROR_FAILURE; |
1611 | + #endif |
1612 | + |
1613 | ++ if( nsKDEUtils::kdeSupport()) { |
1614 | ++ PRBool supports; |
1615 | ++ if( NS_SUCCEEDED( GetHasDefaultHandler( &supports )) && supports ) { |
1616 | ++ nsCStringArray command; |
1617 | ++ command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
1618 | ++ command.AppendCString( nativePath ); |
1619 | ++ command.AppendCString( NS_LITERAL_CSTRING( "MIMETYPE" )); |
1620 | ++ command.AppendCString( mSchemeOrType ); |
1621 | ++ if( nsKDEUtils::command( command )) |
1622 | ++ return NS_OK; |
1623 | ++ } |
1624 | ++ if (!mDefaultApplication) |
1625 | ++ return NS_ERROR_FILE_NOT_FOUND; |
1626 | ++ |
1627 | ++ return LaunchWithIProcess(mDefaultApplication, nativePath); |
1628 | ++ } |
1629 | ++ |
1630 | + nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); |
1631 | + nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
1632 | + if (giovfs) { |
1633 | +@@ -169,7 +189,7 @@ |
1634 | + |
1635 | + // If we haven't got an app we try to get a valid one by searching for the |
1636 | + // extension mapped type |
1637 | +- nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath); |
1638 | ++ nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath); |
1639 | + if (mimeInfo) { |
1640 | + nsCAutoString type; |
1641 | + mimeInfo->GetType(type); |
1642 | +diff -Nur a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp |
1643 | +--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp 2010-11-15 21:40:50.000000000 +0100 |
1644 | ++++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp 2010-11-18 12:18:51.860642952 +0100 |
1645 | +@@ -49,7 +49,7 @@ |
1646 | + #include "nsOSHelperAppService.h" |
1647 | + #include "nsMIMEInfoUnix.h" |
1648 | + #ifdef MOZ_WIDGET_GTK2 |
1649 | +-#include "nsGNOMERegistry.h" |
1650 | ++#include "nsCommonRegistry.h" |
1651 | + #endif |
1652 | + #include "nsISupports.h" |
1653 | + #include "nsString.h" |
1654 | +@@ -1224,7 +1224,7 @@ |
1655 | + |
1656 | + #ifdef MOZ_WIDGET_GTK2 |
1657 | + // Check the GConf registry for a protocol handler |
1658 | +- *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme); |
1659 | ++ *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme); |
1660 | + #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) |
1661 | + *aHandlerExists = nsMIMEInfoUnix::HandlerExists(aProtocolScheme); |
1662 | + #endif |
1663 | +@@ -1236,7 +1236,7 @@ |
1664 | + NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval) |
1665 | + { |
1666 | + #ifdef MOZ_WIDGET_GTK2 |
1667 | +- nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval); |
1668 | ++ nsCommonRegistry::GetAppDescForScheme(aScheme, _retval); |
1669 | + return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK; |
1670 | + #else |
1671 | + return NS_ERROR_NOT_AVAILABLE; |
1672 | +@@ -1332,7 +1332,7 @@ |
1673 | + |
1674 | + #ifdef MOZ_WIDGET_GTK2 |
1675 | + LOG(("Looking in GNOME registry\n")); |
1676 | +- nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromExtension(aFileExt).get(); |
1677 | ++ nsMIMEInfoBase *gnomeInfo = nsCommonRegistry::GetFromExtension(aFileExt).get(); |
1678 | + if (gnomeInfo) { |
1679 | + LOG(("Got MIMEInfo from GNOME registry\n")); |
1680 | + return gnomeInfo; |
1681 | +@@ -1458,7 +1458,7 @@ |
1682 | + // get back a MIMEInfo without any extensions set. In that case we'll have |
1683 | + // to look in our mime.types files for the extensions. |
1684 | + LOG(("Looking in GNOME registry\n")); |
1685 | +- gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType).get(); |
1686 | ++ gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType).get(); |
1687 | + if (gnomeInfo && gnomeInfo->HasExtensions()) { |
1688 | + LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n")); |
1689 | + return gnomeInfo; |
1690 | +diff -Nur a/widget/src/gtk2/Makefile.in b/widget/src/gtk2/Makefile.in |
1691 | +--- a/widget/src/gtk2/Makefile.in 2010-11-15 21:40:52.000000000 +0100 |
1692 | ++++ b/widget/src/gtk2/Makefile.in 2010-11-18 12:18:51.860642952 +0100 |
1693 | +@@ -162,6 +162,9 @@ |
1694 | + -I$(srcdir)/../shared \ |
1695 | + -I$(topsrcdir)/other-licenses/atk-1.0 \ |
1696 | + $(NULL) |
1697 | ++ |
1698 | ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
1699 | ++ |
1700 | + ifdef MOZ_X11 |
1701 | + INCLUDES += -I$(srcdir)/../shared/x11 |
1702 | + endif |
1703 | +diff -Nur a/widget/src/gtk2/nsFilePicker.cpp b/widget/src/gtk2/nsFilePicker.cpp |
1704 | +--- a/widget/src/gtk2/nsFilePicker.cpp 2010-11-15 21:41:30.000000000 +0100 |
1705 | ++++ b/widget/src/gtk2/nsFilePicker.cpp 2010-11-18 12:18:51.860642952 +0100 |
1706 | +@@ -36,6 +36,7 @@ |
1707 | + * ***** END LICENSE BLOCK ***** */ |
1708 | + |
1709 | + #include <gtk/gtk.h> |
1710 | ++#include <gdk/gdkx.h> |
1711 | + |
1712 | + #include "nsIFileURL.h" |
1713 | + #include "nsIURI.h" |
1714 | +@@ -55,6 +56,7 @@ |
1715 | + |
1716 | + #include "nsFilePicker.h" |
1717 | + #include "nsAccessibilityHelper.h" |
1718 | ++#include "nsKDEUtils.h" |
1719 | + |
1720 | + #ifdef MOZ_PLATFORM_MAEMO |
1721 | + #include <hildon-fm-2/hildon/hildon-file-chooser-dialog.h> |
1722 | +@@ -275,7 +277,9 @@ |
1723 | + { |
1724 | + if (aFilter.EqualsLiteral("..apps")) { |
1725 | + // No platform specific thing we can do here, really.... |
1726 | +- return NS_OK; |
1727 | ++ // Unless it's KDE. |
1728 | ++ if( mMode != modeOpen || !nsKDEUtils::kdeSupport()) |
1729 | ++ return NS_OK; |
1730 | + } |
1731 | + |
1732 | + nsCAutoString filter, name; |
1733 | +@@ -423,6 +427,9 @@ |
1734 | + NS_IMETHODIMP |
1735 | + nsFilePicker::Show(PRInt16 *aReturn) |
1736 | + { |
1737 | ++ if( nsKDEUtils::kdeSupport()) |
1738 | ++ return kdeFileDialog( aReturn ); |
1739 | ++ |
1740 | + NS_ENSURE_ARG_POINTER(aReturn); |
1741 | + |
1742 | + nsXPIDLCString title; |
1743 | +@@ -573,3 +580,229 @@ |
1744 | + |
1745 | + return NS_OK; |
1746 | + } |
1747 | ++ |
1748 | ++nsCString nsFilePicker::kdeMakeFilter( int index ) |
1749 | ++ { |
1750 | ++ nsCString buf = mFilters[ index ]; |
1751 | ++ for( PRUint32 i = 0; |
1752 | ++ i < buf.Length(); |
1753 | ++ ++i ) |
1754 | ++ if( buf[ i ] == ';' ) // KDE separates just using spaces |
1755 | ++ buf.SetCharAt( ' ', i ); |
1756 | ++ if (!mFilterNames[index].IsEmpty()) |
1757 | ++ { |
1758 | ++ buf += "|"; |
1759 | ++ buf += mFilterNames[index].get(); |
1760 | ++ } |
1761 | ++ return buf; |
1762 | ++ } |
1763 | ++ |
1764 | ++static PRInt32 windowToXid( nsIWidget* widget ) |
1765 | ++ { |
1766 | ++ GtkWindow *parent_widget = get_gtk_window_for_nsiwidget( widget ); |
1767 | ++ GdkWindow* gdk_window = gtk_widget_get_window( gtk_widget_get_toplevel( GTK_WIDGET( parent_widget ))); |
1768 | ++ return GDK_WINDOW_XID( gdk_window ); |
1769 | ++ } |
1770 | ++ |
1771 | ++NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn) |
1772 | ++ { |
1773 | ++ NS_ENSURE_ARG_POINTER(aReturn); |
1774 | ++ |
1775 | ++ if( mMode == modeOpen && mFilters.Length() == 1 && mFilters[ 0 ].EqualsLiteral( "..apps" )) |
1776 | ++ return kdeAppsDialog( aReturn ); |
1777 | ++ |
1778 | ++ nsXPIDLCString title; |
1779 | ++ title.Adopt(ToNewUTF8String(mTitle)); |
1780 | ++ |
1781 | ++ const char* arg = NULL; |
1782 | ++ if( mAllowURLs ) |
1783 | ++ { |
1784 | ++ switch( mMode ) |
1785 | ++ { |
1786 | ++ case nsIFilePicker::modeOpen: |
1787 | ++ case nsIFilePicker::modeOpenMultiple: |
1788 | ++ arg = "GETOPENURL"; |
1789 | ++ break; |
1790 | ++ case nsIFilePicker::modeSave: |
1791 | ++ arg = "GETSAVEURL"; |
1792 | ++ break; |
1793 | ++ case nsIFilePicker::modeGetFolder: |
1794 | ++ arg = "GETDIRECTORYURL"; |
1795 | ++ break; |
1796 | ++ } |
1797 | ++ } |
1798 | ++ else |
1799 | ++ { |
1800 | ++ switch( mMode ) |
1801 | ++ { |
1802 | ++ case nsIFilePicker::modeOpen: |
1803 | ++ case nsIFilePicker::modeOpenMultiple: |
1804 | ++ arg = "GETOPENFILENAME"; |
1805 | ++ break; |
1806 | ++ case nsIFilePicker::modeSave: |
1807 | ++ arg = "GETSAVEFILENAME"; |
1808 | ++ break; |
1809 | ++ case nsIFilePicker::modeGetFolder: |
1810 | ++ arg = "GETDIRECTORYFILENAME"; |
1811 | ++ break; |
1812 | ++ } |
1813 | ++ } |
1814 | ++ |
1815 | ++ nsCAutoString directory; |
1816 | ++ if (mDisplayDirectory) { |
1817 | ++ mDisplayDirectory->GetNativePath(directory); |
1818 | ++ } else if (mPrevDisplayDirectory) { |
1819 | ++ mPrevDisplayDirectory->GetNativePath(directory); |
1820 | ++ } |
1821 | ++ |
1822 | ++ nsCAutoString startdir; |
1823 | ++ if (!directory.IsEmpty()) { |
1824 | ++ startdir = directory; |
1825 | ++ } |
1826 | ++ if (mMode == nsIFilePicker::modeSave) { |
1827 | ++ if( !startdir.IsEmpty()) |
1828 | ++ { |
1829 | ++ startdir += "/"; |
1830 | ++ startdir += ToNewUTF8String(mDefault); |
1831 | ++ } |
1832 | ++ else |
1833 | ++ startdir = ToNewUTF8String(mDefault); |
1834 | ++ } |
1835 | ++ if( startdir.IsEmpty()) |
1836 | ++ startdir = "."; |
1837 | ++ |
1838 | ++ nsCAutoString filters; |
1839 | ++ PRInt32 count = mFilters.Length(); |
1840 | ++ if( count == 0 ) //just in case |
1841 | ++ filters = "*"; |
1842 | ++ else |
1843 | ++ { |
1844 | ++ filters = kdeMakeFilter( 0 ); |
1845 | ++ for (PRInt32 i = 1; i < count; ++i) |
1846 | ++ { |
1847 | ++ filters += "\n"; |
1848 | ++ filters += kdeMakeFilter( i ); |
1849 | ++ } |
1850 | ++ } |
1851 | ++ |
1852 | ++ nsCStringArray command; |
1853 | ++ command.AppendCString( nsCAutoString( arg )); |
1854 | ++ command.AppendCString( startdir ); |
1855 | ++ if( mMode != nsIFilePicker::modeGetFolder ) |
1856 | ++ { |
1857 | ++ command.AppendCString( filters ); |
1858 | ++ nsCAutoString selected; |
1859 | ++ selected.AppendInt( mSelectedType ); |
1860 | ++ command.AppendCString( selected ); |
1861 | ++ } |
1862 | ++ command.AppendCString( title ); |
1863 | ++ if( mMode == nsIFilePicker::modeOpenMultiple ) |
1864 | ++ command.AppendCString( NS_LITERAL_CSTRING( "MULTIPLE" )); |
1865 | ++ if( PRInt32 xid = windowToXid( mParentWidget )) |
1866 | ++ { |
1867 | ++ command.AppendCString( NS_LITERAL_CSTRING( "PARENT" )); |
1868 | ++ nsCAutoString parent; |
1869 | ++ parent.AppendInt( xid ); |
1870 | ++ command.AppendCString( parent ); |
1871 | ++ } |
1872 | ++ |
1873 | ++ nsCStringArray output; |
1874 | ++ if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
1875 | ++ { |
1876 | ++ *aReturn = nsIFilePicker::returnOK; |
1877 | ++ mFiles.Clear(); |
1878 | ++ if( mMode != nsIFilePicker::modeGetFolder ) |
1879 | ++ { |
1880 | ++ mSelectedType = atoi( output[ 0 ]->get()); |
1881 | ++ output.RemoveCStringAt( 0 ); |
1882 | ++ } |
1883 | ++ if (mMode == nsIFilePicker::modeOpenMultiple) |
1884 | ++ { |
1885 | ++ mFileURL.Truncate(); |
1886 | ++ PRUint32 count = output.Count(); |
1887 | ++ for( PRUint32 i = 0; |
1888 | ++ i < count; |
1889 | ++ ++i ) |
1890 | ++ { |
1891 | ++ nsCOMPtr<nsILocalFile> localfile; |
1892 | ++ nsresult rv = NS_NewNativeLocalFile( *output[ i ], |
1893 | ++ PR_FALSE, |
1894 | ++ getter_AddRefs(localfile)); |
1895 | ++ if (NS_SUCCEEDED(rv)) |
1896 | ++ mFiles.AppendObject(localfile); |
1897 | ++ } |
1898 | ++ } |
1899 | ++ else |
1900 | ++ { |
1901 | ++ if( output.Count() == 0 ) |
1902 | ++ mFileURL = nsCString(); |
1903 | ++ else if( mAllowURLs ) |
1904 | ++ mFileURL = *output[ 0 ]; |
1905 | ++ else // GetFile() actually requires it to be url even for local files :-/ |
1906 | ++ { |
1907 | ++ mFileURL = nsCString( "file://" ); |
1908 | ++ mFileURL.Append( *output[ 0 ] ); |
1909 | ++ } |
1910 | ++ } |
1911 | ++ // Remember last used directory. |
1912 | ++ nsCOMPtr<nsILocalFile> file; |
1913 | ++ GetFile(getter_AddRefs(file)); |
1914 | ++ if (file) { |
1915 | ++ nsCOMPtr<nsIFile> dir; |
1916 | ++ file->GetParent(getter_AddRefs(dir)); |
1917 | ++ nsCOMPtr<nsILocalFile> localDir(do_QueryInterface(dir)); |
1918 | ++ if (localDir) { |
1919 | ++ localDir.swap(mPrevDisplayDirectory); |
1920 | ++ } |
1921 | ++ } |
1922 | ++ if (mMode == nsIFilePicker::modeSave) |
1923 | ++ { |
1924 | ++ nsCOMPtr<nsILocalFile> file; |
1925 | ++ GetFile(getter_AddRefs(file)); |
1926 | ++ if (file) |
1927 | ++ { |
1928 | ++ PRBool exists = PR_FALSE; |
1929 | ++ file->Exists(&exists); |
1930 | ++ if (exists) // TODO do overwrite check in the helper app |
1931 | ++ *aReturn = nsIFilePicker::returnReplace; |
1932 | ++ } |
1933 | ++ } |
1934 | ++ } |
1935 | ++ else |
1936 | ++ { |
1937 | ++ *aReturn = nsIFilePicker::returnCancel; |
1938 | ++ } |
1939 | ++ return NS_OK; |
1940 | ++ } |
1941 | ++ |
1942 | ++ |
1943 | ++NS_IMETHODIMP nsFilePicker::kdeAppsDialog(PRInt16 *aReturn) |
1944 | ++ { |
1945 | ++ NS_ENSURE_ARG_POINTER(aReturn); |
1946 | ++ |
1947 | ++ nsXPIDLCString title; |
1948 | ++ title.Adopt(ToNewUTF8String(mTitle)); |
1949 | ++ |
1950 | ++ nsCStringArray command; |
1951 | ++ command.AppendCString( NS_LITERAL_CSTRING( "APPSDIALOG" )); |
1952 | ++ command.AppendCString( title ); |
1953 | ++ if( PRInt32 xid = windowToXid( mParentWidget )) |
1954 | ++ { |
1955 | ++ command.AppendCString( NS_LITERAL_CSTRING( "PARENT" )); |
1956 | ++ nsCAutoString parent; |
1957 | ++ parent.AppendInt( xid ); |
1958 | ++ command.AppendCString( parent ); |
1959 | ++ } |
1960 | ++ |
1961 | ++ nsCStringArray output; |
1962 | ++ if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) |
1963 | ++ { |
1964 | ++ *aReturn = nsIFilePicker::returnOK; |
1965 | ++ mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString(); |
1966 | ++ } |
1967 | ++ else |
1968 | ++ { |
1969 | ++ *aReturn = nsIFilePicker::returnCancel; |
1970 | ++ } |
1971 | ++ return NS_OK; |
1972 | ++ } |
1973 | +diff -Nur a/widget/src/gtk2/nsFilePicker.h b/widget/src/gtk2/nsFilePicker.h |
1974 | +--- a/widget/src/gtk2/nsFilePicker.h 2010-11-15 21:40:52.000000000 +0100 |
1975 | ++++ b/widget/src/gtk2/nsFilePicker.h 2010-11-18 12:18:51.860642952 +0100 |
1976 | +@@ -94,6 +94,12 @@ |
1977 | + |
1978 | + private: |
1979 | + static nsILocalFile *mPrevDisplayDirectory; |
1980 | ++ |
1981 | ++ bool kdeRunning(); |
1982 | ++ bool getKdeRunning(); |
1983 | ++ NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn); |
1984 | ++ NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn); |
1985 | ++ nsCString kdeMakeFilter( int index ); |
1986 | + }; |
1987 | + |
1988 | + #endif |
1989 | +diff -Nur a/xpcom/components/Makefile.in b/xpcom/components/Makefile.in |
1990 | +--- a/xpcom/components/Makefile.in 2010-11-15 21:40:53.000000000 +0100 |
1991 | ++++ b/xpcom/components/Makefile.in 2010-11-18 12:18:51.860642952 +0100 |
1992 | +@@ -99,5 +99,6 @@ |
1993 | + DEFINES += -D_IMPL_NS_COM |
1994 | + |
1995 | + ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT))) |
1996 | ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre |
1997 | + CXXFLAGS += $(MOZ_GTK2_CFLAGS) |
1998 | + endif |
1999 | +diff -Nur a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp |
2000 | +--- a/xpcom/components/ManifestParser.cpp 2010-11-15 21:40:53.000000000 +0100 |
2001 | ++++ b/xpcom/components/ManifestParser.cpp 2010-11-18 12:18:51.860642952 +0100 |
2002 | +@@ -60,6 +60,7 @@ |
2003 | + #include "nsIScriptError.h" |
2004 | + #include "nsIXULAppInfo.h" |
2005 | + #include "nsIXULRuntime.h" |
2006 | ++#include "nsKDEUtils.h" |
2007 | + |
2008 | + struct ManifestDirective |
2009 | + { |
2010 | +@@ -427,6 +428,7 @@ |
2011 | + NS_NAMED_LITERAL_STRING(kOs, "os"); |
2012 | + NS_NAMED_LITERAL_STRING(kOsVersion, "osversion"); |
2013 | + NS_NAMED_LITERAL_STRING(kABI, "abi"); |
2014 | ++ NS_NAMED_LITERAL_STRING(kDesktop, "desktop"); |
2015 | + |
2016 | + // Obsolete |
2017 | + NS_NAMED_LITERAL_STRING(kXPCNativeWrappers, "xpcnativewrappers"); |
2018 | +@@ -466,6 +468,7 @@ |
2019 | + } |
2020 | + |
2021 | + nsAutoString osVersion; |
2022 | ++ nsAutoString desktop; |
2023 | + #if defined(XP_WIN) |
2024 | + OSVERSIONINFO info = { sizeof(OSVERSIONINFO) }; |
2025 | + if (GetVersionEx(&info)) { |
2026 | +@@ -473,6 +476,7 @@ |
2027 | + info.dwMajorVersion, |
2028 | + info.dwMinorVersion); |
2029 | + } |
2030 | ++ desktop = NS_LITERAL_STRING("win"); |
2031 | + #elif defined(XP_MACOSX) |
2032 | + SInt32 majorVersion, minorVersion; |
2033 | + if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) && |
2034 | +@@ -481,10 +485,12 @@ |
2035 | + majorVersion, |
2036 | + minorVersion); |
2037 | + } |
2038 | ++ desktop = NS_LITERAL_STRING("macosx"); |
2039 | + #elif defined(MOZ_WIDGET_GTK2) |
2040 | + nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(), |
2041 | + gtk_major_version, |
2042 | + gtk_minor_version); |
2043 | ++ desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome"); |
2044 | + #endif |
2045 | + |
2046 | + // Because contracts must be registered after CIDs, we save and process them |
2047 | +@@ -563,6 +569,7 @@ |
2048 | + TriState stABI = eUnspecified; |
2049 | + bool platform = false; |
2050 | + bool contentAccessible = false; |
2051 | ++ TriState stDesktop = eUnspecified; |
2052 | + |
2053 | + while (NULL != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) && ok) { |
2054 | + ToLowerCase(token); |
2055 | +@@ -571,6 +578,7 @@ |
2056 | + if (CheckStringFlag(kApplication, wtoken, appID, stApp) || |
2057 | + CheckStringFlag(kOs, wtoken, osTarget, stOs) || |
2058 | + CheckStringFlag(kABI, wtoken, abi, stABI) || |
2059 | ++ CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || |
2060 | + CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) || |
2061 | + CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion)) |
2062 | + continue; |
2063 | +@@ -599,6 +607,7 @@ |
2064 | + stAppVersion == eBad || |
2065 | + stOs == eBad || |
2066 | + stOsVersion == eBad || |
2067 | ++ stDesktop == eBad || |
2068 | + stABI == eBad) |
2069 | + continue; |
2070 | + |
2071 | +diff -Nur a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in |
2072 | +--- a/xpcom/io/Makefile.in 2010-11-15 21:41:30.000000000 +0100 |
2073 | ++++ b/xpcom/io/Makefile.in 2010-11-18 12:18:51.860642952 +0100 |
2074 | +@@ -197,7 +197,7 @@ |
2075 | + endif |
2076 | + endif |
2077 | + |
2078 | +-LOCAL_INCLUDES += -I.. |
2079 | ++LOCAL_INCLUDES += -I.. -I$(topsrcdir)/toolkit/xre |
2080 | + |
2081 | + ifeq ($(MOZ_PLATFORM_MAEMO),5) |
2082 | + CFLAGS += $(MOZ_DBUS_CFLAGS) |
2083 | +diff -Nur a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp |
2084 | +--- a/xpcom/io/nsLocalFileUnix.cpp 2010-11-15 21:40:56.000000000 +0100 |
2085 | ++++ b/xpcom/io/nsLocalFileUnix.cpp 2010-11-18 12:18:51.860642952 +0100 |
2086 | +@@ -96,6 +96,7 @@ |
2087 | + #ifdef MOZ_WIDGET_GTK2 |
2088 | + #include "nsIGIOService.h" |
2089 | + #include "nsIGnomeVFSService.h" |
2090 | ++#include "nsKDEUtils.h" |
2091 | + #endif |
2092 | + |
2093 | + #ifdef XP_MACOSX |
2094 | +@@ -1823,21 +1824,13 @@ |
2095 | + nsLocalFile::Reveal() |
2096 | + { |
2097 | + #ifdef MOZ_WIDGET_GTK2 |
2098 | +- nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); |
2099 | +- nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
2100 | +- if (!giovfs && !gnomevfs) |
2101 | +- return NS_ERROR_FAILURE; |
2102 | +- |
2103 | ++ nsCAutoString url; |
2104 | + PRBool isDirectory; |
2105 | + if (NS_FAILED(IsDirectory(&isDirectory))) |
2106 | + return NS_ERROR_FAILURE; |
2107 | + |
2108 | + if (isDirectory) { |
2109 | +- if (giovfs) |
2110 | +- return giovfs->ShowURIForInput(mPath); |
2111 | +- else |
2112 | +- /* Fallback to GnomeVFS */ |
2113 | +- return gnomevfs->ShowURIForInput(mPath); |
2114 | ++ url = mPath; |
2115 | + } else { |
2116 | + nsCOMPtr<nsIFile> parentDir; |
2117 | + nsCAutoString dirPath; |
2118 | +@@ -1846,11 +1839,25 @@ |
2119 | + if (NS_FAILED(parentDir->GetNativePath(dirPath))) |
2120 | + return NS_ERROR_FAILURE; |
2121 | + |
2122 | +- if (giovfs) |
2123 | +- return giovfs->ShowURIForInput(dirPath); |
2124 | +- else |
2125 | +- return gnomevfs->ShowURIForInput(dirPath); |
2126 | ++ url = dirPath; |
2127 | ++ } |
2128 | ++ |
2129 | ++ if(nsKDEUtils::kdeSupport()) { |
2130 | ++ nsCStringArray command; |
2131 | ++ command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
2132 | ++ command.AppendCString( url ); |
2133 | ++ return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
2134 | + } |
2135 | ++ |
2136 | ++ nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); |
2137 | ++ nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
2138 | ++ if (!giovfs && !gnomevfs) |
2139 | ++ return NS_ERROR_FAILURE; |
2140 | ++ |
2141 | ++ if (giovfs) |
2142 | ++ return giovfs->ShowURIForInput(url); |
2143 | ++ else |
2144 | ++ return gnomevfs->ShowURIForInput(url); |
2145 | + #elif defined(XP_MACOSX) |
2146 | + CFURLRef url; |
2147 | + if (NS_SUCCEEDED(GetCFURL(&url))) { |
2148 | +@@ -1886,6 +1893,13 @@ |
2149 | + return NS_ERROR_FAILURE; |
2150 | + return NS_OK; |
2151 | + #else |
2152 | ++ if( nsKDEUtils::kdeSupport()) { |
2153 | ++ nsCStringArray command; |
2154 | ++ command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); |
2155 | ++ command.AppendCString( mPath ); |
2156 | ++ return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; |
2157 | ++ } |
2158 | ++ |
2159 | + nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); |
2160 | + nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); |
2161 | + if (giovfs) { |
2162 | |
2163 | === modified file 'debian/patches/series' |
2164 | --- debian/patches/series 2010-11-15 17:52:02 +0000 |
2165 | +++ debian/patches/series 2010-11-19 17:04:04 +0000 |
2166 | @@ -14,3 +14,5 @@ |
2167 | bzXXX_plugin_for_mimetype_pref.patch |
2168 | #bz467738_att351145_lockPref_everywhere.patch |
2169 | install_ubuntu_prefs.patch |
2170 | +mozilla-kde.patch |
2171 | +firefox-kde.patch |
2172 | |
2173 | === modified file 'debian/rules' |
2174 | --- debian/rules 2010-11-16 13:10:55 +0000 |
2175 | +++ debian/rules 2010-11-19 17:04:04 +0000 |
2176 | @@ -402,6 +402,11 @@ |
2177 | chmod a+x debian/$$i; \ |
2178 | done |
2179 | |
2180 | + # KDE integration |
2181 | + cp $(DEB_SRCDIR)/toolkit/content/widgets/dialog.xml $(DEB_SRCDIR)/toolkit/content/widgets/dialog-kde.xml |
2182 | + cp $(DEB_SRCDIR)/toolkit/content/widgets/preferences.xml $(DEB_SRCDIR)/toolkit/content/widgets/preferences-kde.xml |
2183 | + cp $(DEB_SRCDIR)/browser/base/content/browser.xul $(DEB_SRCDIR)/browser/base/content/browser-kde.xul |
2184 | + |
2185 | clean:: regen-debian-control |
2186 | set -e; for i in $(UUDECODE); do \ |
2187 | rm -f debian/$$i; \ |