|
1 /* |
|
2 * Copyright (c) 2007, 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WRHARVESTERREGISTRYACCESS_H |
|
20 #define WRHARVESTERREGISTRYACCESS_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <WidgetRegistryClient.h> |
|
24 #include <badesca.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CWidgetInfo; |
|
28 |
|
29 // CONSTANTS |
|
30 template < class T > class RWrtArray : public RPointerArray< T > |
|
31 { |
|
32 public: |
|
33 inline RWrtArray() : RPointerArray< T >() |
|
34 { |
|
35 }; |
|
36 inline void PushL() |
|
37 { |
|
38 TCleanupItem item( DoCleanup, this ); |
|
39 CleanupStack::PushL( item ); |
|
40 } |
|
41 |
|
42 inline void ResetAll() |
|
43 { |
|
44 for ( TInt i( this->Count() - 1 ); i >= 0; --i ) |
|
45 { |
|
46 delete (*this)[ i ]; |
|
47 } |
|
48 this->Close(); |
|
49 } |
|
50 |
|
51 private: |
|
52 static void DoCleanup( TAny* aPtr ) |
|
53 { |
|
54 __ASSERT_DEBUG( aPtr, User::Invariant() ); |
|
55 RWrtArray< T >* ptr( reinterpret_cast< RWrtArray< T >* >( aPtr ) ); |
|
56 for ( TInt i( ptr->Count() - 1 ); i >= 0; --i ) |
|
57 { |
|
58 delete ( *ptr )[ i ]; |
|
59 } |
|
60 ptr->Close(); |
|
61 } |
|
62 }; |
|
63 |
|
64 // CLASS DECLARATION |
|
65 |
|
66 /** |
|
67 * Widget Register accessor. |
|
68 * |
|
69 * Handles communication & widget bookkeeping of miniview-capable widgets. |
|
70 * |
|
71 * @lib wrtharvester.dll |
|
72 * @since S60 S60 v5.0 |
|
73 */ |
|
74 class WrtHarvesterRegistryAccess |
|
75 { |
|
76 public: |
|
77 /** |
|
78 * Default constructor. |
|
79 */ |
|
80 WrtHarvesterRegistryAccess(); |
|
81 |
|
82 /** |
|
83 * Destructor. |
|
84 */ |
|
85 ~WrtHarvesterRegistryAccess(); |
|
86 |
|
87 /** |
|
88 * Get widget bundle names for widgets supporting miniviews. |
|
89 * |
|
90 * NOTE: Ownership of pointers in the array is not transferred! |
|
91 * Caller must not delete them. |
|
92 * |
|
93 * @param aArray Array where the descriptor pointers are to be stored. |
|
94 */ |
|
95 void WidgetBundleNamesL( RPointerArray< HBufC >& aArray ); |
|
96 |
|
97 /** |
|
98 * Get widget uid. |
|
99 * |
|
100 * @param aBundleName Name of the widget |
|
101 * @return TUid of the widget. |
|
102 */ |
|
103 TUid WidgetUid( TPtrC aBundleName ); |
|
104 |
|
105 private: |
|
106 /** |
|
107 * Check if the widget support miniview. |
|
108 * |
|
109 * @param aSession Widget registry session |
|
110 * @param aUid UID of widget. |
|
111 * @return Yes or no. |
|
112 */ |
|
113 TBool SupportsMiniviewL( RWidgetRegistryClientSession& aSession, const TUid& aUid ); |
|
114 |
|
115 /** |
|
116 * Returns the Bundle identifier for the given widget. Ownership transfered. |
|
117 * |
|
118 * @param aSession Widget registry session |
|
119 * @param aUid UID of widget. |
|
120 * @return Identifier in a descriptor. |
|
121 */ |
|
122 HBufC* ConstructWidgetNameL( RWidgetRegistryClientSession& aSession, CWidgetInfo& aInfo ); |
|
123 |
|
124 private: // data |
|
125 /** |
|
126 * |
|
127 */ |
|
128 RWrtArray< CWidgetInfo > iWidgetInfoArray; |
|
129 }; |
|
130 |
|
131 #endif // WRHARVESTERREGISTRYACCESS_H |