|
1 /* |
|
2 * Copyright (c) 2002 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: Manager for all adapters. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CWPADAPTERMANAGER_H |
|
20 #define CWPADAPTERMANAGER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "MWPContextExtensionArray.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CWPAdapter; |
|
28 class MWPPairVisitor; |
|
29 class CWPRoot; |
|
30 class MWPContextManager; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * CWPAdapterManager owns and controls all adapters. |
|
36 * |
|
37 * @lib ProvisioningEngine |
|
38 * @since 2.0 |
|
39 */ |
|
40 class CWPAdapterManager : public CBase, public MWPContextExtensionArray |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 * @return Adapter manager |
|
46 */ |
|
47 static CWPAdapterManager* NewL(); |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * @return Adapter manager |
|
52 */ |
|
53 static CWPAdapterManager* NewLC(); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CWPAdapterManager(); |
|
59 |
|
60 public: // From MWPContextExtensionArray |
|
61 TInt MwpceCount() const; |
|
62 MWPContextExtension& MwpcePoint(TInt aIndex); |
|
63 |
|
64 public: // New methods |
|
65 |
|
66 /** |
|
67 * Populates adapters with a document. |
|
68 * @param aRoot The document root |
|
69 */ |
|
70 void PopulateL( CWPRoot& aRoot ); |
|
71 |
|
72 /** |
|
73 * Returns the number of settings items. |
|
74 * @return Number of saveable settings items |
|
75 */ |
|
76 TInt ItemCount() const; |
|
77 |
|
78 /** |
|
79 * Returns a summary title. |
|
80 * @param aIndex Number of the setting item to read |
|
81 * @return The summary title for the item |
|
82 */ |
|
83 const TDesC16& SummaryTitle(TInt aIndex) const; |
|
84 |
|
85 /** |
|
86 * Returns a summary text. |
|
87 * @param aIndex Number of the setting item to read |
|
88 * @return The summary text for the item |
|
89 */ |
|
90 const TDesC16& SummaryText(TInt aIndex) const; |
|
91 |
|
92 /** |
|
93 * Calls a visitor for each details line of a particular item. |
|
94 * @param aIndex The number of the item |
|
95 * @param aVisitor The visitor to call |
|
96 * @return KErrNotSupported if not supported |
|
97 */ |
|
98 TInt DetailsL(TInt aIndex, MWPPairVisitor& aVisitor); |
|
99 |
|
100 /** |
|
101 * Saves one setting. |
|
102 * @param aItem Setting number |
|
103 * @param aManager The context manager |
|
104 */ |
|
105 void SaveL( MWPContextManager& aManager, TInt aItem ); |
|
106 |
|
107 /** |
|
108 * Checks if the setting can be set as default. |
|
109 * @param aItem Setting number |
|
110 * @return ETrue if the setting can be set as default |
|
111 */ |
|
112 TBool CanSetAsDefault( TInt aItem ) const; |
|
113 |
|
114 /** |
|
115 * Sets the setting as default. |
|
116 * @param aItem Setting number |
|
117 */ |
|
118 void SetAsDefaultL( TInt aItem ); |
|
119 |
|
120 private: |
|
121 /** |
|
122 * Converts an item number into a pair of adapter and adapter local item number. |
|
123 * @param aItem Setting number |
|
124 * @param aAdapter Contains adapter number after the call |
|
125 * @param aAdapterIndex Contains adapter local item number after the call |
|
126 */ |
|
127 void ItemIndex( TInt aItem , TInt& aAdapter, TInt& aAdapterIndex ) const; |
|
128 |
|
129 protected: |
|
130 /** |
|
131 * C++ default constructor. |
|
132 */ |
|
133 CWPAdapterManager(); |
|
134 |
|
135 /** |
|
136 * By default Symbian 2nd phase constructor is private. |
|
137 */ |
|
138 void ConstructL(); |
|
139 |
|
140 protected: |
|
141 |
|
142 /// All adapters. Owns. |
|
143 CArrayPtr<CWPAdapter>* iAdapters; |
|
144 |
|
145 /// Setting item line indexes. Owns. |
|
146 RArray<TInt> iItemIndexes; |
|
147 |
|
148 /// Number of setting items. |
|
149 TInt iItemCount; |
|
150 }; |
|
151 |
|
152 #endif /* CWPADAPTERMANAGER_H */ |