summaryrefslogtreecommitdiffstats
path: root/certmanager/lib/ui/keyselectiondialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'certmanager/lib/ui/keyselectiondialog.cpp')
-rw-r--r--certmanager/lib/ui/keyselectiondialog.cpp212
1 files changed, 106 insertions, 106 deletions
diff --git a/certmanager/lib/ui/keyselectiondialog.cpp b/certmanager/lib/ui/keyselectiondialog.cpp
index e21cb39d4..fcb257514 100644
--- a/certmanager/lib/ui/keyselectiondialog.cpp
+++ b/certmanager/lib/ui/keyselectiondialog.cpp
@@ -63,17 +63,17 @@
#include <kprocess.h>
// Qt
-#include <qcheckbox.h>
-#include <qtoolbutton.h>
-#include <qlabel.h>
-#include <qpixmap.h>
-#include <qtimer.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qwhatsthis.h>
-#include <qpopupmenu.h>
-#include <qregexp.h>
-#include <qpushbutton.h>
+#include <tqcheckbox.h>
+#include <tqtoolbutton.h>
+#include <tqlabel.h>
+#include <tqpixmap.h>
+#include <tqtimer.h>
+#include <tqlayout.h>
+#include <tqlineedit.h>
+#include <tqwhatsthis.h>
+#include <tqpopupmenu.h>
+#include <tqregexp.h>
+#include <tqpushbutton.h>
#include <algorithm>
#include <iterator>
@@ -151,8 +151,8 @@ static bool checkKeyUsage( const std::vector<GpgME::Key> & keys, unsigned int ke
return true;
}
-static inline QString time_t2string( time_t t ) {
- QDateTime dt;
+static inline TQString time_t2string( time_t t ) {
+ TQDateTime dt;
dt.setTime_t( t );
return dt.toString();
}
@@ -163,15 +163,15 @@ namespace {
public:
ColumnStrategy( unsigned int keyUsage );
- QString title( int col ) const;
- int width( int col, const QFontMetrics & fm ) const;
+ TQString title( int col ) const;
+ int width( int col, const TQFontMetrics & fm ) const;
- QString text( const GpgME::Key & key, int col ) const;
- QString toolTip( const GpgME::Key & key, int col ) const;
- const QPixmap * pixmap( const GpgME::Key & key, int col ) const;
+ TQString text( const GpgME::Key & key, int col ) const;
+ TQString toolTip( const GpgME::Key & key, int col ) const;
+ const TQPixmap * pixmap( const GpgME::Key & key, int col ) const;
private:
- const QPixmap mKeyGoodPix, mKeyBadPix, mKeyUnknownPix, mKeyValidPix;
+ const TQPixmap mKeyGoodPix, mKeyBadPix, mKeyUnknownPix, mKeyValidPix;
const unsigned int mKeyUsage;
};
@@ -187,31 +187,31 @@ namespace {
<< "KeySelectionDialog: keyUsage == 0. You want to use AllKeys instead." << endl;
}
- QString ColumnStrategy::title( int col ) const {
+ TQString ColumnStrategy::title( int col ) const {
switch ( col ) {
case 0: return i18n("Key ID");
case 1: return i18n("User ID");
- default: return QString::null;
+ default: return TQString::null;
}
}
- int ColumnStrategy::width( int col, const QFontMetrics & fm ) const {
+ int ColumnStrategy::width( int col, const TQFontMetrics & fm ) const {
if ( col == 0 ) {
static const char hexchars[] = "0123456789ABCDEF";
int maxWidth = 0;
for ( unsigned int i = 0 ; i < 16 ; ++i )
- maxWidth = kMax( fm.width( QChar( hexchars[i] ) ), maxWidth );
+ maxWidth = kMax( fm.width( TQChar( hexchars[i] ) ), maxWidth );
return 8 * maxWidth + 2 * mKeyGoodPix.width();
}
return Kleo::KeyListView::ColumnStrategy::width( col, fm );
}
- QString ColumnStrategy::text( const GpgME::Key & key, int col ) const {
+ TQString ColumnStrategy::text( const GpgME::Key & key, int col ) const {
switch ( col ) {
case 0:
{
if ( key.shortKeyID() )
- return QString::fromUtf8( key.shortKeyID() );
+ return TQString::fromUtf8( key.shortKeyID() );
else
return i18n("<unknown>");
}
@@ -220,30 +220,30 @@ namespace {
{
const char * uid = key.userID(0).id();
if ( key.protocol() == GpgME::Context::OpenPGP )
- return uid && *uid ? QString::fromUtf8( uid ) : QString::null ;
+ return uid && *uid ? TQString::fromUtf8( uid ) : TQString::null ;
else // CMS
return Kleo::DN( uid ).prettyDN();
}
break;
- default: return QString::null;
+ default: return TQString::null;
}
}
- QString ColumnStrategy::toolTip( const GpgME::Key & key, int ) const {
+ TQString ColumnStrategy::toolTip( const GpgME::Key & key, int ) const {
const char * uid = key.userID(0).id();
const char * fpr = key.primaryFingerprint();
const char * issuer = key.issuerName();
const GpgME::Subkey subkey = key.subkey(0);
- const QString expiry = subkey.neverExpires() ? i18n("never") : time_t2string( subkey.expirationTime() ) ;
- const QString creation = time_t2string( subkey.creationTime() );
+ const TQString expiry = subkey.neverExpires() ? i18n("never") : time_t2string( subkey.expirationTime() ) ;
+ const TQString creation = time_t2string( subkey.creationTime() );
if ( key.protocol() == GpgME::Context::OpenPGP )
return i18n( "OpenPGP key for %1\n"
"Created: %2\n"
"Expiry: %3\n"
"Fingerprint: %4" )
- .arg( uid ? QString::fromUtf8( uid ) : i18n("unknown"),
+ .arg( uid ? TQString::fromUtf8( uid ) : i18n("unknown"),
creation, expiry,
- fpr ? QString::fromLatin1( fpr ) : i18n("unknown") );
+ fpr ? TQString::fromLatin1( fpr ) : i18n("unknown") );
else
return i18n( "S/MIME key for %1\n"
"Created: %2\n"
@@ -252,11 +252,11 @@ namespace {
"Issuer: %5" )
.arg( uid ? Kleo::DN( uid ).prettyDN() : i18n("unknown"),
creation, expiry,
- fpr ? QString::fromLatin1( fpr ) : i18n("unknown") )
+ fpr ? TQString::fromLatin1( fpr ) : i18n("unknown") )
.arg( issuer ? Kleo::DN( issuer ).prettyDN() : i18n("unknown") );
}
- const QPixmap * ColumnStrategy::pixmap( const GpgME::Key & key, int col ) const {
+ const TQPixmap * ColumnStrategy::pixmap( const GpgME::Key & key, int col ) const {
if ( col != 0 )
return 0;
// this key did not undergo a validating keylisting yet:
@@ -288,13 +288,13 @@ namespace {
static const int sCheckSelectionDelay = 250;
-Kleo::KeySelectionDialog::KeySelectionDialog( const QString & title,
- const QString & text,
+Kleo::KeySelectionDialog::KeySelectionDialog( const TQString & title,
+ const TQString & text,
const std::vector<GpgME::Key> & selectedKeys,
unsigned int keyUsage,
bool extendedSelection,
bool rememberChoice,
- QWidget * parent, const char * name,
+ TQWidget * parent, const char * name,
bool modal )
: KDialogBase( parent, name, modal, title, Default|Ok|Cancel|Help, Ok ),
mOpenPGPBackend( 0 ),
@@ -304,16 +304,16 @@ Kleo::KeySelectionDialog::KeySelectionDialog( const QString & title,
mKeyUsage( keyUsage ),
mCurrentContextMenuItem( 0 )
{
- init( rememberChoice, extendedSelection, text, QString::null );
+ init( rememberChoice, extendedSelection, text, TQString::null );
}
-Kleo::KeySelectionDialog::KeySelectionDialog( const QString & title,
- const QString & text,
- const QString & initialQuery,
+Kleo::KeySelectionDialog::KeySelectionDialog( const TQString & title,
+ const TQString & text,
+ const TQString & initialQuery,
unsigned int keyUsage,
bool extendedSelection,
bool rememberChoice,
- QWidget * parent, const char * name,
+ TQWidget * parent, const char * name,
bool modal )
: KDialogBase( parent, name, modal, title, Default|Ok|Cancel|Help, Ok ),
mOpenPGPBackend( 0 ),
@@ -327,81 +327,81 @@ Kleo::KeySelectionDialog::KeySelectionDialog( const QString & title,
}
void Kleo::KeySelectionDialog::init( bool rememberChoice, bool extendedSelection,
- const QString & text, const QString & initialQuery ) {
+ const TQString & text, const TQString & initialQuery ) {
if ( mKeyUsage & OpenPGPKeys )
mOpenPGPBackend = Kleo::CryptoBackendFactory::instance()->openpgp();
if ( mKeyUsage & SMIMEKeys )
mSMIMEBackend = Kleo::CryptoBackendFactory::instance()->smime();
- mCheckSelectionTimer = new QTimer( this );
- mStartSearchTimer = new QTimer( this );
+ mCheckSelectionTimer = new TQTimer( this );
+ mStartSearchTimer = new TQTimer( this );
- QFrame *page = makeMainWidget();
- mTopLayout = new QVBoxLayout( page, 0, spacingHint() );
+ TQFrame *page = makeMainWidget();
+ mTopLayout = new TQVBoxLayout( page, 0, spacingHint() );
if ( !text.isEmpty() ) {
- QLabel* textLabel = new QLabel( text, page );
+ TQLabel* textLabel = new TQLabel( text, page );
textLabel->setAlignment( textLabel->alignment() | Qt::WordBreak );
mTopLayout->addWidget( textLabel );
}
- QHBoxLayout * hlay = new QHBoxLayout( mTopLayout ); // inherits spacing
- QLineEdit * le = new QLineEdit( page );
+ TQHBoxLayout * hlay = new TQHBoxLayout( mTopLayout ); // inherits spacing
+ TQLineEdit * le = new TQLineEdit( page );
le->setText( initialQuery );
- QToolButton *clearButton = new QToolButton( page );
+ TQToolButton *clearButton = new TQToolButton( page );
clearButton->setIconSet( KGlobal::iconLoader()->loadIconSet(
KApplication::reverseLayout() ? "clear_left":"locationbar_erase", KIcon::Small, 0 ) );
hlay->addWidget( clearButton );
- hlay->addWidget( new QLabel( le, i18n("&Search for:"), page ) );
+ hlay->addWidget( new TQLabel( le, i18n("&Search for:"), page ) );
hlay->addWidget( le, 1 );
le->setFocus();
- connect( clearButton, SIGNAL( clicked() ), le, SLOT( clear() ) );
- connect( le, SIGNAL(textChanged(const QString&)),
- this, SLOT(slotSearch(const QString&)) );
- connect( mStartSearchTimer, SIGNAL(timeout()), SLOT(slotFilter()) );
+ connect( clearButton, TQT_SIGNAL( clicked() ), le, TQT_SLOT( clear() ) );
+ connect( le, TQT_SIGNAL(textChanged(const TQString&)),
+ this, TQT_SLOT(slotSearch(const TQString&)) );
+ connect( mStartSearchTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotFilter()) );
mKeyListView = new KeyListView( new ColumnStrategy( mKeyUsage ), 0, page, "mKeyListView" );
- mKeyListView->setResizeMode( QListView::LastColumn );
+ mKeyListView->setResizeMode( TQListView::LastColumn );
mKeyListView->setRootIsDecorated( true );
mKeyListView->setShowSortIndicator( true );
mKeyListView->setSorting( 1, true ); // sort by User ID
mKeyListView->setShowToolTips( true );
if ( extendedSelection )
- mKeyListView->setSelectionMode( QListView::Extended );
+ mKeyListView->setSelectionMode( TQListView::Extended );
mTopLayout->addWidget( mKeyListView, 10 );
if ( rememberChoice ) {
- mRememberCB = new QCheckBox( i18n("&Remember choice"), page );
+ mRememberCB = new TQCheckBox( i18n("&Remember choice"), page );
mTopLayout->addWidget( mRememberCB );
- QWhatsThis::add( mRememberCB,
+ TQWhatsThis::add( mRememberCB,
i18n("<qt><p>If you check this box your choice will "
"be stored and you will not be asked again."
"</p></qt>") );
}
- connect( mCheckSelectionTimer, SIGNAL(timeout()),
- SLOT(slotCheckSelection()) );
+ connect( mCheckSelectionTimer, TQT_SIGNAL(timeout()),
+ TQT_SLOT(slotCheckSelection()) );
connectSignals();
connect( mKeyListView,
- SIGNAL(doubleClicked(Kleo::KeyListViewItem*,const QPoint&,int)),
- SLOT(slotTryOk()) );
+ TQT_SIGNAL(doubleClicked(Kleo::KeyListViewItem*,const TQPoint&,int)),
+ TQT_SLOT(slotTryOk()) );
connect( mKeyListView,
- SIGNAL(contextMenu(Kleo::KeyListViewItem*,const QPoint&)),
- SLOT(slotRMB(Kleo::KeyListViewItem*,const QPoint&)) );
+ TQT_SIGNAL(contextMenu(Kleo::KeyListViewItem*,const TQPoint&)),
+ TQT_SLOT(slotRMB(Kleo::KeyListViewItem*,const TQPoint&)) );
setButtonText( KDialogBase::Default, i18n("&Reread Keys") );
setButtonGuiItem( KDialogBase::Help, i18n("&Start Certificate Manager") );
- connect( this, SIGNAL(defaultClicked()), this, SLOT(slotRereadKeys()) );
- connect( this, SIGNAL(helpClicked()), this, SLOT(slotStartCertificateManager()) );
+ connect( this, TQT_SIGNAL(defaultClicked()), this, TQT_SLOT(slotRereadKeys()) );
+ connect( this, TQT_SIGNAL(helpClicked()), this, TQT_SLOT(slotStartCertificateManager()) );
slotRereadKeys();
mTopLayout->activate();
if ( kapp ) {
KWin::setIcons( winId(), kapp->icon(), kapp->miniIcon() );
- QSize dialogSize( 500, 400 );
+ TQSize dialogSize( 500, 400 );
KConfigGroup dialogConfig( KGlobal::config(), "Key Selection Dialog" );
dialogSize = dialogConfig.readSizeEntry( "Dialog size", &dialogSize );
@@ -418,20 +418,20 @@ Kleo::KeySelectionDialog::~KeySelectionDialog() {
void Kleo::KeySelectionDialog::connectSignals() {
if ( mKeyListView->isMultiSelection() )
- connect( mKeyListView, SIGNAL(selectionChanged()),
- SLOT(slotSelectionChanged()) );
+ connect( mKeyListView, TQT_SIGNAL(selectionChanged()),
+ TQT_SLOT(slotSelectionChanged()) );
else
- connect( mKeyListView, SIGNAL(selectionChanged(Kleo::KeyListViewItem*)),
- SLOT(slotCheckSelection(Kleo::KeyListViewItem*)) );
+ connect( mKeyListView, TQT_SIGNAL(selectionChanged(Kleo::KeyListViewItem*)),
+ TQT_SLOT(slotCheckSelection(Kleo::KeyListViewItem*)) );
}
void Kleo::KeySelectionDialog::disconnectSignals() {
if ( mKeyListView->isMultiSelection() )
- disconnect( mKeyListView, SIGNAL(selectionChanged()),
- this, SLOT(slotSelectionChanged()) );
+ disconnect( mKeyListView, TQT_SIGNAL(selectionChanged()),
+ this, TQT_SLOT(slotSelectionChanged()) );
else
- disconnect( mKeyListView, SIGNAL(selectionChanged(Kleo::KeyListViewItem*)),
- this, SLOT(slotCheckSelection(Kleo::KeyListViewItem*)) );
+ disconnect( mKeyListView, TQT_SIGNAL(selectionChanged(Kleo::KeyListViewItem*)),
+ this, TQT_SLOT(slotCheckSelection(Kleo::KeyListViewItem*)) );
}
const GpgME::Key & Kleo::KeySelectionDialog::selectedKey() const {
@@ -440,20 +440,20 @@ const GpgME::Key & Kleo::KeySelectionDialog::selectedKey() const {
return mKeyListView->selectedItem()->key();
}
-QString Kleo::KeySelectionDialog::fingerprint() const {
+TQString Kleo::KeySelectionDialog::fingerprint() const {
return selectedKey().primaryFingerprint();
}
-QStringList Kleo::KeySelectionDialog::fingerprints() const {
- QStringList result;
+TQStringList Kleo::KeySelectionDialog::fingerprints() const {
+ TQStringList result;
for ( std::vector<GpgME::Key>::const_iterator it = mSelectedKeys.begin() ; it != mSelectedKeys.end() ; ++it )
if ( const char * fpr = it->primaryFingerprint() )
result.push_back( fpr );
return result;
}
-QStringList Kleo::KeySelectionDialog::pgpKeyFingerprints() const {
- QStringList result;
+TQStringList Kleo::KeySelectionDialog::pgpKeyFingerprints() const {
+ TQStringList result;
for ( std::vector<GpgME::Key>::const_iterator it = mSelectedKeys.begin() ; it != mSelectedKeys.end() ; ++it )
if ( it->protocol() == GpgME::Context::OpenPGP )
if ( const char * fpr = it->primaryFingerprint() )
@@ -461,8 +461,8 @@ QStringList Kleo::KeySelectionDialog::pgpKeyFingerprints() const {
return result;
}
-QStringList Kleo::KeySelectionDialog::smimeFingerprints() const {
- QStringList result;
+TQStringList Kleo::KeySelectionDialog::smimeFingerprints() const {
+ TQStringList result;
for ( std::vector<GpgME::Key>::const_iterator it = mSelectedKeys.begin() ; it != mSelectedKeys.end() ; ++it )
if ( it->protocol() == GpgME::Context::CMS )
if ( const char * fpr = it->primaryFingerprint() )
@@ -515,12 +515,12 @@ void Kleo::KeySelectionDialog::slotStartCertificateManager()
#ifndef __KLEO_UI_SHOW_KEY_LIST_ERROR_H__
#define __KLEO_UI_SHOW_KEY_LIST_ERROR_H__
-static void showKeyListError( QWidget * parent, const GpgME::Error & err ) {
+static void showKeyListError( TQWidget * parent, const GpgME::Error & err ) {
assert( err );
- const QString msg = i18n( "<qt><p>An error occurred while fetching "
+ const TQString msg = i18n( "<qt><p>An error occurred while fetching "
"the keys from the backend:</p>"
"<p><b>%1</b></p></qt>" )
- .arg( QString::fromLocal8Bit( err.asString() ) );
+ .arg( TQString::fromLocal8Bit( err.asString() ) );
KMessageBox::error( parent, msg, i18n( "Key Listing Failed" ) );
}
@@ -528,7 +528,7 @@ static void showKeyListError( QWidget * parent, const GpgME::Error & err ) {
namespace {
struct ExtractFingerprint {
- QString operator()( const GpgME::Key & key ) {
+ TQString operator()( const GpgME::Key & key ) {
return key.primaryFingerprint();
}
};
@@ -540,14 +540,14 @@ void Kleo::KeySelectionDialog::startKeyListJobForBackend( const CryptoBackend::P
if ( !job )
return;
- connect( job, SIGNAL(result(const GpgME::KeyListResult&)),
- SLOT(slotKeyListResult(const GpgME::KeyListResult&)) );
- connect( job, SIGNAL(nextKey(const GpgME::Key&)),
+ connect( job, TQT_SIGNAL(result(const GpgME::KeyListResult&)),
+ TQT_SLOT(slotKeyListResult(const GpgME::KeyListResult&)) );
+ connect( job, TQT_SIGNAL(nextKey(const GpgME::Key&)),
mKeyListView, validate ?
- SLOT(slotRefreshKey(const GpgME::Key&)) :
- SLOT(slotAddKey(const GpgME::Key&)) );
+ TQT_SLOT(slotRefreshKey(const GpgME::Key&)) :
+ TQT_SLOT(slotAddKey(const GpgME::Key&)) );
- QStringList fprs;
+ TQStringList fprs;
std::transform( keys.begin(), keys.end(), std::back_inserter( fprs ), ExtractFingerprint() );
const GpgME::Error err = job->start( fprs, mKeyUsage & SecretKeys && !( mKeyUsage & PublicKeys ) );
@@ -685,13 +685,13 @@ bool Kleo::KeySelectionDialog::rememberSelection() const {
return mRememberCB && mRememberCB->isChecked() ;
}
-void Kleo::KeySelectionDialog::slotRMB( Kleo::KeyListViewItem * item, const QPoint & p ) {
+void Kleo::KeySelectionDialog::slotRMB( Kleo::KeyListViewItem * item, const TQPoint & p ) {
if ( !item ) return;
mCurrentContextMenuItem = item;
- QPopupMenu menu;
- menu.insertItem( i18n( "Recheck Key" ), this, SLOT(slotRecheckKey()) );
+ TQPopupMenu menu;
+ menu.insertItem( i18n( "Recheck Key" ), this, TQT_SLOT(slotRecheckKey()) );
menu.exec( p );
}
@@ -725,7 +725,7 @@ void Kleo::KeySelectionDialog::slotCancel() {
reject();
}
-void Kleo::KeySelectionDialog::slotSearch( const QString & text ) {
+void Kleo::KeySelectionDialog::slotSearch( const TQString & text ) {
mSearchText = text.stripWhiteSpace().upper();
slotSearch();
}
@@ -741,7 +741,7 @@ void Kleo::KeySelectionDialog::slotFilter() {
}
// OK, so we need to filter:
- QRegExp keyIdRegExp( "(?:0x)?[A-F0-9]{1,8}", false /*case-insens.*/ );
+ TQRegExp keyIdRegExp( "(?:0x)?[A-F0-9]{1,8}", false /*case-insens.*/ );
if ( keyIdRegExp.exactMatch( mSearchText ) ) {
if ( mSearchText.startsWith( "0X" ) )
// search for keyID only:
@@ -755,7 +755,7 @@ void Kleo::KeySelectionDialog::slotFilter() {
}
}
-void Kleo::KeySelectionDialog::filterByKeyID( const QString & keyID ) {
+void Kleo::KeySelectionDialog::filterByKeyID( const TQString & keyID ) {
assert( keyID.length() <= 8 );
assert( !keyID.isEmpty() ); // regexp in slotFilter should prevent these
if ( keyID.isEmpty() )
@@ -765,33 +765,33 @@ void Kleo::KeySelectionDialog::filterByKeyID( const QString & keyID ) {
item->setVisible( item->text( 0 ).upper().startsWith( keyID ) );
}
-static bool anyUIDMatches( const Kleo::KeyListViewItem * item, QRegExp & rx ) {
+static bool anyUIDMatches( const Kleo::KeyListViewItem * item, TQRegExp & rx ) {
if ( !item )
return false;
const std::vector<GpgME::UserID> uids = item->key().userIDs();
for ( std::vector<GpgME::UserID>::const_iterator it = uids.begin() ; it != uids.end() ; ++it )
- if ( it->id() && rx.search( QString::fromUtf8( it->id() ) ) >= 0 )
+ if ( it->id() && rx.search( TQString::fromUtf8( it->id() ) ) >= 0 )
return true;
return false;
}
-void Kleo::KeySelectionDialog::filterByKeyIDOrUID( const QString & str ) {
+void Kleo::KeySelectionDialog::filterByKeyIDOrUID( const TQString & str ) {
assert( !str.isEmpty() );
// match beginnings of words:
- QRegExp rx( "\\b" + QRegExp::escape( str ), false );
+ TQRegExp rx( "\\b" + TQRegExp::escape( str ), false );
for ( KeyListViewItem * item = mKeyListView->firstChild() ; item ; item = item->nextSibling() )
item->setVisible( item->text( 0 ).upper().startsWith( str ) || anyUIDMatches( item, rx ) );
}
-void Kleo::KeySelectionDialog::filterByUID( const QString & str ) {
+void Kleo::KeySelectionDialog::filterByUID( const TQString & str ) {
assert( !str.isEmpty() );
// match beginnings of words:
- QRegExp rx( "\\b" + QRegExp::escape( str ), false );
+ TQRegExp rx( "\\b" + TQRegExp::escape( str ), false );
for ( KeyListViewItem * item = mKeyListView->firstChild() ; item ; item = item->nextSibling() )
item->setVisible( anyUIDMatches( item, rx ) );