kleopatra
decryptverifyfilescontroller.cpp
Go to the documentation of this file.
76 static shared_ptr<AbstractDecryptVerifyTask> taskFromOperationWidget( const DecryptVerifyOperationWidget * w, const QString & fileName, const QDir & outDir, const shared_ptr<OverwritePolicy> & overwritePolicy );
85 std::vector<shared_ptr<Task> > buildTasks( const QStringList &, const shared_ptr<OverwritePolicy> & );
105 shared_ptr<AbstractDecryptVerifyTask> DecryptVerifyFilesController::Private::taskFromOperationWidget( const DecryptVerifyOperationWidget * w, const QString & fileName, const QDir & outDir, const shared_ptr<OverwritePolicy> & overwritePolicy ) {
143 ad /* _needs_ the info */ ? throw Exception( gpg_error( GPG_ERR_CONFLICT ), i18n("Cannot determine whether input data is OpenPGP or CMS") ) :
149 /*else*/ Output::createFromFile( outDir.absoluteFilePath( outputFileName( QFileInfo( fileName ).fileName() ) ), overwritePolicy );
174 DecryptVerifyFilesController::Private::Private( DecryptVerifyFilesController* qq ) : q( qq ), m_errorDetected( false ), m_operation( DecryptVerify )
183 std::vector<shared_ptr<Task> > tasks = buildTasks( m_filesAfterPreparation, shared_ptr<OverwritePolicy>( new OverwritePolicy( m_wizard ) ) );
199 i18n("Caught unexpected exception in DecryptVerifyFilesController::Private::slotWizardOperationPrepared: %1",
203 i18n("Caught unknown exception in DecryptVerifyFilesController::Private::slotWizardOperationPrepared") );
213 void DecryptVerifyFilesController::doTaskDone( const Task* task, const shared_ptr<const Task::Result> & result )
227 if ( const shared_ptr<const DecryptVerifyResult> & dvr = boost::dynamic_pointer_cast<const DecryptVerifyResult>( result ) )
258 connect( w.get(), SIGNAL(operationPrepared()), q, SLOT(slotWizardOperationPrepared()), Qt::QueuedConnection );
273 result = ad && ( ad->extensions( OpenPGP ).contains( ext, Qt::CaseInsensitive ) || ad->extensions( CMS ).contains( ext, Qt::CaseInsensitive ) );
282 shared_ptr<ArchiveDefinition> pick_archive_definition( GpgME::Protocol proto, const std::vector< shared_ptr<ArchiveDefinition> > & ads, const QString & filename ) {
309 const std::vector< shared_ptr<ArchiveDefinition> > archiveDefinitions = ArchiveDefinition::getArchiveDefinitions();
320 if ( mayBeOpaqueSignature( classification ) || mayBeCipherText( classification ) || mayBeDetachedSignature( classification ) ) {
337 op->setMode( DecryptVerifyOperationWidget::DecryptVerifyOpaque, pick_archive_definition( proto, archiveDefinitions, fname ) );
359 op->setMode( DecryptVerifyOperationWidget::DecryptVerifyOpaque, pick_archive_definition( proto, archiveDefinitions, fname ) );
383 throw Kleo::Exception( makeGnuPGError( GPG_ERR_ASS_NO_INPUT ), i18n("No usable inputs found") );
389 std::vector< shared_ptr<Task> > DecryptVerifyFilesController::Private::buildTasks( const QStringList & fileNames, const shared_ptr<OverwritePolicy> & overwritePolicy )
404 tasks.push_back( taskFromOperationWidget( m_wizard->operationWidget( i ), fileNames[i], useOutDir ? outDir : fileDir, overwritePolicy ) );
406 tasks.push_back( Task::makeErrorTask( e.error().code(), QString::fromLocal8Bit( e.what() ), fileNames[i] ) );
423 DecryptVerifyFilesController::DecryptVerifyFilesController( QObject* parent ) : Controller( parent ), d( new Private( this ) )
427 DecryptVerifyFilesController::DecryptVerifyFilesController( const shared_ptr<const ExecutionContext> & ctx, QObject* parent ) : Controller( ctx, parent ), d( new Private( this ) )
QString completeSuffix() const
QString heuristicBaseDirectory(const QStringList &files)
Definition: path-helper.cpp:71
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
DecryptVerifyOperation operation() const
Definition: decryptverifyfilescontroller.cpp:445
QString findSignedData(const QString &signatureFileName)
Definition: classify.cpp:251
void push_back(const T &value)
void setSignedDataFileName(const QString &name)
Definition: decryptverifyoperationwidget.cpp:238
DecryptVerifyFilesController(QObject *parent=0)
Definition: decryptverifyfilescontroller.cpp:423
Definition: task.h:57
QString printableClassification(unsigned int classification)
Definition: classify.cpp:215
void setAttribute(Qt::WidgetAttribute attribute, bool on)
Definition: types.h:48
Definition: output.h:52
void setInputFileName(const QString &name)
Definition: decryptverifyoperationwidget.cpp:226
void chop(int n)
~DecryptVerifyFilesController()
Definition: decryptverifyfilescontroller.cpp:432
void setArchiveDefinitions(const std::vector< boost::shared_ptr< ArchiveDefinition > > &ads)
Definition: decryptverifyoperationwidget.cpp:176
int size() const
void start()
Definition: decryptverifyfilescontroller.cpp:434
QString fromLocal8Bit(const char *str, int size)
bool exists() const
bool empty() const
Definition: classify.h:49
Mode mode
Definition: decryptverifyoperationwidget.h:58
bool isEmpty() const
void setOperation(DecryptVerifyOperation op)
Definition: decryptverifyfilescontroller.cpp:440
boost::shared_ptr< ArchiveDefinition > selectedArchiveDefinition() const
Definition: decryptverifyoperationwidget.cpp:250
QDir absoluteDir() const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
Definition: classify.h:48
void cancel()
Definition: decryptverifyfilescontroller.cpp:461
QStringList findSignatures(const QString &signedDataFileName)
Definition: classify.cpp:264
QString signedDataFileName
Definition: decryptverifyoperationwidget.h:60
Definition: taskcollection.h:51
void setMode(Mode mode, const boost::shared_ptr< ArchiveDefinition > &ad)
Definition: decryptverifyoperationwidget.cpp:189
shared_ptr< ArchiveDefinition > pick_archive_definition(GpgME::Protocol proto, const std::vector< shared_ptr< ArchiveDefinition > > &ads, const QString &filename)
Definition: decryptverifyfilescontroller.cpp:282
void setWindowTitle(const QString &)
QString absoluteFilePath(const QString &fileName) const
static const char * extension(bool pgp, bool sign, bool encrypt, bool ascii, bool detached)
Definition: signencryptfilescontroller.cpp:287
QString inputFileName
Definition: decryptverifyoperationwidget.h:59
Definition: controller.h:52
ProtocolMask FormatMask TypeMask TypeMask TypeMask GpgME::Protocol findProtocol(const unsigned int classifcation)
Definition: classify.h:127
static std::vector< boost::shared_ptr< ArchiveDefinition > > getArchiveDefinitions()
Definition: archivedefinition.cpp:354
singleShot
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:10 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:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.