use kdialog correctly and fixed some unused variables