|
1 /* |
|
2 * Copyright (c) 2006 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: Process Component for Blocking and Unblocking |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCABLOCKINGPC_H |
|
20 #define CCABLOCKINGPC_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "MCABackgroundObserver.h" |
|
24 #include "MCABlockingPC.h" |
|
25 |
|
26 //FORWARD DECLARATION |
|
27 class MCABackgroundInterface; |
|
28 class CCAEngine; |
|
29 class MCABlocking; |
|
30 class MCABlockingBackgroundObserverPC; |
|
31 class MCAServerContactsArrayPC; |
|
32 class CCAServerContactsArrayPC; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * This class provides blocking functions to UI side |
|
37 * |
|
38 * @lib chat.app |
|
39 * @since 3.2 |
|
40 */ |
|
41 class CCABlockingPC : public CBase, |
|
42 public MCABackgroundObserver, |
|
43 public MCABlockingPC |
|
44 |
|
45 { |
|
46 |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * @param aBlockingInterface Reference to blocking interface |
|
52 * @param aBackgroundInterface Reference to aBackgroundInterface |
|
53 * @return Instance of the class |
|
54 */ |
|
55 static CCABlockingPC* NewL( CCAEngine& aEngine ); |
|
56 |
|
57 /** |
|
58 * Second phased symbian constructor. |
|
59 */ |
|
60 void ConstructL(); |
|
61 |
|
62 /** |
|
63 * Destructor |
|
64 */ |
|
65 virtual ~CCABlockingPC(); |
|
66 |
|
67 public: |
|
68 /** |
|
69 * Gets the backgroundstatus |
|
70 *@return the TCABackgroundStatus |
|
71 */ |
|
72 TInt GetBackgroundStatus(); |
|
73 |
|
74 /** |
|
75 * Gets the blockedlist from server |
|
76 *@return the |
|
77 */ |
|
78 TInt GetBlockedListFromServerL(); |
|
79 |
|
80 /** |
|
81 * Gets the retrieved blocked list |
|
82 *@return the blocked array |
|
83 */ |
|
84 const CDesCArray* GetBlockedList(); |
|
85 |
|
86 /** |
|
87 * Remove user from blocked or granted list. |
|
88 * @param aBlockList blocked to be removed entity's list. |
|
89 * @return error code. |
|
90 */ |
|
91 TInt RemoveL( const CDesCArray* aUnBlockList, |
|
92 const CDesCArray* aGrantList = NULL ); |
|
93 |
|
94 /** |
|
95 * Insert users to be blocked or granted. |
|
96 * @param aBlockList blocked entity's list. |
|
97 * @param aGrantList granted entity's list. |
|
98 * @return error code. |
|
99 */ |
|
100 |
|
101 TInt InsertL( const CDesCArray* aUnBlockList, |
|
102 const CDesCArray* aGrantList ); |
|
103 |
|
104 |
|
105 /** |
|
106 * Is this contact in our block list or not? |
|
107 * @param aContact specifies the contact. |
|
108 * @return ETrue if yes EFalse if not. |
|
109 */ |
|
110 TBool IsContactBlocked( const TDesC& aContact, |
|
111 TBool aUseGrant = EFalse ) const ; |
|
112 |
|
113 /** |
|
114 * Set temporary grant on/off. If contact is blocked, unblock is permanent. |
|
115 * @since 3.2 |
|
116 * @param aContact specifies the contact |
|
117 * @param aOn On/off. ETrue = on |
|
118 * @return errorCode if unsuccessfull |
|
119 */ |
|
120 TInt SetTemporaryGrantL( const TDesC& aContact, TBool aOn ) ; |
|
121 |
|
122 /** |
|
123 * See MCABackgroundObserver |
|
124 */ |
|
125 void HandleBackgroundEvent( |
|
126 MCABackgroundInterface::TCABackgroundTasks aEventSource, |
|
127 MCABackgroundInterface::TCABackgroundStatus aStatus, |
|
128 TInt aSubTaskNumber, |
|
129 TInt aLeaveCode |
|
130 ); |
|
131 |
|
132 |
|
133 |
|
134 /** |
|
135 *Gets the list of blockedmembers |
|
136 */ |
|
137 void GetBlockedMembersL( const TDesC& aIcon ); |
|
138 |
|
139 /** |
|
140 * Gets the reference of ServerContactsArray |
|
141 */ |
|
142 MCAServerContactsArrayPC& GetServerContactsArray(); |
|
143 |
|
144 |
|
145 /** |
|
146 * Gets blocked members from Blocking interface and fetch nicknames also |
|
147 * for contact ID's from Storage. |
|
148 * @param aIcon Icon to be inserted in front of |
|
149 * each list item (e.g "1\t") |
|
150 * @return contacts array with wvid's and nicknames |
|
151 */ |
|
152 MCAServerContactsArrayPC* GetBlockedMembersLC( const TDesC& aIcon ); |
|
153 |
|
154 |
|
155 /** |
|
156 * Gets the list to be unblocked |
|
157 * @Param aSelectedItem - selected index |
|
158 * @param aFindTxt - Find Pane Text |
|
159 */ |
|
160 CDesCArrayFlat* GetUnBlockListL( TInt aSelectedItem, |
|
161 const TDesC& aFindTxt ); |
|
162 |
|
163 |
|
164 /** |
|
165 * GetWvId:gets the WvId of a given index |
|
166 */ |
|
167 TPtrC GetWvIdL( const TDesC& aIcon, TInt aDeletedIndex ); |
|
168 |
|
169 /** |
|
170 * DeleteContactL: Deletes a contact |
|
171 * @Param aWvId: WVID of the contact to be deleted |
|
172 * @Param aFindTxt : Find Pane Text |
|
173 */ |
|
174 TInt DeleteContactL( TInt aSelectedItem, const TDesC& aFindTxt ); |
|
175 |
|
176 /** |
|
177 * RemoveIDsL: removes the list of userids to be unblocked |
|
178 * @Param aUserIds: list of userids |
|
179 */ |
|
180 void RemoveIDsL( const CDesCArray* aUserIds ); |
|
181 |
|
182 public://From MCABackgroundObserverPC |
|
183 |
|
184 /** |
|
185 * Registers the UI observer for backgorund tasks. |
|
186 * @param aBackgroundObserver: observer to be registered |
|
187 */ |
|
188 void RegisterBackgroundObserver( MCABlockingBackgroundObserverPC* |
|
189 aBackgroundObserver ); |
|
190 /** |
|
191 * UnRegisters the UI observer for backgorund tasks. |
|
192 * |
|
193 */ |
|
194 void UnRegisterBackgroundObserver( ); |
|
195 |
|
196 |
|
197 private: |
|
198 |
|
199 /** |
|
200 * Default Constructor |
|
201 * @param aEngine - reference to chat engine |
|
202 */ |
|
203 CCABlockingPC( CCAEngine& aEngine ); |
|
204 |
|
205 |
|
206 |
|
207 private://Data members |
|
208 |
|
209 CCAEngine& iEngine; |
|
210 |
|
211 //Pointer to blocking interface not owned so don't delete |
|
212 MCABlocking& iBlockingInterface; |
|
213 |
|
214 //Pointer to BackgroundInterface not owned so don't delete |
|
215 MCABackgroundInterface& iBackgroundInterface; |
|
216 |
|
217 //Owns. Pointer to CCAServerContactsarrayPC |
|
218 MCAServerContactsArrayPC* iBlockingArray; |
|
219 |
|
220 //Backgorund observer for ui to be notified of for |
|
221 //any background activites received from engine |
|
222 MCABlockingBackgroundObserverPC* iBackgroundObserver; |
|
223 |
|
224 |
|
225 }; |
|
226 #endif //end of CCABlockingPC |