Hi!

I just implemented a small feature for the IdentityStatusWidget. Double 
clicking on a single account effects now a connect/disconnect toggle. Thought 
it would be useful. 

Thanks,
Manu

Index: kopete/identity/identitystatuswidget.cpp
===================================================================
--- kopete/identity/identitystatuswidget.cpp	(Revision 1082530)
+++ kopete/identity/identitystatuswidget.cpp	(Arbeitskopie)
@@ -77,6 +77,8 @@
 			this, SLOT(showAccountContextMenu(const QPoint &)) );
 	connect( d->ui.accounts, SIGNAL(itemClicked(QListWidgetItem *)),
 			this, SLOT(slotAccountClicked( QListWidgetItem *)) );
+	connect( d->ui.accounts, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
+			this, SLOT(slotAccountDoubleClicked(QListWidgetItem *)) );
 	connect( d->ui.photo, SIGNAL(clicked()), 
 			 this, SLOT(slotPhotoClicked()));
 
@@ -314,6 +316,24 @@
 	}
 }
 
+void IdentityStatusWidget::slotAccountDoubleClicked( QListWidgetItem * item )
+{
+	//Account toggles connect/disconnect at double click!
+	if ( item && !d->accountHash.isEmpty() )
+	{
+		Kopete::Account * account = d->accountHash[ item ];
+		if ( account ) {
+			if( account->myself()->onlineStatus().status() == Kopete::OnlineStatus::Offline )
+			{
+				Kopete::OnlineStatus s(Kopete::OnlineStatus::Online);
+				account->connect( s );
+			} else {
+				account->disconnect();
+			}
+		}
+	}
+}
+
 void IdentityStatusWidget::slotPhotoClicked()
 {
 	bool ok, changed = false;
Index: kopete/identity/identitystatuswidget.h
===================================================================
--- kopete/identity/identitystatuswidget.h	(Revision 1082530)
+++ kopete/identity/identitystatuswidget.h	(Arbeitskopie)
@@ -69,6 +69,7 @@
 
 	void showAccountContextMenu( const QPoint & );
 	void slotAccountClicked( QListWidgetItem * item );
+	void slotAccountDoubleClicked( QListWidgetItem * item );
 	void slotPhotoClicked();
 	void slotAccountRegistered( Kopete::Account *account );
 	void slotAccountUnregistered( const Kopete::Account *account );
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to