[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete
From:       Pali Rohár <pali.rohar () gmail ! com>
Date:       2012-12-17 7:02:43
Message-ID: 20121217070243.3B3AFAC73D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1328745 by pali:

Disable notifications in Busy status

This patch disable all visible KNotification for accounts in Busy status.
So now Busy status in Kopete is real Do not Disturb / Busy status without any \
notifications.

BUG: 143586
BUG: 184113
BUG: 205303
BUG: 229306


 M  +5 -0      kopete/infoeventwidget.cpp  
 M  +5 -0      libkopete/kopeteaccount.cpp  
 M  +14 -0     libkopete/kopeteaccount.h  
 M  +6 -8      libkopete/kopetechatsession.cpp  
 M  +1 -0      libkopete/kopetemetacontact.cpp  
 M  +4 -0      libkopete/kopeteutils.cpp  
 M  +4 -0      libkopete/private/kopeteviewmanager.cpp  
 M  +4 -0      plugins/otr/authenticationwizard.cpp  
 M  +6 -0      plugins/privacy/privacyplugin.cpp  
 M  +2 -0      protocols/gadu/gaduaccount.cpp  
 M  +2 -1      protocols/groupwise/gwaccount.cpp  
 M  +4 -0      protocols/jabber/jabberaccount.cpp  
 M  +3 -0      protocols/oscar/icq/icqaccount.cpp  
 M  +3 -0      protocols/oscar/icq/icqcontact.cpp  
 M  +5 -0      protocols/oscar/oscaraccount.cpp  
 M  +1 -1      protocols/skype/libskype/skype.cpp  
 M  +6 -0      protocols/wlm/wlmaccount.cpp  
 M  +17 -0     protocols/yahoo/yahooaccount.cpp  


--- trunk/KDE/kdenetwork/kopete/kopete/infoeventwidget.cpp #1328744:1328745
@@ -26,6 +26,8 @@
 
 #include <kopeteinfoeventmanager.h>
 #include <kopeteinfoevent.h>
+#include <kopetestatusmanager.h>
+#include <kopeteonlinestatusmanager.h>
 
 class InfoEventWidget::Private
 {
@@ -226,6 +228,8 @@
 
 void InfoEventWidget::eventAdded( Kopete::InfoEvent* event )
 {
+	if ( Kopete::StatusManager::self()->globalStatusCategory() != \
Kopete::OnlineStatusManager::Busy ) +	{
 	KNotification *notify = new KNotification( QString("kopete_info_event") , 0l );
 	notify->setActions( QStringList( i18n( "View" ) ) );
 	notify->setText( event->text() );
@@ -236,6 +240,7 @@
 	connect( notify, SIGNAL(closed()), this, SLOT(notificationClosed()) );
 
 	notify->sendEvent();
+	}
 
 	if ( event->showOnSend() )
 	{
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteaccount.cpp #1328744:1328745
@@ -498,6 +498,11 @@
 					d->myself->onlineStatus().status() == Kopete::OnlineStatus::Busy );
 }
 
+bool Account::isBusy() const
+{
+	return d->myself && ( d->myself->onlineStatus().status() == \
Kopete::OnlineStatus::Busy ); +}
+
 Identity * Account::identity() const
 {
 	return d->identity;
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteaccount.h #1328744:1328745
@@ -365,10 +365,24 @@
 	 *
 	 * This is a convenience method that queries @ref Contact::onlineStatus() on @ref \
                myself().
 	 * This function is safe to call if @ref setMyself() has not been called yet.
+	 *
+	 * @see @ref isBusy()
 	 */
 	bool isAway() const;
 
 	/**
+	 * @brief Indicate whether the account is busy.
+	 *
+	 * In busy mode all visible and sound events should be disabled.
+	 *
+	 * This is a convenience method that queries @ref Contact::onlineStatus() on @ref \
myself(). +	 * This function is safe to call if @ref setMyself() has not been called \
yet. +	 *
+	 * @see @ref isAway()
+	 */
+	bool isBusy() const;
+
+	/**
 	 * Return the @ref KConfigGroup used to write and read special properties
 	 *
 	 * "Protocol", "AccountId" , "Color", "AutoConnect", "Priority", "Enabled" , "Icon" \
                are reserved keyword
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetechatsession.cpp #1328744:1328745
@@ -286,7 +286,7 @@
 	if ( !Kopete::CommandHandler::commandHandler()->processMessage( message, this ) )
 	{
 		emit messageSent( sentMessage, this );
-		if ( !account()->isAway() || \
Kopete::BehaviorSettings::self()->enableEventsWhileAway() ) +		if ( ( \
!account()->isAway() || Kopete::BehaviorSettings::self()->enableEventsWhileAway() ) \
&& !account()->isBusy() )  {
 			KNotification::event(QString::fromLatin1( "kopete_outgoing" ),	i18n( "Outgoing \
Message Sent" ) );  }
@@ -304,6 +304,7 @@
 
 void Kopete::ChatSession::emitNudgeNotification()
 {
+	if ( !account()->isBusy() )
 	KNotification::event( QString::fromLatin1("buzz_nudge"), i18n("A contact sent you a \
buzz/nudge.") );  }
 
@@ -538,14 +539,11 @@
 {
 	emit remoteTyping( c, t );
 
-	QWidget *viewWidget = 0L;
-	bool isActiveWindow = false;
+	if ( ( account()->isAway() && ! \
Kopete::BehaviorSettings::self()->enableEventsWhileAway() ) || account()->isBusy() ) \
+		return;  
-	if ( !account()->isAway() || \
                Kopete::BehaviorSettings::self()->enableEventsWhileAway() )
-	{
-		viewWidget = dynamic_cast<QWidget*>(view(false));
-		isActiveWindow = view(false) && ( viewWidget && viewWidget->isActiveWindow() );
-	}
+	QWidget * viewWidget = dynamic_cast<QWidget*>(view(false));
+	bool isActiveWindow = view(false) && ( viewWidget && viewWidget->isActiveWindow() \
);  
 	// We aren't interested in notification from current window
 	// or 'user stopped typing' notifications
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetemetacontact.cpp #1328744:1328745
@@ -1289,6 +1289,7 @@
 	// ensure we are not suppressing notifications, because connecting or disconnected
 	if ( !c->account()->suppressStatusNotification() && c->account()->isConnected()
 	     && c->account()->myself()->onlineStatus().status() != OnlineStatus::Connecting
+	     && c->account()->myself()->onlineStatus().status() != OnlineStatus::Busy
 	     && (Kopete::BehaviorSettings::self()->enableEventsWhileAway() || \
!c->account()->isAway()) )  {
 		// figure out what's happened
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteutils.cpp #1328744:1328745
@@ -33,6 +33,7 @@
 #include "kopeteutils_private.h"
 #include "kopeteutils.h"
 #include "kopeteuiglobal.h"
+#include "kopetestatusmanager.h"
 
 namespace Kopete
 {
@@ -65,6 +66,9 @@
 {
 	Q_UNUSED(caption);
 
+	if ( Kopete::StatusManager::self()->globalStatusCategory() == \
Kopete::OnlineStatusManager::Busy ) +		return;
+
 	QStringList actions;
 		if ( !explanation.isEmpty() )
 			actions  << i18n( "More Information..." );
--- trunk/KDE/kdenetwork/kopete/libkopete/private/kopeteviewmanager.cpp \
#1328744:1328745 @@ -348,6 +348,10 @@
 	                                        QWidget *viewWidget,
 	                                        bool isActiveWindow, bool \
isViewOnCurrentDesktop )  {
+
+	if ( msg.from()->account()->isBusy() )
+		return;
+
     if ( d->balloonGroupMessageNotificationsPerSender )
 	{
 		Kopete::ActiveNotifications::iterator notifyIt =
--- trunk/KDE/kdenetwork/kopete/plugins/otr/authenticationwizard.cpp #1328744:1328745
@@ -33,6 +33,7 @@
 #include <QGroupBox>
 #include <QProgressBar>
 #include <kopeteview.h>
+#include <kopeteaccount.h>
 
 QList<AuthenticationWizard*> wizardList;
 
@@ -68,6 +69,9 @@
 
 	updateInfoBox();
 
+	if ( session->account()->isBusy() )
+		return;
+
 	show();
 	
 	if ( !session->view()->mainWidget() || \
                !session->view()->mainWidget()->isActiveWindow() ) {
--- trunk/KDE/kdenetwork/kopete/plugins/privacy/privacyplugin.cpp #1328744:1328745
@@ -20,6 +20,7 @@
 #include <knotification.h>
 #include <kplugininfo.h>
 
+#include "kopeteaccount.h"
 #include "kopetecontact.h"
 #include "kopetemetacontact.h"
 #include "kopetemessage.h"
@@ -157,6 +158,7 @@
 		if( !PrivacyConfig::whiteList().contains( msg.from()->protocol()->pluginId() + ':' \
+ msg.from()->contactId() ) )  {
 			kDebug(14313) << "Message from " << msg.from()->protocol()->pluginId() << ":" << \
msg.from()->contactId() << " dropped (not whitelisted)"; +			if ( \
!msg.manager()->account()->isBusy() )  KNotification::event( "message_dropped", \
i18n("A message from %1 was dropped, because this contact is not on your whitelist.", \
msg.from()->contactId()) );  event->discard();
 			return;
@@ -167,6 +169,7 @@
 		if( PrivacyConfig::blackList().contains( msg.from()->protocol()->pluginId() + ':' \
+ msg.from()->contactId() ) )  {
 			kDebug(14313) << "Message from " << msg.from()->protocol()->pluginId() << ":" << \
msg.from()->contactId() << " dropped (blacklisted)"; +			if ( \
!msg.manager()->account()->isBusy() )  KNotification::event( "message_dropped", \
i18n("A message from %1 was dropped, because this contact is on your blacklist.", \
msg.from()->contactId()) );  event->discard();
 			return;
@@ -177,6 +180,7 @@
 		if( msg.from()->metaContact()->isTemporary() )
 		{
 			kDebug(14313) << "Message from " << msg.from()->contactId() << " dropped (not on \
the contact list)"; +			if ( !msg.manager()->account()->isBusy() )
 			KNotification::event( "message_dropped", i18n("A message from %1 was dropped, \
because this contact is not on your contact list.", msg.from()->contactId()) );  \
event->discard();  return;
@@ -194,6 +198,7 @@
 			if( msg.plainBody().contains( word ) )
 			{
 				kDebug(14313) << "Message dropped because it contained: " << word;
+				if ( !msg.manager()->account()->isBusy() )
 				KNotification::event( "message_dropped", i18n("A message from %1 was dropped, \
because it contained a blacklisted word.", msg.from()->contactId()) );  \
event->discard();  return;
@@ -218,6 +223,7 @@
 		if( drop )
 		{
 			kDebug(14313) << "Message dropped because it contained blacklisted words.";
+			if ( !msg.manager()->account()->isBusy() )
 				KNotification::event( "message_dropped", i18n("A message from %1 was dropped, \
because it contained blacklisted words.", msg.from()->contactId()) );  \
event->discard();  return;
--- trunk/KDE/kdenetwork/kopete/protocols/gadu/gaduaccount.cpp #1328744:1328745
@@ -1007,6 +1007,7 @@
 void
 GaduAccount::userListNotification( QString what )
 {
+	if ( !isBusy() )
 	KNotification::event( QString::fromLatin1("kopete_gadu_contactslist"), what, \
accountIcon());  }
 
@@ -1184,6 +1185,7 @@
 void
 GaduAccount::slotCommandDone( const QString& /*title*/, const QString& what )
 {
+	if ( !isBusy() )
 	KNotification::event( KNotification::Notification, what );
 }
 
--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/gwaccount.cpp #1328744:1328745
@@ -581,7 +581,7 @@
 			} // 
 		} //end while, now check the next group membership
 	} //end while, now check the next groupwise contact
