1#compdef kfmclient kioclient
2
3# kfmclient is a command line interface for use with Konqueror,
4# the KDE file manager and web browser.
5#
6# In KDE4, kioclient has similar syntax but doesn't necessarily talk
7# to Konqueror ("kioclient exec ." by default starts Dolphin, for example).
8
9local expl
10local -a context state line
11typeset -A opt_args
12
13_arguments \
14  '--help[show help message]' \
15  '--help-qt[show Qt specific options]' \
16  '--help-kde[show KDE specific options]' \
17  '--help-all[show all options]' \
18  '--author[show author information]' \
19  '-v[show version information]' \
20  '--version[show version information]' \
21  '--license[show license information]' \
22  '--commands[show available commands]' \
23  '--display=:X display:_x_display' \
24  '--session=:session id for restoring application: ' \
25  '--cmap[use private colormap (8-bit display)]' \
26  '--ncols=:limit on number of colors (8-bit display): ' \
27  '--nograb[never grab mouse or keyboard]' \
28  '--dograb[override nograb in debugger]' \
29  '--sync[switch to synchronous mode when debugging]' \
30  '--fn=:font name:_x_font' \
31  '--font=:font name:_x_font' \
32  '--bg=:background color:_x_color' \
33  '--background=:background color:_x_color' \
34  '--fg=:foreground color:_x_color' \
35  '--foreround=:foreground color:_x_color' \
36  '--btn=:button color:_x_color' \
37  '--button=:button color:_x_color' \
38  '--name=:application name: ' \
39  '--title=:application title (caption): ' \
40  '--visual=:specify visual:_x_visual' \
41  '--inputstyle:X input method:(onthespot overthespot offthespot root)' \
42  '--im:X Input Method server: ' \
43  '--noxim[disable X Input Method]' \
44  '--reverse[reverse widget layout]' \
45  '--caption=:name in titlebar: ' \
46  '--icon=:application icon: ' \
47  '--miniicon=:icon in titlebar: ' \
48  '--config=:configuration  file:_files' \
49  '--dcopserver=:DCOP server: ' \
50  '--nocrashhandler[disable crash handler, allow core dumps]' \
51  '--waitforwm[wait for a WM_NET compatible window manager]' \
52  '--style=:GUI style for application: ' \
53  '--geometry=:client window geometry:_x_geometry' \
54  '1:client command:(openURL openProfile openProperties exec move
55download copy sortDesktop configure configureDesktop)' \
56  '2::args:->firstarg' \
57  '3::args:->secondarg'  &&  return 0
58
59[[ $state = *arg ]] || return 1
60
61# Argument to previous command.
62
63case $line[1] in
64  (openURL)
65  if [[ $state = secondarg ]]; then
66    _mime_types
67    return
68  elif [[ $state = firstarg ]]; then
69    _webbrowser
70    return
71  fi
72  ;;
73
74  (openProfile)
75  if [[ $state = secondarg ]]; then
76    _webbrowser
77    return
78  elif [[ $state = firstarg ]]; then
79    local appdata=${$(kde-config --path data 2> /dev/null):-~/.kde/share/apps/}
80    _wanted profile expl 'Konqueror profile' \
81      compadd -- ${(s/:/)^${appdata}}konqueror/profiles/*(:t)
82    return
83  fi
84  ;;
85
86  (exec)
87  if [[ $state = secondarg ]]; then
88    # Look for a Desktop Action binding.
89    _wanted binding expl 'KDE binding' compadd -- ${${${(M)${(f)"$(<$file)"}:#"[Desktop Action "*"]"}%%\]}##"[Desktop Action "}
90    return
91  elif [[ $state = firstarg ]]; then
92    _webbrowser
93    return
94  fi
95  ;;
96
97  (move|download|copy|openProperties)
98  if [[ $state = firstarg ]]; then
99      _webbrowser
100      return
101  fi
102  ;;
103esac
104
105_message "no more arguments"
106