1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__MSVFIND_H__)
19 #if !defined(__MSVAPI_H__)
23 #if !defined __MTCLBASE_H__
27 #if !defined(__MTMDEF_H__)
31 //**********************************
33 //**********************************
35 // Contains the result of a find operation for a particular entry
39 /** A single result from a text search operation. The class encapsulates information
42 1. identifies the message in which the search text is found
44 2. identifies the parts of the message that contain the search text.
50 IMPORT_C TMsvFindResult();
51 IMPORT_C TMsvFindResult(TMsvPartList aPartList, TMsvId aId);
54 /** The parts of the message that contain the search text. */
55 TMsvPartList iPartList;
56 /** The entry Id of the message that contains the search text. */
60 //**********************************
61 // CMsvFindResultSelection
62 //**********************************
64 // A list of find operation results with an accessor to find
65 // the position for a particular entry
68 class CMsvFindResultSelection : public CArrayFixFlat<TMsvFindResult>
69 /** Collection of results from a text search operation. The collection is organized
76 IMPORT_C CMsvFindResultSelection();
79 IMPORT_C CMsvFindResultSelection* CopyL() const;
80 IMPORT_C CMsvFindResultSelection* CopyLC() const;
81 IMPORT_C TInt Find(TMsvId aId) const;
84 //**********************************
85 // TMsvFindOperationProgress
86 //**********************************
88 // Find operation progress
91 class TMsvFindOperationProgress
92 /** Encapsulates progress information for a text search operation. The class has
99 IMPORT_C TMsvFindOperationProgress();
102 /** KErrNone if the search operation completed successfully otherwise one of the
103 system-wide error codes.
105 This has no meaning while the search operation is in progress. */
107 /** The number of messages already searched. */
109 /** The number of messages remaining to be searched.
111 If the search operation is for text within a specified root, folder or service,
112 then this value is zero until the total number of messages has been determined. */
114 /** The entry Id identifying the message currently being searched */
118 class CClientMtmRegistry;
119 class CMsvChildMessages;
121 //**********************************
123 //**********************************
125 // The find operation. Created by calling the relevant static function
126 // The results for all of these are added to the CMsvFindResultSelection which
127 // can be accessed via the accessor function GetFindResult
130 class CMsvFindOperation : public CMsvOperation
131 /** Encapsulates a text search operation.
133 The class offers an interface for locating messages which contain specified
134 text. Messages may contain data created for, or received from, any of the
135 transport protocols that are supported by the Messaging Architecture (e.g.
138 Clients create a new instance for each search operation to be performed. They
139 are also responsible for destroying the instance once a search operation is
142 Clients can derive from this class, typically to implement their own version
143 of the function IsValid().
149 IMPORT_C static CMsvFindOperation* FindInChildrenL(CMsvSession& aSession, const TDesC& aTextToFind, TMsvId aParentId, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
150 IMPORT_C static CMsvFindOperation* FindInSelectionL(CMsvSession& aSession, const TDesC& aTextToFind, const CMsvEntrySelection& aSelection, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
151 IMPORT_C ~CMsvFindOperation();
153 IMPORT_C const TDesC8& ProgressL();
154 IMPORT_C const TDesC8& FinalProgress();
156 inline const CMsvFindResultSelection& GetFindResult() const;
159 IMPORT_C CMsvFindOperation(CMsvSession& aSession, const TDesC& aTextToFind, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
160 IMPORT_C void ConstructFindInChildrenL(TMsvId aId);
161 IMPORT_C void ConstructFindInSelectionL(const CMsvEntrySelection& aSelection);
166 IMPORT_C void DoCancel();
167 IMPORT_C void RunL();
171 void Complete(TInt aStatus);
174 virtual TBool IsValid(const TMsvEntry& aEntry) const;
177 enum { EMsvFindingText, EMsvExpandingFolders } iState;
178 TBuf<KMsvMaxFindTextLength> iTextToFind;
179 TMsvPartList iPartList;
180 CMsvFindResultSelection* iFindResultSel;
181 TPckgBuf<TMsvFindOperationProgress> iProgress;
182 CMsvEntrySelection* iSelection;
183 CClientMtmRegistry* iClientRegistry;
184 CArrayPtrFlat<CBaseMtm>* iMtmArray;
185 CMsvChildMessages* iChildMessages;
190 #include <msvfind.inl>