#!/bin/bash


if test -e /usr/bin/7z
then
echo continua
else

kdialog --caption "AcetoneISO2" --error "ATTENTION!\n The file 7z hasn't been found in Your System. Install p7zip"
exit
fi

OPENFILE=`kdialog --icon /usr/share/pixmaps/aiso2.png --caption "Select Image to Compress" --getopenfilename $HOME/ "*.iso *.daa *.bin *.mdf *.ashdisc *.bwi *.b5i *.lcd *.img *.cdi *.cif *.p01 *.pdi *.nrg *.ncd *.pxi *.gi *.fcd *.vcd *.c2d |All supported Images"`

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

SAVE7Z=`kdialog --icon /usr/share/pixmaps/aiso2.png --caption "Select where to Save Compressed ISO!" --getsavefilename $HOME/ "*.7z | 7Z File"`

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

sevz=`kdialog --icon /usr/share/pixmaps/aiso2.png --caption "AcetoneISO2" --combobox "Select a Method Compression:" "Ultra-High-VerySlow" "Normal"`

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

if test $sev7 = Ultra-High-VerySlow
then

konsole --noclose -e 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on "$SAVE7Z" "$OPENFILE"

else

konsole --noclose -e 7z a -t7z -m0=lzma -mx=4 -mfb=32 -md=4m -ms=on "$SAVE7Z" "$OPENFILE"

fi
exit
