aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2010-01-13 23:55:04 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2010-01-13 23:55:04 +0000
commit8de2c952ca87ec5d249d9ebdccd6c75972424f82 (patch)
treea86b802b799ea5974d900df02d78cb858e9ba621
parentupdated todo (diff)
downloadgpg4usb-8de2c952ca87ec5d249d9ebdccd6c75972424f82.tar.gz
gpg4usb-8de2c952ca87ec5d249d9ebdccd6c75972424f82.zip
start on keydetailsdialog
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@242 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--context.cpp21
-rw-r--r--context.h1
-rw-r--r--gpg4usb.pro4
-rw-r--r--gpgwin.cpp2
-rw-r--r--keydetailsdialog.cpp35
-rw-r--r--keydetailsdialog.h32
-rwxr-xr-xkeymgmt.cpp13
-rwxr-xr-xkeymgmt.h3
8 files changed, 108 insertions, 3 deletions
diff --git a/context.cpp b/context.cpp
index 1d32000..af3df86 100644
--- a/context.cpp
+++ b/context.cpp
@@ -48,6 +48,7 @@ Context::Context()
setlocale(LC_ALL, "");
/** set locale, because tests do also */
gpgme_set_locale(NULL, LC_CTYPE, setlocale(LC_CTYPE, NULL));
+ //qDebug() << "Locale set to" << LC_CTYPE << " - " << setlocale(LC_CTYPE, NULL);
#ifndef _WIN32
gpgme_set_locale(NULL, LC_MESSAGES, setlocale(LC_MESSAGES, NULL));
#endif
@@ -148,6 +149,26 @@ bool Context::exportKeys(QList<QString> *uidList, QByteArray *outBuffer)
return true;
}
+gpgme_key_t Context::getKeyDetails(QString uid)
+{
+ gpgme_error_t err;
+ gpgme_key_t key;
+
+ /*gpgme_op_keylist_start (mCctx, uid.toAscii().constData(), 0);
+ gpgme_op_keylist_next (mCtx, &key);
+ qDebug() << key->subkeys->keyid);
+ if (key->uids && key->uids->name)
+ qDebug() << key->uids->name;
+ if (key->uids && key->uids->email)
+ qDebug() << key->uids->email;
+ gpgme_key_release (key);*/
+ gpgme_get_key (mCtx, uid.toAscii().constData(), &key, 1);
+
+
+ return key;
+
+}
+
/** List all availabe Keys (VERY much like kgpgme)
*/
GpgKeyList Context::listKeys()
diff --git a/context.h b/context.h
index c3397e4..7cc4439 100644
--- a/context.h
+++ b/context.h
@@ -69,6 +69,7 @@ public:
bool decrypt(const QByteArray &inBuffer, QByteArray *outBuffer);
void clearCache();
void exportSecretKey(QString uid, QByteArray *outBuffer);
+ gpgme_key_t getKeyDetails(QString uid);
signals:
void keyDBChanged();
diff --git a/gpg4usb.pro b/gpg4usb.pro
index c39c91e..7148e53 100644
--- a/gpg4usb.pro
+++ b/gpg4usb.pro
@@ -12,8 +12,8 @@ INCLUDEPATH += . ./include
CONFIG += release static
# Input
-HEADERS += context.h gpgwin.h keylist.h keymgmt.h fileencryptiondialog.h keygenthread.h
-SOURCES += context.cpp gpgwin.cpp main.cpp keylist.cpp keymgmt.cpp fileencryptiondialog.cpp keygenthread.cpp
+HEADERS += context.h gpgwin.h keylist.h keymgmt.h fileencryptiondialog.h keygenthread.h keydetailsdialog.h
+SOURCES += context.cpp gpgwin.cpp main.cpp keylist.cpp keymgmt.cpp fileencryptiondialog.cpp keygenthread.cpp keydetailsdialog.cpp
RC_FILE = gpg4usb.rc
# comment out line below for static building
LIBS += -lgpgme -lgpg-error
diff --git a/gpgwin.cpp b/gpgwin.cpp
index f2fe931..fb38edc 100644
--- a/gpgwin.cpp
+++ b/gpgwin.cpp
@@ -400,7 +400,7 @@ void GpgWin::about()
void GpgWin::encrypt()
{
QList<QString> *uidList = mKeyList->getChecked();
-
+
QByteArray *tmp = new QByteArray();
if (mCtx->encrypt(uidList, edit->toPlainText().toUtf8(), tmp)) {
QString *tmp2 = new QString(*tmp);
diff --git a/keydetailsdialog.cpp b/keydetailsdialog.cpp
new file mode 100644
index 0000000..a29f38b
--- /dev/null
+++ b/keydetailsdialog.cpp
@@ -0,0 +1,35 @@
+/*
+ * keydetailsdialog.cpp
+ *
+ * Copyright 2008 gpg4usb-team <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include "keydetailsdialog.h"
+#include "QDebug"
+
+KeyDetailsDialog::KeyDetailsDialog(gpgme_key_t key) {
+
+ setWindowTitle(tr("Encrypt / Decrypt File"));
+ resize(500, 200);
+ setModal(true);
+
+ if (key->uids && key->uids->name)
+ qDebug() << key->uids->name;
+
+ exec();
+}
diff --git a/keydetailsdialog.h b/keydetailsdialog.h
new file mode 100644
index 0000000..9233620
--- /dev/null
+++ b/keydetailsdialog.h
@@ -0,0 +1,32 @@
+/*
+ * keydetailsdialog.h
+ *
+ * Copyright 2008 gpg4usb-team <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include <QDialog>
+#include <gpgme.h>
+
+class KeyDetailsDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ KeyDetailsDialog(gpgme_key_t key);
+
+};
diff --git a/keymgmt.cpp b/keymgmt.cpp
index 227cff5..82b5e63 100755
--- a/keymgmt.cpp
+++ b/keymgmt.cpp
@@ -44,6 +44,7 @@ KeyMgmt::KeyMgmt(GpgME::Context *ctx, QString iconpath)
setWindowTitle(tr("Keymanagement"));
mKeyList->addMenuAction(deleteSelectedKeysAct);
+ mKeyList->addMenuAction(showKeyDetailsAct);
}
void KeyMgmt::createActions()
@@ -87,6 +88,10 @@ void KeyMgmt::createActions()
generateKeyDialogAct->setToolTip(tr("Generate New Key"));
generateKeyDialogAct->setIcon(QIcon(mIconPath + "key_generate.png"));
connect(generateKeyDialogAct, SIGNAL(triggered()), this, SLOT(generateKeyDialog()));
+
+ showKeyDetailsAct = new QAction(tr("Show Keydetails"), this);
+ showKeyDetailsAct->setToolTip(tr("Show Details for this Key"));
+ connect(showKeyDetailsAct, SIGNAL(triggered()), this, SLOT(showKeyDetails()));
}
void KeyMgmt::createMenus()
@@ -149,6 +154,14 @@ void KeyMgmt::deleteCheckedKeys()
mCtx->deleteKeys(mKeyList->getChecked());
}
+void KeyMgmt::showKeyDetails()
+{
+ qDebug() << mKeyList->getSelected();
+ // TODO: first...?
+ gpgme_key_t key = mCtx->getKeyDetails(mKeyList->getSelected()->first());
+ new KeyDetailsDialog(key);
+}
+
void KeyMgmt::exportKeyToFile()
{
QByteArray *keyArray = new QByteArray();
diff --git a/keymgmt.h b/keymgmt.h
index 70ea8ff..b878179 100755
--- a/keymgmt.h
+++ b/keymgmt.h
@@ -39,6 +39,7 @@ class QSlider;
#include "context.h"
#include "keylist.h"
#include "keygenthread.h"
+#include "keydetailsdialog.h"
class KeyMgmt : public QMainWindow
{
@@ -57,6 +58,7 @@ public slots:
void generateKeyDialog();
void expireBoxChanged();
void passwordEditChanged();
+ void showKeyDetails();
private slots:
void keyGenAccept();
@@ -83,6 +85,7 @@ private:
QAction *deleteSelectedKeysAct;
QAction *generateKeyDialogAct;
QAction *closeAct;
+ QAction *showKeyDetailsAct;
KeyGenThread *keyGenThread;
QMessageBox msgbox;
/**