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