certmanager

certificatewizard.cpp

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