00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "certificatewizard.h"
00013
00014 #include <qvariant.h>
00015 #include <qpushbutton.h>
00016 #include <qwidget.h>
00017 #include <qlabel.h>
00018 #include <qgroupbox.h>
00019 #include <qcombobox.h>
00020 #include <qbuttongroup.h>
00021 #include <qradiobutton.h>
00022 #include <qframe.h>
00023 #include <kurlrequester.h>
00024 #include <qlineedit.h>
00025 #include <qcheckbox.h>
00026 #include <qtextedit.h>
00027 #include <qlayout.h>
00028 #include <qtooltip.h>
00029 #include <qwhatsthis.h>
00030 #include "klineedit.h"
00031 #include "kpushbutton.h"
00032
00033
00034
00035
00036
00037
00038
00039
00040 CertificateWizard::CertificateWizard( QWidget* parent, const char* name, bool modal, WFlags fl )
00041 : KWizard( parent, name, modal, fl )
00042 {
00043 if ( !name )
00044 setName( "CertificateWizard" );
00045 QFont f( font() );
00046 f.setPointSize( 16 );
00047 f.setBold( TRUE );
00048 setTitleFont( f );
00049
00050 introPage = new QWidget( this, "introPage" );
00051 introPageLayout = new QVBoxLayout( introPage, 11, 6, "introPageLayout");
00052
00053 TextLabel1 = new QLabel( introPage, "TextLabel1" );
00054 introPageLayout->addWidget( TextLabel1 );
00055 spacer3 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
00056 introPageLayout->addItem( spacer3 );
00057 addPage( introPage, QString("") );
00058
00059 WizardPage = new QWidget( this, "WizardPage" );
00060 WizardPageLayout = new QVBoxLayout( WizardPage, 11, 6, "WizardPageLayout");
00061
00062 TextLabel2_2 = new QLabel( WizardPage, "TextLabel2_2" );
00063 TextLabel2_2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
00064 WizardPageLayout->addWidget( TextLabel2_2 );
00065 spacer14 = new QSpacerItem( 20, 31, QSizePolicy::Minimum, QSizePolicy::Expanding );
00066 WizardPageLayout->addItem( spacer14 );
00067
00068 groupBox1 = new QGroupBox( WizardPage, "groupBox1" );
00069 groupBox1->setColumnLayout(0, Qt::Vertical );
00070 groupBox1->layout()->setSpacing( 6 );
00071 groupBox1->layout()->setMargin( 11 );
00072 groupBox1Layout = new QHBoxLayout( groupBox1->layout() );
00073 groupBox1Layout->setAlignment( Qt::AlignTop );
00074
00075 textLabel1 = new QLabel( groupBox1, "textLabel1" );
00076 groupBox1Layout->addWidget( textLabel1 );
00077
00078 keyLengthCB = new QComboBox( FALSE, groupBox1, "keyLengthCB" );
00079 groupBox1Layout->addWidget( keyLengthCB );
00080 spacer13 = new QSpacerItem( 61, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00081 groupBox1Layout->addItem( spacer13 );
00082 WizardPageLayout->addWidget( groupBox1 );
00083
00084 certTypeBG = new QButtonGroup( WizardPage, "certTypeBG" );
00085 certTypeBG->setColumnLayout(0, Qt::Vertical );
00086 certTypeBG->layout()->setSpacing( 6 );
00087 certTypeBG->layout()->setMargin( 11 );
00088 certTypeBGLayout = new QVBoxLayout( certTypeBG->layout() );
00089 certTypeBGLayout->setAlignment( Qt::AlignTop );
00090
00091 signOnlyCB = new QRadioButton( certTypeBG, "signOnlyCB" );
00092 certTypeBGLayout->addWidget( signOnlyCB );
00093
00094 encryptOnlyCB = new QRadioButton( certTypeBG, "encryptOnlyCB" );
00095 certTypeBGLayout->addWidget( encryptOnlyCB );
00096
00097 bothCB = new QRadioButton( certTypeBG, "bothCB" );
00098 bothCB->setChecked( TRUE );
00099 certTypeBGLayout->addWidget( bothCB );
00100 WizardPageLayout->addWidget( certTypeBG );
00101 spacer12 = new QSpacerItem( 21, 60, QSizePolicy::Minimum, QSizePolicy::Expanding );
00102 WizardPageLayout->addItem( spacer12 );
00103 addPage( WizardPage, QString("") );
00104
00105 personalDataPage = new QWidget( this, "personalDataPage" );
00106 personalDataPageLayout = new QGridLayout( personalDataPage, 1, 1, 11, 6, "personalDataPageLayout");
00107
00108 TextLabel2 = new QLabel( personalDataPage, "TextLabel2" );
00109 TextLabel2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
00110
00111 personalDataPageLayout->addMultiCellWidget( TextLabel2, 0, 0, 0, 1 );
00112 spacer6 = new QSpacerItem( 440, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00113 personalDataPageLayout->addItem( spacer6, 4, 0 );
00114
00115 insertAddressButton = new QPushButton( personalDataPage, "insertAddressButton" );
00116
00117 personalDataPageLayout->addWidget( insertAddressButton, 4, 1 );
00118 spacer4 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
00119 personalDataPageLayout->addItem( spacer4, 1, 0 );
00120
00121 edContainer = new QFrame( personalDataPage, "edContainer" );
00122 edContainer->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, edContainer->sizePolicy().hasHeightForWidth() ) );
00123 edContainer->setFrameShape( QFrame::StyledPanel );
00124 edContainer->setFrameShadow( QFrame::Sunken );
00125
00126 personalDataPageLayout->addMultiCellWidget( edContainer, 2, 2, 0, 1 );
00127 addPage( personalDataPage, QString("") );
00128
00129 generatePage = new QWidget( this, "generatePage" );
00130 generatePageLayout = new QGridLayout( generatePage, 1, 1, 11, 6, "generatePageLayout");
00131
00132 TextLabel4 = new QLabel( generatePage, "TextLabel4" );
00133 TextLabel4->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
00134
00135 generatePageLayout->addMultiCellWidget( TextLabel4, 0, 0, 0, 2 );
00136 spacer5 = new QSpacerItem( 21, 31, QSizePolicy::Minimum, QSizePolicy::Expanding );
00137 generatePageLayout->addMultiCell( spacer5, 1, 1, 0, 1 );
00138
00139 ButtonGroup7 = new QButtonGroup( generatePage, "ButtonGroup7" );
00140 ButtonGroup7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, 0, 0, ButtonGroup7->sizePolicy().hasHeightForWidth() ) );
00141 ButtonGroup7->setColumnLayout(0, Qt::Vertical );
00142 ButtonGroup7->layout()->setSpacing( 6 );
00143 ButtonGroup7->layout()->setMargin( 11 );
00144 ButtonGroup7Layout = new QGridLayout( ButtonGroup7->layout() );
00145 ButtonGroup7Layout->setAlignment( Qt::AlignTop );
00146
00147 storeUR = new KURLRequester( ButtonGroup7, "storeUR" );
00148
00149 ButtonGroup7Layout->addWidget( storeUR, 0, 1 );
00150
00151 storeInFileRB = new QRadioButton( ButtonGroup7, "storeInFileRB" );
00152
00153 ButtonGroup7Layout->addWidget( storeInFileRB, 0, 0 );
00154
00155 sendToCARB = new QRadioButton( ButtonGroup7, "sendToCARB" );
00156 sendToCARB->setChecked( TRUE );
00157
00158 ButtonGroup7Layout->addWidget( sendToCARB, 1, 0 );
00159
00160 caEmailED = new QLineEdit( ButtonGroup7, "caEmailED" );
00161
00162 ButtonGroup7Layout->addWidget( caEmailED, 1, 1 );
00163
00164 brokenCA = new QCheckBox( ButtonGroup7, "brokenCA" );
00165
00166 ButtonGroup7Layout->addMultiCellWidget( brokenCA, 2, 2, 0, 1 );
00167
00168 generatePageLayout->addMultiCellWidget( ButtonGroup7, 2, 2, 0, 2 );
00169
00170 generatePB = new QPushButton( generatePage, "generatePB" );
00171 generatePB->setMinimumSize( QSize( 0, 30 ) );
00172
00173 generatePageLayout->addWidget( generatePB, 3, 1 );
00174 Spacer12 = new QSpacerItem( 118, 16, QSizePolicy::Expanding, QSizePolicy::Minimum );
00175 generatePageLayout->addItem( Spacer12, 3, 2 );
00176 Spacer13 = new QSpacerItem( 119, 16, QSizePolicy::Expanding, QSizePolicy::Minimum );
00177 generatePageLayout->addItem( Spacer13, 3, 0 );
00178 addPage( generatePage, QString("") );
00179
00180 finishPage = new QWidget( this, "finishPage" );
00181 finishPageLayout = new QVBoxLayout( finishPage, 11, 6, "finishPageLayout");
00182
00183 TextLabel7 = new QLabel( finishPage, "TextLabel7" );
00184 TextLabel7->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
00185 finishPageLayout->addWidget( TextLabel7 );
00186
00187 certificateTE = new QTextEdit( finishPage, "certificateTE" );
00188 certificateTE->setReadOnly( TRUE );
00189 finishPageLayout->addWidget( certificateTE );
00190 addPage( finishPage, QString("") );
00191 languageChange();
00192 resize( QSize(832, 589).expandedTo(minimumSizeHint()) );
00193 clearWState( WState_Polished );
00194
00195
00196 connect( generatePB, SIGNAL( clicked() ), this, SLOT( slotGenerateCertificate() ) );
00197 connect( sendToCARB, SIGNAL( toggled(bool) ), caEmailED, SLOT( setEnabled(bool) ) );
00198 connect( storeInFileRB, SIGNAL( toggled(bool) ), storeUR, SLOT( setEnabled(bool) ) );
00199 connect( caEmailED, SIGNAL( textChanged(const QString&) ), this, SLOT( slotEmailAddressChanged(const QString&) ) );
00200 connect( sendToCARB, SIGNAL( clicked() ), caEmailED, SLOT( setFocus() ) );
00201 connect( storeInFileRB, SIGNAL( clicked() ), storeUR, SLOT( setFocus() ) );
00202
00203
00204 setTabOrder( sendToCARB, caEmailED );
00205 setTabOrder( caEmailED, certificateTE );
00206 setTabOrder( certificateTE, generatePB );
00207
00208
00209 textLabel1->setBuddy( keyLengthCB );
00210 }
00211
00212
00213
00214
00215 CertificateWizard::~CertificateWizard()
00216 {
00217
00218 }
00219
00220
00221
00222
00223
00224 void CertificateWizard::languageChange()
00225 {
00226 setCaption( tr2i18n( "Key Generation Wizard" ) );
00227 TextLabel1->setText( tr2i18n( "<b>Welcome to the Key Generation Wizard.</b>\n"
00228 "<br>\n"
00229 "<br>\n"
00230 "In a few easy steps, this wizard will help you to create a new key pair and request a certificate for it. You can then use your certificate in order to sign messages, to encrypt messages and to decrypt messages that other people send to you in encrypted form.\n"
00231 "<p>\n"
00232 "The key pair will be generated in a decentralized manner. Please contact your local help desk if you are unsure how to obtain a certificate for your new key in your organization." ) );
00233 setTitle( introPage, tr2i18n( "Key Generation Wizard" ) );
00234 TextLabel2_2->setText( tr2i18n( "On this page, you will configure the cryptographic key length and the type of certificate to create." ) );
00235 groupBox1->setTitle( tr2i18n( "Cryptographic Key Length" ) );
00236 textLabel1->setText( tr2i18n( "Choose &key length:" ) );
00237 certTypeBG->setTitle( tr2i18n( "Certificate Usage" ) );
00238 signOnlyCB->setText( tr2i18n( "For &signing only" ) );
00239 encryptOnlyCB->setText( tr2i18n( "For &encrypting only" ) );
00240 bothCB->setText( tr2i18n( "For signing &and encrypting" ) );
00241 setTitle( WizardPage, tr2i18n( "Key Parameters" ) );
00242 TextLabel2->setText( tr2i18n( "On this page, you will enter some personal data that will be stored in your certificate and that will help other people to determine that it is actually you who is sending a message." ) );
00243 insertAddressButton->setText( tr2i18n( "&Insert My Address" ) );
00244 QToolTip::add( insertAddressButton, tr2i18n( "This will insert your address if you have set the \"Who am I\" information in the address book" ) );
00245 setTitle( personalDataPage, tr2i18n( "Your Personal Data" ) );
00246 TextLabel4->setText( tr2i18n( "<qt><p>On this page, you will create a key pair in a decentralized way.\n"
00247 "</p><p>You can either store the certificate request in a file for later transmission or \n"
00248 "send it to the Certificate Authority (CA) directly. Please check with \n"
00249 "your local help desk if you are unsure what to select here.</p><p>\n"
00250 "Once you are done with your settings, click \n"
00251 "<em>Generate Key Pair and Certificate Request</em> in order to generate your key pair and a corresponding certificate request.</p>\n"
00252 "<p><b>Note:</b> if you choose to send via email directly, \n"
00253 "a kmail composer will be opened; you can add detailed information for the CA\n"
00254 "there.</p><qt>" ) );
00255 ButtonGroup7->setTitle( tr2i18n( "Certificate Request Options" ) );
00256 storeInFileRB->setText( tr2i18n( "&Store in a file:" ) );
00257 sendToCARB->setText( tr2i18n( "Send to CA as an &email message:" ) );
00258 brokenCA->setText( tr2i18n( "Add email to DN in request for broken CAs" ) );
00259 generatePB->setText( tr2i18n( "&Generate Key Pair && Certificate Request" ) );
00260 setTitle( generatePage, tr2i18n( "Decentralized Key Generation" ) );
00261 TextLabel7->setText( tr2i18n( "<qt>\n"
00262 "Your key pair has now been created and stored locally. The corresponding certificate request is now ready to be sent to the CA (certification authority) which will generate a certificate for you and send it back via email (unless you have selected storage in a file). Please review the certificate details shown below.\n"
00263 "<p>\n"
00264 "If you want to change anything, press Back and make your changes; otherwise, press Finish to send the certificate request to the CA.\n"
00265 "</qt>" ) );
00266 setTitle( finishPage, tr2i18n( "Your Certificate Request is Ready to Be Sent" ) );
00267 }
00268
00269 void CertificateWizard::slotEmailAddressChanged(const QString&)
00270 {
00271 qWarning( "CertificateWizard::slotEmailAddressChanged(const QString&): Not implemented yet" );
00272 }
00273
00274 void CertificateWizard::slotGenerateCertificate()
00275 {
00276 qWarning( "CertificateWizard::slotGenerateCertificate(): Not implemented yet" );
00277 }
00278
00279 #include "certificatewizard.moc"