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