kleopatra
signencryptfilestask.cpp
Go to the documentation of this file.
74 QString formatInputOutputLabel( const QString & input, const QString & output, bool inputDeleted, bool outputDeleted ) {
76 inputDeleted ? QString::fromLatin1("<s>%1</s>").arg( Qt::escape( input ) ) : Qt::escape( input ),
77 outputDeleted ? QString::fromLatin1("<s>%1</s>").arg( Qt::escape( output ) ) : Qt::escape( output ) );
82 ErrorResult( bool sign, bool encrypt, const Error & err, const QString & errStr, const QString & input, const QString & output, const AuditLog & auditLog )
83 : Task::Result(), m_sign( sign ), m_encrypt( encrypt ), m_error( err ), m_errString( errStr ), m_inputLabel( input ), m_outputLabel( output ), m_auditLog( auditLog ) {}
103 SignEncryptFilesResult( const SigningResult & sr, const shared_ptr<Input> & input, const shared_ptr<Output> & output, bool inputRemoved, bool outputCreated, const AuditLog & auditLog )
119 SignEncryptFilesResult( const EncryptionResult & er, const shared_ptr<Input> & input, const shared_ptr<Output> & output, bool inputRemoved, bool outputCreated, const AuditLog & auditLog )
135 SignEncryptFilesResult( const SigningResult & sr, const EncryptionResult & er, const shared_ptr<Input> & input, const shared_ptr<Output> & output, bool inputRemoved, bool outputCreated, const AuditLog & auditLog )
220 static QString makeResultDetails( const SigningResult & result, const QString & inputError, const QString & outputError ) {
232 static QString makeResultDetails( const EncryptionResult & result, const QString & inputError, const QString & outputError ) {
253 return canceled ? i18n( "%1: <b>Sign/encrypt canceled.</b>", label ) : i18n( " %1: Sign/encrypt failed.", label );
254 return i18nc( "label: result. Example: foo -> foo.gpg: Encryption failed.", "%1: <b>%2</b>", label,
272 shared_ptr<const Task::Result> makeErrorResult( const Error & err, const QString & errStr, const AuditLog & auditLog );
314 shared_ptr<const Task::Result> SignEncryptFilesTask::Private::makeErrorResult( const Error & err, const QString & errStr, const AuditLog & auditLog )
316 return shared_ptr<const ErrorResult>( new ErrorResult( sign, encrypt, err, errStr, input->label(), output->label(), auditLog ) );
460 std::auto_ptr<Kleo::SignJob> SignEncryptFilesTask::Private::createSignJob( GpgME::Protocol proto ) {
461 const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( proto );
463 std::auto_ptr<Kleo::SignJob> signJob( backend->signJob( q->asciiArmor(), /*textmode=*/false ) );
472 std::auto_ptr<Kleo::SignEncryptJob> SignEncryptFilesTask::Private::createSignEncryptJob( GpgME::Protocol proto ) {
473 const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( proto );
475 std::auto_ptr<Kleo::SignEncryptJob> signEncryptJob( backend->signEncryptJob( q->asciiArmor(), /*textmode=*/false ) );
479 connect( signEncryptJob.get(), SIGNAL(result(GpgME::SigningResult,GpgME::EncryptionResult,QByteArray)),
484 std::auto_ptr<Kleo::EncryptJob> SignEncryptFilesTask::Private::createEncryptJob( GpgME::Protocol proto ) {
485 const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( proto );
487 std::auto_ptr<Kleo::EncryptJob> encryptJob( backend->encryptJob( q->asciiArmor(), /*textmode=*/false ) );
520 q->emitResult( shared_ptr<Result>( new SignEncryptFilesResult( result, input, output, inputRemoved, outputCreated, auditLog ) ) );
523 void SignEncryptFilesTask::Private::slotResult( const SigningResult & sresult, const EncryptionResult & eresult ) {
547 q->emitResult( shared_ptr<Result>( new SignEncryptFilesResult( sresult, eresult, input, output, inputRemoved, outputCreated, auditLog ) ) );
573 q->emitResult( shared_ptr<Result>( new SignEncryptFilesResult( result, input, output, inputRemoved, outputCreated, auditLog ) ) );
577 const QString files = formatInputOutputLabel( m_inputLabel, m_outputLabel, m_inputRemoved, !m_outputCreated );
578 return files + QLatin1String(": ") + makeOverview( makeResultOverview( m_sresult, m_eresult ) );
601 m_sresult.error().code() ? makeResultDetails( m_sresult, m_inputErrorString, m_outputErrorString ) :
602 m_eresult.error().code() ? makeResultDetails( m_eresult, m_inputErrorString, m_outputErrorString ) :
615 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:362
Definition: task.h:57
Definition: output.h:52
void setRecipients(const std::vector< GpgME::Key > &recipients)
Definition: signencryptfilestask.cpp:356
bool isNull() const
QString fromLocal8Bit(const char *str, int size)
bool empty() const
Definition: classify.h:49
SignEncryptFilesTask(QObject *parent=0)
Definition: signencryptfilestask.cpp:319
QString label() const
Definition: signencryptfilestask.cpp:401
bool isEmpty() const
void setSigners(const std::vector< GpgME::Key > &singners)
Definition: signencryptfilestask.cpp:351
void recursivelyRemovePath(const QString &path)
Definition: path-helper.cpp:96
void setOutputFileName(const QString &fileName)
Definition: signencryptfilestask.cpp:345
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:372
void setInputFileNames(const QStringList &fileNames)
Definition: signencryptfilestask.cpp:333
QString & replace(int position, int n, QChar after)
Definition: task.h:119
QString escape(const QString &plain)
void setRemoveInputFileOnSuccess(bool)
Definition: signencryptfilestask.cpp:377
QString fromLatin1(const char *str, int size)
void setSign(bool sign)
Definition: signencryptfilestask.cpp:367
void setInputFileName(const QString &fileName)
Definition: signencryptfilestask.cpp:327
GpgME::Protocol protocol() const
Definition: signencryptfilestask.cpp:388
~SignEncryptFilesTask()
Definition: signencryptfilestask.cpp:325
void setInput(const boost::shared_ptr< Input > &input)
Definition: signencryptfilestask.cpp:339
void setDetachedSignature(bool detached)
Definition: signencryptfilestask.cpp:383
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.