• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kleopatra

  • sources
  • kde-4.12
  • kdepim
  • kleopatra
  • crypto
createchecksumscontroller.cpp
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  crypto/createchecksumscontroller.cpp
3 
4  This file is part of Kleopatra, the KDE keymanager
5  Copyright (c) 2010 Klarälvdalens Datakonsult AB
6 
7  Kleopatra is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  Kleopatra is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  In addition, as a special exception, the copyright holders give
22  permission to link the code of this program with any edition of
23  the Qt library by Trolltech AS, Norway (or with modified versions
24  of Qt that use the same license as Qt), and distribute linked
25  combinations including the two. You must obey the GNU General
26  Public License in all respects for all of the code used other than
27  Qt. If you modify this file, you may extend this exception to
28  your version of the file, but you are not obligated to do so. If
29  you do not wish to do so, delete this exception statement from
30  your version.
31 */
32 
33 #include <config-kleopatra.h>
34 
35 #include "createchecksumscontroller.h"
36 
37 #include <utils/input.h>
38 #include <utils/output.h>
39 #include <utils/classify.h>
40 #include <utils/kleo_assert.h>
41 
42 #include <kleo/stl_util.h>
43 #include <kleo/checksumdefinition.h>
44 
45 #include <KLocale>
46 #include <kdebug.h>
47 #include <KSaveFile>
48 
49 #include <QLayout>
50 #include <QDialog>
51 #include <QDialogButtonBox>
52 #include <QLabel>
53 #include <QListWidget>
54 
55 #include <QPointer>
56 #include <QFileInfo>
57 #include <QThread>
58 #include <QMutex>
59 #include <QProgressDialog>
60 #include <QDir>
61 #include <QProcess>
62 
63 #include <boost/bind.hpp>
64 #include <boost/function.hpp>
65 
66 #include <gpg-error.h>
67 
68 #include <deque>
69 #include <map>
70 #include <limits>
71 
72 using namespace Kleo;
73 using namespace Kleo::Crypto;
74 using namespace boost;
75 
76 namespace {
77 
78  class ResultDialog : public QDialog {
79  Q_OBJECT
80  public:
81  ResultDialog( const QStringList & created, const QStringList & errors, QWidget * parent=0, Qt::WindowFlags f=0 )
82  : QDialog( parent, f ),
83  createdLB( created.empty()
84  ? i18nc("@info","No checksum files have been created.")
85  : i18nc("@info","These checksum files have been successfully created:"), this ),
86  createdLW( this ),
87  errorsLB( errors.empty()
88  ? i18nc("@info","There were no errors.")
89  : i18nc("@info","The following errors were encountered:"), this ),
90  errorsLW( this ),
91  buttonBox( QDialogButtonBox::Ok, Qt::Horizontal, this ),
92  vlay( this )
93  {
94  KDAB_SET_OBJECT_NAME( createdLB );
95  KDAB_SET_OBJECT_NAME( createdLW );
96  KDAB_SET_OBJECT_NAME( errorsLB );
97  KDAB_SET_OBJECT_NAME( errorsLW );
98  KDAB_SET_OBJECT_NAME( buttonBox );
99  KDAB_SET_OBJECT_NAME( vlay );
100 
101  createdLW.addItems( created );
102  QRect r;
103  for( int i = 0; i < created.size(); ++i )
104  r = r.united( createdLW.visualRect( createdLW.model()->index( 0, i ) ) );
105  createdLW.setMinimumWidth( qMin( 1024, r.width() + 4 * createdLW.frameWidth() ) );
106 
107  errorsLW.addItems( errors );
108 
109  vlay.addWidget( &createdLB );
110  vlay.addWidget( &createdLW, 1 );
111  vlay.addWidget( &errorsLB );
112  vlay.addWidget( &errorsLW, 1 );
113  vlay.addWidget( &buttonBox );
114 
115  if ( created.empty() )
116  createdLW.hide();
117  if ( errors.empty() )
118  errorsLW.hide();
119 
120  connect( &buttonBox, SIGNAL(accepted()), this, SLOT(accept()) );
121  connect( &buttonBox, SIGNAL(rejected()), this, SLOT(reject()) );
122  }
123 
124  private:
125  QLabel createdLB;
126  QListWidget createdLW;
127  QLabel errorsLB;
128  QListWidget errorsLW;
129  QDialogButtonBox buttonBox;
130  QVBoxLayout vlay;
131  };
132 
133 }
134 
135 #ifdef Q_OS_UNIX
136 static const bool HAVE_UNIX = true;
137 #else
138 static const bool HAVE_UNIX = false;
139 #endif
140 
141 static const Qt::CaseSensitivity fs_cs = HAVE_UNIX ? Qt::CaseSensitive : Qt::CaseInsensitive ; // can we use QAbstractFileEngine::caseSensitive()?
142 
143 static QStringList fs_sort( QStringList l ) {
144  int (*QString_compare)(const QString&,const QString&,Qt::CaseSensitivity) = &QString::compare;
145  kdtools::sort( l, boost::bind( QString_compare, _1, _2, fs_cs ) < 0 );
146  return l;
147 }
148 
149 static QStringList fs_intersect( QStringList l1, QStringList l2 ) {
150  int (*QString_compare)(const QString&,const QString&,Qt::CaseSensitivity) = &QString::compare;
151  fs_sort( l1 );
152  fs_sort( l2 );
153  QStringList result;
154  std::set_intersection( l1.begin(), l1.end(),
155  l2.begin(), l2.end(),
156  std::back_inserter( result ),
157  boost::bind( QString_compare, _1, _2, fs_cs ) < 0 );
158  return result;
159 }
160 
161 static QList<QRegExp> get_patterns( const std::vector< shared_ptr<ChecksumDefinition> > & checksumDefinitions )
162 {
163  QList<QRegExp> result;
164  Q_FOREACH( const shared_ptr<ChecksumDefinition> & cd, checksumDefinitions )
165  if ( cd )
166  Q_FOREACH( const QString & pattern, cd->patterns() )
167  result.push_back( QRegExp( pattern, fs_cs ) );
168  return result;
169 }
170 
171 namespace {
172  struct matches_any : std::unary_function<QString,bool> {
173  const QList<QRegExp> m_regexps;
174  explicit matches_any( const QList<QRegExp> & regexps ) : m_regexps( regexps ) {}
175  bool operator()( const QString & s ) const {
176  return kdtools::any( m_regexps, boost::bind( &QRegExp::exactMatch, _1, s ) );
177  }
178  };
179 }
180 
181 class CreateChecksumsController::Private : public QThread {
182  Q_OBJECT
183  friend class ::Kleo::Crypto::CreateChecksumsController;
184  CreateChecksumsController * const q;
185 public:
186  explicit Private( CreateChecksumsController * qq );
187  ~Private();
188 
189 Q_SIGNALS:
190  void progress( int, int, const QString & );
191 
192 private:
193  void slotOperationFinished() {
194 #ifndef QT_NO_PROGRESSDIALOG
195  if ( progressDialog ) {
196  progressDialog->setValue( progressDialog->maximum() );
197  progressDialog->close();
198  }
199 #endif // QT_NO_PROGRESSDIALOG
200  ResultDialog * const dlg = new ResultDialog( created, errors );
201  q->bringToForeground( dlg );
202  if ( !errors.empty() )
203  q->setLastError( gpg_error( GPG_ERR_GENERAL ),
204  errors.join( QLatin1String("\n") ) );
205  q->emitDoneOrError();
206  }
207  void slotProgress( int current, int total, const QString & what ) {
208  kDebug() << "progress: " << current << "/" << total << ": " << qPrintable( what );
209 #ifndef QT_NO_PROGRESSDIALOG
210  if ( !progressDialog )
211  return;
212  progressDialog->setMaximum( total );
213  progressDialog->setValue( current );
214  progressDialog->setLabelText( what );
215 #endif // QT_NO_PROGRESSDIALOG
216  }
217 
218 private:
219  /* reimp */ void run();
220 
221 private:
222 #ifndef QT_NO_PROGRESSDIALOG
223  QPointer<QProgressDialog> progressDialog;
224 #endif
225  mutable QMutex mutex;
226  const std::vector< shared_ptr<ChecksumDefinition> > checksumDefinitions;
227  shared_ptr<ChecksumDefinition> checksumDefinition;
228  QStringList files;
229  QStringList errors, created;
230  bool allowAddition;
231  volatile bool canceled;
232 };
233 
234 CreateChecksumsController::Private::Private( CreateChecksumsController * qq )
235  : q( qq ),
236 #ifndef QT_NO_PROGRESSDIALOG
237  progressDialog(),
238 #endif
239  mutex(),
240  checksumDefinitions( ChecksumDefinition::getChecksumDefinitions() ),
241  checksumDefinition( ChecksumDefinition::getDefaultChecksumDefinition( checksumDefinitions ) ),
242  files(),
243  errors(),
244  created(),
245  allowAddition( false ),
246  canceled( false )
247 {
248  connect( this, SIGNAL(progress(int,int,QString)),
249  q, SLOT(slotProgress(int,int,QString)) );
250  connect( this, SIGNAL(progress(int,int,QString)),
251  q, SIGNAL(progress(int,int,QString)) );
252  connect( this, SIGNAL(finished()),
253  q, SLOT(slotOperationFinished()) );
254 }
255 
256 CreateChecksumsController::Private::~Private() { kDebug(); }
257 
258 CreateChecksumsController::CreateChecksumsController( QObject * p )
259  : Controller( p ), d( new Private( this ) )
260 {
261 
262 }
263 
264 CreateChecksumsController::CreateChecksumsController( const shared_ptr<const ExecutionContext> & ctx, QObject * p )
265  : Controller( ctx, p ), d( new Private( this ) )
266 {
267 
268 }
269 
270 CreateChecksumsController::~CreateChecksumsController() {
271  kDebug();
272 }
273 
274 void CreateChecksumsController::setFiles( const QStringList & files ) {
275  kleo_assert( !d->isRunning() );
276  kleo_assert( !files.empty() );
277  const QList<QRegExp> patterns = get_patterns( d->checksumDefinitions );
278  if ( !kdtools::all( files, matches_any( patterns ) ) &&
279  !kdtools::none_of( files, matches_any( patterns ) ) )
280  throw Exception( gpg_error( GPG_ERR_INV_ARG ), i18n("Create Checksums: input files must be either all checksum files or all files to be checksummed, not a mixture of both.") );
281  const QMutexLocker locker( &d->mutex );
282  d->files = files;
283 }
284 
285 void CreateChecksumsController::setAllowAddition( bool allow ) {
286  kleo_assert( !d->isRunning() );
287  const QMutexLocker locker( &d->mutex );
288  d->allowAddition = allow;
289 }
290 
291 bool CreateChecksumsController::allowAddition() const {
292  const QMutexLocker locker( &d->mutex );
293  return d->allowAddition;
294 }
295 
296 void CreateChecksumsController::start() {
297 
298  {
299  const QMutexLocker locker( &d->mutex );
300 
301 #ifndef QT_NO_PROGRESSDIALOG
302  d->progressDialog = new QProgressDialog( i18n("Initializing..."), i18n("Cancel"), 0, 0 );
303  applyWindowID( d->progressDialog );
304  d->progressDialog->setAttribute( Qt::WA_DeleteOnClose );
305  d->progressDialog->setMinimumDuration( 1000 );
306  d->progressDialog->setWindowTitle( i18nc("@title:window","Create Checksum Progress") );
307  connect( d->progressDialog, SIGNAL(canceled()), this, SLOT(cancel()) );
308 #endif // QT_NO_PROGRESSDIALOG
309 
310  d->canceled = false;
311  d->errors.clear();
312  d->created.clear();
313  }
314 
315  d->start();
316 
317 }
318 
319 void CreateChecksumsController::cancel() {
320  kDebug();
321  const QMutexLocker locker( &d->mutex );
322  d->canceled = true;
323 }
324 
325 namespace {
326 
327  struct Dir {
328  QDir dir;
329  QString sumFile;
330  QStringList inputFiles;
331  quint64 totalSize;
332  shared_ptr<ChecksumDefinition> checksumDefinition;
333  };
334 
335 }
336 
337 static QStringList remove_checksum_files( QStringList l, const QList<QRegExp> & rxs ) {
338  QStringList::iterator end = l.end();
339  Q_FOREACH( const QRegExp & rx, rxs )
340  end = std::remove_if( l.begin(), end,
341  boost::bind( &QRegExp::exactMatch, rx, _1 ) );
342  l.erase( end, l.end() );
343  return l;
344 }
345 
346 namespace {
347  struct File {
348  QString name;
349  QByteArray checksum;
350  bool binary;
351  };
352 }
353 
354 static QString decode( const QString & encoded ) {
355  QString decoded;
356  decoded.reserve( encoded.size() );
357  bool shift = false;
358  Q_FOREACH( const QChar ch, encoded )
359  if ( shift ) {
360  switch ( ch.toLatin1() ) {
361  case '\\': decoded += QLatin1Char( '\\' ); break;
362  case 'n': decoded += QLatin1Char( '\n' ); break;
363  default:
364  kDebug() << "invalid escape sequence" << '\\' << ch << "(interpreted as '" << ch << "')";
365  decoded += ch;
366  break;
367  }
368  shift = false;
369  } else {
370  if ( ch == QLatin1Char( '\\' ) )
371  shift = true;
372  else
373  decoded += ch;
374  }
375  return decoded;
376 }
377 
378 static std::vector<File> parse_sum_file( const QString & fileName ) {
379  std::vector<File> files;
380  QFile f( fileName );
381  if ( f.open( QIODevice::ReadOnly ) ) {
382  QTextStream s( &f );
383  QRegExp rx( QLatin1String("(\\?)([a-f0-9A-F]+) ([ *])([^\n]+)\n*") );
384  while ( !s.atEnd() ) {
385  const QString line = s.readLine();
386  if ( rx.exactMatch( line ) ) {
387  assert( !rx.cap(4).endsWith( QLatin1Char('\n') ) );
388  const File file = {
389  rx.cap( 1 ) == QLatin1String("\\") ? decode( rx.cap( 4 ) ) : rx.cap( 4 ),
390  rx.cap( 2 ).toLatin1(),
391  rx.cap( 3 ) == QLatin1String("*"),
392  };
393  files.push_back( file );
394  }
395  }
396  }
397  return files;
398 }
399 
400 static quint64 aggregate_size( const QDir & dir, const QStringList & files ) {
401  quint64 n = 0;
402  Q_FOREACH( const QString & file, files )
403  n += QFileInfo( dir.absoluteFilePath( file ) ).size();
404  return n;
405 }
406 
407 static shared_ptr<ChecksumDefinition> filename2definition( const QString & fileName,
408  const std::vector< shared_ptr<ChecksumDefinition> > & checksumDefinitions )
409 {
410  Q_FOREACH( const shared_ptr<ChecksumDefinition> & cd, checksumDefinitions )
411  if ( cd )
412  Q_FOREACH( const QString & pattern, cd->patterns() )
413  if ( QRegExp( pattern, fs_cs ).exactMatch( fileName ) )
414  return cd;
415  return shared_ptr<ChecksumDefinition>();
416 }
417 
418 static std::vector<Dir> find_dirs_by_sum_files( const QStringList & files, bool allowAddition,
419  const function<void(int)> & progress,
420  const std::vector< shared_ptr<ChecksumDefinition> > & checksumDefinitions )
421 {
422 
423  const QList<QRegExp> patterns = get_patterns( checksumDefinitions );
424 
425  std::vector<Dir> dirs;
426  dirs.reserve( files.size() );
427 
428  int i = 0;
429 
430  Q_FOREACH( const QString & file, files ) {
431 
432  const QFileInfo fi( file );
433  const QDir dir = fi.dir();
434  const QStringList entries = remove_checksum_files( dir.entryList( QDir::Files ), patterns );
435 
436  QStringList inputFiles;
437  if ( allowAddition ) {
438  inputFiles = entries;
439  } else {
440  const std::vector<File> parsed = parse_sum_file( fi.absoluteFilePath() );
441  const QStringList oldInputFiles =
442  kdtools::transform<QStringList>( parsed, mem_fn( &File::name ) );
443  inputFiles = fs_intersect( oldInputFiles, entries );
444  }
445 
446  const Dir item = {
447  dir,
448  fi.fileName(),
449  inputFiles,
450  aggregate_size( dir, inputFiles ),
451  filename2definition( fi.fileName(), checksumDefinitions )
452  };
453 
454  dirs.push_back( item );
455 
456  if ( !progress.empty() )
457  progress( ++i );
458 
459  }
460  return dirs;
461 }
462 
463 namespace {
464  struct less_dir : std::binary_function<QDir,QDir,bool> {
465  bool operator()( const QDir & lhs, const QDir & rhs ) const {
466  return QString::compare( lhs.absolutePath(), rhs.absolutePath(), fs_cs ) < 0 ;
467  }
468  };
469 }
470 
471 static std::vector<Dir> find_dirs_by_input_files( const QStringList & files, const shared_ptr<ChecksumDefinition> & checksumDefinition, bool allowAddition,
472  const function<void(int)> & progress,
473  const std::vector< shared_ptr<ChecksumDefinition> > & checksumDefinitions )
474 {
475  Q_UNUSED( allowAddition );
476  if ( !checksumDefinition )
477  return std::vector<Dir>();
478 
479  const QList<QRegExp> patterns = get_patterns( checksumDefinitions );
480 
481  std::map<QDir,QStringList,less_dir> dirs2files;
482 
483  // Step 1: sort files by the dir they're contained in:
484 
485  std::deque<QString> inputs( files.begin(), files.end() );
486 
487  int i = 0;
488  while ( !inputs.empty() ) {
489  const QString file = inputs.front();
490  inputs.pop_front();
491  const QFileInfo fi( file );
492  if ( fi.isDir() ) {
493  QDir dir( file );
494  dirs2files[ dir ] = remove_checksum_files( dir.entryList( QDir::Files ), patterns );
495  kdtools::transform( dir.entryList( QDir::Dirs|QDir::NoDotAndDotDot ),
496  std::inserter( inputs, inputs.begin() ),
497  boost::bind( &QDir::absoluteFilePath, cref(dir), _1 ) );
498  } else {
499  dirs2files[fi.dir()].push_back( file );
500  }
501  if ( !progress.empty() )
502  progress( ++i );
503  }
504 
505  // Step 2: convert into vector<Dir>:
506 
507  std::vector<Dir> dirs;
508  dirs.reserve( dirs2files.size() );
509 
510  for ( std::map<QDir,QStringList,less_dir>::const_iterator it = dirs2files.begin(), end = dirs2files.end() ; it != end ; ++it ) {
511 
512  const QStringList inputFiles = remove_checksum_files( it->second, patterns );
513  if ( inputFiles.empty() )
514  continue;
515 
516  const Dir dir = {
517  it->first,
518  checksumDefinition->outputFileName(),
519  inputFiles,
520  aggregate_size( it->first, inputFiles ),
521  checksumDefinition
522  };
523  dirs.push_back( dir );
524 
525  if ( !progress.empty() )
526  progress( ++i );
527 
528  }
529  return dirs;
530 }
531 
532 static QString process( const Dir & dir, bool * fatal ) {
533  const QString absFilePath = dir.dir.absoluteFilePath( dir.sumFile );
534  KSaveFile file( absFilePath );
535  if ( !file.open() )
536  return i18n( "Failed to open file \"%1\" for reading and writing: %2",
537  dir.dir.absoluteFilePath( file.fileName() ),
538  file.errorString() );
539  QProcess p;
540  p.setWorkingDirectory( dir.dir.absolutePath() );
541  p.setStandardOutputFile( dir.dir.absoluteFilePath( file.QFile::fileName() ) );
542  const QString program = dir.checksumDefinition->createCommand();
543  dir.checksumDefinition->startCreateCommand( &p, dir.inputFiles );
544  p.waitForFinished();
545  kDebug() << "[" << &p << "] Exit code " << p.exitCode();
546 
547  if ( p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0 ) {
548  file.abort();
549  if ( fatal && p.error() == QProcess::FailedToStart )
550  *fatal = true;
551  if ( p.error() == QProcess::UnknownError )
552  return i18n( "Error while running %1: %2", program,
553  QString::fromLocal8Bit( p.readAllStandardError().trimmed().constData() ) );
554  else
555  return i18n( "Failed to execute %1: %2", program, p.errorString() );
556  }
557 
558  if ( !file.finalize() )
559  return i18n( "Failed to move file %1 to its final destination, %2: %3",
560  file.fileName(), dir.sumFile, file.errorString() );
561 
562  return QString();
563 }
564 
565 namespace {
566  static QDebug operator<<( QDebug s, const Dir & dir ) {
567  return s << "Dir(" << dir.dir << "->" << dir.sumFile << "<-(" << dir.totalSize << ')' << dir.inputFiles << ")\n";
568  }
569 }
570 
571 void CreateChecksumsController::Private::run() {
572 
573  QMutexLocker locker( &mutex );
574 
575  const QStringList files = this->files;
576  const std::vector< shared_ptr<ChecksumDefinition> > checksumDefinitions = this->checksumDefinitions;
577  const shared_ptr<ChecksumDefinition> checksumDefinition = this->checksumDefinition;
578  const bool allowAddition = this->allowAddition;
579 
580  locker.unlock();
581 
582  QStringList errors;
583  QStringList created;
584 
585  if ( !checksumDefinition ) {
586  errors.push_back( i18n("No checksum programs defined.") );
587  locker.relock();
588  this->errors = errors;
589  return;
590  } else {
591  kDebug() << "using checksum-definition" << checksumDefinition->id();
592  }
593 
594  //
595  // Step 1: build a list of work to do (no progress):
596  //
597 
598  const QString scanning = i18n("Scanning directories...");
599  emit progress( 0, 0, scanning );
600 
601  const bool haveSumFiles
602  = kdtools::all( files, matches_any( get_patterns( checksumDefinitions ) ) );
603  const function<void(int)> progressCb = boost::bind( &Private::progress, this, _1, 0, scanning );
604  const std::vector<Dir> dirs = haveSumFiles
605  ? find_dirs_by_sum_files( files, allowAddition, progressCb, checksumDefinitions )
606  : find_dirs_by_input_files( files, checksumDefinition, allowAddition, progressCb, checksumDefinitions ) ;
607 
608  Q_FOREACH( const Dir & dir, dirs )
609  kDebug() << dir;
610 
611  if ( !canceled ) {
612 
613  emit progress( 0, 0, i18n("Calculating total size...") );
614 
615  const quint64 total
616  = kdtools::accumulate_transform( dirs, mem_fn( &Dir::totalSize ), Q_UINT64_C(0) );
617 
618  if ( !canceled ) {
619 
620  //
621  // Step 2: perform work (with progress reporting):
622  //
623 
624  // re-scale 'total' to fit into ints (wish QProgressDialog would use quint64...)
625  const quint64 factor = total / std::numeric_limits<int>::max() + 1 ;
626 
627  quint64 done = 0;
628  Q_FOREACH( const Dir & dir, dirs ) {
629  emit progress( done/factor, total/factor,
630  i18n("Checksumming (%2) in %1", dir.checksumDefinition->label(), dir.dir.path() ) );
631  bool fatal = false;
632  const QString error = process( dir, &fatal );
633  if ( !error.isEmpty() )
634  errors.push_back( error );
635  else
636  created.push_back( dir.dir.absoluteFilePath( dir.sumFile ) );
637  done += dir.totalSize;
638  if ( fatal || canceled )
639  break;
640  }
641  emit progress( done/factor, total/factor, i18n("Done.") );
642 
643  }
644  }
645 
646  locker.relock();
647 
648  this->errors = errors;
649  this->created = created;
650 
651  // mutex unlocked by QMutexLocker
652 
653 }
654 
655 #include "moc_createchecksumscontroller.cpp"
656 #include "createchecksumscontroller.moc"
HAVE_UNIX
static const bool HAVE_UNIX
Definition: createchecksumscontroller.cpp:138
fs_sort
static QStringList fs_sort(QStringList l)
Definition: createchecksumscontroller.cpp:143
parse_sum_file
static std::vector< File > parse_sum_file(const QString &fileName)
Definition: createchecksumscontroller.cpp:378
Kleo::ExecutionContextUser::applyWindowID
void applyWindowID(QWidget *wid)
Definition: types.cpp:72
output.h
input.h
QDialog
get_patterns
static QList< QRegExp > get_patterns(const std::vector< shared_ptr< ChecksumDefinition > > &checksumDefinitions)
Definition: createchecksumscontroller.cpp:161
QWidget
classify.h
fs_intersect
static QStringList fs_intersect(QStringList l1, QStringList l2)
Definition: createchecksumscontroller.cpp:149
Kleo::Crypto::CreateChecksumsController::CreateChecksumsController
CreateChecksumsController(QObject *parent=0)
Definition: createchecksumscontroller.cpp:258
Kleo::Crypto::CreateChecksumsController
Definition: createchecksumscontroller.h:50
fs_cs
static const Qt::CaseSensitivity fs_cs
Definition: createchecksumscontroller.cpp:141
Kleo::Crypto::CreateChecksumsController::start
void start()
Definition: createchecksumscontroller.cpp:296
kleo_assert.h
boost::shared_ptr< ChecksumDefinition >
d
#define d
Definition: adduseridcommand.cpp:90
Kleo::Crypto::CreateChecksumsController::allowAddition
bool allowAddition() const
Definition: createchecksumscontroller.cpp:291
aggregate_size
static quint64 aggregate_size(const QDir &dir, const QStringList &files)
Definition: createchecksumscontroller.cpp:400
process
static QString process(const Dir &dir, bool *fatal)
Definition: createchecksumscontroller.cpp:532
remove_checksum_files
static QStringList remove_checksum_files(QStringList l, const QList< QRegExp > &rxs)
Definition: createchecksumscontroller.cpp:337
operator<<
QDebug operator<<(QDebug debug, const std::vector< T, A > &v)
Definition: headerview.cpp:78
Kleo::Crypto::CreateChecksumsController::cancel
void cancel()
Definition: createchecksumscontroller.cpp:319
KDAB_SET_OBJECT_NAME
#define KDAB_SET_OBJECT_NAME(x)
Definition: kdtoolsglobal.h:66
find_dirs_by_input_files
static std::vector< Dir > find_dirs_by_input_files(const QStringList &files, const shared_ptr< ChecksumDefinition > &checksumDefinition, bool allowAddition, const function< void(int)> &progress, const std::vector< shared_ptr< ChecksumDefinition > > &checksumDefinitions)
Definition: createchecksumscontroller.cpp:471
mutex
static QMutex mutex
Definition: sessiondata.cpp:48
kleo_assert
#define kleo_assert(cond)
Definition: kleo_assert.h:84
dir
static QString dir(const QString &id)
Definition: filedialog.cpp:53
Kleo::Crypto::CreateChecksumsController::setAllowAddition
void setAllowAddition(bool allow)
Definition: createchecksumscontroller.cpp:285
createchecksumscontroller.h
find_dirs_by_sum_files
static std::vector< Dir > find_dirs_by_sum_files(const QStringList &files, bool allowAddition, const function< void(int)> &progress, const std::vector< shared_ptr< ChecksumDefinition > > &checksumDefinitions)
Definition: createchecksumscontroller.cpp:418
Ok
Definition: setinitialpindialog.cpp:59
q
#define q
Definition: adduseridcommand.cpp:91
Kleo::Crypto::CreateChecksumsController::setFiles
void setFiles(const QStringList &files)
Definition: createchecksumscontroller.cpp:274
name
const char * name
Definition: uiserver/selectcertificatecommand.cpp:114
Kleo::Crypto::CreateChecksumsController::~CreateChecksumsController
~CreateChecksumsController()
Definition: createchecksumscontroller.cpp:270
Kleo::Crypto::Controller
Definition: controller.h:50
QList
Definition: commands/command.h:46
filename2definition
static shared_ptr< ChecksumDefinition > filename2definition(const QString &fileName, const std::vector< shared_ptr< ChecksumDefinition > > &checksumDefinitions)
Definition: createchecksumscontroller.cpp:407
decode
static QString decode(const QString &encoded)
Definition: createchecksumscontroller.cpp:354
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kleopatra

Skip menu "kleopatra"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal