|
1 /* |
|
2 * Copyright (c) 2008 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: class handles mailbox sync state queries |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IPSPLGSYNCSTATEHANDLER_H_ |
|
20 #define IPSPLGSYNCSTATEHANDLER_H_ |
|
21 |
|
22 |
|
23 #include "ipsplgeventhandler.h" |
|
24 |
|
25 class CMsvSession; |
|
26 class CIpsPlgSosBasePlugin; |
|
27 |
|
28 /** |
|
29 * |
|
30 * |
|
31 * @lib |
|
32 * @since FS 1.0 |
|
33 */ |
|
34 NONSHARABLE_CLASS( CIpsPlgSyncStateHandler ) : |
|
35 public CBase, |
|
36 public MIpsPlgPropertyObserver |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Symbian 2nd phase construcror |
|
42 * |
|
43 * @since FS 2.0 |
|
44 * @return Created object |
|
45 */ |
|
46 static CIpsPlgSyncStateHandler* NewL( |
|
47 CMsvSession& aSession, |
|
48 CIpsPlgSosBasePlugin& aPlugin, |
|
49 RPointerArray<CIpsPlgSingleOpWatcher>& aOperationsRef ); |
|
50 |
|
51 /** |
|
52 * Class destructor |
|
53 * |
|
54 * @since FS 2.0 |
|
55 */ |
|
56 virtual ~CIpsPlgSyncStateHandler(); |
|
57 |
|
58 |
|
59 public: // from MIpsPlgPropertyObserver |
|
60 |
|
61 virtual void HandlePropertyEventL( |
|
62 TInt aEvent, TInt aMailbox, TInt aPluginId ,TInt aError ); |
|
63 |
|
64 public: |
|
65 |
|
66 /** |
|
67 * Static utility function for saving |
|
68 * sync time to extended mailbox settings |
|
69 * @param aSession, reference to msv session |
|
70 * @param aService, mailbox service id |
|
71 * @since FS 2.0 |
|
72 */ |
|
73 static void SaveSuccessfulSyncTimeL( |
|
74 CMsvSession& aSession, TMsvId aService ); |
|
75 |
|
76 /** |
|
77 * |
|
78 * |
|
79 * @since FS 2.0 |
|
80 */ |
|
81 TSSMailSyncState GetCurrentSyncState( |
|
82 const TFSMailMsgId& aMailboxId ); |
|
83 |
|
84 |
|
85 /** |
|
86 * Returns index of syncing mailbox array if found |
|
87 * @param aMailbox id of mailbox to be found |
|
88 * @return index of syncing mailbox array or KErrNotFound if not found |
|
89 */ |
|
90 TInt FindSyncingMailbox( TMsvId aMailbox ); |
|
91 |
|
92 /** |
|
93 * Updates mailbox state to syncing mailboxes array, append box if not |
|
94 * found and append can be done (no errors occur) |
|
95 * @param aMailbox id of mailbox to be append |
|
96 * @param aState state to be updated or added to mailbox |
|
97 */ |
|
98 void AppendMailboxToSyncingMailbox( TMsvId aMailbox, TInt aState ); |
|
99 |
|
100 TInt GetMailboxIpsState( TMsvId aMailbox ); |
|
101 |
|
102 void NotifyMailboxRemove( TMsvId aMailbox ); |
|
103 |
|
104 TInt FindMailbox( TMsvId aMailbox ); |
|
105 |
|
106 /** |
|
107 * Checks is there any connect operations running, meaning |
|
108 * that the mailbox is in "connected" state. |
|
109 * @param aMailBoxId Id of the mailbox which state is checked |
|
110 */ |
|
111 TBool ConnOpRunning( const TFSMailMsgId& aMailBoxId ); |
|
112 |
|
113 private: |
|
114 |
|
115 /** |
|
116 * |
|
117 */ |
|
118 CIpsPlgSyncStateHandler( |
|
119 CMsvSession& aSession, |
|
120 CIpsPlgSosBasePlugin& aPlugin, |
|
121 RPointerArray<CIpsPlgSingleOpWatcher>& aOperationsRef ); |
|
122 |
|
123 /** |
|
124 * |
|
125 */ |
|
126 void ConstructL(); |
|
127 |
|
128 |
|
129 TInt SolveOpProtocolType( ); |
|
130 |
|
131 private: |
|
132 |
|
133 CMsvSession& iSession; |
|
134 CIpsPlgSosBasePlugin& iPlugin; |
|
135 |
|
136 // used because of efficency, stores ids of mailboxes that is |
|
137 // syncing |
|
138 RArray<TIpsMailboxState> iSyncingMailboxes; |
|
139 |
|
140 RPointerArray<CIpsPlgSingleOpWatcher>& iOperationsRef; |
|
141 |
|
142 }; |
|
143 |
|
144 #endif /*IPSPLGSYNCSTATEHANDLER_H_*/ |
|
145 |
|
146 // End of file |
|
147 |