|
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: DM Idle SoftKey Adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __NSMLISADAPTER_H__ |
|
21 #define __NSMLISADAPTER_H__ |
|
22 |
|
23 #define IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
24 |
|
25 #define IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
26 |
|
27 // tarm |
|
28 #include "TARMDmStreamAdapter.h" |
|
29 |
|
30 #include "IdleSoftkeysWebTargetManager.h" |
|
31 #include "centralrepository.h" |
|
32 |
|
33 |
|
34 //_LIT( KBrowserBookmarks, "BrowserBookmarks" ); |
|
35 |
|
36 class CIdleSoftkeysWebTargetManager; |
|
37 class CIdleSoftkeysAppTargetManager; |
|
38 class CUiSettingsUtil; |
|
39 |
|
40 // ------------------------------------------------------------------------------------------------ |
|
41 // CIsAdapter |
|
42 // ------------------------------------------------------------------------------------------------ |
|
43 class CIsAdapter : public CTARMDmStreamAdapter |
|
44 { |
|
45 private: |
|
46 enum TIsNodeIdentifier |
|
47 { |
|
48 EIsNodeCustomization = 0, |
|
49 EIsNodeIdleSoftkeys, |
|
50 EIsNodeSoftKeys, |
|
51 EIsNodeTargets, |
|
52 EIsNodeWebTargets, |
|
53 EIsNodeSoftKeysX, |
|
54 EIsNodeTargetsX, |
|
55 EIsNodeWebTargetsX, |
|
56 EIsNodeSoftKeysXID, |
|
57 EIsNodeSoftKeysXTargetRef, |
|
58 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
59 EIsNodeSoftKeysXImage, |
|
60 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
61 EIsNodeSoftKeysXMask, |
|
62 #endif |
|
63 #endif |
|
64 EIsNodeTargetsXID, |
|
65 EIsNodeTargetsXDescription, |
|
66 EIsNodeTargetsXCaption, |
|
67 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
68 EIsNodeTargetsXImage, |
|
69 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
70 EIsNodeTargetsXImageMask, |
|
71 #endif |
|
72 #endif |
|
73 EIsNodeWebTargetsXID, |
|
74 EIsNodeWebTargetsXDescription, |
|
75 EIsNodeWebTargetsXURL, |
|
76 EIsNodeWebTargetsXUserName, |
|
77 EIsNodeWebTargetsXPassword, |
|
78 EIsNodeWebTargetsXConRef, |
|
79 EIsNodeWebTargetsXCaption, |
|
80 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
81 EIsNodeWebTargetsXImage, |
|
82 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
83 EIsNodeWebTargetsXImageMask, |
|
84 #endif |
|
85 #endif |
|
86 EIsNodeNotUsedAndAlwaysLast |
|
87 }; |
|
88 |
|
89 public: |
|
90 CIsAdapter(TAny* aEcomArguments); |
|
91 |
|
92 static CIsAdapter* NewL(MSmlDmCallback* aDmCallback ); |
|
93 static CIsAdapter* NewLC(MSmlDmCallback* aDmCallback ); |
|
94 |
|
95 virtual ~CIsAdapter(); |
|
96 |
|
97 // Pure virtual methods |
|
98 // From CSmlDmAdapter |
|
99 void DDFVersionL ( CBufBase& aVersion ); |
|
100 void DDFStructureL ( MSmlDmDDFObject& aDDF ); |
|
101 |
|
102 void UpdateLeafObjectL ( CSmlDmAdapter::TError &aStatus, |
|
103 const TDesC8& aURI, const TDesC8& aLUID, |
|
104 const TDesC8& aObject, const TDesC8& aType ); |
|
105 void DeleteObjectL ( CSmlDmAdapter::TError &aStatus, const TDesC8& aURI, |
|
106 const TDesC8& aLUID ); |
|
107 CSmlDmAdapter::TError |
|
108 FetchLeafObjectL ( const TDesC8& aURI, const TDesC8& aLUID, |
|
109 TDes8& aNewMime, CBufFlat& object ); |
|
110 void AddNodeObjectL ( CSmlDmAdapter::TError &aStatus, const TDesC8& aURI, |
|
111 const TDesC8& aParentLUID ); |
|
112 |
|
113 void _UpdateLeafObjectL ( const TDesC8& aURI, const TDesC8& aLUID, |
|
114 const TDesC8& aObject, const TDesC8& aType, TInt aStatusRef ); |
|
115 void _UpdateLeafObjectL ( const TDesC8& aURI, const TDesC8& aLUID, RWriteStream*& aStream, |
|
116 const TDesC8& aType, TInt aStatusRef ); |
|
117 void _DeleteObjectL ( const TDesC8& aURI, const TDesC8& aLUID, TInt aStatusRef ); |
|
118 void _FetchLeafObjectL ( const TDesC8& aURI, const TDesC8& aLUID, |
|
119 const TDesC8& aType, TInt aResultsRef, TInt aStatusRef ); |
|
120 void _FetchLeafObjectSizeL ( const TDesC8& aURI, const TDesC8& aLUID, |
|
121 const TDesC8& aType, TInt aResultsRef, TInt aStatusRef ); |
|
122 void _ChildURIListL ( const TDesC8& aURI, const TDesC8& aLUID, |
|
123 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
124 TInt aResultsRef, TInt aStatusRef ); |
|
125 void _AddNodeObjectL ( const TDesC8& aURI, const TDesC8& aParentLUID, TInt aStatusRef ); |
|
126 void _ExecuteCommandL ( const TDesC8& aURI, const TDesC8& aLUID, |
|
127 const TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef ); |
|
128 void _ExecuteCommandL ( const TDesC8& aURI, const TDesC8& aLUID, |
|
129 RWriteStream*& aStream, const TDesC8& aType, TInt aStatusRef ); |
|
130 void _CopyCommandL ( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, |
|
131 const TDesC8& aSourceURI, const TDesC8& aSourceLUID, |
|
132 const TDesC8& aType, TInt aStatusRef ); |
|
133 void StartAtomicL ( ); |
|
134 void CommitAtomicL ( ); |
|
135 void RollbackAtomicL ( ); |
|
136 TAdapterStreamType StreamType ( const TDesC8& aURI ); |
|
137 TBool StreamingSupport ( TInt& aItemSize ); |
|
138 void CompleteOutstandingCmdsL ( ); |
|
139 |
|
140 private: |
|
141 void ConstructL(MSmlDmCallback* aDmCallback); |
|
142 |
|
143 // |
|
144 // DDF methods |
|
145 // |
|
146 void FillNodeInfoL( MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes, |
|
147 MSmlDmDDFObject::TOccurence aOccurrence, |
|
148 MSmlDmDDFObject::TScope aScope, |
|
149 MSmlDmDDFObject::TDFFormat aFormat, |
|
150 const TDesC8& aDescription, |
|
151 const TDesC8& aMimeType); |
|
152 |
|
153 // |
|
154 // URI & argument handling |
|
155 // |
|
156 void CopyAndTrimMimeType (TDes8& aNewMime, const TDesC8& aType); |
|
157 |
|
158 TIsNodeIdentifier |
|
159 GetNodeIdentifier (const TDesC8& aURI); |
|
160 |
|
161 // |
|
162 // Softkeys |
|
163 // |
|
164 TInt ListSoftkeysL ( CBufFlat &aList ); |
|
165 |
|
166 TInt GetSoftkeyUidFromNodeNameL ( const TDesC8& aNodeName ); |
|
167 |
|
168 HBufC8* GenerateSoftkeyNodeNameL ( TInt aIndex ); |
|
169 |
|
170 TInt GetSoftkeyIndexFromUid ( TInt aUid ); |
|
171 |
|
172 void AddShortcutNameL ( CBufFlat& aBuffer, |
|
173 TInt aUid ); |
|
174 |
|
175 void SetShortcutTargetL ( const TDesC8& aURI, TInt aUid ); |
|
176 |
|
177 // |
|
178 // Common for targets |
|
179 // |
|
180 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
181 void GetSoftkeyImageL ( TInt aSoftkeyUid, CBufFlat &aImageBuffer, TBool aGetMask=EFalse ); |
|
182 #endif |
|
183 |
|
184 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
185 void GetApplicationImageL ( |
|
186 TInt aIndex, |
|
187 CBufFlat &aImageBuffer, |
|
188 TBool aGetMask=EFalse |
|
189 ); |
|
190 |
|
191 void GetBookmarkImageL ( |
|
192 TInt aIndex, |
|
193 CBufFlat &aImageBuffer, |
|
194 TBool aGetMask=EFalse |
|
195 ); |
|
196 |
|
197 void GetShortcutImageL ( |
|
198 TInt aRtMask, |
|
199 TInt aIndex, |
|
200 CBufFlat &aImageBuffer, |
|
201 TBool aGetMask=EFalse |
|
202 ); |
|
203 |
|
204 #endif |
|
205 |
|
206 // |
|
207 // Other |
|
208 // |
|
209 CSmlDmAdapter::TError GetShortcutTargetURIL ( |
|
210 CBufFlat& aBuffer, |
|
211 TInt aUid |
|
212 ); |
|
213 |
|
214 HBufC16* CreateCopy16LC ( const TDesC8& aText ); |
|
215 |
|
216 //#ifdef __SAP_POLICY_MANAGEMENT |
|
217 TPtrC8 PolicyRequestResourceL ( const TDesC8& aURI ); |
|
218 //#endif |
|
219 |
|
220 // |
|
221 // Image handling |
|
222 // |
|
223 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
224 void SetSoftkeyImageL ( const TDesC8& aURI, |
|
225 const TDesC8& aObject, |
|
226 const TDesC8& aType); |
|
227 #endif |
|
228 |
|
229 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
230 void SetShortcutTargetImageL ( const TDesC8& aURI, |
|
231 const TDesC8& aObject, |
|
232 const TDesC8& aType); |
|
233 #endif |
|
234 |
|
235 TInt DecodeImageToFileL ( const TDesC8& aObject ); |
|
236 |
|
237 void DecodeImageL ( CBufFlat& aBuffer, const TDesC8& aObject ); |
|
238 |
|
239 void EncodeImageL ( CBufFlat& aBuffer, const TDesC8& aObject ); |
|
240 |
|
241 private: |
|
242 TFileName iTemporaryImageFile; |
|
243 static const TInt iSoftkeyList[]; |
|
244 TBool iUiSettingsNotInitialized; |
|
245 |
|
246 RFs iFs; |
|
247 RFavouritesSession iFavSession; |
|
248 RFavouritesDb iFavDb; |
|
249 |
|
250 MSmlDmCallback* iCallBack; |
|
251 CFavouritesItemList* iFavList; |
|
252 |
|
253 CIdleSoftkeysWebTargetManager *iWebTargetManager; |
|
254 CIdleSoftkeysAppTargetManager *iAppTargetManager; |
|
255 CUiSettingsUtil *iUiSettings; |
|
256 }; |
|
257 |
|
258 #endif // __NSMLISADAPTER_H__ |