-	if ( conflicts )
+	if ( conflicts && !isBusy() )
 		// show queuedmessagebox
 		KNotification::event(KNotification::Warning, i18n( "Kopete: Conflicting Changes \
Made Offline" ), i18n( "A change happened to your GroupWise contact list while you \
were offline which was impossible to reconcile." ), QPixmap(), \
Kopete::UI::Global::mainWidget() );  m_dontSync = false;
@@ -1315,6 +1315,7 @@
 
 void GroupWiseAccount::slotConnectedElsewhere()
 {
+	if ( !isBusy() )
 	KNotification::event(KNotification::Notification, i18n ( "Kopete: Signed in as %1 \
Elsewhere", accountId() ), i18nc(  "The parameter is the user's own account id for \
this protocol", "You have been disconnected from GroupWise Messenger because you \
signed in as %1 elsewhere", accountId() ) , QPixmap(), \
Kopete::UI::Global::mainWidget() );  disconnect();
 }
--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabberaccount.cpp #1328744:1328745
@@ -61,6 +61,7 @@
 #include "kopetecontactlist.h"
 #include "kopeteaccountmanager.h"
 #include "kopeteaddedinfoevent.h"
+#include "kopetestatusmanager.h"
 
 #include "jabberclient.h"
 #include "jabberprotocol.h"
