kmail Library API Documentation

cryptplugconfigdialog.cpp

00001 00002 #ifdef HAVE_CONFIG_H 00003 #include <config.h> 00004 #endif 00005 00006 #include "cryptplugconfigdialog.h" 00007 00008 #include "signatureconfigurationdialogimpl.h" 00009 #include "encryptionconfigurationdialogimpl.h" 00010 #include "directoryservicesconfigurationdialogimpl.h" 00011 00012 #include <cryptplugwrapper.h> 00013 00014 #include <klocale.h> 00015 #include <kdebug.h> 00016 #include <kconfig.h> 00017 #include <kprocess.h> 00018 #include <kmessagebox.h> 00019 00020 #include <qradiobutton.h> 00021 #include <qcheckbox.h> 00022 #include <qlistview.h> 00023 #include <qspinbox.h> 00024 #include <qcombobox.h> 00025 #include <qvbox.h> 00026 #include <qlayout.h> 00027 #include <qpushbutton.h> 00028 00029 #include <cassert> 00030 #include "kmkernel.h" 00031 00032 CryptPlugConfigDialog::CryptPlugConfigDialog( CryptPlugWrapper * wrapper, 00033 int plugno, const QString & caption, 00034 QWidget * parent, 00035 const char * name, bool modal ) 00036 : KDialogBase( Tabbed, caption, Ok|Cancel|User1, Ok, parent, name, modal, 00037 false /* no <hr> */, i18n("Start Certificate &Manager") ), 00038 mWrapper( wrapper ), mPluginNumber( plugno ) 00039 { 00040 // addVBoxPage( i18n("Directory Services") ) 00041 mDirServiceTab = new DirectoryServicesConfigurationDialogImpl( this ); 00042 mDirServiceTab->hide(); 00043 mSignatureTab = new SignatureConfigurationDialogImpl( addVBoxPage( i18n("&Signature Configuration") ) ); 00044 mSignatureTab->layout()->setMargin( 0 ); 00045 mEncryptionTab = new EncryptionConfigurationDialogImpl( addVBoxPage( i18n("&Encryption Configuration") ) ); 00046 mEncryptionTab->layout()->setMargin( 0 ); 00047 00048 connect( actionButton( User1 ), SIGNAL(clicked()), 00049 SLOT(slotStartCertManager()) ); 00050 00051 setPluginInformation(); 00052 } 00053 00054 00055 void CryptPlugConfigDialog::slotOk() { 00056 assert( mWrapper ); 00057 00058 KConfig* config = KMKernel::config(); 00059 KConfigGroupSaver saver(config, "General"); 00060 00061 // Set the right config group 00062 config->setGroup( QString( "CryptPlug #%1" ).arg( mPluginNumber ) ); 00063 00064 00065 /* 00066 int numEntry = _generalPage->plugList->childCount(); 00067 QListViewItem *item = _generalPage->plugList->firstChild(); 00068 int i = 0; 00069 int curI = -1; 00070 for (i = 0; i < numEntry; ++i) { 00071 QString itemTxt( pluginNameToNumberedItem( item->text(0), 1+i ) ); 00072 mWrapper = _pluginPage->mCryptPlugList->next(), ++i ) { 00073 if( ! mWrapper->displayName().isEmpty() ) { 00074 QString item = pluginNameToNumberedItem( mWrapper->displayName(), 1+i ); 00075 _pluginPage->_certificatesPage->plugListBoxCertConf->insertItem( item ); 00076 _pluginPage->_signaturePage->plugListBoxSignConf->insertItem( item ); 00077 _pluginPage->_encryptionPage->plugListBoxEncryptConf->insertItem( item ); 00078 _pluginPage->_dirservicesPage->plugListBoxDirServConf->insertItem( item ); 00079 00080 */ 00081 00082 00083 00084 // The signature tab - everything here needs to be written both 00085 // into config and into the crypt plug mWrapper. 00086 00087 // Sign Messages group box 00088 if( mSignatureTab->signAllPartsRB->isChecked() ) { 00089 mWrapper->setSignEmail( SignEmail_SignAll ); 00090 config->writeEntry( "SignEmail", SignEmail_SignAll ); 00091 } else if( mSignatureTab->askEachPartRB->isChecked() ) { 00092 mWrapper->setSignEmail( SignEmail_Ask ); 00093 config->writeEntry( "SignEmail", SignEmail_Ask ); 00094 } else { 00095 mWrapper->setSignEmail( SignEmail_DontSign ); 00096 config->writeEntry( "SignEmail", SignEmail_DontSign ); 00097 } 00098 bool warnSendUnsigned = mSignatureTab->warnUnsignedCB->isChecked(); 00099 mWrapper->setWarnSendUnsigned( warnSendUnsigned ); 00100 config->writeEntry( "WarnSendUnsigned", warnSendUnsigned ); 00101 00102 // Signature Compound Mode group box 00103 if( mSignatureTab->sendSigOpaqueRB->isChecked() ) { 00104 mWrapper->setSignatureCompoundMode( SignatureCompoundMode_Opaque ); 00105 config->writeEntry( "SignatureCompoundMode", SignatureCompoundMode_Opaque ); 00106 } else if( mSignatureTab->sendSigMultiPartRB->isChecked() ) { 00107 mWrapper->setSignatureCompoundMode( SignatureCompoundMode_Detached); 00108 config->writeEntry( "SignatureCompoundMode", SignatureCompoundMode_Detached ); 00109 } else { 00110 mWrapper->setSignatureCompoundMode( SignatureCompoundMode_undef ); 00111 config->writeEntry( "SignatureCompoundMode", SignatureCompoundMode_undef ); 00112 } 00113 00114 // Sending Certificates group box 00115 if( mSignatureTab->dontSendCertificatesRB->isChecked() ) { 00116 mWrapper->setSendCertificates( SendCert_DontSend ); 00117 config->writeEntry( "SendCerts", SendCert_DontSend ); 00118 } else if( mSignatureTab->sendYourOwnCertificateRB->isChecked() ) { 00119 mWrapper->setSendCertificates( SendCert_SendOwn ); 00120 config->writeEntry( "SendCerts", SendCert_SendOwn ); 00121 } else if( mSignatureTab->sendChainWithoutRootRB->isChecked() ) { 00122 mWrapper->setSendCertificates( SendCert_SendChainWithoutRoot ); 00123 config->writeEntry( "SendCerts", SendCert_SendChainWithoutRoot ); 00124 } else { 00125 mWrapper->setSendCertificates( SendCert_SendChainWithRoot ); 00126 config->writeEntry( "SendCerts", SendCert_SendChainWithRoot ); 00127 } 00128 00129 // Signature Settings group box 00130 QString sigAlgoStr = mSignatureTab->signatureAlgorithmCO->currentText(); 00131 SignatureAlgorithm sigAlgo = SignAlg_SHA1; 00132 if( sigAlgoStr == "RSA + SHA-1" ) 00133 sigAlgo = SignAlg_SHA1; 00134 else 00135 kdDebug(5006) << "Unknown signature algorithm " << sigAlgoStr << endl; 00136 mWrapper->setSignatureAlgorithm( sigAlgo ); 00137 config->writeEntry( "SigAlgo", sigAlgo ); 00138 00139 bool warnSigCertExp = mSignatureTab->warnSignatureCertificateExpiresCB->isChecked(); 00140 mWrapper->setSignatureCertificateExpiryNearWarning( warnSigCertExp ); 00141 config->writeEntry( "SigCertWarnNearExpire", warnSigCertExp ); 00142 00143 int warnSigCertExpInt = mSignatureTab->warnSignatureCertificateExpiresSB->value(); 00144 mWrapper->setSignatureCertificateExpiryNearInterval( warnSigCertExpInt ); 00145 config->writeEntry( "SigCertWarnNearExpireInt", warnSigCertExpInt ); 00146 00147 bool warnCACertExp = mSignatureTab->warnCACertificateExpiresCB->isChecked(); 00148 mWrapper->setCACertificateExpiryNearWarning( warnCACertExp ); 00149 config->writeEntry( "CACertWarnNearExpire", warnCACertExp ); 00150 00151 int warnCACertExpInt = mSignatureTab->warnCACertificateExpiresSB->value(); 00152 mWrapper->setCACertificateExpiryNearInterval( warnCACertExpInt ); 00153 config->writeEntry( "CACertWarnNearExpireInt", warnCACertExpInt ); 00154 00155 bool warnRootCertExp = mSignatureTab->warnRootCertificateExpiresCB->isChecked(); 00156 mWrapper->setRootCertificateExpiryNearWarning( warnRootCertExp ); 00157 config->writeEntry( "RootCertWarnNearExpire", warnRootCertExp ); 00158 00159 int warnRootCertExpInt = mSignatureTab->warnRootCertificateExpiresSB->value(); 00160 mWrapper->setRootCertificateExpiryNearInterval( warnRootCertExpInt ); 00161 config->writeEntry( "RootCertWarnNearExpireInt", warnRootCertExpInt ); 00162 00163 bool warnNoCertificate = mSignatureTab->warnAddressNotInCertificateCB->isChecked(); 00164 mWrapper->setWarnNoCertificate( warnNoCertificate ); 00165 config->writeEntry( "WarnEmailNotInCert", warnNoCertificate ); 00166 00167 // PIN Entry group box 00168 if( mSignatureTab->pinOncePerSessionRB->isChecked() ) { 00169 mWrapper->setNumPINRequests( PinRequest_OncePerSession ); 00170 config->writeEntry( "NumPINRequests", PinRequest_OncePerSession ); 00171 } else if( mSignatureTab->pinAlwaysRB->isChecked() ) { 00172 mWrapper->setNumPINRequests( PinRequest_Always ); 00173 config->writeEntry( "NumPINRequests", PinRequest_Always ); 00174 } else if( mSignatureTab->pinAddCertificatesRB->isChecked() ) { 00175 mWrapper->setNumPINRequests( PinRequest_WhenAddingCerts ); 00176 config->writeEntry( "NumPINRequests", PinRequest_WhenAddingCerts ); 00177 } else if( mSignatureTab->pinAlwaysWhenSigningRB->isChecked() ) { 00178 mWrapper->setNumPINRequests( PinRequest_AlwaysWhenSigning ); 00179 config->writeEntry( "NumPINRequests", PinRequest_AlwaysWhenSigning ); 00180 } else { 00181 mWrapper->setNumPINRequests( PinRequest_AfterMinutes ); 00182 config->writeEntry( "NumPINRequests", PinRequest_AfterMinutes ); 00183 } 00184 int pinInt = mSignatureTab->pinIntervalSB->value(); 00185 mWrapper->setNumPINRequestsInterval( pinInt ); 00186 config->writeEntry( "NumPINRequestsInt", pinInt ); 00187 00188 // Save Messages group box 00189 bool saveSigs = mSignatureTab->saveSentSigsCB->isChecked(); 00190 mWrapper->setSaveSentSignatures( saveSigs ); 00191 config->writeEntry( "SaveSentSigs", saveSigs ); 00192 00193 // The encryption tab - everything here needs to be written both 00194 // into config and into the crypt plug wrapper. 00195 00196 // Encrypt Messages group box 00197 if( mEncryptionTab->encryptAllPartsRB->isChecked() ) { 00198 mWrapper->setEncryptEmail( EncryptEmail_EncryptAll ); 00199 config->writeEntry( "EncryptEmail", EncryptEmail_EncryptAll ); 00200 } else if( mEncryptionTab->askEachPartRB->isChecked() ) { 00201 mWrapper->setEncryptEmail( EncryptEmail_Ask ); 00202 config->writeEntry( "EncryptEmail", EncryptEmail_Ask ); 00203 } else { 00204 mWrapper->setEncryptEmail( EncryptEmail_DontEncrypt ); 00205 config->writeEntry( "EncryptEmail", EncryptEmail_DontEncrypt ); 00206 } 00207 bool warnSendUnencrypted = mEncryptionTab->warnUnencryptedCB->isChecked(); 00208 mWrapper->setWarnSendUnencrypted( warnSendUnencrypted ); 00209 config->writeEntry( "WarnSendUnencrypted", warnSendUnencrypted ); 00210 00211 bool alwaysEncryptToSelf = mEncryptionTab->alwaysEncryptToSelfCB->isChecked(); 00212 mWrapper->setAlwaysEncryptToSelf( alwaysEncryptToSelf ); 00213 config->writeEntry( "AlwaysEncryptToSelf", alwaysEncryptToSelf ); 00214 00215 // Encryption Settings group box 00216 QString encAlgoStr = mEncryptionTab->encryptionAlgorithmCO->currentText(); 00217 EncryptionAlgorithm encAlgo = EncryptAlg_RSA; 00218 if( encAlgoStr == "RSA" ) 00219 encAlgo = EncryptAlg_RSA; 00220 else if( encAlgoStr == "Triple-DES" ) 00221 encAlgo = EncryptAlg_TripleDES; 00222 else if( encAlgoStr == "SHA-1" ) 00223 encAlgo = EncryptAlg_SHA1; 00224 else 00225 kdDebug(5006) << "Unknown encryption algorithm " << encAlgoStr << endl; 00226 mWrapper->setEncryptionAlgorithm( encAlgo ); 00227 config->writeEntry( "EncryptAlgo", encAlgo ); 00228 00229 bool recvCertExp = mEncryptionTab->warnReceiverCertificateExpiresCB->isChecked(); 00230 mWrapper->setReceiverCertificateExpiryNearWarning( recvCertExp ); 00231 config->writeEntry( "WarnRecvCertNearExpire", recvCertExp ); 00232 00233 int recvCertExpInt = mEncryptionTab->warnReceiverCertificateExpiresSB->value(); 00234 mWrapper->setReceiverCertificateExpiryNearWarningInterval( recvCertExpInt ); 00235 config->writeEntry( "WarnRecvCertNearExpireInt", recvCertExpInt ); 00236 00237 bool certChainExp = mEncryptionTab->warnChainCertificateExpiresCB->isChecked(); 00238 mWrapper->setCertificateInChainExpiryNearWarning( certChainExp ); 00239 config->writeEntry( "WarnCertInChainNearExpire", certChainExp ); 00240 00241 int certChainExpInt = mEncryptionTab->warnChainCertificateExpiresSB->value(); 00242 mWrapper->setCertificateInChainExpiryNearWarningInterval( certChainExpInt ); 00243 config->writeEntry( "WarnCertInChainNearExpireInt", certChainExpInt ); 00244 00245 bool recvNotInCert = mEncryptionTab->warnReceiverNotInCertificateCB->isChecked(); 00246 mWrapper->setReceiverEmailAddressNotInCertificateWarning( recvNotInCert ); 00247 config->writeEntry( "WarnRecvAddrNotInCert", recvNotInCert ); 00248 00249 // CRL group box 00250 bool useCRL = mEncryptionTab->useCRLsCB->isChecked(); 00251 mWrapper->setEncryptionUseCRLs( useCRL ); 00252 config->writeEntry( "EncryptUseCRLs", useCRL ); 00253 00254 bool warnCRLExp = mEncryptionTab->warnCRLExpireCB->isChecked(); 00255 mWrapper->setEncryptionCRLExpiryNearWarning( warnCRLExp ); 00256 config->writeEntry( "EncryptCRLWarnNearExpire", warnCRLExp ); 00257 00258 int warnCRLExpInt = mEncryptionTab->warnCRLExpireSB->value(); 00259 mWrapper->setEncryptionCRLNearExpiryInterval( warnCRLExpInt ); 00260 config->writeEntry( "EncryptCRLWarnNearExpireInt", warnCRLExpInt ); 00261 00262 // Save Messages group box 00263 bool saveEnc = mEncryptionTab->storeEncryptedCB->isChecked(); 00264 mWrapper->setSaveMessagesEncrypted( saveEnc ); 00265 config->writeEntry( "SaveMsgsEncrypted", saveEnc ); 00266 00267 // Certificate Path Check group box 00268 bool checkPath = mEncryptionTab->checkCertificatePathCB->isChecked(); 00269 mWrapper->setCheckCertificatePath( checkPath ); 00270 config->writeEntry( "CheckCertPath", checkPath ); 00271 00272 bool checkToRoot = mEncryptionTab->alwaysCheckRootRB->isChecked(); 00273 mWrapper->setCheckEncryptionCertificatePathToRoot( checkToRoot ); 00274 config->writeEntry( "CheckEncryptCertToRoot", checkToRoot ); 00275 00276 // The directory services tab - everything here needs to be written both 00277 // into config and into the crypt plug wrapper. 00278 00279 uint numDirServers = mDirServiceTab->x500LV->childCount(); 00280 CryptPlugWrapper::DirectoryServer* servers = new CryptPlugWrapper::DirectoryServer[numDirServers]; 00281 config->writeEntry( "NumDirServers", numDirServers ); 00282 QListViewItemIterator lvit( mDirServiceTab->x500LV ); 00283 QListViewItem* current; 00284 int pos = 0; 00285 while( ( current = lvit.current() ) ) { 00286 ++lvit; 00287 const char* servername = current->text( 0 ).utf8(); 00288 int port = current->text( 1 ).toInt(); 00289 const char* description = current->text( 2 ).utf8(); 00290 servers[pos].servername = new char[strlen( servername )+1]; 00291 strcpy( servers[pos].servername, servername ); 00292 servers[pos].port = port; 00293 servers[pos].description = new char[strlen( description)+1]; 00294 strcpy( servers[pos].description, description ); 00295 config->writeEntry( QString( "DirServer%1Name" ).arg( pos ), 00296 current->text( 0 ) ); 00297 config->writeEntry( QString( "DirServer%1Port" ).arg( pos ), 00298 port ); 00299 config->writeEntry( QString( "DirServer%1Descr" ).arg( pos ), 00300 current->text( 2 ) ); 00301 pos++; 00302 } 00303 mWrapper->setDirectoryServers( servers, numDirServers ); 00304 for( uint i = 0; i < numDirServers; i++ ) { 00305 delete[] servers[i].servername; 00306 delete[] servers[i].description; 00307 } 00308 delete[] servers; 00309 00310 // Local/Remote Certificates group box 00311 if( mDirServiceTab->firstLocalThenDSCertRB->isChecked() ) { 00312 mWrapper->setCertificateSource( CertSrc_ServerLocal ); 00313 config->writeEntry( "CertSource", CertSrc_ServerLocal ); 00314 } else if( mDirServiceTab->localOnlyCertRB->isChecked() ) { 00315 mWrapper->setCertificateSource( CertSrc_Local ); 00316 config->writeEntry( "CertSource", CertSrc_Local ); 00317 } else { 00318 mWrapper->setCertificateSource( CertSrc_Server ); 00319 config->writeEntry( "CertSource", CertSrc_Server ); 00320 } 00321 00322 // Local/Remote CRLs group box 00323 if( mDirServiceTab->firstLocalThenDSCRLRB->isChecked() ) { 00324 mWrapper->setCRLSource( CertSrc_ServerLocal ); 00325 config->writeEntry( "CRLSource", CertSrc_ServerLocal ); 00326 } else if( mDirServiceTab->localOnlyCRLRB->isChecked() ) { 00327 mWrapper->setCRLSource( CertSrc_Local ); 00328 config->writeEntry( "CRLSource", CertSrc_Local ); 00329 } else { 00330 mWrapper->setCRLSource( CertSrc_Server ); 00331 config->writeEntry( "CRLSource", CertSrc_Server ); 00332 } 00333 00334 accept(); 00335 } 00336 00337 00338 void CryptPlugConfigDialog::setPluginInformation() { 00339 assert( mWrapper ); 00340 00341 // Enable/disable the fields in the dialog pages 00342 // according to the plugin capabilities. 00343 mSignatureTab->enableDisable( mWrapper ); 00344 mEncryptionTab->enableDisable( mWrapper ); 00345 mDirServiceTab->enableDisable( mWrapper ); 00346 00347 // Fill the fields of the tab pages with the data from 00348 // the current plugin. 00349 00350 // Signature tab 00351 00352 // Sign Messages group box 00353 switch( mWrapper->signEmail() ) { 00354 case SignEmail_SignAll: 00355 mSignatureTab->signAllPartsRB->setChecked( true ); 00356 break; 00357 case SignEmail_Ask: 00358 mSignatureTab->askEachPartRB->setChecked( true ); 00359 break; 00360 case SignEmail_DontSign: 00361 mSignatureTab->dontSignRB->setChecked( true ); 00362 break; 00363 default: 00364 kdDebug( 5006 ) << "Unknown email sign setting" << endl; 00365 }; 00366 mSignatureTab->warnUnsignedCB->setChecked( mWrapper->warnSendUnsigned() ); 00367 00368 // Compound Mode group box 00369 switch( mWrapper->signatureCompoundMode() ) { 00370 case SignatureCompoundMode_Opaque: 00371 mSignatureTab->sendSigOpaqueRB->setChecked( true ); 00372 break; 00373 case SignatureCompoundMode_Detached: 00374 mSignatureTab->sendSigMultiPartRB->setChecked( true ); 00375 break; 00376 default: 00377 mSignatureTab->sendSigMultiPartRB->setChecked( true ); 00378 kdDebug( 5006 ) << "Unknown signature compound mode setting, default set to multipart/signed" << endl; 00379 }; 00380 00381 // Sending Certificates group box 00382 switch( mWrapper->sendCertificates() ) { 00383 case SendCert_DontSend: 00384 mSignatureTab->dontSendCertificatesRB->setChecked( true ); 00385 break; 00386 case SendCert_SendOwn: 00387 mSignatureTab->sendYourOwnCertificateRB->setChecked( true ); 00388 break; 00389 case SendCert_SendChainWithoutRoot: 00390 mSignatureTab->sendChainWithoutRootRB->setChecked( true ); 00391 break; 00392 case SendCert_SendChainWithRoot: 00393 mSignatureTab->sendChainWithRootRB->setChecked( true ); 00394 break; 00395 default: 00396 kdDebug( 5006 ) << "Unknown send certificate setting" << endl; 00397 } 00398 00399 // Signature Settings group box 00400 SignatureAlgorithm sigAlgo = mWrapper->signatureAlgorithm(); 00401 QString sigAlgoStr; 00402 switch( sigAlgo ) { 00403 case SignAlg_SHA1: 00404 sigAlgoStr = "SHA1"; 00405 break; 00406 default: 00407 kdDebug( 5006 ) << "Unknown signature algorithm" << endl; 00408 }; 00409 00410 for( int i = 0; i < mSignatureTab->signatureAlgorithmCO->count(); ++i ) 00411 if( mSignatureTab->signatureAlgorithmCO->text( i ) == 00412 sigAlgoStr ) { 00413 mSignatureTab->signatureAlgorithmCO->setCurrentItem( i ); 00414 break; 00415 } 00416 00417 mSignatureTab->warnSignatureCertificateExpiresCB->setChecked( mWrapper->signatureCertificateExpiryNearWarning() ); 00418 mSignatureTab->warnSignatureCertificateExpiresSB->setValue( mWrapper->signatureCertificateExpiryNearInterval() ); 00419 mSignatureTab->warnCACertificateExpiresCB->setChecked( mWrapper->caCertificateExpiryNearWarning() ); 00420 mSignatureTab->warnCACertificateExpiresSB->setValue( mWrapper->caCertificateExpiryNearInterval() ); 00421 mSignatureTab->warnRootCertificateExpiresCB->setChecked( mWrapper->rootCertificateExpiryNearWarning() ); 00422 mSignatureTab->warnRootCertificateExpiresSB->setValue( mWrapper->rootCertificateExpiryNearInterval() ); 00423 00424 mSignatureTab->warnAddressNotInCertificateCB->setChecked( mWrapper->warnNoCertificate() ); 00425 00426 // PIN Entry group box 00427 switch( mWrapper->numPINRequests() ) { 00428 case PinRequest_OncePerSession: 00429 mSignatureTab->pinOncePerSessionRB->setChecked( true ); 00430 break; 00431 case PinRequest_Always: 00432 mSignatureTab->pinAlwaysRB->setChecked( true ); 00433 break; 00434 case PinRequest_WhenAddingCerts: 00435 mSignatureTab->pinAddCertificatesRB->setChecked( true ); 00436 break; 00437 case PinRequest_AlwaysWhenSigning: 00438 mSignatureTab->pinAlwaysWhenSigningRB->setChecked( true ); 00439 break; 00440 case PinRequest_AfterMinutes: 00441 mSignatureTab->pinIntervalRB->setChecked( true ); 00442 break; 00443 default: 00444 kdDebug( 5006 ) << "Unknown pin request setting" << endl; 00445 }; 00446 00447 mSignatureTab->pinIntervalSB->setValue( mWrapper->numPINRequestsInterval() ); 00448 00449 // Save Messages group box 00450 mSignatureTab->saveSentSigsCB->setChecked( mWrapper->saveSentSignatures() ); 00451 00452 // The Encryption tab 00453 00454 // Encrypt Messages group box 00455 switch( mWrapper->encryptEmail() ) { 00456 case EncryptEmail_EncryptAll: 00457 mEncryptionTab->encryptAllPartsRB->setChecked( true ); 00458 break; 00459 case EncryptEmail_Ask: 00460 mEncryptionTab->askEachPartRB->setChecked( true ); 00461 break; 00462 case EncryptEmail_DontEncrypt: 00463 mEncryptionTab->dontEncryptRB->setChecked( true ); 00464 break; 00465 default: 00466 kdDebug( 5006 ) << "Unknown email encryption setting" << endl; 00467 }; 00468 mEncryptionTab->warnUnencryptedCB->setChecked( mWrapper->warnSendUnencrypted() ); 00469 mEncryptionTab->alwaysEncryptToSelfCB->setChecked( mWrapper->alwaysEncryptToSelf() ); 00470 00471 // Encryption Settings group box 00472 QString encAlgoStr; 00473 switch( mWrapper->encryptionAlgorithm() ) { 00474 case EncryptAlg_RSA: 00475 encAlgoStr = "RSA"; 00476 break; 00477 case EncryptAlg_TripleDES: 00478 encAlgoStr = "Triple-DES"; 00479 break; 00480 case EncryptAlg_SHA1: 00481 encAlgoStr = "SHA-1"; 00482 break; 00483 default: 00484 kdDebug( 5006 ) << "Unknown encryption algorithm" << endl; 00485 }; 00486 00487 for( int i = 0; i < mEncryptionTab->encryptionAlgorithmCO->count(); ++i ) 00488 if( mEncryptionTab->encryptionAlgorithmCO->text( i ) == encAlgoStr ) { 00489 mEncryptionTab->encryptionAlgorithmCO->setCurrentItem( i ); 00490 break; 00491 } 00492 00493 mEncryptionTab->warnReceiverCertificateExpiresCB->setChecked( mWrapper->receiverCertificateExpiryNearWarning() ); 00494 mEncryptionTab->warnReceiverCertificateExpiresSB->setValue( mWrapper->receiverCertificateExpiryNearWarningInterval() ); 00495 mEncryptionTab->warnChainCertificateExpiresCB->setChecked( mWrapper->certificateInChainExpiryNearWarning() ); 00496 mEncryptionTab->warnChainCertificateExpiresSB->setValue( mWrapper->certificateInChainExpiryNearWarningInterval() ); 00497 mEncryptionTab->warnReceiverNotInCertificateCB->setChecked( mWrapper->receiverEmailAddressNotInCertificateWarning() ); 00498 00499 // CRL group box 00500 mEncryptionTab->useCRLsCB->setChecked( mWrapper->encryptionUseCRLs() ); 00501 mEncryptionTab->warnCRLExpireCB->setChecked( mWrapper->encryptionCRLExpiryNearWarning() ); 00502 mEncryptionTab->warnCRLExpireSB->setValue( mWrapper->encryptionCRLNearExpiryInterval() ); 00503 00504 // Save Messages group box 00505 mEncryptionTab->storeEncryptedCB->setChecked( mWrapper->saveMessagesEncrypted() ); 00506 00507 // Certificate Path Check group box 00508 mEncryptionTab->checkCertificatePathCB->setChecked( mWrapper->checkCertificatePath() ); 00509 if( mWrapper->checkEncryptionCertificatePathToRoot() ) 00510 mEncryptionTab->alwaysCheckRootRB->setChecked( true ); 00511 else 00512 mEncryptionTab->pathMayEndLocallyCB->setChecked( true ); 00513 00514 // Directory Services tab page 00515 00516 int numServers; 00517 CryptPlugWrapper::DirectoryServer* servers = mWrapper->directoryServers( &numServers ); 00518 if( servers ) { 00519 QListViewItem* previous = 0; 00520 for( int i = 0; i < numServers; i++ ) { 00521 previous = new QListViewItem( mDirServiceTab->x500LV, 00522 previous, 00523 QString::fromUtf8( servers[i].servername ), 00524 QString::number( servers[i].port ), 00525 QString::fromUtf8( servers[i].description ) ); 00526 } 00527 } 00528 00529 // Local/Remote Certificates group box 00530 switch( mWrapper->certificateSource() ) { 00531 case CertSrc_ServerLocal: 00532 mDirServiceTab->firstLocalThenDSCertRB->setChecked( true ); 00533 break; 00534 case CertSrc_Local: 00535 mDirServiceTab->localOnlyCertRB->setChecked( true ); 00536 break; 00537 case CertSrc_Server: 00538 mDirServiceTab->dsOnlyCertRB->setChecked( true ); 00539 break; 00540 default: 00541 kdDebug( 5006 ) << "Unknown certificate source" << endl; 00542 } 00543 00544 // Local/Remote CRL group box 00545 switch( mWrapper->crlSource() ) { 00546 case CertSrc_ServerLocal: 00547 mDirServiceTab->firstLocalThenDSCRLRB->setChecked( true ); 00548 break; 00549 case CertSrc_Local: 00550 mDirServiceTab->localOnlyCRLRB->setChecked( true ); 00551 break; 00552 case CertSrc_Server: 00553 mDirServiceTab->dsOnlyCRLRB->setChecked( true ); 00554 break; 00555 default: 00556 kdDebug( 5006 ) << "Unknown certificate source" << endl; 00557 } 00558 } 00559 00560 void CryptPlugConfigDialog::slotStartCertManager() { 00561 assert( mWrapper ); 00562 00563 KProcess certManagerProc; // save to create on the heap, since 00564 // there is no parent 00565 certManagerProc << "kgpgcertmanager"; 00566 certManagerProc << mWrapper->displayName(); 00567 certManagerProc << mWrapper->libName(); 00568 00569 if( !certManagerProc.start( KProcess::DontCare ) ) 00570 KMessageBox::error( this, i18n( "Could not start certificate manager. Please check your installation!" ), 00571 i18n( "KMail Error" ) ); 00572 else 00573 kdDebug(5006) << "\nCertificatesPage::slotStartCertManager(): certificate manager started.\n" << endl; 00574 // process continues to run even after the KProcess object goes 00575 // out of scope here, since it is started in DontCare run mode. 00576 } 00577 00578 00579 #include "cryptplugconfigdialog.moc"
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:58 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003