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

List:       kde-commits
Subject:    KDE/kdenetwork/kopete
From:       Lamarque Souza <lamarque () gmail ! com>
Date:       2011-04-17 10:20:43
Message-ID: 20110417102043.8D302AC8D3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1228308 by lvsouza:

Set the status message when using the away toggle shortcut.

FIXED-IN: 4.6.3


 M  +21 -3     kopete/kopetewindow.cpp  
 M  +4 -1      libkopete/kopetestatusmanager.cpp  


--- trunk/KDE/kdenetwork/kopete/kopete/kopetewindow.cpp #1228307:1228308
@@ -107,6 +107,7 @@
 #include "kopeteitemdelegate.h"
 #include "kopetemetacontact.h"
 #include "kopetecontactlistview.h"
+#include "kopetestatusitems.h"
 
 
 //BEGIN GlobalStatusMessageIconLabel
@@ -518,7 +519,26 @@
 void KopeteWindow::slotToggleAway()
 {
 	kDebug ( 14000 );
-	if ( Kopete::StatusManager::self()->globalAway() )
+	Kopete::StatusManager * statusManager = Kopete::StatusManager::self();
+	const Kopete::Status::StatusItem * item = 0;
+	bool away = Kopete::StatusManager::self()->globalAway();
+
+	foreach (const Kopete::Status::StatusItem *i, statusManager->getRootGroup()->childList()) {
+		if (i->title() == QLatin1String("Online") && away ) {
+			item = i;
+			break;
+		} else if (i->title() == QLatin1String("Away") && !away) {
+			item = i;
+			break;
+		}
+	}
+
+	const Kopete::Status::Status * status = qobject_cast<const Kopete::Status::Status*>(item);
+	if (status) {
+		statusManager->setGlobalStatusMessage(Kopete::StatusMessage(status->title(), status->message()));
+	}
+
+	if ( away )
 		slotGlobalAvailable();
 	else
 		slotGlobalAway();
@@ -1297,8 +1317,6 @@
 	Kopete::AccountManager::self()->setOnlineStatus( category, statusMessage, 0, true );
 }
 
-// Iterate each connected account, updating its status message but keeping the
-// same onlinestatus.  Then update Kopete::Away and the UI.
 void KopeteWindow::setStatusMessage ( const Kopete::StatusMessage& statusMessage )
 {
 	Kopete::StatusManager::self()->setGlobalStatusMessage ( statusMessage );
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetestatusmanager.cpp #1228307:1228308
@@ -326,6 +326,8 @@
 	config.writeEntry( "GlobalStatusMessage", d->globalStatusMessage.message() );
 	config.sync();
 
+	// Iterate each connected account, updating its status message but keeping the
+	// same onlinestatus.
 	QList<Kopete::Account*> accountList = Kopete::AccountManager::self()->accounts();
 	foreach ( Kopete::Account *account, accountList )
 	{
@@ -444,7 +446,8 @@
 {
 	return ( d->globalStatusCategory == OnlineStatusManager::Away ||
 	         d->globalStatusCategory == OnlineStatusManager::ExtendedAway ||
-	         d->globalStatusCategory == OnlineStatusManager::Busy );
+	         d->globalStatusCategory == OnlineStatusManager::Busy ||
+	         d->globalStatusCategory == OnlineStatusManager::Offline );
 }
 
 void StatusManager::accountUnregistered( const Kopete::Account *account )
[prev in list] [next in list] [prev in thread] [next in thread] 

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