This is my code:
Edit_Record() {
zenity --width=600 --height=300 --text-info --title="Records" --filename=$FILE --editable
if [ "$?" = 0 ]; then
kdialog --title "Saving the Data" --warningyesnocancel "Do you want to save the changes?"
if [ "$?" = 0 ]; then
kdialog --msgbox "The changes have been added!"
Home;
elif [ "$?" = 1 ]; then
kdialog --msgbox "No changes has been added!"
Home;
else
Home;
fi;
else
zenity --info --text "You chose to Cancel."
exit
fi;
}
I dont know what to put behind "kdialog --msgbox "The changes have been added!" :( Help please?
zenity --editable
returns the edited text to standard output. You can save it to a temporary file by redirection, and if the user wants to save the changes, just move the temporary file over the original.
tmp=$(mktemp)
zenity --editable ... > $tmp
if ... ; then
mv $FILE "$FILE"~
mv $tmp "$FILE"
fi