aboutsummaryrefslogtreecommitdiffstats
path: root/mainwindow.cpp
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-08-03 20:38:27 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-08-03 20:38:27 +0000
commita274da36798b7aa7a7cbc9e85ec30748fa66047e (patch)
treeb5f4e5403ecae4a86a28f8e58925c2a2f1e01db0 /mainwindow.cpp
parentreorganize kgpg source tree (diff)
downloadgpg4usb-a274da36798b7aa7a7cbc9e85ec30748fa66047e.tar.gz
gpg4usb-a274da36798b7aa7a7cbc9e85ec30748fa66047e.zip
start porting encrypt from kgpg, not yet working
git-svn-id: http://cpunk.de/svn/src/gpg4usb/branches/0.3.2-mac@932 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r--mainwindow.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 024fb35..6f9efc2 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -775,10 +775,35 @@ void MainWindow::encrypt()
QStringList *uidList = mKeyList->getChecked();
QByteArray *tmp = new QByteArray();
- if (mCtx->encrypt(uidList, edit->curTextPage()->toPlainText().toUtf8(), tmp)) {
+ /*if (mCtx->encrypt(uidList, edit->curTextPage()->toPlainText().toUtf8(), tmp)) {
QString *tmp2 = new QString(*tmp);
edit->fillTextEditWithText(*tmp2);
+ }*/
+
+ QStringList options;
+ KGpgEncrypt::EncryptOptions opts = KGpgEncrypt::DefaultEncryption;
+
+ KGpgEncrypt *encr = new KGpgEncrypt(this, *uidList, edit->curTextPage()->toPlainText(), opts, options);
+ encr->start();
+ connect(encr, SIGNAL(done(int)), SLOT(slotEncryptDone(int)));
+}
+
+void MainWindow::slotEncryptDone(int result)
+{
+ KGpgEncrypt *enc = qobject_cast<KGpgEncrypt *>(sender());
+ Q_ASSERT(enc != NULL);
+
+ if (result == KGpgTransaction::TS_OK) {
+ const QString lf = QLatin1String("\n");
+ //setPlainText(enc->encryptedText().join(lf) + lf);
+ edit->fillTextEditWithText(enc->encryptedText().join(lf) + lf);
+ } else {
+ /*KMessageBox::sorry(this, i18n("The encryption failed with error code %1", result),
+ i18n("Encryption failed."));*/
+ qDebug() << "The encryption failed with error code " << result;
}
+
+ sender()->deleteLater();
}
void MainWindow::sign()