1#!/bin/sh
2
3action="$1"; shift;
4
5case "$action" in
6downloadFrom)
7    cmdoption=--download-from
8    dcopcall=org.kde.digikam.downloadFrom
9    args="$@"
10    ;;
11downloadFromUdi)
12    cmdoption=--download-from-udi
13    dcopcall=org.kde.digikam.downloadFromUdi
14    args="$@"
15    ;;
16detectCamera)
17	cmdoption=--detect-camera
18	dcopcall=detectCamera
19	;;
20*)
21	echo "${0##*/}: wrong action.  Usage"
22    echo "  ${0##*/}  downloadFrom <path> # for directories with images"
23    echo "  ${0##*/}  downloadFromUdi <udi> # for devices with images"
24	echo "	${0##*/}  detect 	# for gphoto2 supported cameras"
25	exit 1
26	;;
27esac
28
29for app in `qdbus`; do
30	case "$app" in
31	    org.kde.digikam-*)
32		echo "recycling running $app: $dcopcall $@"
33        if test -z "$args"; then
34		    exec qdbus "$app" "/Digikam" "$dcopcall"
35        else
36            exec qdbus "$app" "/Digikam" "$dcopcall" "$args"
37        fi
38        break
39	    ;;
40	esac
41done;
42echo "starting digikam with $cmdoption $args"
43if test -z "$args"; then
44    exec digikam  "$cmdoption"
45else
46    exec digikam  "$cmdoption" "$args"
47fi
48