ipsservices/ipssosplugin/inc/ipsplgeventhandler.h
branchRCL_3
changeset 64 3533d4323edc
parent 63 d189ee25cf9d
--- a/ipsservices/ipssosplugin/inc/ipsplgeventhandler.h	Tue Aug 31 15:04:17 2010 +0300
+++ b/ipsservices/ipssosplugin/inc/ipsplgeventhandler.h	Wed Sep 01 12:28:57 2010 +0100
@@ -29,7 +29,7 @@
 class CRepository;
 class CIpsPlgSettingsObserver;
 class CIpsPlgSyncStateObserver;
-// <qmail> CIpsSetDataApi removed
+class CIpsSetDataApi;
 /**
 * MIpsPlgPropertyObserver
 *
@@ -63,7 +63,7 @@
 /**
 * Helper class to keep track of accounts
 */
-NONSHARABLE_CLASS ( CIPSAccountInfo ) : public CBase
+class CIPSAccountInfo : public CBase
     {
 public:
 
@@ -88,16 +88,16 @@
  *  @lib ipssosplugin.lib
  *  @since
  */
-NONSHARABLE_CLASS ( CIpsPlgEventHandler ) : public CBase,
+class CIpsPlgEventHandler : public CBase,
                             public MMsvSessionObserver,
                             public MIpsPlgSettingsObserverCallback,
-                            public MIpsPlgPropertyObserver
-// <qmail> not needed       public MFSMailExceptionEventCallback
+                            public MIpsPlgPropertyObserver,
+                            public MFSMailExceptionEventCallback
     {
-//public://from MFSMailExceptionEventCallback
-//
-//    void ExceptionEventCallbackL( TFSMailMsgId aMailboxId, TInt aEventType, TBool aResponse );
-// </qmail>
+
+public://from MFSMailExceptionEventCallback
+
+    void ExceptionEventCallbackL( TFSMailMsgId aMailboxId, TInt aEventType, TBool aResponse );
 
 public: //from MIpsPlgPropertyObserver
     void HandlePropertyEventL(
@@ -180,8 +180,9 @@
      * Adds property observer, p&s (property) events are signaled to these
      * observers
      * @param aObservers interface to observer object
+     * @return error code from RProperty::Define function
      */
-    void RegisterPropertyObserverL( MIpsPlgPropertyObserver* aObserver );
+    TInt RegisterPropertyObserverL( MIpsPlgPropertyObserver* aObserver );
 
     /**
      * Removes property observer
@@ -196,13 +197,55 @@
      */
     void NotifyPropertyEventL( TIpsPlgPropertyEvent aEvent );
 
-// <qmail> removing unused functions
-    //    void SignalMailboxOfflineStateL( const TFSMailMsgId& aAccount );
-    //    void QueryUsrPassL( TMsvId aMbox, MIpsPlgConnectOpCallback* aCallback=NULL );
-    //    void SignalCredientialsSetL( TInt aMailboxId, TBool aCancelled );
-// </qmail>
+    /**
+     * used to inform ui offline state if connection attempt
+     * was not successfull
+     * @param aAccount FS mailbox id
+     */
+    void SignalMailboxOfflineStateL( const TFSMailMsgId& aAccount );
+
+    /**
+     * Send user password query request to fs email ui.
+     * Request is handled by emailserver.
+     * Only one query at a time is allowed - restriction of CFSMailMessageQueryHandler
+     * Operation callback is registered in handler and will receive notification
+     * on query password finished.
+     * 
+     * @param aMbox entry id of mailbox service
+     * @param aCallback callback interface to connection operation, defaut NULL
+     * @param aIncoming incoming or outgoing password query
+     * @return ETrue query invoked, wait for notification
+     *         EFalse another query is in progress
+     */
+    TBool QueryUsrPassL(
+        TMsvId aMbox,
+        MIpsPlgConnectOpCallback* aCallback=NULL,
+        TBool aIncoming=ETrue );
+
+    /**
+     * Query in progress is for incoming or outgoing mail.
+     */
+    TBool IncomingPass() const;
+
+    /**
+     * Send user password (=credentials) set signal to all plugin
+     * instances via p&s (property) mechanism
+     * @param aMailboxId entry id of mailbox
+     * @param aCancelled indicates is user cancelled password dialog
+     */
+    void SignalCredientialsSetL( TInt aMailboxId, TBool aCancelled );
+
 private:
-// <qmail> removed enum TQueryUsrPassState
+
+    /** States of Query user password operation */
+    enum TQueryUsrPassState
+        {
+        EReady,                 // ready for action
+        EBusy,                  // request in progress (invoker eventhandler`s state)
+        ENotificationRequest,   // user notification request (emailserver eventhandler`s state)
+        EPasswordRequest,       // password request (emailserver eventhandler`s state)
+        ERequestResponding      // response for request received, handling in progress (invoker eventhandler`s state)
+        };
 
     /**
     * Checks the source type of event and also
@@ -344,8 +387,11 @@
         TFSMailMsgId& aFSParent,
         RArray<TFSMailMsgId>& aFSDeletedArray );
 
-    // <qmail> does nothing; removing
-    //    void SaveSyncStatusL( TMsvId aMailboxId, TInt aState );
+
+    /**
+    * Saves last signalled sync status to settings
+    */
+    void SaveSyncStatusL( TMsvId aMailboxId, TInt aState );
 
     /**
     * Appends folder id to array if not already in there
@@ -388,21 +434,13 @@
     /**
     * Fills RArray FSMessage objects created from CMsvEntrySelection
     */
-    inline void FillFSMessageArrayL(
+    inline void FillFSMessageArray(
             RArray<TFSMailMsgId>& aFSArray,
             const CMsvEntrySelection* aSelection,
             TUint aMtmUid );
 
-// <qmail> new function
-    /**
-     * Convert sync operation completion code to email framework's syncState
-     * @param aStatus
-     * @return syncstate
-     */
-    TSSMailSyncState ConvertCompletionCode( TInt aCompletionCode );
-// </qmail>
-    
     CRepository*                            iCenRep;
+    CIpsSetDataApi*                         iSettingsApi;
 
     // not owned
     CMsvSession*                            iSession;
@@ -433,8 +471,14 @@
 
     RArray<TMsvId>                          iImapFolderIds;
 
-// <qmail> MIpsPlgConnectOpCallback not used any more
-// <qmail> iQueryPassState, iConnOpCallbacks, iIncomingPass removed
+    // state of the query user password operation
+    // diffrent states are for query invoker and query handler (emailserver)
+    TQueryUsrPassState                      iQueryPassState;
+    // array of operations which wait for query response
+    // or possibilty to perform a query
+    RPointerArray<MIpsPlgConnectOpCallback> iConnOpCallbacks;
+    // query user password for incoming or outgoing
+    TBool                                   iIncomingPass;
     };