williamr@2
|
1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// 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
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#if !defined(__MSVFIND_H__)
|
williamr@2
|
17 |
#define __MSVFIND_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#if !defined(__MSVAPI_H__)
|
williamr@2
|
20 |
#include <msvapi.h>
|
williamr@2
|
21 |
#endif
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#if !defined __MTCLBASE_H__
|
williamr@2
|
24 |
#include <mtclbase.h>
|
williamr@2
|
25 |
#endif
|
williamr@2
|
26 |
|
williamr@2
|
27 |
#if !defined(__MTMDEF_H__)
|
williamr@2
|
28 |
#include <mtmdef.h>
|
williamr@2
|
29 |
#endif
|
williamr@2
|
30 |
|
williamr@2
|
31 |
//**********************************
|
williamr@2
|
32 |
// TMsvFindResult
|
williamr@2
|
33 |
//**********************************
|
williamr@2
|
34 |
//
|
williamr@2
|
35 |
// Contains the result of a find operation for a particular entry
|
williamr@2
|
36 |
//
|
williamr@2
|
37 |
|
williamr@2
|
38 |
class TMsvFindResult
|
williamr@2
|
39 |
/** A single result from a text search operation. The class encapsulates information
|
williamr@2
|
40 |
which:
|
williamr@2
|
41 |
|
williamr@2
|
42 |
1. identifies the message in which the search text is found
|
williamr@2
|
43 |
|
williamr@2
|
44 |
2. identifies the parts of the message that contain the search text.
|
williamr@2
|
45 |
@publishedAll
|
williamr@2
|
46 |
@released
|
williamr@2
|
47 |
*/
|
williamr@2
|
48 |
{
|
williamr@2
|
49 |
public:
|
williamr@2
|
50 |
IMPORT_C TMsvFindResult();
|
williamr@2
|
51 |
IMPORT_C TMsvFindResult(TMsvPartList aPartList, TMsvId aId);
|
williamr@2
|
52 |
//
|
williamr@2
|
53 |
public:
|
williamr@2
|
54 |
/** The parts of the message that contain the search text. */
|
williamr@2
|
55 |
TMsvPartList iPartList;
|
williamr@2
|
56 |
/** The entry Id of the message that contains the search text. */
|
williamr@2
|
57 |
TMsvId iId;
|
williamr@2
|
58 |
};
|
williamr@2
|
59 |
|
williamr@2
|
60 |
//**********************************
|
williamr@2
|
61 |
// CMsvFindResultSelection
|
williamr@2
|
62 |
//**********************************
|
williamr@2
|
63 |
//
|
williamr@2
|
64 |
// A list of find operation results with an accessor to find
|
williamr@2
|
65 |
// the position for a particular entry
|
williamr@2
|
66 |
//
|
williamr@2
|
67 |
|
williamr@2
|
68 |
class CMsvFindResultSelection : public CArrayFixFlat<TMsvFindResult>
|
williamr@2
|
69 |
/** Collection of results from a text search operation. The collection is organized
|
williamr@2
|
70 |
as an array.
|
williamr@2
|
71 |
@publishedAll
|
williamr@2
|
72 |
@released
|
williamr@2
|
73 |
*/
|
williamr@2
|
74 |
{
|
williamr@2
|
75 |
public:
|
williamr@2
|
76 |
IMPORT_C CMsvFindResultSelection();
|
williamr@2
|
77 |
//
|
williamr@2
|
78 |
public:
|
williamr@2
|
79 |
IMPORT_C CMsvFindResultSelection* CopyL() const;
|
williamr@2
|
80 |
IMPORT_C CMsvFindResultSelection* CopyLC() const;
|
williamr@2
|
81 |
IMPORT_C TInt Find(TMsvId aId) const;
|
williamr@2
|
82 |
};
|
williamr@2
|
83 |
|
williamr@2
|
84 |
//**********************************
|
williamr@2
|
85 |
// TMsvFindOperationProgress
|
williamr@2
|
86 |
//**********************************
|
williamr@2
|
87 |
//
|
williamr@2
|
88 |
// Find operation progress
|
williamr@2
|
89 |
//
|
williamr@2
|
90 |
|
williamr@2
|
91 |
class TMsvFindOperationProgress
|
williamr@2
|
92 |
/** Encapsulates progress information for a text search operation. The class has
|
williamr@2
|
93 |
public data members.
|
williamr@2
|
94 |
@publishedAll
|
williamr@2
|
95 |
@released
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
{
|
williamr@2
|
98 |
public:
|
williamr@2
|
99 |
IMPORT_C TMsvFindOperationProgress();
|
williamr@2
|
100 |
//
|
williamr@2
|
101 |
public:
|
williamr@2
|
102 |
/** KErrNone if the search operation completed successfully otherwise one of the
|
williamr@2
|
103 |
system-wide error codes.
|
williamr@2
|
104 |
|
williamr@2
|
105 |
This has no meaning while the search operation is in progress. */
|
williamr@2
|
106 |
TInt iError;
|
williamr@2
|
107 |
/** The number of messages already searched. */
|
williamr@2
|
108 |
TInt iCompleted;
|
williamr@2
|
109 |
/** The number of messages remaining to be searched.
|
williamr@2
|
110 |
|
williamr@2
|
111 |
If the search operation is for text within a specified root, folder or service,
|
williamr@2
|
112 |
then this value is zero until the total number of messages has been determined. */
|
williamr@2
|
113 |
TInt iRemaining;
|
williamr@2
|
114 |
/** The entry Id identifying the message currently being searched */
|
williamr@2
|
115 |
TMsvId iCurrentId;
|
williamr@2
|
116 |
};
|
williamr@2
|
117 |
|
williamr@2
|
118 |
class CClientMtmRegistry;
|
williamr@2
|
119 |
class CMsvChildMessages;
|
williamr@2
|
120 |
|
williamr@2
|
121 |
//**********************************
|
williamr@2
|
122 |
// CMsvFindOperation
|
williamr@2
|
123 |
//**********************************
|
williamr@2
|
124 |
//
|
williamr@2
|
125 |
// The find operation. Created by calling the relevant static function
|
williamr@2
|
126 |
// The results for all of these are added to the CMsvFindResultSelection which
|
williamr@2
|
127 |
// can be accessed via the accessor function GetFindResult
|
williamr@2
|
128 |
//
|
williamr@2
|
129 |
|
williamr@2
|
130 |
class CMsvFindOperation : public CMsvOperation
|
williamr@2
|
131 |
/** Encapsulates a text search operation.
|
williamr@2
|
132 |
|
williamr@2
|
133 |
The class offers an interface for locating messages which contain specified
|
williamr@2
|
134 |
text. Messages may contain data created for, or received from, any of the
|
williamr@2
|
135 |
transport protocols that are supported by the Messaging Architecture (e.g.
|
williamr@2
|
136 |
Email, FAX and SMS).
|
williamr@2
|
137 |
|
williamr@2
|
138 |
Clients create a new instance for each search operation to be performed. They
|
williamr@2
|
139 |
are also responsible for destroying the instance once a search operation is
|
williamr@2
|
140 |
complete.
|
williamr@2
|
141 |
|
williamr@2
|
142 |
Clients can derive from this class, typically to implement their own version
|
williamr@2
|
143 |
of the function IsValid().
|
williamr@2
|
144 |
@publishedAll
|
williamr@2
|
145 |
@released
|
williamr@2
|
146 |
*/
|
williamr@2
|
147 |
{
|
williamr@2
|
148 |
public:
|
williamr@2
|
149 |
IMPORT_C static CMsvFindOperation* FindInChildrenL(CMsvSession& aSession, const TDesC& aTextToFind, TMsvId aParentId, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
|
williamr@2
|
150 |
IMPORT_C static CMsvFindOperation* FindInSelectionL(CMsvSession& aSession, const TDesC& aTextToFind, const CMsvEntrySelection& aSelection, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
|
williamr@2
|
151 |
IMPORT_C ~CMsvFindOperation();
|
williamr@2
|
152 |
//
|
williamr@2
|
153 |
IMPORT_C const TDesC8& ProgressL();
|
williamr@2
|
154 |
IMPORT_C const TDesC8& FinalProgress();
|
williamr@2
|
155 |
//
|
williamr@2
|
156 |
inline const CMsvFindResultSelection& GetFindResult() const;
|
williamr@2
|
157 |
//
|
williamr@2
|
158 |
protected:
|
williamr@2
|
159 |
IMPORT_C CMsvFindOperation(CMsvSession& aSession, const TDesC& aTextToFind, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
|
williamr@2
|
160 |
IMPORT_C void ConstructFindInChildrenL(TMsvId aId);
|
williamr@2
|
161 |
IMPORT_C void ConstructFindInSelectionL(const CMsvEntrySelection& aSelection);
|
williamr@2
|
162 |
//
|
williamr@2
|
163 |
private:
|
williamr@2
|
164 |
void ConstructL();
|
williamr@2
|
165 |
//
|
williamr@2
|
166 |
IMPORT_C void DoCancel();
|
williamr@2
|
167 |
IMPORT_C void RunL();
|
williamr@2
|
168 |
//
|
williamr@2
|
169 |
void DoRunL();
|
williamr@2
|
170 |
void FindL();
|
williamr@2
|
171 |
void Complete(TInt aStatus);
|
williamr@2
|
172 |
void StartL();
|
williamr@2
|
173 |
//
|
williamr@2
|
174 |
virtual TBool IsValid(const TMsvEntry& aEntry) const;
|
williamr@2
|
175 |
//
|
williamr@2
|
176 |
private:
|
williamr@2
|
177 |
enum { EMsvFindingText, EMsvExpandingFolders } iState;
|
williamr@2
|
178 |
TBuf<KMsvMaxFindTextLength> iTextToFind;
|
williamr@2
|
179 |
TMsvPartList iPartList;
|
williamr@2
|
180 |
CMsvFindResultSelection* iFindResultSel;
|
williamr@2
|
181 |
TPckgBuf<TMsvFindOperationProgress> iProgress;
|
williamr@2
|
182 |
CMsvEntrySelection* iSelection;
|
williamr@2
|
183 |
CClientMtmRegistry* iClientRegistry;
|
williamr@2
|
184 |
CArrayPtrFlat<CBaseMtm>* iMtmArray;
|
williamr@2
|
185 |
CMsvChildMessages* iChildMessages;
|
williamr@2
|
186 |
TMsvId iCurrentId;
|
williamr@2
|
187 |
TMsvEntry iEntry;
|
williamr@2
|
188 |
};
|
williamr@2
|
189 |
|
williamr@2
|
190 |
#include <msvfind.inl>
|
williamr@2
|
191 |
|
williamr@2
|
192 |
#endif
|