From 6252c2bfaeacd7977958c6b0c7376db7b21cdcb2 Mon Sep 17 00:00:00 2001 From: nils Date: Fri, 25 Jun 2010 17:23:54 +0000 Subject: added warning, if file exists in file encryption git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@362 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- fileencryptiondialog.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'fileencryptiondialog.cpp') diff --git a/fileencryptiondialog.cpp b/fileencryptiondialog.cpp index d1f02ef..25db7f0 100755 --- a/fileencryptiondialog.cpp +++ b/fileencryptiondialog.cpp @@ -38,7 +38,6 @@ FileEncryptionDialog::FileEncryptionDialog(GpgME::Context *ctx, QString iconPath : QDialog(parent) { - mCtx = ctx; setWindowTitle(tr("Encrypt / Decrypt File")); resize(500, 200); @@ -136,8 +135,9 @@ void FileEncryptionDialog::selectOutputFile() path = QFileInfo(outputFileEdit->text()).absolutePath(); } - QString outfileName = QFileDialog::getSaveFileName(this, tr("Save File"), path); + QString outfileName = QFileDialog::getSaveFileName(this, tr("Save File"),path, NULL ,NULL ,QFileDialog::DontConfirmOverwrite); outputFileEdit->setText(outfileName); + } void FileEncryptionDialog::executeAction() @@ -173,8 +173,14 @@ void FileEncryptionDialog::executeAction() QDataStream out(&outfile); out.writeRawData(outBuffer->data(), outBuffer->length()); - accept(); - QMessageBox::information(0, "Done", "Output saved to " + outputFileEdit->text()); + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("File"), + tr("File exists! Do you want to overwrite it?"), + QMessageBox::Ok|QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + accept(); + QMessageBox::information(0, "Done", "Output saved to " + outputFileEdit->text()); + } } void FileEncryptionDialog::showKeyList() -- cgit v1.2.3