williamr@2
|
1 |
// Copyright (c) 1998-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@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.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 |
#ifndef __MSVENTRY_H__
|
williamr@2
|
17 |
#define __MSVENTRY_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
#if !defined(__E32BASE_H__)
|
williamr@2
|
22 |
#include <e32base.h>
|
williamr@2
|
23 |
#endif
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#if !defined(__MSVSTORE_H__)
|
williamr@2
|
26 |
#include <msvstore.h>
|
williamr@2
|
27 |
#endif
|
williamr@2
|
28 |
|
williamr@4
|
29 |
//
|
williamr@2
|
30 |
// Forward declarations
|
williamr@2
|
31 |
class CMsvStore;
|
williamr@2
|
32 |
class CMsvCopyMoveEntriesBase;
|
williamr@2
|
33 |
class CMsvServer;
|
williamr@2
|
34 |
|
williamr@2
|
35 |
//**********************************
|
williamr@2
|
36 |
// CMsvServerEntry
|
williamr@2
|
37 |
//**********************************
|
williamr@2
|
38 |
//
|
williamr@2
|
39 |
//
|
williamr@2
|
40 |
//
|
williamr@2
|
41 |
|
williamr@2
|
42 |
class CMsvServerEntry : public CActive, public MMsvStoreObserver
|
williamr@2
|
43 |
/** Accesses and acts upon a particular Message Server entry.
|
williamr@2
|
44 |
|
williamr@2
|
45 |
It provides similar
|
williamr@2
|
46 |
functionality to that which CMsvEntry gives to client-side programs. The current
|
williamr@2
|
47 |
entry that a CMsvServerEntry object relates is similarly referred to as its
|
williamr@2
|
48 |
context.
|
williamr@2
|
49 |
|
williamr@2
|
50 |
A difference to note is that CMsvEntry functions, when used on a remote context,
|
williamr@2
|
51 |
can result in requests to Server-side MTMs to change data on a remote server,
|
williamr@2
|
52 |
as well as the local Message Server index. Naturally, as CMsvServerEntry is
|
williamr@2
|
53 |
designed to be used by Server-side MTMs themselves, its comparable functions
|
williamr@2
|
54 |
only alter the Message Server index.
|
williamr@2
|
55 |
|
williamr@2
|
56 |
A CBaseServerMTM-derived object gets an initial CMsvServerEntry on construction.
|
williamr@2
|
57 |
It can get further CMsvServerEntry objects by calling NewEntryL(). The context
|
williamr@2
|
58 |
can be changed by SetEntry().
|
williamr@2
|
59 |
|
williamr@2
|
60 |
The context is locked, preventing it being accessed by other MTMs. The lock
|
williamr@2
|
61 |
is released when the object is deleted, or the context changes.
|
williamr@2
|
62 |
|
williamr@2
|
63 |
As with CMsvEntry, CBaseServerMTM functions can be divided into two broad
|
williamr@2
|
64 |
groups. The first provides means to access the various types of storage associated
|
williamr@2
|
65 |
with an entry. The second provides a means to discover and access other entries
|
williamr@2
|
66 |
that the entry owns (its children).
|
williamr@2
|
67 |
@publishedAll
|
williamr@2
|
68 |
@released
|
williamr@2
|
69 |
*/
|
williamr@2
|
70 |
{
|
williamr@2
|
71 |
public:
|
williamr@2
|
72 |
IMPORT_C static CMsvServerEntry* NewL(CMsvServer& aServer, TMsvId aId);
|
williamr@2
|
73 |
~CMsvServerEntry();
|
williamr@2
|
74 |
//
|
williamr@2
|
75 |
// Set and get the current context
|
williamr@2
|
76 |
IMPORT_C TInt SetEntry(TMsvId aId);
|
williamr@2
|
77 |
inline const TMsvEntry& Entry() const;
|
williamr@2
|
78 |
IMPORT_C TMsvId OwningService() const;
|
williamr@2
|
79 |
//
|
williamr@2
|
80 |
// current entry only functions
|
williamr@2
|
81 |
IMPORT_C TInt ChangeEntry(const TMsvEntry& aEntry, TSecureId aOwnerId);
|
williamr@2
|
82 |
IMPORT_C TInt ChangeEntry(const TMsvEntry& aEntry);
|
williamr@2
|
83 |
|
williamr@2
|
84 |
|
williamr@2
|
85 |
//
|
williamr@2
|
86 |
// child entry only functions
|
williamr@2
|
87 |
IMPORT_C TInt CreateEntry(TMsvEntry& aEntry);
|
williamr@2
|
88 |
IMPORT_C TInt CreateEntry(TMsvEntry& aEntry, TSecureId aOwnerId);
|
williamr@2
|
89 |
IMPORT_C TInt CreateEntry(TMsvEntry& aEntry, TSecureId aOwnerId, TBool aBulk);
|
williamr@2
|
90 |
IMPORT_C TInt DeleteEntry(TMsvId aId);
|
williamr@2
|
91 |
IMPORT_C TInt DeleteEntries(CMsvEntrySelection& aSelection);
|
williamr@2
|
92 |
IMPORT_C TInt MoveEntryWithinService(TMsvId aId, TMsvId aDestination);
|
williamr@2
|
93 |
IMPORT_C TInt MoveEntriesWithinService(CMsvEntrySelection& aSelection, TMsvId aDestination);
|
williamr@2
|
94 |
IMPORT_C TInt ChangeAttributes(const CMsvEntrySelection& aSelection, TUint aSetAttributes, TUint aClearAttributes);
|
williamr@2
|
95 |
IMPORT_C void MoveEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus);
|
williamr@2
|
96 |
IMPORT_C void MoveEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus);
|
williamr@2
|
97 |
IMPORT_C void CopyEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus);
|
williamr@2
|
98 |
IMPORT_C void CopyEntryL(TMsvId aId, TMsvId aDestination, TMsvId& aCompletedEntry, TRequestStatus& aObserverStatus);
|
williamr@2
|
99 |
IMPORT_C void CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus);
|
williamr@2
|
100 |
IMPORT_C void CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, CMsvEntrySelection& aCompletedSelection, TRequestStatus& aObserverStatus);
|
williamr@2
|
101 |
IMPORT_C TInt GetEntryFromId(TMsvId aId,TMsvEntry*& aEntry);
|
williamr@2
|
102 |
//
|
williamr@2
|
103 |
// read and write the store associated with the context
|
williamr@2
|
104 |
IMPORT_C CMsvStore* ReadStoreL();
|
williamr@2
|
105 |
IMPORT_C CMsvStore* EditStoreL();
|
williamr@2
|
106 |
//
|
williamr@2
|
107 |
// List the children of the context
|
williamr@2
|
108 |
inline const TMsvSelectionOrdering& Sort();
|
williamr@2
|
109 |
inline void SetSort(TMsvSelectionOrdering& aOrdering);
|
williamr@2
|
110 |
inline void SetMtm(TUid aMtm);
|
williamr@2
|
111 |
IMPORT_C TInt GetChildren(CMsvEntrySelection& aSelection);
|
williamr@2
|
112 |
//
|
williamr@2
|
113 |
IMPORT_C TInt GetChildrenWithService(TMsvId aServiceId, CMsvEntrySelection& aSelection);
|
williamr@2
|
114 |
IMPORT_C TInt GetChildrenWithMtm(TUid aMtm, CMsvEntrySelection& aSelection);
|
williamr@2
|
115 |
IMPORT_C TInt GetChildrenWithType(TUid aType, CMsvEntrySelection& aSelection);
|
williamr@2
|
116 |
//
|
williamr@2
|
117 |
// Spawns a new CMsvServerEntry object
|
williamr@2
|
118 |
IMPORT_C CMsvServerEntry* NewEntryL(TMsvId aId);
|
williamr@2
|
119 |
//
|
williamr@2
|
120 |
// from MMsvStoreObserver
|
williamr@2
|
121 |
void HandleStoreEvent(MMsvStoreObserver::TMsvStoreEvent aEvent, TMsvId aId);
|
williamr@2
|
122 |
//
|
williamr@2
|
123 |
//
|
williamr@2
|
124 |
|
williamr@2
|
125 |
IMPORT_C TBool HasStoreL() const;
|
williamr@2
|
126 |
//
|
williamr@2
|
127 |
IMPORT_C RFs& FileSession();
|
williamr@2
|
128 |
//
|
williamr@2
|
129 |
// Methods for creating and changing entries in bulk
|
williamr@2
|
130 |
// (e.g. during email header downloading)
|
williamr@2
|
131 |
IMPORT_C TInt CreateEntryBulk(TMsvEntry& aEntry, TSecureId aOwnerId);
|
williamr@2
|
132 |
|
williamr@2
|
133 |
IMPORT_C TInt CreateEntryBulk(TMsvEntry& aEntry);
|
williamr@2
|
134 |
|
williamr@2
|
135 |
IMPORT_C TInt ChangeEntryBulk(const TMsvEntry& aEntry, TSecureId aOwnerId);
|
williamr@2
|
136 |
IMPORT_C TInt ChangeEntryBulk(const TMsvEntry& aEntry);
|
williamr@2
|
137 |
|
williamr@2
|
138 |
IMPORT_C void CompleteBulk();
|
williamr@2
|
139 |
|
williamr@2
|
140 |
protected:
|
williamr@2
|
141 |
CMsvServerEntry(CMsvServer& aIndex);
|
williamr@2
|
142 |
void ConstructL(TMsvId aId);
|
williamr@2
|
143 |
//
|
williamr@2
|
144 |
void RunL();
|
williamr@2
|
145 |
void DoCancel();
|
williamr@2
|
146 |
//
|
williamr@2
|
147 |
private:
|
williamr@2
|
148 |
TInt IncreaseBufferSizes(TInt aNewDescriptionSize, TInt aNewDetailsSize);
|
williamr@2
|
149 |
TBool AreChildren(const CMsvEntrySelection& aSelection) const;
|
williamr@2
|
150 |
TBool IsAChild(TMsvId aId) const;
|
williamr@2
|
151 |
void DoMoveEntryL(TMsvId aId, TMsvId aDestination);
|
williamr@2
|
152 |
void DoDeleteEntryL(TMsvId aId, CMsvEntrySelection*& aDeleted, CMsvEntrySelection*& aMoved);
|
williamr@2
|
153 |
void DoDeleteEntriesL(CMsvEntrySelection& aSelection, CMsvEntrySelection*& aDeleted, CMsvEntrySelection*& aMoved);
|
williamr@2
|
154 |
void DoMoveEntriesL(CMsvEntrySelection& aSelection, TMsvId aDestination, CMsvEntrySelection*& aMoved);
|
williamr@2
|
155 |
TInt DoGetChildren(TMsvId aServiceId, TUid aMtm, TUid aType, CMsvEntrySelection& aSelection);
|
williamr@2
|
156 |
void DoGetChildrenL(TMsvId aServiceId, TUid aMtm, TUid aType, CMsvEntrySelection& aSelection);
|
williamr@2
|
157 |
void DoCopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus);
|
williamr@2
|
158 |
TInt DoChangeEntry(const TMsvEntry& aEntry, TSecureId aOwnerId, TBool aForcedUpdate, TBool aBulk);
|
williamr@2
|
159 |
|
williamr@2
|
160 |
//
|
williamr@2
|
161 |
private:
|
williamr@2
|
162 |
TBool iLockedStore;
|
williamr@2
|
163 |
TMsvSelectionOrdering iOrdering;
|
williamr@2
|
164 |
TMsvEntry iEntry;
|
williamr@2
|
165 |
HBufC* iDescription;
|
williamr@2
|
166 |
HBufC* iDetails;
|
williamr@2
|
167 |
CMsvServer& iServer;
|
williamr@2
|
168 |
CMsvStore* iStore;
|
williamr@2
|
169 |
TUid iMtm;
|
williamr@2
|
170 |
CMsvCopyMoveEntriesBase* iCopyMove;
|
williamr@2
|
171 |
TMsvId iSource;
|
williamr@2
|
172 |
enum { EMsvIdle, EMsvMoving, EMsvCopying } iEntryState;
|
williamr@2
|
173 |
TRequestStatus* iObserverStatus;
|
williamr@2
|
174 |
CMsvEntrySelection* iCompletedSelection;
|
williamr@2
|
175 |
TMsvId* iCompletedEntryId;
|
williamr@2
|
176 |
TSecureId iContextOwnerId;
|
williamr@2
|
177 |
};
|
williamr@2
|
178 |
|
williamr@2
|
179 |
|
williamr@2
|
180 |
#include <msventry.inl>
|
williamr@2
|
181 |
|
williamr@2
|
182 |
#endif // __MSVENTRY_H__
|