smf/smfservermodule/smfclient/smfclient.h
changeset 26 83d6a149c755
parent 18 013a02bf2bb0
--- a/smf/smfservermodule/smfclient/smfclient.h	Thu Sep 23 17:43:31 2010 +0530
+++ b/smf/smfservermodule/smfclient/smfclient.h	Mon Oct 11 21:59:54 2010 +0530
@@ -23,6 +23,7 @@
 #define SMFCLIENT_H
 
 #include <QObject>
+#include <qprocess.h>
 
 #include "smfclientglobal.h"
 #include "smfglobal.h"
@@ -31,6 +32,14 @@
 class SmfProvider;
 class SmfClientPrivate;
 
+enum SMFProviderAuthorizationStatus
+	{
+	SMFProviderAuthStatusUnknown,	 	//status unknown
+	SMFProviderAuthStatusAuthorised, 	//user logged in
+	SMFProviderAuthStatusUnauthorised, 	//user logged out/not logged in
+	SMFProviderAuthStatusBlocked		//user chosen to block this service
+	};
+
 /**
  * @ingroup smf_client_group 
  * Interface for a base service provider. Other service provider classes contains 
@@ -39,8 +48,9 @@
  * All of the functionality described here should be implemented by a service
  * specific plug-in object.
  */
-class  SMFCLIENT_EXPORT SmfClient
+class  SMFCLIENT_EXPORT SmfClient : public QObject
 	{
+	Q_OBJECT
 public:
 	/**
 	 * Constructs SmfClient
@@ -60,8 +70,48 @@
 	 */
 	QList<SmfProvider>* GetServices(const QString& serviceName);
 	
+	/**
+	 * Checks the current status of the service. Application might want to 
+	 * launch authorization process by calling loginToService() for the 
+	 * service which is not authorised.
+	 * @param provider The SmfProvider instance for the requested service
+	 * @return Authorization status (loggedin, logged out, blocked, unknown etc)
+	 */
+	SMFProviderAuthorizationStatus checkAuthorization(const SmfProvider& provider);
+	
+	/**
+	 * Method to launch the authentication application for this service.
+	 * This would pop-up service specific login window. Till user logs in 
+	 * successfully, any call to SMF APIs for this service Provider would 
+	 * return SmfServiceAuthFailed. Symbian application should have 
+	 * UserData capability.
+	 * @param provider The SmfProvider instance for the requested service
+	 * @return SmfError value 
+	 */
+	SmfError loginToService(SmfProvider* provider);
+	
+	/**
+	 * Method to log-out of (unauthorise) this service. Please note that 
+	 * this might not immediately log-out of the service if there are other 
+	 * applications using this service. Application need not use this function 
+	 * for normal operations - being logged in doesn't cost data charges and would 
+	 * avoid disturbing log-in pop-ups. Please note that there is no notification 
+	 * when user has logged out of service. Please use checkAuthorization() to 
+	 * determine the current status
+	 * @param provider The SmfProvider instance for the requested service
+	 * @return SmfError value  
+	 */
+	SmfError logoutOfService(SmfProvider* provider); 
+	
 	// ToDo :- More overloaded APIs will be provided later
-	//QList<SmfProvider>* GetServices(const QString& serviceName, const QString& providerName);
+	/**
+	 * Get provider details for a particular service provider for a particular service interface
+	 * The provider name is always English lowercase with the domain separator 
+	 * e.g. "facebook.com", "last.fm","linkedin.com"
+	 * for updated list of service provider names please refer SMF wiki in SF
+	 * TODO: provide url here.
+	 */
+	//SmfProvider* GetServices(const QString& serviceName, const QString& providerName);
 	//QList<SmfProvider>* GetServices(const QString& serviceName, const SmfProvider& provider);
   
 	/**
@@ -71,6 +121,32 @@
 	 */
 	QString errorString ( const SmfError &aErrorCode ) const;
 
+private slots:
+	/**
+	 * Slot that connects to the started() signal of QProcess
+	 */
+    void started();
+    
+	/**
+	 * Slot that connects to the stateChanged() signal of QProcess
+	 * @param newState The newState of the started Process
+	 */
+    void stateChanged(QProcess::ProcessState newState);
+    
+	/**
+	 * Slot that connects to the error() signal of QProcess
+	 * @param error The error that occured in the started process
+	 */
+    void error(QProcess::ProcessError error);
+    
+	/**
+	 * Slot that connects to the finished() signal of QProcess. This signal 
+	 * is emitted when the process finishes
+	 * @param exitCode The exit code of the process
+	 * @param exitStatus The exit status of the process
+	 */
+    void finished(int exitCode, QProcess::ExitStatus exitStatus);
+    
 private:
 	/**
 	 * Private impl wrapper.
@@ -81,6 +157,7 @@
 	 * List of SmfProvider to be returned to the requested code
 	 */
 	QList<SmfProvider>* m_providerList;
+	QProcess *m_authAppProcess;
   
 	};