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