diff options
Diffstat (limited to 'kopete/plugins/alias/aliaspreferences.cpp')
-rw-r--r-- | kopete/plugins/alias/aliaspreferences.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/kopete/plugins/alias/aliaspreferences.cpp b/kopete/plugins/alias/aliaspreferences.cpp index 65342ddf..a331a592 100644 --- a/kopete/plugins/alias/aliaspreferences.cpp +++ b/kopete/plugins/alias/aliaspreferences.cpp @@ -15,11 +15,11 @@ #include <kgenericfactory.h> #include <kmessagebox.h> #include <kconfig.h> -#include <qregexp.h> -#include <qlayout.h> +#include <tqregexp.h> +#include <tqlayout.h> #include <kplugininfo.h> #include <kiconloader.h> -#include <qpainter.h> +#include <tqpainter.h> #include "kopetecommandhandler.h" #include "kopetepluginmanager.h" @@ -35,11 +35,11 @@ typedef KGenericFactory<AliasPreferences> AliasPreferencesFactory; class AliasItem : public QListViewItem { public: - AliasItem( QListView *parent, + AliasItem( TQListView *parent, uint number, - const QString &alias, - const QString &command, const ProtocolList &p ) : - QListViewItem( parent, alias, command ) + const TQString &alias, + const TQString &command, const ProtocolList &p ) : + TQListViewItem( parent, alias, command ) { protocolList = p; id = number; @@ -49,7 +49,7 @@ class AliasItem : public QListViewItem uint id; protected: - void paintCell( QPainter *p, const QColorGroup &cg, + void paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int align ) { if ( column == 2 ) @@ -58,18 +58,18 @@ class AliasItem : public QListViewItem if ( cellWidth < 0 ) cellWidth = 0; - QListViewItem::paintCell( p, cg, column, cellWidth, align ); + TQListViewItem::paintCell( p, cg, column, cellWidth, align ); // Draw the rest of the background - QListView *lv = listView(); + TQListView *lv = listView(); if ( !lv ) return; int marg = lv->itemMargin(); int r = marg; const BackgroundMode bgmode = lv->viewport()->backgroundMode(); - const QColorGroup::ColorRole crole = - QPalette::backgroundRoleFromMode( bgmode ); + const TQColorGroup::ColorRole crole = + TQPalette::backgroundRoleFromMode( bgmode ); p->fillRect( cellWidth, 0, width - cellWidth, height(), cg.brush( crole ) ); @@ -77,7 +77,7 @@ class AliasItem : public QListViewItem { p->fillRect( QMAX( cellWidth, r - marg ), 0, width - cellWidth - r + marg, height(), - cg.brush( QColorGroup::Highlight ) ); + cg.brush( TQColorGroup::Highlight ) ); if ( isEnabled() || !lv ) p->setPen( cg.highlightedText() ); else if ( !isEnabled() && lv ) @@ -90,7 +90,7 @@ class AliasItem : public QListViewItem for ( ProtocolList::Iterator it = protocolList.begin(); it != protocolList.end(); ++it ) { - QPixmap icon = SmallIcon( (*it)->pluginIcon() ); + TQPixmap icon = SmallIcon( (*it)->pluginIcon() ); p->drawPixmap( mc_x + 4, height() - 16, icon ); mc_x += 16; @@ -99,7 +99,7 @@ class AliasItem : public QListViewItem else { // Use Qt's own drawing - QListViewItem::paintCell( p, cg, column, width, align ); + TQListViewItem::paintCell( p, cg, column, width, align ); } } }; @@ -107,39 +107,39 @@ class AliasItem : public QListViewItem class ProtocolItem : public QListViewItem { public: - ProtocolItem( QListView *parent, KPluginInfo *p ) : - QListViewItem( parent, p->name() ) + ProtocolItem( TQListView *parent, KPluginInfo *p ) : + TQListViewItem( parent, p->name() ) { this->setPixmap( 0, SmallIcon( p->icon() ) ); id = p->pluginName(); } - QString id; + TQString id; }; K_EXPORT_COMPONENT_FACTORY( kcm_kopete_alias, AliasPreferencesFactory( "kcm_kopete_alias" ) ) -AliasPreferences::AliasPreferences( QWidget *parent, const char *, const QStringList &args ) +AliasPreferences::AliasPreferences( TQWidget *parent, const char *, const TQStringList &args ) : KCModule( AliasPreferencesFactory::instance(), parent, args ) { - ( new QVBoxLayout( this ) )->setAutoAdd( true ); + ( new TQVBoxLayout( this ) )->setAutoAdd( true ); preferencesDialog = new AliasDialogBase( this ); - connect( preferencesDialog->addButton, SIGNAL(clicked()), this, SLOT( slotAddAlias() ) ); - connect( preferencesDialog->editButton, SIGNAL(clicked()), this, SLOT( slotEditAlias() ) ); - connect( preferencesDialog->deleteButton, SIGNAL(clicked()), this, SLOT( slotDeleteAliases() ) ); - connect( Kopete::PluginManager::self(), SIGNAL( pluginLoaded( Kopete::Plugin * ) ), - this, SLOT( slotPluginLoaded( Kopete::Plugin * ) ) ); + connect( preferencesDialog->addButton, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotAddAlias() ) ); + connect( preferencesDialog->editButton, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotEditAlias() ) ); + connect( preferencesDialog->deleteButton, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotDeleteAliases() ) ); + connect( Kopete::PluginManager::self(), TQT_SIGNAL( pluginLoaded( Kopete::Plugin * ) ), + this, TQT_SLOT( slotPluginLoaded( Kopete::Plugin * ) ) ); - connect( preferencesDialog->aliasList, SIGNAL(selectionChanged()), - this, SLOT( slotCheckAliasSelected() ) ); + connect( preferencesDialog->aliasList, TQT_SIGNAL(selectionChanged()), + this, TQT_SLOT( slotCheckAliasSelected() ) ); load(); } AliasPreferences::~AliasPreferences() { - QListViewItem *myChild = preferencesDialog->aliasList->firstChild(); + TQListViewItem *myChild = preferencesDialog->aliasList->firstChild(); while( myChild ) { ProtocolList protocols = static_cast<AliasItem*>( myChild )->protocolList; @@ -162,15 +162,15 @@ void AliasPreferences::load() if( config->hasGroup( "AliasPlugin" ) ) { config->setGroup("AliasPlugin"); - QStringList aliases = config->readListEntry("AliasNames"); - for( QStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it ) + TQStringList aliases = config->readListEntry("AliasNames"); + for( TQStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it ) { uint aliasNumber = config->readUnsignedNumEntry( (*it) + "_id" ); - QString aliasCommand = config->readEntry( (*it) + "_command" ); - QStringList protocols = config->readListEntry( (*it) + "_protocols" ); + TQString aliasCommand = config->readEntry( (*it) + "_command" ); + TQStringList protocols = config->readListEntry( (*it) + "_protocols" ); ProtocolList protocolList; - for( QStringList::Iterator it2 = protocols.begin(); it2 != protocols.end(); ++it2 ) + for( TQStringList::Iterator it2 = protocols.begin(); it2 != protocols.end(); ++it2 ) { Kopete::Plugin *p = Kopete::PluginManager::self()->plugin( *it2 ); protocolList.append( (Kopete::Protocol*)p ); @@ -193,25 +193,25 @@ void AliasPreferences::slotPluginLoaded( Kopete::Plugin *plugin ) if( config->hasGroup( "AliasPlugin" ) ) { config->setGroup("AliasPlugin"); - QStringList aliases = config->readListEntry("AliasNames"); - for( QStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it ) + TQStringList aliases = config->readListEntry("AliasNames"); + for( TQStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it ) { uint aliasNumber = config->readUnsignedNumEntry( (*it) + "_id" ); - QString aliasCommand = config->readEntry( (*it) + "_command" ); - QStringList protocols = config->readListEntry( (*it) + "_protocols" ); + TQString aliasCommand = config->readEntry( (*it) + "_command" ); + TQStringList protocols = config->readListEntry( (*it) + "_protocols" ); - for( QStringList::iterator it2 = protocols.begin(); it2 != protocols.end(); ++it2 ) + for( TQStringList::iterator it2 = protocols.begin(); it2 != protocols.end(); ++it2 ) { if( *it2 == protocol->pluginId() ) { - QPair<Kopete::Protocol*, QString> pr( protocol, *it ); + QPair<Kopete::Protocol*, TQString> pr( protocol, *it ); if( protocolMap.find( pr ) == protocolMap.end() ) { Kopete::CommandHandler::commandHandler()->registerAlias( protocol, *it, aliasCommand, - QString::fromLatin1("Custom alias for %1").arg(aliasCommand), + TQString::fromLatin1("Custom alias for %1").arg(aliasCommand), Kopete::CommandHandler::UserAlias ); @@ -241,14 +241,14 @@ void AliasPreferences::slotPluginLoaded( Kopete::Plugin *plugin ) void AliasPreferences::save() { KConfig *config = KGlobal::config(); - config->deleteGroup( QString::fromLatin1("AliasPlugin") ); - config->setGroup( QString::fromLatin1("AliasPlugin") ); + config->deleteGroup( TQString::fromLatin1("AliasPlugin") ); + config->setGroup( TQString::fromLatin1("AliasPlugin") ); - QStringList aliases; + TQStringList aliases; AliasItem *item = (AliasItem*)preferencesDialog->aliasList->firstChild(); while( item ) { - QStringList protocols; + TQStringList protocols; for( ProtocolList::Iterator it = item->protocolList.begin(); it != item->protocolList.end(); ++it ) { @@ -269,13 +269,13 @@ void AliasPreferences::save() emit KCModule::changed(false); } -void AliasPreferences::addAlias( QString &alias, QString &command, const ProtocolList &p, uint id ) +void AliasPreferences::addAlias( TQString &alias, TQString &command, const ProtocolList &p, uint id ) { - QRegExp spaces( QString::fromLatin1("\\s+") ); + TQRegExp spaces( TQString::fromLatin1("\\s+") ); - if( alias.startsWith( QString::fromLatin1("/") ) ) + if( alias.startsWith( TQString::fromLatin1("/") ) ) alias = alias.section( '/', 1 ); - if( command.startsWith( QString::fromLatin1("/") ) ) + if( command.startsWith( TQString::fromLatin1("/") ) ) command = command.section( '/', 1 ); if( id == 0 ) @@ -286,13 +286,13 @@ void AliasPreferences::addAlias( QString &alias, QString &command, const Protoco id = 1; } - QString newAlias = command.section( spaces, 0, 0 ); + TQString newAlias = command.section( spaces, 0, 0 ); aliasMap.insert( alias, new AliasItem( preferencesDialog->aliasList, id, alias, command, p ) ); // count the number of arguments present in 'command' - QRegExp rx( "(%\\d+)" ); - QStringList list; + TQRegExp rx( "(%\\d+)" ); + TQStringList list; int pos = 0; while ( pos >= 0 ) { pos = rx.search( command, pos ); @@ -309,13 +309,13 @@ void AliasPreferences::addAlias( QString &alias, QString &command, const Protoco *it, alias, command, - QString::fromLatin1("Custom alias for %1").arg(command), + TQString::fromLatin1("Custom alias for %1").arg(command), Kopete::CommandHandler::UserAlias, 0, argc ); - protocolMap.insert( QPair<Kopete::Protocol*,QString>( *it, alias ), true ); + protocolMap.insert( QPair<Kopete::Protocol*,TQString>( *it, alias ), true ); } } @@ -325,13 +325,13 @@ void AliasPreferences::slotAddAlias() loadProtocols( &addDialog ); addDialog.addButton->setText( i18n("&Add") ); - if( addDialog.exec() == QDialog::Accepted ) + if( addDialog.exec() == TQDialog::Accepted ) { - QString alias = addDialog.alias->text(); - if( alias.startsWith( QString::fromLatin1("/") ) ) + TQString alias = addDialog.alias->text(); + if( alias.startsWith( TQString::fromLatin1("/") ) ) alias = alias.section( '/', 1 ); - if( alias.contains( QRegExp("[_=]") ) ) + if( alias.contains( TQRegExp("[_=]") ) ) { KMessageBox::error( this, i18n("<qt>Could not add alias <b>%1</b>. An" " alias name cannot contain the characters \"_\" or \"=\"." @@ -339,7 +339,7 @@ void AliasPreferences::slotAddAlias() } else { - QString command = addDialog.command->text(); + TQString command = addDialog.command->text(); ProtocolList protocols = selectedProtocols( &addDialog ); // Loop through selected protocols @@ -367,7 +367,7 @@ void AliasPreferences::slotAddAlias() const ProtocolList AliasPreferences::selectedProtocols( EditAliasDialog *dialog ) { ProtocolList protocolList; - QListViewItem *item = dialog->protocolList->firstChild(); + TQListViewItem *item = dialog->protocolList->firstChild(); while( item ) { @@ -390,8 +390,8 @@ const ProtocolList AliasPreferences::selectedProtocols( EditAliasDialog *dialog void AliasPreferences::loadProtocols( EditAliasDialog *dialog ) { - QValueList<KPluginInfo*> plugins = Kopete::PluginManager::self()->availablePlugins("Protocols"); - for( QValueList<KPluginInfo*>::Iterator it = plugins.begin(); it != plugins.end(); ++it ) + TQValueList<KPluginInfo*> plugins = Kopete::PluginManager::self()->availablePlugins("Protocols"); + for( TQValueList<KPluginInfo*>::Iterator it = plugins.begin(); it != plugins.end(); ++it ) { ProtocolItem *item = new ProtocolItem( dialog->protocolList, *it ); itemMap[ (Kopete::Protocol*)Kopete::PluginManager::self()->plugin( (*it)->pluginName() ) ] = item; @@ -403,10 +403,10 @@ void AliasPreferences::slotEditAlias() EditAliasDialog editDialog; loadProtocols( &editDialog ); - QListViewItem *item = preferencesDialog->aliasList->selectedItems().first(); + TQListViewItem *item = preferencesDialog->aliasList->selectedItems().first(); if( item ) { - QString oldAlias = item->text(0); + TQString oldAlias = item->text(0); editDialog.alias->setText( oldAlias ); editDialog.command->setText( item->text(1) ); ProtocolList protocols = static_cast<AliasItem*>( item )->protocolList; @@ -415,12 +415,12 @@ void AliasPreferences::slotEditAlias() itemMap[ *it ]->setSelected( true ); } - if( editDialog.exec() == QDialog::Accepted ) + if( editDialog.exec() == TQDialog::Accepted ) { - QString alias = editDialog.alias->text(); - if( alias.startsWith( QString::fromLatin1("/") ) ) + TQString alias = editDialog.alias->text(); + if( alias.startsWith( TQString::fromLatin1("/") ) ) alias = alias.section( '/', 1 ); - if( alias.contains( QRegExp("[_=]") ) ) + if( alias.contains( TQRegExp("[_=]") ) ) { KMessageBox::error( this, i18n("<qt>Could not add alias <b>%1</b>. An" " alias name cannot contain the characters \"_\" or \"=\"." @@ -428,7 +428,7 @@ void AliasPreferences::slotEditAlias() } else { - QString command = editDialog.command->text(); + TQString command = editDialog.command->text(); if( alias == oldAlias ) { @@ -468,8 +468,8 @@ void AliasPreferences::slotDeleteAliases() { if( KMessageBox::warningContinueCancel(this, i18n("Are you sure you want to delete the selected aliases?"), i18n("Delete Aliases"), KGuiItem(i18n("Delete"), "editdelete") ) == KMessageBox::Continue ) { - QPtrList< QListViewItem > items = preferencesDialog->aliasList->selectedItems(); - for( QListViewItem *i = items.first(); i; i = items.next() ) + TQPtrList< TQListViewItem > items = preferencesDialog->aliasList->selectedItems(); + for( TQListViewItem *i = items.first(); i; i = items.next() ) { ProtocolList protocols = static_cast<AliasItem*>( i )->protocolList; for( ProtocolList::Iterator it = protocols.begin(); it != protocols.end(); ++it ) @@ -479,7 +479,7 @@ void AliasPreferences::slotDeleteAliases() i->text(0) ); - protocolMap.erase( QPair<Kopete::Protocol*,QString>( *it, i->text(0) ) ); + protocolMap.erase( QPair<Kopete::Protocol*,TQString>( *it, i->text(0) ) ); } aliasMap.erase( i->text(0) ); |