aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-08-21 22:27:56 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-08-21 22:27:56 +0000
commit4fbaa10c0928d6215dd29fbad836b89f70d539a1 (patch)
tree9b88c512e119d1de1cecc7a14bd4f0adfb690bd6
parentchanged verifylabellist back to one verifylabel and updated TODO (diff)
downloadgpg4usb-4fbaa10c0928d6215dd29fbad836b89f70d539a1.tar.gz
gpg4usb-4fbaa10c0928d6215dd29fbad836b89f70d539a1.zip
added copy mailaddress to clipboard in keylist
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@517 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--TODO5
-rw-r--r--gpgwin.cpp55
-rw-r--r--gpgwin.h2
-rw-r--r--main.cpp1
-rw-r--r--verifynotification.cpp14
-rw-r--r--verifynotification.h8
6 files changed, 57 insertions, 28 deletions
diff --git a/TODO b/TODO
index e6e9597..906bc02 100644
--- a/TODO
+++ b/TODO
@@ -2,7 +2,7 @@ TODO:
-----
Release 0.3.1
- export key: default filename to <keyowner-name>.asc
-- make email adress from keylist copyable
+- make email adress from keylist copyable [DONE]
- show keydetails-dialog in keylist on mainwindow [DONE]
- key should blink short in keylist after import
- show keys which verified message in different colour
@@ -11,8 +11,9 @@ Release 0.3.1
- set gpgme error language to chosen language (context.cpp:49)
- in verifycation dialog import multiple keys
- inform user about verification errors
-- enum for verify status
+- enum for verify status [DONE]
- put sign/verify to toolbar and add shortcuts
+- umlaute are not handled correctly in signing
BUGS:
- Sometimes two or more stars are shown at modified documents
diff --git a/gpgwin.cpp b/gpgwin.cpp
index 923d2ab..7052639 100644
--- a/gpgwin.cpp
+++ b/gpgwin.cpp
@@ -57,6 +57,7 @@ GpgWin::GpgWin()
createDockWindows();
mKeyList->addMenuAction(appendSelectedKeysAct);
+ mKeyList->addMenuAction(copyMailAddressToClipboardAct);
mKeyList->addMenuAction(showKeyDetailsAct);
restoreSettings();
@@ -310,6 +311,10 @@ void GpgWin::createActions()
appendSelectedKeysAct->setToolTip(tr("Append The Selected Keys To Text in Editor"));
connect(appendSelectedKeysAct, SIGNAL(triggered()), this, SLOT(appendSelectedKeys()));
+ copyMailAddressToClipboardAct = new QAction(tr("Copy EMail-address"), this);
+ copyMailAddressToClipboardAct->setToolTip(tr("Copy selected EMailaddress to clipboard"));
+ connect(copyMailAddressToClipboardAct, SIGNAL(triggered()), this, SLOT(copyMailAddressToClipboard()));
+
// TODO: find central place for shared actions, to avoid code-duplication with keymgmt.cpp
showKeyDetailsAct = new QAction(tr("Show Keydetails"), this);
showKeyDetailsAct->setToolTip(tr("Show Details for this Key"));
@@ -598,7 +603,6 @@ void GpgWin::parseMime(QByteArray *message)
showmadock = true;
}
}
-
*message = pText.toUtf8();
if (showmadock) {
aDock->show();
@@ -676,7 +680,6 @@ void GpgWin::importKeyFromFile()
}
}
-
void GpgWin::openKeyManagement()
{
if (!keyMgmt) {
@@ -726,8 +729,8 @@ int GpgWin::isSigned(const QByteArray &text) {
void GpgWin::verify()
{
- QString status="ok";
-
+ QDateTime timestamp;
+ verify_label_status verifyStatus=VERIFY_ERROR_OK;
QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here?
preventNoDataErr(&text);
QString *verifyDetailText = new QString();
@@ -747,45 +750,45 @@ void GpgWin::verify()
{
case 2: verifyLabelText=tr("Text is completly signed by the following key(s): ");
verifyDetailText->append(tr("Text is completly signed by the following key(s): ")+" \n\n");
- break;
+ break;
case 1: verifyLabelText=tr("Text is partially signed by the following key(s): ");
verifyDetailText->append(tr("Text is partially signed by the following key(s): ")+" \n\n");
- break;
+ break;
}
bool unknownKeyFound=false;
while (sign) {
- verifyDetailText->append(tr("Fingerprint: ")+QString(sign->fpr)+"\n");
+ timestamp.setTime_t(sign->timestamp);
if (gpg_err_code(sign->status) == 9) {
- status="warning";
+ verifyStatus=VERIFY_ERROR_WARN;
verifyLabelText.append(tr("Key not present with Fingerprint: ")+QString(sign->fpr));
*vn->keysNotInList << sign->fpr;
vn->setProperty("keyNotFound", true);
unknownKeyFound=true;
- verifyDetailText->append(tr("Signature status: "));
- verifyDetailText->append(gpg_strerror(sign->status));
- verifyDetailText->append("\nsig validity reason: "+QString(gpgme_strerror(sign->validity_reason))+"\n");
+ verifyDetailText->append(tr("Key not present:"));
+ //verifyDetailText->append(tr("Signature status: ")+gpg_strerror(sign->status)+"\nsig validity reason: "+QString(gpgme_strerror(sign->validity_reason))+"\n");
} else {
QString name = mKeyList->getKeyNameByFpr(sign->fpr);
- QString email = "<"+mKeyList->getKeyEmailByFpr(sign->fpr)+">";
- if ( email == "<>" ) {
- email="";
+ QString email =mKeyList->getKeyEmailByFpr(sign->fpr);
+ qDebug() << email;
+ verifyDetailText->append(tr("Name: ")+name+"\n"+tr("EMail: ")+email);
+ verifyLabelText.append(name);
+ if (!email.isEmpty()) {
+ verifyLabelText.append("<"+email+">");
}
- verifyDetailText->append(tr("Name: ")+name+"\n");
- verifyDetailText->append(tr("EMail: ")+email);
-
- verifyLabelText.append(name+email);
vn->setProperty("keyFound", true);
}
+ verifyDetailText->append(tr("\nFingerprint: ")+QString(sign->fpr)+"\n\n");
verifyLabelText.append("\n");
- verifyDetailText->append("\n\n");
qDebug() << "sig fingerprint: " << sign->fpr;
qDebug() << "sig status: " << sign->status << " - " << gpg_err_code(sign->status) << " - " << gpg_strerror(sign->status);
qDebug() << "sig validity: " << sign->validity;
qDebug() << "sig validity reason: " << sign->validity_reason << " - " << gpg_err_code(sign->validity_reason) << " - " << gpgme_strerror(sign->validity_reason);
+ qDebug() << "timestamp: " << sign->timestamp;
sign = sign->next;
}
+ verifyDetailText->prepend("Text was signed on: "+timestamp.toString(Qt::SystemLocaleShortDate)+"\n\n");
vn->setVerifyDetailText(*verifyDetailText);
// If an unknown key is found, enable the importfromkeyserveraction
@@ -797,8 +800,7 @@ void GpgWin::verify()
// Remove the last linebreak
verifyLabelText.remove(verifyLabelText.length()-1,1);
-
- vn->setVerifyLabel(verifyLabelText,status);
+ vn->setVerifyLabel(verifyLabelText,verifyStatus);
edit->curPage()->showNotificationWidget(vn, "verifyNotification");
}
@@ -852,6 +854,17 @@ void GpgWin::appendSelectedKeys()
edit->curTextPage()->appendPlainText(*keyArray);
}
+void GpgWin::copyMailAddressToClipboard()
+{
+
+ gpgme_key_t key = mCtx->getKeyDetails(mKeyList->getSelected()->first());
+ QClipboard *cb = QApplication::clipboard();
+ mCtx->importKey(cb->text(QClipboard::Clipboard).toAscii());
+ QString mail = key->uids->email;
+ cb->setText(mail);
+ //edit->curTextPage()->appendPlainText(*keyArray);
+}
+
void GpgWin::showKeyDetails()
{
// TODO: first...?
diff --git a/gpgwin.h b/gpgwin.h
index f09b332..ea90907 100644
--- a/gpgwin.h
+++ b/gpgwin.h
@@ -77,6 +77,7 @@ public slots:
void importKeyDialog();
//void deleteSelectedKeys();
void appendSelectedKeys();
+ void copyMailAddressToClipboard();
void showKeyDetails();
void openKeyManagement();
void about();
@@ -136,6 +137,7 @@ private:
QAction *cleanDoubleLinebreaksAct;
QAction *appendSelectedKeysAct;
+ QAction *copyMailAddressToClipboardAct;
QAction *showKeyDetailsAct;
QAction *openKeyManagementAct;
QAction *copyAct;
diff --git a/main.cpp b/main.cpp
index 5965d83..eaf852a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -68,7 +68,6 @@ int main(int argc, char *argv[])
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(styleSheet);
- qDebug() << "css: " << styleSheet;
GpgWin *window = new GpgWin();
window->show();
diff --git a/verifynotification.cpp b/verifynotification.cpp
index 67efe89..2b650fb 100644
--- a/verifynotification.cpp
+++ b/verifynotification.cpp
@@ -29,7 +29,6 @@ VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) :
notificationWidgetLayout->addWidget(detailsButton);
this->setLayout(notificationWidgetLayout);
-
}
void VerifyNotification::setVerifyDetailText (QString text)
@@ -47,10 +46,19 @@ void VerifyNotification::importFromKeyserver()
}
}
-void VerifyNotification::setVerifyLabel(QString text, QString status)
+void VerifyNotification::setVerifyLabel(QString text, verify_label_status verifyLabelStatus)
{
verifyLabel->setText(text);
- verifyLabel->setObjectName(status);
+ switch (verifyLabelStatus) {
+ case VERIFY_ERROR_OK: verifyLabel->setObjectName("ok");
+ break;
+ case VERIFY_ERROR_WARN: verifyLabel->setObjectName("warning");
+ break;
+ case VERIFY_ERROR_CRITICAL: verifyLabel->setObjectName("critical");
+ break;
+ default:
+ break;
+ }
return;
}
diff --git a/verifynotification.h b/verifynotification.h
index 289ccbb..37adfcf 100644
--- a/verifynotification.h
+++ b/verifynotification.h
@@ -12,6 +12,12 @@
#include "context.h"
#include <gpgme.h>
+typedef enum
+{
+ VERIFY_ERROR_OK = 0,
+ VERIFY_ERROR_WARN = 1,
+ VERIFY_ERROR_CRITICAL = 2,
+} verify_label_status;
class VerifyNotification : public QWidget
{
@@ -26,7 +32,7 @@ public:
* Return Values: none
* Change on members: none
*/
- void setVerifyLabel(QString text, QString status);
+ void setVerifyLabel(QString text, verify_label_status verifyLabelStatus);
/****************************************************************************************
* Name: showImportAction
* Description: show the action in detailsmenu