diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-10-11 20:29:14 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-10-11 20:29:14 +0000 |
commit | 7df096cffe4806fbc1e13fbcc3170933876a115a (patch) | |
tree | eaeef8024c6466f28a350460f2890a19880e916b /gpgwin.cpp | |
parent | some commenting (diff) | |
download | gpg4usb-7df096cffe4806fbc1e13fbcc3170933876a115a.tar.gz gpg4usb-7df096cffe4806fbc1e13fbcc3170933876a115a.zip |
moved preventnodataerr to context.cpp, added refresh slots for verify
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@544 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'gpgwin.cpp')
-rw-r--r-- | gpgwin.cpp | 37 |
1 files changed, 10 insertions, 27 deletions
@@ -419,12 +419,12 @@ void GpgWin::createDockWindows() { /* KeyList-Dockwindow */ - encryptDock = new QDockWidget(tr("Encrypt for:"), this); - encryptDock->setObjectName("EncryptDock"); - encryptDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - addDockWidget(Qt::RightDockWidgetArea, encryptDock); - encryptDock->setWidget(mKeyList); - viewMenu->addAction(encryptDock->toggleViewAction()); + keylistDock = new QDockWidget(tr("Encrypt for:"), this); + keylistDock->setObjectName("EncryptDock"); + keylistDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + addDockWidget(Qt::RightDockWidgetArea, keylistDock); + keylistDock->setWidget(mKeyList); + viewMenu->addAction(keylistDock->toggleViewAction()); /* Attachments-Dockwindow */ @@ -564,23 +564,6 @@ void GpgWin::checkAttachmentFolder() { } } -/* - * if there is no '\n' before the PGP-Begin-Block, but for example a whitespace, - * GPGME doesn't recognise the Message as encrypted. This function adds '\n' - * before the PGP-Begin-Block, if missing. - */ -void GpgWin::preventNoDataErr(QByteArray *in) -{ - int block_start = in->indexOf("-----BEGIN PGP MESSAGE-----"); - if (block_start > 0 && in->at(block_start - 1) != '\n') { - in->insert(block_start, '\n'); - } - block_start = in->indexOf("-----BEGIN PGP SIGNED MESSAGE-----"); - if (block_start > 0 && in->at(block_start - 1) != '\n') { - in->insert(block_start, '\n'); - } -} - void GpgWin::importKeyFromEdit() { mCtx->importKey(edit->curTextPage()->toPlainText().toAscii()); @@ -620,7 +603,7 @@ void GpgWin::decrypt() { QByteArray *decrypted = new QByteArray(); QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here? - preventNoDataErr(&text); + mCtx->preventNoDataErr(&text); // try decrypt, if fail do nothing, especially don't replace text if(!mCtx->decrypt(text, decrypted)) { @@ -672,7 +655,7 @@ void GpgWin::verify() QDateTime timestamp; verify_label_status verifyStatus=VERIFY_ERROR_OK; QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here? - preventNoDataErr(&text); + mCtx->preventNoDataErr(&text); int textIsSigned = isSigned(text); gpgme_signature_t sign = mCtx->verify(text); @@ -809,7 +792,6 @@ void GpgWin::showKeyDetails() new KeyDetailsDialog(mCtx, key, this); } - void GpgWin::fileEncryption() { QStringList *keyList; @@ -829,7 +811,8 @@ void GpgWin::openSettingsDialog() this->setToolButtonStyle(buttonStyle); } -void GpgWin::cleanDoubleLinebreaks() { +void GpgWin::cleanDoubleLinebreaks() +{ QString content = edit->curTextPage()->toPlainText(); content.replace("\n\n", "\n"); edit->fillTextEditWithText(content); |