#!/bin/sh
########################################################################
#             (c) Copyright 2010 Lexmark R&D Corporation               #
#                        All rights reserved                           #
########################################################################
#                                                                      #
#  This script will display a save-file dialog.                        #
#                                                                      #
#  Requires the following scripts:                                     #
#  (refer to PATHS section for actual filepaths)                       #
#      NONE                                                            # 
#                                                                      #
#  Parameters: <title> <file filter> <filename>                        #
########################################################################

# Dialog title
title=$1

# File filter to used
filter=$2

# Default filename
filename=$3

# Check if zenity is available
zenity --help > /dev/null 2>&1
if [ $? -eq 0 ]; then
	zenity --title="${title}" --file-selection --save --confirm-overwrite --file-filter="${filter}" --filename="${filename}"
	#zenity --file-selection --save --confirm-overwrite --file-filter="${filter}" --filename="${filename}"
else
	kdialog --getsavefilename "${filename}" 2> /dev/null
fi

