diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2009-01-04 00:42:36 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2009-01-04 00:42:36 +0000 |
commit | f43fb4b467c19e94e8c51d78600fd6355edef68e (patch) | |
tree | 0089551ab901a3edf6941418d1550c67050231e4 | |
parent | added expire date in key generation (diff) | |
download | gpg4usb-f43fb4b467c19e94e8c51d78600fd6355edef68e.tar.gz gpg4usb-f43fb4b467c19e94e8c51d78600fd6355edef68e.zip |
added file en-/decryption dialog
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@204 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to '')
-rw-r--r-- | context.cpp | 23 | ||||
-rw-r--r-- | gpg4usb.pro | 4 | ||||
-rw-r--r-- | gpgwin.cpp | 19 | ||||
-rw-r--r-- | gpgwin.h | 6 | ||||
-rw-r--r-- | release/keydb/pubring.gpg | bin | 1164 -> 2091 bytes |
5 files changed, 39 insertions, 13 deletions
diff --git a/context.cpp b/context.cpp index cf20073..846cf36 100644 --- a/context.cpp +++ b/context.cpp @@ -352,7 +352,7 @@ gpgme_error_t Context::passphrase(const char *uid_hint, const char * /*passphrase_info*/, int last_was_bad, int fd) { - gpgme_error_t res = GPG_ERR_CANCELED; + gpgme_error_t returnValue = GPG_ERR_CANCELED; QString s; QString gpg_hint = uid_hint; bool result; @@ -374,27 +374,34 @@ gpgme_error_t Context::passphrase(const char *uid_hint, s, QLineEdit::Password, "", &result); - if (result == 1) m_cache = password.toAscii(); + if (result) m_cache = password.toAscii(); } else - result = 0; + result = false; + + if (result) { - if (result == 1) { #ifndef _WIN32 - write(fd, m_cache.data(), m_cache.length()); + if( write(fd, m_cache.data(), m_cache.length()) == -1) { + qDebug() << "something is terribly broken"; + } #else DWORD written; WriteFile((HANDLE) fd, m_cache.data(), m_cache.length(), &written, 0); #endif - res = 0; + + returnValue = 0; } + #ifndef _WIN32 - write(fd, "\n", 1); + if( write(fd, "\n", 1) == -1 ) { + qDebug() << "something is terribly broken"; + } #else DWORD written; WriteFile((HANDLE) fd, "\n", 1, &written, 0); #endif - return res; + return returnValue; } /** also from kgpgme.cpp, seems to clear password from mem */ diff --git a/gpg4usb.pro b/gpg4usb.pro index ce24e7d..83c46e8 100644 --- a/gpg4usb.pro +++ b/gpg4usb.pro @@ -11,8 +11,8 @@ DEPENDPATH += . INCLUDEPATH += . # Input -HEADERS += context.h gpgwin.h keylist.h attachments.h keymgmt.h -SOURCES += context.cpp gpgwin.cpp main.cpp keylist.cpp attachments.cpp keymgmt.cpp +HEADERS += context.h gpgwin.h keylist.h attachments.h keymgmt.h fileencryptiondialog.h +SOURCES += context.cpp gpgwin.cpp main.cpp keylist.cpp attachments.cpp keymgmt.cpp fileencryptiondialog.cpp RC_FILE = gpg4usb.rc # For Static build on Linux: uncomment line below #LIBS += lib/libgpgme.a -static-libgcc -Llib @@ -20,6 +20,7 @@ */ #include "gpgwin.h" +#include "fileencryptiondialog.h" GpgWin::GpgWin() { @@ -132,6 +133,13 @@ void GpgWin::createActions() decryptAct->setToolTip(tr("Decrypt Message")); connect(decryptAct, SIGNAL(triggered()), this, SLOT(decrypt())); + fileEncryptionAct = new QAction(tr("&File Encryption"), this); + fileEncryptionAct->setIcon(QIcon(iconPath + "fileencrytion.png")); + fileEncryptionAct->setToolTip(tr("Encrypt/Decrypt File")); + connect(fileEncryptionAct, SIGNAL(triggered()), this, SLOT(fileEncryption())); + + /** Key Menu + */ importKeyFromFileAct = new QAction(tr("&File"), this); importKeyFromFileAct->setIcon(QIcon(iconPath + "misc_doc.png")); importKeyFromFileAct->setToolTip(tr("Import New Key From File")); @@ -148,7 +156,7 @@ void GpgWin::createActions() connect(importKeyFromClipboardAct, SIGNAL(triggered()), this, SLOT(importKeyFromClipboard())); openKeyManagementAct = new QAction(tr("Key Management"), this); - openKeyManagementAct->setIcon(QIcon(iconPath + "importkey_editor.png")); + openKeyManagementAct->setIcon(QIcon(iconPath + "keymgmt.png")); openKeyManagementAct->setToolTip(tr("Open Keymanagement")); connect(openKeyManagementAct, SIGNAL(triggered()), this, SLOT(openKeyManagement())); @@ -195,6 +203,7 @@ void GpgWin::createMenus() cryptMenu->addAction(encryptAct); cryptMenu->addAction(decryptAct); cryptMenu->addSeparator(); + cryptMenu->addAction(fileEncryptionAct); keyMenu = menuBar()->addMenu(tr("&Keys")); importKeyMenu = keyMenu->addMenu(tr("&Import Key From...")); @@ -212,6 +221,7 @@ void GpgWin::createToolBars() cryptToolBar = addToolBar(tr("Crypt")); cryptToolBar->addAction(encryptAct); cryptToolBar->addAction(decryptAct); + cryptToolBar->addAction(fileEncryptionAct); keyToolBar = addToolBar(tr("Key")); keyToolBar->addAction(importKeyDialogAct); @@ -513,3 +523,10 @@ void GpgWin::appendSelectedKeys() mCtx->exportKeys(mKeyList->getSelected(), keyArray); edit->appendPlainText(*keyArray); } + + +void GpgWin::fileEncryption() { + + new FileEncryptionDialog(mCtx, iconPath); + +} @@ -71,7 +71,8 @@ public slots: bool save(); bool saveAs(); void open(); - + void fileEncryption(); + private: void createActions(); void createMenus(); @@ -116,7 +117,8 @@ private: QAction *pasteAct; QAction *selectallAct; QAction *aboutAct; - + QAction *fileEncryptionAct; + QLineEdit *nameEdit; QLineEdit *emailEdit; QLineEdit *commentEdit; diff --git a/release/keydb/pubring.gpg b/release/keydb/pubring.gpg Binary files differindex c71d827..bf07f2f 100644 --- a/release/keydb/pubring.gpg +++ b/release/keydb/pubring.gpg |