diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kaddressbook/editors/imeditorwidget.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kaddressbook/editors/imeditorwidget.cpp')
-rw-r--r-- | kaddressbook/editors/imeditorwidget.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/kaddressbook/editors/imeditorwidget.cpp b/kaddressbook/editors/imeditorwidget.cpp index f61e06386..0da0feb03 100644 --- a/kaddressbook/editors/imeditorwidget.cpp +++ b/kaddressbook/editors/imeditorwidget.cpp @@ -22,12 +22,12 @@ without including the source code for Qt in the source distribution. */ -#include <qlistview.h> -#include <qstringlist.h> -#include <qvbox.h> -#include <qlayout.h> -#include <qfont.h> -#include <qpainter.h> +#include <tqlistview.h> +#include <tqstringlist.h> +#include <tqvbox.h> +#include <tqlayout.h> +#include <tqfont.h> +#include <tqpainter.h> #include <kdialogbase.h> #include <kdebug.h> @@ -44,7 +44,7 @@ IMAddressLVI::IMAddressLVI( KListView *parent, KPluginInfo *protocol, - const QString &address, const IMContext &context ) + const TQString &address, const IMContext &context ) : KListViewItem( parent ) { setProtocol( protocol ); @@ -63,11 +63,11 @@ bool IMAddressLVI::preferred() const return mPreferred; } -void IMAddressLVI::paintCell( QPainter *p, const QColorGroup &cg, +void IMAddressLVI::paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int alignment ) { if ( mPreferred ) { - QFont font = p->font(); + TQFont font = p->font(); font.setBold( true ); p->setFont( font ); } @@ -75,15 +75,15 @@ void IMAddressLVI::paintCell( QPainter *p, const QColorGroup &cg, KListViewItem::paintCell( p, cg, column, width, alignment ); } -void IMAddressLVI::setAddress( const QString &address ) +void IMAddressLVI::setAddress( const TQString &address ) { // irc uses 0xE120 to seperate the nick and the server group. - QString serverOrGroup = address.section( QChar( 0xE120 ), 1 ); + TQString serverOrGroup = address.section( TQChar( 0xE120 ), 1 ); if ( serverOrGroup.isEmpty() ) setText( 1, address ); else { - QString nickname = address.section( QChar( 0xE120 ), 0, 0 ); + TQString nickname = address.section( TQChar( 0xE120 ), 0, 0 ); setText( 1, i18n( "<nickname> on <server>","%1 on %2" ) .arg( nickname ).arg( serverOrGroup ) ); } @@ -128,7 +128,7 @@ IMContext IMAddressLVI::context() const return mContext; } -QString IMAddressLVI::address() const +TQString IMAddressLVI::address() const { return mAddress; } @@ -140,7 +140,7 @@ void IMAddressLVI::activate() /*===========================================================================*/ -IMEditorWidget::IMEditorWidget( QWidget *parent, const QString &preferredIM, const char *name ) +IMEditorWidget::IMEditorWidget( TQWidget *parent, const TQString &preferredIM, const char *name ) : KDialogBase( parent, name, false, i18n( "Edit Instant Messenging Address" ), Help | Ok | Cancel, Ok, false ), mReadOnly( false ) @@ -148,14 +148,14 @@ IMEditorWidget::IMEditorWidget( QWidget *parent, const QString &preferredIM, con mWidget = new IMEditorBase( this ); setMainWidget( mWidget ); - connect( mWidget->btnAdd, SIGNAL( clicked() ), SLOT( slotAdd() ) ); - connect( mWidget->btnEdit, SIGNAL( clicked() ), SLOT( slotEdit() ) ); - connect( mWidget->btnDelete, SIGNAL( clicked() ), SLOT( slotDelete() ) ); - connect( mWidget->btnSetStandard, SIGNAL( clicked()), SLOT( slotSetStandard() ) ); - connect( mWidget->lvAddresses, SIGNAL( selectionChanged() ), SLOT( slotUpdateButtons() ) ); + connect( mWidget->btnAdd, TQT_SIGNAL( clicked() ), TQT_SLOT( slotAdd() ) ); + connect( mWidget->btnEdit, TQT_SIGNAL( clicked() ), TQT_SLOT( slotEdit() ) ); + connect( mWidget->btnDelete, TQT_SIGNAL( clicked() ), TQT_SLOT( slotDelete() ) ); + connect( mWidget->btnSetStandard, TQT_SIGNAL( clicked()), TQT_SLOT( slotSetStandard() ) ); + connect( mWidget->lvAddresses, TQT_SIGNAL( selectionChanged() ), TQT_SLOT( slotUpdateButtons() ) ); - connect( mWidget->lvAddresses, SIGNAL( doubleClicked( QListViewItem*, const QPoint&, int ) ), - SLOT( slotEdit() ) ); + connect( mWidget->lvAddresses, TQT_SIGNAL( doubleClicked( TQListViewItem*, const TQPoint&, int ) ), + TQT_SLOT( slotEdit() ) ); setHelp( "managing-contacts-im-addresses" ); @@ -166,26 +166,26 @@ IMEditorWidget::IMEditorWidget( QWidget *parent, const QString &preferredIM, con //mWidget->btnUp->setEnabled( false ); //mWidget->btnDown->setEnabled( false ); mPreferred = preferredIM; - mPreferred = mPreferred.replace( " on ", QString( QChar( 0xE120 ) ), true ); - mProtocols = KPluginInfo::fromServices( KTrader::self()->query( QString::fromLatin1( "KABC/IMProtocol" ) ) ); + mPreferred = mPreferred.replace( " on ", TQString( TQChar( 0xE120 ) ), true ); + mProtocols = KPluginInfo::fromServices( KTrader::self()->query( TQString::fromLatin1( "KABC/IMProtocol" ) ) ); // order the protocols by putting them in a qmap, then sorting the set of keys and recreating the list - QMap<QString, KPluginInfo *> protocolMap; - QValueList<KPluginInfo *>::ConstIterator it; - QValueList<KPluginInfo *> sorted; + TQMap<TQString, KPluginInfo *> protocolMap; + TQValueList<KPluginInfo *>::ConstIterator it; + TQValueList<KPluginInfo *> sorted; for ( it = mProtocols.begin(); it != mProtocols.end(); ++it ) protocolMap.insert( (*it)->name(), (*it) ); - QStringList keys = protocolMap.keys(); + TQStringList keys = protocolMap.keys(); keys.sort(); - QStringList::ConstIterator keyIt = keys.begin(); - QStringList::ConstIterator end = keys.end(); + TQStringList::ConstIterator keyIt = keys.begin(); + TQStringList::ConstIterator end = keys.end(); for ( ; keyIt != end; ++keyIt ) sorted.append( protocolMap[*keyIt] ); mProtocols = sorted; } -QValueList<KPluginInfo *> IMEditorWidget::availableProtocols() const +TQValueList<KPluginInfo *> IMEditorWidget::availableProtocols() const { return mProtocols; } @@ -196,21 +196,21 @@ void IMEditorWidget::loadContact( KABC::Addressee *addr ) mWidget->lvAddresses->clear(); // see README for details of how Evolution stores IM addresses (differently) - const QStringList customs = addr->customs(); + const TQStringList customs = addr->customs(); - QStringList::ConstIterator it; + TQStringList::ConstIterator it; bool isSet = false; for ( it = customs.begin(); it != customs.end(); ++it ) { - QString app, name, value; + TQString app, name, value; splitField( *it, app, name, value ); - if ( app.startsWith( QString::fromLatin1( "messaging/" ) ) ) { - if ( name == QString::fromLatin1( "All" ) ) { + if ( app.startsWith( TQString::fromLatin1( "messaging/" ) ) ) { + if ( name == TQString::fromLatin1( "All" ) ) { KPluginInfo *protocol = protocolFromString( app ); if ( protocol ) { - QStringList addresses = QStringList::split( QChar( 0xE000 ), value ); - QStringList::iterator end = addresses.end(); - for ( QStringList::ConstIterator it = addresses.begin(); it != end; ++it ) { + TQStringList addresses = TQStringList::split( TQChar( 0xE000 ), value ); + TQStringList::iterator end = addresses.end(); + for ( TQStringList::ConstIterator it = addresses.begin(); it != end; ++it ) { IMAddressLVI *imaddresslvi = new IMAddressLVI( mWidget->lvAddresses, protocol, *it, Any/*, false*/ ); if ( !isSet && (*it).stripWhiteSpace().lower() == mPreferred.stripWhiteSpace().lower() ) { imaddresslvi->setPreferred( true ); @@ -231,10 +231,10 @@ void IMEditorWidget::storeContact( KABC::Addressee *addr ) { // for each changed protocol, write a new custom field containing the current set of // addresses - QValueList<KPluginInfo *>::ConstIterator protocolIt; + TQValueList<KPluginInfo *>::ConstIterator protocolIt; for ( protocolIt = mChangedProtocols.begin(); protocolIt != mChangedProtocols.end(); ++protocolIt ) { - QStringList lst; - QListViewItemIterator addressIt( mWidget->lvAddresses ); + TQStringList lst; + TQListViewItemIterator addressIt( mWidget->lvAddresses ); while ( addressIt.current() ) { IMAddressLVI* currentAddress = static_cast<IMAddressLVI*>( *addressIt ); if ( currentAddress->protocol() == *protocolIt ) @@ -242,11 +242,11 @@ void IMEditorWidget::storeContact( KABC::Addressee *addr ) ++addressIt; } - QString addrBookField = (*protocolIt)->property( "X-KDE-InstantMessagingKABCField" ).toString(); + TQString addrBookField = (*protocolIt)->property( "X-KDE-InstantMessagingKABCField" ).toString(); if ( !lst.isEmpty() ) - addr->insertCustom( addrBookField, QString::fromLatin1( "All" ), lst.join( QChar( 0xE000 ) ) ); + addr->insertCustom( addrBookField, TQString::fromLatin1( "All" ), lst.join( TQChar( 0xE000 ) ) ); else - addr->removeCustom( addrBookField, QString::fromLatin1( "All" ) ); + addr->removeCustom( addrBookField, TQString::fromLatin1( "All" ) ); } } @@ -258,11 +258,11 @@ void IMEditorWidget::setReadOnly( bool readOnly ) void IMEditorWidget::slotSetStandard() { - QListViewItemIterator it( mWidget->lvAddresses, QListViewItemIterator::Selected ); + TQListViewItemIterator it( mWidget->lvAddresses, TQListViewItemIterator::Selected ); // Just set the first one selected as standard if ( IMAddressLVI *current = static_cast<IMAddressLVI*>( it.current() ) ) { - QListViewItemIterator it2( mWidget->lvAddresses ); + TQListViewItemIterator it2( mWidget->lvAddresses ); while ( it2.current() ) { IMAddressLVI *item = static_cast<IMAddressLVI*>( it2.current() ); @@ -289,7 +289,7 @@ void IMEditorWidget::slotSetStandard() void IMEditorWidget::slotUpdateButtons() { int num_selected = 0; - QListViewItemIterator it( mWidget->lvAddresses, QListViewItemIterator::Selected ); + TQListViewItemIterator it( mWidget->lvAddresses, TQListViewItemIterator::Selected ); while ( it.current() ) { ++num_selected; if ( num_selected > 1 ) @@ -336,11 +336,11 @@ void IMEditorWidget::slotAdd() IMAddressWidget *addressWid = new IMAddressWidget( &addDialog, mProtocols ); addDialog.enableButtonOK( false ); - connect( addressWid, SIGNAL( inValidState( bool ) ), - &addDialog, SLOT( enableButtonOK( bool ) ) ); + connect( addressWid, TQT_SIGNAL( inValidState( bool ) ), + &addDialog, TQT_SLOT( enableButtonOK( bool ) ) ); addDialog.setMainWidget( addressWid ); - if ( addDialog.exec() == QDialog::Accepted ) { + if ( addDialog.exec() == TQDialog::Accepted ) { // add the new item IMAddressLVI *imaddresslvi = new IMAddressLVI( mWidget->lvAddresses, addressWid->protocol(), addressWid->address() /*, addressWid->context() */ ); @@ -362,7 +362,7 @@ void IMEditorWidget::slotAdd() void IMEditorWidget::slotEdit() { - QListViewItemIterator it( mWidget->lvAddresses, QListViewItemIterator::Selected ); + TQListViewItemIterator it( mWidget->lvAddresses, TQListViewItemIterator::Selected ); // Just edit the first one selected. if ( IMAddressLVI *current = static_cast<IMAddressLVI*>( it.current() ) ) { @@ -370,11 +370,11 @@ void IMEditorWidget::slotEdit() KDialogBase::Ok | KDialogBase::Cancel ); IMAddressWidget *addressWid = new IMAddressWidget( &editDialog, mProtocols, current->protocol(), current->address(), current->context() ) ; - connect( addressWid, SIGNAL( inValidState( bool ) ), - &editDialog, SLOT( enableButtonOK( bool ) ) ); + connect( addressWid, TQT_SIGNAL( inValidState( bool ) ), + &editDialog, TQT_SLOT( enableButtonOK( bool ) ) ); editDialog.setMainWidget( addressWid ); - if ( editDialog.exec() == QDialog::Accepted ) { + if ( editDialog.exec() == TQDialog::Accepted ) { bool modified = false; if ( addressWid->address() != current->address() ) { modified = true; @@ -409,7 +409,7 @@ void IMEditorWidget::slotDelete() int num_selected = 0; { - QListViewItemIterator it( mWidget->lvAddresses, QListViewItemIterator::Selected ); + TQListViewItemIterator it( mWidget->lvAddresses, TQListViewItemIterator::Selected ); while ( it.current() ) { num_selected++; ++it; @@ -424,7 +424,7 @@ void IMEditorWidget::slotDelete() i18n( "Confirm Delete" ), KStdGuiItem::del() ) != KMessageBox::Continue ) return; - QListViewItemIterator it( mWidget->lvAddresses ); + TQListViewItemIterator it( mWidget->lvAddresses ); bool deletedPreferred = false; while( it.current() ) { if ( it.current()->isSelected() ) { @@ -452,16 +452,16 @@ void IMEditorWidget::slotDelete() setModified( true ); } -QString IMEditorWidget::preferred() const +TQString IMEditorWidget::preferred() const { - QString retval( mPreferred ); - return retval.replace( QChar( 0xE120 ), " on " ); + TQString retval( mPreferred ); + return retval.replace( TQChar( 0xE120 ), " on " ); } -KPluginInfo * IMEditorWidget::protocolFromString( const QString &fieldValue ) const +KPluginInfo * IMEditorWidget::protocolFromString( const TQString &fieldValue ) const { - QValueList<KPluginInfo *>::ConstIterator it; + TQValueList<KPluginInfo *>::ConstIterator it; KPluginInfo * protocol = 0; for ( it = mProtocols.begin(); it != mProtocols.end(); ++it ) { if ( (*it)->property( "X-KDE-InstantMessagingKABCField" ).toString() == fieldValue ) { @@ -473,11 +473,11 @@ KPluginInfo * IMEditorWidget::protocolFromString( const QString &fieldValue ) co return protocol; } -void IMEditorWidget::splitField( const QString &str, QString &app, QString &name, QString &value ) +void IMEditorWidget::splitField( const TQString &str, TQString &app, TQString &name, TQString &value ) { int colon = str.find( ':' ); if ( colon != -1 ) { - QString tmp = str.left( colon ); + TQString tmp = str.left( colon ); value = str.mid( colon + 1 ); int dash = tmp.find( '-' ); |