Hi,

I was missing some DCOP-calls in Kopete for requesting the status of your 
accounts (see also bug 117962). I implemented the ones I needed myself (see 
patch). Can I commit this in the 3.5 branch?

(Note: I don't have a similar patch for trunk, not yet really a die hard KDE 4 
programmer)


Kind regards,

-- 
Bram Schoenmakers
KDE Netherlands (www.kde.nl)

KDE Forum - http://www.kde-forum.org
Index: kopeteiface.h
===================================================================
--- kopeteiface.h	(revision 614555)
+++ kopeteiface.h	(working copy)
@@ -117,6 +117,26 @@
 	bool unloadPlugin( const QString& name );
 
 	/**
+	 * Returns true if all accounts are connected.
+	 */
+	bool allAccountsConnected();
+
+	/**
+	 * Returns true if all accounts are disconnected.
+	 */
+	bool allAccountsDisconnected();
+
+	/**
+	 * Returns true if all connected accounts are not set 'Away'.
+	 */
+	bool allConnectedAccountsOnline();
+
+	/**
+	 * Returns true if all connected accounts are set 'Away'.
+	 */
+	bool allConnectedAccountsAway();
+
+	/**
 	 * set all account away using the global away function
 	 */
 	void setAway();
Index: kopeteiface.cpp
===================================================================
--- kopeteiface.cpp	(revision 614555)
+++ kopeteiface.cpp	(working copy)
@@ -275,6 +275,75 @@
 	}
 }
 
+bool KopeteIface::allAccountsConnected()
+{
+	bool result = true;
+	const QPtrList<Kopete::Account> &accounts = Kopete::AccountManager::self()->accounts();
+	QPtrListIterator<Kopete::Account> it( accounts );
+	for ( ; it.current(); ++it )
+	{
+		if ( !(*it)->isConnected() )
+		{
+			result = false;
+			break;
+		}
+	}
+
+	return result;
+}
+
+bool KopeteIface::allAccountsDisconnected()
+{
+	bool result = true;
+	const QPtrList<Kopete::Account> &accounts = Kopete::AccountManager::self()->accounts();
+	QPtrListIterator<Kopete::Account> it( accounts );
+	for ( ; it.current(); ++it )
+	{
+		if ( (*it)->isConnected() )
+		{
+			result = false;
+			break;
+		}
+	}
+
+	return result;
+}
+
+bool KopeteIface::allConnectedAccountsOnline()
+{
+	bool result = true;
+	const QPtrList<Kopete::Account> &accounts = Kopete::AccountManager::self()->accounts();
+	QPtrListIterator<Kopete::Account> it( accounts );
+	for ( ; it.current(); ++it )
+	{
+		if ( (*it)->isConnected() && (*it)->isAway() )
+		{
+			result = false;
+			break;
+		}
+	}
+
+	return result;
+}
+
+bool KopeteIface::allConnectedAccountsAway()
+{
+	bool result = true;
+	const QPtrList<Kopete::Account> &accounts = Kopete::AccountManager::self()->accounts();
+	QPtrListIterator<Kopete::Account> it( accounts );
+	for ( ; it.current(); ++it )
+	{
+		if ( (*it)->isConnected() && !(*it)->isAway() )
+		{
+			result = false;
+			break;
+		}
+	}
+
+	return result;
+}
+
+
 void KopeteIface::setAway()
 {
 	Kopete::AccountManager::self()->setAwayAll();

Attachment: pgpfVIqIC6V67.pgp
Description: PGP signature

_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to