kleopatra
signencryptfilestask.cpp
Go to the documentation of this file.
73 QString formatInputOutputLabel( const QString & input, const QString & output, bool inputDeleted, bool outputDeleted ) {
75 inputDeleted ? QString::fromLatin1("<s>%1</s>").arg( Qt::escape( input ) ) : Qt::escape( input ),
76 outputDeleted ? QString::fromLatin1("<s>%1</s>").arg( Qt::escape( output ) ) : Qt::escape( output ) );
81 ErrorResult( bool sign, bool encrypt, const Error & err, const QString & errStr, const QString & input, const QString & output, const AuditLog & auditLog )
82 : Task::Result(), m_sign( sign ), m_encrypt( encrypt ), m_error( err ), m_errString( errStr ), m_inputLabel( input ), m_outputLabel( output ), m_auditLog( auditLog ) {}
102 SignEncryptFilesResult( const SigningResult & sr, const shared_ptr<Input> & input, const shared_ptr<Output> & output, bool inputRemoved, bool outputCreated, const AuditLog & auditLog )
118 SignEncryptFilesResult( const EncryptionResult & er, const shared_ptr<Input> & input, const shared_ptr<Output> & output, bool inputRemoved, bool outputCreated, const AuditLog & auditLog )
134 SignEncryptFilesResult( const SigningResult & sr, const EncryptionResult & er, const shared_ptr<Input> & input, const shared_ptr<Output> & output, bool inputRemoved, bool outputCreated, const AuditLog & auditLog )
219 static QString makeResultDetails( const SigningResult & result, const QString & inputError, const QString & outputError ) {
231 static QString makeResultDetails( const EncryptionResult & result, const QString & inputError, const QString & outputError ) {
252 return canceled ? i18n( "%1: <b>Sign/encrypt canceled.</b>", label ) : i18n( " %1: Sign/encrypt failed.", label );
253 return i18nc( "label: result. Example: foo -> foo.gpg: Encryption failed.", "%1: <b>%2</b>", label,
271 shared_ptr<const Task::Result> makeErrorResult( const Error & err, const QString & errStr, const AuditLog & auditLog );
313 shared_ptr<const Task::Result> SignEncryptFilesTask::Private::makeErrorResult( const Error & err, const QString & errStr, const AuditLog & auditLog )
315 return shared_ptr<const ErrorResult>( new ErrorResult( sign, encrypt, err, errStr, input->label(), output->label(), auditLog ) );
459 std::auto_ptr<Kleo::SignJob> SignEncryptFilesTask::Private::createSignJob( GpgME::Protocol proto ) {
460 const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( proto );
462 std::auto_ptr<Kleo::SignJob> signJob( backend->signJob( q->asciiArmor(), /*textmode=*/false ) );
471 std::auto_ptr<Kleo::SignEncryptJob> SignEncryptFilesTask::Private::createSignEncryptJob( GpgME::Protocol proto ) {
472 const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( proto );
474 std::auto_ptr<Kleo::SignEncryptJob> signEncryptJob( backend->signEncryptJob( q->asciiArmor(), /*textmode=*/false ) );
478 connect( signEncryptJob.get(), SIGNAL(result(GpgME::SigningResult,GpgME::EncryptionResult,QByteArray)),
483 std::auto_ptr<Kleo::EncryptJob> SignEncryptFilesTask::Private::createEncryptJob( GpgME::Protocol proto ) {
484 const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( proto );
486 std::auto_ptr<Kleo::EncryptJob> encryptJob( backend->encryptJob( q->asciiArmor(), /*textmode=*/false ) );
519 q->emitResult( shared_ptr<Result>( new SignEncryptFilesResult( result, input, output, inputRemoved, outputCreated, auditLog ) ) );
522 void SignEncryptFilesTask::Private::slotResult( const SigningResult & sresult, const EncryptionResult & eresult ) {
546 q->emitResult( shared_ptr<Result>( new SignEncryptFilesResult( sresult, eresult, input, output, inputRemoved, outputCreated, auditLog ) ) );
572 q->emitResult( shared_ptr<Result>( new SignEncryptFilesResult( result, input, output, inputRemoved, outputCreated, auditLog ) ) );
576 const QString files = formatInputOutputLabel( m_inputLabel, m_outputLabel, m_inputRemoved, !m_outputCreated );
577 return files + QLatin1String(": ") + makeOverview( makeResultOverview( m_sresult, m_eresult ) );
600 m_sresult.error().code() ? makeResultDetails( m_sresult, m_inputErrorString, m_outputErrorString ) :
601 m_eresult.error().code() ? makeResultDetails( m_eresult, m_inputErrorString, m_outputErrorString ) :
614 return ( m_sresult.error().code() || m_eresult.error().code() ) ? NeutralError : NeutralSuccess;
Definition: types.h:55
Definition: auditlog.h:48
QString displayName(GpgME::Protocol prot)
void setOverwritePolicy(const boost::shared_ptr< OverwritePolicy > &policy)
Definition: signencryptfilestask.cpp:361
Definition: task.h:55
Definition: output.h:50
void setRecipients(const std::vector< GpgME::Key > &recipients)
Definition: signencryptfilestask.cpp:355
Definition: classify.h:49
SignEncryptFilesTask(QObject *parent=0)
Definition: signencryptfilestask.cpp:318
QString label() const
Definition: signencryptfilestask.cpp:400
void setSigners(const std::vector< GpgME::Key > &singners)
Definition: signencryptfilestask.cpp:350
void recursivelyRemovePath(const QString &path)
Definition: path-helper.cpp:94
void setOutputFileName(const QString &fileName)
Definition: signencryptfilestask.cpp:344
static boost::shared_ptr< Output > createFromFile(const QString &fileName, const boost::shared_ptr< OverwritePolicy > &)
Definition: output.cpp:343
void setEncrypt(bool encrypt)
Definition: signencryptfilestask.cpp:371
void setInputFileNames(const QStringList &fileNames)
Definition: signencryptfilestask.cpp:332
Definition: task.h:117
void setRemoveInputFileOnSuccess(bool)
Definition: signencryptfilestask.cpp:376
void setSign(bool sign)
Definition: signencryptfilestask.cpp:366
void setInputFileName(const QString &fileName)
Definition: signencryptfilestask.cpp:326
GpgME::Protocol protocol() const
Definition: signencryptfilestask.cpp:387
~SignEncryptFilesTask()
Definition: signencryptfilestask.cpp:324
void setInput(const boost::shared_ptr< Input > &input)
Definition: signencryptfilestask.cpp:338
void setDetachedSignature(bool detached)
Definition: signencryptfilestask.cpp:382
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.