1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/msvfind.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,192 @@
1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#if !defined(__MSVFIND_H__)
1.20 +#define __MSVFIND_H__
1.21 +
1.22 +#if !defined(__MSVAPI_H__)
1.23 +#include <msvapi.h>
1.24 +#endif
1.25 +
1.26 +#if !defined __MTCLBASE_H__
1.27 +#include <mtclbase.h>
1.28 +#endif
1.29 +
1.30 +#if !defined(__MTMDEF_H__)
1.31 +#include <mtmdef.h>
1.32 +#endif
1.33 +
1.34 +//**********************************
1.35 +// TMsvFindResult
1.36 +//**********************************
1.37 +//
1.38 +// Contains the result of a find operation for a particular entry
1.39 +//
1.40 +
1.41 +class TMsvFindResult
1.42 +/** A single result from a text search operation. The class encapsulates information
1.43 +which:
1.44 +
1.45 +1. identifies the message in which the search text is found
1.46 +
1.47 +2. identifies the parts of the message that contain the search text.
1.48 +@publishedAll
1.49 +@released
1.50 +*/
1.51 + {
1.52 +public:
1.53 + IMPORT_C TMsvFindResult();
1.54 + IMPORT_C TMsvFindResult(TMsvPartList aPartList, TMsvId aId);
1.55 + //
1.56 +public:
1.57 + /** The parts of the message that contain the search text. */
1.58 + TMsvPartList iPartList;
1.59 + /** The entry Id of the message that contains the search text. */
1.60 + TMsvId iId;
1.61 + };
1.62 +
1.63 +//**********************************
1.64 +// CMsvFindResultSelection
1.65 +//**********************************
1.66 +//
1.67 +// A list of find operation results with an accessor to find
1.68 +// the position for a particular entry
1.69 +//
1.70 +
1.71 +class CMsvFindResultSelection : public CArrayFixFlat<TMsvFindResult>
1.72 +/** Collection of results from a text search operation. The collection is organized
1.73 +as an array.
1.74 +@publishedAll
1.75 +@released
1.76 +*/
1.77 + {
1.78 +public:
1.79 + IMPORT_C CMsvFindResultSelection();
1.80 + //
1.81 +public:
1.82 + IMPORT_C CMsvFindResultSelection* CopyL() const;
1.83 + IMPORT_C CMsvFindResultSelection* CopyLC() const;
1.84 + IMPORT_C TInt Find(TMsvId aId) const;
1.85 + };
1.86 +
1.87 +//**********************************
1.88 +// TMsvFindOperationProgress
1.89 +//**********************************
1.90 +//
1.91 +// Find operation progress
1.92 +//
1.93 +
1.94 +class TMsvFindOperationProgress
1.95 +/** Encapsulates progress information for a text search operation. The class has
1.96 +public data members.
1.97 +@publishedAll
1.98 +@released
1.99 +*/
1.100 + {
1.101 +public:
1.102 + IMPORT_C TMsvFindOperationProgress();
1.103 + //
1.104 +public:
1.105 + /** KErrNone if the search operation completed successfully otherwise one of the
1.106 + system-wide error codes.
1.107 +
1.108 + This has no meaning while the search operation is in progress. */
1.109 + TInt iError;
1.110 + /** The number of messages already searched. */
1.111 + TInt iCompleted;
1.112 + /** The number of messages remaining to be searched.
1.113 +
1.114 + If the search operation is for text within a specified root, folder or service,
1.115 + then this value is zero until the total number of messages has been determined. */
1.116 + TInt iRemaining;
1.117 + /** The entry Id identifying the message currently being searched */
1.118 + TMsvId iCurrentId;
1.119 + };
1.120 +
1.121 +class CClientMtmRegistry;
1.122 +class CMsvChildMessages;
1.123 +
1.124 +//**********************************
1.125 +// CMsvFindOperation
1.126 +//**********************************
1.127 +//
1.128 +// The find operation. Created by calling the relevant static function
1.129 +// The results for all of these are added to the CMsvFindResultSelection which
1.130 +// can be accessed via the accessor function GetFindResult
1.131 +//
1.132 +
1.133 +class CMsvFindOperation : public CMsvOperation
1.134 +/** Encapsulates a text search operation.
1.135 +
1.136 +The class offers an interface for locating messages which contain specified
1.137 +text. Messages may contain data created for, or received from, any of the
1.138 +transport protocols that are supported by the Messaging Architecture (e.g.
1.139 +Email, FAX and SMS).
1.140 +
1.141 +Clients create a new instance for each search operation to be performed. They
1.142 +are also responsible for destroying the instance once a search operation is
1.143 +complete.
1.144 +
1.145 +Clients can derive from this class, typically to implement their own version
1.146 +of the function IsValid().
1.147 +@publishedAll
1.148 +@released
1.149 +*/
1.150 + {
1.151 +public:
1.152 + IMPORT_C static CMsvFindOperation* FindInChildrenL(CMsvSession& aSession, const TDesC& aTextToFind, TMsvId aParentId, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
1.153 + IMPORT_C static CMsvFindOperation* FindInSelectionL(CMsvSession& aSession, const TDesC& aTextToFind, const CMsvEntrySelection& aSelection, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
1.154 + IMPORT_C ~CMsvFindOperation();
1.155 + //
1.156 + IMPORT_C const TDesC8& ProgressL();
1.157 + IMPORT_C const TDesC8& FinalProgress();
1.158 + //
1.159 + inline const CMsvFindResultSelection& GetFindResult() const;
1.160 + //
1.161 +protected:
1.162 + IMPORT_C CMsvFindOperation(CMsvSession& aSession, const TDesC& aTextToFind, TMsvPartList aPartList, TRequestStatus& aObserverRequestStatus);
1.163 + IMPORT_C void ConstructFindInChildrenL(TMsvId aId);
1.164 + IMPORT_C void ConstructFindInSelectionL(const CMsvEntrySelection& aSelection);
1.165 + //
1.166 +private:
1.167 + void ConstructL();
1.168 + //
1.169 + IMPORT_C void DoCancel();
1.170 + IMPORT_C void RunL();
1.171 + //
1.172 + void DoRunL();
1.173 + void FindL();
1.174 + void Complete(TInt aStatus);
1.175 + void StartL();
1.176 + //
1.177 + virtual TBool IsValid(const TMsvEntry& aEntry) const;
1.178 + //
1.179 +private:
1.180 + enum { EMsvFindingText, EMsvExpandingFolders } iState;
1.181 + TBuf<KMsvMaxFindTextLength> iTextToFind;
1.182 + TMsvPartList iPartList;
1.183 + CMsvFindResultSelection* iFindResultSel;
1.184 + TPckgBuf<TMsvFindOperationProgress> iProgress;
1.185 + CMsvEntrySelection* iSelection;
1.186 + CClientMtmRegistry* iClientRegistry;
1.187 + CArrayPtrFlat<CBaseMtm>* iMtmArray;
1.188 + CMsvChildMessages* iChildMessages;
1.189 + TMsvId iCurrentId;
1.190 + TMsvEntry iEntry;
1.191 + };
1.192 +
1.193 +#include <msvfind.inl>
1.194 +
1.195 +#endif