|
1 /* |
|
2 * Copyright (c) 2005 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: Profile list container |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CNSMLDMSYNCPROFILELIST_H |
|
21 #define CNSMLDMSYNCPROFILELIST_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <e32base.h> |
|
26 #include "nsmldmsyncprofileitem.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TNSmlDMSyncProfileItem; |
|
30 class CNSmlDMSyncProfile; |
|
31 class CNSmlDMSyncAppEngine; |
|
32 |
|
33 /** |
|
34 * CNSmlDMSyncProfileList |
|
35 * |
|
36 * CNSmlDMSyncProfileList is a list of profiles |
|
37 */ |
|
38 NONSHARABLE_CLASS (CNSmlDMSyncProfileList) : public CBase |
|
39 { |
|
40 |
|
41 public: |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 */ |
|
45 static CNSmlDMSyncProfileList* NewL( CNSmlDMSyncAppEngine* aEngine ); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 virtual ~CNSmlDMSyncProfileList(); |
|
51 |
|
52 private: |
|
53 /** |
|
54 * C++ default constructor. |
|
55 */ |
|
56 CNSmlDMSyncProfileList( CNSmlDMSyncAppEngine* aEngine ); |
|
57 |
|
58 /** |
|
59 * By default Symbian 2nd phase constructor is private. |
|
60 */ |
|
61 void ConstructL(); |
|
62 |
|
63 public: |
|
64 /** |
|
65 * Returns profile count. |
|
66 * @return Profile count. |
|
67 */ |
|
68 TInt Count(); |
|
69 |
|
70 /** |
|
71 * Returns profile from list. |
|
72 * @param aIndex List index. |
|
73 * @return TNSmlDMSyncProfileItem. |
|
74 */ |
|
75 TNSmlDMSyncProfileItem Item( TInt aIndex ); |
|
76 |
|
77 /** |
|
78 * Finds profile with name aProfileName. |
|
79 * @param aProfileName Profile name. |
|
80 * @return Profile id or KErrNotFound. |
|
81 */ |
|
82 TInt FindProfile( const TDesC& aProfileName ); |
|
83 |
|
84 /** |
|
85 * Read one profile from database. |
|
86 * @param aProfile. |
|
87 * @return TNSmlDMSyncProfileItem. |
|
88 */ |
|
89 TNSmlDMSyncProfileItem ReadProfileItemL( CNSmlDMSyncProfile* aProfile ); |
|
90 |
|
91 /** |
|
92 * Reads all profiles from database. |
|
93 * @return None. |
|
94 */ |
|
95 void ReadProfileItemsL(); |
|
96 |
|
97 /** |
|
98 * Reads all profiles from database. |
|
99 * @param aIncludeHidden Should hidden profile be included |
|
100 * @return None. |
|
101 */ |
|
102 void ReadProfileItemsL( TBool aIncludeHidden ); |
|
103 |
|
104 /** |
|
105 * Reads one profile from database. |
|
106 * @param aIndex profile index |
|
107 * @return None. |
|
108 */ |
|
109 void ReadProfileItemL( TInt aIndex ); |
|
110 |
|
111 /** |
|
112 * Resets profile list. |
|
113 * @param None. |
|
114 * @return None. |
|
115 */ |
|
116 void Reset(); |
|
117 |
|
118 /** |
|
119 * Remove item from profilelist |
|
120 * @param aProfileId. |
|
121 * @return None. |
|
122 */ |
|
123 void Remove( TInt aProfileId ); |
|
124 |
|
125 /** |
|
126 * Checks that mandatory data exists. |
|
127 * @param aProfile. |
|
128 * @return Return code. |
|
129 */ |
|
130 static TInt CheckMandatoryDataL( CNSmlDMSyncProfile* aProfile ); |
|
131 |
|
132 /** |
|
133 * Replaces profile items |
|
134 * @param aProfileItem. |
|
135 * @return None. |
|
136 */ |
|
137 void ReplaceProfileItemL( TNSmlDMSyncProfileItem& aProfileItem ); |
|
138 |
|
139 /** |
|
140 * Sort list |
|
141 * @param None |
|
142 * @return None. |
|
143 */ |
|
144 void Sort(); |
|
145 |
|
146 private: |
|
147 |
|
148 /** |
|
149 * Chceks empty characters |
|
150 * @param aText |
|
151 * @return ETrue if text is empty |
|
152 */ |
|
153 static TBool IsEmpty( const TDesC& aText ); |
|
154 |
|
155 private: |
|
156 // Sync app engine |
|
157 CNSmlDMSyncAppEngine* iEngine; |
|
158 // list of profiles |
|
159 RArray<TNSmlDMSyncProfileItem> iList; |
|
160 }; |
|
161 |
|
162 #endif // CNSMLDMSYNCPROFILELIST_H |
|
163 |
|
164 // End of File |