diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/irc/irccontact.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/irc/irccontact.cpp')
-rw-r--r-- | kopete/protocols/irc/irccontact.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/kopete/protocols/irc/irccontact.cpp b/kopete/protocols/irc/irccontact.cpp index 64f89322..349fba60 100644 --- a/kopete/protocols/irc/irccontact.cpp +++ b/kopete/protocols/irc/irccontact.cpp @@ -19,10 +19,10 @@ #include <kdebug.h> #include <klocale.h> -#include <qregexp.h> +#include <tqregexp.h> -#include <qtimer.h> -#include <qtextcodec.h> +#include <tqtimer.h> +#include <tqtextcodec.h> #include "ircaccount.h" #include "kopeteglobal.h" @@ -36,13 +36,13 @@ #include "irccontactmanager.h" #include "ksparser.h" -IRCContact::IRCContact(IRCAccount *account, KIRC::EntityPtr entity, Kopete::MetaContact *metac, const QString& icon) +IRCContact::IRCContact(IRCAccount *account, KIRC::EntityPtr entity, Kopete::MetaContact *metac, const TQString& icon) : Kopete::Contact(account, entity->name(), metac, icon), m_chatSession(0) { } -IRCContact::IRCContact(IRCContactManager *contactManager, const QString &nick, Kopete::MetaContact *metac, const QString& icon) +IRCContact::IRCContact(IRCContactManager *contactManager, const TQString &nick, Kopete::MetaContact *metac, const TQString& icon) : Kopete::Contact(contactManager->account(), nick, metac, icon), m_nickName(nick), m_chatSession(0) @@ -53,22 +53,22 @@ IRCContact::IRCContact(IRCContactManager *contactManager, const QString &nick, K setProperty( Kopete::Global::Properties::self()->nickName(), m_nickName ); // IRCContactManager stuff - QObject::connect(contactManager, SIGNAL(privateMessage(IRCContact *, IRCContact *, const QString &)), - this, SLOT(privateMessage(IRCContact *, IRCContact *, const QString &))); + TQObject::connect(contactManager, TQT_SIGNAL(privateMessage(IRCContact *, IRCContact *, const TQString &)), + this, TQT_SLOT(privateMessage(IRCContact *, IRCContact *, const TQString &))); // Kopete::ChatSessionManager stuff mMyself.append( static_cast<Kopete::Contact*>( this ) ); // KIRC stuff - QObject::connect(engine, SIGNAL(incomingNickChange(const QString &, const QString &)), - this, SLOT( slotNewNickChange(const QString&, const QString&))); - QObject::connect(engine, SIGNAL(successfullyChangedNick(const QString &, const QString &)), - this, SLOT(slotNewNickChange(const QString &, const QString &))); - QObject::connect(engine, SIGNAL(incomingQuitIRC(const QString &, const QString &)), - this, SLOT( slotUserDisconnected(const QString&, const QString&))); + TQObject::connect(engine, TQT_SIGNAL(incomingNickChange(const TQString &, const TQString &)), + this, TQT_SLOT( slotNewNickChange(const TQString&, const TQString&))); + TQObject::connect(engine, TQT_SIGNAL(successfullyChangedNick(const TQString &, const TQString &)), + this, TQT_SLOT(slotNewNickChange(const TQString &, const TQString &))); + TQObject::connect(engine, TQT_SIGNAL(incomingQuitIRC(const TQString &, const TQString &)), + this, TQT_SLOT( slotUserDisconnected(const TQString&, const TQString&))); - QObject::connect(engine, SIGNAL(statusChanged(KIRC::Engine::Status)), - this, SLOT(updateStatus())); + TQObject::connect(engine, TQT_SIGNAL(statusChanged(KIRC::Engine::Status)), + this, TQT_SLOT(updateStatus())); engine->setCodec( m_nickName, codec() ); } @@ -101,43 +101,43 @@ bool IRCContact::isReachable() return false; } -const QString IRCContact::caption() const +const TQString IRCContact::caption() const { - return QString::null; + return TQString::null; } /* -const QString IRCContact::formatedName() const +const TQString IRCContact::formatedName() const { - return QString::null; + return TQString::null; } */ void IRCContact::updateStatus() { } -void IRCContact::privateMessage(IRCContact *, IRCContact *, const QString &) +void IRCContact::privateMessage(IRCContact *, IRCContact *, const TQString &) { } -void IRCContact::setCodec(const QTextCodec *codec) +void IRCContact::setCodec(const TQTextCodec *codec) { kircEngine()->setCodec(m_nickName, codec); - metaContact()->setPluginData(m_protocol, QString::fromLatin1("Codec"), QString::number(codec->mibEnum())); + metaContact()->setPluginData(m_protocol, TQString::fromLatin1("Codec"), TQString::number(codec->mibEnum())); } -const QTextCodec *IRCContact::codec() +const TQTextCodec *IRCContact::codec() { - QString codecId = metaContact()->pluginData(m_protocol, QString::fromLatin1("Codec")); - QTextCodec *codec = ircAccount()->codec(); + TQString codecId = metaContact()->pluginData(m_protocol, TQString::fromLatin1("Codec")); + TQTextCodec *codec = ircAccount()->codec(); if( !codecId.isEmpty() ) { bool test = true; uint mib = codecId.toInt(&test); if (test) - codec = QTextCodec::codecForMib(mib); + codec = TQTextCodec::codecForMib(mib); else - codec = QTextCodec::codecForName(codecId.latin1()); + codec = TQTextCodec::codecForName(codecId.latin1()); } if( !codec ) @@ -159,10 +159,10 @@ Kopete::ChatSession *IRCContact::manager(Kopete::Contact::CanCreateFlags canCrea m_chatSession = Kopete::ChatSessionManager::self()->create(account->myself(), mMyself, account->protocol()); m_chatSession->setDisplayName(caption()); - QObject::connect(m_chatSession, SIGNAL(messageSent(Kopete::Message&, Kopete::ChatSession *)), - this, SLOT(slotSendMsg(Kopete::Message&, Kopete::ChatSession *))); - QObject::connect(m_chatSession, SIGNAL(closing(Kopete::ChatSession *)), - this, SLOT(chatSessionDestroyed())); + TQObject::connect(m_chatSession, TQT_SIGNAL(messageSent(Kopete::Message&, Kopete::ChatSession *)), + this, TQT_SLOT(slotSendMsg(Kopete::Message&, Kopete::ChatSession *))); + TQObject::connect(m_chatSession, TQT_SIGNAL(closing(Kopete::ChatSession *)), + this, TQT_SLOT(chatSessionDestroyed())); initConversation(); } @@ -178,11 +178,11 @@ void IRCContact::chatSessionDestroyed() deleteLater(); } -void IRCContact::slotUserDisconnected(const QString &user, const QString &reason) +void IRCContact::slotUserDisconnected(const TQString &user, const TQString &reason) { if (m_chatSession) { - QString nickname = user.section('!', 0, 0); + TQString nickname = user.section('!', 0, 0); Kopete::Contact *c = locateUser( nickname ); if ( c ) { @@ -192,14 +192,14 @@ void IRCContact::slotUserDisconnected(const QString &user, const QString &reason } } -void IRCContact::setNickName( const QString &nickname ) +void IRCContact::setNickName( const TQString &nickname ) { kdDebug(14120) << k_funcinfo << m_nickName << " changed to " << nickname << endl; m_nickName = nickname; Kopete::Contact::setNickName( nickname ); } -void IRCContact::slotNewNickChange(const QString &oldnickname, const QString &newnickname) +void IRCContact::slotNewNickChange(const TQString &oldnickname, const TQString &newnickname) { IRCAccount *account = ircAccount(); @@ -219,7 +219,7 @@ void IRCContact::slotNewNickChange(const QString &oldnickname, const QString &ne void IRCContact::slotSendMsg(Kopete::Message &message, Kopete::ChatSession *) { - QString htmlString = message.escapedBody(); + TQString htmlString = message.escapedBody(); // Messages we get with RichText enabled: // @@ -229,9 +229,9 @@ void IRCContact::slotSendMsg(Kopete::Message &message, Kopete::ChatSession *) // Two-liner in color: // <span style="color:#403897">Hello<br />World</span> - if (htmlString.find(QString::fromLatin1("</span")) > -1) + if (htmlString.find(TQString::fromLatin1("</span")) > -1) { - QRegExp findTags( QString::fromLatin1("<span style=\"(.*)\">(.*)</span>") ); + TQRegExp findTags( TQString::fromLatin1("<span style=\"(.*)\">(.*)</span>") ); findTags.setMinimal( true ); int pos = 0; @@ -240,29 +240,29 @@ void IRCContact::slotSendMsg(Kopete::Message &message, Kopete::ChatSession *) pos = findTags.search(htmlString); if (pos > -1) { - QString styleHTML = findTags.cap(1); - QString replacement = findTags.cap(2); - QStringList styleAttrs = QStringList::split(';', styleHTML); + TQString styleHTML = findTags.cap(1); + TQString replacement = findTags.cap(2); + TQStringList styleAttrs = TQStringList::split(';', styleHTML); - for (QStringList::Iterator attrPair = styleAttrs.begin(); attrPair != styleAttrs.end(); ++attrPair) + for (TQStringList::Iterator attrPair = styleAttrs.begin(); attrPair != styleAttrs.end(); ++attrPair) { - QString attribute = (*attrPair).section(':',0,0); - QString value = (*attrPair).section(':',1); + TQString attribute = (*attrPair).section(':',0,0); + TQString value = (*attrPair).section(':',1); - if( attribute == QString::fromLatin1("color") ) + if( attribute == TQString::fromLatin1("color") ) { int ircColor = KSParser::colorForHTML( value ); if( ircColor > -1 ) - replacement.prepend( QString( QChar(0x03) ).append( QString::number(ircColor) ) ).append( QChar( 0x03 ) ); + replacement.prepend( TQString( TQChar(0x03) ).append( TQString::number(ircColor) ) ).append( TQChar( 0x03 ) ); } - else if( attribute == QString::fromLatin1("font-weight") && - value == QString::fromLatin1("600") ) { + else if( attribute == TQString::fromLatin1("font-weight") && + value == TQString::fromLatin1("600") ) { // Bolding - replacement.prepend( QChar(0x02) ).append( QChar(0x02) ); + replacement.prepend( TQChar(0x02) ).append( TQChar(0x02) ); } - else if( attribute == QString::fromLatin1("text-decoration") && - value == QString::fromLatin1("underline") ) { - replacement.prepend( QChar(31) ).append( QChar(31) ); + else if( attribute == TQString::fromLatin1("text-decoration") && + value == TQString::fromLatin1("underline") ) { + replacement.prepend( TQChar(31) ).append( TQChar(31) ); } } @@ -273,9 +273,9 @@ void IRCContact::slotSendMsg(Kopete::Message &message, Kopete::ChatSession *) htmlString = Kopete::Message::unescape(htmlString); - QStringList messages = QStringList::split( '\n', htmlString ); + TQStringList messages = TQStringList::split( '\n', htmlString ); - for( QStringList::Iterator it = messages.begin(); it != messages.end(); ++it ) + for( TQStringList::Iterator it = messages.begin(); it != messages.end(); ++it ) { // Dont use the resulting string(s). The problem is that we'd have to parse them // back to format that would be suitable for appendMessage(). @@ -290,25 +290,25 @@ void IRCContact::slotSendMsg(Kopete::Message &message, Kopete::ChatSession *) Kopete::Message msg(message.from(), message.to(), message.escapedBody(), message.direction(), Kopete::Message::RichText, CHAT_VIEW, message.type()); - msg.setBg(QColor()); - msg.setFg(QColor()); + msg.setBg(TQColor()); + msg.setFg(TQColor()); appendMessage(msg); } else { // Lets not modify the given message object. Kopete::Message msg = message; - msg.setBg(QColor()); + msg.setBg(TQColor()); appendMessage(msg); } manager(Kopete::Contact::CanCreate)->messageSucceeded(); } -QStringList IRCContact::sendMessage( const QString &msg ) +TQStringList IRCContact::sendMessage( const TQString &msg ) { - QStringList messages; + TQStringList messages; - QString newMessage = msg; + TQString newMessage = msg; // IRC limits the message size to 512 characters. So split the given // message into pieces. @@ -324,14 +324,14 @@ QStringList IRCContact::sendMessage( const QString &msg ) newMessage.remove(0, l); } while (!newMessage.isEmpty()); - for (QStringList::const_iterator it = messages.begin(); + for (TQStringList::const_iterator it = messages.begin(); it != messages.end(); ++it) kircEngine()->privmsg(m_nickName, *it); return messages; } -Kopete::Contact *IRCContact::locateUser(const QString &nick) +Kopete::Contact *IRCContact::locateUser(const TQString &nick) { IRCAccount *account = ircAccount(); @@ -359,8 +359,8 @@ bool IRCContact::isChatting(const Kopete::ChatSession *avoid) const if (!account) return false; - QValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions(); - for (QValueList<Kopete::ChatSession*>::Iterator it= sessions.begin(); it!=sessions.end() ; ++it) + TQValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions(); + for (TQValueList<Kopete::ChatSession*>::Iterator it= sessions.begin(); it!=sessions.end() ; ++it) { if( (*it) != avoid && (*it)->account() == account && (*it)->members().contains(this) ) @@ -402,16 +402,16 @@ KopeteView *IRCContact::view() return m_chatSession->view(false); return 0L; } -void IRCContact::serialize(QMap<QString, QString> & /*serializedData*/, QMap<QString, QString> &addressBookData) +void IRCContact::serialize(TQMap<TQString, TQString> & /*serializedData*/, TQMap<TQString, TQString> &addressBookData) { // write the - addressBookData[ protocol()->addressBookIndexField() ] = ( contactId() + QChar(0xE120) + account()->accountId() ); + addressBookData[ protocol()->addressBookIndexField() ] = ( contactId() + TQChar(0xE120) + account()->accountId() ); } void IRCContact::receivedMessage( KIRC::Engine::ServerMessageType type, const KIRC::EntityPtr &from, const KIRC::EntityPtrList &to, - const QString &msg) + const TQString &msg) { if (to.contains(m_entity)) { |