2
chrome/chrome_exe.gypi | 1
3
chrome/chrome_installer.gypi | 1
4
third_party/xdg-utils/ChangeLog | 155 +++++++++++++
5
third_party/xdg-utils/README.chromium | 21 +
6
third_party/xdg-utils/README.google | 12 -
7
third_party/xdg-utils/scripts/Makefile.in | 4
8
third_party/xdg-utils/scripts/man/xdg-open.1 | 6
9
third_party/xdg-utils/scripts/xdg-copy | 6
10
third_party/xdg-utils/scripts/xdg-copy.in | 6
11
third_party/xdg-utils/scripts/xdg-desktop-icon | 39 +--
12
third_party/xdg-utils/scripts/xdg-desktop-icon.in | 30 +-
13
third_party/xdg-utils/scripts/xdg-desktop-menu | 82 +------
14
third_party/xdg-utils/scripts/xdg-desktop-menu.in | 75 +-----
15
third_party/xdg-utils/scripts/xdg-email | 107 ++++++++-
16
third_party/xdg-utils/scripts/xdg-email.in | 100 +++++++-
17
third_party/xdg-utils/scripts/xdg-file-dialog.in | 2
18
third_party/xdg-utils/scripts/xdg-icon-resource | 30 +-
19
third_party/xdg-utils/scripts/xdg-icon-resource.in | 23 +-
20
third_party/xdg-utils/scripts/xdg-mime | 237 +++++++++++++++------
21
third_party/xdg-utils/scripts/xdg-mime.in | 230 +++++++++++++++-----
22
third_party/xdg-utils/scripts/xdg-open | 120 ++++++++--
23
third_party/xdg-utils/scripts/xdg-open.in | 113 +++++++---
24
third_party/xdg-utils/scripts/xdg-screensaver | 181 ++++++++++------
25
third_party/xdg-utils/scripts/xdg-screensaver.in | 128 +++++++----
26
third_party/xdg-utils/scripts/xdg-settings | 22 +
27
third_party/xdg-utils/scripts/xdg-settings.in | 17 -
28
third_party/xdg-utils/scripts/xdg-su.in | 2
29
third_party/xdg-utils/scripts/xdg-utils-common.in | 5
30
28 files changed, 1237 insertions(+), 518 deletions(-)
32
Index: src/third_party/xdg-utils/ChangeLog
33
===================================================================
34
--- src.orig/third_party/xdg-utils/ChangeLog
35
+++ src/third_party/xdg-utils/ChangeLog
37
-=== xdg-utils 1.x.x ====
38
+=== xdg-utils 1.x.x ===
40
-2009-07-27 Fathi Boudra <fabo@debian.org>
41
+2010-07-09 Rex Dieter <rdieter@fedoraproject.org>
42
+ * xdg-screensaver: consider gnome-screensaver a separate DE (BR20027)
44
+2010-07-09 Rex Dieter <rdieter@fedoraproject.org>
45
+ * xdg-mime : use 'gnomevfs-info --slow-mime' (BR 13939)
47
+2010-07-09 Rex Dieter <rdieter@fedoraproject.org>
48
+ * xdg-desktop-icon : use localized desktop folder name (BR19011)
50
+2010-07-09 Rex Dieter <rdieter@fedoraproject.org>
51
+ * xdg-open : use mimeopen -L (follow symlinks)
53
+2010-07-09 Rex Dieter <rdieter@fedoraproject.org>
54
+ * xdg-open.1 : add FILES, SEE ALSO sections
56
+2010-05-16 Rex Dieter <rdieter@fedoraproject.org>
57
+ * xdg-open: Spaces in filename (BR27959)
59
+2010-04-22 Fathi Boudra <fabo@freedesktop.org>
60
+ * xdg-email and xdg-open: perform BROWSER check in any case.
61
+ Thanks to Andrea Florio. (BR27551)
63
+2010-04-22 Fathi Boudra <fabo@freedesktop.org>
64
+ * xdg-email: try console mode browsers and update the browser list.
66
+2010-02-28 Fathi Boudra <fabo@freedesktop.org>
67
+ * xdg-utils-common: fix the comment of exit_failure_file_permission_write
70
+2010-02-28 Fathi Boudra <fabo@freedesktop.org>
71
+ * xdg-open: fix regression in open_generic as xdg-mime doesn't handle
72
+ URLs (mimeopen and run-mailcap as well). Move xdg-mime call into
73
+ a new function (open_generic_xdg_mime). Check input file before
74
+ trying to open them with non-browsers.
76
+2010-02-28 Fathi Boudra <fabo@freedesktop.org>
77
+ * xdg-open: fix failure if $BROWSER has arguments. (BR14374)
78
+ Thanks to Johannes Wegener.
80
+2010-02-28 Fathi Boudra <fabo@freedesktop.org>
81
+ * xdg-open: try console mode browsers and update the browser list.
82
+ Thanks to Ville Skyttä and Pablo Castellano. (BR14361)
84
+2010-02-24 Fathi Boudra <fabo@freedesktop.org>
85
+ * xdg-screensaver: use dbus-send instead of qdbus for freedesktop
88
+2010-02-23 Fathi Boudra <fabo@freedesktop.org>
89
+ * xdg-mime: improve MIME string check when using gnomevfs-info. (BR12818)
91
+2010-02-23 Fathi Boudra <fabo@freedesktop.org>
92
+ * xdg-mime: report error on failure.
94
+2010-02-21 Fathi Boudra <fabo@freedesktop.org>
95
+ * xdg-open: in open_generic, use xdg-mime to lookup mime type and
96
+ association before the alternatives methods (mimeopen and run-mailcap).
99
+2010-02-20 Fathi Boudra <fabo@freedesktop.org>
100
+ * Add gvfs-copy and gvfs-info support. (BR15828)
102
+2010-01-27 Rex Dieter <rdieter@fedoraproject.org>
103
+ * xdg-settings: Add %s to the command in the Gnome url handlers (BR26284)
105
+2010-01-18 Rex Dieter <rdieter@fedoraproject.org>
106
+ * xdg-screensaver resume activates the screensaver on KDE4 (BR26085)
108
+2009-10-16 Rex Dieter <rdieter@fedoraproject.org>
109
+ * prefer gvfs-open over gnome-open
110
+ * DE=gnome, if org.gnome.SessionManager exists on dbus
112
+2009-10-12 Fathi Boudra <fabo@freedesktop.org>
113
+ * Fix xdg-email --attach failure with Evolution. (BR23007)
114
+ Thanks to Dwayne Bailey <dwayne@translate.org.za>
116
+2009-10-12 Fathi Boudra <fabo@freedesktop.org>
117
+ * Add an extra check in xdg-open and call kfmclient openURL as a fallback
118
+ on KDE 4. Thanks to Nicolas Lécureil <neoclust@mandriva.org>
120
+2009-10-12 Fathi Boudra <fabo@freedesktop.org>
121
+ * Add email attachments support to Thunderbird from xdg-email. (BR13435)
122
+ Thanks to Lei Zhang <thestig@google.com>
124
+2009-10-12 Fathi Boudra <fabo@freedesktop.org>
125
+ * Fix xdg-open to handle URL with '#' symbol. (BR23319, BR24375)
127
+2009-10-12 Fathi Boudra <fabo@freedesktop.org>
128
+ * Remove bash requirement to xdg-open and xdg-email. (BR20015)
130
+2009-10-12 Fathi Boudra <fabo@freedesktop.org>
131
+ * Update xdg-settings - Thanks to Mike Mammarella:
132
+ This fixes some issues where user-generated icons would be detected as
133
+ the official .desktop file for a binary, rather than the actual version.
134
+ (It resolves forward and compares binaries rather than resolving backward
135
+ to a .desktop file from a binary)
137
+2009-09-28 Rex Dieter <rdieter@fedoraproject.org>
138
+ * Use kde-open, if available (ie, KDE 4)
140
+2009-09-13 Rex Dieter <rdieter@fedoraproject.org>
141
+ * detect_de: suppress xprop stderr.
143
+2009-08-25 Rex Dieter <rdieter@fedoraproject.org>
144
+ * fix build for missing manpages (eg. xdg-settings)
146
+2009-08-25 Fathi Boudra <fabo@freedesktop.org>
147
+ * Fix hardcoded KDE home directory. Use kde(4)-config to get path.
149
+2009-08-25 Fathi Boudra <fabo@freedesktop.org>
150
+ * Apply patch from Mike Mammarella <mdm@chromium.org> to fix 2 issues:
151
+ - skip invisible desktop files when looking up the default web browser in
152
+ GNOME. (http://codereview.chromium.org/159738)
153
+ - check for localized settings by hand in xdg-settings if kreadconfig
154
+ fails. (http://codereview.chromium.org/160376)
156
+2009-08-10 Fathi Boudra <fabo@freedesktop.org>
157
+ * Replace kfmclient by kioclient usage under KDE 4.
158
+ Thanks to Nicolas Lécureil <neoclust@mandriva.org>
160
+2009-08-03 Fathi Boudra <fabo@freedesktop.org>
161
+ * Remove fixup_mandriva_categories() function. It is not needed anymore
162
+ since a year. Thanks to Nicolas Lécureil <neoclust@mandriva.org>
164
+2009-07-29 Fathi Boudra <fabo@freedesktop.org>
165
+ * Merge xdg-settings utility: a script to get various settings from
166
+ the desktop environment. Thanks to Dan Kegel and Google Inc.
168
+2009-07-29 Fathi Boudra <fabo@freedesktop.org>
169
+ * Fix hardcoded path in make_default_kde() in xdg-mime unde KDE 3.
170
+ Add initial KDE 4 support to the function.
172
+2009-07-28 Fathi Boudra <fabo@freedesktop.org>
173
+ * Use kbuildsycoca4 under KDE 4 and kbuildsycoca under KDE 3.
175
+2009-07-28 Fathi Boudra <fabo@freedesktop.org>
176
+ * Use kmimetypefinder under KDE 4 and kfile under KDE 3.
178
+2009-07-28 Fathi Boudra <fabo@freedesktop.org>
179
+ * Add KDE 4 support to xdg-mime. kdetradertest was replaced by
180
+ ktraderclient under KDE 4. (BR22975)
182
+2009-07-27 Fathi Boudra <fabo@freedesktop.org>
183
* Remove -u option from su. It doesn't have it.
185
-2009-07-27 Fathi Boudra <fabo@debian.org>
186
+2009-07-27 Fathi Boudra <fabo@freedesktop.org>
187
* Add KDE 4 support to xdg-email (BR17268)
189
-2009-07-26 Fathi Boudra <fabo@debian.org>
190
+2009-07-26 Fathi Boudra <fabo@freedesktop.org>
191
* Sleep for 50s instead of 59s to avoid to froze the seesion (BR19414)
193
-2009-07-26 Fathi Boudra <fabo@debian.org>
194
+2009-07-26 Fathi Boudra <fabo@freedesktop.org>
195
* Fix a race condition in xdg-screensaver (BR19382)
197
-2009-07-26 Fathi Boudra <fabo@debian.org>
198
+2009-07-26 Fathi Boudra <fabo@freedesktop.org>
199
* Fix basename usage when filename contains spaces (BR18567)
201
-2009-07-26 Fathi Boudra <fabo@debian.org>
202
+2009-07-26 Fathi Boudra <fabo@freedesktop.org>
203
* Fix bashisms used in xdg-mime and xdg-screensaver (BR15827)
205
2008-08-11 Rex Dieter <rdieter@fedoraproject.org>
206
* initial support for KDE 4
207
* Add dbus commands to xdg-screensaver for KDE 4 (BR17537)
209
2008-01-24 Kevin Krammer <kevin.krammer@gmx.at>
210
* Fixing security issue in xdg-email and xdg-open at replacing
211
Index: src/third_party/xdg-utils/README.chromium
212
===================================================================
214
+++ src/third_party/xdg-utils/README.chromium
217
+URL: http://portland.freedesktop.org/wiki/
219
+This directory contains a copy of xdg-utils obtained from CVS on 2010-08-30,
222
+cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/portland co -d xdg-utils portland/xdg-utils
224
+The .cvsignore files were converted to svn:ignore properties to check it in.
226
+Originally, it had been modified to add the xdg-settings command for getting
227
+and, in some cases, setting various GNU/Linux desktop environment settings like
228
+the default web browser and proxy configuration.
230
+This change has since been incorporated upstream.
232
+We now have this copy only to allow us to ship our own copy of xdg-settings (and
233
+xdg-mime, because we need a newer version than some distributions include). When
234
+these are standard, we can delete our copy.
236
+The license for xdg-utils is in the LICENSE file and is similar to BSD-style.
237
Index: src/third_party/xdg-utils/README.google
238
===================================================================
239
--- src.orig/third_party/xdg-utils/README.google
242
-This directory contains a copy of xdg-utils obtained from CVS on 2009-07-27,
245
-cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/portland co -d xdg-utils portland/xdg-utils
247
-The .cvsignore files were converted to svn:ignore properties to check it in.
249
-It has been modified to add the xdg-settings command for getting and, in some
250
-cases, setting various GNU/Linux desktop environment settings like the default
251
-web browser and proxy configuration.
253
-The license for xdg-utils is in the LICENSE file and is similar to BSD-style.
254
Index: src/third_party/xdg-utils/scripts/Makefile.in
255
===================================================================
256
--- src.orig/third_party/xdg-utils/scripts/Makefile.in
257
+++ src/third_party/xdg-utils/scripts/Makefile.in
260
$(MKDIR) $(DESTDIR)$(bindir)
261
for x in $(SCRIPTS) ; do \
262
$(INSTALL_SCRIPT) $$x $(DESTDIR)$(bindir) ; \
264
$(MKDIR) $(DESTDIR)$(mandir)
265
$(MKDIR) $(DESTDIR)$(mandir)/man1
266
for x in $(MANPAGES) ; do \
267
- $(INSTALL_DATA) $$x $(DESTDIR)$(mandir)/man1 ; \
268
+ if [ -f $$x ]; then \
269
+ $(INSTALL_DATA) $$x $(DESTDIR)$(mandir)/man1 ; \
274
for x in $(MANPAGES) ; do \
275
rm -f $(DESTDIR)$(mandir)/man1/`basename $$x` ; \
277
-$(RMDIR) $(DESTDIR)$(mandir)/man1
278
-$(RMDIR) $(DESTDIR)$(mandir)
279
Index: src/third_party/xdg-utils/scripts/man/xdg-open.1
280
===================================================================
281
--- src.orig/third_party/xdg-utils/scripts/man/xdg-open.1
282
+++ src/third_party/xdg-utils/scripts/man/xdg-open.1
285
Opens the Freedesktop.org website in the user's default browser
288
xdg\-open /tmp/foobar.png
291
Opens the PNG image file /tmp/foobar.png in the user's default image viewing application.
294
+\fI/usr/share/applications/defaults.list ~/.local/share/applications\fR
299
Kevin Krammer, Jeremy White.
301
<kevin.krammer@gmx.at>
303
<jwhite@codeweavers.com>
304
Index: src/third_party/xdg-utils/scripts/xdg-copy
305
===================================================================
306
--- src.orig/third_party/xdg-utils/scripts/xdg-copy
307
+++ src/third_party/xdg-utils/scripts/xdg-copy
308
@@ -235,17 +235,21 @@
311
exit_failure_operation_failed
317
- gnomevfs-copy "$1" "$2"
318
+ if gvfs-copy --help 2>/dev/null 1>&2; then
319
+ gvfs-copy "$1" "$2"
321
+ gnomevfs-copy "$1" "$2"
324
if [ $? -eq 0 ]; then
327
exit_failure_operation_failed
331
Index: src/third_party/xdg-utils/scripts/xdg-copy.in
332
===================================================================
333
--- src.orig/third_party/xdg-utils/scripts/xdg-copy.in
334
+++ src/third_party/xdg-utils/scripts/xdg-copy.in
338
exit_failure_operation_failed
344
- gnomevfs-copy "$1" "$2"
345
+ if gvfs-copy --help 2>/dev/null 1>&2; then
346
+ gvfs-copy "$1" "$2"
348
+ gnomevfs-copy "$1" "$2"
351
if [ $? -eq 0 ]; then
354
exit_failure_operation_failed
358
Index: src/third_party/xdg-utils/scripts/xdg-desktop-icon
359
===================================================================
360
--- src.orig/third_party/xdg-utils/scripts/xdg-desktop-icon
361
+++ src/third_party/xdg-utils/scripts/xdg-desktop-icon
362
@@ -296,17 +296,17 @@
363
if [ $# -gt 0 ]; then
364
echo "xdg-desktop-icon: $@" >&2
370
#------------------------------------------------------------
371
-# Exit script on insufficient permission to read a specified file
372
+# Exit script on insufficient permission to write a specified file
374
exit_failure_file_permission_write()
376
if [ $# -gt 0 ]; then
377
echo "xdg-desktop-icon: $@" >&2
381
@@ -373,17 +373,17 @@
390
- echo "xdg-desktop-icon 1.0.1"
391
+ echo "xdg-desktop-icon 1.0.2"
398
check_common_commands "$@"
400
@@ -399,17 +399,18 @@
401
#--------------------------------------
402
# Checks for known desktop environments
403
# set variable DE to the desktop environments name, lowercase
407
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
408
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
409
- elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
410
+ elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
411
+ elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
415
#----------------------------------------------------------------------------
416
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
417
# It also always returns 1 in KDE 3.4 and earlier
418
# Simply return 0 in such case
420
@@ -420,17 +421,17 @@
421
minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'`
422
release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'`
423
test "$major" -gt 3 && return $1
424
test "$minor" -gt 5 && return $1
425
test "$release" -gt 4 && return $1
429
-[ x"$1" != x"" ] || exit_failure_syntax
430
+[ x"$1" != x"" ] || exit_failure_syntax
439
@@ -477,73 +478,77 @@
440
exit_failure_syntax "command argument missing"
443
if [ -z "$desktop_file" ] ; then
444
exit_failure_syntax "FILE argument missing"
448
-case $desktop_file in
449
+case "$desktop_file" in
452
if [ "$vendor" = "true" -a "$action" = "install" ] ; then
453
check_vendor_prefix "$desktop_file"
462
-desktop_dir="$HOME/Desktop"
463
+if xdg-user-dir 2>/dev/null 1>&2; then
464
+ desktop_dir=`xdg-user-dir DESKTOP`
466
desktop_dir_kde=`kde${KDE_SESSION_VERSION}-config --userpath desktop 2> /dev/null`
467
if gconftool-2 -g /apps/nautilus/preferences/desktop_is_home_dir 2> /dev/null | grep true > /dev/null; then
468
desktop_dir_gnome="$HOME"
469
# Don't create $HOME/Desktop if it doesn't exist
470
- [ -w $desktop_dir ] || desktop_dir=
471
+ [ -w "$desktop_dir" ] || desktop_dir=
473
if [ -n "$desktop_dir_kde" ]; then
474
if [ ! -d "$desktop_dir_kde" ]; then
477
- mkdir -p $desktop_dir_kde
478
+ mkdir -p "$desktop_dir_kde"
481
# Is the KDE desktop dir != $HOME/Desktop ?
482
if [ x`readlink -f "$desktop_dir"` != x`readlink -f "$desktop_dir_kde"` ]; then
483
# If so, don't create $HOME/Desktop if it doesn't exist
484
- [ -w $desktop_dir ] || desktop_dir=
485
+ [ -w "$desktop_dir" ] || desktop_dir=
490
-desktop_dir="$desktop_dir $desktop_dir_kde $desktop_dir_gnome"
492
basefile=`basename "$desktop_file"`
494
-DEBUG 1 "$action $desktop_file in $desktop_dir"
495
+DEBUG 1 "$action $desktop_file in $desktop_dir $desktop_dir_kde $desktop_dir_gnome"
502
- for x in $desktop_dir ; do
504
- eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output
505
+ for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do
506
+ if [ -n "$x" ]; then
508
+ eval 'cp "$desktop_file" "$x/$basefile"'$xdg_redirect_output
516
- for x in $desktop_dir ; do
518
+ for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do
519
+ if [ -n "$x" ]; then
520
+ rm -f "$x/$basefile"
530
Index: src/third_party/xdg-utils/scripts/xdg-desktop-icon.in
531
===================================================================
532
--- src.orig/third_party/xdg-utils/scripts/xdg-desktop-icon.in
533
+++ src/third_party/xdg-utils/scripts/xdg-desktop-icon.in
543
-[ x"$1" != x"" ] || exit_failure_syntax
544
+[ x"$1" != x"" ] || exit_failure_syntax
554
exit_failure_syntax "command argument missing"
557
if [ -z "$desktop_file" ] ; then
558
exit_failure_syntax "FILE argument missing"
562
-case $desktop_file in
563
+case "$desktop_file" in
566
if [ "$vendor" = "true" -a "$action" = "install" ] ; then
567
check_vendor_prefix "$desktop_file"
576
desktop_dir="$HOME/Desktop"
577
+if xdg-user-dir 2>/dev/null 1>&2; then
578
+ desktop_dir=`xdg-user-dir DESKTOP`
580
desktop_dir_kde=`kde${KDE_SESSION_VERSION}-config --userpath desktop 2> /dev/null`
581
if gconftool-2 -g /apps/nautilus/preferences/desktop_is_home_dir 2> /dev/null | grep true > /dev/null; then
582
desktop_dir_gnome="$HOME"
583
# Don't create $HOME/Desktop if it doesn't exist
584
- [ -w $desktop_dir ] || desktop_dir=
585
+ [ -w "$desktop_dir" ] || desktop_dir=
587
if [ -n "$desktop_dir_kde" ]; then
588
if [ ! -d "$desktop_dir_kde" ]; then
591
- mkdir -p $desktop_dir_kde
592
+ mkdir -p "$desktop_dir_kde"
595
# Is the KDE desktop dir != $HOME/Desktop ?
596
if [ x`readlink -f "$desktop_dir"` != x`readlink -f "$desktop_dir_kde"` ]; then
597
# If so, don't create $HOME/Desktop if it doesn't exist
598
- [ -w $desktop_dir ] || desktop_dir=
599
+ [ -w "$desktop_dir" ] || desktop_dir=
604
-desktop_dir="$desktop_dir $desktop_dir_kde $desktop_dir_gnome"
606
basefile=`basename "$desktop_file"`
608
-DEBUG 1 "$action $desktop_file in $desktop_dir"
609
+DEBUG 1 "$action $desktop_file in $desktop_dir $desktop_dir_kde $desktop_dir_gnome"
616
- for x in $desktop_dir ; do
618
- eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output
619
+ for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do
620
+ if [ -n "$x" ]; then
622
+ eval 'cp "$desktop_file" "$x/$basefile"'$xdg_redirect_output
630
- for x in $desktop_dir ; do
632
+ for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do
633
+ if [ -n "$x" ]; then
634
+ rm -f "$x/$basefile"
644
Index: src/third_party/xdg-utils/scripts/xdg-desktop-menu
645
===================================================================
646
--- src.orig/third_party/xdg-utils/scripts/xdg-desktop-menu
647
+++ src/third_party/xdg-utils/scripts/xdg-desktop-menu
648
@@ -492,17 +492,17 @@
649
if [ $# -gt 0 ]; then
650
echo "xdg-desktop-menu: $@" >&2
656
#------------------------------------------------------------
657
-# Exit script on insufficient permission to read a specified file
658
+# Exit script on insufficient permission to write a specified file
660
exit_failure_file_permission_write()
662
if [ $# -gt 0 ]; then
663
echo "xdg-desktop-menu: $@" >&2
667
@@ -569,17 +569,17 @@
676
- echo "xdg-desktop-menu 1.0.1"
677
+ echo "xdg-desktop-menu 1.0.2"
684
check_common_commands "$@"
686
@@ -595,17 +595,18 @@
687
#--------------------------------------
688
# Checks for known desktop environments
689
# set variable DE to the desktop environments name, lowercase
693
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
694
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
695
- elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
696
+ elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
697
+ elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
701
#----------------------------------------------------------------------------
702
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
703
# It also always returns 1 in KDE 3.4 and earlier
704
# Simply return 0 in such case
706
@@ -630,75 +631,39 @@
707
DEBUG 1 "Running $x/update-desktop-database"
708
eval '$x/update-desktop-database'$xdg_redirect_output
715
-fixup_mandriva_categories()
717
- DEBUG 1 "fixup_mandriva_categories $1"
720
- xlat["AudioVideo"]="X-Mandrakelinux-Multimedia;X-MandrivaLinux-Multimedia"
721
- xlat["Development"]="X-Mandrakelinux-MoreApplications-Development;X-MandrivaLinux-MoreApplications-Development"
722
- xlat["Education"]="X-Mandrakelinux-MoreApplications;X-MandrivaLinux-MoreApplications-Education"
723
- xlat["Game"]="X-Mandrakelinux-MoreApplications;X-MandrivaLinux-MoreApplications-Games"
724
- xlat["Graphics"]="X-Mandrakelinux-Multimedia-Graphics"
725
- xlat["Network"]="X-Mandrakelinux-Internet;X-MandrivaLinux-Internet"
726
- xlat["Office"]="X-Mandrakelinux-Office;X-MandrivaLinux-Office"
727
- xlat["System"]="X-Mandrakelinux-System;X-MandrivaLinux-System"
728
- xlat["Utility"]="X-Mandrakelinux-Office-Accessories;X-MandrivaLinux-Office-Accessories"
731
- if (match($0,/Categories=/)) {
732
- split(substr($0,RSTART+11),categories,";")
734
- for (n in categories)
736
- if (categories[n] in xlat)
737
- categories[n]=categories[n] ";" xlat[categories[n]]
739
- result=result categories[n] ";"
741
- print "Categories=" result
751
# Make application $1/$2 the default for all the mimetypes it support,
752
# iff such mimetype didn't had a default application already.
753
# $1 Install dir for desktop file
754
# $2 base name of desktop file
759
local xdg_default_dirs
762
DEBUG 1 "make_lazy_default $1/$2"
765
if (match($0,/MimeType=/)) {
766
split(substr($0,RSTART+9),mimetypes,";")
773
}' "$1/$2" 2> /dev/null`
776
for MIME in $mimetypes ; do
777
xdg_default_dirs="$XDG_DATA_DIRS"
778
[ -n "$xdg_default_dirs" ] || xdg_default_dirs=/usr/local/share/:/usr/share/
779
if [ x"$mode" = x"user" ] ; then
780
xdg_user_dir="$XDG_DATA_HOME"
781
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
782
xdg_default_dirs="$xdg_user_dir:$xdg_default_dirs"
784
@@ -745,17 +710,17 @@
785
if [ -w $x/$xdg_dir_name ] ; then
786
xdg_global_dir="$x/$xdg_dir_name"
790
xdg_user_dir="$xdg_user_dir/applications-merged"
791
xdg_global_dir="$xdg_global_dir/applications-merged"
793
- DEBUG 3 "Install locations for *.menu file:"
794
+ DEBUG 3 "Install locations for *.menu file:"
795
DEBUG 3 "xdg_user_dir: $xdg_user_dir"
796
DEBUG 3 "xdg_global_dir: $xdg_global_dir"
797
DEBUG 3 "kde_user_dir: $kde_user_dir"
798
DEBUG 3 "kde_global_dir: $kde_global_dir"
799
DEBUG 3 "gnome_user_dir: $gnome_user_dir"
800
DEBUG 3 "gnome_global_dir: $gnome_global_dir"
802
if [ x"$mode" = x"user" ] ; then
803
@@ -808,17 +773,17 @@
804
if [ $action = "install" -a x"$mode" = x"user" -a -d "/etc/xdg/menus/kde-applications-merged" ] ; then
805
# Work around for Fedora Core 5 + patched KDE
806
kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-applications-merged^'`
807
if [ ! -e "$kde_xdg_dir" ] ; then
808
DEBUG 1 "Fedora Workaround: Link '$xdg_dir' to '$kde_xdg_dir'"
809
mkdir -p `dirname "$kde_xdg_dir"`
810
eval 'ln -s "applications-merged" "$kde_xdg_dir"'$xdg_redirect_output
814
if [ $action = "install" -a x"$mode" = x"system" -a -d "/etc/xdg/menus/kde-applications-merged" -a ! -d "/etc/xdg/menus/applications-merged" ] ; then
815
# Work around for Kubuntu 6.06
816
kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-applications-merged^'`
817
DEBUG 1 "Kubuntu Workaround: Link '$xdg_dir' to 'kde-applications-merged'"
818
eval 'ln -s "kde-applications-merged" "$xdg_dir"'$xdg_redirect_output
821
orig_menu_file=$xdg_dir/$menu_file
822
@@ -863,19 +828,19 @@
823
for desktop_file in $orig_desktop_files; do
824
if ! grep '^'$desktop_file'$' $tmpfile > /dev/null 2> /dev/null; then
825
# Keep this file, it's not in the uninstall list
826
new_desktop_files="$new_desktop_files $desktop_file"
833
DEBUG 3 "Files to list in $menu_file: $new_desktop_files"
836
if [ -n "$new_desktop_files" ] ; then
838
test "${TMPDIR+set}" = set || TMPDIR=/tmp
839
tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
841
echo '<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"'
842
echo ' "http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">'
843
echo '<!-- Do not edit manually - generated and managed by xdg-desktop-menu -->'
844
@@ -895,33 +860,33 @@
845
echo " <Filename>$desktop_file</Filename>"
849
for desktop_file in $directory_files; do
856
chmod $my_chmod $tmpfile
863
eval 'cp $tmpfile $xdg_dir/$menu_file'$xdg_redirect_output
869
rm -f $xdg_dir/$menu_file
873
# Uninstall .directory files only if no longer referenced
874
if [ $action = "uninstall" ] ; then
875
test "${TMPDIR+set}" = set || TMPDIR=/tmp
876
tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
877
for menu_file in $xdg_dir/*; do
878
if grep 'generated and managed by xdg-desktop-menu' $menu_file > /dev/null 2> /dev/null; then
880
# List all files within <Directory> tags
881
@@ -929,17 +894,17 @@
886
print substr($0,RSTART+1)
888
}' $menu_file >> $tmpfile
892
orig_directory_files="$directory_files"
894
for desktop_file in $orig_directory_files; do
895
if ! grep '^'$desktop_file'$' $tmpfile > /dev/null 2> /dev/null; then
896
# No longer in use, safe to delete
897
directory_files="$directory_files $desktop_file"
900
@@ -993,17 +958,17 @@
912
exit_failure_syntax "unknown mode '$1'"
919
@@ -1106,17 +1071,17 @@
921
for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
922
if [ -w $x/$xdg_dir_name ] ; then
923
xdg_global_dir="$x/$xdg_dir_name"
928
-DEBUG 3 "Install locations for *.directory files:"
929
+DEBUG 3 "Install locations for *.directory files:"
930
DEBUG 3 "xdg_user_dir: $xdg_user_dir"
931
DEBUG 3 "xdg_global_dir: $xdg_global_dir"
932
DEBUG 3 "kde_user_dir: $kde_user_dir"
933
DEBUG 3 "kde_global_dir: $kde_global_dir"
934
DEBUG 3 "gnome_user_dir: $gnome_user_dir"
935
DEBUG 3 "gnome_global_dir: $gnome_global_dir"
937
if [ x"$mode" = x"user" ] ; then
938
@@ -1173,28 +1138,25 @@
940
for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
941
if [ -w $x/$xdg_dir_name ] ; then
942
xdg_global_dir="$x/$xdg_dir_name"
947
-kde_user_dir="$HOME/.kde/share/applnk"
948
-kde_global_dir="/usr/share/applnk"
949
+kde_user_dir=`kde${KDE_SESSION_VERSION}-config --path apps 2> /dev/null | cut -d ':' -f 1`
950
+kde_global_dir=`kde${KDE_SESSION_VERSION}-config --path apps 2> /dev/null | cut -d ':' -f 2`
951
[ -w $kde_global_dir ] || kde_global_dir=
953
gnome_user_dir="$HOME/.gnome/apps"
954
gnome_global_dir="/usr/share/gnome/apps"
955
[ -w $gnome_global_dir ] || gnome_global_dir=
957
-[ -f /etc/mandriva-release ] && need_mandriva_fix=true
958
-[ -n "$need_mandriva_fix" ] && DEBUG 1 "Fixing up .desktop categories (Mandriva work around)"
960
-DEBUG 3 "Install locations for *.desktop files:"
961
+DEBUG 3 "Install locations for *.desktop files:"
962
DEBUG 3 "xdg_user_dir: $xdg_user_dir"
963
DEBUG 3 "xdg_global_dir: $xdg_global_dir"
964
DEBUG 3 "kde_user_dir: $kde_user_dir"
965
DEBUG 3 "kde_global_dir: $kde_global_dir"
966
DEBUG 3 "gnome_user_dir: $gnome_user_dir"
967
DEBUG 3 "gnome_global_dir: $gnome_global_dir"
969
if [ x"$mode" = x"user" ] ; then
970
@@ -1226,28 +1188,24 @@
974
for x in $xdg_dir $kde_dir $gnome_dir ; do
976
eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output
979
- if [ -n "$need_mandriva_fix" ] ; then
980
- fixup_mandriva_categories $xdg_dir/$basefile
983
if [ -f $kde_dir/$basefile ] ; then
984
echo "OnlyShowIn=Old;" >> $kde_dir/$basefile
987
if [ -f $gnome_dir/$basefile ] ; then
988
echo "OnlyShowIn=Old;" >> $gnome_dir/$basefile
992
make_lazy_default "$xdg_dir" "$basefile"
998
for x in $xdg_dir $kde_dir $gnome_dir ; do
1000
Index: src/third_party/xdg-utils/scripts/xdg-desktop-menu.in
1001
===================================================================
1002
--- src.orig/third_party/xdg-utils/scripts/xdg-desktop-menu.in
1003
+++ src/third_party/xdg-utils/scripts/xdg-desktop-menu.in
1005
DEBUG 1 "Running $x/update-desktop-database"
1006
eval '$x/update-desktop-database'$xdg_redirect_output
1013
-fixup_mandriva_categories()
1015
- DEBUG 1 "fixup_mandriva_categories $1"
1018
- xlat["AudioVideo"]="X-Mandrakelinux-Multimedia;X-MandrivaLinux-Multimedia"
1019
- xlat["Development"]="X-Mandrakelinux-MoreApplications-Development;X-MandrivaLinux-MoreApplications-Development"
1020
- xlat["Education"]="X-Mandrakelinux-MoreApplications;X-MandrivaLinux-MoreApplications-Education"
1021
- xlat["Game"]="X-Mandrakelinux-MoreApplications;X-MandrivaLinux-MoreApplications-Games"
1022
- xlat["Graphics"]="X-Mandrakelinux-Multimedia-Graphics"
1023
- xlat["Network"]="X-Mandrakelinux-Internet;X-MandrivaLinux-Internet"
1024
- xlat["Office"]="X-Mandrakelinux-Office;X-MandrivaLinux-Office"
1025
- xlat["System"]="X-Mandrakelinux-System;X-MandrivaLinux-System"
1026
- xlat["Utility"]="X-Mandrakelinux-Office-Accessories;X-MandrivaLinux-Office-Accessories"
1029
- if (match($0,/Categories=/)) {
1030
- split(substr($0,RSTART+11),categories,";")
1032
- for (n in categories)
1034
- if (categories[n] in xlat)
1035
- categories[n]=categories[n] ";" xlat[categories[n]]
1036
- if (categories[n])
1037
- result=result categories[n] ";"
1039
- print "Categories=" result
1049
# Make application $1/$2 the default for all the mimetypes it support,
1050
# iff such mimetype didn't had a default application already.
1051
# $1 Install dir for desktop file
1052
# $2 base name of desktop file
1057
local xdg_default_dirs
1060
DEBUG 1 "make_lazy_default $1/$2"
1063
if (match($0,/MimeType=/)) {
1064
split(substr($0,RSTART+9),mimetypes,";")
1065
for (n in mimetypes)
1071
}' "$1/$2" 2> /dev/null`
1074
for MIME in $mimetypes ; do
1075
xdg_default_dirs="$XDG_DATA_DIRS"
1076
[ -n "$xdg_default_dirs" ] || xdg_default_dirs=/usr/local/share/:/usr/share/
1077
if [ x"$mode" = x"user" ] ; then
1078
xdg_user_dir="$XDG_DATA_HOME"
1079
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
1080
xdg_default_dirs="$xdg_user_dir:$xdg_default_dirs"
1082
@@ -150,17 +114,17 @@
1083
if [ -w $x/$xdg_dir_name ] ; then
1084
xdg_global_dir="$x/$xdg_dir_name"
1088
xdg_user_dir="$xdg_user_dir/applications-merged"
1089
xdg_global_dir="$xdg_global_dir/applications-merged"
1091
- DEBUG 3 "Install locations for *.menu file:"
1092
+ DEBUG 3 "Install locations for *.menu file:"
1093
DEBUG 3 "xdg_user_dir: $xdg_user_dir"
1094
DEBUG 3 "xdg_global_dir: $xdg_global_dir"
1095
DEBUG 3 "kde_user_dir: $kde_user_dir"
1096
DEBUG 3 "kde_global_dir: $kde_global_dir"
1097
DEBUG 3 "gnome_user_dir: $gnome_user_dir"
1098
DEBUG 3 "gnome_global_dir: $gnome_global_dir"
1100
if [ x"$mode" = x"user" ] ; then
1101
@@ -213,17 +177,17 @@
1102
if [ $action = "install" -a x"$mode" = x"user" -a -d "/etc/xdg/menus/kde-applications-merged" ] ; then
1103
# Work around for Fedora Core 5 + patched KDE
1104
kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-applications-merged^'`
1105
if [ ! -e "$kde_xdg_dir" ] ; then
1106
DEBUG 1 "Fedora Workaround: Link '$xdg_dir' to '$kde_xdg_dir'"
1107
mkdir -p `dirname "$kde_xdg_dir"`
1108
eval 'ln -s "applications-merged" "$kde_xdg_dir"'$xdg_redirect_output
1112
if [ $action = "install" -a x"$mode" = x"system" -a -d "/etc/xdg/menus/kde-applications-merged" -a ! -d "/etc/xdg/menus/applications-merged" ] ; then
1113
# Work around for Kubuntu 6.06
1114
kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-applications-merged^'`
1115
DEBUG 1 "Kubuntu Workaround: Link '$xdg_dir' to 'kde-applications-merged'"
1116
eval 'ln -s "kde-applications-merged" "$xdg_dir"'$xdg_redirect_output
1119
orig_menu_file=$xdg_dir/$menu_file
1120
@@ -268,19 +232,19 @@
1121
for desktop_file in $orig_desktop_files; do
1122
if ! grep '^'$desktop_file'$' $tmpfile > /dev/null 2> /dev/null; then
1123
# Keep this file, it's not in the uninstall list
1124
new_desktop_files="$new_desktop_files $desktop_file"
1131
DEBUG 3 "Files to list in $menu_file: $new_desktop_files"
1134
if [ -n "$new_desktop_files" ] ; then
1136
test "${TMPDIR+set}" = set || TMPDIR=/tmp
1137
tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
1139
echo '<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"'
1140
echo ' "http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">'
1141
echo '<!-- Do not edit manually - generated and managed by @NAME@ -->'
1142
@@ -300,33 +264,33 @@
1143
echo " <Filename>$desktop_file</Filename>"
1147
for desktop_file in $directory_files; do
1154
chmod $my_chmod $tmpfile
1161
eval 'cp $tmpfile $xdg_dir/$menu_file'$xdg_redirect_output
1167
rm -f $xdg_dir/$menu_file
1171
# Uninstall .directory files only if no longer referenced
1172
if [ $action = "uninstall" ] ; then
1173
test "${TMPDIR+set}" = set || TMPDIR=/tmp
1174
tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
1175
for menu_file in $xdg_dir/*; do
1176
if grep 'generated and managed by @NAME@' $menu_file > /dev/null 2> /dev/null; then
1178
# List all files within <Directory> tags
1179
@@ -334,17 +298,17 @@
1183
if (match($0,/>/)) {
1184
print substr($0,RSTART+1)
1186
}' $menu_file >> $tmpfile
1190
orig_directory_files="$directory_files"
1192
for desktop_file in $orig_directory_files; do
1193
if ! grep '^'$desktop_file'$' $tmpfile > /dev/null 2> /dev/null; then
1194
# No longer in use, safe to delete
1195
directory_files="$directory_files $desktop_file"
1198
@@ -398,17 +362,17 @@
1210
exit_failure_syntax "unknown mode '$1'"
1217
@@ -511,17 +475,17 @@
1219
for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
1220
if [ -w $x/$xdg_dir_name ] ; then
1221
xdg_global_dir="$x/$xdg_dir_name"
1226
-DEBUG 3 "Install locations for *.directory files:"
1227
+DEBUG 3 "Install locations for *.directory files:"
1228
DEBUG 3 "xdg_user_dir: $xdg_user_dir"
1229
DEBUG 3 "xdg_global_dir: $xdg_global_dir"
1230
DEBUG 3 "kde_user_dir: $kde_user_dir"
1231
DEBUG 3 "kde_global_dir: $kde_global_dir"
1232
DEBUG 3 "gnome_user_dir: $gnome_user_dir"
1233
DEBUG 3 "gnome_global_dir: $gnome_global_dir"
1235
if [ x"$mode" = x"user" ] ; then
1236
@@ -578,28 +542,25 @@
1238
for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
1239
if [ -w $x/$xdg_dir_name ] ; then
1240
xdg_global_dir="$x/$xdg_dir_name"
1245
-kde_user_dir="$HOME/.kde/share/applnk"
1246
-kde_global_dir="/usr/share/applnk"
1247
+kde_user_dir=`kde${KDE_SESSION_VERSION}-config --path apps 2> /dev/null | cut -d ':' -f 1`
1248
+kde_global_dir=`kde${KDE_SESSION_VERSION}-config --path apps 2> /dev/null | cut -d ':' -f 2`
1249
[ -w $kde_global_dir ] || kde_global_dir=
1251
gnome_user_dir="$HOME/.gnome/apps"
1252
gnome_global_dir="/usr/share/gnome/apps"
1253
[ -w $gnome_global_dir ] || gnome_global_dir=
1255
-[ -f /etc/mandriva-release ] && need_mandriva_fix=true
1256
-[ -n "$need_mandriva_fix" ] && DEBUG 1 "Fixing up .desktop categories (Mandriva work around)"
1258
-DEBUG 3 "Install locations for *.desktop files:"
1259
+DEBUG 3 "Install locations for *.desktop files:"
1260
DEBUG 3 "xdg_user_dir: $xdg_user_dir"
1261
DEBUG 3 "xdg_global_dir: $xdg_global_dir"
1262
DEBUG 3 "kde_user_dir: $kde_user_dir"
1263
DEBUG 3 "kde_global_dir: $kde_global_dir"
1264
DEBUG 3 "gnome_user_dir: $gnome_user_dir"
1265
DEBUG 3 "gnome_global_dir: $gnome_global_dir"
1267
if [ x"$mode" = x"user" ] ; then
1268
@@ -631,28 +592,24 @@
1272
for x in $xdg_dir $kde_dir $gnome_dir ; do
1274
eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output
1277
- if [ -n "$need_mandriva_fix" ] ; then
1278
- fixup_mandriva_categories $xdg_dir/$basefile
1281
if [ -f $kde_dir/$basefile ] ; then
1282
echo "OnlyShowIn=Old;" >> $kde_dir/$basefile
1285
if [ -f $gnome_dir/$basefile ] ; then
1286
echo "OnlyShowIn=Old;" >> $gnome_dir/$basefile
1290
make_lazy_default "$xdg_dir" "$basefile"
1296
for x in $xdg_dir $kde_dir $gnome_dir ; do
1298
Index: src/third_party/xdg-utils/scripts/xdg-email
1299
===================================================================
1300
--- src.orig/third_party/xdg-utils/scripts/xdg-email
1301
+++ src/third_party/xdg-utils/scripts/xdg-email
1305
#---------------------------------------------
1308
# Utility script to open the users favorite email program, using the
1309
# RFC 2368 mailto: URI spec
1311
# Refer to the usage() function below for usage.
1313
@@ -248,17 +248,17 @@
1314
if [ $# -gt 0 ]; then
1315
echo "xdg-email: $@" >&2
1321
#------------------------------------------------------------
1322
-# Exit script on insufficient permission to read a specified file
1323
+# Exit script on insufficient permission to write a specified file
1325
exit_failure_file_permission_write()
1327
if [ $# -gt 0 ]; then
1328
echo "xdg-email: $@" >&2
1332
@@ -325,17 +325,17 @@
1341
- echo "xdg-email 1.0.1"
1342
+ echo "xdg-email 1.0.2"
1349
check_common_commands "$@"
1351
@@ -351,17 +351,18 @@
1352
#--------------------------------------
1353
# Checks for known desktop environments
1354
# set variable DE to the desktop environments name, lowercase
1358
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
1359
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
1360
- elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
1361
+ elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
1362
+ elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
1366
#----------------------------------------------------------------------------
1367
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
1368
# It also always returns 1 in KDE 3.4 and earlier
1369
# Simply return 0 in such case
1371
@@ -372,24 +373,81 @@
1372
minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'`
1373
release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'`
1374
test "$major" -gt 3 && return $1
1375
test "$minor" -gt 5 && return $1
1376
test "$release" -gt 4 && return $1
1382
+ local THUNDERBIRD MAILTO NEWMAILTO TO CC BCC SUBJECT BODY ATTACH
1384
+ MAILTO=$(echo "$2" | sed 's/^mailto://')
1385
+ echo "$MAILTO" | grep -qs "^?"
1386
+ if [ "$?" = "0" ] ; then
1387
+ MAILTO=$(echo "$MAILTO" | sed 's/^?//')
1389
+ MAILTO=$(echo "$MAILTO" | sed 's/^/to=/' | sed 's/?/\&/')
1392
+ MAILTO=$(echo "$MAILTO" | sed 's/&/\n/g')
1393
+ TO=$(echo "$MAILTO" | grep '^to=' | sed 's/^to=//' | awk '{ printf "%s,",$0 }')
1394
+ CC=$(echo "$MAILTO" | grep '^cc=' | sed 's/^cc=//' | awk '{ printf "%s,",$0 }')
1395
+ BCC=$(echo "$MAILTO" | grep '^bcc=' | sed 's/^bcc=//' | awk '{ printf "%s,",$0 }')
1396
+ SUBJECT=$(echo "$MAILTO" | grep '^subject=' | tail -n 1)
1397
+ BODY=$(echo "$MAILTO" | grep '^body=' | tail -n 1)
1398
+ ATTACH=$(echo "$MAILTO" | sed 's/^attach=/\n\nfile:\/\//g' | awk '/^file:/ { printf "%s,",$0 }')
1400
+ if [ -z "$TO" ] ; then
1403
+ NEWMAILTO="to='$TO'"
1405
+ if [ -n "$CC" ] ; then
1406
+ NEWMAILTO="${NEWMAILTO},cc='$CC'"
1408
+ if [ -n "$BCC" ] ; then
1409
+ NEWMAILTO="${NEWMAILTO},bcc='$BCC'"
1411
+ if [ -n "$SUBJECT" ] ; then
1412
+ NEWMAILTO="${NEWMAILTO},$SUBJECT"
1414
+ if [ -n "$BODY" ] ; then
1415
+ NEWMAILTO="${NEWMAILTO},$BODY"
1418
+ if [ -n "$ATTACH" ] ; then
1419
+ NEWMAILTO="${NEWMAILTO},attachment='${ATTACH}'"
1422
+ NEWMAILTO=$(echo "$NEWMAILTO" | sed 's/^,//')
1423
+ DEBUG 1 "Running $THUNDERBIRD -compose \"$NEWMAILTO\""
1424
+ "$THUNDERBIRD" -compose "$NEWMAILTO"
1425
+ if [ $? -eq 0 ]; then
1428
+ exit_failure_operation_failed
1435
+ client=`kreadconfig --file emaildefaults --group PROFILE_Default --key EmailClient | cut -d ' ' -f 1`
1436
+ echo $client | grep thunderbird > /dev/null 2>&1
1437
+ if [ $? -eq 0 ] ; then
1438
+ run_thunderbird "$client" "$1"
1441
if [ -f /etc/SuSE-release ] ; then
1442
# Workaround for SUSE 10.0
1443
- client=`kreadconfig --file emaildefaults --group PROFILE_Default --key EmailClient| cut -d ' ' -f 1`
1444
- [ -z $client ] && client="kmail"
1445
- if ! which $client > /dev/null 2> /dev/null; then
1446
+ [ -z "$client" ] && client="kmail"
1447
+ if ! which "$client" > /dev/null 2> /dev/null; then
1448
DEBUG 3 "KDE has $client configured as email client which isn't installed"
1449
if which gnome-open > /dev/null 2> /dev/null && which evolution > /dev/null 2> /dev/null; then
1450
DEBUG 3 "Try gnome-open instead"
1455
DEBUG 1 "Running kmailservice \"$1\""
1456
@@ -406,18 +464,30 @@
1459
exit_failure_operation_failed
1465
- DEBUG 1 "Running gnome-open \"$1\""
1468
+ client=`gconftool-2 --get /desktop/gnome/url-handlers/mailto/command | cut -d ' ' -f 1` || ""
1469
+ echo $client | grep thunderbird > /dev/null 2>&1
1470
+ if [ $? -eq 0 ] ; then
1471
+ run_thunderbird "$client" "$1"
1474
+ if gvfs-open --help 2>/dev/null 1>&2; then
1475
+ DEBUG 1 "Running gvfs-open \"$1\""
1478
+ DEBUG 1 "Running gnome-open \"$1\""
1482
if [ $? -eq 0 ]; then
1485
exit_failure_operation_failed
1489
@@ -435,18 +505,19 @@
1495
for browser in $BROWSER; do
1496
if [ x"$browser" != x"" ]; then
1499
- browser_with_arg=${browser//'%s'/"$1"}
1500
+ browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
1501
+ if [ $? -ne 0 ]; then browser_with_arg=$browser;
1504
if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
1505
else $browser_with_arg;
1508
if [ $? -eq 0 ]; then exit_success;
1511
@@ -466,17 +537,17 @@
1513
if ( linenr++ != 1 ) {
1516
for ( i=1; i<=length ($0); ++i ) {
1517
c = substr ($0, i, 1)
1518
if ( ord [c] > 127 ) {
1519
e = e "%" sprintf("%02X", ord [c])
1520
- } else if ( c ~ /[@a-zA-Z0-9.-]/ ) {
1521
+ } else if ( c ~ /[@a-zA-Z0-9.-\\/]/ ) {
1524
e = e "%" sprintf("%02X", ord [c])
1530
@@ -611,23 +682,27 @@
1532
exit_failure_operation_failed
1538
if [ x"$DE" = x"" ]; then
1539
- # if BROWSER variable is not set, check some well known browsers instead
1540
- if [ x"$BROWSER" = x"" ]; then
1541
- BROWSER=firefox:mozilla:netscape
1546
+# if BROWSER variable is not set, check some well known browsers instead
1547
+if [ x"$BROWSER" = x"" ]; then
1548
+ BROWSER=links2:links:lynx:w3m
1549
+ if [ -n "$DISPLAY" ]; then
1550
+ BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
1556
open_kde "${mailto}"
1560
open_gnome "${mailto}"
1562
Index: src/third_party/xdg-utils/scripts/xdg-email.in
1563
===================================================================
1564
--- src.orig/third_party/xdg-utils/scripts/xdg-email.in
1565
+++ src/third_party/xdg-utils/scripts/xdg-email.in
1569
#---------------------------------------------
1572
# Utility script to open the users favorite email program, using the
1573
# RFC 2368 mailto: URI spec
1575
# Refer to the usage() function below for usage.
1588
+ local THUNDERBIRD MAILTO NEWMAILTO TO CC BCC SUBJECT BODY ATTACH
1590
+ MAILTO=$(echo "$2" | sed 's/^mailto://')
1591
+ echo "$MAILTO" | grep -qs "^?"
1592
+ if [ "$?" = "0" ] ; then
1593
+ MAILTO=$(echo "$MAILTO" | sed 's/^?//')
1595
+ MAILTO=$(echo "$MAILTO" | sed 's/^/to=/' | sed 's/?/\&/')
1598
+ MAILTO=$(echo "$MAILTO" | sed 's/&/\n/g')
1599
+ TO=$(echo "$MAILTO" | grep '^to=' | sed 's/^to=//' | awk '{ printf "%s,",$0 }')
1600
+ CC=$(echo "$MAILTO" | grep '^cc=' | sed 's/^cc=//' | awk '{ printf "%s,",$0 }')
1601
+ BCC=$(echo "$MAILTO" | grep '^bcc=' | sed 's/^bcc=//' | awk '{ printf "%s,",$0 }')
1602
+ SUBJECT=$(echo "$MAILTO" | grep '^subject=' | tail -n 1)
1603
+ BODY=$(echo "$MAILTO" | grep '^body=' | tail -n 1)
1604
+ ATTACH=$(echo "$MAILTO" | sed 's/^attach=/\n\nfile:\/\//g' | awk '/^file:/ { printf "%s,",$0 }')
1606
+ if [ -z "$TO" ] ; then
1609
+ NEWMAILTO="to='$TO'"
1611
+ if [ -n "$CC" ] ; then
1612
+ NEWMAILTO="${NEWMAILTO},cc='$CC'"
1614
+ if [ -n "$BCC" ] ; then
1615
+ NEWMAILTO="${NEWMAILTO},bcc='$BCC'"
1617
+ if [ -n "$SUBJECT" ] ; then
1618
+ NEWMAILTO="${NEWMAILTO},$SUBJECT"
1620
+ if [ -n "$BODY" ] ; then
1621
+ NEWMAILTO="${NEWMAILTO},$BODY"
1624
+ if [ -n "$ATTACH" ] ; then
1625
+ NEWMAILTO="${NEWMAILTO},attachment='${ATTACH}'"
1628
+ NEWMAILTO=$(echo "$NEWMAILTO" | sed 's/^,//')
1629
+ DEBUG 1 "Running $THUNDERBIRD -compose \"$NEWMAILTO\""
1630
+ "$THUNDERBIRD" -compose "$NEWMAILTO"
1631
+ if [ $? -eq 0 ]; then
1634
+ exit_failure_operation_failed
1641
+ client=`kreadconfig --file emaildefaults --group PROFILE_Default --key EmailClient | cut -d ' ' -f 1`
1642
+ echo $client | grep thunderbird > /dev/null 2>&1
1643
+ if [ $? -eq 0 ] ; then
1644
+ run_thunderbird "$client" "$1"
1647
if [ -f /etc/SuSE-release ] ; then
1648
# Workaround for SUSE 10.0
1649
- client=`kreadconfig --file emaildefaults --group PROFILE_Default --key EmailClient| cut -d ' ' -f 1`
1650
- [ -z $client ] && client="kmail"
1651
- if ! which $client > /dev/null 2> /dev/null; then
1652
+ [ -z "$client" ] && client="kmail"
1653
+ if ! which "$client" > /dev/null 2> /dev/null; then
1654
DEBUG 3 "KDE has $client configured as email client which isn't installed"
1655
if which gnome-open > /dev/null 2> /dev/null && which evolution > /dev/null 2> /dev/null; then
1656
DEBUG 3 "Try gnome-open instead"
1661
DEBUG 1 "Running kmailservice \"$1\""
1662
@@ -57,18 +114,30 @@
1665
exit_failure_operation_failed
1671
- DEBUG 1 "Running gnome-open \"$1\""
1674
+ client=`gconftool-2 --get /desktop/gnome/url-handlers/mailto/command | cut -d ' ' -f 1` || ""
1675
+ echo $client | grep thunderbird > /dev/null 2>&1
1676
+ if [ $? -eq 0 ] ; then
1677
+ run_thunderbird "$client" "$1"
1680
+ if gvfs-open --help 2>/dev/null 1>&2; then
1681
+ DEBUG 1 "Running gvfs-open \"$1\""
1684
+ DEBUG 1 "Running gnome-open \"$1\""
1688
if [ $? -eq 0 ]; then
1691
exit_failure_operation_failed
1695
@@ -86,18 +155,19 @@
1701
for browser in $BROWSER; do
1702
if [ x"$browser" != x"" ]; then
1705
- browser_with_arg=${browser//'%s'/"$1"}
1706
+ browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
1707
+ if [ $? -ne 0 ]; then browser_with_arg=$browser;
1710
if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
1711
else $browser_with_arg;
1714
if [ $? -eq 0 ]; then exit_success;
1717
@@ -117,17 +187,17 @@
1719
if ( linenr++ != 1 ) {
1722
for ( i=1; i<=length ($0); ++i ) {
1723
c = substr ($0, i, 1)
1724
if ( ord [c] > 127 ) {
1725
e = e "%" sprintf("%02X", ord [c])
1726
- } else if ( c ~ /[@a-zA-Z0-9.-]/ ) {
1727
+ } else if ( c ~ /[@a-zA-Z0-9.-\\/]/ ) {
1730
e = e "%" sprintf("%02X", ord [c])
1736
@@ -262,23 +332,27 @@
1738
exit_failure_operation_failed
1744
if [ x"$DE" = x"" ]; then
1745
- # if BROWSER variable is not set, check some well known browsers instead
1746
- if [ x"$BROWSER" = x"" ]; then
1747
- BROWSER=firefox:mozilla:netscape
1752
+# if BROWSER variable is not set, check some well known browsers instead
1753
+if [ x"$BROWSER" = x"" ]; then
1754
+ BROWSER=links2:links:lynx:w3m
1755
+ if [ -n "$DISPLAY" ]; then
1756
+ BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
1762
open_kde "${mailto}"
1766
open_gnome "${mailto}"
1768
Index: src/third_party/xdg-utils/scripts/xdg-file-dialog.in
1769
===================================================================
1770
--- src.orig/third_party/xdg-utils/scripts/xdg-file-dialog.in
1771
+++ src/third_party/xdg-utils/scripts/xdg-file-dialog.in
1772
@@ -254,17 +254,17 @@
1775
action=openfilenamelist
1788
exit_failure_syntax "unknown command '$1'"
1791
Index: src/third_party/xdg-utils/scripts/xdg-icon-resource
1792
===================================================================
1793
--- src.orig/third_party/xdg-utils/scripts/xdg-icon-resource
1794
+++ src/third_party/xdg-utils/scripts/xdg-icon-resource
1795
@@ -288,17 +288,17 @@
1796
if [ $# -gt 0 ]; then
1797
echo "xdg-icon-resource: $@" >&2
1803
#------------------------------------------------------------
1804
-# Exit script on insufficient permission to read a specified file
1805
+# Exit script on insufficient permission to write a specified file
1807
exit_failure_file_permission_write()
1809
if [ $# -gt 0 ]; then
1810
echo "xdg-icon-resource: $@" >&2
1814
@@ -365,17 +365,17 @@
1823
- echo "xdg-icon-resource 1.0.1"
1824
+ echo "xdg-icon-resource 1.0.2"
1831
check_common_commands "$@"
1833
@@ -391,17 +391,18 @@
1834
#--------------------------------------
1835
# Checks for known desktop environments
1836
# set variable DE to the desktop environments name, lowercase
1840
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
1841
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
1842
- elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
1843
+ elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
1844
+ elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
1848
#----------------------------------------------------------------------------
1849
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
1850
# It also always returns 1 in KDE 3.4 and earlier
1851
# Simply return 0 in such case
1853
@@ -418,18 +419,18 @@
1856
# Set GTK_UPDATE_ICON_CACHE to gtk-update-icon-cache executable path or
1857
# to "-" if not found.
1858
GTK_UPDATE_ICON_CACHE=
1859
find_gtk_update_icon_cache()
1861
[ -n "$GTK_UPDATE_ICON_CACHE" ] && return;
1863
- GTK_UPDATE_ICON_CACHE="-"
1865
+ GTK_UPDATE_ICON_CACHE="-"
1866
for x in `echo "$PATH:/opt/gnome/bin" | sed 's/:/ /g'`; do
1867
DEBUG 3 "Checking $x for gtk-update-icon-cache"
1868
if [ -x "$x/gtk-update-icon-cache" ] ; then
1869
DEBUG 1 "Found $x/gtk-update-icon-cache"
1870
GTK_UPDATE_ICON_CACHE="$x/gtk-update-icon-cache"
1874
@@ -437,30 +438,30 @@
1876
# Start GNOME legacy workaround section
1877
need_dot_icon_path()
1879
# GTK < 2.6 uses ~/.icons but not XDG_DATA_HOME/icons
1880
# The availability of gtk-update-icon-cache is used as indication
1881
# of whether the system is using GTK 2.6 or later
1882
find_gtk_update_icon_cache
1883
- [ "$GTK_UPDATE_ICON_CACHE" != "-" ] && return 1;
1884
+ [ "$GTK_UPDATE_ICON_CACHE" != "-" ] && return 1;
1888
update_icon_database()
1890
# Touch me, I'm dirty
1891
touch "$1/.xdg-icon-resource-dummy"
1892
rm -f "$1/.xdg-icon-resource-dummy"
1894
# Don't create a cache if there wan't one already
1895
if [ -f "$1/icon-theme.cache" ] ; then
1896
find_gtk_update_icon_cache
1897
- if [ "$GTK_UPDATE_ICON_CACHE" != "-" ] ; then
1898
+ if [ "$GTK_UPDATE_ICON_CACHE" != "-" ] ; then
1899
DEBUG 1 "Running $GTK_UPDATE_ICON_CACHE -f -t \"$1\""
1900
eval '$GTK_UPDATE_ICON_CACHE -f -t "$1"'$xdg_redirect_output
1906
[ x"$1" != x"" ] || exit_failure_syntax
1907
@@ -511,17 +512,17 @@
1919
exit_failure_syntax "unknown mode '$1'"
1926
@@ -729,19 +730,20 @@
1931
if [ x"$mode" = x"user" ] ; then
1932
xdg_dir="$xdg_base_dir/$xdg_size_name/$context"
1933
#KDE 3.x doesn't support XDG_DATA_HOME for icons
1934
#Check if xdg_dir prefix is listed by kde-config --path icon
1935
- #If not, install additional symlink to kdedir
1936
+ #If not, install additional symlink to kdedir
1937
if need_kde_icon_path "$xdg_user_prefix" ; then
1938
- kde_user_dir="$HOME/.kde/share/icons/$theme"
1939
+ kde_user_icon_dir=`kde${KDE_SESSION_VERSION}-config --path icon | cut -d ':' -f 1`
1940
+ kde_user_dir="$kde_user_icon_dir/$theme"
1941
kde_dir="$kde_user_dir/$xdg_size_name/$context"
1943
#Gnome 2.8 supports ~/.icons but not XDG_DATA_HOME
1944
if [ -n "$dot_icon_dir" ] ; then
1945
if [ -L "$dot_icon_dir" ] ; then
1948
elif [ ! -d "$dot_icon_dir/" ] ; then
1949
@@ -752,28 +754,28 @@
1950
dot_icon_dir="$dot_icon_dir/$theme/$xdg_size_name/$context"
1955
xdg_dir="$xdg_base_dir/$xdg_size_name/$context"
1956
#KDE 3.x doesn't support XDG_DATA_DIRS for icons
1957
#Check if xdg_dir prefix is listed by kde-config --path icon
1958
- #If not, install additional symlink to kdedir
1959
+ #If not, install additional symlink to kdedir
1960
if need_kde_icon_path "$xdg_global_prefix" ; then
1961
kde_global_dir="$kde_global_prefix/$theme"
1962
kde_dir="$kde_global_dir/$xdg_size_name/$context"
1966
# End KDE legacy workaround section
1968
# Start GNOME legacy workaround section
1970
-[ $context = "mimetypes" ] && need_gnome_mime=true
1971
+[ $context = "mimetypes" ] && need_gnome_mime=true
1972
# End GNOME legacy workaround section
1974
[ -n "$icon_name" ] || icon_name=`basename "$icon_file" | sed 's/\.[a-z][a-z][a-z]$//'`
1976
if [ "$vendor" = "true" -a "$action" = "install" -a "$context" = "apps" ] ; then
1977
check_vendor_prefix "$icon_name" "icon name"
1980
@@ -809,18 +811,18 @@
1985
for icon_dir in $xdg_dir $dot_icon_dir; do
1986
rm -f "$icon_dir/$icon_name.xpm" "$icon_dir/$icon_name.png"
1987
rm -f "$icon_dir/$icon_icon_name"
1988
if [ -n "$need_gnome_mime" ] ; then
1989
- rm -f "$icon_dir/gnome-mime-$icon_name.xpm"
1990
- rm -f "$icon_dir/gnome-mime-$icon_name.png"
1991
+ rm -f "$icon_dir/gnome-mime-$icon_name.xpm"
1992
+ rm -f "$icon_dir/gnome-mime-$icon_name.png"
1995
if [ -n "$kde_dir" ] ; then
1996
rm -f "$kde_dir/$icon_name.xpm" "$kde_dir/$icon_name.png"
2001
Index: src/third_party/xdg-utils/scripts/xdg-icon-resource.in
2002
===================================================================
2003
--- src.orig/third_party/xdg-utils/scripts/xdg-icon-resource.in
2004
+++ src/third_party/xdg-utils/scripts/xdg-icon-resource.in
2008
# Set GTK_UPDATE_ICON_CACHE to gtk-update-icon-cache executable path or
2009
# to "-" if not found.
2010
GTK_UPDATE_ICON_CACHE=
2011
find_gtk_update_icon_cache()
2013
[ -n "$GTK_UPDATE_ICON_CACHE" ] && return;
2015
- GTK_UPDATE_ICON_CACHE="-"
2017
+ GTK_UPDATE_ICON_CACHE="-"
2018
for x in `echo "$PATH:/opt/gnome/bin" | sed 's/:/ /g'`; do
2019
DEBUG 3 "Checking $x for gtk-update-icon-cache"
2020
if [ -x "$x/gtk-update-icon-cache" ] ; then
2021
DEBUG 1 "Found $x/gtk-update-icon-cache"
2022
GTK_UPDATE_ICON_CACHE="$x/gtk-update-icon-cache"
2028
# Start GNOME legacy workaround section
2029
need_dot_icon_path()
2031
# GTK < 2.6 uses ~/.icons but not XDG_DATA_HOME/icons
2032
# The availability of gtk-update-icon-cache is used as indication
2033
# of whether the system is using GTK 2.6 or later
2034
find_gtk_update_icon_cache
2035
- [ "$GTK_UPDATE_ICON_CACHE" != "-" ] && return 1;
2036
+ [ "$GTK_UPDATE_ICON_CACHE" != "-" ] && return 1;
2040
update_icon_database()
2042
# Touch me, I'm dirty
2043
touch "$1/.@NAME@-dummy"
2044
rm -f "$1/.@NAME@-dummy"
2046
# Don't create a cache if there wan't one already
2047
if [ -f "$1/icon-theme.cache" ] ; then
2048
find_gtk_update_icon_cache
2049
- if [ "$GTK_UPDATE_ICON_CACHE" != "-" ] ; then
2050
+ if [ "$GTK_UPDATE_ICON_CACHE" != "-" ] ; then
2051
DEBUG 1 "Running $GTK_UPDATE_ICON_CACHE -f -t \"$1\""
2052
eval '$GTK_UPDATE_ICON_CACHE -f -t "$1"'$xdg_redirect_output
2058
[ x"$1" != x"" ] || exit_failure_syntax
2059
@@ -121,17 +121,17 @@
2071
exit_failure_syntax "unknown mode '$1'"
2078
@@ -339,19 +339,20 @@
2083
if [ x"$mode" = x"user" ] ; then
2084
xdg_dir="$xdg_base_dir/$xdg_size_name/$context"
2085
#KDE 3.x doesn't support XDG_DATA_HOME for icons
2086
#Check if xdg_dir prefix is listed by kde-config --path icon
2087
- #If not, install additional symlink to kdedir
2088
+ #If not, install additional symlink to kdedir
2089
if need_kde_icon_path "$xdg_user_prefix" ; then
2090
- kde_user_dir="$HOME/.kde/share/icons/$theme"
2091
+ kde_user_icon_dir=`kde${KDE_SESSION_VERSION}-config --path icon | cut -d ':' -f 1`
2092
+ kde_user_dir="$kde_user_icon_dir/$theme"
2093
kde_dir="$kde_user_dir/$xdg_size_name/$context"
2095
#Gnome 2.8 supports ~/.icons but not XDG_DATA_HOME
2096
if [ -n "$dot_icon_dir" ] ; then
2097
if [ -L "$dot_icon_dir" ] ; then
2100
elif [ ! -d "$dot_icon_dir/" ] ; then
2101
@@ -362,28 +363,28 @@
2102
dot_icon_dir="$dot_icon_dir/$theme/$xdg_size_name/$context"
2107
xdg_dir="$xdg_base_dir/$xdg_size_name/$context"
2108
#KDE 3.x doesn't support XDG_DATA_DIRS for icons
2109
#Check if xdg_dir prefix is listed by kde-config --path icon
2110
- #If not, install additional symlink to kdedir
2111
+ #If not, install additional symlink to kdedir
2112
if need_kde_icon_path "$xdg_global_prefix" ; then
2113
kde_global_dir="$kde_global_prefix/$theme"
2114
kde_dir="$kde_global_dir/$xdg_size_name/$context"
2118
# End KDE legacy workaround section
2120
# Start GNOME legacy workaround section
2122
-[ $context = "mimetypes" ] && need_gnome_mime=true
2123
+[ $context = "mimetypes" ] && need_gnome_mime=true
2124
# End GNOME legacy workaround section
2126
[ -n "$icon_name" ] || icon_name=`basename "$icon_file" | sed 's/\.[a-z][a-z][a-z]$//'`
2128
if [ "$vendor" = "true" -a "$action" = "install" -a "$context" = "apps" ] ; then
2129
check_vendor_prefix "$icon_name" "icon name"
2132
@@ -419,18 +420,18 @@
2137
for icon_dir in $xdg_dir $dot_icon_dir; do
2138
rm -f "$icon_dir/$icon_name.xpm" "$icon_dir/$icon_name.png"
2139
rm -f "$icon_dir/$icon_icon_name"
2140
if [ -n "$need_gnome_mime" ] ; then
2141
- rm -f "$icon_dir/gnome-mime-$icon_name.xpm"
2142
- rm -f "$icon_dir/gnome-mime-$icon_name.png"
2143
+ rm -f "$icon_dir/gnome-mime-$icon_name.xpm"
2144
+ rm -f "$icon_dir/gnome-mime-$icon_name.png"
2147
if [ -n "$kde_dir" ] ; then
2148
rm -f "$kde_dir/$icon_name.xpm" "$kde_dir/$icon_name.png"
2153
Index: src/third_party/xdg-utils/scripts/xdg-mime
2154
===================================================================
2155
--- src.orig/third_party/xdg-utils/scripts/xdg-mime
2156
+++ src/third_party/xdg-utils/scripts/xdg-mime
2157
@@ -317,17 +317,17 @@
2158
if [ $# -gt 0 ]; then
2159
echo "xdg-mime: $@" >&2
2165
#------------------------------------------------------------
2166
-# Exit script on insufficient permission to read a specified file
2167
+# Exit script on insufficient permission to write a specified file
2169
exit_failure_file_permission_write()
2171
if [ $# -gt 0 ]; then
2172
echo "xdg-mime: $@" >&2
2176
@@ -394,17 +394,17 @@
2185
- echo "xdg-mime 1.0.1"
2186
+ echo "xdg-mime 1.0.2"
2193
check_common_commands "$@"
2195
@@ -420,17 +420,18 @@
2196
#--------------------------------------
2197
# Checks for known desktop environments
2198
# set variable DE to the desktop environments name, lowercase
2202
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
2203
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
2204
- elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
2205
+ elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
2206
+ elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
2210
#----------------------------------------------------------------------------
2211
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
2212
# It also always returns 1 in KDE 3.4 and earlier
2213
# Simply return 0 in such case
2215
@@ -447,105 +448,213 @@
2218
update_mime_database()
2220
if [ x"$mode" = x"user" -a -n "$DISPLAY" ] ; then
2222
if [ x"$DE" = x"kde" ] ; then
2223
DEBUG 1 "Running kbuildsycoca"
2224
- eval 'kbuildsycoca'$xdg_redirect_output
2225
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2226
+ eval 'kbuildsycoca4'$xdg_redirect_output
2228
+ eval 'kbuildsycoca'$xdg_redirect_output
2232
for x in `echo "$PATH:/opt/gnome/bin" | sed 's/:/ /g'`; do
2233
if [ -x $x/update-mime-database ] ; then
2234
DEBUG 1 "Running $x/update-mime-database $1"
2235
eval '$x/update-mime-database $1'$xdg_redirect_output
2243
- if which "kmimetypefinder" > /dev/null 2>/dev/null; then
2244
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2245
DEBUG 1 "Running kmimetypefinder \"$1\""
2246
- kmimetypefinder "$1" 2>/dev/null | head -n 1
2247
+ KMIMETYPEFINDER=`which kmimetypefinder 2>/dev/null`
2248
+ $KMIMETYPEFINDER "$1" 2>/dev/null | head -n 1
2250
DEBUG 1 "Running kfile \"$1\""
2251
- kfile "$1" 2> /dev/null | head -n 1 | cut -d "(" -f 2 | cut -d ")" -f 1
2252
+ KFILE=`which kfile 2>/dev/null`
2253
+ $KFILE "$1" 2> /dev/null | head -n 1 | cut -d "(" -f 2 | cut -d ")" -f 1
2257
+ if [ $? -eq 0 ]; then
2260
+ exit_failure_operation_failed
2266
file=`readlink -f "$1"` # Normalize path
2267
- DEBUG 1 "Running gnomevfs-info \"$file\""
2268
- gnomevfs-info "$file" 2> /dev/null | grep MIME | cut -d ":" -f 2 | sed s/"^ "//
2271
+ if gvfs-info --help 2>/dev/null 1>&2; then
2272
+ DEBUG 1 "Running gvfs-info \"$file\""
2273
+ gvfs-info "$file" 2> /dev/null | grep standard::content-type | cut -d' ' -f4
2275
+ DEBUG 1 "Running gnomevfs-info \"$file\""
2276
+ gnomevfs-info --slow-mime "$file" 2> /dev/null | grep "^MIME" | cut -d ":" -f 2 | sed s/"^ "//
2279
+ if [ $? -eq 0 ]; then
2282
+ exit_failure_operation_failed
2288
- DEBUG 1 "Running /usr/bin/file -i \"$1\""
2289
+ DEBUG 1 "Running file -i \"$1\""
2290
/usr/bin/file -i "$1" 2> /dev/null | cut -d ":" -f 2 | sed s/"^ "//
2293
+ if [ $? -eq 0 ]; then
2296
+ exit_failure_operation_failed
2302
# $1 is vendor-name.desktop
2304
- # Add to $KDE_HOME/share/config/profilerc:
2307
+ # On KDE 3, add to $KDE_CONFIG_PATH/profilerc:
2311
# Remove all [$2 - *] sections, or even better,
2312
# renumber [$2 - *] sections and remove duplicate
2314
- default_file="$HOME/.kde/share/config/profilerc"
2315
- DEBUG 2 "make_default_kde $1 $2"
2317
+ # On KDE 4, add $2=$1 to $XDG_DATA_APPS/mimeapps.list
2321
+ # [Added Associations]
2322
+ # text/plain=kde4-kate.desktop;kde4-kwrite.desktop;
2324
+ # [Removed Associations]
2325
+ # text/plain=gnome-gedit.desktop;gnu-emacs.desktop;
2328
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2329
+ default_dir=`kde4-config --path xdgdata-apps 2> /dev/null | cut -d ':' -f 1`
2330
+ default_file="$default_dir/mimeapps.list"
2332
+ default_dir=`kde-config --path config 2> /dev/null | cut -d ':' -f 1`
2333
+ default_file="$default_dir/profilerc"
2335
+ if [ -z "$default_dir" ]; then
2336
+ DEBUG 2 "make_default_kde: No kde runtime detected"
2339
+ DEBUG 2 "make_default_kde $vendor $mimetype"
2340
DEBUG 1 "Updating $default_file"
2341
- mkdir -p "$HOME/.kde/share/config"
2342
+ mkdir -p "$default_dir"
2343
[ -f $default_file ] || touch $default_file
2344
- awk -v application="$1" -v mimetype="$2" '
2345
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2346
+ [ -f $default_file ] || touch $default_file
2347
+ awk -v application="$vendor" -v mimetype="$mimetype" '
2349
+ prefix=mimetype "="
2356
+ if (index($0, "[Added Associations]") == 1) {
2358
+ } else if (index($0, "[") == 1) {
2359
+ if (associations && !found) {
2360
+ print prefix application
2364
+ } else if ($0 == "") {
2367
+ } else if (associations && index($0, prefix) == 1) {
2368
+ value=substr($0, length(prefix) + 1, length)
2369
+ split(value, apps, ";")
2370
+ value=application ";"
2375
+ for (i=0; i < count; i++) {
2376
+ if (apps[i] != application && apps[i] != "") {
2377
+ value=value apps[i] ";"
2384
+ while (blanks > 0) {
2393
+ if (!associations) {
2394
+ print "[Added Associations]"
2396
+ print prefix application
2398
+ while (blanks > 0) {
2403
+' $default_file > ${default_file}.new && mv ${default_file}.new $default_file
2404
+ eval 'kbuildsycoca4'$xdg_redirect_output
2406
+ awk -v application="$vendor" -v mimetype="$mimetype" '
2408
header_start="[" mimetype " - "
2414
if (index($0, header_start) == 1 )
2418
- if (/^\[/) { supress=0 }
2419
+ if (/^\[/) { suppress=0 }
2429
print "[" mimetype " - 1]"
2430
print "Application=" application
2431
print "AllowAsDefault=true"
2432
print "GenericServiceType=Application"
2433
print "Preference=1"
2434
print "ServiceType=" mimetype
2436
' $default_file > ${default_file}.new && mv ${default_file}.new $default_file
2440
make_default_generic()
2442
# $1 is vendor-name.desktop
2445
# Add $2=$1 to XDG_DATA_HOME/applications/defaults.list
2446
xdg_user_dir="$XDG_DATA_HOME"
2447
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
2448
default_file="$xdg_user_dir/applications/defaults.list"
2449
DEBUG 2 "make_default_generic $1 $2"
2450
DEBUG 1 "Updating $default_file"
2451
grep -v "$2=" $default_file > ${default_file}.new 2> /dev/null
2452
if ! grep "[Default Applications]" ${default_file}.new > /dev/null; then
2453
@@ -573,21 +682,27 @@
2462
- ktradertest=`which ktradertest 2> /dev/null`
2463
- if [ -n "$ktradertest" ] ; then
2464
- DEBUG 1 "Running ktradertest \"$MIME\" Application"
2465
- trader_result=`ktradertest "$MIME" Application 2>/dev/null | grep DesktopEntryPath \
2466
- | head -n 1 | cut -d ':' -f 2 | cut -d \' -f 2`
2467
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2468
+ KTRADER=`which ktraderclient 2> /dev/null`
2469
+ MIMETYPE="--mimetype"
2470
+ SERVICETYPE="--servicetype"
2472
+ KTRADER=`which ktradertest 2> /dev/null`
2474
+ if [ -n "$KTRADER" ] ; then
2475
+ DEBUG 1 "Running KDE trader query \"$MIME\" mimetype and \"Application\" servicetype"
2476
+ trader_result=`$KTRADER $MIMETYPE "$MIME" $SERVICETYPE Application 2>/dev/null \
2477
+ | grep DesktopEntryPath | head -n 1 | cut -d ':' -f 2 | cut -d \' -f 2`
2478
if [ -n "$trader_result" ] ; then
2479
basename "$trader_result"
2482
exit_failure_operation_failed
2486
@@ -608,40 +723,40 @@
2495
- if [ -z "$1" ] ; then
2496
+ if [ -z "$1" ] ; then
2497
exit_failure_syntax "query type argument missing"
2506
- if [ -z "$filename" ] ; then
2507
+ if [ -z "$filename" ] ; then
2508
exit_failure_syntax "FILE argument missing"
2512
exit_failure_syntax "unexpected option '$filename'"
2515
check_input_file "$filename"
2521
- if [ -z "$mimetype" ] ; then
2522
+ if [ -z "$mimetype" ] ; then
2523
exit_failure_syntax "mimetype argument missing"
2527
exit_failure_syntax "unexpected option '$mimetype'"
2531
@@ -659,17 +774,17 @@
2540
- if [ -z "$1" ] ; then
2541
+ if [ -z "$1" ] ; then
2542
exit_failure_syntax "application argument missing"
2546
exit_failure_syntax "unexpected option '$1'"
2550
@@ -686,29 +801,29 @@
2551
exit_failure_syntax "unknown command '$1'"
2558
if [ "$action" = "makedefault" ]; then
2559
- if [ -z "$1" ] ; then
2560
+ if [ -z "$1" ] ; then
2561
exit_failure_syntax "mimetype argument missing"
2564
while [ $# -gt 0 ] ; do
2567
exit_failure_syntax "unexpected option '$1'"
2574
make_default_kde "$filename" "$mimetype"
2575
make_default_generic "$filename" "$mimetype"
2580
if [ "$action" = "info" ]; then
2582
@@ -763,17 +878,17 @@
2594
exit_failure_syntax "unknown mode '$1'"
2601
@@ -894,34 +1009,34 @@
2604
if [ -n "$kde_dir" ] ; then
2605
DEBUG 2 "KDE3 mimelnk directory found, extracting mimetypes from XML file"
2607
mimetypes=`awk < "$filename" '
2608
# Strip XML comments
2618
if (match($0,/-->/)) {
2619
$0=substr($0,RSTART+RLENGTH)
2628
if (match($0,/<!--/)) {
2629
if (RSTART>1) print substr($0,0,RSTART)
2630
$0=substr($0,RSTART+RLENGTH)
2641
@@ -932,67 +1047,67 @@
2643
/^mime-info/, /^\/mime-info/ {
2644
if (match($0,/^mime-type/)) {
2645
if (match($0,/type="[^"]*/) || match($0,/type='"'"'[^'"'"']*/)) {
2646
print substr($0,RSTART+6,RLENGTH-6)
2653
DEBUG 1 "$action mimetype in $xdg_dir"
2660
for x in $xdg_dir ; do
2662
eval 'cp $filename $x/$basefile'$xdg_redirect_output
2665
if [ -n "$mimetypes" ] ; then
2666
# No quotes around $mimetypes
2667
- for x in $mimetypes ; do
2668
+ for x in $mimetypes ; do
2669
DEBUG 1 "Installing $kde_dir/$x.desktop (KDE 3.x support)"
2670
mkdir -p `dirname $kde_dir/$x.desktop`
2672
# Strip XML comments
2682
if (match($0,/-->/)) {
2683
$0=substr($0,RSTART+RLENGTH)
2692
if (match($0,/<!--/)) {
2693
if (RSTART>1) print substr($0,0,RSTART)
2694
$0=substr($0,RSTART+RLENGTH)
2705
' | awk > $kde_dir/$x.desktop '
2706
# Extract mimetype $x from the XML file $filename
2707
-# Note that bash requires us to escape a single quote as '"'"'
2708
+# Note that bash requires us to escape a single quote as '"'"'
2717
@@ -1002,47 +1117,47 @@
2718
if (substr($0,RSTART+6,RLENGTH-6) == the_type) {
2720
print "[Desktop Entry]"
2721
print "# Installed by xdg-mime from " the_source
2722
print "Type=MimeType"
2723
print "MimeType=" the_type
2725
sub("/", "-", the_icon)
2726
- print "Icon=" the_icon
2727
+ print "Icon=" the_icon
2732
if (match($0,/^\/mime-type/)) {
2734
print "Patterns=" glob_patterns
2738
if (match($0,/^sub-class-of/)) {
2739
- if (match($0,/type="[^"]*/) || match($0,/type='"'"'[^'"'"']*/)) {
2740
+ if (match($0,/type="[^"]*/) || match($0,/type='"'"'[^'"'"']*/)) {
2741
print "X-KDE-IsAlso=" substr($0,RSTART+6,RLENGTH-6)
2744
print "Error: '"'"'type'"'"' argument missing in " RS $0
2749
if (match($0,/^glob/)) {
2750
- if (match($0,/pattern="[^"]*/) || match($0,/pattern='"'"'[^'"'"']*/)) {
2751
+ if (match($0,/pattern="[^"]*/) || match($0,/pattern='"'"'[^'"'"']*/)) {
2752
glob_patterns = glob_patterns substr($0,RSTART+9,RLENGTH-9) ";"
2755
print "Error: '"'"'pattern'"'"' argument missing in " RS $0
2760
if (match($0,/^comment/)) {
2761
- if (match($0,/xml:lang="[^"]*/) || match($0,/xml:lang='"'"'[^'"'"']*/)) {
2762
+ if (match($0,/xml:lang="[^"]*/) || match($0,/xml:lang='"'"'[^'"'"']*/)) {
2763
lang=substr($0,RSTART+10,RLENGTH-10)
2768
if (match($0,/>/)) {
2769
comment=substr($0,RSTART+1)
2770
sub("<", "<", comment)
2771
@@ -1061,31 +1176,31 @@
2772
print "Error: Mimetype '"'"'" the_type "'"'"' not found"
2777
if [ "$?" = "1" ] ; then
2778
grep -A 10 "^Error:" $kde_dir/$x.desktop >&2
2779
rm $kde_dir/$x.desktop
2790
for x in $xdg_dir ; do
2794
# No quotes around $mimetypes
2795
- for x in $mimetypes ; do
2796
+ for x in $mimetypes ; do
2797
if grep '^# Installed by xdg-mime' $kde_dir/$x.desktop >/dev/null 2>&1; then
2798
DEBUG 1 "Removing $kde_dir/$x.desktop (KDE 3.x support)"
2799
rm -f $kde_dir/$x.desktop
2805
Index: src/third_party/xdg-utils/scripts/xdg-mime.in
2806
===================================================================
2807
--- src.orig/third_party/xdg-utils/scripts/xdg-mime.in
2808
+++ src/third_party/xdg-utils/scripts/xdg-mime.in
2809
@@ -29,105 +29,213 @@
2812
update_mime_database()
2814
if [ x"$mode" = x"user" -a -n "$DISPLAY" ] ; then
2816
if [ x"$DE" = x"kde" ] ; then
2817
DEBUG 1 "Running kbuildsycoca"
2818
- eval 'kbuildsycoca'$xdg_redirect_output
2819
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2820
+ eval 'kbuildsycoca4'$xdg_redirect_output
2822
+ eval 'kbuildsycoca'$xdg_redirect_output
2826
for x in `echo "$PATH:/opt/gnome/bin" | sed 's/:/ /g'`; do
2827
if [ -x $x/update-mime-database ] ; then
2828
DEBUG 1 "Running $x/update-mime-database $1"
2829
eval '$x/update-mime-database $1'$xdg_redirect_output
2837
- if which "kmimetypefinder" > /dev/null 2>/dev/null; then
2838
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2839
DEBUG 1 "Running kmimetypefinder \"$1\""
2840
- kmimetypefinder "$1" 2>/dev/null | head -n 1
2841
+ KMIMETYPEFINDER=`which kmimetypefinder 2>/dev/null`
2842
+ $KMIMETYPEFINDER "$1" 2>/dev/null | head -n 1
2844
DEBUG 1 "Running kfile \"$1\""
2845
- kfile "$1" 2> /dev/null | head -n 1 | cut -d "(" -f 2 | cut -d ")" -f 1
2846
+ KFILE=`which kfile 2>/dev/null`
2847
+ $KFILE "$1" 2> /dev/null | head -n 1 | cut -d "(" -f 2 | cut -d ")" -f 1
2851
+ if [ $? -eq 0 ]; then
2854
+ exit_failure_operation_failed
2860
file=`readlink -f "$1"` # Normalize path
2861
- DEBUG 1 "Running gnomevfs-info \"$file\""
2862
- gnomevfs-info "$file" 2> /dev/null | grep MIME | cut -d ":" -f 2 | sed s/"^ "//
2865
+ if gvfs-info --help 2>/dev/null 1>&2; then
2866
+ DEBUG 1 "Running gvfs-info \"$file\""
2867
+ gvfs-info "$file" 2> /dev/null | grep standard::content-type | cut -d' ' -f4
2869
+ DEBUG 1 "Running gnomevfs-info \"$file\""
2870
+ gnomevfs-info --slow-mime "$file" 2> /dev/null | grep "^MIME" | cut -d ":" -f 2 | sed s/"^ "//
2873
+ if [ $? -eq 0 ]; then
2876
+ exit_failure_operation_failed
2882
- DEBUG 1 "Running /usr/bin/file -i \"$1\""
2883
+ DEBUG 1 "Running file -i \"$1\""
2884
/usr/bin/file -i "$1" 2> /dev/null | cut -d ":" -f 2 | sed s/"^ "//
2887
+ if [ $? -eq 0 ]; then
2890
+ exit_failure_operation_failed
2896
# $1 is vendor-name.desktop
2898
- # Add to $KDE_HOME/share/config/profilerc:
2901
+ # On KDE 3, add to $KDE_CONFIG_PATH/profilerc:
2905
# Remove all [$2 - *] sections, or even better,
2906
# renumber [$2 - *] sections and remove duplicate
2908
- default_file="$HOME/.kde/share/config/profilerc"
2909
- DEBUG 2 "make_default_kde $1 $2"
2911
+ # On KDE 4, add $2=$1 to $XDG_DATA_APPS/mimeapps.list
2915
+ # [Added Associations]
2916
+ # text/plain=kde4-kate.desktop;kde4-kwrite.desktop;
2918
+ # [Removed Associations]
2919
+ # text/plain=gnome-gedit.desktop;gnu-emacs.desktop;
2922
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2923
+ default_dir=`kde4-config --path xdgdata-apps 2> /dev/null | cut -d ':' -f 1`
2924
+ default_file="$default_dir/mimeapps.list"
2926
+ default_dir=`kde-config --path config 2> /dev/null | cut -d ':' -f 1`
2927
+ default_file="$default_dir/profilerc"
2929
+ if [ -z "$default_dir" ]; then
2930
+ DEBUG 2 "make_default_kde: No kde runtime detected"
2933
+ DEBUG 2 "make_default_kde $vendor $mimetype"
2934
DEBUG 1 "Updating $default_file"
2935
- mkdir -p "$HOME/.kde/share/config"
2936
+ mkdir -p "$default_dir"
2937
[ -f $default_file ] || touch $default_file
2938
- awk -v application="$1" -v mimetype="$2" '
2939
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
2940
+ [ -f $default_file ] || touch $default_file
2941
+ awk -v application="$vendor" -v mimetype="$mimetype" '
2943
+ prefix=mimetype "="
2950
+ if (index($0, "[Added Associations]") == 1) {
2952
+ } else if (index($0, "[") == 1) {
2953
+ if (associations && !found) {
2954
+ print prefix application
2958
+ } else if ($0 == "") {
2961
+ } else if (associations && index($0, prefix) == 1) {
2962
+ value=substr($0, length(prefix) + 1, length)
2963
+ split(value, apps, ";")
2964
+ value=application ";"
2969
+ for (i=0; i < count; i++) {
2970
+ if (apps[i] != application && apps[i] != "") {
2971
+ value=value apps[i] ";"
2978
+ while (blanks > 0) {
2987
+ if (!associations) {
2988
+ print "[Added Associations]"
2990
+ print prefix application
2992
+ while (blanks > 0) {
2997
+' $default_file > ${default_file}.new && mv ${default_file}.new $default_file
2998
+ eval 'kbuildsycoca4'$xdg_redirect_output
3000
+ awk -v application="$vendor" -v mimetype="$mimetype" '
3002
header_start="[" mimetype " - "
3008
if (index($0, header_start) == 1 )
3012
- if (/^\[/) { supress=0 }
3013
+ if (/^\[/) { suppress=0 }
3023
print "[" mimetype " - 1]"
3024
print "Application=" application
3025
print "AllowAsDefault=true"
3026
print "GenericServiceType=Application"
3027
print "Preference=1"
3028
print "ServiceType=" mimetype
3030
' $default_file > ${default_file}.new && mv ${default_file}.new $default_file
3034
make_default_generic()
3036
# $1 is vendor-name.desktop
3039
# Add $2=$1 to XDG_DATA_HOME/applications/defaults.list
3040
xdg_user_dir="$XDG_DATA_HOME"
3041
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
3042
default_file="$xdg_user_dir/applications/defaults.list"
3043
DEBUG 2 "make_default_generic $1 $2"
3044
DEBUG 1 "Updating $default_file"
3045
grep -v "$2=" $default_file > ${default_file}.new 2> /dev/null
3046
if ! grep "[Default Applications]" ${default_file}.new > /dev/null; then
3047
@@ -155,21 +263,27 @@
3056
- ktradertest=`which ktradertest 2> /dev/null`
3057
- if [ -n "$ktradertest" ] ; then
3058
- DEBUG 1 "Running ktradertest \"$MIME\" Application"
3059
- trader_result=`ktradertest "$MIME" Application 2>/dev/null | grep DesktopEntryPath \
3060
- | head -n 1 | cut -d ':' -f 2 | cut -d \' -f 2`
3061
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
3062
+ KTRADER=`which ktraderclient 2> /dev/null`
3063
+ MIMETYPE="--mimetype"
3064
+ SERVICETYPE="--servicetype"
3066
+ KTRADER=`which ktradertest 2> /dev/null`
3068
+ if [ -n "$KTRADER" ] ; then
3069
+ DEBUG 1 "Running KDE trader query \"$MIME\" mimetype and \"Application\" servicetype"
3070
+ trader_result=`$KTRADER $MIMETYPE "$MIME" $SERVICETYPE Application 2>/dev/null \
3071
+ | grep DesktopEntryPath | head -n 1 | cut -d ':' -f 2 | cut -d \' -f 2`
3072
if [ -n "$trader_result" ] ; then
3073
basename "$trader_result"
3076
exit_failure_operation_failed
3080
@@ -190,40 +304,40 @@
3089
- if [ -z "$1" ] ; then
3090
+ if [ -z "$1" ] ; then
3091
exit_failure_syntax "query type argument missing"
3100
- if [ -z "$filename" ] ; then
3101
+ if [ -z "$filename" ] ; then
3102
exit_failure_syntax "FILE argument missing"
3106
exit_failure_syntax "unexpected option '$filename'"
3109
check_input_file "$filename"
3115
- if [ -z "$mimetype" ] ; then
3116
+ if [ -z "$mimetype" ] ; then
3117
exit_failure_syntax "mimetype argument missing"
3121
exit_failure_syntax "unexpected option '$mimetype'"
3125
@@ -241,17 +355,17 @@
3134
- if [ -z "$1" ] ; then
3135
+ if [ -z "$1" ] ; then
3136
exit_failure_syntax "application argument missing"
3140
exit_failure_syntax "unexpected option '$1'"
3144
@@ -268,29 +382,29 @@
3145
exit_failure_syntax "unknown command '$1'"
3152
if [ "$action" = "makedefault" ]; then
3153
- if [ -z "$1" ] ; then
3154
+ if [ -z "$1" ] ; then
3155
exit_failure_syntax "mimetype argument missing"
3158
while [ $# -gt 0 ] ; do
3161
exit_failure_syntax "unexpected option '$1'"
3168
make_default_kde "$filename" "$mimetype"
3169
make_default_generic "$filename" "$mimetype"
3174
if [ "$action" = "info" ]; then
3176
@@ -345,17 +459,17 @@
3188
exit_failure_syntax "unknown mode '$1'"
3195
@@ -476,34 +590,34 @@
3198
if [ -n "$kde_dir" ] ; then
3199
DEBUG 2 "KDE3 mimelnk directory found, extracting mimetypes from XML file"
3201
mimetypes=`awk < "$filename" '
3202
# Strip XML comments
3212
if (match($0,/-->/)) {
3213
$0=substr($0,RSTART+RLENGTH)
3222
if (match($0,/<!--/)) {
3223
if (RSTART>1) print substr($0,0,RSTART)
3224
$0=substr($0,RSTART+RLENGTH)
3235
@@ -514,67 +628,67 @@
3237
/^mime-info/, /^\/mime-info/ {
3238
if (match($0,/^mime-type/)) {
3239
if (match($0,/type="[^"]*/) || match($0,/type='"'"'[^'"'"']*/)) {
3240
print substr($0,RSTART+6,RLENGTH-6)
3247
DEBUG 1 "$action mimetype in $xdg_dir"
3254
for x in $xdg_dir ; do
3256
eval 'cp $filename $x/$basefile'$xdg_redirect_output
3259
if [ -n "$mimetypes" ] ; then
3260
# No quotes around $mimetypes
3261
- for x in $mimetypes ; do
3262
+ for x in $mimetypes ; do
3263
DEBUG 1 "Installing $kde_dir/$x.desktop (KDE 3.x support)"
3264
mkdir -p `dirname $kde_dir/$x.desktop`
3266
# Strip XML comments
3276
if (match($0,/-->/)) {
3277
$0=substr($0,RSTART+RLENGTH)
3286
if (match($0,/<!--/)) {
3287
if (RSTART>1) print substr($0,0,RSTART)
3288
$0=substr($0,RSTART+RLENGTH)
3299
' | awk > $kde_dir/$x.desktop '
3300
# Extract mimetype $x from the XML file $filename
3301
-# Note that bash requires us to escape a single quote as '"'"'
3302
+# Note that bash requires us to escape a single quote as '"'"'
3311
@@ -584,47 +698,47 @@
3312
if (substr($0,RSTART+6,RLENGTH-6) == the_type) {
3314
print "[Desktop Entry]"
3315
print "# Installed by xdg-mime from " the_source
3316
print "Type=MimeType"
3317
print "MimeType=" the_type
3319
sub("/", "-", the_icon)
3320
- print "Icon=" the_icon
3321
+ print "Icon=" the_icon
3326
if (match($0,/^\/mime-type/)) {
3328
print "Patterns=" glob_patterns
3332
if (match($0,/^sub-class-of/)) {
3333
- if (match($0,/type="[^"]*/) || match($0,/type='"'"'[^'"'"']*/)) {
3334
+ if (match($0,/type="[^"]*/) || match($0,/type='"'"'[^'"'"']*/)) {
3335
print "X-KDE-IsAlso=" substr($0,RSTART+6,RLENGTH-6)
3338
print "Error: '"'"'type'"'"' argument missing in " RS $0
3343
if (match($0,/^glob/)) {
3344
- if (match($0,/pattern="[^"]*/) || match($0,/pattern='"'"'[^'"'"']*/)) {
3345
+ if (match($0,/pattern="[^"]*/) || match($0,/pattern='"'"'[^'"'"']*/)) {
3346
glob_patterns = glob_patterns substr($0,RSTART+9,RLENGTH-9) ";"
3349
print "Error: '"'"'pattern'"'"' argument missing in " RS $0
3354
if (match($0,/^comment/)) {
3355
- if (match($0,/xml:lang="[^"]*/) || match($0,/xml:lang='"'"'[^'"'"']*/)) {
3356
+ if (match($0,/xml:lang="[^"]*/) || match($0,/xml:lang='"'"'[^'"'"']*/)) {
3357
lang=substr($0,RSTART+10,RLENGTH-10)
3362
if (match($0,/>/)) {
3363
comment=substr($0,RSTART+1)
3364
sub("<", "<", comment)
3365
@@ -643,31 +757,31 @@
3366
print "Error: Mimetype '"'"'" the_type "'"'"' not found"
3371
if [ "$?" = "1" ] ; then
3372
grep -A 10 "^Error:" $kde_dir/$x.desktop >&2
3373
rm $kde_dir/$x.desktop
3384
for x in $xdg_dir ; do
3388
# No quotes around $mimetypes
3389
- for x in $mimetypes ; do
3390
+ for x in $mimetypes ; do
3391
if grep '^# Installed by xdg-mime' $kde_dir/$x.desktop >/dev/null 2>&1; then
3392
DEBUG 1 "Removing $kde_dir/$x.desktop (KDE 3.x support)"
3393
rm -f $kde_dir/$x.desktop
3399
Index: src/third_party/xdg-utils/scripts/xdg-open
3400
===================================================================
3401
--- src.orig/third_party/xdg-utils/scripts/xdg-open
3402
+++ src/third_party/xdg-utils/scripts/xdg-open
3406
#---------------------------------------------
3409
# Utility script to open a URL in the registered default application.
3411
# Refer to the usage() function below for usage.
3413
# Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
3414
@@ -195,17 +195,17 @@
3415
if [ $# -gt 0 ]; then
3416
echo "xdg-open: $@" >&2
3422
#------------------------------------------------------------
3423
-# Exit script on insufficient permission to read a specified file
3424
+# Exit script on insufficient permission to write a specified file
3426
exit_failure_file_permission_write()
3428
if [ $# -gt 0 ]; then
3429
echo "xdg-open: $@" >&2
3433
@@ -272,17 +272,17 @@
3442
- echo "xdg-open 1.0.1"
3443
+ echo "xdg-open 1.0.2"
3450
check_common_commands "$@"
3452
@@ -298,17 +298,18 @@
3453
#--------------------------------------
3454
# Checks for known desktop environments
3455
# set variable DE to the desktop environments name, lowercase
3459
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
3460
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
3461
- elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
3462
+ elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
3463
+ elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
3467
#----------------------------------------------------------------------------
3468
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
3469
# It also always returns 1 in KDE 3.4 and earlier
3470
# Simply return 0 in such case
3472
@@ -319,31 +320,50 @@
3473
minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'`
3474
release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'`
3475
test "$major" -gt 3 && return $1
3476
test "$minor" -gt 5 && return $1
3477
test "$release" -gt 4 && return $1
3481
+# This handles backslashes but not quote marks.
3490
- kfmclient exec "$1"
3491
- kfmclient_fix_exit_code $?
3492
+ if kde-open -v 2>/dev/null 1>&2; then
3495
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
3496
+ kfmclient openURL "$1"
3498
+ kfmclient exec "$1"
3499
+ kfmclient_fix_exit_code $?
3503
if [ $? -eq 0 ]; then
3506
exit_failure_operation_failed
3513
+ if gvfs-open --help 2>/dev/null 1>&2; then
3519
if [ $? -eq 0 ]; then
3522
exit_failure_operation_failed
3526
@@ -353,48 +373,90 @@
3528
if [ $? -eq 0 ]; then
3531
exit_failure_operation_failed
3536
+open_generic_xdg_mime()
3538
- if mimeopen -v 2>/dev/null 1>&2; then
3540
- if [ $? -eq 0 ]; then
3543
+ filetype=`xdg-mime query filetype "$1" | sed "s/;.*//"`
3544
+ default=`xdg-mime query default "$filetype"`
3545
+ if [ -n "$default" ] ; then
3546
+ xdg_user_dir="$XDG_DATA_HOME"
3547
+ [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
3549
+ xdg_system_dirs="$XDG_DATA_DIRS"
3550
+ [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
3552
+ for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do
3553
+ file="$x/applications/$default"
3554
+ if [ -r "$file" ] ; then
3555
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
3556
+ command_exec=`which $command 2>/dev/null`
3557
+ if [ -x "$command_exec" ] ; then
3558
+ $command_exec "$1"
3559
+ if [ $? -eq 0 ]; then
3568
- if which run-mailcap 2>/dev/null 1>&2 &&
3569
- (echo "$1" | grep -q '^file://' ||
3572
+ # Paths or file:// URLs
3573
+ if (echo "$1" | grep -q '^file://' ||
3574
! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:'); then
3576
local file=$(echo "$1" | sed 's%^file://%%')
3577
- run-mailcap --action=view "$file"
3578
- if [ $? -eq 0 ]; then
3584
+ check_input_file "$file"
3586
+ open_generic_xdg_mime "$file"
3588
+ if [ -f /etc/debian_version ] &&
3589
+ which run-mailcap 2>/dev/null 1>&2; then
3590
+ run-mailcap --action=view "$file"
3591
+ if [ $? -eq 0 ]; then
3596
+ if mimeopen -v 2>/dev/null 1>&2; then
3597
+ mimeopen -L -n "$file"
3598
+ if [ $? -eq 0 ]; then
3605
for browser in $BROWSER; do
3606
if [ x"$browser" != x"" ]; then
3609
- browser_with_arg=${browser//'%s'/"$1"}
3610
+ browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
3611
+ if [ $? -ne 0 ]; then
3612
+ browser_with_arg=$browser;
3615
- if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
3616
- else $browser_with_arg;
3617
+ if [ x"$browser_with_arg" = x"$browser" ]; then
3619
+ else eval '$browser_with_arg'$xdg_redirect_output;
3622
- if [ $? -eq 0 ]; then exit_success;
3623
+ if [ $? -eq 0 ]; then
3629
exit_failure_operation_impossible "no method available for opening '$1'"
3632
[ x"$1" != x"" ] || exit_failure_syntax
3633
@@ -420,23 +482,27 @@
3635
if [ -z "${url}" ] ; then
3636
exit_failure_syntax "file or URL argument missing"
3641
if [ x"$DE" = x"" ]; then
3642
- # if BROWSER variable is not set, check some well known browsers instead
3643
- if [ x"$BROWSER" = x"" ]; then
3644
- BROWSER=firefox:mozilla:netscape
3649
+# if BROWSER variable is not set, check some well known browsers instead
3650
+if [ x"$BROWSER" = x"" ]; then
3651
+ BROWSER=links2:links:lynx:w3m
3652
+ if [ -n "$DISPLAY" ]; then
3653
+ BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
3665
Index: src/third_party/xdg-utils/scripts/xdg-open.in
3666
===================================================================
3667
--- src.orig/third_party/xdg-utils/scripts/xdg-open.in
3668
+++ src/third_party/xdg-utils/scripts/xdg-open.in
3672
#---------------------------------------------
3675
# Utility script to open a URL in the registered default application.
3677
# Refer to the usage() function below for usage.
3679
# Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
3689
+# This handles backslashes but not quote marks.
3698
- kfmclient exec "$1"
3699
- kfmclient_fix_exit_code $?
3700
+ if kde-open -v 2>/dev/null 1>&2; then
3703
+ if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
3704
+ kfmclient openURL "$1"
3706
+ kfmclient exec "$1"
3707
+ kfmclient_fix_exit_code $?
3711
if [ $? -eq 0 ]; then
3714
exit_failure_operation_failed
3721
+ if gvfs-open --help 2>/dev/null 1>&2; then
3727
if [ $? -eq 0 ]; then
3730
exit_failure_operation_failed
3736
if [ $? -eq 0 ]; then
3739
exit_failure_operation_failed
3744
+open_generic_xdg_mime()
3746
- if mimeopen -v 2>/dev/null 1>&2; then
3748
- if [ $? -eq 0 ]; then
3751
+ filetype=`xdg-mime query filetype "$1" | sed "s/;.*//"`
3752
+ default=`xdg-mime query default "$filetype"`
3753
+ if [ -n "$default" ] ; then
3754
+ xdg_user_dir="$XDG_DATA_HOME"
3755
+ [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
3757
+ xdg_system_dirs="$XDG_DATA_DIRS"
3758
+ [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
3760
+ for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do
3761
+ file="$x/applications/$default"
3762
+ if [ -r "$file" ] ; then
3763
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
3764
+ command_exec=`which $command 2>/dev/null`
3765
+ if [ -x "$command_exec" ] ; then
3766
+ $command_exec "$1"
3767
+ if [ $? -eq 0 ]; then
3776
- if which run-mailcap 2>/dev/null 1>&2 &&
3777
- (echo "$1" | grep -q '^file://' ||
3780
+ # Paths or file:// URLs
3781
+ if (echo "$1" | grep -q '^file://' ||
3782
! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:'); then
3784
local file=$(echo "$1" | sed 's%^file://%%')
3785
- run-mailcap --action=view "$file"
3786
- if [ $? -eq 0 ]; then
3792
+ check_input_file "$file"
3794
+ open_generic_xdg_mime "$file"
3796
+ if [ -f /etc/debian_version ] &&
3797
+ which run-mailcap 2>/dev/null 1>&2; then
3798
+ run-mailcap --action=view "$file"
3799
+ if [ $? -eq 0 ]; then
3804
+ if mimeopen -v 2>/dev/null 1>&2; then
3805
+ mimeopen -L -n "$file"
3806
+ if [ $? -eq 0 ]; then
3813
for browser in $BROWSER; do
3814
if [ x"$browser" != x"" ]; then
3817
- browser_with_arg=${browser//'%s'/"$1"}
3818
+ browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
3819
+ if [ $? -ne 0 ]; then
3820
+ browser_with_arg=$browser;
3823
- if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
3824
- else $browser_with_arg;
3825
+ if [ x"$browser_with_arg" = x"$browser" ]; then
3827
+ else eval '$browser_with_arg'$xdg_redirect_output;
3830
- if [ $? -eq 0 ]; then exit_success;
3831
+ if [ $? -eq 0 ]; then
3837
exit_failure_operation_impossible "no method available for opening '$1'"
3840
[ x"$1" != x"" ] || exit_failure_syntax
3841
@@ -123,23 +184,27 @@
3843
if [ -z "${url}" ] ; then
3844
exit_failure_syntax "file or URL argument missing"
3849
if [ x"$DE" = x"" ]; then
3850
- # if BROWSER variable is not set, check some well known browsers instead
3851
- if [ x"$BROWSER" = x"" ]; then
3852
- BROWSER=firefox:mozilla:netscape
3857
+# if BROWSER variable is not set, check some well known browsers instead
3858
+if [ x"$BROWSER" = x"" ]; then
3859
+ BROWSER=links2:links:lynx:w3m
3860
+ if [ -n "$DISPLAY" ]; then
3861
+ BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
3873
Index: src/third_party/xdg-utils/scripts/xdg-screensaver
3874
===================================================================
3875
--- src.orig/third_party/xdg-utils/scripts/xdg-screensaver
3876
+++ src/third_party/xdg-utils/scripts/xdg-screensaver
3877
@@ -225,17 +225,17 @@
3878
if [ $# -gt 0 ]; then
3879
echo "xdg-screensaver: $@" >&2
3885
#------------------------------------------------------------
3886
-# Exit script on insufficient permission to read a specified file
3887
+# Exit script on insufficient permission to write a specified file
3889
exit_failure_file_permission_write()
3891
if [ $# -gt 0 ]; then
3892
echo "xdg-screensaver: $@" >&2
3896
@@ -302,17 +302,17 @@
3905
- echo "xdg-screensaver 1.0.1"
3906
+ echo "xdg-screensaver 1.0.2"
3913
check_common_commands "$@"
3915
@@ -328,17 +328,18 @@
3916
#--------------------------------------
3917
# Checks for known desktop environments
3918
# set variable DE to the desktop environments name, lowercase
3922
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
3923
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
3924
- elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
3925
+ elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
3926
+ elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
3930
#----------------------------------------------------------------------------
3931
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
3932
# It also always returns 1 in KDE 3.4 and earlier
3933
# Simply return 0 in such case
3935
@@ -349,17 +350,17 @@
3936
minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'`
3937
release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'`