|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Harvester message plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMESSAGEHARVESTER_H |
|
20 #define CMESSAGEHARVESTER_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <msvapi.h> |
|
26 //#include <mdeitem.h> |
|
27 |
|
28 #include "cmessageplugin.h" |
|
29 |
|
30 |
|
31 class CMessageHarvester : public CActive |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Construction |
|
36 * @return Harvester image plugin |
|
37 */ |
|
38 static CMessageHarvester* NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); |
|
39 |
|
40 /** |
|
41 * Destruction |
|
42 */ |
|
43 virtual ~CMessageHarvester(); |
|
44 |
|
45 /** |
|
46 * Start harvesting message items |
|
47 */ |
|
48 void StartHarvestingL(); |
|
49 |
|
50 private: //From CActive |
|
51 |
|
52 /** |
|
53 * From CACtive. |
|
54 */ |
|
55 void DoCancel(); |
|
56 |
|
57 /** |
|
58 * From CACtive. |
|
59 */ |
|
60 void RunL(); |
|
61 |
|
62 /** |
|
63 * From CACtive. |
|
64 * @param aError Leave code from RunL() |
|
65 * @return Error code, KErrNone if error was handled successfully. |
|
66 */ |
|
67 TInt RunError( TInt aError ); |
|
68 |
|
69 |
|
70 private: |
|
71 |
|
72 /** |
|
73 * Private constructor |
|
74 */ |
|
75 CMessageHarvester( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); |
|
76 |
|
77 /** |
|
78 * Get next messaging folder |
|
79 */ |
|
80 void GetNextFolderL(); |
|
81 |
|
82 /** |
|
83 * List subfolder from current folder |
|
84 * @param aFolderEntry Folder entry |
|
85 */ |
|
86 void ListSubFoldersL( const CMsvEntry& aFolderEntry ); |
|
87 |
|
88 /** |
|
89 * List subfolder from current folder |
|
90 * @param aFolderId a folder identifier |
|
91 */ |
|
92 void AddFolderWithSubFoldersL( const TMsvId& aFolderId ); |
|
93 |
|
94 /** |
|
95 * Get message folders under the messaging |
|
96 */ |
|
97 void GetMessageFoldersL(); |
|
98 |
|
99 /** |
|
100 * Get message identifier |
|
101 */ |
|
102 void GetMessageIdL(); |
|
103 |
|
104 /** |
|
105 * Handles next request |
|
106 */ |
|
107 void HandleNextRequest(); |
|
108 |
|
109 private: |
|
110 enum TState |
|
111 { |
|
112 EStateIdle, // Stopped |
|
113 EStateNextFolder, // Getting the next folder |
|
114 EStateNextMessage, // Getting the next message |
|
115 }; |
|
116 |
|
117 private: |
|
118 // Whether Harvesting is ready |
|
119 TBool iHarvestCompleted; |
|
120 // Message plugin for observing |
|
121 CMessagePlugin& iMessagePlugin; |
|
122 // Session Message server session, own |
|
123 CMsvSession& iMsvSession; |
|
124 // Internal state machine state |
|
125 TState iState; |
|
126 // Array of folders to be searched |
|
127 RArray<TMsvId> iToBeSearchedFolders; |
|
128 // UID of current folder searched |
|
129 TMsvId iCurrentFolder; |
|
130 // Current folder message items |
|
131 CMsvEntrySelection* iChildren; |
|
132 }; |
|
133 |
|
134 #endif // CMESSAGEHARVESTER_H |
|
135 |
|
136 // End of File |