~ubuntu-branches/ubuntu/wily/xdg-utils/wily

« back to all changes in this revision

Viewing changes to scripts/xdg-copy.in

  • Committer: Package Import Robot
  • Author(s): Sean Davis
  • Date: 2015-09-13 12:39:10 UTC
  • mfrom: (13.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20150913123910-uba8c1sph2iwnqlr
Tags: 1.1.0~rc3+git20150907-1ubuntu1
* Merge from Debian unstable.  Remaining changes: (LP: #1495273)
  - debian/patches:
    * gnome-3.0.diff: Correctly open preferred browser with 
      gnome-open (LP: #670128)
    * lp779156-lubuntu.diff: Add open_lxde and run_sylpheed function
      for improved LXDE and sylpheed support (LP: #779156)
    * xdg-screensaver-restore-timeout.diff: restore previous X11 
      screensaver timeout when xdg-screensaver resume is used (LP: #1363540)
* New upstream release fixes the following bugs:
  - xdg-mime query filetype does not work on KDE 5 (LP: #1454833)
  - xdg-open doesn't properly detect Xfce/Xubuntu (LP: #1388922)
  - xserver-blanking patch in Ubuntu duplicates code (LP: #1330386)
  - Typo in manpage of 'xdg-icon-resource' (LP: #996304)
  - xdg-open (to gnome-open) fails to launch file:// URL with query string 
    (LP: #396162)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#---------------------------------------------
 
3
#   xdg-copy
 
4
#
 
5
#   Utility script to copy files specified by URLs, including
 
6
#   downloading and uploading from/to remote sites.
 
7
#
 
8
#   Refer to the usage() function below for usage.
 
9
#
 
10
#   Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org>
 
11
#   Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org>
 
12
#   Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
 
13
#   Copyright 2006, Jeremy White <jwhite@codeweavers.com>
 
14
#
 
15
#   LICENSE:
 
16
#
 
17
#---------------------------------------------
 
18
 
 
19
manualpage()
 
20
{
 
21
cat << _MANUALPAGE
 
22
_MANUALPAGE
 
23
}
 
24
 
 
25
usage()
 
26
{
 
27
cat << _USAGE
 
28
_USAGE
 
29
}
 
30
 
 
31
#@xdg-utils-common@
 
32
 
 
33
copy_kde()
 
34
{
 
35
    kfmclient copy "$1" "$2"
 
36
 
 
37
    if [ $? -eq 0 ]; then
 
38
        exit_success
 
39
    else
 
40
        exit_failure_operation_failed
 
41
    fi
 
42
}
 
43
 
 
44
copy_gnome()
 
45
{
 
46
    if gvfs-copy --help 2>/dev/null 1>&2; then
 
47
        gvfs-copy "$1" "$2"
 
48
    else
 
49
        gnomevfs-copy "$1" "$2"
 
50
    fi
 
51
 
 
52
    if [ $? -eq 0 ]; then
 
53
        exit_success
 
54
    else
 
55
        exit_failure_operation_failed
 
56
    fi
 
57
}
 
58
 
 
59
[ x"$1" != x"" ] || exit_failure_syntax
 
60
 
 
61
source=
 
62
dest=
 
63
while [ $# -gt 0 ] ; do
 
64
    parm=$1
 
65
    shift
 
66
 
 
67
    case $parm in
 
68
      -*)
 
69
        exit_failure_syntax "unexpected option '$parm'"
 
70
        ;;
 
71
 
 
72
      *)
 
73
        if [ -n "$dest" ] ; then
 
74
            exit_failure_syntax "unexpected argument '$parm'"
 
75
        fi
 
76
        if [ -n "$source" ] ; then
 
77
            dest=$parm
 
78
        else
 
79
            source=$parm
 
80
        fi
 
81
        ;;
 
82
    esac
 
83
done
 
84
 
 
85
if [ -z "${source}" ] ; then
 
86
    exit_failure_syntax "source argument missing"
 
87
fi
 
88
if [ -z "${dest}" ] ; then
 
89
    exit_failure_syntax "destination argument missing"
 
90
fi
 
91
 
 
92
detectDE
 
93
 
 
94
case "$DE" in
 
95
    kde)
 
96
    copy_kde "$source" "$dest"
 
97
    ;;
 
98
 
 
99
    gnome*|cinnamon|lxde|mate|xfce)
 
100
    copy_gnome "$source" "$dest"
 
101
    ;;
 
102
 
 
103
    *)
 
104
    exit_failure_operation_impossible "no method available for copying '$source' to '$dest'"
 
105
    ;;
 
106
esac