diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-12-29 15:47:46 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-12-29 15:47:46 +0000 |
commit | df2bce397c1b05c75afb175d340c3fa32614a3a9 (patch) | |
tree | 6797c72060b2be18b0023f40ed773075b7ebf389 /fileencryptiondialog.cpp | |
parent | added possibility to import keys through dropping key-files on keylist or thr... (diff) | |
download | gpg4usb-df2bce397c1b05c75afb175d340c3fa32614a3a9.tar.gz gpg4usb-df2bce397c1b05c75afb175d340c3fa32614a3a9.zip |
fixed behaviour in file encryption with existing and non-existing files
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@410 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to '')
-rwxr-xr-x | fileencryptiondialog.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/fileencryptiondialog.cpp b/fileencryptiondialog.cpp index 138a8b4..931aaa3 100755 --- a/fileencryptiondialog.cpp +++ b/fileencryptiondialog.cpp @@ -150,7 +150,6 @@ void FileEncryptionDialog::executeAction() } QByteArray inBuffer = infile.readAll(); - QByteArray *outBuffer = new QByteArray(); if (radioEnc->isChecked()) { @@ -162,6 +161,16 @@ void FileEncryptionDialog::executeAction() } QFile outfile(outputFileEdit->text()); + if (outfile.exists()){ + 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::Cancel){ + return; + } + } + if (!outfile.open(QFile::WriteOnly)) { QMessageBox::warning(this, tr("File"), tr("Cannot write file %1:\n%2.") @@ -172,15 +181,8 @@ void FileEncryptionDialog::executeAction() QDataStream out(&outfile); out.writeRawData(outBuffer->data(), outBuffer->length()); - - 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()); - } + QMessageBox::information(0, "Done", "Output saved to " + outputFileEdit->text()); + accept(); } void FileEncryptionDialog::showKeyList() |