diff options
Diffstat (limited to 'certmanager/certificatewizardimpl.cpp')
-rw-r--r-- | certmanager/certificatewizardimpl.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/certmanager/certificatewizardimpl.cpp b/certmanager/certificatewizardimpl.cpp index a88c54d84..bb31d5c3e 100644 --- a/certmanager/certificatewizardimpl.cpp +++ b/certmanager/certificatewizardimpl.cpp @@ -64,14 +64,14 @@ #include <kio/netaccess.h> // Qt -#include <qlineedit.h> -#include <qtextedit.h> -#include <qpushbutton.h> -#include <qcheckbox.h> -#include <qradiobutton.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qcombobox.h> +#include <tqlineedit.h> +#include <tqtextedit.h> +#include <tqpushbutton.h> +#include <tqcheckbox.h> +#include <tqradiobutton.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqcombobox.h> #include <assert.h> #include <dcopref.h> @@ -81,10 +81,10 @@ static const unsigned int keyLengths[] = { }; static const unsigned int numKeyLengths = sizeof keyLengths / sizeof *keyLengths; -static QString attributeLabel( const QString & attr, bool required ) { +static TQString attributeLabel( const TQString & attr, bool required ) { if ( attr.isEmpty() ) - return QString::null; - const QString label = Kleo::DNAttributeMapper::instance()->name2label( attr ); + return TQString::null; + const TQString label = Kleo::DNAttributeMapper::instance()->name2label( attr ); if ( !label.isEmpty() ) if ( required ) return i18n("Format string for the labels in the \"Your Personal Data\" page - required field", @@ -99,11 +99,11 @@ static QString attributeLabel( const QString & attr, bool required ) { return attr + ':'; } -static QString attributeFromKey( QString key ) { +static TQString attributeFromKey( TQString key ) { return key.remove( '!' ); } -static bool availForMod( const QLineEdit * le ) { +static bool availForMod( const TQLineEdit * le ) { return le && le->isEnabled(); } @@ -114,7 +114,7 @@ static bool availForMod( const QLineEdit * le ) { * The wizard will by default be modeless, unless you set 'modal' to * TRUE to construct a modal wizard. */ -CertificateWizardImpl::CertificateWizardImpl( QWidget* parent, const char* name, bool modal, WFlags fl ) +CertificateWizardImpl::CertificateWizardImpl( TQWidget* parent, const char* name, bool modal, WFlags fl ) : CertificateWizard( parent, name, modal, fl ) { // don't allow to go to last page until a key has been generated @@ -126,16 +126,16 @@ CertificateWizardImpl::CertificateWizardImpl( QWidget* parent, const char* name // Allow to select remote URLs storeUR->setMode( KFile::File ); storeUR->setFilter( "application/pkcs10" ); - connect( storeUR, SIGNAL( urlSelected( const QString& ) ), - this, SLOT( slotURLSelected( const QString& ) ) ); + connect( storeUR, TQT_SIGNAL( urlSelected( const TQString& ) ), + this, TQT_SLOT( slotURLSelected( const TQString& ) ) ); const KConfigGroup config( KGlobal::config(), "CertificateCreationWizard" ); caEmailED->setText( config.readEntry( "CAEmailAddress" ) ); - connect( this, SIGNAL( helpClicked() ), - this, SLOT( slotHelpClicked() ) ); - connect( insertAddressButton, SIGNAL( clicked() ), - this, SLOT( slotSetValuesFromWhoAmI() ) ); + connect( this, TQT_SIGNAL( helpClicked() ), + this, TQT_SLOT( slotHelpClicked() ) ); + connect( insertAddressButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( slotSetValuesFromWhoAmI() ) ); for ( unsigned int i = 0 ; i < numKeyLengths ; ++i ) keyLengthCB->insertItem( i18n("%n bit", "%n bits", keyLengths[i] ) ); @@ -144,10 +144,10 @@ CertificateWizardImpl::CertificateWizardImpl( QWidget* parent, const char* name static bool requirementsAreMet( const CertificateWizardImpl::AttrPairList & list ) { for ( CertificateWizardImpl::AttrPairList::const_iterator it = list.begin() ; it != list.end() ; ++it ) { - const QLineEdit * le = (*it).second; + const TQLineEdit * le = (*it).second; if ( !le ) continue; - const QString key = (*it).first; + const TQString key = (*it).first; #ifndef NDEBUG kdbgstream s = kdDebug(); #else @@ -179,8 +179,8 @@ CertificateWizardImpl::~CertificateWizardImpl() // no need to delete child widgets, Qt does it all for us } -static const char * oidForAttributeName( const QString & attr ) { - QCString attrUtf8 = attr.utf8(); +static const char * oidForAttributeName( const TQString & attr ) { + TQCString attrUtf8 = attr.utf8(); for ( unsigned int i = 0 ; i < numOidMaps ; ++i ) if ( qstricmp( attrUtf8, oidmap[i].name ) == 0 ) return oidmap[i].oid; @@ -193,10 +193,10 @@ static const char * oidForAttributeName( const QString & attr ) { void CertificateWizardImpl::slotGenerateCertificate() { // Ask gpgme to generate a key and return it - QString certParms; + TQString certParms; certParms += "<GnupgKeyParms format=\"internal\">\n"; certParms += "Key-Type: RSA\n"; - certParms += QString( "Key-Length: %1\n" ).arg( keyLengths[keyLengthCB->currentItem()] ); + certParms += TQString( "Key-Length: %1\n" ).arg( keyLengths[keyLengthCB->currentItem()] ); certParms += "Key-Usage: "; if ( signOnlyCB->isChecked() ) certParms += "Sign"; @@ -207,15 +207,15 @@ void CertificateWizardImpl::slotGenerateCertificate() certParms += "\n"; certParms += "name-dn: "; - QString email; - QStringList rdns; + TQString email; + TQStringList rdns; for( AttrPairList::const_iterator it = _attrPairList.begin(); it != _attrPairList.end(); ++it ) { - const QString attr = attributeFromKey( (*it).first.upper() ); - const QLineEdit * le = (*it).second; + const TQString attr = attributeFromKey( (*it).first.upper() ); + const TQLineEdit * le = (*it).second; if ( !le ) continue; - const QString value = le->text().stripWhiteSpace(); + const TQString value = le->text().stripWhiteSpace(); if ( value.isEmpty() ) continue; @@ -230,7 +230,7 @@ void CertificateWizardImpl::slotGenerateCertificate() if ( const char * oid = oidForAttributeName( attr ) ) { // we need to translate the attribute name for the backend: - rdns.push_back( QString::fromUtf8( oid ) + '=' + Kleo::DN::escape( value ) ); + rdns.push_back( TQString::fromUtf8( oid ) + '=' + Kleo::DN::escape( value ) ); } else { rdns.push_back( attr + '=' + Kleo::DN::escape( value ) ); } @@ -246,8 +246,8 @@ void CertificateWizardImpl::slotGenerateCertificate() Kleo::CryptoBackendFactory::instance()->smime()->keyGenerationJob(); assert( job ); - connect( job, SIGNAL(result(const GpgME::KeyGenerationResult&,const QByteArray&)), - SLOT(slotResult(const GpgME::KeyGenerationResult&,const QByteArray&)) ); + connect( job, TQT_SIGNAL(result(const GpgME::KeyGenerationResult&,const TQByteArray&)), + TQT_SLOT(slotResult(const GpgME::KeyGenerationResult&,const TQByteArray&)) ); certificateTE->setText( certParms ); @@ -255,7 +255,7 @@ void CertificateWizardImpl::slotGenerateCertificate() if ( err ) KMessageBox::error( this, i18n( "Could not start certificate generation: %1" ) - .arg( QString::fromLocal8Bit( err.asString() ) ), + .arg( TQString::fromLocal8Bit( err.asString() ) ), i18n( "Certificate Manager Error" ) ); else { generatePB->setEnabled( false ); @@ -266,7 +266,7 @@ void CertificateWizardImpl::slotGenerateCertificate() void CertificateWizardImpl::slotResult( const GpgME::KeyGenerationResult & res, - const QByteArray & keyData ) { + const TQByteArray & keyData ) { //kdDebug() << "keyData.size(): " << keyData.size() << endl; _keyData = keyData; @@ -278,7 +278,7 @@ void CertificateWizardImpl::slotResult( const GpgME::KeyGenerationResult & res, if ( !res.error().isCanceled() ) KMessageBox::error( this, i18n( "Could not generate certificate: %1" ) - .arg( QString::fromLatin1( res.error().asString() ) ), + .arg( TQString::fromLatin1( res.error().asString() ) ), i18n( "Certificate Manager Error" ) ); } else { // next will stay enabled until the user clicks Generate @@ -302,11 +302,11 @@ void CertificateWizardImpl::slotSetValuesFromWhoAmI() for ( AttrPairList::const_iterator it = _attrPairList.begin() ; it != _attrPairList.end() ; ++it ) { - QLineEdit * le = (*it).second; + TQLineEdit * le = (*it).second; if ( !availForMod( le ) ) continue; - const QString attr = attributeFromKey( (*it).first.upper() ); + const TQString attr = attributeFromKey( (*it).first.upper() ); if ( attr == "CN" ) le->setText( a.formattedName() ); else if ( attr == "EMAIL" ) @@ -334,29 +334,29 @@ void CertificateWizardImpl::slotSetValuesFromWhoAmI() void CertificateWizardImpl::createPersonalDataPage() { - QGridLayout* grid = new QGridLayout( edContainer, 2, 1, + TQGridLayout* grid = new TQGridLayout( edContainer, 2, 1, KDialog::marginHint(), KDialog::spacingHint() ); KConfigGroup config( KGlobal::config(), "CertificateCreationWizard" ); - QStringList attrOrder = config.readListEntry( "DNAttributeOrder" ); + TQStringList attrOrder = config.readListEntry( "DNAttributeOrder" ); if ( attrOrder.empty() ) attrOrder << "CN!" << "L" << "OU" << "O!" << "C!" << "EMAIL!"; int row = 0; - for ( QStringList::const_iterator it = attrOrder.begin() ; it != attrOrder.end() ; ++it, ++row ) { - const QString key = (*it).stripWhiteSpace().upper(); - const QString attr = attributeFromKey( key ); + for ( TQStringList::const_iterator it = attrOrder.begin() ; it != attrOrder.end() ; ++it, ++row ) { + const TQString key = (*it).stripWhiteSpace().upper(); + const TQString attr = attributeFromKey( key ); if ( attr.isEmpty() ) { --row; continue; } - const QString preset = config.readEntry( attr ); - const QString label = config.readEntry( attr + "_label", + const TQString preset = config.readEntry( attr ); + const TQString label = config.readEntry( attr + "_label", attributeLabel( attr, key.endsWith("!") ) ); - QLineEdit * le = new QLineEdit( edContainer ); + TQLineEdit * le = new TQLineEdit( edContainer ); grid->addWidget( le, row, 1 ); - grid->addWidget( new QLabel( le, label.isEmpty() ? attr : label, edContainer ), row, 0 ); + grid->addWidget( new TQLabel( le, label.isEmpty() ? attr : label, edContainer ), row, 0 ); le->setText( preset ); if ( config.entryIsImmutable( attr ) ) @@ -364,8 +364,8 @@ void CertificateWizardImpl::createPersonalDataPage() _attrPairList.append(qMakePair(key, le)); - connect( le, SIGNAL(textChanged(const QString&)), - SLOT(slotEnablePersonalDataPageExit()) ); + connect( le, TQT_SIGNAL(textChanged(const TQString&)), + TQT_SLOT(slotEnablePersonalDataPageExit()) ); } // enable button only if administrator wants to allow it @@ -380,17 +380,17 @@ bool CertificateWizardImpl::sendToCA() const { return sendToCARB->isChecked(); } -QString CertificateWizardImpl::caEMailAddress() const { +TQString CertificateWizardImpl::caEMailAddress() const { return caEmailED->text().stripWhiteSpace(); } -void CertificateWizardImpl::slotURLSelected( const QString& _url ) +void CertificateWizardImpl::slotURLSelected( const TQString& _url ) { KURL url = KURL::fromPathOrURL( _url.stripWhiteSpace() ); #if ! KDE_IS_VERSION(3,2,90) // The application/pkcs10 mimetype didn't have a native extension, // so the filedialog didn't have the checkbox for auto-adding it. - QString fileName = url.fileName(); + TQString fileName = url.fileName(); int pos = fileName.findRev( '.' ); if ( pos < 0 ) // no extension url.setFileName( fileName + ".p10" ); @@ -402,7 +402,7 @@ KURL CertificateWizardImpl::saveFileUrl() const { return KURL::fromPathOrURL( storeUR->url().stripWhiteSpace() ); } -void CertificateWizardImpl::showPage( QWidget * page ) +void CertificateWizardImpl::showPage( TQWidget * page ) { CertificateWizard::showPage( page ); if ( page == generatePage ) { @@ -424,13 +424,13 @@ static const char* const dcopObjectId = "KMailIface"; /** Send the new certificate by mail using KMail */ -void CertificateWizardImpl::sendCertificate( const QString& email, const QByteArray& certificateData ) +void CertificateWizardImpl::sendCertificate( const TQString& email, const TQByteArray& certificateData ) { - QString error; - QCString dcopService; + TQString error; + TQCString dcopService; int result = KDCOPServiceStarter::self()-> - findServiceFor( "DCOP/Mailer", QString::null, - QString::null, &error, &dcopService ); + findServiceFor( "DCOP/Mailer", TQString::null, + TQString::null, &error, &dcopService ); if ( result != 0 ) { kdDebug() << "Couldn't connect to KMail\n"; KMessageBox::error( this, @@ -438,25 +438,25 @@ void CertificateWizardImpl::sendCertificate( const QString& email, const QByteAr return; } - QCString dummy; + TQCString dummy; // OK, so kmail (or kontact) is running. Now ensure the object we want is available. // [that's not the case when kontact was already running, but kmail not loaded into it... in theory.] - if ( !kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) ) { + if ( !kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", TQByteArray(), dummy, dummy ) ) { DCOPRef ref( dcopService, dcopService ); // talk to the KUniqueApplication or its kontact wrapper DCOPReply reply = ref.call( "load()" ); if ( reply.isValid() && (bool)reply ) { - Q_ASSERT( kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) ); + Q_ASSERT( kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", TQByteArray(), dummy, dummy ) ); } else kdWarning() << "Error loading " << dcopService << endl; } DCOPClient* dcopClient = kapp->dcopClient(); - QByteArray data; - QDataStream arg( data, IO_WriteOnly ); + TQByteArray data; + TQDataStream arg( data, IO_WriteOnly ); arg << email; arg << certificateData; if( !dcopClient->send( dcopService, dcopObjectId, - "sendCertificate(QString,QByteArray)", data ) ) { + "sendCertificate(TQString,TQByteArray)", data ) ) { KMessageBox::error( this, i18n( "DCOP Communication Error, unable to send certificate using KMail." ) ); return; @@ -490,8 +490,8 @@ void CertificateWizardImpl::accept() KIO::Job* uploadJob = KIOext::put( _keyData, url, -1, overwrite, false /*resume*/ ); uploadJob->setWindow( this ); - connect( uploadJob, SIGNAL( result( KIO::Job* ) ), - this, SLOT( slotUploadResult( KIO::Job* ) ) ); + connect( uploadJob, TQT_SIGNAL( result( KIO::Job* ) ), + this, TQT_SLOT( slotUploadResult( KIO::Job* ) ) ); // Can't press finish again during the upload setFinishEnabled( finishPage, false ); } |