harvesterplugins/messaging/inc/cmessageplugin.h
changeset 2 208a4ba3894c
parent 0 ccd0fd43f247
child 3 6832643895f7
equal deleted inserted replaced
0:ccd0fd43f247 2:208a4ba3894c
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMESSAGEPLUGIN_H
       
    20 #define CMESSAGEPLUGIN_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <msvapi.h>
       
    24 #include <cindexingplugin.h>
       
    25 #include <common.h>
       
    26 
       
    27 class CMessageMonitor;
       
    28 class CMessageHarvester;
       
    29 class CMessageDataHandler;
       
    30 class CCPixIndexer;
       
    31 
       
    32 enum TMsgType
       
    33 {
       
    34 	EMsgTypeInvalid,
       
    35 	EMsgTypeSms,
       
    36 	EMsgTypeMms,
       
    37 	EMsgTypeDraft,
       
    38 	EMsgTypeEmailPop3,
       
    39 	EMsgTypeEmailSmtp,
       
    40 	EMsgTypeEmailImap4
       
    41 };
       
    42 
       
    43 class CMessagePlugin : public CIndexingPlugin, public MMsvSessionObserver
       
    44 {
       
    45 public:
       
    46 	static CMessagePlugin* NewL();
       
    47 	static CMessagePlugin* NewLC();
       
    48 	virtual ~CMessagePlugin();
       
    49 	
       
    50 	/**
       
    51 	 * From CIndexingPlugin
       
    52 	 */
       
    53 	void StartPluginL();
       
    54 	void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
       
    55 	
       
    56 	/**
       
    57 	* callback from MMsvSessionObserver
       
    58 	*/
       
    59 	virtual void HandleSessionEventL(TMsvSessionEvent aEvent, 
       
    60 									 TAny* aArg1, 
       
    61 									 TAny* aArg2, 
       
    62 									 TAny* aArg3);
       
    63 
       
    64 	/**
       
    65 	* Called by Message monitor or harvester when new item is found.
       
    66 	*
       
    67 	* @param aMsgId Message item identifier
       
    68 	* @param TCPixActionType aActionType action type
       
    69 	* @param aFolderId identifier of the folder where message is stored 
       
    70 	*/
       
    71     void MessageItemL( TMsvId aMsgId, TCPixActionType aActionType, TMsvId aFolderId );
       
    72     	
       
    73 	/**
       
    74 	* Indentify the message type from TMsvEntry
       
    75 	*
       
    76 	* @param TMsvEntry& aEntry a entry item to identify
       
    77 	*/
       
    78     TMsgType CalculateMessageType (const TMsvEntry& aEntry );
       
    79     
       
    80     /**
       
    81      * Gets the database observer class
       
    82      */
       
    83     CCPixIndexer* GetIndexer(); //SPB { return iIndexer; }
       
    84     /**
       
    85      * MountL - Mount an IndexDB.
       
    86      * @aMedia drive to mount.
       
    87      * @aForceReharvesting to reharvest or not
       
    88      */
       
    89     void MountL(TDriveNumber aMedia, TBool aForceReharvesting=EFalse);
       
    90 
       
    91     /**
       
    92      * UnMount - Dismount a IndexDB for drive aMedia.
       
    93      * @aMedia drive to unmount.
       
    94      * @aUndefineAsWell if ETrue then undefine the volume as well
       
    95      * 
       
    96      */
       
    97     void UnMount(TDriveNumber aMedia, TBool aUndefineAsWell = ETrue);
       
    98     
       
    99     /**
       
   100      * FormBaseAppClass - constructs a baseAppClass for the given drive.
       
   101      * @aMedia drive to form the baseAppClass for.
       
   102      * @aBaseAppClass return descriptor containing the baseAppClass
       
   103      * returns KErrNone on success or a standard error code
       
   104      */
       
   105     static TInt FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass);
       
   106     
       
   107     /**
       
   108      * DatabasePathL - Forms IndexDb path.
       
   109      * @param aMedia - The drive for which the path should be constructed.
       
   110      * returns pointer to the IndexDb path.
       
   111      */
       
   112     HBufC* DatabasePathLC(TDriveNumber aMedia);
       
   113     
       
   114     /**
       
   115      * IsMediaRemovableL - Check media is removable or not.
       
   116      * @param aDrive - The drive for which it is checked.
       
   117      * returns ETrue if it is removable else EFalse.
       
   118      */
       
   119     TBool IsMediaRemovableL(TDriveNumber& aDrive);
       
   120 
       
   121 public:
       
   122 	/*
       
   123 	 * Notifies the indexing manager of completed harvesting, called by CMessageHarvester
       
   124 	 */
       
   125 	void HarvestingCompleted(TInt aError);
       
   126 
       
   127 protected:
       
   128 	CMessagePlugin();
       
   129 	void ConstructL();
       
   130 
       
   131 private:
       
   132     // Session to Messge server session
       
   133     CMsvSession* iMsvSession;
       
   134     CMessageMonitor* iMessageMonitor;    
       
   135     CMessageHarvester* iMessageHarvester;
       
   136     CMessageDataHandler* iMessageDataHandler;
       
   137 
       
   138     // File system session
       
   139     RFs iFs;
       
   140     //Currently used Drive by messaging application
       
   141     TInt     iCurrentDrive;
       
   142     // CPix indexer 
       
   143     CCPixIndexer* iIndexer[EDriveZ+1]; // EDriveZ enum value is 25, so add 1.
       
   144 
       
   145 #ifdef __PERFORMANCE_DATA
       
   146     TTime iStartTime;
       
   147     TTime iCompleteTime;
       
   148     void UpdatePerformaceDataL();
       
   149     void UpdatePerformaceDataL(TMsvSessionEvent);
       
   150 #endif
       
   151 };
       
   152 
       
   153 #endif // CMESSAGEPLUGIN_H