@@ -783,6 +784,9 @@
 
 void JabberAccount::handleStreamError (int streamError, int streamCondition, int \
connectorCode, const QString &server, Kopete::Account::DisconnectReason &errorClass, \
QString additionalErrMsg)  {
+	if ( Kopete::StatusManager::self()->globalStatusCategory() == \
Kopete::OnlineStatusManager::Busy ) +		return;
+
 	QString errorText;
 	QString errorCondition;
 
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/icq/icqaccount.cpp #1328744:1328745
@@ -338,6 +338,9 @@
 
 void ICQAccount::userReadsStatusMessage( const QString& contact )
 {
+	if ( isBusy() )
+		return;
+
 	QString name;
 
 	Kopete::Contact * ct = contacts().value( Oscar::normalize( contact ) );
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/icq/icqcontact.cpp #1328744:1328745
@@ -296,6 +296,9 @@
 	if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) )
 		return;
 
+	if ( account()->isBusy() )
+		return;
+
 	kDebug(OSCAR_ICQ_DEBUG) ;
 	QString message;
 	if( granted )
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/oscaraccount.cpp #1328744:1328745
@@ -1020,10 +1020,13 @@
 void OscarAccount::slotSocketError( int errCode, const QString& errString )
 {
 	Q_UNUSED( errCode );
+
+	if ( !isBusy() )
 	KNotification::event( QLatin1String("connection_error"), i18nc( "account has been \
disconnected", "Kopete: %1 disconnected", accountId() ),  errString,
 	                      \
myself()->onlineStatus().protocolIcon(KIconLoader::SizeMedium),  \
Kopete::UI::Global::mainWidget() ); +
 	logOff( Kopete::Account::ConnectionReset );
 }
 
