williamr@2: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #if !defined(__MSVFIND_H__) williamr@2: #define __MSVFIND_H__ williamr@2: williamr@2: #if !defined(__MSVAPI_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined __MTCLBASE_H__ williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__MTMDEF_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: //********************************** williamr@2: // TMsvFindResult williamr@2: //********************************** williamr@2: // williamr@2: // Contains the result of a find operation for a particular entry williamr@2: // williamr@2: williamr@2: class TMsvFindResult williamr@2: /** A single result from a text search operation. The class encapsulates information williamr@2: which: williamr@2: williamr@2: 1. identifies the message in which the search text is found williamr@2: williamr@2: 2. identifies the parts of the message that contain the search text. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TMsvFindResult(); williamr@2: IMPORT_C TMsvFindResult(TMsvPartList aPartList, TMsvId aId); williamr@2: // williamr@2: public: williamr@2: /** The parts of the message that contain the search text. */ williamr@2: TMsvPartList iPartList; williamr@2: /** The entry Id of the message that contains the search text. */ williamr@2: TMsvId iId; williamr@2: }; williamr@2: williamr@2: //********************************** williamr@2: // CMsvFindResultSelection williamr@2: //********************************** williamr@2: // williamr@2: // A list of find operation results with an accessor to find williamr@2: // the position for a particular entry williamr@2: // williamr@2: williamr@2: class CMsvFindResultSelection : public CArrayFixFlat williamr@2: /** Collection of results from a text search operation. The collection is organized williamr@2: as an array. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C CMsvFindResultSelection(); williamr@2: // williamr@2: public: williamr@2: IMPORT_C CMsvFindResultSelection* CopyL() const; williamr@2: IMPORT_C CMsvFindResultSelection* CopyLC() const; williamr@2: IMPORT_C TInt Find(TMsvId aId) const; williamr@2: }; williamr@2: williamr@2: //********************************** williamr@2: // TMsvFindOperationProgress williamr@2: //********************************** williamr@2: // williamr@2: // Find operation progress williamr@2: // williamr@2: williamr@2: class TMsvFindOperationProgress williamr@2: /** Encapsulates progress information for a text search operation. The class has williamr@2: public data members. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TMsvFindOperationProgress(); williamr@2: // williamr@2: public: williamr@2: /** KErrNone if the search operation completed successfully otherwise one of the williamr@2: system-wide error codes. williamr@2: williamr@2: This has no meaning while the search operation is in progress. */ williamr@2: TInt iError; williamr@2: /** The number of messages already searched. */ williamr@2: TInt iCompleted; williamr@2: /** The number of messages remaining to be searched. williamr@2: williamr@2: If the search operation is for text within a specified root, folder or service, williamr@2: then this value is zero until the total number of messages has been determined. */ williamr@2: TInt iRemaining; williamr@2: /** The entry Id identifying the message currently being searched */ williamr@2: TMsvId iCurrentId; williamr@2: }; williamr@2: williamr@2: class CClientMtmRegistry; williamr@2: class CMsvChildMessages; williamr@2: williamr@2: //********************************** williamr@2: // CMsvFindOperation williamr@2: //********************************** williamr@2: // williamr@2: // The find operation. Created by calling the relevant static function williamr@2: // The results for all of these are added to the CMsvFindResultSelection which williamr@2: // can be accessed via the accessor function GetFindResult williamr@2: // williamr@2: williamr@2: class CMsvFindOperation : public CMsvOperation williamr@2: /** Encapsulates a text search operation. williamr@2: williamr@2: The class offers an interface for locating messages which contain specified williamr@2: text. Messages may contain data created for, or received from, any of the williamr@2: transport protocols that are supported by the Messaging Architecture (e.g. williamr@2: Email, FAX and SMS). williamr@2: williamr@2: Clients create a new instance for each search operation to be performed. They williamr@2: are also responsible for destroying the instance once a search operation is williamr@2: complete. williamr@2: williamr@2: Clients can derive from this class, typically to implement their own version williamr@2: of the function IsValid(). williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CMsvFindOperation* FindInChildrenL(CMsvSession& aSession, const TDesC& aTextToFind, TMsvId aParentId, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus); williamr@2: IMPORT_C static CMsvFindOperation* FindInSelectionL(CMsvSession& aSession, const TDesC& aTextToFind, const CMsvEntrySelection& aSelection, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus); williamr@2: IMPORT_C ~CMsvFindOperation(); williamr@2: // williamr@2: IMPORT_C const TDesC8& ProgressL(); williamr@2: IMPORT_C const TDesC8& FinalProgress(); williamr@2: // williamr@2: inline const CMsvFindResultSelection& GetFindResult() const; williamr@2: // williamr@2: protected: williamr@2: IMPORT_C CMsvFindOperation(CMsvSession& aSession, const TDesC& aTextToFind, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus); williamr@2: IMPORT_C void ConstructFindInChildrenL(TMsvId aId); williamr@2: IMPORT_C void ConstructFindInSelectionL(const CMsvEntrySelection& aSelection); williamr@2: // williamr@2: private: williamr@2: void ConstructL(); williamr@2: // williamr@2: IMPORT_C void DoCancel(); williamr@2: IMPORT_C void RunL(); williamr@2: // williamr@2: void DoRunL(); williamr@2: void FindL(); williamr@2: void Complete(TInt aStatus); williamr@2: void StartL(); williamr@2: // williamr@2: virtual TBool IsValid(const TMsvEntry& aEntry) const; williamr@2: // williamr@2: private: williamr@2: enum { EMsvFindingText, EMsvExpandingFolders } iState; williamr@2: TBuf iTextToFind; williamr@2: TMsvPartList iPartList; williamr@2: CMsvFindResultSelection* iFindResultSel; williamr@2: TPckgBuf iProgress; williamr@2: CMsvEntrySelection* iSelection; williamr@2: CClientMtmRegistry* iClientRegistry; williamr@2: CArrayPtrFlat* iMtmArray; williamr@2: CMsvChildMessages* iChildMessages; williamr@2: TMsvId iCurrentId; williamr@2: TMsvEntry iEntry; williamr@2: }; williamr@2: williamr@2: #include williamr@2: williamr@2: #endif