|
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 #include "isadapter.h" |
|
20 |
|
21 #include "IsAdapterDefines.h" |
|
22 #include "IsAdapterLiterals.h" |
|
23 #include "IdleSoftkeysAppTargetManager.h" |
|
24 #include "UiSettingsUtil.h" |
|
25 |
|
26 // symbian |
|
27 #include <implementationproxy.h> |
|
28 #include <centralrepository.h> |
|
29 #include <imcvcodc.h> |
|
30 // s60 |
|
31 #include <FavouritesItemList.h> |
|
32 |
|
33 // tarm |
|
34 //#ifdef __SAP_POLICY_MANAGEMENT |
|
35 #include <SettingEnforcementInfo.h> |
|
36 #include <PolicyEngineXACML.h> |
|
37 #include <DMCert.h> |
|
38 //#endif |
|
39 |
|
40 //#include "UISettingsSrvConstants.h" |
|
41 #include "IsAdapterConstants.h" |
|
42 #include "nsmldmiapmatcher.h" |
|
43 #include "nsmldmuri.h" |
|
44 #include "TPtrC8I.h" |
|
45 #include "TARMCharConv.h" |
|
46 #include "FileCoderB64.h" |
|
47 #include "debug.h" |
|
48 #include <featmgr.h> |
|
49 // ------------------------------------------------------------------------------------------------ |
|
50 // CIsAdapter* CIsAdapter::NewL( ) |
|
51 // ------------------------------------------------------------------------------------------------ |
|
52 CIsAdapter* CIsAdapter::NewL(MSmlDmCallback* aDmCallback ) |
|
53 { |
|
54 RDEBUG( "CIsAdapter::NewL() >" ); |
|
55 CIsAdapter* self = NewLC( aDmCallback ); |
|
56 CleanupStack::Pop(); |
|
57 RDEBUG( "CIsAdapter::NewL() <" ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ------------------------------------------------------------------------------------------------ |
|
62 // CIsAdapter* CIsAdapter::NewLC( ) |
|
63 // ------------------------------------------------------------------------------------------------ |
|
64 CIsAdapter* CIsAdapter::NewLC(MSmlDmCallback* aDmCallback ) |
|
65 { |
|
66 RDEBUG( "CIsAdapter::NewLC() >" ); |
|
67 CIsAdapter* self = new (ELeave) CIsAdapter(aDmCallback); |
|
68 CleanupStack::PushL(self); |
|
69 self->ConstructL(aDmCallback); |
|
70 RDEBUG( "CIsAdapter::NewLC() <" ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 // ------------------------------------------------------------------------------------------------ |
|
75 // CIsAdapter::CIsAdapter() |
|
76 // ------------------------------------------------------------------------------------------------ |
|
77 CIsAdapter::CIsAdapter(TAny* aEcomArguments) |
|
78 : CTARMDmStreamAdapter((MSmlDmCallback*)aEcomArguments) |
|
79 , iFavList(0) |
|
80 , iWebTargetManager(0) |
|
81 , iAppTargetManager(0) |
|
82 , iUiSettings(0) |
|
83 { |
|
84 RDEBUG( "CIsAdapter::CIsAdapter()" ); |
|
85 iUiSettingsNotInitialized = ETrue; |
|
86 } |
|
87 |
|
88 // ------------------------------------------------------------------------------------------------ |
|
89 // CIsAdapter::~CIsAdapter() |
|
90 // ------------------------------------------------------------------------------------------------ |
|
91 CIsAdapter::~CIsAdapter() |
|
92 { |
|
93 RDEBUG( "CIsAdapter::~CIsAdapter() >" ); |
|
94 FeatureManager::UnInitializeLib(); |
|
95 delete iWebTargetManager; |
|
96 delete iAppTargetManager; |
|
97 delete iUiSettings; |
|
98 |
|
99 iFavDb.Close(); |
|
100 iFavSession.Close(); |
|
101 |
|
102 if( iFavList != 0 ) |
|
103 { |
|
104 delete iFavList; |
|
105 iFavList = 0; |
|
106 } |
|
107 |
|
108 if( iTemporaryImageFile.Length() > 0 ) |
|
109 { |
|
110 RDEBUG( "CIsAdapter::~CIsAdapter() Deleting temporary file" ); |
|
111 RFs fs; |
|
112 TInt err = fs.Connect(); |
|
113 if( err == KErrNone ) |
|
114 { |
|
115 fs.Delete( iTemporaryImageFile ); |
|
116 fs.Close(); |
|
117 iTemporaryImageFile.Zero(); |
|
118 } |
|
119 } |
|
120 |
|
121 RDEBUG( "CIsAdapter::~CIsAdapter() <" ); |
|
122 } |
|
123 |
|
124 |
|
125 |
|
126 // ------------------------------------------------------------------------------------------------ |
|
127 // CIsAdapter::DDFVersionL() |
|
128 // ------------------------------------------------------------------------------------------------ |
|
129 void CIsAdapter::DDFVersionL(CBufBase& aDDFVersion) |
|
130 { |
|
131 RDEBUG( "CIsAdapter::DDFVersionL() >" ); |
|
132 |
|
133 aDDFVersion.InsertL(0,KNSmlISDDFVersion); |
|
134 |
|
135 RDEBUG( "CIsAdapter::DDFVersionL() <" ); |
|
136 } |
|
137 |
|
138 // ------------------------------------------------------------------------------------------------ |
|
139 // CIsAdapter::DDFStructureL() |
|
140 // ------------------------------------------------------------------------------------------------ |
|
141 void CIsAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) |
|
142 { |
|
143 RDEBUG( "CIsAdapter::DDFStructureL() >" ); |
|
144 |
|
145 TSmlDmAccessTypes accessTypesGet; |
|
146 accessTypesGet.SetGet(); |
|
147 |
|
148 TSmlDmAccessTypes accessTypesAddGet; |
|
149 accessTypesAddGet.SetAdd(); |
|
150 accessTypesAddGet.SetGet(); |
|
151 |
|
152 TSmlDmAccessTypes accessTypesGetReplace; |
|
153 accessTypesGetReplace.SetGet(); |
|
154 accessTypesGetReplace.SetReplace(); |
|
155 |
|
156 TSmlDmAccessTypes accessTypesADGR; |
|
157 accessTypesADGR.SetAdd(); |
|
158 accessTypesADGR.SetDelete(); |
|
159 accessTypesADGR.SetGet(); |
|
160 accessTypesADGR.SetReplace(); |
|
161 |
|
162 /* |
|
163 Node: ./Customzation |
|
164 This interior node is the common parent to all customization.. |
|
165 Status: Required |
|
166 Occurs: One |
|
167 Format: Node |
|
168 Access Types: Get |
|
169 Values: N/A |
|
170 */ |
|
171 MSmlDmDDFObject& apps = aDDF.AddChildObjectL(KNSmlCustomizationNodeName); |
|
172 FillNodeInfoL(apps,accessTypesGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent,MSmlDmDDFObject::ENode, |
|
173 KNSmlISDescription,KNullDesC8()); |
|
174 |
|
175 /* |
|
176 Node: ./Customization/IdleSoftKey |
|
177 This interior node acts as a placeholder for one or more update packages within a same content provider group. |
|
178 Status: Required |
|
179 Occurs: One |
|
180 Format: Node |
|
181 Access Types: Get |
|
182 Values: N/A |
|
183 */ |
|
184 MSmlDmDDFObject& groupNode = apps.AddChildObjectL(KNSmlIS_IdleSoftKeyNodeName); |
|
185 FillNodeInfoL(groupNode,accessTypesGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
186 MSmlDmDDFObject::ENode,KNSmlISIdleSoftKeyNodeDescription,KNullDesC8()); |
|
187 |
|
188 // IdleSoftkeys/* |
|
189 MSmlDmDDFObject& groupNodeSoftkeys = groupNode.AddChildObjectL(KNSmlIS_SoftKeysNodeName); |
|
190 FillNodeInfoL(groupNodeSoftkeys,accessTypesGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
191 MSmlDmDDFObject::ENode,KNSmlISSoftkeysNodeDescription,KNullDesC8()); |
|
192 |
|
193 MSmlDmDDFObject& groupNodeTargets = groupNode.AddChildObjectL(KNSmlIS_TargetsNodeName); |
|
194 FillNodeInfoL(groupNodeTargets,accessTypesGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
195 MSmlDmDDFObject::ENode,KNSmlISTargetsNodeDescription,KNullDesC8()); |
|
196 |
|
197 MSmlDmDDFObject& groupNodeWebTargets = groupNode.AddChildObjectL(KNSmlIS_WebTargetsNodeName); |
|
198 FillNodeInfoL(groupNodeWebTargets,accessTypesAddGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
199 MSmlDmDDFObject::ENode,KNSmlISWebTargetsNodeDescription,KNullDesC8()); |
|
200 |
|
201 // Dynamic node lists, IdleSoftkeys/*/X |
|
202 MSmlDmDDFObject& groupNodeSoftkeysX = groupNodeSoftkeys.AddChildObjectGroupL(); |
|
203 FillNodeInfoL(groupNodeSoftkeysX,accessTypesGet,MSmlDmDDFObject::EOneOrMore,MSmlDmDDFObject::EDynamic, |
|
204 MSmlDmDDFObject::ENode,KNSmlISSoftkeysXNodeDescription,KNullDesC8()); |
|
205 |
|
206 MSmlDmDDFObject& groupNodeTargetsX = groupNodeTargets.AddChildObjectGroupL(); |
|
207 FillNodeInfoL(groupNodeTargetsX,accessTypesGet,MSmlDmDDFObject::EZeroOrMore,MSmlDmDDFObject::EDynamic, |
|
208 MSmlDmDDFObject::ENode,KNSmlISTargetsXNodeDescription,KNullDesC8()); |
|
209 |
|
210 MSmlDmDDFObject& groupNodeWebTargetsX = groupNodeWebTargets.AddChildObjectGroupL(); |
|
211 FillNodeInfoL(groupNodeWebTargetsX,accessTypesADGR,MSmlDmDDFObject::EZeroOrMore,MSmlDmDDFObject::EDynamic, |
|
212 MSmlDmDDFObject::ENode,KNSmlISWebTargetsXNodeDescription,KNullDesC8()); |
|
213 |
|
214 // Softkeys/X/* |
|
215 MSmlDmDDFObject& sId = groupNodeSoftkeysX.AddChildObjectL(KNSmlIS_SoftkeysIDNodeName); |
|
216 FillNodeInfoL(sId,accessTypesGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
217 MSmlDmDDFObject::EChr,KNSmlIS_SoftkeysIDDescription,KNSmlISTextPlain()); |
|
218 MSmlDmDDFObject& sRef = groupNodeSoftkeysX.AddChildObjectL(KNSmlIS_SoftkeysTargetRefNodeName); |
|
219 FillNodeInfoL(sRef,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
220 MSmlDmDDFObject::EChr,KNSmlIS_SoftkeysTargetRefDescription,KNSmlISTextPlain()); |
|
221 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
222 MSmlDmDDFObject& sImage = groupNodeSoftkeysX.AddChildObjectL(KNSmlIS_SoftkeysImageNoneName); |
|
223 FillNodeInfoL(sImage,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
224 MSmlDmDDFObject::EBin,KNSmlIS_SoftkeysImageDescription,KMimeTypeImageMbm()); |
|
225 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
226 MSmlDmDDFObject& sImageMask = groupNodeSoftkeysX.AddChildObjectL(KNSmlIS_SoftkeysMaskNodeName); |
|
227 FillNodeInfoL(sImageMask,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
228 MSmlDmDDFObject::EBin,KNSmlIS_SoftkeysMaskDescription,KMimeTypeImageMbm()); |
|
229 #endif |
|
230 #endif |
|
231 // Targets/X/* |
|
232 MSmlDmDDFObject& tId = groupNodeTargetsX.AddChildObjectL(KNSmlIS_TargetsIDNodeName); |
|
233 FillNodeInfoL(tId,accessTypesGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
234 MSmlDmDDFObject::EChr,KNSmlIS_TargetsIDDescription,KNSmlISTextPlain()); |
|
235 |
|
236 MSmlDmDDFObject& tDesc = groupNodeTargetsX.AddChildObjectL(KNSmlIS_TargetsDescriptionNodeName); |
|
237 FillNodeInfoL(tDesc,accessTypesGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
238 MSmlDmDDFObject::EChr,KNSmlIS_TargetsDescriptionDescription,KNSmlISTextPlain()); |
|
239 |
|
240 MSmlDmDDFObject& tCaption = groupNodeTargetsX.AddChildObjectL(KNSmlIS_TargetsCaptionName); |
|
241 FillNodeInfoL(tCaption,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
242 MSmlDmDDFObject::EChr,KNSmlIS_TargetsCaptionDescription,KNSmlISTextPlain()); |
|
243 |
|
244 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
245 MSmlDmDDFObject& tImage = groupNodeTargetsX.AddChildObjectL(KNSmlIS_TargetsImageNodeName); |
|
246 FillNodeInfoL(tImage,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
247 MSmlDmDDFObject::EBin,KNSmlIS_TargetsImageDescription,KMimeTypeImageMbm()); |
|
248 |
|
249 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
250 MSmlDmDDFObject& tImageMask = groupNodeTargetsX.AddChildObjectL(KNSmlIS_TargetsMaskNodeName); |
|
251 FillNodeInfoL(tImageMask,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
252 MSmlDmDDFObject::EBin,KNSmlIS_TargetsMaskDescription,KMimeTypeImageMbm()); |
|
253 #endif |
|
254 #endif |
|
255 |
|
256 // WebTargets/X/* |
|
257 MSmlDmDDFObject& wId = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsIDNodeName); |
|
258 FillNodeInfoL(wId,accessTypesGet,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
259 MSmlDmDDFObject::EChr,KNSmlIS_WebTargetsIDDescription,KNSmlISTextPlain()); |
|
260 |
|
261 MSmlDmDDFObject& wDesc = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsDescriptionNodeName); |
|
262 FillNodeInfoL(wDesc,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
263 MSmlDmDDFObject::EChr,KNSmlIS_WebTargetsDescriptionDescription,KNSmlISTextPlain()); |
|
264 |
|
265 MSmlDmDDFObject& wURL = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsURLNodeName); |
|
266 FillNodeInfoL(wURL,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
267 MSmlDmDDFObject::EChr,KNSmlIS_WebTargetsURLDescription,KNSmlISTextPlain()); |
|
268 |
|
269 MSmlDmDDFObject& wUserName = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsUserNameNodeName); |
|
270 FillNodeInfoL(wUserName,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
271 MSmlDmDDFObject::EChr,KNSmlIS_WebTargetsUserNameDescription,KNSmlISTextPlain()); |
|
272 |
|
273 MSmlDmDDFObject& wPassword = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsPasswordNodeName); |
|
274 FillNodeInfoL(wPassword,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
275 MSmlDmDDFObject::EChr,KNSmlIS_WebTargetsPasswordDescription,KNSmlISTextPlain()); |
|
276 |
|
277 MSmlDmDDFObject& wConRef = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsConRefNodeName); |
|
278 FillNodeInfoL(wConRef,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
279 MSmlDmDDFObject::EChr,KNSmlIS_WebTargetsConRefDescription,KNSmlISTextPlain()); |
|
280 |
|
281 MSmlDmDDFObject& wCaption = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsCaptionNodeName); |
|
282 FillNodeInfoL(wCaption,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
283 MSmlDmDDFObject::EChr,KNSmlIS_WebTargetsCaptionDescription,KNSmlISTextPlain()); |
|
284 |
|
285 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
286 MSmlDmDDFObject& wImage = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsImageNodeName); |
|
287 FillNodeInfoL(wImage,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
288 MSmlDmDDFObject::EBin,KNSmlIS_WebTargetsImageDescription,KMimeTypeImageMbm()); |
|
289 |
|
290 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
291 MSmlDmDDFObject& wImageMask = groupNodeWebTargetsX.AddChildObjectL(KNSmlIS_WebTargetsMaskNodeName); |
|
292 FillNodeInfoL(wImageMask,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
293 MSmlDmDDFObject::EBin,KNSmlIS_WebTargetsMaskDescription,KMimeTypeImageMbm()); |
|
294 #endif |
|
295 #endif |
|
296 |
|
297 RDEBUG( "CIsAdapter::DDFStructureL() <" ); |
|
298 } |
|
299 |
|
300 // ------------------------------------------------------------------------------------------------ |
|
301 // CIsAdapter::UpdateLeafObjectL() |
|
302 // ------------------------------------------------------------------------------------------------ |
|
303 void CIsAdapter::UpdateLeafObjectL( CSmlDmAdapter::TError &aStatus, |
|
304 const TDesC8& aURI, const TDesC8& aLUID, |
|
305 const TDesC8& aObject, const TDesC8& aType) |
|
306 { |
|
307 RDEBUG( "CIsAdapter::UpdateLeafObjectL() >" ); |
|
308 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
309 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
310 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( uriPtrc ); |
|
311 #else |
|
312 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( aURI ); |
|
313 #endif |
|
314 |
|
315 HBufC16* strBuf; |
|
316 TInt value; |
|
317 CFavouritesItem *favItem = CFavouritesItem::NewLC(); |
|
318 RDEBUG_2( "CIsAdapter::UpdateLeafObjectL() CFavouritesItem ALLOC %x", favItem ); |
|
319 TPtrC8 ptr8(0, 0); |
|
320 |
|
321 switch( identifier ) |
|
322 { |
|
323 |
|
324 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
325 case EIsNodeSoftKeysXImage: |
|
326 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
327 SetSoftkeyImageL( uriPtrc, aObject, aType ); |
|
328 #else |
|
329 SetSoftkeyImageL( aURI, aObject, aType ); |
|
330 #endif |
|
331 break; |
|
332 |
|
333 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
334 case EIsNodeSoftKeysXMask: |
|
335 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
336 SetSoftkeyImageL( uriPtrc, aObject, aType ); |
|
337 #else |
|
338 SetSoftkeyImageL( aURI, aObject, aType ); |
|
339 #endif |
|
340 break; |
|
341 #endif |
|
342 #endif |
|
343 |
|
344 case EIsNodeSoftKeysXTargetRef: |
|
345 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
346 ptr8.Set( NSmlDmURI::URISeg( uriPtrc, 3 ) ); |
|
347 #else |
|
348 ptr8.Set( NSmlDmURI::URISeg( aURI, 3 ) ); |
|
349 #endif |
|
350 value = GetSoftkeyUidFromNodeNameL( ptr8 ); |
|
351 SetShortcutTargetL( aObject, value ); |
|
352 break; |
|
353 |
|
354 case EIsNodeTargetsXCaption: |
|
355 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
356 iAppTargetManager->SetCaptionL( uriPtrc, aObject ); |
|
357 #else |
|
358 iAppTargetManager->SetCaptionL( aURI, aObject ); |
|
359 #endif |
|
360 break; |
|
361 |
|
362 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
363 case EIsNodeTargetsXImage: |
|
364 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
365 SetShortcutTargetImageL( uriPtrc, aObject, aType ); |
|
366 #else |
|
367 SetShortcutTargetImageL( aURI, aObject, aType ); |
|
368 #endif |
|
369 |
|
370 break; |
|
371 |
|
372 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
373 case EIsNodeTargetsXImageMask: |
|
374 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
375 SetShortcutTargetImageL( uriPtrc, aObject, aType ); |
|
376 #else |
|
377 SetShortcutTargetImageL( aURI, aObject, aType ); |
|
378 #endif |
|
379 break; |
|
380 #endif |
|
381 #endif |
|
382 |
|
383 case EIsNodeWebTargetsX: |
|
384 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
385 if( KErrNone != iWebTargetManager->RenameL( uriPtrc, aLUID, aObject ) ) |
|
386 #else |
|
387 if( KErrNone != iWebTargetManager->RenameL( aURI, aLUID, aObject ) ) |
|
388 #endif |
|
389 { |
|
390 aStatus = CSmlDmAdapter::EError; |
|
391 } |
|
392 break; |
|
393 |
|
394 case EIsNodeWebTargetsXDescription: |
|
395 case EIsNodeWebTargetsXURL: |
|
396 case EIsNodeWebTargetsXUserName: |
|
397 case EIsNodeWebTargetsXPassword: |
|
398 case EIsNodeWebTargetsXConRef: |
|
399 { |
|
400 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
401 iWebTargetManager->PrepareItemL( uriPtrc, *favItem, value ); |
|
402 #else |
|
403 iWebTargetManager->PrepareItemL( aURI, *favItem, value ); |
|
404 #endif |
|
405 strBuf = CTARMCharConv::ConvertFromUtf8LC( aObject ); |
|
406 |
|
407 switch( identifier ) |
|
408 { |
|
409 case EIsNodeWebTargetsXDescription: |
|
410 favItem->SetNameL( *strBuf ); |
|
411 break; |
|
412 |
|
413 case EIsNodeWebTargetsXURL: |
|
414 favItem->SetUrlL( *strBuf ); |
|
415 if( favItem->Url().Compare( *strBuf ) != 0 ) |
|
416 { |
|
417 RDEBUG( "CIsAdapter::UpdateLeafObjectL() Bookmark URL setting failed with FavouritesEngine!" ); |
|
418 aStatus = CSmlDmAdapter::EError; |
|
419 } |
|
420 break; |
|
421 |
|
422 case EIsNodeWebTargetsXUserName: |
|
423 favItem->SetUserNameL( *strBuf ); |
|
424 break; |
|
425 |
|
426 case EIsNodeWebTargetsXPassword: |
|
427 favItem->SetPasswordL( *strBuf ); |
|
428 break; |
|
429 |
|
430 case EIsNodeWebTargetsXConRef: |
|
431 TFavouritesWapAp wapAp; |
|
432 if( aObject.Length() == 0 ) |
|
433 { |
|
434 wapAp.SetDefault(); |
|
435 } |
|
436 else |
|
437 { |
|
438 iWebTargetManager->FindWapApL( aObject, value ); |
|
439 wapAp.SetApId( value ); |
|
440 } |
|
441 favItem->SetWapAp( wapAp ); |
|
442 break; |
|
443 } |
|
444 |
|
445 CleanupStack::PopAndDestroy( strBuf ); |
|
446 iWebTargetManager->ReleaseItemL( *favItem ); |
|
447 } |
|
448 break; |
|
449 |
|
450 case EIsNodeWebTargetsXCaption: |
|
451 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
452 iWebTargetManager->SetCaptionL( uriPtrc, aObject ); |
|
453 #else |
|
454 iWebTargetManager->SetCaptionL( aURI, aObject ); |
|
455 #endif |
|
456 break; |
|
457 |
|
458 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
459 case EIsNodeWebTargetsXImage: |
|
460 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
461 SetShortcutTargetImageL( uriPtrc, aObject, aType ); |
|
462 #else |
|
463 SetShortcutTargetImageL( aURI, aObject, aType ); |
|
464 #endif |
|
465 break; |
|
466 |
|
467 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
468 case EIsNodeWebTargetsXImageMask: |
|
469 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
470 SetShortcutTargetImageL( uriPtrc, aObject, aType ); |
|
471 #else |
|
472 SetShortcutTargetImageL( aURI, aObject, aType ); |
|
473 #endif |
|
474 break; |
|
475 #endif |
|
476 #endif |
|
477 |
|
478 default: |
|
479 aStatus = CSmlDmAdapter::EError; |
|
480 break; |
|
481 }; |
|
482 |
|
483 CleanupStack::PopAndDestroy( favItem ); |
|
484 |
|
485 RDEBUG( "CIsAdapter::UpdateLeafObjectL() <" ); |
|
486 } |
|
487 |
|
488 // ------------------------------------------------------------------------------------------------ |
|
489 // CIsAdapter::_UpdateLeafObjectL() |
|
490 // ------------------------------------------------------------------------------------------------ |
|
491 void CIsAdapter::_UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
492 const TDesC8& aObject, const TDesC8& aType, |
|
493 TInt aStatusRef ) |
|
494 { |
|
495 RDEBUG( "CIsAdapter::_UpdateLeafObjectL() >" ); |
|
496 |
|
497 TBuf8<KISTBufMaxLength> mimeType; |
|
498 CopyAndTrimMimeType(mimeType, aType); |
|
499 |
|
500 CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; |
|
501 |
|
502 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
503 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
504 TRAPD( reason, |
|
505 UpdateLeafObjectL( status, uriPtrc, aLUID, aObject, aType ) ); |
|
506 #else |
|
507 TRAPD( reason, |
|
508 UpdateLeafObjectL( status, aURI, aLUID, aObject, aType ) ); |
|
509 #endif |
|
510 |
|
511 if( KErrNone != reason ) |
|
512 { |
|
513 RDEBUG_2( "CIsAdapter::_UpdateLeafObjectL: Error code %d", reason ); |
|
514 status = CSmlDmAdapter::EError; |
|
515 } |
|
516 |
|
517 iCallBack->SetStatusL(aStatusRef, status); |
|
518 |
|
519 RDEBUG( "CIsAdapter::_UpdateLeafObjectL() <" ); |
|
520 } |
|
521 |
|
522 // ------------------------------------------------------------------------------------------------ |
|
523 // CIsAdapter::_UpdateLeafObjectL() |
|
524 // ------------------------------------------------------------------------------------------------ |
|
525 void CIsAdapter::_UpdateLeafObjectL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, |
|
526 RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, |
|
527 TInt aStatusRef ) |
|
528 { |
|
529 RDEBUG( "CIsAdapter::_UpdateLeafObjectL() (stream) >" ); |
|
530 |
|
531 // SymbianConvergencyNote! Check _UpdateLeafObjectL() <-> removes the "./" ! |
|
532 |
|
533 CSmlDmAdapter::TError ret = CSmlDmAdapter::EError; |
|
534 iCallBack->SetStatusL(aStatusRef, ret); |
|
535 |
|
536 RDEBUG( "CIsAdapter::_UpdateLeafObjectL() (stream) <" ); |
|
537 } |
|
538 |
|
539 // ------------------------------------------------------------------------------------------------ |
|
540 // CIsAdapter::DeleteObjectL |
|
541 // ------------------------------------------------------------------------------------------------ |
|
542 void CIsAdapter::DeleteObjectL( CSmlDmAdapter::TError &aStatus, const TDesC8& aURI, |
|
543 const TDesC8& /*aLUID*/) |
|
544 { |
|
545 RDEBUG( "CIsAdapter::DeleteObjectL() >" ); |
|
546 |
|
547 // NOTE! Look _DeleteObjectL() <-> removes the "./" from the aURI !! |
|
548 |
|
549 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( aURI ); |
|
550 CFavouritesItem *favItem = CFavouritesItem::NewLC(); |
|
551 RDEBUG_2( "CIsAdapter::DeleteObjectL() CFavouritesItem ALLOC %x", favItem ); |
|
552 TInt index; |
|
553 TInt status = KErrNone; |
|
554 |
|
555 switch( identifier ) |
|
556 { |
|
557 case EIsNodeWebTargetsX: |
|
558 status = iWebTargetManager->GetTargetFromNodeNameL( aURI, *favItem, index ); |
|
559 if( (0 != favItem) && (KErrNone == status) ) |
|
560 { |
|
561 User::LeaveIfError( iFavDb.Delete( favItem->Uid() ) ); |
|
562 iWebTargetManager->CheckLUIDDatabaseL( ETrue ); |
|
563 //iWebTargetManager->iUiSettings->ReadBookmarksL(); |
|
564 } |
|
565 else |
|
566 { |
|
567 aStatus = CSmlDmAdapter::EError; |
|
568 } |
|
569 break; |
|
570 |
|
571 default: |
|
572 aStatus = CSmlDmAdapter::EError; |
|
573 break; |
|
574 }; |
|
575 |
|
576 CleanupStack::PopAndDestroy( favItem ); |
|
577 |
|
578 RDEBUG( "CIsAdapter::DeleteObjectL() <" ); |
|
579 } |
|
580 |
|
581 // ------------------------------------------------------------------------------------------------ |
|
582 // CIsAdapter::_DeleteObjectL |
|
583 // ------------------------------------------------------------------------------------------------ |
|
584 void CIsAdapter::_DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, TInt aStatusRef ) |
|
585 { |
|
586 RDEBUG( "CIsAdapter::_DeleteObjectL() >" ); |
|
587 |
|
588 CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; |
|
589 |
|
590 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
591 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
592 TRAPD( reason, |
|
593 DeleteObjectL( status, uriPtrc, aLUID ) ); |
|
594 #else |
|
595 TRAPD( reason, |
|
596 DeleteObjectL( status, aURI, aLUID ) ); |
|
597 #endif |
|
598 |
|
599 if( KErrNone != reason ) |
|
600 { |
|
601 RDEBUG_2( "CIsAdapter::_DeleteObjectL: Error code %d", reason ); |
|
602 status = CSmlDmAdapter::EError; |
|
603 } |
|
604 |
|
605 iCallBack->SetStatusL(aStatusRef, status); |
|
606 |
|
607 RDEBUG( "CIsAdapter::_DeleteObjectL() <" ); |
|
608 } |
|
609 |
|
610 // ------------------------------------------------------------------------------------------------ |
|
611 // CIsAdapter::FetchLeafObjectL |
|
612 // ------------------------------------------------------------------------------------------------ |
|
613 CSmlDmAdapter::TError CIsAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& /*aLUID*/, |
|
614 TDes8& aNewMime, CBufFlat& aObject ) |
|
615 { |
|
616 RDEBUG( "CIsAdapter::FetchLeafObjectL() >" ); |
|
617 |
|
618 // SymbianConvergency NOTE! Check _FetchLeafObjectL() <-> removes the "./" from the aURI |
|
619 |
|
620 TBuf8<KISTBufMaxLength> mimeType; |
|
621 CopyAndTrimMimeType(mimeType, aNewMime); |
|
622 |
|
623 CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; |
|
624 |
|
625 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( aURI ); |
|
626 |
|
627 TInt softkeyUid; |
|
628 HBufC8* strBuf = 0; |
|
629 TBuf8<MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64> numBuf; |
|
630 TBuf <MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64> numBuf16; |
|
631 CFavouritesItem *favItem = CFavouritesItem::NewLC(); |
|
632 RDEBUG_2( "CIsAdapter::FetchLeafObjectL() CFavouritesItem ALLOC %x", favItem ); |
|
633 TBuf8<ISADAPTER_SHORTCUT_CAPTION_MAXLENGTH> caption; |
|
634 TInt index; |
|
635 |
|
636 switch( identifier ) |
|
637 { |
|
638 case EIsNodeCustomization: |
|
639 case EIsNodeIdleSoftkeys: |
|
640 case EIsNodeSoftKeys: |
|
641 case EIsNodeTargets: |
|
642 case EIsNodeWebTargets: |
|
643 case EIsNodeSoftKeysX: |
|
644 case EIsNodeTargetsX: |
|
645 case EIsNodeWebTargetsX: |
|
646 // Empty |
|
647 break; |
|
648 |
|
649 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
650 case EIsNodeSoftKeysXImage: |
|
651 status = CSmlDmAdapter::EError; |
|
652 //softkeyUid = GetSoftkeyUidFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ) ); |
|
653 //GetSoftkeyImageL( softkeyUid, aObject ); |
|
654 break; |
|
655 |
|
656 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
657 case EIsNodeSoftKeysXMask: |
|
658 status = CSmlDmAdapter::EError; |
|
659 //softkeyUid = GetSoftkeyUidFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ) ); |
|
660 //GetSoftkeyImageL( softkeyUid, aObject, ETrue ); |
|
661 break; |
|
662 #endif |
|
663 #endif |
|
664 |
|
665 case EIsNodeSoftKeysXID: |
|
666 softkeyUid = GetSoftkeyUidFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ) ); |
|
667 numBuf.Num( softkeyUid ); |
|
668 aObject.InsertL( aObject.Size(), numBuf ); |
|
669 aObject.InsertL( aObject.Size(), KNSmlISSeparator() ); |
|
670 AddShortcutNameL( aObject, softkeyUid ); |
|
671 break; |
|
672 |
|
673 case EIsNodeSoftKeysXTargetRef: |
|
674 status = GetShortcutTargetURIL( aObject, GetSoftkeyUidFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ) ) ); |
|
675 break; |
|
676 |
|
677 case EIsNodeTargetsXID: |
|
678 iAppTargetManager->GetTargetFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ), index, caption ); |
|
679 numBuf.Num( index ); |
|
680 aObject.InsertL( aObject.Size(), numBuf ); |
|
681 break; |
|
682 |
|
683 case EIsNodeTargetsXCaption: |
|
684 iAppTargetManager->GetTargetFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ), index, caption ); |
|
685 aObject.InsertL( aObject.Size(), caption ); |
|
686 break; |
|
687 |
|
688 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
689 case EIsNodeTargetsXImage: |
|
690 status = CSmlDmAdapter::EError; |
|
691 //iAppTargetManager->GetTargetFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ), index, caption ); |
|
692 //GetApplicationImageL( index, aObject ); |
|
693 break; |
|
694 |
|
695 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
696 case EIsNodeTargetsXImageMask: |
|
697 status = CSmlDmAdapter::EError; |
|
698 //iAppTargetManager->GetTargetFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ), index, caption ); |
|
699 //GetApplicationImageL( index, aObject, ETrue ); |
|
700 break; |
|
701 #endif |
|
702 #endif |
|
703 |
|
704 case EIsNodeTargetsXDescription: |
|
705 iAppTargetManager->GetTargetFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ), index, caption ); |
|
706 aObject.InsertL( aObject.Size(), caption ); |
|
707 break; |
|
708 |
|
709 case EIsNodeWebTargetsXID: |
|
710 case EIsNodeWebTargetsXDescription: |
|
711 case EIsNodeWebTargetsXURL: |
|
712 case EIsNodeWebTargetsXUserName: |
|
713 case EIsNodeWebTargetsXPassword: |
|
714 case EIsNodeWebTargetsXCaption: |
|
715 { |
|
716 iWebTargetManager->PrepareItemL( aURI, *favItem, index ); |
|
717 switch( identifier ) |
|
718 { |
|
719 case EIsNodeWebTargetsXID: |
|
720 numBuf16.Num( favItem->Uid() ); |
|
721 strBuf = CTARMCharConv::ConvertToUtf8LC( numBuf16 ); |
|
722 aObject.InsertL( aObject.Size(), *strBuf ); |
|
723 break; |
|
724 |
|
725 case EIsNodeWebTargetsXDescription: |
|
726 strBuf = CTARMCharConv::ConvertToUtf8LC( favItem->Name() ); |
|
727 aObject.InsertL( aObject.Size(), *strBuf ); |
|
728 break; |
|
729 |
|
730 case EIsNodeWebTargetsXURL: |
|
731 strBuf = CTARMCharConv::ConvertToUtf8LC( favItem->Url() ); |
|
732 aObject.InsertL( aObject.Size(), *strBuf ); |
|
733 break; |
|
734 |
|
735 case EIsNodeWebTargetsXUserName: |
|
736 status = CSmlDmAdapter::EError; |
|
737 |
|
738 //strBuf = CTARMCharConv::ConvertToUtf8LC( favItem->UserName() ); |
|
739 //aObject.InsertL( aObject.Size(), *strBuf ); |
|
740 break; |
|
741 |
|
742 case EIsNodeWebTargetsXPassword: |
|
743 status = CSmlDmAdapter::EError; |
|
744 |
|
745 //strBuf = CTARMCharConv::ConvertToUtf8LC( favItem->Password() ); |
|
746 //aObject.InsertL( aObject.Size(), *strBuf ); |
|
747 break; |
|
748 |
|
749 case EIsNodeWebTargetsXCaption: |
|
750 strBuf = CTARMCharConv::ConvertToUtf8LC( favItem->Name() ); |
|
751 aObject.InsertL( aObject.Size(), *strBuf ); |
|
752 break; |
|
753 } |
|
754 if(strBuf!=NULL) |
|
755 { |
|
756 CleanupStack::PopAndDestroy( strBuf ); |
|
757 } |
|
758 iWebTargetManager->ReleaseItemL( *favItem, EFalse ); |
|
759 } |
|
760 break; |
|
761 |
|
762 case EIsNodeWebTargetsXConRef: |
|
763 { |
|
764 iWebTargetManager->PrepareItemL( aURI, *favItem, index ); |
|
765 |
|
766 TFavouritesWapAp wapAp = favItem->WapAp(); |
|
767 if( wapAp.IsDefault() ) |
|
768 { |
|
769 aObject.InsertL( aObject.Size(), KDefaultApName8() ); |
|
770 } |
|
771 else if( wapAp.IsNull() ) |
|
772 { |
|
773 // Leave empty |
|
774 } |
|
775 else |
|
776 { |
|
777 CNSmlDMIAPMatcher *matcher = CNSmlDMIAPMatcher::NewLC( iCallBack ); |
|
778 TInt id = wapAp.ApId(); |
|
779 HBufC8* buf = matcher->URIFromIAPIdL( id ); |
|
780 if( 0 == buf ) |
|
781 { |
|
782 User::Leave( KErrNotFound ); |
|
783 } |
|
784 CleanupStack::PushL( buf ); |
|
785 aObject.InsertL( aObject.Size(), *buf ); |
|
786 CleanupStack::PopAndDestroy( buf ); |
|
787 CleanupStack::PopAndDestroy( matcher ); |
|
788 } |
|
789 |
|
790 iWebTargetManager->ReleaseItemL( *favItem, EFalse ); |
|
791 } |
|
792 break; |
|
793 |
|
794 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
795 case EIsNodeWebTargetsXImage: |
|
796 status = CSmlDmAdapter::EError; |
|
797 //iWebTargetManager->PrepareItemL( aURI, *favItem, index ); |
|
798 //GetBookmarkImageL( index, aObject ); |
|
799 //iWebTargetManager->ReleaseItemL( *favItem, EFalse ); |
|
800 break; |
|
801 |
|
802 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
803 case EIsNodeWebTargetsXImageMask: |
|
804 status = CSmlDmAdapter::EError; |
|
805 //iWebTargetManager->PrepareItemL( aURI, *favItem, index ); |
|
806 //GetBookmarkImageL( index, aObject, ETrue ); |
|
807 //iWebTargetManager->ReleaseItemL( *favItem, EFalse ); |
|
808 break; |
|
809 #endif |
|
810 #endif |
|
811 |
|
812 default: |
|
813 status = CSmlDmAdapter::EError; |
|
814 break; |
|
815 }; |
|
816 |
|
817 CleanupStack::PopAndDestroy( favItem ); |
|
818 |
|
819 RDEBUG_2( "CIsAdapter::FetchLeafObjectL() < %d", (TInt)status ); |
|
820 return status; |
|
821 } |
|
822 |
|
823 // ------------------------------------------------------------------------------------------------ |
|
824 // CIsAdapter::_FetchLeafObjectL |
|
825 // ------------------------------------------------------------------------------------------------ |
|
826 void CIsAdapter::_FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
827 const TDesC8& aType, TInt aResultsRef, |
|
828 TInt aStatusRef ) |
|
829 { |
|
830 RDEBUG("CIsAdapter::_FetchLeafObjectL() >"); |
|
831 |
|
832 TBuf8<KISTBufMaxLength> mimeType; |
|
833 CopyAndTrimMimeType(mimeType, aType); |
|
834 |
|
835 CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; |
|
836 |
|
837 CBufFlat *object = CBufFlat::NewL(128); |
|
838 CleanupStack::PushL( object ); |
|
839 |
|
840 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
841 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
842 TRAPD( |
|
843 reason, |
|
844 status = FetchLeafObjectL( uriPtrc, aLUID, mimeType, *object ) ); |
|
845 #else |
|
846 TRAPD( |
|
847 reason, |
|
848 status = FetchLeafObjectL( aURI, aLUID, mimeType, *object ) ); |
|
849 #endif |
|
850 |
|
851 if( KErrNone != reason ) |
|
852 { |
|
853 RDEBUG_2( "CIsAdapter::_FetchLeafObjectL: Error code %d", reason); |
|
854 status = CSmlDmAdapter::EError; |
|
855 } |
|
856 |
|
857 iCallBack->SetStatusL(aStatusRef, status); |
|
858 |
|
859 if( status == CSmlDmAdapter::EOk) |
|
860 { |
|
861 object->Compress(); |
|
862 iCallBack->SetResultsL( aResultsRef, *object, mimeType ); |
|
863 } |
|
864 |
|
865 CleanupStack::PopAndDestroy( object ); |
|
866 |
|
867 RDEBUG("CIsAdapter::_FetchLeafObjectL() <"); |
|
868 } |
|
869 |
|
870 // ------------------------------------------------------------------------------------------------ |
|
871 // CIsAdapter::_FetchLeafObjectSizeL |
|
872 // ------------------------------------------------------------------------------------------------ |
|
873 void CIsAdapter::_FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, |
|
874 const TDesC8& aType, TInt aResultsRef, |
|
875 TInt aStatusRef ) |
|
876 { |
|
877 RDEBUG("CIsAdapter::_FetchLeafObjectSizeL() >"); |
|
878 |
|
879 TBuf8<KISTBufMaxLength> mimeType; |
|
880 CopyAndTrimMimeType(mimeType, aType); |
|
881 |
|
882 CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; |
|
883 |
|
884 CBufFlat *object = CBufFlat::NewL(128); |
|
885 CleanupStack::PushL( object ); |
|
886 |
|
887 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
888 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
889 TRAPD( |
|
890 reason, |
|
891 status = FetchLeafObjectL( uriPtrc, aLUID, mimeType, *object ) ); |
|
892 #else |
|
893 TRAPD( |
|
894 reason, |
|
895 status = FetchLeafObjectL( aURI, aLUID, mimeType, *object ) ); |
|
896 #endif |
|
897 |
|
898 if( KErrNone != reason ) |
|
899 { |
|
900 RDEBUG_2( "CIsAdapter::_FetchLeafObjectSizeL: Error code %d", reason); |
|
901 status = CSmlDmAdapter::EError; |
|
902 } |
|
903 |
|
904 iCallBack->SetStatusL(aStatusRef, status); |
|
905 |
|
906 if( status == CSmlDmAdapter::EOk) |
|
907 { |
|
908 TBuf8<MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64> numBuf; |
|
909 object->Compress(); |
|
910 |
|
911 CBufFlat *object2 = CBufFlat::NewL(128); |
|
912 CleanupStack::PushL( object2 ); |
|
913 |
|
914 numBuf.Num(object->Size()); |
|
915 object2->InsertL(0, numBuf); |
|
916 object2->Compress(); |
|
917 iCallBack->SetResultsL( aResultsRef, *object2, KNSmlISTextPlain ); |
|
918 |
|
919 CleanupStack::PopAndDestroy( object2 ); |
|
920 } |
|
921 |
|
922 CleanupStack::PopAndDestroy( object ); |
|
923 |
|
924 RDEBUG("CIsAdapter::_FetchLeafObjectSizeL() <"); |
|
925 } |
|
926 |
|
927 // ------------------------------------------------------------------------------------------------ |
|
928 // CIsAdapter::_ChildURIListL |
|
929 // ------------------------------------------------------------------------------------------------ |
|
930 void CIsAdapter::_ChildURIListL( const TDesC8& aURI, const TDesC8& /*aLUID*/, |
|
931 const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/, |
|
932 TInt aResultsRef, TInt aStatusRef ) |
|
933 { |
|
934 RDEBUG( "CIsAdapter::_ChildURIListL() >" ); |
|
935 |
|
936 CSmlDmAdapter::TError ret = CSmlDmAdapter::EOk; |
|
937 |
|
938 CBufFlat *currentList = CBufFlat::NewL(128); |
|
939 CleanupStack::PushL(currentList); |
|
940 |
|
941 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
942 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
943 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( uriPtrc ); |
|
944 #else |
|
945 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( aURI ); |
|
946 #endif |
|
947 |
|
948 switch( identifier ) |
|
949 { |
|
950 case EIsNodeCustomization: |
|
951 currentList->InsertL(currentList->Size(),KNSmlIS_IdleSoftKeyNodeName()); |
|
952 break; |
|
953 |
|
954 case EIsNodeIdleSoftkeys: |
|
955 currentList->InsertL(currentList->Size(),KNSmlIS_SoftKeysNodeName()); |
|
956 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
957 currentList->InsertL(currentList->Size(),KNSmlIS_TargetsNodeName()); |
|
958 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
959 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsNodeName()); |
|
960 break; |
|
961 |
|
962 case EIsNodeSoftKeys: |
|
963 ListSoftkeysL( *currentList ); |
|
964 break; |
|
965 |
|
966 case EIsNodeTargets: |
|
967 iAppTargetManager->ListTargetsL( *currentList ); |
|
968 break; |
|
969 |
|
970 case EIsNodeWebTargets: |
|
971 |
|
972 //User::LeaveIfError( iUiSrv.UpdateShortcutTargetList() ); |
|
973 iWebTargetManager->ListWebTargetsL( *currentList ); |
|
974 iWebTargetManager->CheckLUIDDatabaseL( ETrue ); |
|
975 break; |
|
976 |
|
977 case EIsNodeSoftKeysX: |
|
978 currentList->InsertL(currentList->Size(),KNSmlIS_SoftkeysIDNodeName()); |
|
979 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
980 currentList->InsertL(currentList->Size(),KNSmlIS_SoftkeysTargetRefNodeName()); |
|
981 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
982 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
983 currentList->InsertL(currentList->Size(),KNSmlIS_SoftkeysImageNoneName()); |
|
984 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
985 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
986 currentList->InsertL(currentList->Size(),KNSmlIS_SoftkeysMaskNodeName()); |
|
987 #endif |
|
988 #endif |
|
989 break; |
|
990 |
|
991 case EIsNodeTargetsX: |
|
992 currentList->InsertL(currentList->Size(),KNSmlIS_TargetsIDNodeName()); |
|
993 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
994 currentList->InsertL(currentList->Size(),KNSmlIS_TargetsDescriptionNodeName()); |
|
995 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
996 currentList->InsertL(currentList->Size(),KNSmlIS_TargetsCaptionName()); |
|
997 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
998 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
999 currentList->InsertL(currentList->Size(),KNSmlIS_TargetsImageNodeName()); |
|
1000 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
1001 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1002 currentList->InsertL(currentList->Size(),KNSmlIS_TargetsMaskNodeName()); |
|
1003 #endif |
|
1004 #endif |
|
1005 break; |
|
1006 |
|
1007 case EIsNodeWebTargetsX: |
|
1008 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsIDNodeName()); |
|
1009 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1010 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsDescriptionNodeName()); |
|
1011 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1012 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsURLNodeName()); |
|
1013 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1014 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsUserNameNodeName()); |
|
1015 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1016 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsPasswordNodeName()); |
|
1017 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1018 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsConRefNodeName()); |
|
1019 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1020 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsCaptionNodeName()); |
|
1021 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1022 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1023 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsImageNodeName()); |
|
1024 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
1025 currentList->InsertL(currentList->Size(),KNSmlISSeparator()); |
|
1026 currentList->InsertL(currentList->Size(),KNSmlIS_WebTargetsMaskNodeName()); |
|
1027 #endif |
|
1028 #endif |
|
1029 break; |
|
1030 |
|
1031 case EIsNodeSoftKeysXID: |
|
1032 case EIsNodeSoftKeysXTargetRef: |
|
1033 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1034 case EIsNodeSoftKeysXImage: |
|
1035 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
1036 case EIsNodeSoftKeysXMask: |
|
1037 #endif |
|
1038 #endif |
|
1039 // Empty |
|
1040 break; |
|
1041 |
|
1042 case EIsNodeTargetsXID: |
|
1043 case EIsNodeTargetsXDescription: |
|
1044 case EIsNodeTargetsXCaption: |
|
1045 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1046 case EIsNodeTargetsXImage: |
|
1047 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
1048 case EIsNodeTargetsXImageMask: |
|
1049 #endif |
|
1050 #endif |
|
1051 // Empty |
|
1052 break; |
|
1053 |
|
1054 case EIsNodeWebTargetsXID: |
|
1055 case EIsNodeWebTargetsXDescription: |
|
1056 case EIsNodeWebTargetsXURL: |
|
1057 case EIsNodeWebTargetsXUserName: |
|
1058 case EIsNodeWebTargetsXPassword: |
|
1059 case EIsNodeWebTargetsXConRef: |
|
1060 case EIsNodeWebTargetsXCaption: |
|
1061 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1062 case EIsNodeWebTargetsXImage: |
|
1063 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
1064 case EIsNodeWebTargetsXImageMask: |
|
1065 #endif |
|
1066 #endif |
|
1067 // Empty |
|
1068 break; |
|
1069 |
|
1070 default: |
|
1071 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1072 if( uriPtrc.Length() == 0 ) |
|
1073 #else |
|
1074 if( aURI.Length() == 0 ) |
|
1075 #endif |
|
1076 { |
|
1077 currentList->InsertL(0,KNSmlCustomizationNodeName()); |
|
1078 } |
|
1079 else |
|
1080 { |
|
1081 ret = CSmlDmAdapter::ENotFound; |
|
1082 } |
|
1083 break; |
|
1084 } |
|
1085 |
|
1086 iCallBack->SetStatusL(aStatusRef, ret); |
|
1087 |
|
1088 if( ret == CSmlDmAdapter::EOk ) |
|
1089 { |
|
1090 iCallBack->SetResultsL(aResultsRef, *currentList, KNSmlISTextPlain); |
|
1091 } |
|
1092 |
|
1093 CleanupStack::PopAndDestroy( currentList ); |
|
1094 |
|
1095 RDEBUG( "CIsAdapter::_ChildURIListL() <" ); |
|
1096 } |
|
1097 |
|
1098 // ------------------------------------------------------------------------------------------------ |
|
1099 // CIsAdapter::AddNodeObjectL |
|
1100 // ------------------------------------------------------------------------------------------------ |
|
1101 void CIsAdapter::AddNodeObjectL( CSmlDmAdapter::TError &aStatus, const TDesC8& aURI, |
|
1102 const TDesC8& /*aParentLUID*/ ) |
|
1103 { |
|
1104 RDEBUG( "CIsAdapter::AddNodeObjectL() >" ); |
|
1105 |
|
1106 // SymbianConvergency NOTE! See _AddNodeObjectL() <-> it removes the "./" from aURI |
|
1107 |
|
1108 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( aURI ); |
|
1109 |
|
1110 HBufC8* dataH = HBufC8::NewLC( KRepositoryEntryMaxLength ); |
|
1111 RDEBUG_2( "CIsAdapter::AddNodeObjectL() HBufC8 dataH ALLOC %x", dataH); |
|
1112 TPtr8 data( dataH->Des() ); |
|
1113 TInt index = -1; |
|
1114 TInt ret = KErrNone; |
|
1115 |
|
1116 switch( identifier ) |
|
1117 { |
|
1118 case EIsNodeWebTargetsX: |
|
1119 { |
|
1120 TRAPD( reason, |
|
1121 ret = |
|
1122 iWebTargetManager->GetTargetFromNodeNameL( aURI, index ) ); // Ignore index |
|
1123 if( (KErrNone != reason) || (KErrNone != ret) ) |
|
1124 { |
|
1125 RDEBUG_2( "CIsAdapter::AddNodeObjectL: New WebTarget (%d)", reason); |
|
1126 CFavouritesItem *favItem = CFavouritesItem::NewLC(); |
|
1127 RDEBUG_2( "CIsAdapter::AddNodeObjectL() CFavouritesItem ALLOC %x", favItem); |
|
1128 |
|
1129 TPtrC8 namePtr( NSmlDmURI::LastURISeg(aURI) ); |
|
1130 HBufC* nameBuf = HBufC::NewLC( namePtr.Length() ); |
|
1131 RDEBUG_2( "CIsAdapter::AddNodeObjectL() HBufC nameBuf ALLOC %x", nameBuf); |
|
1132 |
|
1133 nameBuf->Des().Copy( namePtr ); |
|
1134 favItem->SetNameL( *nameBuf ); |
|
1135 CleanupStack::PopAndDestroy( nameBuf ); |
|
1136 |
|
1137 favItem->SetUrlL(_L("http://")); |
|
1138 favItem->SetParentFolder(KFavouritesRootUid); |
|
1139 |
|
1140 if( KErrNone == iFavDb.Add( *favItem, ETrue ) ) |
|
1141 { |
|
1142 TBuf8<MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64> newUID; |
|
1143 newUID.Num( favItem->Uid() ); |
|
1144 |
|
1145 if( KErrNone == iWebTargetManager->FindLUIDByURIL( aURI, data, index ) ) |
|
1146 { |
|
1147 aStatus = CSmlDmAdapter::EAlreadyExists; |
|
1148 } |
|
1149 |
|
1150 /* |
|
1151 else |
|
1152 if( KErrNone == iWebTargetManager->FindURIByLUIDL( data, newUID, index ) ) |
|
1153 { |
|
1154 aStatus = CSmlDmAdapter::EAlreadyExists; |
|
1155 }*/ |
|
1156 else |
|
1157 { |
|
1158 RDEBUG8_2( "CIsAdapter::AddNodeObjectL: New WebTarget UID=%S", &newUID ); |
|
1159 iWebTargetManager->FindURIByLUIDL( data, newUID, index ); // Replace if LUid exists... |
|
1160 iWebTargetManager->UpdateLUIDDatabaseL( aURI, newUID, index ); |
|
1161 iCallBack->SetMappingL( aURI, newUID ); |
|
1162 } |
|
1163 } |
|
1164 else |
|
1165 { |
|
1166 aStatus = CSmlDmAdapter::EError; |
|
1167 } |
|
1168 |
|
1169 CleanupStack::PopAndDestroy( favItem ); |
|
1170 } |
|
1171 else |
|
1172 { |
|
1173 aStatus = CSmlDmAdapter::EAlreadyExists; |
|
1174 } |
|
1175 } |
|
1176 break; |
|
1177 |
|
1178 default: |
|
1179 aStatus = CSmlDmAdapter::EError; |
|
1180 break; |
|
1181 }; |
|
1182 |
|
1183 CleanupStack::PopAndDestroy(dataH); |
|
1184 |
|
1185 RDEBUG( "CIsAdapter::AddNodeObjectL() <" ); |
|
1186 } |
|
1187 |
|
1188 // ------------------------------------------------------------------------------------------------ |
|
1189 // CIsAdapter::_AddNodeObjectL |
|
1190 // ------------------------------------------------------------------------------------------------ |
|
1191 void CIsAdapter::_AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, TInt aStatusRef ) |
|
1192 { |
|
1193 RDEBUG( "CIsAdapter::_AddNodeObjectL() >" ); |
|
1194 |
|
1195 CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; |
|
1196 |
|
1197 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1198 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
1199 TRAPD( |
|
1200 reason, |
|
1201 AddNodeObjectL( status, uriPtrc, aParentLUID ) ); |
|
1202 #else |
|
1203 TRAPD( |
|
1204 reason, |
|
1205 AddNodeObjectL( status, aURI, aParentLUID ) ); |
|
1206 #endif |
|
1207 |
|
1208 if( KErrNone != reason ) |
|
1209 { |
|
1210 RDEBUG_2( "CIsAdapter::_AddNodeObjectL: Error code %d", reason); |
|
1211 status = CSmlDmAdapter::EError; |
|
1212 } |
|
1213 |
|
1214 iCallBack->SetStatusL(aStatusRef, status); |
|
1215 |
|
1216 RDEBUG( "CIsAdapter::_AddNodeObjectL() <" ); |
|
1217 } |
|
1218 |
|
1219 // ------------------------------------------------------------------------------------------------ |
|
1220 // CIsAdapter::_ExecuteCommandL |
|
1221 // ------------------------------------------------------------------------------------------------ |
|
1222 void CIsAdapter::_ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, |
|
1223 const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, |
|
1224 TInt aStatusRef ) |
|
1225 { |
|
1226 RDEBUG( "CIsAdapter::_ExecuteCommandL() >" ); |
|
1227 |
|
1228 CSmlDmAdapter::TError ret = CSmlDmAdapter::EError; |
|
1229 iCallBack->SetStatusL(aStatusRef, ret); |
|
1230 |
|
1231 RDEBUG( "CIsAdapter::_ExecuteCommandL() <" ); |
|
1232 } |
|
1233 |
|
1234 // ------------------------------------------------------------------------------------------------ |
|
1235 // CIsAdapter::_ExecuteCommandL |
|
1236 // ------------------------------------------------------------------------------------------------ |
|
1237 void CIsAdapter::_ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, |
|
1238 RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, |
|
1239 TInt aStatusRef ) |
|
1240 { |
|
1241 RDEBUG( "CIsAdapter::_ExecuteCommandL() (stream) >" ); |
|
1242 |
|
1243 CSmlDmAdapter::TError ret = CSmlDmAdapter::EError; |
|
1244 iCallBack->SetStatusL(aStatusRef, ret); |
|
1245 |
|
1246 RDEBUG( "CIsAdapter::_ExecuteCommandL() (stream) <" ); |
|
1247 } |
|
1248 |
|
1249 // ------------------------------------------------------------------------------------------------ |
|
1250 // CIsAdapter::_CopyCommandL |
|
1251 // ------------------------------------------------------------------------------------------------ |
|
1252 void CIsAdapter::_CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& /*aTargetLUID*/, |
|
1253 const TDesC8& /*aSourceURI*/, const TDesC8& /*aSourceLUID*/, |
|
1254 const TDesC8& /*aType*/, TInt aStatusRef ) |
|
1255 { |
|
1256 RDEBUG( "CIsAdapter::_CopyCommandL() >" ); |
|
1257 |
|
1258 CSmlDmAdapter::TError ret = CSmlDmAdapter::EError; |
|
1259 iCallBack->SetStatusL(aStatusRef, ret); |
|
1260 |
|
1261 RDEBUG( "CIsAdapter::_CopyCommandL() <" ); |
|
1262 } |
|
1263 |
|
1264 // ------------------------------------------------------------------------------------------------ |
|
1265 // CIsAdapter::StartAtomicL |
|
1266 // ------------------------------------------------------------------------------------------------ |
|
1267 void CIsAdapter::StartAtomicL() |
|
1268 { |
|
1269 RDEBUG( "CIsAdapter::StartAtomicL() ><" ); |
|
1270 } |
|
1271 |
|
1272 // ------------------------------------------------------------------------------------------------ |
|
1273 // CIsAdapter::CommitAtomicL |
|
1274 // ------------------------------------------------------------------------------------------------ |
|
1275 void CIsAdapter::CommitAtomicL() |
|
1276 { |
|
1277 RDEBUG( "CIsAdapter::CommitAtomicL() ><" ); |
|
1278 } |
|
1279 |
|
1280 // ------------------------------------------------------------------------------------------------ |
|
1281 // CIsAdapter::RollbackAtomicL |
|
1282 // ------------------------------------------------------------------------------------------------ |
|
1283 void CIsAdapter::RollbackAtomicL() |
|
1284 { |
|
1285 RDEBUG( "CIsAdapter::RollbackAtomicL() ><" ); |
|
1286 |
|
1287 |
|
1288 CSmlDmAdapter::TError status = CSmlDmAdapter::ERollbackFailed; |
|
1289 iCallBack->SetStatusL(0, status); |
|
1290 } |
|
1291 |
|
1292 // ----------------------------------------------------------------------------- |
|
1293 // CIsAdapter::StreamType |
|
1294 // |
|
1295 // ----------------------------------------------------------------------------- |
|
1296 CTARMDmStreamAdapter::TAdapterStreamType CIsAdapter::StreamType( const TDesC8& /*aURI*/ ) |
|
1297 { |
|
1298 RDEBUG( "CIsAdapter::StreamType()" ); |
|
1299 return CTARMDmStreamAdapter::EStreamToBuffer; |
|
1300 } |
|
1301 |
|
1302 // ------------------------------------------------------------------------------------------------ |
|
1303 // CIsAdapter::StreamingSupport |
|
1304 // ------------------------------------------------------------------------------------------------ |
|
1305 TBool CIsAdapter::StreamingSupport( TInt& aItemSize ) |
|
1306 { |
|
1307 RDEBUG( "CIsAdapter::StreamingSupport()" ); |
|
1308 aItemSize = 1024; // Large images are streamed |
|
1309 return EFalse; // don't support stream |
|
1310 } |
|
1311 |
|
1312 // ------------------------------------------------------------------------------------------------ |
|
1313 // CIsAdapter::CompleteOutstandingCmdsL |
|
1314 // ------------------------------------------------------------------------------------------------ |
|
1315 void CIsAdapter::CompleteOutstandingCmdsL() |
|
1316 { |
|
1317 RDEBUG( "CIsAdapter::CompleteOutstandingCmdsL() ><" ); |
|
1318 } |
|
1319 |
|
1320 // ------------------------------------------------------------------------------------------------ |
|
1321 // ImplementationTable |
|
1322 // ------------------------------------------------------------------------------------------------ |
|
1323 const TImplementationProxy ImplementationTable[] = |
|
1324 { |
|
1325 { { KNSmlDMISAdapterImplUidValue }, (TProxyNewLPtr)CIsAdapter::NewL } |
|
1326 }; |
|
1327 |
|
1328 // ------------------------------------------------------------------------------------------------ |
|
1329 // ImplementationGroupProxy |
|
1330 // ------------------------------------------------------------------------------------------------ |
|
1331 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
1332 { |
|
1333 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
1334 return ImplementationTable; |
|
1335 } |
|
1336 |
|
1337 // ------------------------------------------------------------------------------------------------ |
|
1338 // CIsAdapter::ConstructL |
|
1339 // ------------------------------------------------------------------------------------------------ |
|
1340 void CIsAdapter::ConstructL(MSmlDmCallback *aDmCallback) |
|
1341 { |
|
1342 RDEBUG( "CIsAdapter::ConstructL() >" ); |
|
1343 |
|
1344 TRAPD( errf, FeatureManager::InitializeLibL() ); |
|
1345 if( errf != KErrNone ) |
|
1346 { |
|
1347 User::Leave(errf); |
|
1348 } |
|
1349 |
|
1350 if(FeatureManager::FeatureSupported(KFeatureIdSapIdleSoftkeyAdapter)) |
|
1351 { |
|
1352 iCallBack = aDmCallback; |
|
1353 |
|
1354 //User::LeaveIfError( iUiSrv.Connect() ); |
|
1355 //iUiSrv.UpdateShortcutTargetList(); |
|
1356 |
|
1357 User::LeaveIfError( iFavSession.Connect() ); |
|
1358 User::LeaveIfError( iFavDb.Open( iFavSession, KBrowserBookmarks ) ); |
|
1359 |
|
1360 TInt count = 0; |
|
1361 // Get / create the count |
|
1362 // |
|
1363 CRepository* rep = CRepository::NewLC( KNSmlDMISAdapterCentRepUid ); |
|
1364 RDEBUG_2( "CIsAdapter::ConstructL() CRepository ALLOC %x", rep); |
|
1365 |
|
1366 TInt ret = rep->Get((TUint32)KRepositoryIdBookmarkCount, count); |
|
1367 if( ret == KErrNotFound ) |
|
1368 { |
|
1369 ret = rep->Create((TUint32)KRepositoryIdBookmarkCount, count); |
|
1370 } |
|
1371 |
|
1372 CleanupStack::PopAndDestroy( rep ); |
|
1373 |
|
1374 iWebTargetManager = new (ELeave) CIdleSoftkeysWebTargetManager( |
|
1375 iCallBack, |
|
1376 iFavDb |
|
1377 ); |
|
1378 iWebTargetManager->CheckLUIDDatabaseL( EFalse ); |
|
1379 |
|
1380 iAppTargetManager = new (ELeave) CIdleSoftkeysAppTargetManager( |
|
1381 iCallBack |
|
1382 |
|
1383 ); |
|
1384 // just creating a pointer to the class |
|
1385 // this needs to be initialized before it is used |
|
1386 // to initialize we use ReadBookmarksL and ReadTargetsL function |
|
1387 iUiSettings = CUiSettingsUtil::NewL( ); |
|
1388 |
|
1389 RDEBUG( "CIsAdapter::ConstructL() <" ); |
|
1390 } |
|
1391 else |
|
1392 { |
|
1393 FeatureManager::UnInitializeLib(); |
|
1394 User::Leave( KErrNotSupported ); |
|
1395 } |
|
1396 |
|
1397 } |
|
1398 |
|
1399 // ------------------------------------------------------------------------------------- |
|
1400 // CIsAdapter::FillNodeInfoL() |
|
1401 // Fills the node info in ddf structure |
|
1402 // ------------------------------------------------------------------------------------- |
|
1403 void CIsAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes, |
|
1404 MSmlDmDDFObject::TOccurence aOccurrence, MSmlDmDDFObject::TScope aScope, |
|
1405 MSmlDmDDFObject::TDFFormat aFormat,const TDesC8& aDescription,const TDesC8& aMimeType) |
|
1406 { |
|
1407 RDEBUG( "CIsAdapter::FillNodeInfoL() >" ); |
|
1408 |
|
1409 aNode.SetAccessTypesL(aAccTypes); |
|
1410 aNode.SetOccurenceL(aOccurrence); |
|
1411 aNode.SetScopeL(aScope); |
|
1412 aNode.SetDFFormatL(aFormat); |
|
1413 aNode.SetDescriptionL(aDescription); |
|
1414 if(aMimeType.Length() > 0) |
|
1415 { |
|
1416 aNode.AddDFTypeMimeTypeL(aMimeType); |
|
1417 } |
|
1418 |
|
1419 RDEBUG( "CIsAdapter::FillNodeInfoL() <" ); |
|
1420 } |
|
1421 |
|
1422 // ------------------------------------------------------------------------------------- |
|
1423 // CIsAdapter::GetNodeIdentifier |
|
1424 // ------------------------------------------------------------------------------------- |
|
1425 CIsAdapter::TIsNodeIdentifier CIsAdapter::GetNodeIdentifier(const TDesC8& aURI) |
|
1426 { |
|
1427 RDEBUG( "CIsAdapter::GetNodeIdentifier() >" ); |
|
1428 |
|
1429 // SymbianConvergency NOTE! Look _DeleteObjectL() <-> removes the "./" from the aURI !! |
|
1430 |
|
1431 TInt numOfSegs = NSmlDmURI::NumOfURISegs( aURI ); |
|
1432 if(numOfSegs == 0) |
|
1433 { |
|
1434 return CIsAdapter::EIsNodeNotUsedAndAlwaysLast; |
|
1435 } |
|
1436 |
|
1437 TPtrC8I seg1 = NSmlDmURI::URISeg( aURI, 0 ); |
|
1438 |
|
1439 if(seg1 == KNSmlCustomizationNodeName) |
|
1440 { |
|
1441 if(numOfSegs == 1) |
|
1442 { |
|
1443 return EIsNodeCustomization; |
|
1444 } |
|
1445 |
|
1446 // At least 2 segments |
|
1447 TPtrC8I seg2 = NSmlDmURI::URISeg( aURI, 1 ); |
|
1448 if(seg2 == KNSmlIS_IdleSoftKeyNodeName) |
|
1449 { |
|
1450 if(numOfSegs == 2) |
|
1451 { |
|
1452 return CIsAdapter::EIsNodeIdleSoftkeys; |
|
1453 } |
|
1454 |
|
1455 // At least 3 segments |
|
1456 TPtrC8I seg3 = NSmlDmURI::URISeg( aURI, 2 ); |
|
1457 if(seg3 == KNSmlIS_SoftKeysNodeName) |
|
1458 { |
|
1459 if(numOfSegs == 3) |
|
1460 { |
|
1461 return CIsAdapter::EIsNodeSoftKeys; |
|
1462 } |
|
1463 |
|
1464 // At least 4 segments |
|
1465 if(numOfSegs == 4) |
|
1466 { |
|
1467 return CIsAdapter::EIsNodeSoftKeysX; |
|
1468 } |
|
1469 |
|
1470 // At least 5 segments |
|
1471 TPtrC8I seg5 = NSmlDmURI::URISeg( aURI, 4 ); |
|
1472 if(seg5 == KNSmlIS_SoftkeysIDNodeName) |
|
1473 { |
|
1474 return CIsAdapter::EIsNodeSoftKeysXID; |
|
1475 } |
|
1476 else |
|
1477 if(seg5 == KNSmlIS_SoftkeysTargetRefNodeName) |
|
1478 { |
|
1479 return CIsAdapter::EIsNodeSoftKeysXTargetRef; |
|
1480 } |
|
1481 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1482 else |
|
1483 if(seg5 == KNSmlIS_SoftkeysImageNoneName) |
|
1484 { |
|
1485 return CIsAdapter::EIsNodeSoftKeysXImage; |
|
1486 } |
|
1487 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
1488 else |
|
1489 if(seg5 == KNSmlIS_SoftkeysMaskNodeName) |
|
1490 { |
|
1491 return CIsAdapter::EIsNodeSoftKeysXMask; |
|
1492 } |
|
1493 #endif |
|
1494 #endif |
|
1495 else |
|
1496 { |
|
1497 return CIsAdapter::EIsNodeNotUsedAndAlwaysLast; |
|
1498 } |
|
1499 } |
|
1500 else |
|
1501 if(seg3 == KNSmlIS_TargetsNodeName) |
|
1502 { |
|
1503 if(numOfSegs == 3) |
|
1504 { |
|
1505 return CIsAdapter::EIsNodeTargets; |
|
1506 } |
|
1507 |
|
1508 // At least 4 segments |
|
1509 if(numOfSegs == 4) |
|
1510 { |
|
1511 return CIsAdapter::EIsNodeTargetsX; |
|
1512 } |
|
1513 |
|
1514 // At least 5 segments |
|
1515 TPtrC8I seg5 = NSmlDmURI::URISeg( aURI, 4 ); |
|
1516 if(seg5 == KNSmlIS_TargetsIDNodeName) |
|
1517 { |
|
1518 return CIsAdapter::EIsNodeTargetsXID; |
|
1519 } |
|
1520 else |
|
1521 if(seg5 == KNSmlIS_TargetsDescriptionNodeName) |
|
1522 { |
|
1523 return CIsAdapter::EIsNodeTargetsXDescription; |
|
1524 } |
|
1525 // ... |
|
1526 else |
|
1527 if(seg5 == KNSmlIS_TargetsCaptionName) |
|
1528 { |
|
1529 return CIsAdapter::EIsNodeTargetsXCaption; |
|
1530 } |
|
1531 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1532 else |
|
1533 if(seg5 == KNSmlIS_TargetsImageNodeName) |
|
1534 { |
|
1535 return CIsAdapter::EIsNodeTargetsXImage; |
|
1536 } |
|
1537 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
1538 else |
|
1539 if(seg5 == KNSmlIS_TargetsMaskNodeName) |
|
1540 { |
|
1541 return CIsAdapter::EIsNodeTargetsXImageMask; |
|
1542 } |
|
1543 #endif |
|
1544 #endif |
|
1545 // ... |
|
1546 else |
|
1547 |
|
1548 { |
|
1549 return CIsAdapter::EIsNodeNotUsedAndAlwaysLast; |
|
1550 } |
|
1551 } |
|
1552 else |
|
1553 if(seg3 == KNSmlIS_WebTargetsNodeName) |
|
1554 { |
|
1555 if(numOfSegs == 3) |
|
1556 { |
|
1557 return CIsAdapter::EIsNodeWebTargets; |
|
1558 } |
|
1559 |
|
1560 // At least 4 segments |
|
1561 if(numOfSegs == 4) |
|
1562 { |
|
1563 return CIsAdapter::EIsNodeWebTargetsX; |
|
1564 } |
|
1565 |
|
1566 // At least 5 segments |
|
1567 TPtrC8I seg5 = NSmlDmURI::URISeg( aURI, 4 ); |
|
1568 if(seg5 == KNSmlIS_WebTargetsIDNodeName) |
|
1569 { |
|
1570 return CIsAdapter::EIsNodeWebTargetsXID; |
|
1571 } |
|
1572 else |
|
1573 if(seg5 == KNSmlIS_WebTargetsDescriptionNodeName) |
|
1574 { |
|
1575 return CIsAdapter::EIsNodeWebTargetsXDescription; |
|
1576 } |
|
1577 else |
|
1578 if(seg5 == KNSmlIS_WebTargetsURLNodeName) |
|
1579 { |
|
1580 return CIsAdapter::EIsNodeWebTargetsXURL; |
|
1581 } |
|
1582 else |
|
1583 if(seg5 == KNSmlIS_WebTargetsUserNameNodeName) |
|
1584 { |
|
1585 return CIsAdapter::EIsNodeWebTargetsXUserName; |
|
1586 } |
|
1587 else |
|
1588 if(seg5 == KNSmlIS_WebTargetsPasswordNodeName) |
|
1589 { |
|
1590 return CIsAdapter::EIsNodeWebTargetsXPassword; |
|
1591 } |
|
1592 else |
|
1593 if(seg5 == KNSmlIS_WebTargetsConRefNodeName) |
|
1594 { |
|
1595 return CIsAdapter::EIsNodeWebTargetsXConRef; |
|
1596 } |
|
1597 // ... |
|
1598 else |
|
1599 if(seg5 == KNSmlIS_WebTargetsCaptionNodeName) |
|
1600 { |
|
1601 return CIsAdapter::EIsNodeWebTargetsXCaption; |
|
1602 } |
|
1603 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1604 else |
|
1605 if(seg5 == KNSmlIS_WebTargetsImageNodeName) |
|
1606 { |
|
1607 return CIsAdapter::EIsNodeWebTargetsXImage; |
|
1608 } |
|
1609 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
1610 else |
|
1611 if(seg5 == KNSmlIS_WebTargetsMaskNodeName) |
|
1612 { |
|
1613 return CIsAdapter::EIsNodeWebTargetsXImageMask; |
|
1614 } |
|
1615 #endif |
|
1616 #endif |
|
1617 // ... |
|
1618 else |
|
1619 { |
|
1620 return CIsAdapter::EIsNodeNotUsedAndAlwaysLast; |
|
1621 } |
|
1622 } |
|
1623 else |
|
1624 { |
|
1625 return CIsAdapter::EIsNodeNotUsedAndAlwaysLast; |
|
1626 } |
|
1627 } |
|
1628 else |
|
1629 { |
|
1630 return CIsAdapter::EIsNodeNotUsedAndAlwaysLast; |
|
1631 } |
|
1632 } |
|
1633 else |
|
1634 { |
|
1635 return CIsAdapter::EIsNodeNotUsedAndAlwaysLast; |
|
1636 } |
|
1637 |
|
1638 // Note: do not return anything here |
|
1639 } |
|
1640 |
|
1641 |
|
1642 // ------------------------------------------------------------------------------------- |
|
1643 // CIsAdapter::CopyAndTrimMimeType |
|
1644 // ------------------------------------------------------------------------------------- |
|
1645 void CIsAdapter::CopyAndTrimMimeType(TDes8& aNewMime, const TDesC8& aType) |
|
1646 { |
|
1647 RDEBUG( "CIsAdapter::CopyAndTrimMimeType() >" ); |
|
1648 |
|
1649 if(aNewMime.MaxLength() < aType.Length()) |
|
1650 { |
|
1651 aNewMime.Copy( aType.Left(aNewMime.MaxLength()) ); |
|
1652 } |
|
1653 else |
|
1654 { |
|
1655 aNewMime.Copy( aType ); |
|
1656 } |
|
1657 aNewMime.TrimAll(); |
|
1658 aNewMime.LowerCase(); |
|
1659 |
|
1660 TInt pos; |
|
1661 while(( pos = aNewMime.Locate(' ') ) != KErrNotFound) |
|
1662 { |
|
1663 aNewMime.Delete(pos, 1); |
|
1664 } |
|
1665 |
|
1666 RDEBUG( "CIsAdapter::CopyAndTrimMimeType() <" ); |
|
1667 } |
|
1668 |
|
1669 // ------------------------------------------------------------------------------------- |
|
1670 // CIsAdapter::ListSoftkeysL |
|
1671 // ------------------------------------------------------------------------------------- |
|
1672 TInt CIsAdapter::ListSoftkeysL( CBufFlat &aList ) |
|
1673 { |
|
1674 RDEBUG( "CIsAdapter::ListSoftkeysL() >" ); |
|
1675 |
|
1676 TInt i; |
|
1677 for(i=0; i<NumberOfSoftkeys/*iUiSettings->GetSoftkeyCountL()*/; i++) |
|
1678 { |
|
1679 if(i>0) |
|
1680 { |
|
1681 aList.InsertL( aList.Size(), KNSmlISSeparator() ); |
|
1682 } |
|
1683 |
|
1684 HBufC8* softkeyName = GenerateSoftkeyNodeNameL( i ); |
|
1685 CleanupStack::PushL( softkeyName ); |
|
1686 |
|
1687 aList.InsertL( aList.Size(), *softkeyName ); |
|
1688 |
|
1689 CleanupStack::PopAndDestroy( softkeyName ); |
|
1690 } |
|
1691 |
|
1692 RDEBUG( "CIsAdapter::ListSoftkeysL() <" ); |
|
1693 return KErrNone; |
|
1694 } |
|
1695 |
|
1696 // ------------------------------------------------------------------------------------- |
|
1697 // CIsAdapter::GenerateSoftkeyNodeNameL |
|
1698 // ------------------------------------------------------------------------------------- |
|
1699 HBufC8* CIsAdapter::GenerateSoftkeyNodeNameL(TInt aIndex ) |
|
1700 { |
|
1701 RDEBUG( "CIsAdapter::GenerateSoftkeyNodeNameL() >" ); |
|
1702 |
|
1703 TInt index = aIndex; |
|
1704 |
|
1705 HBufC8* softkeyName = HBufC8::NewL( KPrefixSoftkeyNodeName().Length() |
|
1706 + MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64 ); |
|
1707 |
|
1708 TPtr8 ptr( softkeyName->Des() ); |
|
1709 |
|
1710 ptr.Format(KFormatSoftkeyNodeName, index+1); |
|
1711 |
|
1712 RDEBUG8_2( "CIsAdapter::GenerateSoftkeyNodeNameL() < %S", &softkeyName ); |
|
1713 return softkeyName; |
|
1714 } |
|
1715 |
|
1716 // ------------------------------------------------------------------------------------- |
|
1717 // CIsAdapter::GetSoftkeyIndexFromUid |
|
1718 // ------------------------------------------------------------------------------------- |
|
1719 TInt CIsAdapter::GetSoftkeyIndexFromUid( TInt aUid ) |
|
1720 { |
|
1721 RDEBUG( "CIsAdapter::GetSoftkeyIndexFromUid() >" ); |
|
1722 |
|
1723 switch( aUid ) |
|
1724 { |
|
1725 case KScActionTypeUidValueSoftkeyLeft: |
|
1726 return 0; |
|
1727 case KScActionTypeUidValueSoftkeyRight: |
|
1728 return 1; |
|
1729 case KScActionTypeUidValueScrollkeyLeft: |
|
1730 return 2; |
|
1731 case KScActionTypeUidValueScrollkeyRight: |
|
1732 return 3; |
|
1733 case KScActionTypeUidValueScrollkeyUp: |
|
1734 return 4; |
|
1735 case KScActionTypeUidValueScrollkeyDown: |
|
1736 return 5; |
|
1737 case KScActionTypeUidValueScrollkeySelect: |
|
1738 return 6; |
|
1739 case KActiveIdleScUidValueItem1: |
|
1740 return 7; |
|
1741 case KActiveIdleScUidValueItem2: |
|
1742 return 8; |
|
1743 case KActiveIdleScUidValueItem3: |
|
1744 return 9; |
|
1745 case KActiveIdleScUidValueItem4: |
|
1746 return 10; |
|
1747 case KActiveIdleScUidValueItem5: |
|
1748 return 11; |
|
1749 default: |
|
1750 return -1; |
|
1751 } |
|
1752 |
|
1753 // return aUid; |
|
1754 } |
|
1755 |
|
1756 // ------------------------------------------------------------------------------------- |
|
1757 // CIsAdapter::GetSoftkeyUidFromNodeNameL |
|
1758 // ------------------------------------------------------------------------------------- |
|
1759 TInt CIsAdapter::GetSoftkeyUidFromNodeNameL(const TDesC8& aNodeName) |
|
1760 { |
|
1761 RDEBUG( "CIsAdapter::GetSoftkeyUidFromNodeNameL() >" ); |
|
1762 |
|
1763 TInt index = -1; |
|
1764 TInt compareLen = KPrefixSoftkeyNodeName().Length(); |
|
1765 if(aNodeName.Left(compareLen) == KFormatSoftkeyNodeName().Left(compareLen)) |
|
1766 { |
|
1767 TLex8 lex; |
|
1768 lex.Assign( aNodeName ); |
|
1769 |
|
1770 lex.Inc( compareLen ); |
|
1771 User::LeaveIfError( lex.Val(index) ); |
|
1772 index--; |
|
1773 User::LeaveIfError( index>=0 && index<NumberOfSoftkeys/*iUiSettings->GetSoftkeyCountL()*/ ? KErrNone : KErrGeneral ); |
|
1774 |
|
1775 HBufC8* softkeyName = GenerateSoftkeyNodeNameL( index ); |
|
1776 CleanupStack::PushL( softkeyName ); |
|
1777 |
|
1778 TPtr8 ptr( softkeyName->Des() ); |
|
1779 User::LeaveIfError( ptr == aNodeName ? KErrNone : KErrGeneral ); |
|
1780 |
|
1781 CleanupStack::PopAndDestroy( softkeyName ); |
|
1782 } |
|
1783 else |
|
1784 { |
|
1785 User::Leave( KErrNotFound ); |
|
1786 } |
|
1787 |
|
1788 RDEBUG_2( "CIsAdapter::GetSoftkeyUidFromNodeNameL() < %d", iSoftkeyList[ index ] ); |
|
1789 return iSoftkeyList[ index ]; |
|
1790 } |
|
1791 |
|
1792 // ------------------------------------------------------------------------------------- |
|
1793 // CIsAdapter::AddShortcutNameL |
|
1794 // ------------------------------------------------------------------------------------- |
|
1795 void CIsAdapter::AddShortcutNameL(CBufFlat& aBuffer, TInt aUid) |
|
1796 { |
|
1797 RDEBUG( "CIsAdapter::AddShortcutNameL() >" ); |
|
1798 |
|
1799 switch( aUid ) |
|
1800 { |
|
1801 |
|
1802 case KScActionTypeUidValueSoftkeyLeft: |
|
1803 aBuffer.InsertL( aBuffer.Size(), KISLeftSoftkeyName() ); |
|
1804 break; |
|
1805 case KScActionTypeUidValueSoftkeyRight: |
|
1806 aBuffer.InsertL( aBuffer.Size(), KISRightSoftkeyName() ); |
|
1807 break; |
|
1808 case KScActionTypeUidValueScrollkeyLeft: |
|
1809 aBuffer.InsertL( aBuffer.Size(), KISScrollLeftSoftkeyName() ); |
|
1810 break; |
|
1811 case KScActionTypeUidValueScrollkeyRight: |
|
1812 aBuffer.InsertL( aBuffer.Size(), KISScrollRightSoftkeyName() ); |
|
1813 break; |
|
1814 case KScActionTypeUidValueScrollkeyUp: |
|
1815 aBuffer.InsertL( aBuffer.Size(), KISScrollUpSoftkeyName() ); |
|
1816 break; |
|
1817 case KScActionTypeUidValueScrollkeyDown: |
|
1818 aBuffer.InsertL( aBuffer.Size(), KISScrollDownSoftkeyName() ); |
|
1819 break; |
|
1820 case KScActionTypeUidValueScrollkeySelect: |
|
1821 aBuffer.InsertL( aBuffer.Size(), KISSelectionSoftkeyName() ); |
|
1822 break; |
|
1823 |
|
1824 case KActiveIdleScUidValueItem1: |
|
1825 aBuffer.InsertL( aBuffer.Size(), KISAISoftkeyName1() ); |
|
1826 break; |
|
1827 case KActiveIdleScUidValueItem2: |
|
1828 aBuffer.InsertL( aBuffer.Size(), KISAISoftkeyName2() ); |
|
1829 break; |
|
1830 case KActiveIdleScUidValueItem3: |
|
1831 aBuffer.InsertL( aBuffer.Size(), KISAISoftkeyName3() ); |
|
1832 break; |
|
1833 case KActiveIdleScUidValueItem4: |
|
1834 aBuffer.InsertL( aBuffer.Size(), KISAISoftkeyName4() ); |
|
1835 break; |
|
1836 case KActiveIdleScUidValueItem5: |
|
1837 aBuffer.InsertL( aBuffer.Size(), KISAISoftkeyName5() ); |
|
1838 break; |
|
1839 case KActiveIdleScUidValueItem6: |
|
1840 aBuffer.InsertL( aBuffer.Size(), KISAISoftkeyName6() ); |
|
1841 break; |
|
1842 |
|
1843 |
|
1844 |
|
1845 } |
|
1846 RDEBUG( "CIsAdapter::AddShortcutNameL() <" ); |
|
1847 } |
|
1848 |
|
1849 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1850 |
|
1851 void CIsAdapter::GetSoftkeyImageL( |
|
1852 TInt /*aSoftkeyUid*/, |
|
1853 CBufFlat &aImageBuffer, |
|
1854 TBool /*aGetMask*//*=EFalse*/ ) |
|
1855 { |
|
1856 RDEBUG( "CIsAdapter::GetSoftkeyImageL() >" ); |
|
1857 |
|
1858 TFileName filename; |
|
1859 TBuf8<128> mimetype; |
|
1860 |
|
1861 |
|
1862 |
|
1863 /* |
|
1864 |
|
1865 if( aGetMask ) |
|
1866 { |
|
1867 User::LeaveIfError( iUiSrv.GetSoftkeyMask( |
|
1868 aSoftkeyUid, |
|
1869 filename, |
|
1870 mimetype |
|
1871 ) ); |
|
1872 } |
|
1873 else |
|
1874 { |
|
1875 User::LeaveIfError( iUiSrv.GetSoftkeyBitmap( |
|
1876 aSoftkeyUid, |
|
1877 filename, |
|
1878 mimetype |
|
1879 ) ); |
|
1880 } |
|
1881 |
|
1882 */ |
|
1883 |
|
1884 RFs fileSession; |
|
1885 RFile file; |
|
1886 |
|
1887 User::LeaveIfError( fileSession.Connect() ); |
|
1888 CleanupClosePushL( fileSession ); |
|
1889 |
|
1890 // |
|
1891 // Create new temp file |
|
1892 // |
|
1893 User::LeaveIfError( file.Open( fileSession, filename, EFileRead ) ); |
|
1894 CleanupClosePushL( file ); |
|
1895 |
|
1896 // |
|
1897 // Decode data to buffer |
|
1898 // |
|
1899 TInt size = 0; |
|
1900 file.Size( size ); |
|
1901 HBufC8* buffer = HBufC8::NewLC( size ); |
|
1902 |
|
1903 TPtr8 ptr( 0, 0 ); |
|
1904 ptr.Set( buffer->Des() ); |
|
1905 User::LeaveIfError( file.Read( ptr ) ); |
|
1906 |
|
1907 EncodeImageL( aImageBuffer, ptr ); |
|
1908 |
|
1909 CleanupStack::PopAndDestroy( buffer ); |
|
1910 |
|
1911 // Close file |
|
1912 CleanupStack::PopAndDestroy( &file ); |
|
1913 |
|
1914 // Close fileSession |
|
1915 CleanupStack::PopAndDestroy( &fileSession ); |
|
1916 |
|
1917 RDEBUG( "CIsAdapter::GetSoftkeyImageL() <" ); |
|
1918 } |
|
1919 |
|
1920 #endif |
|
1921 |
|
1922 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1923 |
|
1924 // ------------------------------------------------------------------------------------- |
|
1925 // CIsAdapter::GetApplicationImageL |
|
1926 // ------------------------------------------------------------------------------------- |
|
1927 void CIsAdapter::GetApplicationImageL( |
|
1928 TInt aIndex, |
|
1929 CBufFlat &aImageBuffer, |
|
1930 TBool aGetMask/*=EFalse*/ ) |
|
1931 { |
|
1932 RDEBUG( "CIsAdapter::GetApplicationImageL() >" ); |
|
1933 |
|
1934 GetShortcutImageL( |
|
1935 EUiSrvRtTypeApp, |
|
1936 aIndex, |
|
1937 aImageBuffer, |
|
1938 aGetMask |
|
1939 ); |
|
1940 |
|
1941 RDEBUG( "CIsAdapter::GetApplicationImageL() <" ); |
|
1942 } |
|
1943 |
|
1944 // ------------------------------------------------------------------------------------- |
|
1945 // CIsAdapter::GetBookmarkImageL |
|
1946 // ------------------------------------------------------------------------------------- |
|
1947 void CIsAdapter::GetBookmarkImageL( |
|
1948 TInt aIndex, |
|
1949 CBufFlat &aImageBuffer, |
|
1950 TBool aGetMask/*=EFalse*/ ) |
|
1951 { |
|
1952 RDEBUG( "CIsAdapter::GetBookmarkImageL() >" ); |
|
1953 |
|
1954 GetShortcutImageL( |
|
1955 EUiSrvRtTypeBm, |
|
1956 aIndex, |
|
1957 aImageBuffer, |
|
1958 aGetMask |
|
1959 ); |
|
1960 |
|
1961 RDEBUG( "CIsAdapter::GetBookmarkImageL() <" ); |
|
1962 } |
|
1963 |
|
1964 #endif |
|
1965 |
|
1966 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
1967 |
|
1968 // ------------------------------------------------------------------------------------- |
|
1969 // CIsAdapter::GetShortcutImageL |
|
1970 // ------------------------------------------------------------------------------------- |
|
1971 void CIsAdapter::GetShortcutImageL( |
|
1972 TInt aRtMask, |
|
1973 TInt aIndex, |
|
1974 CBufFlat &aImageBuffer, |
|
1975 TBool aGetMask/*=EFalse*/ ) |
|
1976 { |
|
1977 RDEBUG( "CIsAdapter::GetShortcutImageL() >" ); |
|
1978 TFileName filename; |
|
1979 TBuf8<128> mimetype; |
|
1980 |
|
1981 if( aGetMask ) |
|
1982 { |
|
1983 User::LeaveIfError( iUiSrv.GetShortcutTargetMask( |
|
1984 aRtMask, |
|
1985 aIndex, |
|
1986 filename, |
|
1987 mimetype |
|
1988 ) ); |
|
1989 } |
|
1990 else |
|
1991 { |
|
1992 User::LeaveIfError( iUiSrv.GetShortcutTargetBitmap( |
|
1993 aRtMask, |
|
1994 aIndex, |
|
1995 filename, |
|
1996 mimetype |
|
1997 ) ); |
|
1998 } |
|
1999 |
|
2000 RFs fileSession; |
|
2001 RFile file; |
|
2002 |
|
2003 User::LeaveIfError( fileSession.Connect() ); |
|
2004 CleanupClosePushL( fileSession ); |
|
2005 |
|
2006 // |
|
2007 // Create new temp file |
|
2008 // |
|
2009 User::LeaveIfError( file.Open( fileSession, filename, EFileRead ) ); |
|
2010 CleanupClosePushL( file ); |
|
2011 |
|
2012 // |
|
2013 // Decode data to buffer |
|
2014 // |
|
2015 TInt size = 0; |
|
2016 file.Size( size ); |
|
2017 HBufC8* buffer = HBufC8::NewLC( size ); |
|
2018 |
|
2019 TPtr8 ptr( 0, 0 ); |
|
2020 ptr.Set( buffer->Des() ); |
|
2021 User::LeaveIfError( file.Read( ptr ) ); |
|
2022 |
|
2023 EncodeImageL( aImageBuffer, ptr ); |
|
2024 |
|
2025 CleanupStack::PopAndDestroy( buffer ); |
|
2026 |
|
2027 // Close file |
|
2028 CleanupStack::PopAndDestroy( &file ); |
|
2029 |
|
2030 // Close fileSession |
|
2031 CleanupStack::PopAndDestroy( &fileSession ); |
|
2032 |
|
2033 RDEBUG( "CIsAdapter::GetShortcutImageL() <" ); |
|
2034 } |
|
2035 #endif |
|
2036 |
|
2037 #ifdef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
2038 void CIsAdapter::SetSoftkeyImageL ( |
|
2039 const TDesC8& aURI, |
|
2040 const TDesC8& aObject, |
|
2041 const TDesC8& aType) |
|
2042 { |
|
2043 RDEBUG( "CIsAdapter::SetSoftkeyImageL() >" ); |
|
2044 |
|
2045 // SymbianConvergency NOTE! Functions that call this function will parse off the "./" |
|
2046 // from the aURI -> no need to parse "./" here |
|
2047 |
|
2048 if( aType.Length() == 0 ) |
|
2049 { |
|
2050 RDEBUG( "CIsAdapter::SetSoftkeyImageL() WARNING Mime type is empty!" ); |
|
2051 } |
|
2052 |
|
2053 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( aURI ); |
|
2054 TInt softkeyUid = 0; |
|
2055 |
|
2056 if( |
|
2057 |
|
2058 (EIsNodeSoftKeysXImage != identifier) |
|
2059 |
|
2060 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
2061 |
|
2062 && (EIsNodeSoftKeysXMask != identifier) |
|
2063 |
|
2064 #endif |
|
2065 |
|
2066 ) |
|
2067 { |
|
2068 User::Leave( KErrArgument ); |
|
2069 } |
|
2070 |
|
2071 // |
|
2072 // Get shortcut target index |
|
2073 // |
|
2074 switch( identifier ) |
|
2075 { |
|
2076 |
|
2077 // Softkeys/* |
|
2078 case EIsNodeSoftKeysXImage: |
|
2079 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
2080 case EIsNodeSoftKeysXMask: |
|
2081 #endif |
|
2082 { |
|
2083 softkeyUid = GetSoftkeyUidFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ) ); |
|
2084 if(softkeyUid) |
|
2085 RDEBUG_2( "CIsAdapter::GetShortcutImageL() < %d", softkeyUid ); |
|
2086 } |
|
2087 break; |
|
2088 |
|
2089 default: |
|
2090 User::Leave( KErrArgument ); |
|
2091 break; |
|
2092 |
|
2093 } |
|
2094 |
|
2095 // |
|
2096 // Decode image data |
|
2097 // |
|
2098 DecodeImageToFileL( aObject ); |
|
2099 /* |
|
2100 switch( identifier ) |
|
2101 { |
|
2102 case EIsNodeSoftKeysXImage: |
|
2103 User::LeaveIfError( iUiSrv.SetSoftkeyBitmap( |
|
2104 softkeyUid, |
|
2105 iTemporaryImageFile, |
|
2106 aType ) ); |
|
2107 break; |
|
2108 |
|
2109 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
2110 case EIsNodeSoftKeysXMask: |
|
2111 User::LeaveIfError( iUiSrv.SetSoftkeyMask( |
|
2112 softkeyUid, |
|
2113 iTemporaryImageFile, |
|
2114 aType ) ); |
|
2115 break; |
|
2116 |
|
2117 #endif |
|
2118 } |
|
2119 */ |
|
2120 |
|
2121 RDEBUG( "CIsAdapter::SetSoftkeyImageL() <" ); |
|
2122 } |
|
2123 #endif |
|
2124 |
|
2125 #ifndef IDLESOFTKEY_ADAPTER_SOFTKEY_IMAGES |
|
2126 // ------------------------------------------------------------------------------------- |
|
2127 // CIsAdapter::SetShortcutTargetImageL |
|
2128 // ------------------------------------------------------------------------------------- |
|
2129 void CIsAdapter::SetShortcutTargetImageL( |
|
2130 const TDesC8& aURI, |
|
2131 const TDesC8& aObject, |
|
2132 const TDesC8& aType) |
|
2133 { |
|
2134 RDEBUG( "CIsAdapter::SetShortcutTargetImageL() >" ); |
|
2135 |
|
2136 // SymbianConvergency NOTE! Functions that call this function will parse off the "./" |
|
2137 // from the aURI -> no need to parse "./" here |
|
2138 |
|
2139 if( aType.Length() == 0 ) |
|
2140 { |
|
2141 RDEBUG( "CIsAdapter::SetShortcutTargetImageL() WARNING Mime type is empty!" ); |
|
2142 } |
|
2143 |
|
2144 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( aURI ); |
|
2145 TInt targetIndex = 0; |
|
2146 |
|
2147 if( |
|
2148 (EIsNodeTargetsXImage != identifier) |
|
2149 && (EIsNodeWebTargetsXImage != identifier) |
|
2150 |
|
2151 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
2152 |
|
2153 && (EIsNodeTargetsXImageMask != identifier) |
|
2154 && (EIsNodeWebTargetsXImageMask != identifier) |
|
2155 |
|
2156 #endif |
|
2157 |
|
2158 ) |
|
2159 { |
|
2160 User::Leave( KErrArgument ); |
|
2161 } |
|
2162 |
|
2163 // |
|
2164 // Get shortcut target index |
|
2165 // |
|
2166 switch( identifier ) |
|
2167 { |
|
2168 |
|
2169 // Targets/* |
|
2170 case EIsNodeTargetsXImage: |
|
2171 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
2172 case EIsNodeTargetsXImageMask: |
|
2173 #endif |
|
2174 { |
|
2175 TBuf8<ISADAPTER_SHORTCUT_CAPTION_MAXLENGTH> caption; |
|
2176 iAppTargetManager->GetTargetFromNodeNameL( NSmlDmURI::URISeg( aURI, 3 ), targetIndex, caption ); |
|
2177 } |
|
2178 |
|
2179 break; |
|
2180 |
|
2181 // WebTargets/* |
|
2182 case EIsNodeWebTargetsXImage: |
|
2183 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
2184 case EIsNodeWebTargetsXImageMask: |
|
2185 #endif |
|
2186 { |
|
2187 iWebTargetManager->CheckWebTargetsL(); |
|
2188 CFavouritesItem *favItem = CFavouritesItem::NewLC(); |
|
2189 RDEBUG_2( _L("CIsAdapter::SetShortcutTargetImageL() CFavouritesItem ALLOC %x"), favItem); |
|
2190 if( KErrNone != |
|
2191 iWebTargetManager->GetTargetFromNodeNameL( NSmlDmURI::URISeg( aURI, 0, 4 ), *favItem, targetIndex ) ) |
|
2192 { |
|
2193 User::Leave( KErrNotFound ); |
|
2194 } |
|
2195 CleanupStack::PopAndDestroy( favItem ); |
|
2196 } |
|
2197 |
|
2198 break; |
|
2199 |
|
2200 } |
|
2201 |
|
2202 // |
|
2203 // Decode image data |
|
2204 // |
|
2205 DecodeImageToFileL( aObject ); |
|
2206 |
|
2207 switch( identifier ) |
|
2208 { |
|
2209 case EIsNodeTargetsXImage: |
|
2210 User::LeaveIfError( iUiSrv.SetShortcutTargetBitmap( EUiSrvRtTypeApp, |
|
2211 targetIndex, |
|
2212 iTemporaryImageFile, |
|
2213 aType ) ); |
|
2214 break; |
|
2215 |
|
2216 case EIsNodeWebTargetsXImage: |
|
2217 User::LeaveIfError( iUiSrv.SetShortcutTargetBitmap( EUiSrvRtTypeBm, |
|
2218 targetIndex, |
|
2219 iTemporaryImageFile, |
|
2220 aType ) ); |
|
2221 break; |
|
2222 |
|
2223 #ifdef IDLESOFTKEY_ADAPTER_IMAGEMASK |
|
2224 case EIsNodeTargetsXImageMask: |
|
2225 User::LeaveIfError( iUiSrv.SetShortcutTargetMask( EUiSrvRtTypeApp, |
|
2226 targetIndex, |
|
2227 iTemporaryImageFile, |
|
2228 aType ) ); |
|
2229 break; |
|
2230 |
|
2231 case EIsNodeWebTargetsXImageMask: |
|
2232 User::LeaveIfError( iUiSrv.SetShortcutTargetMask( EUiSrvRtTypeBm, |
|
2233 targetIndex, |
|
2234 iTemporaryImageFile, |
|
2235 aType ) ); |
|
2236 break; |
|
2237 #endif |
|
2238 } |
|
2239 |
|
2240 RDEBUG( "CIsAdapter::SetShortcutTargetImageL() <" ); |
|
2241 } |
|
2242 #endif |
|
2243 |
|
2244 // ------------------------------------------------------------------------------------- |
|
2245 // CIsAdapter::DecodeImageToFileL |
|
2246 // ------------------------------------------------------------------------------------- |
|
2247 TInt CIsAdapter::DecodeImageToFileL( const TDesC8& aObject ) |
|
2248 { |
|
2249 RDEBUG( "CIsAdapter::DecodeImageToFileL() >" ); |
|
2250 |
|
2251 // |
|
2252 // Write file to a temp file |
|
2253 // |
|
2254 RFs fileSession; |
|
2255 RFile file; |
|
2256 |
|
2257 User::LeaveIfError( fileSession.Connect() ); |
|
2258 CleanupClosePushL( fileSession ); |
|
2259 |
|
2260 // |
|
2261 // Delete previous temp file |
|
2262 // |
|
2263 if( iTemporaryImageFile.Length() > 0 ) |
|
2264 { |
|
2265 fileSession.Delete( iTemporaryImageFile ); |
|
2266 iTemporaryImageFile.Zero(); |
|
2267 } |
|
2268 |
|
2269 // |
|
2270 // Create new temp file |
|
2271 // |
|
2272 User::LeaveIfError( file.Temp( fileSession, KTempFilePath, iTemporaryImageFile, EFileWrite ) ); |
|
2273 CleanupClosePushL( file ); |
|
2274 |
|
2275 // |
|
2276 // Decode data to buffer |
|
2277 // |
|
2278 CBufFlat* buffer = CBufFlat::NewL( 128 ); |
|
2279 CleanupStack::PushL( buffer ); |
|
2280 DecodeImageL( *buffer, aObject ); |
|
2281 |
|
2282 // Write buffer to file and release buffer |
|
2283 User::LeaveIfError( file.Write( buffer->Ptr(0) ) ); |
|
2284 CleanupStack::PopAndDestroy( buffer ); |
|
2285 |
|
2286 // Close file |
|
2287 CleanupStack::PopAndDestroy( &file ); |
|
2288 |
|
2289 // Close fileSession |
|
2290 CleanupStack::PopAndDestroy( &fileSession ); |
|
2291 |
|
2292 RDEBUG( "CIsAdapter::DecodeImageToFileL() <" ); |
|
2293 return KErrNone; |
|
2294 } |
|
2295 |
|
2296 // ------------------------------------------------------------------------------------- |
|
2297 // CIsAdapter::DecodeImageL |
|
2298 // ------------------------------------------------------------------------------------- |
|
2299 void CIsAdapter::DecodeImageL( CBufFlat& aBuffer, const TDesC8& aObject ) |
|
2300 { |
|
2301 RDEBUG( "CIsAdapter::DecodeImageL() >" ); |
|
2302 |
|
2303 // |
|
2304 // Decoce from base 64 |
|
2305 // |
|
2306 TImCodecB64 B64Coder; |
|
2307 HBufC8 *uncoded = HBufC8::NewLC( ( aObject.Length() * 3 ) / 4 + 16 ); |
|
2308 RDEBUG_2( "CIsAdapter::DecodeImageL() HBufC8 uncoded ALLOC %x", uncoded); |
|
2309 TPtr8 uncodedPtr( uncoded->Des() ); |
|
2310 |
|
2311 TBool uncodeResult = TFileCoderB64::CheckB64Encode( aObject );// |
|
2312 |
|
2313 if( uncodeResult ) |
|
2314 { |
|
2315 // use base64 decode |
|
2316 B64Coder.Decode( aObject, uncodedPtr ); |
|
2317 aBuffer.InsertL( 0, uncodedPtr ); |
|
2318 } |
|
2319 else |
|
2320 { |
|
2321 // original data |
|
2322 aBuffer.InsertL( 0, aObject ); |
|
2323 } |
|
2324 |
|
2325 CleanupStack::PopAndDestroy( uncoded ); |
|
2326 |
|
2327 RDEBUG( "CIsAdapter::DecodeImageL() <" ); |
|
2328 } |
|
2329 |
|
2330 // ------------------------------------------------------------------------------------- |
|
2331 // CIsAdapter::EncodeImageL |
|
2332 // ------------------------------------------------------------------------------------- |
|
2333 void CIsAdapter::EncodeImageL( CBufFlat& aBuffer, const TDesC8& aObject ) |
|
2334 { |
|
2335 RDEBUG( "CIsAdapter::EncodeImageL() >" ); |
|
2336 |
|
2337 // |
|
2338 // Decoce from base 64 |
|
2339 // |
|
2340 TImCodecB64 B64Coder; |
|
2341 HBufC8 *encoded = HBufC8::NewLC( ( aObject.Length() * 4 ) / 3 + 16 ); |
|
2342 RDEBUG_2( "CIsAdapter::EncodeImageL() HBufC8 encoded ALLOC %x", encoded); |
|
2343 TPtr8 encodedPtr( encoded->Des() ); |
|
2344 TBool encodeResult = B64Coder.Encode( aObject, encodedPtr ); |
|
2345 |
|
2346 aBuffer.InsertL( 0, encodedPtr ); |
|
2347 |
|
2348 CleanupStack::PopAndDestroy( encoded ); |
|
2349 |
|
2350 RDEBUG( "CIsAdapter::EncodeImageL() <" ); |
|
2351 } |
|
2352 |
|
2353 // ------------------------------------------------------------------------------------- |
|
2354 // CIsAdapter::GetShortcutTargetURIL |
|
2355 // ------------------------------------------------------------------------------------- |
|
2356 CSmlDmAdapter::TError CIsAdapter::GetShortcutTargetURIL(CBufFlat& aBuffer, TInt aUid ) |
|
2357 { |
|
2358 RDEBUG( "CIsAdapter::GetShortcutTargetURIL() >" ); |
|
2359 |
|
2360 TInt rtType = 0; |
|
2361 if(iUiSettingsNotInitialized) |
|
2362 { |
|
2363 iUiSettings->ReadTargetsL() ; |
|
2364 iUiSettings->ReadBookmarksL() ; |
|
2365 iUiSettingsNotInitialized = EFalse; |
|
2366 } |
|
2367 iUiSettings->GetShortcutRtTypeL( aUid, rtType ); |
|
2368 // TScActionType acType = TUid::Uid( aUid ); |
|
2369 CSmlDmAdapter::TError retVal = CSmlDmAdapter::EOk; |
|
2370 |
|
2371 |
|
2372 switch( rtType ) |
|
2373 { |
|
2374 default: |
|
2375 { |
|
2376 TInt index = -1; |
|
2377 User::LeaveIfError(iUiSettings->GetShortcutTargetIndexL( aUid, index )); |
|
2378 |
|
2379 if( index == -1 ) |
|
2380 { |
|
2381 return CSmlDmAdapter::ENotFound; |
|
2382 } |
|
2383 else |
|
2384 { |
|
2385 HBufC8* nodeName = iAppTargetManager->GenerateNodeNameL( index ); |
|
2386 CleanupStack::PushL( nodeName ); |
|
2387 aBuffer.InsertL( aBuffer.Size(), KNSmlCustomizationNodeName() ); |
|
2388 aBuffer.InsertL( aBuffer.Size(), KNSmlISSeparator() ); |
|
2389 aBuffer.InsertL( aBuffer.Size(), KNSmlIS_IdleSoftKeyNodeName() ); |
|
2390 aBuffer.InsertL( aBuffer.Size(), KNSmlISSeparator() ); |
|
2391 aBuffer.InsertL( aBuffer.Size(), KNSmlIS_TargetsNodeName() ); |
|
2392 aBuffer.InsertL( aBuffer.Size(), KNSmlISSeparator() ); |
|
2393 aBuffer.InsertL( aBuffer.Size(), *nodeName ); |
|
2394 CleanupStack::PopAndDestroy( nodeName ); |
|
2395 |
|
2396 return CSmlDmAdapter::EOk; |
|
2397 } |
|
2398 } |
|
2399 |
|
2400 |
|
2401 case KScRtTypeUidValueBookmark: |
|
2402 { |
|
2403 TInt bmId = -1, index = -1; |
|
2404 User::LeaveIfError(iUiSettings->GetShortcutTargetIndexL( aUid, index )); |
|
2405 User::LeaveIfError(iUiSettings->GetWebTargetAppUid( index, bmId )); |
|
2406 |
|
2407 TBuf8<MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64> numBuf; |
|
2408 numBuf.Num( bmId ); |
|
2409 TInt ind = -1; |
|
2410 |
|
2411 HBufC8* dataH = HBufC8::NewLC( KRepositoryEntryMaxLength ); |
|
2412 TPtr8 data( dataH->Des() ); |
|
2413 TBool ret = iWebTargetManager->FindURIByLUIDL( data, numBuf, ind ); |
|
2414 User::LeaveIfError( ret ); |
|
2415 |
|
2416 aBuffer.InsertL( aBuffer.Size(), data ); |
|
2417 |
|
2418 CleanupStack::PopAndDestroy( dataH ); |
|
2419 } |
|
2420 break; |
|
2421 |
|
2422 } |
|
2423 |
|
2424 |
|
2425 RDEBUG_2( "CIsAdapter::GetShortcutTargetURIL() < %d", retVal ); |
|
2426 return retVal; |
|
2427 } |
|
2428 |
|
2429 // ------------------------------------------------------------------------------------- |
|
2430 // CIsAdapter::SetShortcutTargetL |
|
2431 // ------------------------------------------------------------------------------------- |
|
2432 void CIsAdapter::SetShortcutTargetL(const TDesC8& aURI, TInt aUid) |
|
2433 { |
|
2434 RDEBUG8_2( "CIsAdapter::SetShortcutTargetL() > %S ", &aURI ); |
|
2435 |
|
2436 // SymbianConvergency NOTE! this should be ok, for the aURI part |
|
2437 if(iUiSettingsNotInitialized) |
|
2438 { |
|
2439 iUiSettings->ReadTargetsL() ; |
|
2440 iUiSettings->ReadBookmarksL() ; |
|
2441 iUiSettingsNotInitialized = EFalse; |
|
2442 } |
|
2443 TPtrC8 uri( aURI ); |
|
2444 if( uri.Left(2).Compare( _L8("./") ) == 0 ) |
|
2445 { |
|
2446 uri.Set( aURI.Right( aURI.Length() - 2 ) ); |
|
2447 } |
|
2448 |
|
2449 CIsAdapter::TIsNodeIdentifier identifier = GetNodeIdentifier( uri ); |
|
2450 if( (EIsNodeTargetsX != identifier) && |
|
2451 (EIsNodeWebTargetsX != identifier) ) |
|
2452 { |
|
2453 User::Leave( KErrArgument ); |
|
2454 } |
|
2455 |
|
2456 HBufC16* buf = CreateCopy16LC( uri ); |
|
2457 TPtrC8 targetNode = NSmlDmURI::URISeg( uri, 2 ); |
|
2458 TPtrC8 segment = NSmlDmURI::URISeg( uri, 3 ); |
|
2459 TInt index = -1; |
|
2460 |
|
2461 if( targetNode == KNSmlIS_WebTargetsNodeName() ) |
|
2462 { |
|
2463 iWebTargetManager->CheckWebTargetsL(); |
|
2464 CFavouritesItem *favItem = CFavouritesItem::NewLC(); |
|
2465 RDEBUG_2( "CIsAdapter::SetShortcutTargetL() CFavouritesItem ALLOC %x", favItem); |
|
2466 |
|
2467 TInt status = KErrNone; |
|
2468 TRAPD( reason, |
|
2469 status = iWebTargetManager->GetTargetFromNodeNameL( uri, *favItem, index ) ); |
|
2470 if( (KErrNone == reason) && (0 != favItem) && (KErrNone == status) && (-1 != index) ) |
|
2471 { |
|
2472 User::LeaveIfError(iUiSettings->SetShortcutTargetWebIndexL (aUid, index)); |
|
2473 } |
|
2474 else |
|
2475 { |
|
2476 RDEBUG8_2( "CIsAdapter::SetShortcutTargetL: Error in argument, WebTarget %S", &targetNode); |
|
2477 User::Leave( KErrArgument ); |
|
2478 } |
|
2479 |
|
2480 CleanupStack::PopAndDestroy( favItem ); |
|
2481 } |
|
2482 else |
|
2483 { |
|
2484 if( targetNode == KNSmlIS_TargetsNodeName() ) |
|
2485 { |
|
2486 // Set new target |
|
2487 TBuf8<ISADAPTER_SHORTCUT_CAPTION_MAXLENGTH> caption; |
|
2488 iAppTargetManager->GetTargetFromNodeNameL( segment, index, caption ); |
|
2489 User::LeaveIfError(iUiSettings->SetShortcutTargetAppIndexL (aUid, index)); |
|
2490 } |
|
2491 else |
|
2492 { |
|
2493 RDEBUG8_2( "CIsAdapter::SetShortcutTargetL: Error in argument, AppTarget %S", &targetNode); |
|
2494 User::Leave( KErrArgument ); |
|
2495 } |
|
2496 } |
|
2497 |
|
2498 CleanupStack::PopAndDestroy( buf ); |
|
2499 |
|
2500 RDEBUG( "CIsAdapter::SetShortcutTargetL() <" ); |
|
2501 } |
|
2502 |
|
2503 // ------------------------------------------------------------------------------------- |
|
2504 // CIsAdapter::CreateCopy16LC |
|
2505 // ------------------------------------------------------------------------------------- |
|
2506 HBufC16* CIsAdapter::CreateCopy16LC( const TDesC8& aText ) |
|
2507 { |
|
2508 RDEBUG( "CIsAdapter::CreateCopy16LC() >" ); |
|
2509 |
|
2510 HBufC16* buf = HBufC16::NewLC( aText.Length() ); |
|
2511 RDEBUG_2( "CIsAdapter::CreateCopy16LC() HBufC16 buf ALLOC %x", buf); |
|
2512 buf->Des().Copy( aText ); |
|
2513 |
|
2514 RDEBUG( "CIsAdapter::CreateCopy16LC() <" ); |
|
2515 return buf; |
|
2516 } |
|
2517 |
|
2518 // ----------------------------------------------------------------------------- |
|
2519 // CIsAdapter::PolicyRequestResourceL |
|
2520 // ----------------------------------------------------------------------------- |
|
2521 // |
|
2522 //#ifdef __SAP_POLICY_MANAGEMENT |
|
2523 TPtrC8 CIsAdapter::PolicyRequestResourceL( const TDesC8& /*aURI*/ ) |
|
2524 { |
|
2525 if(! FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement )) |
|
2526 { |
|
2527 User::Leave(KErrNotSupported); |
|
2528 } |
|
2529 |
|
2530 RDEBUG8_2( "CIsAdapter::PolicyRequestResourceL() >< %S", |
|
2531 &PolicyEngineXACML::KCustomizationManagement() ); |
|
2532 |
|
2533 return PolicyEngineXACML::KCustomizationManagement(); |
|
2534 |
|
2535 } |
|
2536 //#endif |
|
2537 |