|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Phonebook 2 server application contact store manager. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2SERVERAPPSTOREMANAGER_H |
|
20 #define CPBK2SERVERAPPSTOREMANAGER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MVPbkContactViewObserver.h> |
|
25 #include <VPbkContactView.hrh> |
|
26 #include <MVPbkContactStoreObserver.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CPbk2ServerAppMonitor; |
|
30 class CVPbkContactStoreUriArray; |
|
31 class MVPbkContactViewBase; |
|
32 class CPbk2StoreManager; |
|
33 class CVPbkFieldTypeSelector; |
|
34 class CVPbkContactManager; |
|
35 class MPbk2ServerAppStartupObserver; |
|
36 class CPbk2StorePropertyArray; |
|
37 class CPbk2SortOrderManager; |
|
38 class MVPbkStoreContact; |
|
39 class CPbk2StoreConfiguration; |
|
40 class CVPbkSortOrderAcquirer; |
|
41 class MVPbkContactLinkArray; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * Phonebook 2 server application contact store manager. |
|
47 */ |
|
48 class CPbk2ServerAppStoreManager : public CBase, |
|
49 public MVPbkContactViewObserver, |
|
50 public MVPbkContactStoreObserver |
|
51 { |
|
52 public: // Construction and destruction |
|
53 |
|
54 /** |
|
55 * Creates a new instance of this class. |
|
56 * |
|
57 * @param aStoreManager Contact store manager. |
|
58 * @param aContactManager Virtual Phonebook contact manager. |
|
59 * @return A new instance of this class. |
|
60 */ |
|
61 static CPbk2ServerAppStoreManager* NewL( |
|
62 CPbk2StoreManager& aStoreManager, |
|
63 CVPbkContactManager& aContactManager ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~CPbk2ServerAppStoreManager(); |
|
69 |
|
70 public: // Interface |
|
71 |
|
72 /** |
|
73 * Loads and opens given contact stores. |
|
74 * |
|
75 * @param aStoreUris The URIs of the stores to open. |
|
76 * @param aObserver Start-up observer. |
|
77 * @param aLoadSavingMemoriesAlways If Etrue default saving memory and |
|
78 * backup saving memory are loaded and |
|
79 * opened always. |
|
80 */ |
|
81 void LoadAndOpenContactStoresL( |
|
82 CVPbkContactStoreUriArray& aStoreUris, |
|
83 MPbk2ServerAppStartupObserver& aObserver, |
|
84 TBool aLoadSavingMemoriesAlways ); |
|
85 |
|
86 /** |
|
87 * Builds a contact view to be used in the fetch phase. |
|
88 * |
|
89 * @param aViewType View type, only group and |
|
90 * contacts types are supported. |
|
91 * @param aStoreUris URIs of the stores to include |
|
92 * in the view. |
|
93 * @param aViewFilter Contact view filter. |
|
94 * @param aStoreProperties Phonebook contact store properties. |
|
95 * @param aSortOrderManager Sort order manager. |
|
96 * @param aFlags Contact view flags |
|
97 * @see TVPbkContactViewFlag |
|
98 * @return Contact view. |
|
99 */ |
|
100 MVPbkContactViewBase* BuildFetchViewL( |
|
101 TVPbkContactViewType aViewType, |
|
102 const CVPbkContactStoreUriArray& aStoreUris, |
|
103 CVPbkFieldTypeSelector* aViewFilter, |
|
104 CPbk2StorePropertyArray& aStoreProperties, |
|
105 const CPbk2SortOrderManager& aSortOrderManager, |
|
106 const TUint32 aFlags ); |
|
107 |
|
108 /** |
|
109 * Removes read-only stores from the given store URI list. |
|
110 * |
|
111 * @param aStoreUriArray Store URI array to operate with. |
|
112 * @param aStoreProperties Phonebook store properties. |
|
113 */ |
|
114 void RemoveReadOnlyStoreUris( |
|
115 CVPbkContactStoreUriArray& aStoreUriArray, |
|
116 CPbk2StorePropertyArray& aStoreProperties ) const; |
|
117 |
|
118 /** |
|
119 * Checks whether the given contact is included in the |
|
120 * current configuration. |
|
121 * |
|
122 * @param aContact The contact to inspect. |
|
123 * @param aStoreConfiguration Phonebook store configuration. |
|
124 * @return ETrue if contact belongs to the configuration. |
|
125 */ |
|
126 TBool IsContactIncludedInCurrentConfigurationL( |
|
127 const MVPbkStoreContact& aContact, |
|
128 const CPbk2StoreConfiguration& aStoreConfiguration ) const; |
|
129 |
|
130 /** |
|
131 * Checks are given contacts from stores that are available. |
|
132 * |
|
133 * @param aContactLinks Contacts whose stores to inspect. |
|
134 * @return EFalse if any of the store that was |
|
135 * inspected is unavailable. |
|
136 */ |
|
137 TBool ContactsAvailableL( |
|
138 const MVPbkContactLinkArray& aContactLinks ) const; |
|
139 |
|
140 /** |
|
141 * Returns currently valid stores. |
|
142 * |
|
143 * @return Currently valid stores. |
|
144 */ |
|
145 CVPbkContactStoreUriArray* CurrentlyValidStoresL() const; |
|
146 |
|
147 private: // From MVPbkContactViewObserver |
|
148 void ContactViewReady( |
|
149 MVPbkContactViewBase& aView ); |
|
150 void ContactViewUnavailable( |
|
151 MVPbkContactViewBase& aView ); |
|
152 void ContactAddedToView( |
|
153 MVPbkContactViewBase& aView, |
|
154 TInt aIndex, |
|
155 const MVPbkContactLink& aContactLink ); |
|
156 void ContactRemovedFromView( |
|
157 MVPbkContactViewBase& aView, |
|
158 TInt aIndex, |
|
159 const MVPbkContactLink& aContactLink ); |
|
160 void ContactViewError( |
|
161 MVPbkContactViewBase& aView, |
|
162 TInt aError, |
|
163 TBool aErrorNotified ); |
|
164 |
|
165 private: // From MVPbkContactStoreObserver |
|
166 void StoreReady( |
|
167 MVPbkContactStore& aContactStore ); |
|
168 void StoreUnavailable( |
|
169 MVPbkContactStore& aContactStore, |
|
170 TInt aReason ); |
|
171 void HandleStoreEventL( |
|
172 MVPbkContactStore& aContactStore, |
|
173 TVPbkContactStoreEvent aEvent ); |
|
174 |
|
175 private: // Implementation |
|
176 CPbk2ServerAppStoreManager( |
|
177 CPbk2StoreManager& aStoreManager, |
|
178 CVPbkContactManager& aContactManager ); |
|
179 void ConstructL(); |
|
180 |
|
181 private: // Data |
|
182 /// Ref: Store manager |
|
183 CPbk2StoreManager& iStoreManager; |
|
184 /// Ref: Virtual Phonebook contact manager |
|
185 CVPbkContactManager& iContactManager; |
|
186 /// Own: Server app monitor |
|
187 CPbk2ServerAppMonitor* iMonitor; |
|
188 /// Own: View for fetch names list |
|
189 MVPbkContactViewBase* iFetchView; |
|
190 /// Own: Sort order aquirerer for group extension |
|
191 CVPbkSortOrderAcquirer* iSortOrderAcquirer; |
|
192 /// Ref: list of opened contact stores |
|
193 RPointerArray<MVPbkContactStore> iOpenedStores; |
|
194 }; |
|
195 |
|
196 #endif // CPBK2SERVERAPPSTOREMANAGER_H |
|
197 |
|
198 // End of File |