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/private/kopetecommand.cpp | 26 ++++++------- kopete/libkopete/private/kopetecommand.h | 9 +++-- kopete/libkopete/private/kopeteemoticons.cpp | 52 +++++++++++++------------- kopete/libkopete/private/kopeteemoticons.h | 15 ++++---- kopete/libkopete/private/kopeteutils_private.h | 3 +- kopete/libkopete/private/kopeteviewmanager.cpp | 24 ++++++------ kopete/libkopete/private/kopeteviewmanager.h | 5 ++- 7 files changed, 69 insertions(+), 65 deletions(-) (limited to 'kopete/libkopete/private') diff --git a/kopete/libkopete/private/kopetecommand.cpp b/kopete/libkopete/private/kopetecommand.cpp index 1f8969f6..f9fef1b6 100644 --- a/kopete/libkopete/private/kopetecommand.cpp +++ b/kopete/libkopete/private/kopetecommand.cpp @@ -25,11 +25,11 @@ #include "kopetecommand.h" #include "kopeteuiglobal.h" -Kopete::Command::Command( TQObject *parent, const TQString &command, const char* handlerSlot, +Kopete::Command::Command( TQObject *tqparent, const TQString &command, const char* handlerSlot, const TQString &help, Kopete::CommandHandler::CommandType type, const TQString &formatString, uint minArgs, int maxArgs, const KShortcut &cut, const TQString &pix ) - : KAction( command[0].upper() + command.right( command.length() - 1).lower(), pix, cut, parent, - ( command.lower() + TQString::fromLatin1("_command") ).latin1() ) + : KAction( command[0].upper() + command.right( command.length() - 1).lower(), pix, cut, tqparent, + ( command.lower() + TQString::tqfromLatin1("_command") ).latin1() ) { init( command, handlerSlot, help, type, formatString, minArgs, maxArgs ); } @@ -48,7 +48,7 @@ void Kopete::Command::init( const TQString &command, const char* slot, const TQS if( m_type == Kopete::CommandHandler::Normal ) { TQObject::connect( this, TQT_SIGNAL( handleCommand( const TQString &, Kopete::ChatSession *) ), - parent(), slot ); + tqparent(), slot ); } TQObject::connect( this, TQT_SIGNAL( activated() ), this, TQT_SLOT( slotAction() ) ); @@ -61,7 +61,7 @@ void Kopete::Command::slotAction() TQString args; if( m_minArgs > 0 ) { - args = KInputDialog::getText( i18n("Enter Arguments"), i18n("Enter the arguments to %1:").arg(m_command) ); + args = KInputDialog::getText( i18n("Enter Arguments"), i18n("Enter the arguments to %1:").tqarg(m_command) ); if( args.isNull() ) return; } @@ -74,23 +74,23 @@ void Kopete::Command::processCommand( const TQString &args, Kopete::ChatSession TQStringList mArgs = Kopete::CommandHandler::parseArguments( args ); if( m_processing ) { - printError( i18n("Alias \"%1\" expands to itself.").arg( text() ), manager, gui ); + printError( i18n("Alias \"%1\" expands to itself.").tqarg( text() ), manager, gui ); } else if( mArgs.count() < m_minArgs ) { printError( i18n("\"%1\" requires at least %n argument.", "\"%1\" requires at least %n arguments.", m_minArgs) - .arg( text() ), manager, gui ); + .tqarg( text() ), manager, gui ); } else if( m_maxArgs > -1 && (int)mArgs.count() > m_maxArgs ) { printError( i18n("\"%1\" has a maximum of %n argument.", "\"%1\" has a maximum of %n arguments.", m_minArgs) - .arg( text() ), manager, gui ); + .tqarg( text() ), manager, gui ); } else if( !KApplication::kApplication()->authorizeKAction( name() ) ) { - printError( i18n("You are not authorized to perform the command \"%1\".").arg(text()), manager, gui ); + printError( i18n("You are not authorized to perform the command \"%1\".").tqarg(text()), manager, gui ); } else { @@ -102,20 +102,20 @@ void Kopete::Command::processCommand( const TQString &args, Kopete::ChatSession // Translate %s to the whole string and %n to current nickname - formatString.replace( TQString::fromLatin1("%n"), manager->myself()->nickName() ); - formatString.replace( TQString::fromLatin1("%s"), args ); + formatString.tqreplace( TQString::tqfromLatin1("%n"), manager->myself()->nickName() ); + formatString.tqreplace( TQString::tqfromLatin1("%s"), args ); // Translate %1..%N to word1..wordN while( mArgs.count() > 0 ) { - formatString = formatString.arg( mArgs.front() ); + formatString = formatString.tqarg( mArgs.front() ); mArgs.pop_front(); } kdDebug(14010) << "New Command after processing alias: " << formatString << endl; - Kopete::CommandHandler::commandHandler()->processMessage( TQString::fromLatin1("/") + formatString, manager ); + Kopete::CommandHandler::commandHandler()->processMessage( TQString::tqfromLatin1("/") + formatString, manager ); } else { diff --git a/kopete/libkopete/private/kopetecommand.h b/kopete/libkopete/private/kopetecommand.h index 6a686f1e..d49de208 100644 --- a/kopete/libkopete/private/kopetecommand.h +++ b/kopete/libkopete/private/kopetecommand.h @@ -30,12 +30,13 @@ class ChatSession; class Command : public KAction { Q_OBJECT + TQ_OBJECT public: /** * Creates a Kopete::Command object * - * @param parent The plugin who owns this command + * @param tqparent The plugin who owns this command * @param command The command we want to handle, not including the '/' * @param handlerSlot The slot used to handle the command. This slot must * accept two parameters, a TQString of arguments, and a Kopete::ChatSession @@ -49,10 +50,10 @@ class Command : public KAction * @param cut The shortcut for the command * @param pix The icon to use for the command */ - Command( TQObject *parent, const TQString &command, const char* handlerSlot, - const TQString &help = TQString::null, CommandHandler::CommandType type = CommandHandler::Normal, const TQString &formatString = TQString::null, + Command( TQObject *tqparent, const TQString &command, const char* handlerSlot, + const TQString &help = TQString(), CommandHandler::CommandType type = CommandHandler::Normal, const TQString &formatString = TQString(), uint minArgs = 0, int maxArgs = -1, const KShortcut &cut = 0, - const TQString &pix = TQString::null ); + const TQString &pix = TQString() ); /** * Process this command diff --git a/kopete/libkopete/private/kopeteemoticons.cpp b/kopete/libkopete/private/kopeteemoticons.cpp index a2d33341..1edede5d 100644 --- a/kopete/libkopete/private/kopeteemoticons.cpp +++ b/kopete/libkopete/private/kopeteemoticons.cpp @@ -52,7 +52,7 @@ struct Emoticons::Emoticon bool operator< (const Emoticon &e){ return matchText.length() > e.matchText.length(); } TQString matchText; TQString matchTextEscaped; - QString picPath; + TQString picPath; TQString picHTMLCode; }; @@ -183,7 +183,7 @@ TQValueList Emoticons::tokenize( const TQString& message, uint p = c; continue; } /* strict requires space before the emoticon */ - if ( d->emoticonMap.contains( c ) ) + if ( d->emoticonMap.tqcontains( c ) ) { emoticonList = d->emoticonMap[ c ]; bool found = false; @@ -192,7 +192,7 @@ TQValueList Emoticons::tokenize( const TQString& message, uint // If this is an HTML, then search for the HTML form of the emoticon. // For instance >o) needle = ( mode & SkipHTML ) ? (*it).matchTextEscaped : (*it).matchText; - if ( ( pos == (size_t)message.find( needle, pos ) ) ) + if ( ( pos == (size_t)message.tqfind( needle, pos ) ) ) { if( mode & StrictParse ) { @@ -214,11 +214,11 @@ TQValueList Emoticons::tokenize( const TQString& message, uint { if( inHTMLEntity ){ // If we are in an HTML entitiy such as > - int htmlEnd = message.find( ';', pos ); + int htmlEnd = message.tqfind( ';', pos ); // Search for where it ends if( htmlEnd == -1 ) { - // Apparently this HTML entity isn't ended, something is wrong, try skip the '&' + // Aptqparently this HTML entity isn't ended, something is wrong, try skip the '&' // and continue kdDebug( 14000 ) << k_funcinfo << "Broken HTML entity, trying to recover." << endl; inHTMLEntity = false; @@ -300,14 +300,14 @@ void Emoticons::addIfPossible( const TQString& filenameNoExt, const TQStringList TQString pic; //maybe an extension was given, so try to find the exact file - pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt ); + pic = dir->findResource( "emoticons", d->theme + TQString::tqfromLatin1( "/" ) + filenameNoExt ); if( pic.isNull() ) - pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".mng" ) ); + pic = dir->findResource( "emoticons", d->theme + TQString::tqfromLatin1( "/" ) + filenameNoExt + TQString::tqfromLatin1( ".mng" ) ); if ( pic.isNull() ) - pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".png" ) ); + pic = dir->findResource( "emoticons", d->theme + TQString::tqfromLatin1( "/" ) + filenameNoExt + TQString::tqfromLatin1( ".png" ) ); if ( pic.isNull() ) - pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".gif" ) ); + pic = dir->findResource( "emoticons", d->theme + TQString::tqfromLatin1( "/" ) + filenameNoExt + TQString::tqfromLatin1( ".gif" ) ); if( !pic.isNull() ) // only add if we found one file { @@ -328,15 +328,15 @@ void Emoticons::addIfPossible( const TQString& filenameNoExt, const TQStringList // Unless we do so, ChatMessagePart::slotScrollView does not work properly and causing // HTMLPart not to be scrolled to the very last message. p.load( e.picPath ); - result = TQString::fromLatin1( "" ); + TQString::tqfromLatin1( "\" />" ); e.picHTMLCode = result; e.matchTextEscaped = matchEscaped; @@ -365,10 +365,10 @@ void Emoticons::initEmoticons( const TQString &theme ) d->emoticonAndPicList.clear(); d->emoticonMap.clear(); - TQString filename= KGlobal::dirs()->findResource( "emoticons", d->theme + TQString::fromLatin1( "/emoticons.xml" ) ); + TQString filename= KGlobal::dirs()->findResource( "emoticons", d->theme + TQString::tqfromLatin1( "/emoticons.xml" ) ); if(!filename.isEmpty()) return initEmoticon_emoticonsxml( filename ); - filename= KGlobal::dirs()->findResource( "emoticons", d->theme + TQString::fromLatin1( "/icondef.xml" ) ); + filename= KGlobal::dirs()->findResource( "emoticons", d->theme + TQString::tqfromLatin1( "/icondef.xml" ) ); if(!filename.isEmpty()) return initEmoticon_JEP0038( filename ); kdWarning(14010) << k_funcinfo << "emotiucon XML theme description not found" < * @since 23-03-05 @@ -180,7 +181,7 @@ private slots: * Fills the map with paths and emoticons * This needs to be done on every emoticon-theme change **/ - void initEmoticons ( const TQString &theme = TQString::null ); + void initEmoticons ( const TQString &theme = TQString() ); }; diff --git a/kopete/libkopete/private/kopeteutils_private.h b/kopete/libkopete/private/kopeteutils_private.h index 8c780c2f..4114e65f 100644 --- a/kopete/libkopete/private/kopeteutils_private.h +++ b/kopete/libkopete/private/kopeteutils_private.h @@ -37,9 +37,10 @@ typedef struct TQString debugInfo; } ErrorNotificationInfo; -class NotifyHelper : public QObject +class NotifyHelper : public TQObject { Q_OBJECT + TQ_OBJECT public: static NotifyHelper* self(); void registerNotification(const KNotification* event, ErrorNotificationInfo error); diff --git a/kopete/libkopete/private/kopeteviewmanager.cpp b/kopete/libkopete/private/kopeteviewmanager.cpp index 2a6ccb84..4650ffb9 100644 --- a/kopete/libkopete/private/kopeteviewmanager.cpp +++ b/kopete/libkopete/private/kopeteviewmanager.cpp @@ -110,7 +110,7 @@ KopeteView *KopeteViewManager::view( Kopete::ChatSession* session, const TQStrin { // kdDebug(14000) << k_funcinfo << endl; - if( d->managerMap.contains( session ) && d->managerMap[ session ] ) + if( d->managerMap.tqcontains( session ) && d->managerMap[ session ] ) { return d->managerMap[ session ]; } @@ -132,7 +132,7 @@ KopeteView *KopeteViewManager::view( Kopete::ChatSession* session, const TQStrin } if( !viewPlugin ) - viewPlugin = (Kopete::ViewPlugin*)pluginManager->loadPlugin( TQString::fromLatin1("kopete_chatwindow") ); + viewPlugin = (Kopete::ViewPlugin*)pluginManager->loadPlugin( TQString::tqfromLatin1("kopete_chatwindow") ); if( viewPlugin ) { @@ -161,7 +161,7 @@ void KopeteViewManager::messageAppended( Kopete::Message &msg, Kopete::ChatSessi bool outgoingMessage = ( msg.direction() == Kopete::Message::Outbound ); - if( !outgoingMessage || d->managerMap.contains( manager ) ) + if( !outgoingMessage || d->managerMap.tqcontains( manager ) ) { d->foreignMessage=!outgoingMessage; //let know for the view we are about to create manager->view(true,msg.requestedPlugin())->appendMessage( msg ); @@ -175,7 +175,7 @@ void KopeteViewManager::messageAppended( Kopete::Message &msg, Kopete::ChatSessi // append msg event to queue if chat window is active but not the chat view in it... appendMessageEvent = appendMessageEvent && !(w->isActiveWindow() && manager->view() == d->activeView); // ...and chat window is on another desktop - appendMessageEvent = appendMessageEvent && (!d->queueOnlyMessagesOnAnotherDesktop || !KWin::windowInfo( w->topLevelWidget()->winId(), NET::WMDesktop ).isOnCurrentDesktop()); + appendMessageEvent = appendMessageEvent && (!d->queueOnlyMessagesOnAnotherDesktop || !KWin::windowInfo( w->tqtopLevelWidget()->winId(), NET::WMDesktop ).isOnCurrentDesktop()); } else { @@ -211,7 +211,7 @@ void KopeteViewManager::messageAppended( Kopete::Message &msg, Kopete::ChatSessi config->readBoolEntry("EventIfActive", true) || !w->isActiveWindow()) && msg.from()) { - TQString msgFrom = TQString::null; + TQString msgFrom = TQString(); if( msg.from()->metaContact() ) msgFrom = msg.from()->metaContact()->displayName(); else @@ -219,7 +219,7 @@ void KopeteViewManager::messageAppended( Kopete::Message &msg, Kopete::ChatSessi TQString msgText = msg.plainBody(); if( msgText.length() > 90 ) - msgText = msgText.left(88) + TQString::fromLatin1("..."); + msgText = msgText.left(88) + TQString::tqfromLatin1("..."); TQString event; TQString body =i18n( "Incoming message from %1
\"%2\"
" ); @@ -227,16 +227,16 @@ void KopeteViewManager::messageAppended( Kopete::Message &msg, Kopete::ChatSessi switch( msg.importance() ) { case Kopete::Message::Low: - event = TQString::fromLatin1( "kopete_contact_lowpriority" ); + event = TQString::tqfromLatin1( "kopete_contact_lowpriority" ); break; case Kopete::Message::Highlight: - event = TQString::fromLatin1( "kopete_contact_highlight" ); + event = TQString::tqfromLatin1( "kopete_contact_highlight" ); body = i18n( "A highlighted message arrived from %1
\"%2\"
" ); break; default: - event = TQString::fromLatin1( "kopete_contact_incoming" ); + event = TQString::tqfromLatin1( "kopete_contact_incoming" ); } - KNotification *notify=KNotification::event(msg.from()->metaContact() , event, body.arg( TQStyleSheet::escape(msgFrom), TQStyleSheet::escape(msgText) ), 0, /*msg.from()->metaContact(),*/ + KNotification *notify=KNotification::event(msg.from()->metaContact() , event, body.tqarg( TQStyleSheet::escape(msgFrom), TQStyleSheet::escape(msgText) ), 0, /*msg.from()->metaContact(),*/ w , i18n("View") ); connect(notify,TQT_SIGNAL(activated(unsigned int )), manager , TQT_SLOT(raiseView()) ); @@ -329,7 +329,7 @@ void KopeteViewManager::slotViewDestroyed( KopeteView *closingView ) { // kdDebug( 14000 ) << k_funcinfo << endl; - if( d->managerMap.contains( closingView->msgManager() ) ) + if( d->managerMap.tqcontains( closingView->msgManager() ) ) { d->managerMap.remove( closingView->msgManager() ); // closingView->msgManager()->setCanBeDeleted( true ); @@ -343,7 +343,7 @@ void KopeteViewManager::slotChatSessionDestroyed( Kopete::ChatSession *manager ) { // kdDebug( 14000 ) << k_funcinfo << endl; - if( d->managerMap.contains( manager ) ) + if( d->managerMap.tqcontains( manager ) ) { KopeteView *v=d->managerMap[ manager ]; v->closeView( true ); diff --git a/kopete/libkopete/private/kopeteviewmanager.h b/kopete/libkopete/private/kopeteviewmanager.h index f2302f6d..c1de7730 100644 --- a/kopete/libkopete/private/kopeteviewmanager.h +++ b/kopete/libkopete/private/kopeteviewmanager.h @@ -36,9 +36,10 @@ struct KopeteViewManagerPrivate; /** * Relates an actual chat to the means used to view it. */ -class KOPETE_EXPORT KopeteViewManager : public QObject +class KOPETE_EXPORT KopeteViewManager : public TQObject { Q_OBJECT + TQ_OBJECT public: /** This is a singleton class. Call this method to get a pointer to * a KopeteViewManager. @@ -54,7 +55,7 @@ class KOPETE_EXPORT KopeteViewManager : public QObject * @param session The Kopete::ChatSession we are viewing. * @param requestedPlugin Specifies the view plugin to use. */ - KopeteView *view( Kopete::ChatSession *session, const TQString &requestedPlugin = TQString::null ); + KopeteView *view( Kopete::ChatSession *session, const TQString &requestedPlugin = TQString() ); /** * Provide access to the list of KopeteChatWindow the class maintains. -- cgit v1.2.1