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

kleopatra

  • sources
  • kde-4.14
  • kdepim
  • kleopatra
  • crypto
  • gui
newsignencryptfileswizard.cpp
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  crypto/gui/newsignencryptfileswizard.cpp
3 
4  This file is part of Kleopatra, the KDE keymanager
5  Copyright (c) 2009 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 "newsignencryptfileswizard.h"
36 
37 #include "newresultpage.h"
38 #include "signingcertificateselectionwidget.h"
39 
40 #include <crypto/certificateresolver.h>
41 
42 #include <view/keytreeview.h>
43 #include <view/searchbar.h>
44 
45 #include <models/keycache.h>
46 #include <models/predicates.h>
47 #include <models/keylistmodel.h>
48 
49 #include <utils/archivedefinition.h>
50 #include <utils/path-helper.h>
51 #include <utils/gui-helper.h>
52 
53 #include <kleo/stl_util.h>
54 #include <ui/filenamerequester.h>
55 
56 #include <KLocalizedString>
57 #include <KIcon>
58 #include <KDebug>
59 #include <KMessageBox>
60 
61 #include <QVBoxLayout>
62 #include <QLabel>
63 #include <QWizardPage>
64 #include <QRadioButton>
65 #include <QCheckBox>
66 #include <QPushButton>
67 #include <QDialogButtonBox>
68 #include <QListWidget>
69 #include <QComboBox>
70 #include <QTreeView>
71 
72 #include <QPointer>
73 
74 #include <gpgme++/key.h>
75 
76 #ifndef Q_MOC_RUN
77 #include <boost/shared_ptr.hpp>
78 #include <boost/bind.hpp>
79 #endif
80 
81 using namespace GpgME;
82 using namespace boost;
83 using namespace Kleo;
84 using namespace Kleo::Crypto;
85 using namespace Kleo::Crypto::Gui;
86 
87 enum Page {
88  OperationPageId,
89  RecipientsPageId,
90  SignerPageId,
91  ResultPageId,
92 
93  NumPages
94 };
95 
96 static void enable_disable( QAbstractButton & button, const QAbstractItemView * view ) {
97  const QItemSelectionModel * ism = view ? view->selectionModel() : 0 ;
98  button.setEnabled( ism && ism->hasSelection() );
99 }
100 
101 static void copy_selected_from_to( KeyTreeView & from, KeyTreeView & to ) {
102  to.addKeysSelected( from.selectedKeys() );
103  from.view()->selectionModel()->clearSelection();
104 }
105 
106 static void move_selected_from_to( KeyTreeView & from, KeyTreeView & to ) {
107  const std::vector<Key> keys = from.selectedKeys();
108  from.removeKeys( keys );
109  to.addKeysSelected( keys );
110 }
111 
112 static void remove_all_keys_not_xyz( KeyTreeView & ktv, Protocol proto ) {
113  const std::vector<Key> k
114  = kdtools::copy_if< std::vector<Key> >( ktv.keys(), boost::bind( &Key::protocol, _1 ) != proto );
115  ktv.removeKeys( k );
116 }
117 
118 static QString join_max( const QStringList & sl, const int max, const QString & glue ) {
119  return QStringList( sl.mid( 0, max ) ).join( glue );
120 }
121 
122 
123 namespace {
124 
125  // Simple dialog to show a list of files
126  class ListDialog : public QDialog {
127  Q_OBJECT
128  public:
129  explicit ListDialog( const QStringList & files, QWidget * parent=0 )
130  : QDialog( parent ),
131  listWidget( this ),
132  buttonBox( QDialogButtonBox::Close, Qt::Vertical, this ),
133  hlay( this )
134  {
135  setWindowTitle( i18nc("@title:window","Selected Files") );
136 
137  KDAB_SET_OBJECT_NAME( listWidget );
138  KDAB_SET_OBJECT_NAME( buttonBox );
139  KDAB_SET_OBJECT_NAME( hlay );
140 
141  listWidget.setSelectionMode( QListWidget::NoSelection );
142  listWidget.addItems( files );
143 
144  hlay.addWidget( &listWidget );
145  hlay.addWidget( &buttonBox );
146 
147  connect( &buttonBox, SIGNAL(rejected()), this, SLOT(reject()) );
148  }
149 
150  private:
151  QListWidget listWidget;
152  QDialogButtonBox buttonBox;
153  QHBoxLayout hlay;
154  };
155 
156  //
157  // This is a simple QLabel subclass, used mainly to have a widget
158  // for the 'files' field of the wizard (though that one's unused as of now).
159  //
160  class ObjectsLabel : public QLabel {
161  Q_OBJECT // ### PENDING(marc) deal with lots of files (->listbox)
162  Q_PROPERTY( QStringList files READ files WRITE setFiles )
163  public:
164  static const int MaxLinesShownInline = 5;
165 
166  explicit ObjectsLabel( QWidget * parent=0, Qt::WindowFlags f=0 )
167  : QLabel( parent, f ), m_dialog(), m_files( dummyFiles() )
168  {
169  connect( this, SIGNAL(linkActivated(QString)),
170  this, SLOT(slotLinkActivated()) );
171  updateText();
172  // updateGeometry() doesn't seem to reset the
173  // minimumSizeHint(), using max-height dummy text here
174  // does... Go figure
175  m_files.clear();
176  }
177  explicit ObjectsLabel( const QStringList & files, QWidget * parent=0, Qt::WindowFlags f=0 )
178  : QLabel( parent, f ), m_dialog(), m_files( files )
179  {
180  connect( this, SIGNAL(linkActivated(QString)),
181  this, SLOT(slotLinkActivated()) );
182  updateText();
183  }
184 
185  QStringList files() const { return m_files; }
186  void setFiles( const QStringList & files ) {
187  if ( m_files == files )
188  return;
189  m_files = files;
190  updateText();
191  }
192 
193  private Q_SLOTS:
194  void slotLinkActivated() {
195  if ( !m_dialog ) {
196  m_dialog = new ListDialog( m_files, this );
197  m_dialog->setAttribute( Qt::WA_DeleteOnClose );
198  }
199  if ( m_dialog->isVisible() )
200  m_dialog->raise();
201  else
202  m_dialog->show();
203  }
204 
205  private:
206  static QStringList dummyFiles() {
207  QStringList dummy;
208  for ( int i = 0 ; i < MaxLinesShownInline+1 ; ++i )
209  dummy.push_back( QString::number( i ) );
210  return dummy;
211  }
212  QString makeText() const {
213  if ( m_files.empty() )
214  return QLatin1String("<p>") + i18n("No files selected.") + QLatin1String("</p>");
215  QString html = QLatin1String("<p>") + i18np("Selected file:", "Selected files:", m_files.size() ) + QLatin1String("</p>")
216  + QLatin1String("<ul><li>") + join_max( m_files, MaxLinesShownInline, QLatin1String("</li><li>") ) + QLatin1String("</li></ul>") ;
217  if ( m_files.size() > MaxLinesShownInline )
218  html += QLatin1String("<p><a href=\"link:/\">") + i18nc("@action","More...") + QLatin1String("</a></p>");
219  return html;
220  }
221  void updateText() { setText( makeText() ); }
222 
223  private:
224  QPointer<ListDialog> m_dialog;
225  QStringList m_files;
226  };
227 
228  //
229  // Helper wrapper around Kleo::FileNameRequester that adjusts
230  // extensions to an ArchiveDefinition
231  //
232  class ArchiveFileNameRequester : public Kleo::FileNameRequester {
233  Q_OBJECT
234  public:
235  explicit ArchiveFileNameRequester( Protocol protocol, QWidget * parent=0 )
236  : FileNameRequester( QDir::Files, parent ), m_protocol( protocol ), m_archiveDefinition()
237  {
238  setExistingOnly( false );
239  }
240 
241  public Q_SLOTS:
242  void setArchiveDefinition( const boost::shared_ptr<const Kleo::ArchiveDefinition> & ad ) {
243  if ( ad == m_archiveDefinition )
244  return;
245  const QString oldExt = m_archiveDefinition ? m_archiveDefinition->extensions( m_protocol ).front() : QString() ;
246  const QString newExt = ad ? ad->extensions( m_protocol ).front() : QString() ;
247  QString fn = fileName();
248  if ( fn.endsWith( oldExt ) )
249  fn.chop( oldExt.size() + 1 );
250  m_archiveDefinition = ad;
251  if ( ad )
252  fn += QLatin1Char('.') + newExt;
253  FileNameRequester::setFileName( fn );
254  }
255  void setFileName( const QString & fn ) {
256  const QString ext = m_archiveDefinition ? m_archiveDefinition->extensions( m_protocol ).front() : QString() ;
257  if ( m_archiveDefinition && !fn.endsWith( ext ) )
258  FileNameRequester::setFileName( fn + QLatin1Char('.') + ext );
259  else
260  FileNameRequester::setFileName( fn );
261  }
262  private:
263  const Protocol m_protocol;
264  shared_ptr<const ArchiveDefinition> m_archiveDefinition;
265  };
266 
267 
268 
269  class WizardPage : public QWizardPage {
270  Q_OBJECT
271  public:
272  explicit WizardPage( QWidget * parent=0 )
273  : QWizardPage( parent ),
274  m_presetProtocol( UnknownProtocol )
275  {
276 
277  }
278 
279  bool isArchiveRequested() const {
280  return field(QLatin1String("archive")).toBool();
281  }
282 
283  QString archiveName( Protocol p ) const {
284  return field( p == OpenPGP ? QLatin1String("archive-name-pgp") : QLatin1String("archive-name-cms" )).toString();
285  }
286 
287  bool isRemoveUnencryptedFilesEnabled() const {
288  return field(QLatin1String("remove")).toBool();
289  }
290 
291  bool isSignOnlySelected() const {
292  return field(QLatin1String("sign")).toBool();
293  }
294 
295  bool isEncryptOnlySelected() const {
296  return field(QLatin1String("encrypt")).toBool();
297  }
298 
299  bool isSignEncryptSelected() const {
300  return field(QLatin1String("signencrypt")).toBool() ;
301  }
302 
303  bool isSigningSelected() const {
304  return isSignOnlySelected() || isSignEncryptSelected() ;
305  }
306 
307  bool isEncryptionSelected() const {
308  return isEncryptOnlySelected() || isSignEncryptSelected() ;
309  }
310 
311  Protocol protocol() const { return m_presetProtocol; }
312  Protocol effectiveProtocol() const {
313  if ( isSignEncryptSelected() ) {
314  assert( m_presetProtocol == OpenPGP || m_presetProtocol == UnknownProtocol );
315  return OpenPGP;
316  } else {
317  return m_presetProtocol;
318  }
319  }
320 
321  void setPresetProtocol( Protocol proto ) {
322  if ( proto == m_presetProtocol )
323  return;
324  m_presetProtocol = proto;
325  doSetPresetProtocol();
326  }
327 
328  private:
329  virtual void doSetPresetProtocol() {}
330 
331  private:
332  Protocol m_presetProtocol;
333  };
334 
335 
336  class OperationPage : public WizardPage {
337  Q_OBJECT
338  Q_PROPERTY( QStringList files READ files WRITE setFiles )
339  Q_PROPERTY( bool signingPreset READ isSigningPreset WRITE setSigningPreset )
340  Q_PROPERTY( bool signingUserMutable READ isSigningUserMutable WRITE setSigningUserMutable )
341  Q_PROPERTY( bool encryptionPreset READ isEncryptionPreset WRITE setEncryptionPreset )
342  Q_PROPERTY( bool encryptionUserMutable READ isEncryptionUserMutable WRITE setEncryptionUserMutable )
343  Q_PROPERTY( bool archiveUserMutable READ isArchiveUserMutable WRITE setArchiveUserMutable )
344  public:
345  explicit OperationPage( QWidget * parent=0 )
346  : WizardPage( parent ),
347  m_objectsLabel( this ),
348  m_archiveCB( i18n("Archive files with:"), this ),
349  m_archive( this ),
350  m_archiveNamePgpLB( i18n("Archive name (OpenPGP):"), this ),
351  m_archiveNamePgp( OpenPGP, this ),
352  m_archiveNameCmsLB( i18n("Archive name (S/MIME):"), this ),
353  m_archiveNameCms( CMS, this ),
354  m_signencrypt( i18n("Sign and Encrypt (OpenPGP only)"), this ),
355  m_encrypt( i18n("Encrypt"), this ),
356  m_sign( i18n("Sign"), this ),
357  m_armor( i18n("Text output (ASCII armor)"), this ),
358  m_removeSource( i18n("Remove unencrypted original file when done"), this ),
359  m_signingUserMutable( true ),
360  m_encryptionUserMutable( true ),
361  m_archiveUserMutable( true ),
362  m_signingPreset( true ),
363  m_encryptionPreset( true ),
364  m_archiveDefinitions( ArchiveDefinition::getArchiveDefinitions() )
365  {
366  setTitle( i18nc("@title","What do you want to do?") );
367  setSubTitle( i18nc("@title",
368  "Please select here whether you want to sign or encrypt files.") );
369  KDAB_SET_OBJECT_NAME( m_objectsLabel );
370  KDAB_SET_OBJECT_NAME( m_signencrypt );
371  KDAB_SET_OBJECT_NAME( m_encrypt );
372  KDAB_SET_OBJECT_NAME( m_sign );
373  KDAB_SET_OBJECT_NAME( m_archiveCB );
374  KDAB_SET_OBJECT_NAME( m_archive );
375  KDAB_SET_OBJECT_NAME( m_archiveNamePgpLB );
376  KDAB_SET_OBJECT_NAME( m_archiveNamePgp );
377  KDAB_SET_OBJECT_NAME( m_archiveNameCmsLB );
378  KDAB_SET_OBJECT_NAME( m_archiveNameCms );
379  KDAB_SET_OBJECT_NAME( m_armor );
380  KDAB_SET_OBJECT_NAME( m_removeSource );
381 
382  QGridLayout * glay = new QGridLayout;
383  glay->addWidget( &m_archiveCB, 0, 0 );
384  glay->addWidget( &m_archive, 0, 1 );
385  glay->addWidget( &m_archiveNamePgpLB, 1, 0 );
386  glay->addWidget( &m_archiveNamePgp, 1, 1 );
387  glay->addWidget( &m_archiveNameCmsLB, 2, 0 );
388  glay->addWidget( &m_archiveNameCms, 2, 1 );
389 
390  QVBoxLayout * vlay = new QVBoxLayout( this );
391  vlay->addWidget( &m_objectsLabel );
392  vlay->addLayout( glay );
393  vlay->addWidget( &m_signencrypt );
394  vlay->addWidget( &m_encrypt );
395  vlay->addWidget( &m_sign );
396  vlay->addStretch( 1 );
397  vlay->addWidget( &m_armor );
398  vlay->addWidget( &m_removeSource );
399 
400  m_archiveNamePgpLB.setAlignment( Qt::AlignRight );
401  m_archiveNamePgpLB.setBuddy( &m_archiveNamePgp );
402  m_archiveNameCmsLB.setAlignment( Qt::AlignRight );
403  m_archiveNameCmsLB.setBuddy( &m_archiveNameCms );
404 
405  m_armor.setChecked( false );
406  m_archive.setEnabled( false );
407  m_archiveNamePgpLB.setEnabled( false );
408  m_archiveNamePgp.setEnabled( false );
409  m_archiveNameCmsLB.setEnabled( false );
410  m_archiveNameCms.setEnabled( false );
411 
412  Q_FOREACH( const shared_ptr<ArchiveDefinition> & ad, m_archiveDefinitions )
413  m_archive.addItem( ad->label(), qVariantFromValue( ad ) );
414 
415  registerField( QLatin1String("files"), this, "files" );
416 
417  registerField( QLatin1String("signing-preset"), this, "signingPreset" );
418  registerField( QLatin1String("encryption-preset"), this, "encryptionPreset" );
419 
420  registerField( QLatin1String("signencrypt"), &m_signencrypt );
421  registerField( QLatin1String("encrypt"), &m_encrypt );
422  registerField( QLatin1String("sign"), &m_sign );
423 
424  registerField( QLatin1String("armor"), &m_armor );
425  registerField( QLatin1String("remove"), &m_removeSource );
426 
427  registerField( QLatin1String("archive"), &m_archiveCB );
428  registerField( QLatin1String("archive-id"), &m_archive );
429  registerField( QLatin1String("archive-name-pgp"), &m_archiveNamePgp, "fileName" );
430  registerField( QLatin1String("archive-name-cms"), &m_archiveNameCms, "fileName" );
431 
432  registerField( QLatin1String("signing-user-mutable"), this, "signingUserMutable" );
433  registerField( QLatin1String("encryption-user-mutable"), this, "encryptionUserMutable" );
434  registerField( QLatin1String("archive-user-mutable"), this, "archiveUserMutable" );
435 
436  connect( &m_archive, SIGNAL(currentIndexChanged(int)),
437  this, SLOT(slotArchiveDefinitionChanged()) );
438 
439  connect( &m_signencrypt, SIGNAL(clicked()), this, SIGNAL(completeChanged()) );
440  connect( &m_encrypt, SIGNAL(clicked()), this, SIGNAL(completeChanged()) );
441  connect( &m_sign, SIGNAL(clicked()), this, SIGNAL(completeChanged()) );
442  connect( &m_archiveCB, SIGNAL(clicked()), this, SIGNAL(completeChanged()) );
443  connect( &m_archiveNamePgp, SIGNAL(fileNameChanged(QString)), this, SIGNAL(completeChanged()) );
444  connect( &m_archiveNameCms, SIGNAL(fileNameChanged(QString)), this, SIGNAL(completeChanged()) );
445 
446  connect( &m_sign, SIGNAL(toggled(bool)),
447  &m_removeSource, SLOT(setDisabled(bool)) );
448  connect( &m_archiveCB, SIGNAL(toggled(bool)),
449  &m_archive, SLOT(setEnabled(bool)) );
450  connect( &m_archiveCB, SIGNAL(toggled(bool)),
451  &m_archiveNamePgpLB, SLOT(setEnabled(bool)) );
452  connect( &m_archiveCB, SIGNAL(toggled(bool)),
453  &m_archiveNamePgp, SLOT(setEnabled(bool)) );
454  connect( &m_archiveCB, SIGNAL(toggled(bool)),
455  &m_archiveNameCmsLB, SLOT(setEnabled(bool)) );
456  connect( &m_archiveCB, SIGNAL(toggled(bool)),
457  &m_archiveNameCms, SLOT(setEnabled(bool)) );
458 
459  const shared_ptr<ArchiveDefinition> ad = archiveDefinition();
460  m_archiveNamePgp.setArchiveDefinition( ad );
461  m_archiveNameCms.setArchiveDefinition( ad );
462  }
463 
464  QStringList files() const { return m_objectsLabel.files(); }
465  void setFiles( const QStringList & files ) {
466  m_objectsLabel.setFiles( files );
467  const QString archiveName =
468  files.size() == 1 ? files.front() :
469  /* else */ QDir( heuristicBaseDirectory( files ) )
470  .absoluteFilePath( i18nc("base name of an archive file, e.g. archive.zip or archive.tar.gz", "archive") );
471  m_archiveNamePgp.setFileName( archiveName );
472  m_archiveNameCms.setFileName( archiveName );
473  }
474 
475  bool isSigningPreset() const { return m_signingPreset; }
476  void setSigningPreset( bool preset ) {
477  if ( m_signingPreset == preset )
478  return;
479  m_signingPreset = preset;
480  updateSignEncryptArchiveWidgetStates();
481  }
482 
483  bool isSigningUserMutable() const { return m_signingUserMutable; }
484  void setSigningUserMutable( bool mut ) {
485  if ( m_signingUserMutable == mut )
486  return;
487  m_signingUserMutable = mut;
488  updateSignEncryptArchiveWidgetStates();
489  }
490 
491  bool isEncryptionPreset() const { return m_encryptionPreset; }
492  void setEncryptionPreset( bool preset ) {
493  if ( m_encryptionPreset == preset )
494  return;
495  m_encryptionPreset = preset;
496  updateSignEncryptArchiveWidgetStates();
497  }
498 
499  bool isEncryptionUserMutable() const { return m_encryptionUserMutable; }
500  void setEncryptionUserMutable( bool mut ) {
501  if ( m_encryptionUserMutable == mut )
502  return;
503  m_encryptionUserMutable = mut;
504  updateSignEncryptArchiveWidgetStates();
505  }
506 
507  bool isArchiveUserMutable() const { return m_archiveUserMutable; }
508  void setArchiveUserMutable( bool mut ) {
509  if ( m_archiveUserMutable == mut )
510  return;
511  m_archiveUserMutable = mut;
512  updateSignEncryptArchiveWidgetStates();
513  }
514 
515  /* reimp */ bool isComplete() const {
516  return ( !isArchiveRequested() || !archiveName( OpenPGP ).isEmpty() && !archiveName( CMS ).isEmpty() ) // ### make more permissive
517  && ( isSigningSelected() || isEncryptionSelected() ) ;
518  }
519 
520  /* reimp */ bool validatePage() {
521  if ( isSignOnlySelected() && isArchiveRequested() )
522  return KMessageBox::warningContinueCancel( this,
523  i18nc("@info",
524  "<para>Archiving in combination with sign-only currently requires what are known as opaque signatures - "
525  "unlike detached ones, these embed the content in the signature.</para>"
526  "<para>This format is rather unusual. You might want to archive the files separately, "
527  "and then sign the archive as one file with Kleopatra.</para>"
528  "<para>Future versions of Kleopatra are expected to also support detached signatures in this case.</para>" ),
529  i18nc("@title:window", "Unusual Signature Warning"),
530  KStandardGuiItem::cont(), KStandardGuiItem::cancel(),
531  QLatin1String("signencryptfileswizard-archive+sign-only-warning") )
532  == KMessageBox::Continue ;
533  else
534  return true;
535  }
536 
537  /* reimp */ int nextId() const {
538  return isEncryptionSelected() ? RecipientsPageId : SignerPageId ;
539  }
540  /* reimp */ void doSetPresetProtocol() {
541  updateSignEncryptArchiveWidgetStates();
542  }
543 
544  shared_ptr<ArchiveDefinition> archiveDefinition() const {
545  return m_archive.itemData( m_archive.currentIndex() ).value< shared_ptr<ArchiveDefinition> >();
546  }
547 
548  void setArchiveDefinition( const shared_ptr<ArchiveDefinition> & ad ) {
549  m_archive.setCurrentIndex( m_archive.findData( qVariantFromValue( ad ) ) );
550  }
551 
552  void setArchiveDefinition( const QString & adName ) {
553  const std::vector< shared_ptr<ArchiveDefinition> >::const_iterator
554  it = kdtools::find_if( m_archiveDefinitions, boost::bind( &ArchiveDefinition::id, _1 ) == adName );
555  if ( it != m_archiveDefinitions.end() )
556  m_archive.setCurrentIndex( it - m_archiveDefinitions.begin() );
557  }
558 
559  private Q_SLOTS:
560  void slotArchiveDefinitionChanged() {
561  const shared_ptr<ArchiveDefinition> ad = archiveDefinition();
562  m_archiveNamePgp.setArchiveDefinition( ad );
563  m_archiveNameCms.setArchiveDefinition( ad );
564  }
565 
566  private:
567  void updateSignEncryptArchiveWidgetStates() {
568  m_archiveCB.setEnabled( m_archiveUserMutable );
569 
570  const bool mustEncrypt = m_encryptionPreset && !m_encryptionUserMutable ;
571  const bool mustSign = m_signingPreset && !m_signingUserMutable ;
572 
573  const bool mayEncrypt = m_encryptionPreset || m_encryptionUserMutable ;
574  const bool maySign = m_signingPreset || m_signingUserMutable ;
575 
576  const bool canSignEncrypt = protocol() != CMS && mayEncrypt && maySign ;
577  const bool canSignOnly = maySign && !mustEncrypt ;
578  const bool canEncryptOnly = mayEncrypt && !mustSign ;
579 
580  m_signencrypt.setEnabled( canSignEncrypt );
581  m_encrypt.setEnabled( canEncryptOnly );
582  m_sign.setEnabled( canSignOnly );
583 
584  really_check( m_signencrypt, canSignEncrypt && m_signingPreset && m_encryptionPreset );
585  really_check( m_encrypt, canEncryptOnly && !m_signingPreset && m_encryptionPreset );
586  really_check( m_sign, canSignOnly && m_signingPreset && !m_encryptionPreset );
587 
588  m_signencrypt.setToolTip( protocol() == CMS
589  ? i18n("This operation is not available for S/MIME")
590  : QString() );
591  }
592  private:
593  ObjectsLabel m_objectsLabel;
594  QCheckBox m_archiveCB;
595  QComboBox m_archive;
596  QLabel m_archiveNamePgpLB;
597  ArchiveFileNameRequester m_archiveNamePgp;
598  QLabel m_archiveNameCmsLB;
599  ArchiveFileNameRequester m_archiveNameCms;
600  QRadioButton m_signencrypt, m_encrypt, m_sign;
601  QCheckBox m_armor, m_removeSource;
602  bool m_signingUserMutable, m_encryptionUserMutable, m_archiveUserMutable;
603  bool m_signingPreset, m_encryptionPreset;
604  const std::vector< shared_ptr<ArchiveDefinition> > m_archiveDefinitions;
605  };
606 
607 
608  class RecipientsPage : public WizardPage {
609  Q_OBJECT
610  public:
611  explicit RecipientsPage( QWidget * parent=0 )
612  : WizardPage( parent ),
613  m_lastEffectiveProtocol( static_cast<Protocol>(-1) ), // dummy start
614  m_searchbar( this ),
615  m_unselectedKTV( this ),
616  m_selectPB( i18n("Add"), this ),
617  m_unselectPB( i18n("Remove"), this ),
618  m_selectedKTV( this )
619  {
620  setTitle( i18nc("@title","For whom do you want to encrypt?") );
621  setSubTitle( i18nc("@title",
622  "Please select for whom you want the files to be encrypted. "
623  "Do not forget to pick one of your own certificates.") );
624  // the button may be there or not, the _text_ is static, though:
625  setButtonText( QWizard::CommitButton, i18nc("@action","Encrypt") );
626 
627  KDAB_SET_OBJECT_NAME( m_searchbar );
628  KDAB_SET_OBJECT_NAME( m_unselectedKTV );
629  KDAB_SET_OBJECT_NAME( m_selectPB );
630  KDAB_SET_OBJECT_NAME( m_unselectPB );
631  KDAB_SET_OBJECT_NAME( m_selectedKTV );
632 
633  m_selectPB.setIcon( KIcon( QLatin1String("arrow-down") ) );
634  m_unselectPB.setIcon( KIcon( QLatin1String("arrow-up") ) );
635 
636  m_selectPB.setEnabled( false );
637  m_unselectPB.setEnabled( false );
638 
639  m_unselectedKTV.setHierarchicalModel( AbstractKeyListModel::createHierarchicalKeyListModel( &m_unselectedKTV ) );
640  m_unselectedKTV.setHierarchicalView( true );
641  m_selectedKTV.setFlatModel( AbstractKeyListModel::createFlatKeyListModel( &m_selectedKTV ) );
642  m_selectedKTV.setHierarchicalView( false );
643 
644  QVBoxLayout * vlay = new QVBoxLayout( this );
645  vlay->addWidget( &m_searchbar );
646  vlay->addWidget( &m_unselectedKTV, 1 );
647 
648  QHBoxLayout * hlay = new QHBoxLayout;
649  hlay->addStretch( 1 );
650  hlay->addWidget( &m_selectPB );
651  hlay->addWidget( &m_unselectPB );
652  hlay->addStretch( 1 );
653 
654  vlay->addLayout( hlay );
655  vlay->addWidget( &m_selectedKTV, 1 );
656 
657  xconnect( &m_searchbar, SIGNAL(stringFilterChanged(QString)),
658  &m_unselectedKTV, SLOT(setStringFilter(QString)) );
659  xconnect( &m_searchbar, SIGNAL(keyFilterChanged(boost::shared_ptr<Kleo::KeyFilter>)),
660  &m_unselectedKTV, SLOT(setKeyFilter(boost::shared_ptr<Kleo::KeyFilter>)) );
661 
662  connect( m_unselectedKTV.view()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
663  this, SLOT(slotUnselectedSelectionChanged()) );
664  connect( m_selectedKTV.view()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
665  this, SLOT(slotSelectedSelectionChanged()) );
666 
667  connect( &m_selectPB, SIGNAL(clicked()), this, SLOT(select()) );
668  connect( &m_unselectPB, SIGNAL(clicked()), this, SLOT(unselect()) );
669  }
670 
671  /* reimp */ bool isComplete() const {
672  return !m_selectedKTV.keys().empty();
673  }
674 
675  /* reimp */ int nextId() const {
676  if ( isSigningSelected() )
677  return SignerPageId;
678  else
679  return ResultPageId;
680  }
681 
682  static bool need_reload( Protocol now, Protocol then ) {
683  if ( then == UnknownProtocol )
684  return false;
685  if ( now == UnknownProtocol )
686  return true;
687  return now != then;
688  }
689 
690  static bool need_grep( Protocol now, Protocol then ) {
691  return now != UnknownProtocol && then == UnknownProtocol ;
692  }
693 
694  /* reimp */ void initializePage() {
695 
696  setCommitPage( !isSigningSelected() );
697 
698  const Protocol currentEffectiveProtocol = effectiveProtocol();
699 
700  if ( need_reload( currentEffectiveProtocol, m_lastEffectiveProtocol ) ) {
701  std::vector<Key> keys = KeyCache::instance()->keys();
702  _detail::grep_can_encrypt( keys );
703  if ( currentEffectiveProtocol != UnknownProtocol )
704  _detail::grep_protocol( keys, currentEffectiveProtocol );
705  m_unselectedKTV.setKeys( keys );
706  } else if ( need_grep( currentEffectiveProtocol, m_lastEffectiveProtocol ) ) {
707  remove_all_keys_not_xyz( m_unselectedKTV, currentEffectiveProtocol );
708  remove_all_keys_not_xyz( m_selectedKTV, currentEffectiveProtocol );
709  }
710 
711  m_lastEffectiveProtocol = currentEffectiveProtocol;
712  }
713 
714  /* reimp */ bool validatePage() {
715  const std::vector<Key> & r = keys();
716  if ( _detail::none_of_secret( r ) ) {
717  if ( KMessageBox::warningContinueCancel( this,
718  i18nc("@info",
719  "<para>None of the recipients you are encrypting to seems to be your own.</para>"
720  "<para>This means that you will not be able to decrypt the data anymore, once encrypted.</para>"
721  "<para>Do you want to continue, or cancel to change the recipient selection?</para>"),
722  i18nc("@title:window","Encrypt-To-Self Warning"),
723  KStandardGuiItem::cont(),
724  KStandardGuiItem::cancel(),
725  QLatin1String("warn-encrypt-to-non-self"), KMessageBox::Notify|KMessageBox::Dangerous )
726  == KMessageBox::Cancel )
727  return false;
728  else if ( isRemoveUnencryptedFilesEnabled() )
729  if ( KMessageBox::warningContinueCancel( this,
730  i18nc("@info",
731  "<para>You have requested the unencrypted data to be removed after encryption.</para>"
732  "<para>Are you really sure you do not need to access the data anymore in decrypted form?</para>"),
733  i18nc("@title:window","Encrypt-To-Self Warning"),
734  KStandardGuiItem::cont(),
735  KStandardGuiItem::cancel(),
736  QLatin1String("warn-encrypt-to-non-self-destructive"), KMessageBox::Notify|KMessageBox::Dangerous )
737  == KMessageBox::Cancel )
738  return false;
739  }
740  return true;
741  }
742 
743  const std::vector<Key> & keys() const {
744  return m_selectedKTV.keys();
745  }
746 
747  private Q_SLOTS:
748  void slotUnselectedSelectionChanged() {
749  enable_disable( m_selectPB, m_unselectedKTV.view() );
750  }
751  void slotSelectedSelectionChanged() {
752  enable_disable( m_unselectPB, m_selectedKTV.view() );
753  }
754  void select() {
755  copy_selected_from_to( m_unselectedKTV, m_selectedKTV );
756  emit completeChanged();
757  }
758  void unselect() {
759  move_selected_from_to( m_selectedKTV, m_unselectedKTV );
760  emit completeChanged();
761  }
762 
763  private:
764  Protocol m_lastEffectiveProtocol;
765 
766  SearchBar m_searchbar;
767  KeyTreeView m_unselectedKTV;
768  QPushButton m_selectPB, m_unselectPB;
769  KeyTreeView m_selectedKTV;
770  };
771 
772 
773  class SignerPage : public WizardPage {
774  Q_OBJECT
775  public:
776  explicit SignerPage( QWidget * parent=0 )
777  : WizardPage( parent ),
778  signPref(),
779  pgpCB( i18n("Sign with OpenPGP"), this ),
780  cmsCB( i18n("Sign with S/MIME"), this ),
781  widget( this )
782  {
783  setTitle( i18nc("@title","Who do you want to sign as?") );
784  setSubTitle( i18nc("@title",
785  "Please choose an identity with which to sign the data." ) );
786  // this one is always a commit page
787  setCommitPage( true );
788 
789  QVBoxLayout * vlay = new QVBoxLayout( this );
790 
791  KDAB_SET_OBJECT_NAME( pgpCB );
792  KDAB_SET_OBJECT_NAME( cmsCB );
793  KDAB_SET_OBJECT_NAME( widget );
794  KDAB_SET_OBJECT_NAME( vlay );
795 
796  vlay->addWidget( &pgpCB );
797  vlay->addWidget( &cmsCB );
798 
799  widget.layout()->setMargin( 0 );
800  vlay->addWidget( &widget );
801 
802  // ### connect something to completeChanged()
803  // ### deal with widget.rememberAsDefault()
804 
805  connect( &pgpCB, SIGNAL(toggled(bool)), this, SLOT(slotSignProtocolToggled()) );
806  connect( &cmsCB, SIGNAL(toggled(bool)), this, SLOT(slotSignProtocolToggled()) );
807  }
808 
809  std::vector<Key> keys() const {
810  const QMap<Protocol,Key> keys = widget.selectedCertificates();
811  const bool pgp = pgpCB.isChecked();
812  const bool cms = cmsCB.isChecked();
813 
814  std::vector<Key> result;
815  result.reserve( pgp + cms );
816 
817  if ( pgp )
818  result.push_back( keys[OpenPGP] );
819  if ( cms )
820  result.push_back( keys[CMS] );
821 
822  // remove empty keys, for good measure...
823  result.erase( std::remove_if( result.begin(), result.end(), mem_fn( &Key::isNull ) ),
824  result.end() );
825  return result;
826  }
827 
828  /* reimp */ bool isComplete() const {
829  return !keys().empty();
830  }
831 
832  /* reimp */ int nextId() const {
833  return ResultPageId ;
834  }
835 
836  /* reimp */ void initializePage() {
837 
838  if ( QWizard * wiz = wizard() ) {
839  // need to do this here, since wizard() == 0 in the ctor
840  const NewSignEncryptFilesWizard *filesWizard = qobject_cast<NewSignEncryptFilesWizard*>( wiz );
841  disconnect( filesWizard, SIGNAL(operationPrepared()), this, SLOT(slotCommitSigningPreferences()) );
842  connect( filesWizard, SIGNAL(operationPrepared()), this, SLOT(slotCommitSigningPreferences()) );
843  }
844 
845  bool pgp = effectiveProtocol() == OpenPGP;
846  bool cms = effectiveProtocol() == CMS;
847 
848  if ( effectiveProtocol() == UnknownProtocol )
849  pgp = cms = true;
850 
851  assert( pgp || cms );
852 
853  if ( isSignOnlySelected() ) {
854  // free choice of OpenPGP and/or CMS
855  // (except when protocol() requires otherwise):
856  pgpCB.setEnabled( pgp );
857  cmsCB.setEnabled( cms );
858  pgpCB.setChecked( pgp );
859  cmsCB.setChecked( cms );
860 
861  setButtonText( QWizard::CommitButton, i18nc("@action","Sign") );
862  } else {
863  // we need signing keys for each of protocols that
864  // make up the recipients:
865 
866  const std::vector<Key> & recipients = resolvedRecipients();
867  if ( _detail::none_of_protocol( recipients, OpenPGP ) )
868  pgp = false;
869  if ( _detail::none_of_protocol( recipients, CMS ) )
870  cms = false;
871 
872  pgpCB.setEnabled( false );
873  cmsCB.setEnabled( false );
874  pgpCB.setChecked( pgp );
875  cmsCB.setChecked( cms );
876 
877  setButtonText( QWizard::CommitButton, i18nc("@action","Sign && Encrypt") );
878  }
879 
880  if ( !signPref ) {
881  signPref.reset( new KConfigBasedSigningPreferences( KGlobal::config() ) );
882  widget.setSelectedCertificates( signPref->preferredCertificate( OpenPGP ),
883  signPref->preferredCertificate( CMS ) );
884  }
885  }
886 
887  private:
888  const std::vector<Key> & resolvedRecipients() const {
889  assert( wizard() );
890  assert( qobject_cast<NewSignEncryptFilesWizard*>( wizard() ) == static_cast<NewSignEncryptFilesWizard*>( wizard() ) );
891  return static_cast<NewSignEncryptFilesWizard*>( wizard() )->resolvedRecipients();
892  }
893 
894  private Q_SLOTS:
895  void slotSignProtocolToggled() {
896  widget.setAllowedProtocols( pgpCB.isChecked(), cmsCB.isChecked() );
897  emit completeChanged();
898  }
899 
900  void slotCommitSigningPreferences() {
901  if ( widget.rememberAsDefault() )
902  Q_FOREACH( const GpgME::Key & key, keys() )
903  if ( !key.isNull() )
904  signPref->setPreferredCertificate( key.protocol(), key );
905  }
906 
907  private:
908  shared_ptr<SigningPreferences> signPref;
909  QCheckBox pgpCB, cmsCB;
910  SigningCertificateSelectionWidget widget;
911  };
912 
913 
914  class ResultPage : public NewResultPage {
915  Q_OBJECT
916  public:
917  explicit ResultPage( QWidget * parent=0 )
918  : NewResultPage( parent )
919  {
920  setTitle( i18nc("@title","Results") );
921  setSubTitle( i18nc("@title",
922  "Status and progress of the crypto operations is shown here." ) );
923  }
924 
925  };
926 
927 }
928 
929 class NewSignEncryptFilesWizard::Private {
930  friend class ::Kleo::Crypto::Gui::NewSignEncryptFilesWizard;
931  NewSignEncryptFilesWizard * const q;
932 public:
933  explicit Private( NewSignEncryptFilesWizard * qq )
934  : q( qq ),
935  operationPage( new OperationPage( q ) ),
936  recipientsPage( new RecipientsPage( q ) ),
937  signerPage( new SignerPage( q ) ),
938  resultPage( new ResultPage( q ) ),
939  createArchivePreset( false ),
940  createArchiveUserMutable( true ),
941  signingPreset( true ),
942  signingUserMutable( true ),
943  encryptionPreset( true ),
944  encryptionUserMutable( true )
945  {
946  KDAB_SET_OBJECT_NAME( operationPage );
947  KDAB_SET_OBJECT_NAME( recipientsPage );
948  KDAB_SET_OBJECT_NAME( signerPage );
949  KDAB_SET_OBJECT_NAME( resultPage );
950 
951  q->setPage( OperationPageId, operationPage );
952  q->setPage( RecipientsPageId, recipientsPage );
953  q->setPage( SignerPageId, signerPage );
954  q->setPage( ResultPageId, resultPage );
955 
956  connect( q, SIGNAL(currentIdChanged(int)), q, SLOT(slotCurrentIdChanged(int)) );
957  }
958 
959 private:
960  void slotCurrentIdChanged( int id ) {
961  if ( id == ResultPageId )
962  emit q->operationPrepared();
963  }
964 
965 private:
966  int startId() const {
967  if ( !createArchivePreset && !createArchiveUserMutable ) {
968  if ( signingPreset && !encryptionPreset && !encryptionUserMutable )
969  return SignerPageId;
970  if ( encryptionPreset && !signingPreset && !signingUserMutable ||
971  signingPreset && !signingUserMutable && encryptionPreset && !encryptionUserMutable )
972  return RecipientsPageId;
973  }
974  if ( signingUserMutable || encryptionUserMutable || createArchivePreset || createArchiveUserMutable )
975  return OperationPageId;
976  else
977  if ( encryptionPreset )
978  return RecipientsPageId;
979  else
980  return SignerPageId;
981  }
982  void updateStartId() { q->setStartId( startId() ); }
983 
984 private:
985  OperationPage * operationPage;
986  RecipientsPage * recipientsPage;
987  SignerPage * signerPage;
988  ResultPage * resultPage;
989 
990  bool createArchivePreset : 1;
991  bool createArchiveUserMutable : 1;
992  bool signingPreset : 1;
993  bool signingUserMutable : 1;
994  bool encryptionPreset : 1;
995  bool encryptionUserMutable : 1;
996 };
997 
998 
999 NewSignEncryptFilesWizard::NewSignEncryptFilesWizard( QWidget * parent, Qt::WindowFlags f )
1000  : QWizard( parent, f ), d( new Private( this ) )
1001 {
1002 
1003 }
1004 
1005 NewSignEncryptFilesWizard::~NewSignEncryptFilesWizard() { kDebug(); }
1006 
1007 void NewSignEncryptFilesWizard::setPresetProtocol( Protocol proto ) {
1008  d->operationPage->setPresetProtocol( proto );
1009  d->recipientsPage->setPresetProtocol( proto );
1010  d->signerPage->setPresetProtocol( proto );
1011 }
1012 
1013 void NewSignEncryptFilesWizard::setCreateArchivePreset( bool preset ) {
1014  if ( preset == d->createArchivePreset && preset == isCreateArchiveSelected() )
1015  return;
1016  d->createArchivePreset = preset;
1017  setField( QLatin1String("archive"), preset );
1018  d->updateStartId();
1019 }
1020 
1021 void NewSignEncryptFilesWizard::setCreateArchiveUserMutable( bool mut ) {
1022  if ( mut == d->createArchiveUserMutable )
1023  return;
1024  d->createArchiveUserMutable = mut;
1025  setField( QLatin1String("archive-user-mutable"), mut );
1026  d->updateStartId();
1027 }
1028 
1029 void NewSignEncryptFilesWizard::setArchiveDefinitionId( const QString & id ) {
1030  d->operationPage->setArchiveDefinition( id );
1031 }
1032 
1033 void NewSignEncryptFilesWizard::setSigningPreset( bool preset ) {
1034  if ( preset == d->signingPreset )
1035  return;
1036  d->signingPreset = preset;
1037  setField( QLatin1String("signing-preset"), preset );
1038  d->updateStartId();
1039 }
1040 
1041 void NewSignEncryptFilesWizard::setSigningUserMutable( bool mut ) {
1042  if ( mut == d->signingUserMutable )
1043  return;
1044  d->signingUserMutable = mut;
1045  setField( QLatin1String("signing-user-mutable"), mut );
1046  d->updateStartId();
1047 }
1048 
1049 void NewSignEncryptFilesWizard::setEncryptionPreset( bool preset ) {
1050  if ( preset == d->encryptionPreset )
1051  return;
1052  d->encryptionPreset = preset;
1053  setField( QLatin1String("encryption-preset"), preset );
1054  d->updateStartId();
1055 }
1056 
1057 void NewSignEncryptFilesWizard::setEncryptionUserMutable( bool mut ) {
1058  if ( mut == d->encryptionUserMutable )
1059  return;
1060  d->encryptionUserMutable = mut;
1061  setField( QLatin1String("encryption-user-mutable"), mut );
1062  d->updateStartId();
1063 }
1064 
1065 void NewSignEncryptFilesWizard::setFiles( const QStringList & files ) {
1066  setField( QLatin1String("files"), files );
1067 }
1068 
1069 
1070 bool NewSignEncryptFilesWizard::isSigningSelected() const {
1071  return field(QLatin1String("sign")).toBool() || field(QLatin1String("signencrypt")).toBool() ;
1072 }
1073 
1074 bool NewSignEncryptFilesWizard::isEncryptionSelected() const {
1075  return field(QLatin1String("encrypt")).toBool() || field(QLatin1String("signencrypt")).toBool() ;
1076 }
1077 
1078 bool NewSignEncryptFilesWizard::isAsciiArmorEnabled() const {
1079  return field(QLatin1String("armor")).toBool();
1080 }
1081 
1082 bool NewSignEncryptFilesWizard::isRemoveUnencryptedFilesEnabled() const {
1083  return isEncryptionSelected() && field(QLatin1String("remove")).toBool();
1084 }
1085 
1086 bool NewSignEncryptFilesWizard::isCreateArchiveSelected() const {
1087  return field(QLatin1String("archive")).toBool();
1088 }
1089 
1090 shared_ptr<ArchiveDefinition> NewSignEncryptFilesWizard::selectedArchiveDefinition() const {
1091  return d->operationPage->archiveDefinition();
1092 }
1093 
1094 QString NewSignEncryptFilesWizard::archiveFileName( Protocol p ) const {
1095  return d->/*any page*/operationPage->archiveName( p );
1096 }
1097 
1098 const std::vector<Key> & NewSignEncryptFilesWizard::resolvedRecipients() const {
1099  return d->recipientsPage->keys();
1100 }
1101 
1102 std::vector<Key> NewSignEncryptFilesWizard::resolvedSigners() const {
1103  return d->signerPage->keys();
1104 }
1105 
1106 
1107 void NewSignEncryptFilesWizard::setTaskCollection( const shared_ptr<TaskCollection> & coll ) {
1108  d->resultPage->setTaskCollection( coll );
1109 }
1110 
1111 #include "moc_newsignencryptfileswizard.cpp"
1112 #include "newsignencryptfileswizard.moc"
QWizard::field
QVariant field(const QString &name) const
Kleo::heuristicBaseDirectory
QString heuristicBaseDirectory(const QStringList &files)
Definition: path-helper.cpp:71
copy_selected_from_to
static void copy_selected_from_to(KeyTreeView &from, KeyTreeView &to)
Definition: newsignencryptfileswizard.cpp:101
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::~NewSignEncryptFilesWizard
~NewSignEncryptFilesWizard()
Definition: newsignencryptfileswizard.cpp:1005
Kleo::Crypto::KConfigBasedSigningPreferences
Definition: certificateresolver.h:81
keytreeview.h
QWidget
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setCreateArchiveUserMutable
void setCreateArchiveUserMutable(bool mut)
Definition: newsignencryptfileswizard.cpp:1021
RecipientsPageId
Definition: newsignencryptfileswizard.cpp:89
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::isSigningSelected
bool isSigningSelected() const
Definition: newsignencryptfileswizard.cpp:1070
QMap::erase
iterator erase(iterator pos)
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setSigningPreset
void setSigningPreset(bool preset)
Definition: newsignencryptfileswizard.cpp:1033
xconnect
static void xconnect(const QObject *o1, const char *signal, const QObject *o2, const char *slot)
Definition: tabwidget.cpp:777
Kleo::KeyTreeView::keys
const std::vector< GpgME::Key > & keys() const
Definition: keytreeview.h:75
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::isCreateArchiveSelected
bool isCreateArchiveSelected() const
Definition: newsignencryptfileswizard.cpp:1086
move_selected_from_to
static void move_selected_from_to(KeyTreeView &from, KeyTreeView &to)
Definition: newsignencryptfileswizard.cpp:106
QAbstractItemView
QMap::empty
bool empty() const
remove_all_keys_not_xyz
static void remove_all_keys_not_xyz(KeyTreeView &ktv, Protocol proto)
Definition: newsignencryptfileswizard.cpp:112
Kleo::KeyTreeView
Definition: keytreeview.h:56
QGridLayout::addWidget
void addWidget(QWidget *widget, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
QList::push_back
void push_back(const T &value)
QAbstractItemView::selectionModel
QItemSelectionModel * selectionModel() const
path-helper.h
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setCreateArchivePreset
void setCreateArchivePreset(bool preset)
Definition: newsignencryptfileswizard.cpp:1013
Kleo::_detail::grep_can_encrypt
void grep_can_encrypt(T &t)
Definition: predicates.h:180
QMap
Definition: signingcertificateselectiondialog.h:41
newsignencryptfileswizard.h
QString::size
int size() const
QPointer
Kleo::SearchBar
Definition: searchbar.h:50
QHBoxLayout
ResultPageId
Definition: newsignencryptfileswizard.cpp:91
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setFiles
void setFiles(const QStringList &files)
Definition: newsignencryptfileswizard.cpp:1065
QGridLayout
QListWidget
Kleo::_detail::grep_protocol
void grep_protocol(T &t, GpgME::Protocol proto)
Definition: predicates.h:139
QString::chop
void chop(int n)
Kleo::Crypto::Gui::NewResultPage
Definition: newresultpage.h:56
Kleo::KeyTreeView::addKeysSelected
void addKeysSelected(const std::vector< GpgME::Key > &keys)
Definition: keytreeview.cpp:329
QList::size
int size() const
boost::shared_ptr
Definition: encryptemailcontroller.h:51
QWidget::setEnabled
void setEnabled(bool)
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QString::number
QString number(int n, int base)
d
#define d
Definition: adduseridcommand.cpp:89
Kleo::Class::OpenPGP
Definition: classify.h:49
OperationPageId
Definition: newsignencryptfileswizard.cpp:88
QCheckBox
QItemSelectionModel::hasSelection
bool hasSelection() const
KDAB_SET_OBJECT_NAME
#define KDAB_SET_OBJECT_NAME(x)
Definition: kdtoolsglobal.h:66
QVBoxLayout
QString::endsWith
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
Kleo::Class::CMS
Definition: classify.h:48
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::isAsciiArmorEnabled
bool isAsciiArmorEnabled() const
Definition: newsignencryptfileswizard.cpp:1078
QList::front
T & front()
Kleo::_detail::none_of_secret
bool none_of_secret(const T &t)
Definition: predicates.h:174
QItemSelectionModel::clearSelection
void clearSelection()
QString
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setArchiveDefinitionId
void setArchiveDefinitionId(const QString &id)
Definition: newsignencryptfileswizard.cpp:1029
Kleo::_detail::none_of_protocol
bool none_of_protocol(const T &t, GpgME::Protocol proto)
Definition: predicates.h:154
QStringList
archivedefinition.h
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::archiveFileName
QString archiveFileName(GpgME::Protocol proto) const
Definition: newsignencryptfileswizard.cpp:1094
Kleo::KeyTreeView::selectedKeys
std::vector< GpgME::Key > selectedKeys() const
Definition: keytreeview.cpp:258
QLatin1Char
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::resolvedSigners
std::vector< GpgME::Key > resolvedSigners() const
Definition: newsignencryptfileswizard.cpp:1102
keylistmodel.h
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setSigningUserMutable
void setSigningUserMutable(bool mut)
Definition: newsignencryptfileswizard.cpp:1041
QDir
QItemSelection
Kleo::Crypto::Gui::SigningCertificateSelectionWidget
Definition: signingcertificateselectionwidget.h:51
QAbstractButton
NumPages
Definition: newsignencryptfileswizard.cpp:93
QLatin1String
QBoxLayout::addStretch
void addStretch(int stretch)
QRadioButton
predicates.h
gui-helper.h
searchbar.h
QDialogButtonBox
q
#define q
Definition: adduseridcommand.cpp:90
Kleo::Crypto::Gui::ResultPage
Definition: resultpage.h:53
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setTaskCollection
void setTaskCollection(const boost::shared_ptr< TaskCollection > &coll)
Definition: newsignencryptfileswizard.cpp:1107
QDir::absoluteFilePath
QString absoluteFilePath(const QString &fileName) const
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::isEncryptionSelected
bool isEncryptionSelected() const
Definition: newsignencryptfileswizard.cpp:1074
QList::mid
QList< T > mid(int pos, int length) const
Page
Page
Definition: newsignencryptfileswizard.cpp:87
QVariant::toBool
bool toBool() const
name
const char * name
Definition: uiserver/selectcertificatecommand.cpp:113
QDialog
SignerPageId
Definition: newsignencryptfileswizard.cpp:90
Kleo::KeyTreeView::removeKeys
void removeKeys(const std::vector< GpgME::Key > &keys)
Definition: keytreeview.cpp:337
signingcertificateselectionwidget.h
QPushButton
Qt::WindowFlags
typedef WindowFlags
newresultpage.h
certificateresolver.h
Kleo::Crypto::Gui::NewSignEncryptFilesWizard
Definition: newsignencryptfileswizard.h:71
Kleo::KeyTreeView::view
QTreeView * view() const
Definition: keytreeview.h:64
QWizard::setField
void setField(const QString &name, const QVariant &value)
QWizard
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::isRemoveUnencryptedFilesEnabled
bool isRemoveUnencryptedFilesEnabled() const
Definition: newsignencryptfileswizard.cpp:1082
Kleo::Crypto::Gui::WizardPage
Definition: wizardpage.h:48
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::resolvedRecipients
const std::vector< GpgME::Key > & resolvedRecipients() const
Definition: newsignencryptfileswizard.cpp:1098
keycache.h
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::selectedArchiveDefinition
boost::shared_ptr< ArchiveDefinition > selectedArchiveDefinition() const
Definition: newsignencryptfileswizard.cpp:1090
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setEncryptionPreset
void setEncryptionPreset(bool preset)
Definition: newsignencryptfileswizard.cpp:1049
QItemSelectionModel
QLabel
enable_disable
static void enable_disable(QAbstractButton &button, const QAbstractItemView *view)
Definition: newsignencryptfileswizard.cpp:96
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setEncryptionUserMutable
void setEncryptionUserMutable(bool mut)
Definition: newsignencryptfileswizard.cpp:1057
QWizardPage
join_max
static QString join_max(const QStringList &sl, const int max, const QString &glue)
Definition: newsignencryptfileswizard.cpp:118
Kleo::really_check
static void really_check(QAbstractButton &b, bool on)
Definition: gui-helper.h:39
Kleo::Crypto::Gui::NewSignEncryptFilesWizard::setPresetProtocol
void setPresetProtocol(GpgME::Protocol proto)
Definition: newsignencryptfileswizard.cpp:1007
QBoxLayout::addLayout
void addLayout(QLayout *layout, int stretch)
Kleo::ArchiveDefinition
Definition: archivedefinition.h:57
QComboBox
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

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
  • pimprint

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