33 #include <config-kleopatra.h> 
   53 #include <kleo/stl_util.h> 
   54 #include <ui/filenamerequester.h> 
   56 #include <KLocalizedString> 
   59 #include <KMessageBox> 
   61 #include <QVBoxLayout> 
   63 #include <QWizardPage> 
   64 #include <QRadioButton> 
   66 #include <QPushButton> 
   67 #include <QDialogButtonBox> 
   68 #include <QListWidget> 
   74 #include <gpgme++/key.h> 
   77 #include <boost/shared_ptr.hpp> 
   78 #include <boost/bind.hpp> 
   81 using namespace GpgME;
 
   82 using namespace boost;
 
   84 using namespace Kleo::Crypto;
 
   85 using namespace Kleo::Crypto::Gui;
 
  113     const std::vector<Key> k
 
  114         = kdtools::copy_if< std::vector<Key> >( ktv.
keys(), boost::bind( &Key::protocol, _1 ) != proto );
 
  126     class ListDialog : 
public QDialog {
 
  135             setWindowTitle( i18nc(
"@title:window",
"Selected Files") );
 
  141             listWidget.setSelectionMode( QListWidget::NoSelection );
 
  142             listWidget.addItems( files );
 
  144             hlay.addWidget( &listWidget );
 
  145             hlay.addWidget( &buttonBox );
 
  147             connect( &buttonBox, SIGNAL(rejected()), 
this, SLOT(reject()) );
 
  160     class ObjectsLabel : 
public QLabel {
 
  162         Q_PROPERTY( 
QStringList files READ files WRITE setFiles )
 
  164         static const int MaxLinesShownInline = 5;
 
  167             : 
QLabel( parent, f ), m_dialog(), m_files( dummyFiles() )
 
  169             connect( 
this, SIGNAL(linkActivated(
QString)),
 
  170                      this, SLOT(slotLinkActivated()) );
 
  178             : 
QLabel( parent, f ), m_dialog(), m_files( files )
 
  180             connect( 
this, SIGNAL(linkActivated(
QString)),
 
  181                      this, SLOT(slotLinkActivated()) );
 
  187             if ( m_files == files )
 
  194         void slotLinkActivated() {
 
  196                 m_dialog = 
new ListDialog( m_files, 
this );
 
  197                 m_dialog->setAttribute( Qt::WA_DeleteOnClose );
 
  199             if ( m_dialog->isVisible() )
 
  208             for ( 
int i = 0 ; i < MaxLinesShownInline+1 ; ++i )
 
  213             if ( m_files.empty() )
 
  217             if ( m_files.size() > MaxLinesShownInline )
 
  221         void updateText() { setText( makeText() ); }
 
  232     class ArchiveFileNameRequester : 
public Kleo::FileNameRequester {
 
  235         explicit ArchiveFileNameRequester( Protocol protocol, 
QWidget * parent=0 )
 
  236             : FileNameRequester( 
QDir::Files, parent ), m_protocol( protocol ), m_archiveDefinition()
 
  238             setExistingOnly( 
false );
 
  243             if ( ad == m_archiveDefinition )
 
  245             const QString oldExt = m_archiveDefinition ? m_archiveDefinition->extensions( m_protocol ).front() : 
QString() ;
 
  246             const QString newExt = ad                  ? ad->extensions( m_protocol ).front()                  : 
QString() ;
 
  250             m_archiveDefinition = ad;
 
  253             FileNameRequester::setFileName( fn );
 
  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 );
 
  260                 FileNameRequester::setFileName( fn );
 
  263         const Protocol m_protocol;
 
  274               m_presetProtocol( UnknownProtocol )
 
  279         bool isArchiveRequested()
 const {
 
  283         QString archiveName( Protocol p )
 const {
 
  287         bool isRemoveUnencryptedFilesEnabled()
 const {
 
  291         bool isSignOnlySelected()
 const {
 
  295         bool isEncryptOnlySelected()
 const {
 
  299         bool isSignEncryptSelected()
 const {
 
  303         bool isSigningSelected()
 const {
 
  304             return isSignOnlySelected() || isSignEncryptSelected() ;
 
  307         bool isEncryptionSelected()
 const {
 
  308             return isEncryptOnlySelected() || isSignEncryptSelected() ;
 
  311         Protocol protocol()
 const { 
return m_presetProtocol; }
 
  312         Protocol effectiveProtocol()
 const {
 
  313             if ( isSignEncryptSelected() ) {
 
  314                 assert( m_presetProtocol == 
OpenPGP || m_presetProtocol == UnknownProtocol );
 
  317                 return m_presetProtocol;
 
  321         void setPresetProtocol( Protocol proto ) {
 
  322             if ( proto == m_presetProtocol )
 
  324             m_presetProtocol = proto;
 
  325             doSetPresetProtocol();
 
  329         virtual void doSetPresetProtocol() {}
 
  332         Protocol m_presetProtocol;
 
  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 )
 
  345         explicit OperationPage( 
QWidget * parent=0 )
 
  347               m_objectsLabel( this ),
 
  348               m_archiveCB( i18n(
"Archive files with:"), 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 ),
 
  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.") );
 
  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 );
 
  400             m_archiveNamePgpLB.setAlignment( Qt::AlignRight );
 
  401             m_archiveNamePgpLB.setBuddy( &m_archiveNamePgp );
 
  402             m_archiveNameCmsLB.setAlignment( Qt::AlignRight );
 
  403             m_archiveNameCmsLB.setBuddy( &m_archiveNameCms );
 
  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 );
 
  413                 m_archive.addItem( ad->label(), qVariantFromValue( ad ) );
 
  417             registerField( 
QLatin1String("signing-preset"), this, "signingPreset" );
 
  418             registerField( 
QLatin1String("encryption-preset"), this, "encryptionPreset" );
 
  420             registerField( 
QLatin1String("signencrypt"), &m_signencrypt );
 
  429             registerField( 
QLatin1String("archive-
name-pgp"), &m_archiveNamePgp, "fileName" );
 
  430             registerField( 
QLatin1String("archive-
name-cms"), &m_archiveNameCms, "fileName" );
 
  432             registerField( 
QLatin1String("signing-user-mutable"), this, "signingUserMutable" );
 
  433             registerField( 
QLatin1String("encryption-user-mutable"), this, "encryptionUserMutable" );
 
  434             registerField( 
QLatin1String("archive-user-mutable"), this, "archiveUserMutable" );
 
  436             connect( &m_archive, SIGNAL(currentIndexChanged(
int)),
 
  437                      this, SLOT(slotArchiveDefinitionChanged()) );
 
  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()) );
 
  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)) );
 
  460             m_archiveNamePgp.setArchiveDefinition( ad );
 
  461             m_archiveNameCms.setArchiveDefinition( ad );
 
  464         QStringList files()
 const { 
return m_objectsLabel.files(); }
 
  466             m_objectsLabel.setFiles( files );
 
  467             const QString archiveName =
 
  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 );
 
  475         bool isSigningPreset()
 const { 
return m_signingPreset; }
 
  476         void setSigningPreset( 
bool preset ) {
 
  477             if ( m_signingPreset == preset )
 
  479             m_signingPreset = preset;
 
  480             updateSignEncryptArchiveWidgetStates();
 
  483         bool isSigningUserMutable()
 const { 
return m_signingUserMutable; }
 
  484         void setSigningUserMutable( 
bool mut ) {
 
  485             if ( m_signingUserMutable == mut )
 
  487             m_signingUserMutable = mut;
 
  488             updateSignEncryptArchiveWidgetStates();
 
  491         bool isEncryptionPreset()
 const { 
return m_encryptionPreset; }
 
  492         void setEncryptionPreset( 
bool preset ) {
 
  493             if ( m_encryptionPreset == preset )
 
  495             m_encryptionPreset = preset;
 
  496             updateSignEncryptArchiveWidgetStates();
 
  499         bool isEncryptionUserMutable()
 const { 
return m_encryptionUserMutable; }
 
  500         void setEncryptionUserMutable( 
bool mut ) {
 
  501             if ( m_encryptionUserMutable == mut )
 
  503             m_encryptionUserMutable = mut;
 
  504             updateSignEncryptArchiveWidgetStates();
 
  507         bool isArchiveUserMutable()
 const { 
return m_archiveUserMutable; }
 
  508         void setArchiveUserMutable( 
bool mut ) {
 
  509             if ( m_archiveUserMutable == mut )
 
  511             m_archiveUserMutable = mut;
 
  512             updateSignEncryptArchiveWidgetStates();
 
  515          bool isComplete()
 const {
 
  516             return ( !isArchiveRequested() || !archiveName( 
OpenPGP ).isEmpty() && !archiveName( 
CMS ).isEmpty() ) 
 
  517                 && ( isSigningSelected() || isEncryptionSelected() ) ;
 
  520          bool validatePage() {
 
  521             if ( isSignOnlySelected() && isArchiveRequested() )
 
  522                 return KMessageBox::warningContinueCancel( 
this,
 
  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 ;
 
  540          void doSetPresetProtocol() {
 
  541             updateSignEncryptArchiveWidgetStates();
 
  549             m_archive.setCurrentIndex( m_archive.findData( qVariantFromValue( ad ) ) );
 
  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() );
 
  560         void slotArchiveDefinitionChanged() {
 
  562             m_archiveNamePgp.setArchiveDefinition( ad );
 
  563             m_archiveNameCms.setArchiveDefinition( ad );
 
  567         void updateSignEncryptArchiveWidgetStates() {
 
  568             m_archiveCB.setEnabled( m_archiveUserMutable );
 
  570             const bool mustEncrypt = m_encryptionPreset && !m_encryptionUserMutable ;
 
  571             const bool mustSign    = m_signingPreset    && !m_signingUserMutable    ;
 
  573             const bool mayEncrypt  = m_encryptionPreset || m_encryptionUserMutable  ;
 
  574             const bool maySign     = m_signingPreset    || m_signingUserMutable     ;
 
  576             const bool canSignEncrypt = protocol() != 
CMS && mayEncrypt && maySign ;
 
  577             const bool canSignOnly    = maySign && !mustEncrypt ;
 
  578             const bool canEncryptOnly = mayEncrypt && !mustSign ;
 
  580             m_signencrypt.setEnabled( canSignEncrypt );
 
  581             m_encrypt.setEnabled( canEncryptOnly );
 
  582             m_sign.setEnabled( canSignOnly );
 
  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 );
 
  588             m_signencrypt.setToolTip( protocol() == 
CMS 
  589                                       ? i18n(
"This operation is not available for S/MIME")
 
  593         ObjectsLabel m_objectsLabel;
 
  596         QLabel m_archiveNamePgpLB;
 
  597         ArchiveFileNameRequester m_archiveNamePgp;
 
  598         QLabel m_archiveNameCmsLB;
 
  599         ArchiveFileNameRequester m_archiveNameCms;
 
  602         bool m_signingUserMutable, m_encryptionUserMutable, m_archiveUserMutable;
 
  603         bool m_signingPreset, m_encryptionPreset;
 
  604         const std::vector< shared_ptr<ArchiveDefinition> > m_archiveDefinitions;
 
  611         explicit RecipientsPage( 
QWidget * parent=0 )
 
  613               m_lastEffectiveProtocol( static_cast<Protocol>(-1) ), 
 
  615               m_unselectedKTV( this ),
 
  616               m_selectPB( i18n(
"Add"), this ),
 
  617               m_unselectPB( i18n(
"Remove"), this ),
 
  618               m_selectedKTV( this )
 
  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.") );
 
  625             setButtonText( QWizard::CommitButton, i18nc(
"@action",
"Encrypt") );
 
  636             m_selectPB.setEnabled( 
false );
 
  637             m_unselectPB.setEnabled( 
false );
 
  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 );
 
  657             xconnect( &m_searchbar, SIGNAL(stringFilterChanged(QString)),
 
  658                       &m_unselectedKTV, SLOT(setStringFilter(QString)) );
 
  663                      this, SLOT(slotUnselectedSelectionChanged()) );
 
  665                      this, SLOT(slotSelectedSelectionChanged()) );
 
  667             connect( &m_selectPB, SIGNAL(clicked()), 
this, SLOT(select()) );
 
  668             connect( &m_unselectPB, SIGNAL(clicked()), 
this, SLOT(unselect()) );
 
  671          bool isComplete()
 const {
 
  672             return !m_selectedKTV.keys().empty();
 
  676             if ( isSigningSelected() )
 
  682         static bool need_reload( Protocol now, Protocol then ) {
 
  683             if ( then == UnknownProtocol )
 
  685             if ( now == UnknownProtocol )
 
  690         static bool need_grep( Protocol now, Protocol then ) {
 
  691             return now != UnknownProtocol && then == UnknownProtocol ;
 
  694          void initializePage() {
 
  696             setCommitPage( !isSigningSelected() );
 
  698             const Protocol currentEffectiveProtocol = effectiveProtocol();
 
  700             if ( need_reload( currentEffectiveProtocol, m_lastEffectiveProtocol ) ) {
 
  701                 std::vector<Key> keys = KeyCache::instance()->keys();
 
  703                 if ( currentEffectiveProtocol != UnknownProtocol )
 
  705                 m_unselectedKTV.setKeys( keys );
 
  706             } 
else if ( need_grep( currentEffectiveProtocol, m_lastEffectiveProtocol ) ) {
 
  711             m_lastEffectiveProtocol = currentEffectiveProtocol;
 
  714          bool validatePage() {
 
  715             const std::vector<Key> & r = keys();
 
  717                 if ( KMessageBox::warningContinueCancel( 
this,
 
  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 )
 
  728                 else if ( isRemoveUnencryptedFilesEnabled() )
 
  729                     if ( KMessageBox::warningContinueCancel( 
this,
 
  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 )
 
  743         const std::vector<Key> & keys()
 const {
 
  744             return m_selectedKTV.keys();
 
  748         void slotUnselectedSelectionChanged() {
 
  751         void slotSelectedSelectionChanged() {
 
  756             emit completeChanged();
 
  760             emit completeChanged();
 
  764         Protocol m_lastEffectiveProtocol;
 
  776         explicit SignerPage( 
QWidget * parent=0 )
 
  779               pgpCB( i18n(
"Sign with OpenPGP"), this ),
 
  780               cmsCB( i18n(
"Sign with S/MIME"), this ),
 
  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." ) );
 
  787             setCommitPage( 
true );
 
  799             widget.layout()->setMargin( 0 );
 
  805             connect( &pgpCB, SIGNAL(toggled(
bool)), 
this, SLOT(slotSignProtocolToggled()) );
 
  806             connect( &cmsCB, SIGNAL(toggled(
bool)), 
this, SLOT(slotSignProtocolToggled()) );
 
  809         std::vector<Key> keys()
 const {
 
  811             const bool pgp = pgpCB.isChecked();
 
  812             const bool cms = cmsCB.isChecked();
 
  814             std::vector<Key> result;
 
  815             result.reserve( pgp + cms );
 
  818                 result.push_back( keys[
OpenPGP] );
 
  820                 result.push_back( keys[
CMS] );
 
  823             result.
erase( std::remove_if( result.begin(), result.end(), mem_fn( &Key::isNull ) ),
 
  828          bool isComplete()
 const {
 
  829             return !keys().
empty();
 
  836          void initializePage() {
 
  838             if ( 
QWizard * wiz = wizard() ) {
 
  841                 disconnect( filesWizard, SIGNAL(operationPrepared()), 
this, SLOT(slotCommitSigningPreferences()) );
 
  842                 connect( filesWizard, SIGNAL(operationPrepared()), 
this, SLOT(slotCommitSigningPreferences()) );
 
  845             bool pgp = effectiveProtocol() == 
OpenPGP;
 
  846             bool cms = effectiveProtocol() == 
CMS;
 
  848             if ( effectiveProtocol() == UnknownProtocol )
 
  851             assert( pgp || cms );
 
  853             if ( isSignOnlySelected() ) {
 
  856                 pgpCB.setEnabled( pgp );
 
  857                 cmsCB.setEnabled( cms );
 
  858                 pgpCB.setChecked( pgp );
 
  859                 cmsCB.setChecked( cms );
 
  861                 setButtonText( QWizard::CommitButton, i18nc(
"@action",
"Sign") );
 
  866                 const std::vector<Key> & recipients = resolvedRecipients();
 
  872                 pgpCB.setEnabled( 
false );
 
  873                 cmsCB.setEnabled( 
false );
 
  874                 pgpCB.setChecked( pgp );
 
  875                 cmsCB.setChecked( cms );
 
  877                 setButtonText( QWizard::CommitButton, i18nc(
"@action",
"Sign && Encrypt") );
 
  882                 widget.setSelectedCertificates( signPref->preferredCertificate( OpenPGP ),
 
  883                                                 signPref->preferredCertificate( CMS ) );
 
  888         const std::vector<Key> & resolvedRecipients()
 const {
 
  890             assert( qobject_cast<NewSignEncryptFilesWizard*>( wizard() ) == static_cast<NewSignEncryptFilesWizard*>( wizard() ) );
 
  895         void slotSignProtocolToggled() {
 
  896             widget.setAllowedProtocols( pgpCB.isChecked(), cmsCB.isChecked() );
 
  897             emit completeChanged();
 
  900         void slotCommitSigningPreferences() {
 
  901             if ( widget.rememberAsDefault() )
 
  902                 Q_FOREACH( 
const GpgME::Key & key, keys() )
 
  904                         signPref->setPreferredCertificate( key.protocol(), key );
 
  920             setTitle( i18nc(
"@title",
"Results") );
 
  921             setSubTitle( i18nc(
"@title",
 
  922                                "Status and progress of the crypto operations is shown here." ) );
 
  929 class NewSignEncryptFilesWizard::Private {
 
  930     friend class ::Kleo::Crypto::Gui::NewSignEncryptFilesWizard;
 
  935           operationPage( new OperationPage( 
q ) ),
 
  936           recipientsPage( new RecipientsPage( 
q ) ),
 
  937           signerPage( new SignerPage( 
q ) ),
 
  939           createArchivePreset( false ),
 
  940           createArchiveUserMutable( true ),
 
  941           signingPreset( true ),
 
  942           signingUserMutable( true ),
 
  943           encryptionPreset( true ),
 
  944           encryptionUserMutable( true )
 
  956         connect( 
q, SIGNAL(currentIdChanged(
int)), 
q, SLOT(slotCurrentIdChanged(
int)) );
 
  960     void slotCurrentIdChanged( 
int id ) {
 
  962             emit 
q->operationPrepared();
 
  966     int startId()
 const {
 
  967         if ( !createArchivePreset && !createArchiveUserMutable ) {
 
  968             if ( signingPreset && !encryptionPreset && !encryptionUserMutable )
 
  970             if ( encryptionPreset && !signingPreset && !signingUserMutable ||
 
  971                  signingPreset && !signingUserMutable && encryptionPreset && !encryptionUserMutable )
 
  974         if ( signingUserMutable || encryptionUserMutable || createArchivePreset || createArchiveUserMutable )
 
  977             if ( encryptionPreset )
 
  982     void updateStartId() { 
q->setStartId( startId() ); }
 
  985     OperationPage  * operationPage;
 
  986     RecipientsPage * recipientsPage;
 
  987     SignerPage     * signerPage;
 
  990     bool createArchivePreset      : 1;
 
  991     bool createArchiveUserMutable : 1;
 
  992     bool signingPreset         : 1;
 
  993     bool signingUserMutable    : 1;
 
  994     bool encryptionPreset      : 1;
 
  995     bool encryptionUserMutable : 1;
 
 1000     : 
QWizard( parent, f ), 
d( new Private( this ) )
 
 1008     d->operationPage->setPresetProtocol( proto );
 
 1009     d->recipientsPage->setPresetProtocol( proto );
 
 1010     d->signerPage->setPresetProtocol( proto );
 
 1016     d->createArchivePreset = preset;
 
 1022     if ( mut == d->createArchiveUserMutable )
 
 1024     d->createArchiveUserMutable = mut;
 
 1030     d->operationPage->setArchiveDefinition( 
id );
 
 1034     if ( preset == d->signingPreset )
 
 1036     d->signingPreset = preset;
 
 1042     if ( mut == d->signingUserMutable )
 
 1044     d->signingUserMutable = mut;
 
 1050     if ( preset == d->encryptionPreset )
 
 1052     d->encryptionPreset = preset;
 
 1058     if ( mut == d->encryptionUserMutable )
 
 1060     d->encryptionUserMutable = mut;
 
 1091     return d->operationPage->archiveDefinition();
 
 1095     return d->operationPage->archiveName( p );
 
 1099     return d->recipientsPage->keys();
 
 1103     return d->signerPage->keys();
 
 1108     d->resultPage->setTaskCollection( coll );
 
 1111 #include "moc_newsignencryptfileswizard.cpp" 
 1112 #include "newsignencryptfileswizard.moc" 
QVariant field(const QString &name) const
QString heuristicBaseDirectory(const QStringList &files)
static void copy_selected_from_to(KeyTreeView &from, KeyTreeView &to)
~NewSignEncryptFilesWizard()
void setCreateArchiveUserMutable(bool mut)
bool isSigningSelected() const 
iterator erase(iterator pos)
void setSigningPreset(bool preset)
const std::vector< GpgME::Key > & keys() const 
bool isCreateArchiveSelected() const 
static void move_selected_from_to(KeyTreeView &from, KeyTreeView &to)
static void remove_all_keys_not_xyz(KeyTreeView &ktv, Protocol proto)
void push_back(const T &value)
QItemSelectionModel * selectionModel() const
void setCreateArchivePreset(bool preset)
void grep_can_encrypt(T &t)
void setFiles(const QStringList &files)
void grep_protocol(T &t, GpgME::Protocol proto)
void addKeysSelected(const std::vector< GpgME::Key > &keys)
QString number(int n, int base)
bool hasSelection() const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
bool isAsciiArmorEnabled() const 
bool none_of_secret(const T &t)
void setArchiveDefinitionId(const QString &id)
bool none_of_protocol(const T &t, GpgME::Protocol proto)
QString archiveFileName(GpgME::Protocol proto) const 
std::vector< GpgME::Key > selectedKeys() const 
std::vector< GpgME::Key > resolvedSigners() const 
void setSigningUserMutable(bool mut)
void addStretch(int stretch)
void setTaskCollection(const boost::shared_ptr< TaskCollection > &coll)
QString absoluteFilePath(const QString &fileName) const
bool isEncryptionSelected() const 
QList< T > mid(int pos, int length) const
void removeKeys(const std::vector< GpgME::Key > &keys)
void setField(const QString &name, const QVariant &value)
bool isRemoveUnencryptedFilesEnabled() const 
const std::vector< GpgME::Key > & resolvedRecipients() const 
boost::shared_ptr< ArchiveDefinition > selectedArchiveDefinition() const 
void setEncryptionPreset(bool preset)
static void enable_disable(QAbstractButton &button, const QAbstractItemView *view)
void setEncryptionUserMutable(bool mut)
static QString join_max(const QStringList &sl, const int max, const QString &glue)
static void really_check(QAbstractButton &b, bool on)
void setPresetProtocol(GpgME::Protocol proto)
void addLayout(QLayout *layout, int stretch)