#!/bin/bash



  #	AcetoneISO2 Pro
  #	Copyright (C) 2006  Fabrizio Di Marco & Marco Di Antonio    <acetoneiso_at_gmail.com>
  #
  #  This program is free software; you can redistribute it and/or modify
  #  it under the terms of the GNU General Public License as published by
  #  the Free Software Foundation; either version 2 of the License, or
  #  (at your option) any later version.
  #
  #  This program is distributed in the hope that it will be useful,
  #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  #  GNU General Public License for more details.
  #
  #  You should have received a copy of the GNU General Public License
  #  along with this program; if not, write to the Free Software
  #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


VAROUT=`kdialog --icon /usr/share/pixmaps/aiso2.png --caption "Select Folder to Unmount" --getexistingdirectory $HOME/ `
if test -z "$VAROUT"
then 
exit
else
echo continua
fi

if test -w "$VAROUT"
then 
kdialog --caption "AcetoneISO2 Message" --msgbox "The folder '$VAROUT' is not mounted by any ISO!"
exit 
else
echo continua
fi

kdesu -n -d -i /usr/share/pixmaps/aiso2.png "umount '$VAROUT'" 
					
		if test -w "$VAROUT"
		then



	if `kdialog --dontagain acetoneiso:nofilemsg --title "AcetoneISO2 warning dialog" --warningyesno "ISO Umounted!\nDo you want to DELETE '$VAROUT' folder?"`

	then

	rm -rf "$VAROUT"
	

	else
	exit
	fi
		else
		kdialog --caption "AcetoneISO2 Message" --sorry "Sorry, AcetoneISO2 wasn't able to Umount the folder"
		fi