@@ -1037,6 +1040,7 @@
 	if ( s.family == 0 && s.subtype == 0 )
 	{
 		message = getFLAPErrorMessage( code );
+		if ( !isBusy() )
 		KNotification::event( QLatin1String("connection_error"), i18nc( "account has been \
                disconnected", "Kopete: %1 disconnected", accountId() ),
 		                      message, \
myself()->onlineStatus().protocolIcon(KIconLoader::SizeMedium),  \
Kopete::UI::Global::mainWidget() ); @@ -1078,6 +1082,7 @@
 	else
 		message = i18n("There was an error in the protocol handling; automatic \
reconnection occurring.");  
+	if ( !isBusy() )
 	KNotification::event( QLatin1String("server_error"), i18n("Kopete: OSCAR Protocol \
error"), message, myself()->onlineStatus().protocolIcon(KIconLoader::SizeMedium),  \
Kopete::UI::Global::mainWidget() );  if ( fatal )
--- trunk/KDE/kdenetwork/kopete/protocols/skype/libskype/skype.cpp #1328744:1328745
@@ -287,7 +287,7 @@
 
 	disconnect(&d->connection, SIGNAL(error(QString)), this, \
SLOT(error(QString)));//One arror at a time is enough, stop flooding the user  
-	if (d->showDeadMessage)//just skip the error message if we are going offline, none \
ever cares. +	if (d->showDeadMessage && !d->account.isBusy())//just skip the error \
message if we are going offline, none ever cares.  \
KNotification::event(KNotification::Error, i18n("Skype protocol"), message);//Show \
the message  
 	connect(&d->connection, SIGNAL(error(QString)), this, \
                SLOT(error(QString)));//Continue showing more errors in future
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmaccount.cpp #1328744:1328745
@@ -1152,6 +1152,9 @@
 void
 WlmAccount::slotInitialEmailNotification (const int unread_inbox)
 {
+    if ( isBusy() )
+        return;
+
     KNotification *notification= new KNotification ("msn_mail", \
Kopete::UI::Global::mainWidget());  
     notification->setText(i18np( "You have one unread message in your Hotmail \
inbox.", @@ -1169,6 +1172,9 @@
 void
 WlmAccount::slotNewEmailNotification (const QString from, const QString subject)
 {
+    if ( isBusy() )
+        return;
+
     KNotification *notification= new KNotification ("msn_mail", \
Kopete::UI::Global::mainWidget());  
     notification->setText(i18n( "New message from %1 in your Hotmail \
                inbox.<p>Subject: %2", from, subject));
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/yahooaccount.cpp #1328744:1328745
@@ -787,6 +787,9 @@
 	static_cast<YahooContact *>( myself() )->setOnlineStatus( m_protocol->Offline );
 	disconnected( ConnectionReset );	// may reconnect
 
+	if ( isBusy() )
+		return;
+
 	QString message;
 	message = i18n( "%1 has been disconnected.\nError message:\n%2 - %3" ,
 		  accountId(), m_session->error(), m_session->errorString() );
@@ -800,6 +803,9 @@
 	static_cast<YahooContact *>( myself() )->setOnlineStatus( m_protocol->Offline );
 	disconnected( Manual );			// don't reconnect
 
+	if ( isBusy() )
+		return;
+
 	QString message;
 	message = i18n( "There was an error while connecting %1 to the Yahoo server.\nError \
message:\n%2 - %3" ,  accountId(), m_session->error(), m_session->errorString() );
@@ -870,6 +876,10 @@
 void YahooAccount::slotAuthorizationAccepted( const QString &who )
 {
 	kDebug(YAHOO_GEN_DEBUG) ;
+
+	if ( isBusy() )
+		return;
+
 	QString message;
 	message = i18n( "User %1 has granted your authorization request." ,
 		  who );
@@ -882,6 +892,10 @@
 void YahooAccount::slotAuthorizationRejected( const QString &who, const QString &msg \
)  {
 	kDebug(YAHOO_GEN_DEBUG) ;
+
+	if ( isBusy() )
+		return;
+
 	QString message;
 	message = i18n( "User %1 has rejected your authorization request.\n%2" ,
 		  who, msg );
@@ -1571,6 +1585,9 @@
 {
 	kDebug(YAHOO_GEN_DEBUG) << "Mail count: " << cnt;
 	
+	if ( isBusy() )
+		return;
+
 	if ( cnt > 0 && from.isEmpty() )
 	{
 		QObject::connect(KNotification::event( QLatin1String("yahoo_mail"), i18np( "You \
have one unread message in your Yahoo inbox.",


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic