[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: KDE/kdenetwork/kopete
From: Lamarque Souza <lamarque () gmail ! com>
Date: 2011-03-02 21:26:34
Message-ID: 20110302212634.557E8AC8C2 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1223419 by lvsouza:
Applying patch from http://reviewboard.kde.org/r/5364/
Thanks Igor Poboiko for the patch.
BUG: 251279
CCMAIL: kopete-devel@kde.org
M +38 -11 libkopete/kopetechatsession.cpp
M +5 -0 libkopete/kopetechatsession.h
M +11 -0 libkopete/private/kopeteactivenotification.cpp
M +5 -0 libkopete/private/kopeteactivenotification.h
M +1 -1 protocols/oscar/aim/aimaccount.cpp
M +3 -3 protocols/oscar/aim/ui/aimeditaccountui.ui
M +3 -3 protocols/oscar/aim/ui/aimeditaccountwidget.cpp
M +1 -1 protocols/oscar/liboscar/tasks/filetransfertask.cpp
M +1 -1 protocols/oscar/liboscar/tests/logintest.cpp
M +4 -2 protocols/oscar/oscarcontact.cpp
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetechatsession.cpp #1223418:1223419
@@ -49,6 +49,7 @@
#include "kopetepluginmanager.h"
#include "kopeteprotocol.h"
#include "kopetepicture.h"
+#include "kopeteactivenotification.h"
const int CHAIN_COUNT = 3;
@@ -58,6 +59,7 @@
Kopete::ContactPtrList contacts;
const Kopete::Contact *mUser;
QMap<const Kopete::Contact *, Kopete::OnlineStatus> contactStatus;
+ Kopete::ActiveNotifications typingNotifications;
Kopete::Protocol *mProtocol;
bool isEmpty;
bool mCanBeDeleted;
@@ -532,8 +534,8 @@
void Kopete::ChatSession::receivedTypingMsg( const Kopete::Contact *c, bool t )
{
- if ( t )
- {
+ emit remoteTyping( c, t );
+
QWidget *viewWidget = 0L;
bool isActiveWindow = false;
@@ -543,26 +545,50 @@
isActiveWindow = view(false) && ( viewWidget && viewWidget->isActiveWindow() );
}
- if ( ! isActiveWindow )
+ // We aren't interested in notification from current window
+ // or 'user stopped typing' notifications
+ if ( isActiveWindow || !t )
{
- KNotification * notification = new KNotification ( "user_is_typing_message", \
Kopete::UI::Global::mainWidget() );
- notification->setText( i18n("User <i>%1</i> is typing a message", c->nickName()) \
); + return;
+ }
+
+ // If there is a notification in d->typingNotifications, then we should show it and \
quit + Kopete::ActiveNotifications::iterator notifyIt =
+ d->typingNotifications.find( c->account()->accountLabel() + c->contactId() );
+ if (notifyIt != d->typingNotifications.end())
+ {
+ ( *notifyIt )->showNotification();
+ return;
+ }
+
+ KNotification *notification = new KNotification( "user_is_typing_message", \
viewWidget ); + const QString msgBody = i18n( "User <i>%1</i> is typing a message", \
c->nickName() ); + notification->setText( msgBody );
notification->setPixmap( QPixmap::fromImage( c->metaContact()->picture().image() \
) ); notification->setActions( QStringList( i18nc("@action", "Chat") ) );
- notification->addContext( qMakePair( QString::fromLatin1("contact"), \
c->metaContact()->metaContactId().toString() ) );
- foreach( Kopete::Group *g , c->metaContact()->groups() )
+ new Kopete::ActiveNotification( notification,
+ c->account()->accountLabel() + c->contactId(),
+ d->typingNotifications,
+ "",
+ msgBody );
+
+ Kopete::MetaContact *mc = c->metaContact();
+ if ( mc )
{
+ notification->addContext( qMakePair( QString::fromLatin1("contact"), \
mc->metaContactId().toString() ) ); + foreach( Kopete::Group *g , mc->groups() )
+ {
notification->addContext( qMakePair( QString::fromLatin1("group") , \
QString::number( g->groupId() ) ) ); }
+ }
+ connect( notification, SIGNAL(activated(unsigned int)) , c, SLOT(execute()) );
+ // User don't need this notification when view is activate
+ connect( this, SIGNAL( viewActivated( KopeteView * ) ), notification, SLOT( close() \
) );
- connect( notification, SIGNAL(activated(unsigned int)) , c, SLOT(execute()) );
notification->sendEvent();
}
- }
- emit remoteTyping( c, t );
-}
void Kopete::ChatSession::receivedTypingMsg( const QString &contactId, bool t )
{
@@ -620,6 +646,7 @@
d->view = Kopete::ChatSessionManager::self()->createView( this, requestedPlugin );
if ( d->view )
{
+ connect( d->view->mainWidget(), SIGNAL( activated( KopeteView * ) ), this, \
SIGNAL( viewActivated( KopeteView * ) ) ); connect( d->view->mainWidget(), SIGNAL( \
closing( KopeteView * ) ), this, SLOT( slotViewDestroyed( ) ) ); }
else
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetechatsession.h #1223418:1223419
@@ -311,6 +311,11 @@
void eventNotification( const QString& notificationText);
/**
+ * Signals that view for that chat session was activated
+ */
+ void viewActivated( KopeteView* view );
+
+ /**
* Signals that a message has changed its state.
* The chat window connects to this signal to update the message in chat view.
*/
--- trunk/KDE/kdenetwork/kopete/libkopete/private/kopeteactivenotification.cpp \
#1223418:1223419 @@ -26,7 +26,10 @@
{
notifications.insert( id, this );
KNotification* aParent = static_cast<KNotification *>( parent() );
+ if ( !title.isEmpty() )
+ {
aParent->setTitle( "<qt>" + title + "</qt>" );
+ }
aParent->setText( "<qt>" + body + "</qt>" );
}
@@ -38,11 +41,19 @@
}
/**
+ * Show this notification
+ */
+ void ActiveNotification::showNotification() {
+ static_cast<KNotification *>( parent() )->sendEvent();
+ }
+
+ /**
* received another message from a sender with a notification
*/
void ActiveNotification::incrementMessages() {
KLocalizedString append = ki18np( "+ %1 more message", "+ %1 more \
messages");
KNotification *aParent = static_cast<KNotification *>( parent() );
aParent->setText( "<qt>" + body + "<br/><small><font color=\"yellow\">" \
+ append.subs( ++nEventsSinceNotified ).toString() + "</small></font></qt>" ); + \
aParent->sendEvent(); // Show it }
}
--- trunk/KDE/kdenetwork/kopete/libkopete/private/kopeteactivenotification.h \
#1223418:1223419 @@ -44,6 +44,11 @@
~ActiveNotification();
/**
+ * Show this notification
+ */
+ void showNotification();
+
+ /**
* received another message from a sender with a notification
*/
void incrementMessages();
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/aim/aimaccount.cpp #1223418:1223419
@@ -646,7 +646,7 @@
// Get the screen name for this account
QString screenName = accountId();
- QString server = configGroup()->readEntry( "Server", QString::fromLatin1( \
"login.oscar.aol.com" ) ); + QString server = configGroup()->readEntry( "Server", \
QString::fromLatin1( "login.icq.com" ) ); uint port = configGroup()->readEntry( \
"Port", 5190 );
//set up the settings for the account
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/aim/ui/aimeditaccountui.ui \
#1223418:1223419 @@ -334,7 +334,7 @@
<string>The IP address or hostmask of the AIM server you wish to \
connect to.</string> </property>
<property name="whatsThis" >
- <string>The IP address or hostmask of the AIM server you wish to \
connect to. Normally you will want the default (login.oscar.aol.com).</string> + \
<string>The IP address or hostmask of the AIM server you wish to connect to. \
Normally you will want the default (login.icq.com).</string> </property>
<property name="text" >
<string>Ser&ver:</string>
@@ -353,10 +353,10 @@
<string>The IP address or hostmask of the AIM server you wish to \
connect to.</string> </property>
<property name="whatsThis" >
- <string>The IP address or hostmask of the AIM server you wish to \
connect to. Normally you will want the default (login.oscar.aol.com).</string> + \
<string>The IP address or hostmask of the AIM server you wish to connect to. \
Normally you will want the default (login.icq.com).</string> </property>
<property name="text" >
- <string>login.oscar.aol.com</string>
+ <string>login.icq.com</string>
</property>
</widget>
</item>
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/aim/ui/aimeditaccountwidget.cpp \
#1223418:1223419 @@ -47,9 +47,9 @@
//Remove me after we can change Account IDs (Matt)
mGui->edtAccountId->setReadOnly( true );
mGui->mAutoLogon->setChecked( account->excludeConnect() );
- QString serverEntry = account->configGroup()->readEntry( "Server", \
"login.oscar.aol.com" ); + QString serverEntry = account->configGroup()->readEntry( \
"Server", "login.icq.com" ); int portEntry = account->configGroup()->readEntry( \
"Port", 5190 );
- if ( serverEntry != "login.oscar.aol.com" || portEntry != 5190 )
+ if ( serverEntry != "login.icq.com" || portEntry != 5190 )
mGui->optionOverrideServer->setChecked( true );
else
mGui->optionOverrideServer->setChecked( false );
@@ -162,7 +162,7 @@
}
else
{
- static_cast<OscarAccount *>( mAccount )->setServerAddress( "login.oscar.aol.com" \
); + static_cast<OscarAccount *>( mAccount )->setServerAddress( "login.icq.com" );
static_cast<OscarAccount *>( mAccount )->setServerPort( 5190 );
}
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/tasks/filetransfertask.cpp \
#1223418:1223419 @@ -658,7 +658,7 @@
QString host;
if ( m_proxyRequester )
- host = "ars.oscar.aol.com";
+ host = "ars.icq.com";
else
{
if ( m_ip.length() != 4 || ! m_port )
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/tests/logintest.cpp \
#1223418:1223419 @@ -22,7 +22,7 @@
void LoginTest::slotDoTest()
{
- QString server = QString::fromLatin1("login.oscar.aol.com");
+ QString server = QString::fromLatin1("login.icq.com");
// connect to server
qDebug( "connecting to server ");
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/oscarcontact.cpp #1223418:1223419
@@ -271,8 +271,10 @@
void OscarContact::startedTyping()
{
- if ( mMsgManager )
- mMsgManager->receivedTypingMsg( this, true );
+ Kopete::ChatSession* cs = manager();
+ // We want the user to know if someone is typing a message
+ // but there is no chat session for this contact
+ cs->receivedTypingMsg( this, true );
}
void OscarContact::stoppedTyping()
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic