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