aboutsummaryrefslogtreecommitdiffstats
path: root/attachments.cpp
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2009-09-19 15:50:33 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2009-09-19 15:50:33 +0000
commita68b9055347759ba71db77559047c44db02e8f46 (patch)
treef96a063617f24ddd3c568e89206cf17ebc24a474 /attachments.cpp
parentnew version number and smaller changes (diff)
downloadgpg4usb-a68b9055347759ba71db77559047c44db02e8f46.tar.gz
gpg4usb-a68b9055347759ba71db77559047c44db02e8f46.zip
cosmetic changes(indention)
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@217 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'attachments.cpp')
-rw-r--r--attachments.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/attachments.cpp b/attachments.cpp
index 5f78eec..57ca8b9 100644
--- a/attachments.cpp
+++ b/attachments.cpp
@@ -82,7 +82,7 @@ void Attachments::addFile()
QStringList fileNames;
if (dialog.exec())
- fileNames = dialog.selectedFiles();
+ fileNames = dialog.selectedFiles();
//foreach(QString tmp, fileNames) qDebug() << tmp;
m_attachmentList->addItems(fileNames);
@@ -108,64 +108,64 @@ void Attachments::encryptFile()
//qDebug() << "buffsize: " << inBuffer.size();
if (m_ctx->encrypt(uidList, inBuffer, outBuffer)) {
- //qDebug() << "inb: " << inBuffer.toHex();
- //qDebug() << "outb: " << outBuffer->data();
- QString outFilename = QFileDialog::getSaveFileName(this);
- if (outFilename.isEmpty()) {
+ //qDebug() << "inb: " << inBuffer.toHex();
+ //qDebug() << "outb: " << outBuffer->data();
+ QString outFilename = QFileDialog::getSaveFileName(this);
+ if (outFilename.isEmpty()) {
+ qDebug() << "need Filename";
+ return;
+ }
+
+ QFile outfile(outFilename);
+ if (!outfile.open(QFile::WriteOnly)) {
+ QMessageBox::warning(this, tr("File"),
+ tr("Cannot write file %1:\n%2.")
+ .arg(outFilename)
+ .arg(outfile.errorString()));
+ return;
+ }
+
+ QTextStream out(&outfile);
+ out << outBuffer->data();
+ }
+ }
+}
+
+void Attachments::decryptFile()
+{
+ qDebug() << "dec";
+ foreach(QString inFilename, *(getSelected())) {
+ qDebug() << inFilename;
+
+ QFile infile;
+ infile.setFileName(inFilename);
+ if (!infile.open(QIODevice::ReadOnly)) {
+ qDebug() << tr("couldn't open file: ") + inFilename;
+ }
+
+ QByteArray inBuffer = infile.readAll();
+ QByteArray *outBuffer = new QByteArray();
+ m_ctx->decrypt(inBuffer, outBuffer);
+
+ QString outFilename = QFileDialog::getSaveFileName(this);
+ if (outFilename.isEmpty()) {
qDebug() << "need Filename";
return;
- }
+ }
- QFile outfile(outFilename);
- if (!outfile.open(QFile::WriteOnly)) {
+ QFile outfile(outFilename);
+ if (!outfile.open(QFile::WriteOnly)) {
QMessageBox::warning(this, tr("File"),
tr("Cannot write file %1:\n%2.")
.arg(outFilename)
.arg(outfile.errorString()));
return;
- }
-
- QTextStream out(&outfile);
- out << outBuffer->data();
}
- }
-}
-void Attachments::decryptFile()
-{
- qDebug() << "dec";
- foreach(QString inFilename, *(getSelected())){
- qDebug() << inFilename;
-
- QFile infile;
- infile.setFileName(inFilename);
- if (!infile.open(QIODevice::ReadOnly)) {
- qDebug() << tr("couldn't open file: ") + inFilename;
- }
-
- QByteArray inBuffer = infile.readAll();
- QByteArray *outBuffer = new QByteArray();
- m_ctx->decrypt(inBuffer, outBuffer);
-
- QString outFilename = QFileDialog::getSaveFileName(this);
- if (outFilename.isEmpty()) {
- qDebug() << "need Filename";
- return;
- }
-
- QFile outfile(outFilename);
- if (!outfile.open(QFile::WriteOnly)) {
- QMessageBox::warning(this, tr("File"),
- tr("Cannot write file %1:\n%2.")
- .arg(outFilename)
- .arg(outfile.errorString()));
- return;
- }
-
- QDataStream out(&outfile);
- //out << outBuffer;
- out.writeRawData(outBuffer->data(), outBuffer->length());
- //qDebug() << "outb: " << outBuffer->toHex();
+ QDataStream out(&outfile);
+ //out << outBuffer;
+ out.writeRawData(outBuffer->data(), outBuffer->length());
+ //qDebug() << "outb: " << outBuffer->toHex();
}