|
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: Implements MCUIInfoIterator API for CCUIDetailsDialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_APPMNGR2INFOITERATOR_H |
|
20 #define C_APPMNGR2INFOITERATOR_H |
|
21 |
|
22 #include <CUIDetailsDialog.h> // SwiUI::CommonUI::MCUIInfoIterator |
|
23 |
|
24 class CAppMngr2InfoBase; |
|
25 class CDesC8Array; |
|
26 |
|
27 enum TAppMngr2InfoType |
|
28 { |
|
29 EAppMngr2StatusInstalled, |
|
30 EAppMngr2StatusNotInstalled |
|
31 }; |
|
32 |
|
33 |
|
34 /** |
|
35 * CAppMngr2InfoIterator is the base class for plug-in specific data collecting |
|
36 * iterators. CAppMngr2InfoIterator derived iterators can be used to get the data |
|
37 * shown in details dialog (CCUIDetailsDialog). Details dialog shows application |
|
38 * details and certificate info. |
|
39 * |
|
40 * @lib appmngr2pluginapi.lib |
|
41 * @since S60 v5.1 |
|
42 */ |
|
43 class CAppMngr2InfoIterator : public CBase, public SwiUI::CommonUI::MCUIInfoIterator |
|
44 { |
|
45 public: // constructors and destructor |
|
46 /** |
|
47 * Constructs new info iterator to show details dialog. |
|
48 * |
|
49 * @param aInfo Reference to application or package info object |
|
50 * @param aInfoType Type info (installed application or not installed package) |
|
51 */ |
|
52 IMPORT_C CAppMngr2InfoIterator( CAppMngr2InfoBase& aInfo, TAppMngr2InfoType aInfoType ); |
|
53 |
|
54 /** |
|
55 * Allocates memory for CDesCArrays. |
|
56 * |
|
57 * BaseConstructL() must be called from derived ConstructL() before any other |
|
58 * leaving functions. BaseConstructL() calls SetAllFieldsL() to get all the |
|
59 * displayable details. |
|
60 */ |
|
61 IMPORT_C void BaseConstructL(); |
|
62 |
|
63 /** |
|
64 * Destructor, deletes allocated memory. |
|
65 */ |
|
66 IMPORT_C ~CAppMngr2InfoIterator(); |
|
67 |
|
68 public: // from MCUIInfoIterator |
|
69 IMPORT_C TBool HasNext() const; |
|
70 IMPORT_C void Next( TPtrC& aKey, TPtrC& aValue ); |
|
71 IMPORT_C void Reset(); |
|
72 |
|
73 protected: // new functions |
|
74 /** |
|
75 * Sets field to given value. |
|
76 * |
|
77 * Uses StringLoader to load aResourceId and adds it to MCUIInfoIterator |
|
78 * as a new key having value aValue. |
|
79 * |
|
80 * @param aResourceId Resource id for MCUIInfoIterator key |
|
81 * @param aValue Value for the key |
|
82 */ |
|
83 IMPORT_C void SetFieldL( TInt aResourceId, const TDesC& aValue ); |
|
84 |
|
85 /** |
|
86 * Sets all default fields, can be overridden in derived classes. |
|
87 * |
|
88 * Default implementation sets name (from CAppMngr2InfoBase::Name()), |
|
89 * status (either installed or not installed), location drive (from |
|
90 * CAppMngr2InfoBase::Location()), and application/file size (from |
|
91 * CAppMngr2InfoBase::Details()). Status and location fields are set |
|
92 * using SetStatusL() and SetLocationL() functions, so that they can |
|
93 * be overridden separately. Finally calls SetOtherFieldsL() to set |
|
94 * other fields, if derived class has some additional fields that |
|
95 * are not covered here. |
|
96 */ |
|
97 IMPORT_C virtual void SetAllFieldsL(); |
|
98 |
|
99 /** |
|
100 * Sets status (installed or not installed) based on aInfoType |
|
101 * defined in constructor. This function can be overridden in |
|
102 * derived classes. |
|
103 */ |
|
104 IMPORT_C virtual void SetStatusL(); |
|
105 |
|
106 /** |
|
107 * Sets location drive based on CAppMngr2InfoBase::Location(). |
|
108 * This function can be overridden in derived classes. |
|
109 */ |
|
110 IMPORT_C virtual void SetLocationL(); |
|
111 |
|
112 /** |
|
113 * Sets other possble fields, default implemenation is empty. |
|
114 * This function can be overridden in derived classes. |
|
115 */ |
|
116 IMPORT_C virtual void SetOtherFieldsL(); |
|
117 |
|
118 protected: // data |
|
119 CAppMngr2InfoBase& iInfo; |
|
120 TAppMngr2InfoType iInfoType; |
|
121 TInt iCurrentIndex; |
|
122 CDesCArray* iKeys; |
|
123 CDesCArray* iValues; |
|
124 }; |
|
125 |
|
126 #endif // C_APPMNGR2INFOITERATOR_H |
|
127 |