summaryrefslogtreecommitdiffstats
path: root/certmanager/lib
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /certmanager/lib
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz
tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip
* Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch
* Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'certmanager/lib')
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp16
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp5
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp8
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp1
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp4
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp5
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp4
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp8
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmejob.cpp16
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmejob.h7
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp5
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp16
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h1
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp4
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp5
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp4
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp5
-rw-r--r--certmanager/lib/kleo/job.cpp14
-rw-r--r--certmanager/lib/kleo/job.h6
-rw-r--r--certmanager/lib/libkleopatrarc.desktop9
-rw-r--r--certmanager/lib/tests/test_verify.cpp1
-rw-r--r--certmanager/lib/ui/cryptoconfigdialog.cpp6
-rw-r--r--certmanager/lib/ui/cryptoconfigmodule.cpp30
-rw-r--r--certmanager/lib/ui/cryptoconfigmodule.h2
-rw-r--r--certmanager/lib/ui/keyselectiondialog.cpp57
-rw-r--r--certmanager/lib/ui/keyselectiondialog.h15
-rw-r--r--certmanager/lib/ui/messagebox.cpp69
-rw-r--r--certmanager/lib/ui/messagebox.h3
28 files changed, 279 insertions, 47 deletions
diff --git a/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp b/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp
index c67800502..ae45d6833 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp
@@ -447,6 +447,13 @@ TQVariant QGpgMECryptoConfigEntry::stringToValue( const TQString& str, bool unes
bool isString = isStringType();
if ( isList() ) {
+ if ( argType() == ArgType_None ) {
+ bool ok = true;
+ const TQVariant v = str.isEmpty() ? 0U : str.toUInt( &ok ) ;
+ if ( !ok )
+ kdWarning(5150) << "list-of-none should have an unsigned int as value:" << str << endl;
+ return v;
+ }
TQValueList<TQVariant> lst;
TQStringList items = TQStringList::split( ',', str );
for( TQStringList::const_iterator valit = items.begin(); valit != items.end(); ++valit ) {
@@ -657,7 +664,10 @@ void QGpgMECryptoConfigEntry::resetToDefault()
if ( mFlags & GPGCONF_FLAG_DEFAULT )
mValue = mDefaultValue;
else if ( mArgType == ArgType_None )
- mValue = false;
+ if ( isList() )
+ mValue = 0U;
+ else
+ mValue = false;
}
void QGpgMECryptoConfigEntry::setBoolValue( bool b )
@@ -715,7 +725,9 @@ void QGpgMECryptoConfigEntry::setNumberOfTimesSet( unsigned int i )
{
Q_ASSERT( mArgType == ArgType_None );
Q_ASSERT( isList() );
- setUIntValue( i );
+ mValue = i;
+ mSet = i > 0;
+ mDirty = true;
}
void QGpgMECryptoConfigEntry::setStringValueList( const TQStringList& lst )
diff --git a/certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp
index 692efa322..15d3246fe 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp
@@ -85,7 +85,10 @@ GpgME::DecryptionResult Kleo::QGpgMEDecryptJob::exec( const TQByteArray & cipher
}
void Kleo::QGpgMEDecryptJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->decryptionResult(), mOutDataDataProvider->data() );
+ const GpgME::DecryptionResult res = mCtx->decrypt( *mInData, *mOutData );
+ const TQByteArray plainText = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( res, plainText );
}
#include "qgpgmedecryptjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp
index 68f67d0fd..a14e7e18f 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp
@@ -87,9 +87,11 @@ Kleo::QGpgMEDecryptVerifyJob::exec( const TQByteArray & cipherText, TQByteArray
}
void Kleo::QGpgMEDecryptVerifyJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->decryptionResult(),
- mCtx->verificationResult(),
- mOutDataDataProvider->data() );
+ const GpgME::DecryptionResult dr = mCtx->decryptionResult();
+ const GpgME::VerificationResult vr = mCtx->verificationResult();
+ const TQByteArray plainText = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( dr, vr, plainText );
}
#include "qgpgmedecryptverifyjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp b/certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp
index c06907eea..3665ee668 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp
@@ -64,6 +64,7 @@ GpgME::Error Kleo::QGpgMEDeleteJob::start( const GpgME::Key & key, bool allowSec
}
void Kleo::QGpgMEDeleteJob::doOperationDoneEvent( const GpgME::Error & error ) {
+ getAuditLog();
emit result( error );
}
diff --git a/certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp
index 364e8f9f7..979a85490 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp
@@ -72,7 +72,9 @@ GpgME::Error Kleo::QGpgMEDownloadJob::start( const TQStringList & pats ) {
}
void Kleo::QGpgMEDownloadJob::doOperationDoneEvent( const GpgME::Error & error ) {
- emit result( error, mOutDataDataProvider->data() );
+ const TQByteArray data = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( error, data );
}
#include "qgpgmedownloadjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp
index ddd51717f..a6a380b0b 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp
@@ -97,7 +97,10 @@ GpgME::EncryptionResult Kleo::QGpgMEEncryptJob::exec( const std::vector<GpgME::K
}
void Kleo::QGpgMEEncryptJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mResult = mCtx->encryptionResult(), mOutDataDataProvider->data() );
+ mResult = mCtx->encryptionResult();
+ const TQByteArray ciphertext = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( mResult, ciphertext );
}
void Kleo::QGpgMEEncryptJob::showErrorDialog( TQWidget * parent, const TQString & caption ) const {
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp
index c31074aff..16e5fb773 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp
@@ -72,7 +72,9 @@ GpgME::Error Kleo::QGpgMEExportJob::start( const TQStringList & pats ) {
}
void Kleo::QGpgMEExportJob::doOperationDoneEvent( const GpgME::Error & error ) {
- emit result( error, mOutDataDataProvider->data() );
+ const TQByteArray data = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( error, data );
}
#include "qgpgmeexportjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp
index 7c698e7e7..80792161f 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp
@@ -75,11 +75,15 @@ GpgME::Error Kleo::QGpgMEImportJob::start( const TQByteArray & keyData ) {
GpgME::ImportResult Kleo::QGpgMEImportJob::exec( const TQByteArray & keyData ) {
setup( keyData );
- return mCtx->importKeys( *mInData );
+ const GpgME::ImportResult res = mCtx->importKeys( *mInData );
+ getAuditLog();
+ return res;
}
void Kleo::QGpgMEImportJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->importResult() );
+ const GpgME::ImportResult res = mCtx->importResult();
+ getAuditLog();
+ emit result( res );
}
diff --git a/certmanager/lib/backends/qgpgme/qgpgmejob.cpp b/certmanager/lib/backends/qgpgme/qgpgmejob.cpp
index 72f9f77ff..6d7ae5b45 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmejob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmejob.cpp
@@ -236,21 +236,19 @@ void Kleo::QGpgMEJob::createOutData() {
static const unsigned int GetAuditLogFlags = GpgME::Context::AuditLogWithHelp|GpgME::Context::HtmlAuditLog;
-static TQString audit_log_as_html( GpgME::Context * ctx ) {
- if ( !ctx )
- return TQString();
+static TQString audit_log_as_html( GpgME::Context * ctx, GpgME::Error & err ) {
+ assert( ctx );
QGpgME::QByteArrayDataProvider dp;
GpgME::Data data( &dp );
assert( !data.isNull() );
- if ( const GpgME::Error err = ctx->getAuditLog( data, GetAuditLogFlags ) )
+ if ( ( err = ctx->getAuditLog( data, GetAuditLogFlags ) ) )
return TQString();
- else
- return TQString::fromUtf8( dp.data().data() );
+ const TQByteArray ba = dp.data();
+ return TQString::fromUtf8( ba.data(), ba.size() );
}
void Kleo::QGpgMEJob::doSlotOperationDoneEvent( GpgME::Context * context, const GpgME::Error & e ) {
if ( context == mCtx ) {
- getAuditLog();
doEmitDoneSignal();
doOperationDoneEvent( e );
mThis->deleteLater();
@@ -258,7 +256,9 @@ void Kleo::QGpgMEJob::doSlotOperationDoneEvent( GpgME::Context * context, const
}
void Kleo::QGpgMEJob::getAuditLog() {
- mAuditLogAsHtml = audit_log_as_html( mCtx );
+ if ( !mCtx )
+ return;
+ mAuditLogAsHtml = audit_log_as_html( mCtx, mAuditLogError );
}
void Kleo::QGpgMEJob::doSlotCancel() {
diff --git a/certmanager/lib/backends/qgpgme/qgpgmejob.h b/certmanager/lib/backends/qgpgme/qgpgmejob.h
index 984bed445..0681c165d 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmejob.h
+++ b/certmanager/lib/backends/qgpgme/qgpgmejob.h
@@ -37,6 +37,7 @@
#include <gpgmepp/interfaces/passphraseprovider.h>
#include <gpgmepp/key.h>
+#include <gpgmepp/context.h>
#include <tqcstring.h>
#include <tqstring.h>
@@ -45,8 +46,6 @@
#include <kdepimmacros.h>
namespace GpgME {
- class Error;
- class Context;
class Data;
}
@@ -120,6 +119,7 @@ namespace Kleo {
virtual void doEmitDoneSignal() = 0;
void doSlotCancel();
TQString auditLogAsHtml() const { return mAuditLogAsHtml; }
+ GpgME::Error auditLogError() const { return mAuditLogError; }
private:
/*! \reimp from GpgME::ProgressProvider */
@@ -146,6 +146,7 @@ namespace Kleo {
unsigned int mNumPatterns;
unsigned int mChunkSize;
unsigned int mPatternStartIndex, mPatternEndIndex;
+ GpgME::Error mAuditLogError;
TQString mAuditLogAsHtml;
};
@@ -154,7 +155,7 @@ namespace Kleo {
#define make_slot_cancel private: void slotCancel() { QGpgMEJob::doSlotCancel(); }
#define make_progress_emitter private: void doEmitProgressSignal( const TQString & what, int cur, int tot ) { emit progress( what, cur, tot ); }
#define make_done_emitter private: void doEmitDoneSignal() { emit done(); }
-#define make_auditLogAsHtml private: TQString auditLogAsHtml() const { return QGpgMEJob::auditLogAsHtml(); }
+#define make_auditLogAsHtml private: TQString auditLogAsHtml() const { return QGpgMEJob::auditLogAsHtml(); } GpgME::Error auditLogError() const { return QGpgMEJob::auditLogError(); }
#define QGPGME_JOB make_slot_cancel make_progress_emitter make_done_emitter make_auditLogAsHtml
#endif // __KLEO_QGPGMEJOB_H__
diff --git a/certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp
index b226d6498..16e131348 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp
@@ -80,7 +80,10 @@ GpgME::Error Kleo::QGpgMEKeyGenerationJob::start( const TQString & parameters )
}
void Kleo::QGpgMEKeyGenerationJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->keyGenerationResult(), mPubKeyDataProvider ? mPubKeyDataProvider->data() : TQByteArray() );
+ const GpgME::KeyGenerationResult res = mCtx->keyGenerationResult();
+ const TQByteArray data = mPubKeyDataProvider ? mPubKeyDataProvider->data() : TQByteArray() ;
+ getAuditLog();
+ emit result( res, data );
}
#include "qgpgmekeygenerationjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp
index 9e663e92d..b07135f01 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp
@@ -48,6 +48,7 @@
#include <kdebug.h>
#include <tqstringlist.h>
+#include <tqtimer.h>
#include <algorithm>
@@ -97,6 +98,10 @@ GpgME::Error Kleo::QGpgMEKeyListJob::start( const TQStringList & pats, bool secr
kdDebug(5150) << "QGpgMEKeyListJob::start(): retrying keylisting with chunksize " << chunkSize() << endl;
continue;
}
+ } else if ( err.code() == GPG_ERR_EOF ) {
+ kdDebug(5150) << "QGpgMEKeyListJob::start(): early end of keylisting, trying to fake an empty result" << endl;
+ TQTimer::singleShot( 10, this, TQT_SLOT(slotFakeOperationDoneEvent()) );
+ return GpgME::Error();
}
deleteLater();
mResult = GpgME::KeyListResult( 0, err );
@@ -158,6 +163,17 @@ void Kleo::QGpgMEKeyListJob::slotNextKeyEvent( GpgME::Context * context, const G
emit nextKey( key );
}
+void Kleo::QGpgMEKeyListJob::slotFakeOperationDoneEvent() {
+ const GpgME::KeyListResult res = mCtx->keyListResult();
+ if ( !res.error().code() == GPG_ERR_EOF )
+ kdDebug(5150) << "QGpgMEKeyListJob::slotFakeOperationDoneEvent: expected EOF, got "
+ << res.error().asString() << endl;
+ mResult = GpgME::KeyListResult();
+ emit done();
+ emit result( mResult );
+ deleteLater();
+}
+
void Kleo::QGpgMEKeyListJob::slotOperationDoneEvent( GpgME::Context * context, const GpgME::Error & ) {
if ( context != mCtx )
return;
diff --git a/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h b/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h
index 0bc84c08c..388641076 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h
+++ b/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h
@@ -65,6 +65,7 @@ namespace Kleo {
private slots:
void slotNextKeyEvent( GpgME::Context * context, const GpgME::Key & key );
void slotOperationDoneEvent( GpgME::Context * context, const GpgME::Error & e );
+ void slotFakeOperationDoneEvent();
private:
void doOperationDoneEvent( const GpgME::Error &) {} // unused, we implement slotOperationDoneEvent ourselves.
diff --git a/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp
index bc05eb86c..9a469001c 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp
@@ -109,7 +109,9 @@ Kleo::QGpgMESignEncryptJob::exec( const std::vector<GpgME::Key> & signers,
void Kleo::QGpgMESignEncryptJob::doOperationDoneEvent( const GpgME::Error & ) {
mResult.first = mCtx->signingResult();
mResult.second = mCtx->encryptionResult();
- emit result( mResult.first, mResult.second, mOutDataDataProvider->data() );
+ const TQByteArray cipherText = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( mResult.first, mResult.second, cipherText );
}
void Kleo::QGpgMESignEncryptJob::showErrorDialog( TQWidget * parent, const TQString & caption ) const {
diff --git a/certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp
index 0042d6a38..01ae8a91f 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp
@@ -102,7 +102,10 @@ GpgME::SigningResult Kleo::QGpgMESignJob::exec( const std::vector<GpgME::Key> &
}
void Kleo::QGpgMESignJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mResult = mCtx->signingResult(), mOutDataDataProvider->data() );
+ mResult = mCtx->signingResult();
+ const TQByteArray signature = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( mResult, signature );
}
void Kleo::QGpgMESignJob::showErrorDialog( TQWidget * parent, const TQString & caption ) const {
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp
index b1022f61b..41fa48494 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp
@@ -89,7 +89,9 @@ GpgME::VerificationResult Kleo::QGpgMEVerifyDetachedJob::exec( const TQByteArray
}
void Kleo::QGpgMEVerifyDetachedJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->verificationResult() );
+ const GpgME::VerificationResult res = mCtx->verificationResult();
+ getAuditLog();
+ emit result( res );
}
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp
index 92e1917b7..e4340aa39 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp
@@ -84,7 +84,10 @@ GpgME::VerificationResult Kleo::QGpgMEVerifyOpaqueJob::exec( const TQByteArray &
}
void Kleo::QGpgMEVerifyOpaqueJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->verificationResult(), mOutDataDataProvider->data() );
+ const GpgME::VerificationResult res = mCtx->verificationResult();
+ const TQByteArray plainText = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( res, plainText );
}
diff --git a/certmanager/lib/kleo/job.cpp b/certmanager/lib/kleo/job.cpp
index c5371b646..dedbebfc2 100644
--- a/certmanager/lib/kleo/job.cpp
+++ b/certmanager/lib/kleo/job.cpp
@@ -52,9 +52,13 @@
#include "refreshkeysjob.h"
#include "specialjob.h"
+#include <gpgmepp/context.h>
+
#include <tqapplication.h>
#include <kdebug.h>
+#include <gpg-error.h>
+
Kleo::Job::Job( TQObject * parent, const char * name )
: TQObject( parent, name )
{
@@ -75,6 +79,16 @@ TQString Kleo::Job::auditLogAsHtml() const {
return TQString();
}
+GpgME::Error Kleo::Job::auditLogError() const {
+ kdDebug() << "Kleo::Job::auditLogError() should be reimplemented in Kleo::Job subclasses!" << endl;
+ return GpgME::Error( gpg_error( GPG_ERR_NOT_IMPLEMENTED ) );
+}
+
+bool Kleo::Job::isAuditLogSupported() const {
+ const GpgME::Error err = auditLogError();
+ return err.code() != GPG_ERR_NOT_IMPLEMENTED ;
+}
+
#define make_job_subclass(x) \
Kleo::x::x( TQObject * parent, const char * name ) : Job( parent, name ) {} \
Kleo::x::~x() {}
diff --git a/certmanager/lib/kleo/job.h b/certmanager/lib/kleo/job.h
index 1c091bab3..78ff58ce1 100644
--- a/certmanager/lib/kleo/job.h
+++ b/certmanager/lib/kleo/job.h
@@ -38,6 +38,10 @@
class TQWidget;
+namespace GpgME {
+ class Error;
+}
+
namespace Kleo {
/**
@@ -67,6 +71,8 @@ namespace Kleo {
virtual void showErrorDialog( TQWidget * parent=0, const TQString & caption=TQString::null ) const;
virtual TQString auditLogAsHtml() const;
+ virtual GpgME::Error auditLogError() const;
+ bool isAuditLogSupported() const;
public slots:
virtual void slotCancel() = 0;
diff --git a/certmanager/lib/libkleopatrarc.desktop b/certmanager/lib/libkleopatrarc.desktop
index 3af8feaf0..07af3adcd 100644
--- a/certmanager/lib/libkleopatrarc.desktop
+++ b/certmanager/lib/libkleopatrarc.desktop
@@ -22,7 +22,6 @@ Name[hu]=Nem ellenőrzött kulcs
Name[is]=Ekki staðfestur lykill
Name[it]=Chiave non convalidata
Name[ja]=認証されていない鍵
-Name[ka]=დაუმოწმებელი გასაღები
Name[kk]=Тексерілмеген кілт
Name[km]=កូនសោ​គ្មាន​សុពលភាព
Name[ko]=검증되지 않은 키
@@ -77,7 +76,6 @@ Name[hu]=Lejárt kulcs
Name[is]=Útrunninn lykill
Name[it]=Chiave scaduta
Name[ja]=期限切れの鍵
-Name[ka]=ვადაგასული გასაღები
Name[kk]=Ескірген кілт
Name[km]=កូនសោ​បាន​ផុតកំណត់
Name[ko]=만료된 키
@@ -130,7 +128,6 @@ Name[hu]=Visszavont kulcs
Name[is]=Afturkallaður lykill
Name[it]=Chiave revocata
Name[ja]=破棄された鍵
-Name[ka]=ანულირებული გასაღები
Name[kk]=Күші жойылған кілт
Name[km]=កូនសោ​ត្រូវ​បាន​ដកហូត
Name[ko]=거부된 키
@@ -183,7 +180,6 @@ Name[hu]=Megbízható gyökértanúsítvány
Name[is]=Treyst rótarskilríki
Name[it]=Certificato radice affidabile
Name[ja]=信頼されたルート証明書
-Name[ka]= რუტის სანდო სერთიფიკატი
Name[kk]=Сенім артылған түбір куәлігі
Name[km]=វិញ្ញាបនបត្រ Root ដែល​អាច​ជឿទុកចិត្ត
Name[lt]=Patikimas root sertifikatas
@@ -236,7 +232,6 @@ Name[hu]=Nem megbízható gyökértanúsítvány
Name[is]=Ekki traust rótarskilríki
Name[it]=Certificato radice non affidabile
Name[ja]=信頼されてないルート証明書
-Name[ka]=რუტის არასანდო სერტიფიკატი
Name[kk]=Сенім артылмаған түбір куәлігі
Name[km]=វិញ្ញាបនបត្រ Root ដែល​មិន​អាច​ជឿទុកចិត្ត
Name[lt]=Nepatikimas root sertifikatas
@@ -290,7 +285,6 @@ Name[hu]=Egyéb kulcsok
Name[is]=Aðrir lyklar
Name[it]=Altre chiavi
Name[ja]=他の鍵
-Name[ka]=სხვა გასაღებები
Name[kk]=Басқа кілттер
Name[km]=កូនសោ​ផ្សេង​ទៀត
Name[ko]=기타 키
@@ -316,8 +310,7 @@ Name[sv]=Andra nycklar
Name[ta]=மற்ற விசைகள்
Name[tr]=Diğer Anahtarlar
Name[uk]=Інші ключі
-Name[uz]=Boshqa kalitlar
-Name[uz@cyrillic]=Бошқа калитлар
+Name[uz]=Бошқа калитлар
Name[zh_CN]=其它密钥
Name[zh_TW]=其他金鑰
diff --git a/certmanager/lib/tests/test_verify.cpp b/certmanager/lib/tests/test_verify.cpp
index 54a88b4c2..cb5db396a 100644
--- a/certmanager/lib/tests/test_verify.cpp
+++ b/certmanager/lib/tests/test_verify.cpp
@@ -29,6 +29,7 @@
*/
#include <config.h>
+#include <cstdlib>
#include <kleo/cryptobackendfactory.h>
#include <kleo/verifydetachedjob.h>
diff --git a/certmanager/lib/ui/cryptoconfigdialog.cpp b/certmanager/lib/ui/cryptoconfigdialog.cpp
index 472429942..0d383083b 100644
--- a/certmanager/lib/ui/cryptoconfigdialog.cpp
+++ b/certmanager/lib/ui/cryptoconfigdialog.cpp
@@ -46,6 +46,12 @@ Kleo::CryptoConfigDialog::CryptoConfigDialog( Kleo::CryptoConfig* config, TQWidg
setMainWidget( mMainWidget );
connect( mMainWidget, TQT_SIGNAL( changed() ), TQT_SLOT( slotChanged() ) );
enableButton( Apply, false );
+ if ( mMainWidget->hasError() ) {
+ showButton( Default, false );
+ showButton( User1, false );
+ showButton( Apply, false );
+ showButton( Ok, false );
+ }
// Automatically assign accelerators
KAcceleratorManager::manage( this );
diff --git a/certmanager/lib/ui/cryptoconfigmodule.cpp b/certmanager/lib/ui/cryptoconfigmodule.cpp
index 33e7129c4..5b14d7c41 100644
--- a/certmanager/lib/ui/cryptoconfigmodule.cpp
+++ b/certmanager/lib/ui/cryptoconfigmodule.cpp
@@ -62,8 +62,20 @@ static inline TQPixmap loadIcon( TQString s ) {
->loadIcon( s.replace( TQRegExp( "[^a-zA-Z0-9_]" ), "_" ), KIcon::NoGroup, KIcon::SizeMedium );
}
+static unsigned int num_components_with_options( const Kleo::CryptoConfig * config ) {
+ if ( !config )
+ return 0;
+ const TQStringList components = config->componentList();
+ unsigned int result = 0;
+ for ( TQStringList::const_iterator it = components.begin() ; it != components.end() ; ++it )
+ if ( const Kleo::CryptoConfigComponent * const comp = config->component( *it ) )
+ if ( !comp->groupList().empty() )
+ ++result;
+ return result;
+}
+
static const KJanusWidget::Face determineJanusFace( const Kleo::CryptoConfig * config ) {
- return config && config->componentList().size() < 2
+ return num_components_with_options( config ) < 2
? KJanusWidget::Plain
: KJanusWidget::IconList ;
}
@@ -115,6 +127,22 @@ Kleo::CryptoConfigModule::CryptoConfigModule( Kleo::CryptoConfig* config, TQWidg
+ scrollView->style().pixelMetric(TQStyle::PM_ScrollBarExtent),
QMIN( compGUI->sizeHint().height(), dialogHeight ) );
}
+ if ( mComponentGUIs.empty() ) {
+ Q_ASSERT( face() == Plain );
+ const TQString msg = i18n("The gpgconf tool used to provide the information "
+ "for this dialog does not seem to be installed "
+ "properly. It did not return any components. "
+ "Try running \"%1\" on the command line for more "
+ "information.")
+ .arg( components.empty() ? "gpgconf --list-components" : "gpgconf --list-options gpg" );
+ TQLabel * label = new TQLabel( msg, vbox );
+ label->setAlignment( TQt::WordBreak );
+ label->setMinimumHeight( fontMetrics().lineSpacing() * 5 );
+ }
+}
+
+bool Kleo::CryptoConfigModule::hasError() const {
+ return mComponentGUIs.empty();
}
void Kleo::CryptoConfigModule::save()
diff --git a/certmanager/lib/ui/cryptoconfigmodule.h b/certmanager/lib/ui/cryptoconfigmodule.h
index 70c4a2691..167c3ac84 100644
--- a/certmanager/lib/ui/cryptoconfigmodule.h
+++ b/certmanager/lib/ui/cryptoconfigmodule.h
@@ -50,6 +50,8 @@ namespace Kleo {
public:
CryptoConfigModule( Kleo::CryptoConfig* config, TQWidget * parent=0, const char * name=0 );
+ bool hasError() const;
+
void save();
void reset(); // i.e. reload current settings, discarding user input
void defaults();
diff --git a/certmanager/lib/ui/keyselectiondialog.cpp b/certmanager/lib/ui/keyselectiondialog.cpp
index fcb257514..fc590d49b 100644
--- a/certmanager/lib/ui/keyselectiondialog.cpp
+++ b/certmanager/lib/ui/keyselectiondialog.cpp
@@ -61,6 +61,8 @@
#include <kconfig.h>
#include <kmessagebox.h>
#include <kprocess.h>
+#include <kactivelabel.h>
+#include <kurl.h>
// Qt
#include <tqcheckbox.h>
@@ -85,7 +87,12 @@ static bool checkKeyUsage( const GpgME::Key & key, unsigned int keyUsage ) {
if ( keyUsage & Kleo::KeySelectionDialog::ValidKeys ) {
if ( key.isInvalid() )
- kdDebug() << "key is invalid - ignoring" << endl;
+ if ( key.keyListMode() & GpgME::Context::Validate ) {
+ kdDebug() << "key is invalid" << endl;
+ return false;
+ } else {
+ kdDebug() << "key is invalid - ignoring" << endl;
+ }
if ( key.isExpired() ) {
kdDebug() << "key is expired" << endl;
return false;
@@ -309,6 +316,28 @@ Kleo::KeySelectionDialog::KeySelectionDialog( const TQString & title,
Kleo::KeySelectionDialog::KeySelectionDialog( const TQString & title,
const TQString & text,
+ const TQString & initialQuery,
+ const std::vector<GpgME::Key> & selectedKeys,
+ unsigned int keyUsage,
+ bool extendedSelection,
+ bool rememberChoice,
+ TQWidget * parent, const char * name,
+ bool modal )
+ : KDialogBase( parent, name, modal, title, Default|Ok|Cancel|Help, Ok ),
+ mOpenPGPBackend( 0 ),
+ mSMIMEBackend( 0 ),
+ mRememberCB( 0 ),
+ mSelectedKeys( selectedKeys ),
+ mKeyUsage( keyUsage ),
+ mSearchText( initialQuery ),
+ mInitialQuery( initialQuery ),
+ mCurrentContextMenuItem( 0 )
+{
+ init( rememberChoice, extendedSelection, text, initialQuery );
+}
+
+Kleo::KeySelectionDialog::KeySelectionDialog( const TQString & title,
+ const TQString & text,
const TQString & initialQuery,
unsigned int keyUsage,
bool extendedSelection,
@@ -321,6 +350,7 @@ Kleo::KeySelectionDialog::KeySelectionDialog( const TQString & title,
mRememberCB( 0 ),
mKeyUsage( keyUsage ),
mSearchText( initialQuery ),
+ mInitialQuery( initialQuery ),
mCurrentContextMenuItem( 0 )
{
init( rememberChoice, extendedSelection, text, initialQuery );
@@ -340,11 +370,26 @@ void Kleo::KeySelectionDialog::init( bool rememberChoice, bool extendedSelection
mTopLayout = new TQVBoxLayout( page, 0, spacingHint() );
if ( !text.isEmpty() ) {
- TQLabel* textLabel = new TQLabel( text, page );
- textLabel->setAlignment( textLabel->alignment() | Qt::WordBreak );
- mTopLayout->addWidget( textLabel );
+ if ( text.startsWith( "<qt>" ) ) {
+ KActiveLabel *textLabel = new KActiveLabel( text, page );
+ disconnect( textLabel, TQT_SIGNAL(linkClicked(const TQString&)), textLabel, TQT_SLOT(openLink(const TQString&)) );
+ connect( textLabel, TQT_SIGNAL(linkClicked(const TQString&)), TQT_SLOT(slotStartCertificateManager(const TQString&)) );
+ textLabel->setAlignment( textLabel->alignment() | TQt::WordBreak );
+ mTopLayout->addWidget( textLabel );
+ } else {
+ KActiveLabel *textLabel = new KActiveLabel( text, page );
+ textLabel->setAlignment( textLabel->alignment() | TQt::WordBreak );
+ mTopLayout->addWidget( textLabel );
+ }
}
+ TQPushButton * const searchExternalPB
+ = new TQPushButton( i18n("Search for &External Certificates"), page );
+ mTopLayout->addWidget( searchExternalPB, 0, TQt::AlignLeft );
+ connect( searchExternalPB, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotStartSearchForExternalCertificates()) );
+ if ( initialQuery.isEmpty() )
+ searchExternalPB->hide();
+
TQHBoxLayout * hlay = new TQHBoxLayout( mTopLayout ); // inherits spacing
TQLineEdit * le = new TQLineEdit( page );
le->setText( initialQuery );
@@ -500,10 +545,12 @@ void Kleo::KeySelectionDialog::slotHelp()
emit helpClicked();
}
-void Kleo::KeySelectionDialog::slotStartCertificateManager()
+void Kleo::KeySelectionDialog::slotStartCertificateManager( const TQString &query )
{
KProcess certManagerProc;
certManagerProc << "kleopatra";
+ if ( !query.isEmpty() )
+ certManagerProc << "--external" << "--query" << KURL::decode_string( query );
if( !certManagerProc.start( KProcess::DontCare ) )
KMessageBox::error( this, i18n( "Could not start certificate manager; "
diff --git a/certmanager/lib/ui/keyselectiondialog.h b/certmanager/lib/ui/keyselectiondialog.h
index fd8f67394..ab8dc756d 100644
--- a/certmanager/lib/ui/keyselectiondialog.h
+++ b/certmanager/lib/ui/keyselectiondialog.h
@@ -93,6 +93,15 @@ namespace Kleo {
bool modal=true );
KeySelectionDialog( const TQString & title,
const TQString & text,
+ const TQString & initialPattern,
+ const std::vector<GpgME::Key> & selectedKeys,
+ unsigned int keyUsage=AllKeys,
+ bool extendedSelection=false,
+ bool rememberChoice=false,
+ TQWidget * parent=0, const char * name=0,
+ bool modal=true );
+ KeySelectionDialog( const TQString & title,
+ const TQString & text,
const TQString & initialPattern,
unsigned int keyUsage=AllKeys,
bool extendedSelection=false,
@@ -129,7 +138,10 @@ namespace Kleo {
private slots:
void slotRereadKeys();
- void slotStartCertificateManager();
+ void slotStartCertificateManager( const TQString &query = TQString() );
+ void slotStartSearchForExternalCertificates() {
+ slotStartCertificateManager( mInitialQuery );
+ }
void slotKeyListResult( const GpgME::KeyListResult & );
void slotSelectionChanged();
void slotCheckSelection() { slotCheckSelection( 0 ); }
@@ -170,6 +182,7 @@ namespace Kleo {
TQTimer * mStartSearchTimer;
// cross-eventloop temporaries:
TQString mSearchText;
+ const TQString mInitialQuery;
Kleo::KeyListViewItem * mCurrentContextMenuItem;
int mTruncated, mListJobCount, mSavedOffsetY;
};
diff --git a/certmanager/lib/ui/messagebox.cpp b/certmanager/lib/ui/messagebox.cpp
index ddce8f04d..e05a21b9a 100644
--- a/certmanager/lib/ui/messagebox.cpp
+++ b/certmanager/lib/ui/messagebox.cpp
@@ -46,10 +46,15 @@
#include <klocale.h>
#include <ksavefile.h>
#include <kguiitem.h>
+#include <kdebug.h>
#include <tqtextedit.h>
#include <tqtextstream.h>
#include <tqvbox.h>
+#include <tqapplication.h>
+#include <tqstylesheet.h>
+
+#include <gpg-error.h>
using namespace Kleo;
using namespace GpgME;
@@ -74,6 +79,7 @@ public:
explicit AuditLogViewer( const TQString & log, TQWidget * parent=0, const char * name=0, WFlags f=0 )
: KDialogBase( parent, name, false, i18n("View GnuPG Audit Log"),
Close|User1|User2, Close, false, KGuiItem_save(), KGuiItem_copy() ),
+ m_log( /* sic */ ),
m_textEdit( new TQTextEdit( this, "m_textEdit" ) )
{
setWFlags( f );
@@ -85,7 +91,18 @@ public:
~AuditLogViewer() {}
void setAuditLog( const TQString & log ) {
- m_textEdit->setText( log );
+ if ( log == m_log )
+ return;
+ m_log = log;
+ m_textEdit->setText( "<qt>" + log + "</qt>" );
+ const TQRect rect = m_textEdit->paragraphRect( 0 );
+ kdDebug() << "setAuditLog: rect = " << rect << endl;
+ if ( !rect.isValid() )
+ return;
+ TQSize maxSize = qApp->desktop()->screenGeometry( this ).size() * 2 / 3 ;
+ if ( !maxSize.isValid() )
+ maxSize = TQSize( 640, 480 );
+ m_textEdit->setMinimumSize( rect.size().boundedTo( maxSize ) );
}
private:
@@ -98,7 +115,12 @@ private:
KSaveFile file( fileName );
if ( TQTextStream * const s = file.textStream() ) {
- *s << m_textEdit->text() << endl;
+ *s << "<html><head>";
+ if ( !caption().isEmpty() )
+ *s << "\n<title>" << /*TQt*/TQStyleSheet::escape( caption() ) << "</title>\n";
+ *s << "</head><body>\n"
+ << m_log
+ << "\n</body></html>" << endl;
file.close();
}
@@ -114,6 +136,7 @@ private:
}
private:
+ TQString m_log;
TQTextEdit * m_textEdit;
};
@@ -125,13 +148,23 @@ void MessageBox::auditLog( TQWidget * parent, const Job * job, const TQString &
if ( !job )
return;
- if ( !GpgME::hasFeature( AuditLogFeature ) ) {
+ if ( !GpgME::hasFeature( AuditLogFeature ) || !job->isAuditLogSupported() ) {
KMessageBox::information( parent, i18n("Your system does not have support for GnuPG Audit Logs"),
i18n("System Error") );
return;
}
+ const GpgME::Error err = job->auditLogError();
+
+ if ( err.code() != GPG_ERR_NO_DATA ) {
+ KMessageBox::information( parent, i18n("An error occurred while trying to retrieve the GnuPG Audit Log:\n%1")
+ .arg( TQString::fromLocal8Bit( err.asString() ) ),
+ i18n("GnuPG Audit Log Error") );
+ return;
+ }
+
const TQString log = job->auditLogAsHtml();
+
if ( log.isEmpty() ) {
KMessageBox::information( parent, i18n("No GnuPG Audit Log available for this operation."),
i18n("No GnuPG Audit Log") );
@@ -143,7 +176,7 @@ void MessageBox::auditLog( TQWidget * parent, const Job * job, const TQString &
// static
void MessageBox::auditLog( TQWidget * parent, const TQString & log, const TQString & caption ) {
- AuditLogViewer * const alv = new AuditLogViewer( "<qt>" + log + "</qt>", parent, "alv", Qt::WDestructiveClose );
+ AuditLogViewer * const alv = new AuditLogViewer( log, parent, "alv", Qt::WDestructiveClose );
alv->setCaption( caption );
alv->show();
}
@@ -247,8 +280,34 @@ void MessageBox::error( TQWidget * parent, const SigningResult & sresult, const
}
// static
+bool MessageBox::showAuditLogButton( const Kleo::Job * job ) {
+ if ( !job ) {
+ kdDebug() << "not showing audit log button (no job instance)" << endl;
+ return false;
+ }
+ if ( !GpgME::hasFeature( GpgME::AuditLogFeature ) ) {
+ kdDebug() << "not showing audit log button (gpgme too old)" << endl;
+ return false;
+ }
+ if ( !job->isAuditLogSupported() ) {
+ kdDebug() << "not showing audit log button (not supported)" << endl;
+ return false;
+ }
+ if ( job->auditLogError().code() == GPG_ERR_NO_DATA ) {
+ kdDebug() << "not showing audit log button (GPG_ERR_NO_DATA)" << endl;
+ return false;
+ }
+ if ( !job->auditLogError() && job->auditLogAsHtml().isEmpty() ) {
+ kdDebug() << "not showing audit log button (success, but result empty)" << endl;
+ return false;
+ }
+ return true;
+}
+
+
+// static
void MessageBox::make( TQWidget * parent, TQMessageBox::Icon icon, const TQString & text, const Job * job, const TQString & caption, int options ) {
- KDialogBase * dialog = GpgME::hasFeature( GpgME::AuditLogFeature )
+ KDialogBase * dialog = showAuditLogButton( job )
? new KDialogBase( caption, KDialogBase::Yes | KDialogBase::No,
KDialogBase::Yes, KDialogBase::Yes,
parent, "error", true, true,
diff --git a/certmanager/lib/ui/messagebox.h b/certmanager/lib/ui/messagebox.h
index 5ed2edaf4..ee72e43c3 100644
--- a/certmanager/lib/ui/messagebox.h
+++ b/certmanager/lib/ui/messagebox.h
@@ -40,6 +40,7 @@ namespace GpgME {
class EncryptionResult;
class DecryptionResult;
class VerificationResult;
+ class Error;
}
namespace Kleo {
@@ -73,6 +74,8 @@ namespace Kleo {
static void auditLog( TQWidget * parent, const TQString & log, const TQString & caption );
static void auditLog( TQWidget * parent, const TQString & log );
+ static bool showAuditLogButton( const Kleo::Job * job );
+
private:
static void make( TQWidget * parent, TQMessageBox::Icon icon, const TQString & text, const Kleo::Job * job, const TQString & caption, int options );
};