diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
commit | 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch) | |
tree | 073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /kopete/libkopete/kopetecommandhandler.cpp | |
parent | 3467e6464beac3a162839bf7078e22e3a74d73e7 (diff) | |
download | tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip |
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
Diffstat (limited to 'kopete/libkopete/kopetecommandhandler.cpp')
-rw-r--r-- | kopete/libkopete/kopetecommandhandler.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
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<TQObject*, CommandList> PluginCommandMap; typedef TQMap<TQString,TQString> CommandMap; -typedef QPair<Kopete::ChatSession*, Kopete::Message::MessageDirection> ManagerPair; +typedef TQPair<Kopete::ChatSession*, Kopete::Message::MessageDirection> 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<KAction*>( 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 [<command>] - 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 <text> - Formats message as in '<nickname> 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 [<reason>] - 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 [<reason>] - 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 <text> - 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] <command> - 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); |