From 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 22 Jun 2011 00:30:31 +0000 Subject: TQt4 port kdenetwork This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/libkopete/kopetecommandhandler.cpp | 76 +++++++++++++++---------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'kopete/libkopete/kopetecommandhandler.cpp') diff --git a/kopete/libkopete/kopetecommandhandler.cpp b/kopete/libkopete/kopetecommandhandler.cpp index cd4dcd8c..a01d06e4 100644 --- a/kopete/libkopete/kopetecommandhandler.cpp +++ b/kopete/libkopete/kopetecommandhandler.cpp @@ -38,14 +38,14 @@ using Kopete::CommandList; typedef TQMap PluginCommandMap; typedef TQMap CommandMap; -typedef QPair ManagerPair; +typedef TQPair ManagerPair; class KopeteCommandGUIClient : public TQObject, public KXMLGUIClient { public: KopeteCommandGUIClient( Kopete::ChatSession *manager ) : TQObject(manager), KXMLGUIClient(manager) { - setXMLFile( TQString::fromLatin1("kopetecommandui.rc") ); + setXMLFile( TQString::tqfromLatin1("kopetecommandui.rc") ); TQDomDocument doc = domDocument(); TQDomNode menu = doc.documentElement().firstChild().firstChild().firstChild(); @@ -57,15 +57,15 @@ class KopeteCommandGUIClient : public TQObject, public KXMLGUIClient { KAction *a = static_cast( it.current() ); actionCollection()->insert( a ); - TQDomElement newNode = doc.createElement( TQString::fromLatin1("Action") ); - newNode.setAttribute( TQString::fromLatin1("name"), - TQString::fromLatin1( a->name() ) ); + TQDomElement newNode = doc.createElement( TQString::tqfromLatin1("Action") ); + newNode.setAttribute( TQString::tqfromLatin1("name"), + TQString::tqfromLatin1( a->name() ) ); bool added = false; for( TQDomElement n = menu.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if( TQString::fromLatin1(a->name()) < n.attribute(TQString::fromLatin1("name"))) + if( TQString::tqfromLatin1(a->name()) < n.attribute(TQString::tqfromLatin1("name"))) { menu.insertBefore( newNode, n ); added = true; @@ -94,7 +94,7 @@ struct CommandHandlerPrivate CommandHandlerPrivate *Kopete::CommandHandler::p = 0L; -Kopete::CommandHandler::CommandHandler() : TQObject( qApp ) +Kopete::CommandHandler::CommandHandler() : TQObject( tqApp ) { p->s_handler = this; p->inCommand = false; @@ -103,33 +103,33 @@ Kopete::CommandHandler::CommandHandler() : TQObject( qApp ) mCommands.setAutoDelete( true ); p->pluginCommands.insert( this, mCommands ); - registerCommand( this, TQString::fromLatin1("help"), TQT_SLOT( slotHelpCommand( const TQString &, Kopete::ChatSession * ) ), + registerCommand( this, TQString::tqfromLatin1("help"), TQT_SLOT( slotHelpCommand( const TQString &, Kopete::ChatSession * ) ), i18n( "USAGE: /help [] - Used to list available commands, or show help for a specified command." ), 0, 1 ); - registerCommand( this, TQString::fromLatin1("close"), TQT_SLOT( slotCloseCommand( const TQString &, Kopete::ChatSession * ) ), + registerCommand( this, TQString::tqfromLatin1("close"), TQT_SLOT( slotCloseCommand( const TQString &, Kopete::ChatSession * ) ), i18n( "USAGE: /close - Closes the current view." ) ); // FIXME: What's the difference with /close? The help doesn't explain it - Martijn - registerCommand( this, TQString::fromLatin1("part"), TQT_SLOT( slotPartCommand( const TQString &, Kopete::ChatSession * ) ), + registerCommand( this, TQString::tqfromLatin1("part"), TQT_SLOT( slotPartCommand( const TQString &, Kopete::ChatSession * ) ), i18n( "USAGE: /part - Closes the current view." ) ); - registerCommand( this, TQString::fromLatin1("clear"), TQT_SLOT( slotClearCommand( const TQString &, Kopete::ChatSession * ) ), + registerCommand( this, TQString::tqfromLatin1("clear"), TQT_SLOT( slotClearCommand( const TQString &, Kopete::ChatSession * ) ), i18n( "USAGE: /clear - Clears the active view's chat buffer." ) ); - //registerCommand( this, TQString::fromLatin1("me"), TQT_SLOT( slotMeCommand( const TQString &, Kopete::ChatSession * ) ), + //registerCommand( this, TQString::tqfromLatin1("me"), TQT_SLOT( slotMeCommand( const TQString &, Kopete::ChatSession * ) ), // i18n( "USAGE: /me - Formats message as in ' went to the store'." ) ); - registerCommand( this, TQString::fromLatin1("away"), TQT_SLOT( slotAwayCommand( const TQString &, Kopete::ChatSession * ) ), + registerCommand( this, TQString::tqfromLatin1("away"), TQT_SLOT( slotAwayCommand( const TQString &, Kopete::ChatSession * ) ), i18n( "USAGE: /away [] - Marks you as away/back for the current account only." ) ); - registerCommand( this, TQString::fromLatin1("awayall"), TQT_SLOT( slotAwayAllCommand( const TQString &, Kopete::ChatSession * ) ), + registerCommand( this, TQString::tqfromLatin1("awayall"), TQT_SLOT( slotAwayAllCommand( const TQString &, Kopete::ChatSession * ) ), i18n( "USAGE: /awayall [] - Marks you as away/back for all accounts." ) ); - registerCommand( this, TQString::fromLatin1("say"), TQT_SLOT( slotSayCommand( const TQString &, Kopete::ChatSession * ) ), + registerCommand( this, TQString::tqfromLatin1("say"), TQT_SLOT( slotSayCommand( const TQString &, Kopete::ChatSession * ) ), i18n( "USAGE: /say - Say text in this chat. This is the same as just typing a message, but is very " "useful for scripts." ), 1 ); - registerCommand( this, TQString::fromLatin1("exec"), TQT_SLOT( slotExecCommand( const TQString &, Kopete::ChatSession * ) ), + registerCommand( this, TQString::tqfromLatin1("exec"), TQT_SLOT( slotExecCommand( const TQString &, Kopete::ChatSession * ) ), i18n( "USAGE: /exec [-o] - Executes the specified command and displays the output in the chat buffer. " "If -o is specified, the output is sent to all members of the chat."), 1 ); @@ -156,43 +156,43 @@ Kopete::CommandHandler *Kopete::CommandHandler::commandHandler() return p->s_handler; } -void Kopete::CommandHandler::registerCommand( TQObject *parent, const TQString &command, const char* handlerSlot, +void Kopete::CommandHandler::registerCommand( TQObject *tqparent, const TQString &command, const char* handlerSlot, const TQString &help, uint minArgs, int maxArgs, const KShortcut &cut, const TQString &pix ) { TQString lowerCommand = command.lower(); - Kopete::Command *mCommand = new Kopete::Command( parent, lowerCommand, handlerSlot, help, - Normal, TQString::null, minArgs, maxArgs, cut, pix); - p->pluginCommands[ parent ].insert( lowerCommand, mCommand ); + Kopete::Command *mCommand = new Kopete::Command( tqparent, lowerCommand, handlerSlot, help, + Normal, TQString(), minArgs, maxArgs, cut, pix); + p->pluginCommands[ tqparent ].insert( lowerCommand, mCommand ); } -void Kopete::CommandHandler::unregisterCommand( TQObject *parent, const TQString &command ) +void Kopete::CommandHandler::unregisterCommand( TQObject *tqparent, const TQString &command ) { - if( p->pluginCommands[ parent ].find(command) ) - p->pluginCommands[ parent ].remove( command ); + if( p->pluginCommands[ tqparent ].tqfind(command) ) + p->pluginCommands[ tqparent ].remove( command ); } -void Kopete::CommandHandler::registerAlias( TQObject *parent, const TQString &alias, const TQString &formatString, +void Kopete::CommandHandler::registerAlias( TQObject *tqparent, const TQString &alias, const TQString &formatString, const TQString &help, CommandType type, uint minArgs, int maxArgs, const KShortcut &cut, const TQString &pix ) { TQString lowerAlias = alias.lower(); - Kopete::Command *mCommand = new Kopete::Command( parent, lowerAlias, 0L, help, type, + Kopete::Command *mCommand = new Kopete::Command( tqparent, lowerAlias, 0L, help, type, formatString, minArgs, maxArgs, cut, pix ); - p->pluginCommands[ parent ].insert( lowerAlias, mCommand ); + p->pluginCommands[ tqparent ].insert( lowerAlias, mCommand ); } -void Kopete::CommandHandler::unregisterAlias( TQObject *parent, const TQString &alias ) +void Kopete::CommandHandler::unregisterAlias( TQObject *tqparent, const TQString &alias ) { - if( p->pluginCommands[ parent ].find(alias) ) - p->pluginCommands[ parent ].remove( alias ); + if( p->pluginCommands[ tqparent ].tqfind(alias) ) + p->pluginCommands[ tqparent ].remove( alias ); } bool Kopete::CommandHandler::processMessage( const TQString &msg, Kopete::ChatSession *manager ) { if( p->inCommand ) return false; - TQRegExp splitRx( TQString::fromLatin1("^/([\\S]+)(.*)") ); + TQRegExp splitRx( TQString::tqfromLatin1("^/([\\S]+)(.*)") ); TQString command; TQString args; if(splitRx.search(msg) != -1) @@ -255,7 +255,7 @@ void Kopete::CommandHandler::slotHelpCommand( const TQString &args, Kopete::Chat if( c && !c->help().isNull() ) output = c->help(); else - output = i18n("There is no help available for '%1'.").arg( command ); + output = i18n("There is no help available for '%1'.").tqarg( command ); } Kopete::Message msg(manager->myself(), manager->members(), output, Kopete::Message::Internal, Kopete::Message::PlainText); @@ -275,18 +275,18 @@ void Kopete::CommandHandler::slotExecCommand( const TQString &args, Kopete::Chat if( !args.isEmpty() ) { KProcess *proc = 0L; - if ( kapp->authorize( TQString::fromLatin1( "shell_access" ) ) ) + if ( kapp->authorize( TQString::tqfromLatin1( "shell_access" ) ) ) proc = new KProcess(manager); if( proc ) { - *proc << TQString::fromLatin1("sh") << TQString::fromLatin1("-c"); + *proc << TQString::tqfromLatin1("sh") << TQString::tqfromLatin1("-c"); TQStringList argsList = parseArguments( args ); - if( argsList.front() == TQString::fromLatin1("-o") ) + if( argsList.front() == TQString::tqfromLatin1("-o") ) { p->processMap.insert( proc, ManagerPair(manager, Kopete::Message::Outbound) ); - *proc << args.section(TQRegExp(TQString::fromLatin1("\\s+")), 1); + *proc << args.section(TQRegExp(TQString::tqfromLatin1("\\s+")), 1); } else { @@ -371,7 +371,7 @@ void Kopete::CommandHandler::slotExecFinished(KProcess *proc) TQStringList Kopete::CommandHandler::parseArguments( const TQString &args ) { TQStringList arguments; - TQRegExp quotedArgs( TQString::fromLatin1("\"(.*)\"") ); + TQRegExp quotedArgs( TQString::tqfromLatin1("\"(.*)\"") ); quotedArgs.setMinimal( true ); if ( quotedArgs.search( args ) != -1 ) @@ -380,7 +380,7 @@ TQStringList Kopete::CommandHandler::parseArguments( const TQString &args ) arguments.append( quotedArgs.cap(i) ); } - TQStringList otherArgs = TQStringList::split( TQRegExp(TQString::fromLatin1("\\s+")), args.section( quotedArgs, 0 ) ); + TQStringList otherArgs = TQStringList::split( TQRegExp(TQString::tqfromLatin1("\\s+")), args.section( quotedArgs, 0 ) ); for( TQStringList::Iterator it = otherArgs.begin(); it != otherArgs.end(); ++it ) arguments.append( *it ); @@ -470,7 +470,7 @@ void Kopete::CommandHandler::slotViewCreated( KopeteView *view ) void Kopete::CommandHandler::slotPluginLoaded( Kopete::Plugin *plugin ) { connect( plugin, TQT_SIGNAL( destroyed( TQObject * ) ), this, TQT_SLOT( slotPluginDestroyed( TQObject * ) ) ); - if( !p->pluginCommands.contains( plugin ) ) + if( !p->pluginCommands.tqcontains( plugin ) ) { //Create a TQDict optomized for a larger # of commands, and case insensitive CommandList mCommands(31, false); -- cgit v1.2.1