From kde-commits Fri Mar 14 03:30:13 2003 From: Jason Keirstead Date: Fri, 14 Mar 2003 03:30:13 +0000 To: kde-commits Subject: kdenonbeta/kopete/protocols/irc X-MARC-Message: https://marc.info/?l=kde-commits&m=104761272311379 CVS commit by brunes: Fix a bug ocurring when we tried to add text to a non existant view, it created two views M +10 -5 ircchannelcontact.cpp 1.39 M +2 -1 ircchannelcontact.h 1.21 --- kdenonbeta/kopete/protocols/irc/ircchannelcontact.cpp #1.38:1.39 @@ -23,4 +23,5 @@ #include "kirc.h" #include "kopetemessagemanagerfactory.h" +#include "kopeteviewmanager.h" #include "kopetemetacontact.h" #include "kopetestdaction.h" @@ -89,5 +90,5 @@ KopeteMessageManager* IRCChannelContact: QObject::connect( mMsgManager, SIGNAL(destroyed()), this, SLOT(slotMessageManagerDestroyed())); isConnected = true; - QTimer::singleShot( 1000, this, SLOT( slotJoinChannel() ) ); + QObject::connect( KopeteViewManager::viewManager(), SIGNAL(viewCreated(KopeteView*)),this, SLOT( slotJoinChannel(KopeteView*) ) ); } return mMsgManager; @@ -107,7 +108,11 @@ void IRCChannelContact::slotMessageManag } -void IRCChannelContact::slotJoinChannel() +void IRCChannelContact::slotJoinChannel( KopeteView *view ) { + if( view->msgManager() == mMsgManager ) + { mEngine->joinChannel(mNickName); + QObject::disconnect( KopeteViewManager::viewManager(), SIGNAL(viewCreated(KopeteView*)),this, SLOT( slotJoinChannel(KopeteView*) ) ); + } } @@ -203,5 +208,5 @@ void IRCChannelContact::slotUserJoinedCh KopeteMessage msg((KopeteContact *)this, mContact, - i18n("User %1 [%2] joined channel %3").arg(nickname).arg(user.section('!', 1)).arg(mNickName), KopeteMessage::Internal, KopeteMessage::PlainText, KopeteMessage::Chat); + i18n("User %1 [%2] joined channel %3").arg(nickname).arg(user.section('!', 1)).arg(mNickName), KopeteMessage::Internal, KopeteMessage::RichText, KopeteMessage::Chat); manager()->appendMessage(msg); } @@ -221,5 +226,5 @@ void IRCChannelContact::slotUserPartedCh } KopeteMessage msg((KopeteContact *)this, mContact, - i18n("User %1 parted channel %2 (%3)").arg(nickname).arg(mNickName).arg(reason), KopeteMessage::Internal, KopeteMessage::PlainText, KopeteMessage::Chat); + i18n("User %1 parted channel %2 (%3)").arg(nickname).arg(mNickName).arg(reason), KopeteMessage::Internal, KopeteMessage::RichText, KopeteMessage::Chat); manager()->appendMessage(msg); } --- kdenonbeta/kopete/protocols/irc/ircchannelcontact.h #1.20:1.21 @@ -30,4 +30,5 @@ class KToggleAction; class KopeteMessageManager; class KopeteMessage; +class KopeteView; /** @@ -81,5 +82,5 @@ class IRCChannelContact : public IRCCont void slotMessageManagerDestroyed(); void slotConnectedToServer(); - void slotJoinChannel(); + void slotJoinChannel( KopeteView* ); void slotUserJoinedChannel(const QString &, const QString &); void slotJoin();