#!/bin/bash


kdialog --icon /usr/share/pixmaps/aiso2.png --caption "AcetoneISO2" --msgbox "Remember to choose All files xaa xab xa* to be Merged\nKeep CTRL button pressed to select more than one file\nBe patient.A big file will require a long time to be merged"



VARIN=`kdialog --icon /usr/share/pixmaps/aiso2.png --caption "Select files to be Merged" --multiple --getopenfilename $HOME/ `

if test -z $VARIN
then
exit
else
echo continua
fi

info=`dirname "$VARIN"`

info2=`echo "$info" | awk '{print $1}'`

info3=`dirname "$info2"`
info4=`echo "$info3"`

if test ! -e "$info4"/INFO-splitted-file
then

kdialog --caption "AcetoneISO2" --sorry "AcetoneISO2 couldn't retrieve information on splitted image.It won't be able to automatically give name and extention of it\nPlease also be sure the directory does not have space in dirname"
else
echo continua
fi

info5=`cat "$info4"/INFO-splitted-file`

VAROUT=`kdialog --icon /usr/share/pixmaps/aiso2.png --caption "Select where to Save Merged Image" --getsavefilename $HOME/"$info5"`

if test -z $VAROUT
then
exit
else
echo continua
fi

cat $VARIN > "$VAROUT"

kdialog --caption "AcetoneISO2" --msgbox "Process Completed"

exit
