|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MESSAGESCANNER_H_ |
|
19 #define MESSAGESCANNER_H_ |
|
20 |
|
21 #include <e32property.h> |
|
22 #include <mdequery.h> |
|
23 |
|
24 // FORWARD DECLARATION |
|
25 class CMsvSession; |
|
26 class CMdESession; |
|
27 class CMsvFindOperation; |
|
28 class MMonitorPluginObserver; |
|
29 |
|
30 class TMessage |
|
31 { |
|
32 public: |
|
33 TInt32 iMsvId; |
|
34 TTime iCreationDate; |
|
35 TItemId iMdeId; |
|
36 }; |
|
37 |
|
38 class CMessageScannerAO : public CActive, public MMdEQueryObserver |
|
39 { |
|
40 public: |
|
41 enum TScannerState { |
|
42 EScannerIdle, |
|
43 EScannerRunning, |
|
44 EScannerFinished |
|
45 }; |
|
46 |
|
47 static CMessageScannerAO* NewL( CMsvSession* aMsvSession, CMdESession* aMdeSession, |
|
48 MMonitorPluginObserver* aMonitorPluginObserver ); |
|
49 ~CMessageScannerAO(); |
|
50 void StartL(); |
|
51 |
|
52 void HandleQueryNewResults( CMdEQuery& aQuery, TInt aFirstNewItemIndex, |
|
53 TInt aNewItemCount ); |
|
54 |
|
55 void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ); |
|
56 |
|
57 private: |
|
58 CMessageScannerAO( CMsvSession* aMsvSession, CMdESession* aMdeSession, |
|
59 MMonitorPluginObserver* aMonitorPluginObserver ); |
|
60 void ConstructL(); |
|
61 void RunL(); |
|
62 void DoCancel(); |
|
63 TInt RunError( TInt aError ); |
|
64 void ScanMessagesL( RArray<TMessage>& aMessageIds ); |
|
65 void QueryAllMessagesL(); |
|
66 void ProcessMessagesL( CMdEQuery& aQuery, RArray<TMessage>& aMessages ); |
|
67 void Unregister(); |
|
68 void Cleanup(); |
|
69 |
|
70 private: |
|
71 CMsvFindOperation* iFindOperation; |
|
72 CMsvSession* iMsvSession; |
|
73 CMdESession* iMdeSession; |
|
74 CMdEObjectQuery* iObjectQuery; |
|
75 MMonitorPluginObserver* iMonitorPluginObserver; |
|
76 RProperty iProperty; |
|
77 TScannerState iState; |
|
78 }; |
|
79 |
|
80 #endif /*MESSAGESCANNER_H_*/ |