htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/PIMHandler.h
branchRCL_3
changeset 11 454d022d514b
parent 0 d6fe6244b863
equal deleted inserted replaced
9:404ad6c9bc20 11:454d022d514b
    20 #define CPIMHANDLER_H
    20 #define CPIMHANDLER_H
    21 
    21 
    22 // INCLUDES
    22 // INCLUDES
    23 #include <e32base.h>
    23 #include <e32base.h>
    24 #include <s32mem.h>
    24 #include <s32mem.h>
    25 #include <HTIServicePluginInterface.h>
    25 #include <HtiServicePluginInterface.h>
    26 #include <MVPbkBatchOperationObserver.h>
       
    27 #include <MVPbkContactCopyObserver.h>
       
    28 #include <MVPbkContactStoreObserver.h>
       
    29 #include <MVPbkContactViewObserver.h>
       
    30 #include <calprogresscallback.h>
    26 #include <calprogresscallback.h>
    31 
    27 
    32 // CONSTANTS
    28 // CONSTANTS
    33 
    29 
    34 // FORWARD DECLARATIONS
    30 // FORWARD DECLARATIONS
    35 class CVPbkContactManager;
       
    36 class CVPbkVCardEng;
       
    37 class CCalSession;
    31 class CCalSession;
    38 class CCalEntryView;
       
    39 
    32 
    40 // CLASS DECLARATION
    33 // CLASS DECLARATION
    41 
    34 
    42 /**
    35 /**
    43 *  Functional implentation of PIM service.
    36 *  Functional implentation of PIM service.
    44 */
    37 */
    45 class CPIMHandler : public CBase,
    38 class CPIMHandler : public CBase,
    46                     public MVPbkContactStoreObserver,
       
    47                     public MVPbkContactCopyObserver,
       
    48                     public MVPbkContactViewObserver,
       
    49                     public MVPbkBatchOperationObserver,
       
    50                     public MCalProgressCallBack
    39                     public MCalProgressCallBack
    51     {
    40     {
    52     public:
    41     public:
    53 
    42 
    54         static CPIMHandler* NewL();
    43         static CPIMHandler* NewL();
    60         TBool IsBusy();
    49         TBool IsBusy();
    61 
    50 
    62         virtual ~CPIMHandler();
    51         virtual ~CPIMHandler();
    63 
    52 
    64         void SetDispatcher( MHtiDispatcher* aDispatcher );
    53         void SetDispatcher( MHtiDispatcher* aDispatcher );
    65 
    54       
    66 
       
    67         // From MVPbkContactStoreObserver
       
    68 
       
    69         /**
       
    70          * Called when a contact store is ready to use.
       
    71          */
       
    72         void StoreReady( MVPbkContactStore& aContactStore );
       
    73 
       
    74         /**
       
    75          * Called when a contact store becomes unavailable.
       
    76          * @param aContactStore The store that became unavailable.
       
    77          * @param aReason The reason why the store is unavailable.
       
    78          *                This is one of the system wide error codes.
       
    79          */
       
    80         void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason );
       
    81 
       
    82         /**
       
    83          * Called when changes occur in the contact store.
       
    84          * @param aContactStore The store the event occurred in.
       
    85          * @param aStoreEvent   Event that has occured.
       
    86          */
       
    87         void HandleStoreEventL( MVPbkContactStore& aContactStore,
       
    88                                 TVPbkContactStoreEvent aStoreEvent);
       
    89 
       
    90         // From MVPbkContactCopyObserver
       
    91 
       
    92         /**
       
    93          * Called when the contact has been successfully commited or
       
    94          * copied. Caller takes the ownership of results.
       
    95          * @param aOperation    The operation that this observer monitors.
       
    96          * @param aResults  An array of links to copied contacts.
       
    97          *                  Caller takes the ownership of the
       
    98          *                  object immediately.
       
    99          */
       
   100         void ContactsSaved( MVPbkContactOperationBase& aOperation,
       
   101             MVPbkContactLinkArray* aResults );
       
   102 
       
   103         /**
       
   104          * Called when there was en error while saving contact(s).
       
   105          * @param aOperation    The operation that this observer monitors.
       
   106          * @param aError an error that occured.
       
   107          */
       
   108         void ContactsSavingFailed(
       
   109                 MVPbkContactOperationBase& aOperation, TInt aError );
       
   110 
       
   111         // From MVPbkContactViewObserver
       
   112 
       
   113         /**
       
   114          * Called when a view is ready for use.
       
   115          */
       
   116         void ContactViewReady( MVPbkContactViewBase& aView );
       
   117 
       
   118         /**
       
   119          * Called when a view is unavailable for a while.
       
   120          */
       
   121         void ContactViewUnavailable( MVPbkContactViewBase& aView );
       
   122 
       
   123         /**
       
   124          * Called when a contact has been added to the view.
       
   125          */
       
   126         void ContactAddedToView( MVPbkContactViewBase& aView,
       
   127                                  TInt aIndex,
       
   128                                  const MVPbkContactLink& aContactLink );
       
   129 
       
   130         /**
       
   131          * Called when a contact has been removed from a view.
       
   132          */
       
   133         void ContactRemovedFromView( MVPbkContactViewBase& aView,
       
   134                                      TInt aIndex,
       
   135                                      const MVPbkContactLink& aContactLink );
       
   136 
       
   137         /**
       
   138          * Called when an error occurs in the view.
       
   139          */
       
   140         void ContactViewError( MVPbkContactViewBase& aView,
       
   141                                TInt aError,
       
   142                                TBool aErrorNotified );
       
   143 
       
   144         // From MVPbkBatchOperationObserver
       
   145 
       
   146         /**
       
   147          * Called when one step of the operation is complete
       
   148          */
       
   149         void StepComplete( MVPbkContactOperationBase& aOperation,
       
   150                            TInt aStepSize );
       
   151 
       
   152         /**
       
   153          * Called when one step of the operation fails
       
   154          */
       
   155         TBool StepFailed( MVPbkContactOperationBase& aOperation,
       
   156                           TInt aStepSize, TInt aError );
       
   157 
       
   158         /**
       
   159          * Called when operation is completed
       
   160          */
       
   161         void OperationComplete( MVPbkContactOperationBase& aOperation );
       
   162 
       
   163 
    55 
   164         // From MCalProgressCallBack
    56         // From MCalProgressCallBack
   165 
    57 
   166         void Progress( TInt aPercentageCompleted );
    58         void Progress( TInt aPercentageCompleted );
   167         void Completed( TInt aError );
    59         void Completed( TInt aError );
   176 
    68 
   177         void HandleVCardImportFuncL( const TDesC8& aData );
    69         void HandleVCardImportFuncL( const TDesC8& aData );
   178         void HandleVCalendarImportFuncL( const TDesC8& aData );
    70         void HandleVCalendarImportFuncL( const TDesC8& aData );
   179         void HandleContactDeleteFuncL( const TDesC8& aData );
    71         void HandleContactDeleteFuncL( const TDesC8& aData );
   180         void HandleCalendarDeleteFuncL( const TDesC8& aData );
    72         void HandleCalendarDeleteFuncL( const TDesC8& aData );
       
    73         void HandleOpenCalendarFileL( const TDesC8& aData );
       
    74         void HandleListCalendarFilesL();
   181         void HandleNotepadAddMemoFuncL( const TDesC8& aData );
    75         void HandleNotepadAddMemoFuncL( const TDesC8& aData );
   182         void HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData );
    76         void HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData );
   183         void HandleNotepadDeleteAllFuncL();
    77         void HandleNotepadDeleteAllFuncL();
   184         void CreateContactDeleteViewL();
    78         
   185         void DeleteContactsInViewL();
       
   186 
       
   187         void SendOkMsgL( const TDesC8& aData );
    79         void SendOkMsgL( const TDesC8& aData );
   188         void SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand );
    80         void SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand );
   189         void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
    81         void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
   190 
    82 
   191     private: // data
    83     private: // data
   192         TUint8                iCommand;
       
   193         TBool                 iIsBusy;
    84         TBool                 iIsBusy;
   194         CBufFlat*             iBuffer;
       
   195         RBufReadStream        iReadStream;
       
   196         CCalSession*          iCalSession;
       
   197         CCalEntryView*        iEntryView;
       
   198         CVPbkContactManager*  iContactManager;
       
   199         CVPbkVCardEng*        iVCardEngine;
       
   200         MVPbkContactStore*    iContactStore;
       
   201         MVPbkContactOperationBase* iOp;
       
   202         MVPbkContactViewBase* iContactView;
       
   203         MHtiDispatcher*       iDispatcher; // referenced
    85         MHtiDispatcher*       iDispatcher; // referenced
   204         CActiveSchedulerWait* iWaiter;
    86         CActiveSchedulerWait* iWaiter;
   205         TInt                  iEntryViewErr;
    87         TInt                  iEntryViewErr;
       
    88         CCalSession*          iCalSession;
   206     };
    89     };
   207 
    90 
   208 #endif // CPIMHANDLER_H
    91 #endif // CPIMHANDLER_H