void VCardXXPort::addKey( KABC::Addressee &addr, KABC::Key::Types type ) { QString fingerprint = addr.custom( "KADDRESSBOOK", (type == KABC::Key::PGP ? "OPENPGPFP" : "SMIMEFP") ); if ( fingerprint.isEmpty() ) return; GpgME::Context * context = GpgME::Context::createForProtocol( GpgME::Context::OpenPGP ); if ( !context ) { kdError() << "No context available" << endl; return; } context->setArmor( false ); context->setTextMode( false ); QGpgME::QByteArrayDataProvider dataProvider; GpgME::Data dataObj( &dataProvider ); GpgME::Error error = context->exportPublicKeys( fingerprint.latin1(), dataObj ); delete context; if ( error ) { kdError() << error.asString() << endl; return; } KABC::Key key; key.setType( type ); key.setBinaryData( dataProvider.data() ); addr.insertKey( key ); }
Kleo::DecryptVerifyJob *CryptPlugWrapper::decryptVerifyJob(bool textMode) const { if(!_cp) return 0; GpgME::Context *context = GpgME::Context::createForProtocol(_cp->mProtocol); if(!context) return 0; context->setTextMode(textMode); return new Kleo::QGpgMEDecryptVerifyJob(context); }
Kleo::EncryptJob *CryptPlugWrapper::encryptJob(bool armor, bool textmode) const { if(!_cp) return 0; GpgME::Context *context = GpgME::Context::createForProtocol(_cp->mProtocol); if(!context) return 0; context->setArmor(armor); context->setTextMode(textmode); return new Kleo::QGpgMEEncryptJob(context); }