#!/bin/sh
#
# kfm -- launcher for KDE file manager in konqueror
#
# Usage:  kfm
#  or     kfm directory ...
#  or     kfm //host ...
#  or     kfm URL ...
#
# The kfm command launches a KDE konqueror file manager or web browser
# window for each argument given, or for the current directory if nothing
# is specified.  If the argument begins with a double slash (//) it will
# open a file manager window on that host using the FISH (file over shell)
# protocol if the host is a known local Linux system, or using an FTP
# login as "exp" for other hosts.  If the argument is an http: or man:
# URL, it will open a web browser on that web page or Linux manual page.
#
# (c) 2008, G.R. Detillieux, Spinal Cord Research Centre,
# The University of Manitoba.  All Rights Reserved.
#

case "$#" in
0)	set -- "." ;;
esac

for arg
do
  case "$arg" in
  http:*|man:*)
	kfmclient openProfile webbrowsing "$arg" 2>/dev/null
	;;
  //dave*|//larry*|//phil*|//cliff*)
	kfmclient openProfile filemanagement "fish:$arg" 2>/dev/null
	;;
  //*)
	kfmclient openProfile filemanagement "ftp://exp@${arg#//}" 2>/dev/null
	;;
  *)
	kfmclient openProfile filemanagement "$arg" 2>/dev/null
	;;
  esac
done
