85
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
|
|
21 |
#include "cadef.h"
|
|
22 |
#include "cawidgetdescription.h"
|
|
23 |
#include "cainnerentry.h"
|
|
24 |
#include "widgetscannerutils.h"
|
96
|
25 |
#include "hbtextresolversymbian.h"
|
85
|
26 |
|
96
|
27 |
#include "cawidgetscannerdef.h"
|
85
|
28 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
29 |
|
|
30 |
// -----------------------------------------------------------------------------
|
|
31 |
// CCaWidgetDescription::CCaWidgetDescription
|
|
32 |
// C++ default constructor can NOT contain any code, that
|
|
33 |
// might leave.
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
//
|
|
36 |
CCaWidgetDescription::CCaWidgetDescription() :
|
93
|
37 |
iEntryId(KNoId), iMmcId()
|
85
|
38 |
{
|
|
39 |
}
|
|
40 |
|
|
41 |
// -----------------------------------------------------------------------------
|
|
42 |
// CCaWidgetDescription::ConstructL
|
|
43 |
// Symbian 2nd phase constructor can leave.
|
|
44 |
// -----------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
void CCaWidgetDescription::ConstructL( )
|
|
47 |
{
|
|
48 |
}
|
|
49 |
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
// CCaWidgetDescription::ConstructL
|
|
52 |
// Symbian 2nd phase constructor can leave.
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
void CCaWidgetDescription::ConstructL( CCaInnerEntry* aEntry )
|
|
56 |
{
|
|
57 |
iEntryId = aEntry->GetId();
|
92
|
58 |
iDescription.CreateL( aEntry->GetDescription() );
|
85
|
59 |
//package uid
|
|
60 |
TBuf<KMaxUidName> uidDesc;
|
|
61 |
aEntry->FindAttribute( KCaPackageUid, uidDesc );
|
|
62 |
if ( uidDesc.Length() )
|
87
|
63 |
{
|
|
64 |
TLex uidLex(uidDesc);
|
|
65 |
User::LeaveIfError( uidLex.Val( iPackageUid, EHex ));
|
|
66 |
}
|
92
|
67 |
iTitle.CreateL( aEntry->GetText() );
|
|
68 |
iIconUri.CreateL( aEntry->Icon()->FileName() );
|
85
|
69 |
//library
|
|
70 |
iLibrary.CreateL( KCaMaxAttrValueLen );
|
|
71 |
aEntry->FindAttribute( KAttrWidgetLibrary, iLibrary );
|
89
|
72 |
//path
|
|
73 |
iPath.CreateL( KCaMaxAttrValueLen );
|
|
74 |
aEntry->FindAttribute( KAttrWidgetPath, iPath );
|
85
|
75 |
//uri
|
|
76 |
iUri.CreateL( KCaMaxAttrValueLen );
|
|
77 |
aEntry->FindAttribute( KAttrWidgetUri, iUri );
|
|
78 |
//mmc id
|
93
|
79 |
iMmcId.CreateL(KMassStorageIdLength);
|
|
80 |
aEntry->FindAttribute( KCaAttrMmcId, iMmcId );
|
|
81 |
//service xml
|
|
82 |
iServiceXml.CreateL( KCaMaxAttrValueLen );
|
|
83 |
aEntry->FindAttribute( KAttrWidgetServiceXml,iServiceXml );
|
87
|
84 |
|
93
|
85 |
iFlags = aEntry->GetFlags();
|
87
|
86 |
iModificationTime.CreateL(KCaMaxAttrValueLen);
|
|
87 |
aEntry->FindAttribute( KCaAttrInstallationTime, iModificationTime );
|
85
|
88 |
}
|
|
89 |
|
|
90 |
// -----------------------------------------------------------------------------
|
|
91 |
// CCaWidgetScannerParser::NewL
|
|
92 |
// Two-phased constructor.
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
//
|
|
95 |
CCaWidgetDescription* CCaWidgetDescription::NewL( )
|
|
96 |
{
|
|
97 |
CCaWidgetDescription* self = NewLC( );
|
|
98 |
CleanupStack::Pop( self );
|
|
99 |
return self;
|
|
100 |
}
|
|
101 |
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
// CCaWidgetDescription::NewLC
|
|
104 |
// Two-phased constructor.
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
CCaWidgetDescription* CCaWidgetDescription::NewLC( )
|
|
108 |
{
|
|
109 |
CCaWidgetDescription* self = new( ELeave ) CCaWidgetDescription();
|
|
110 |
CleanupStack::PushL( self );
|
|
111 |
self->ConstructL( );
|
|
112 |
return self;
|
|
113 |
}
|
|
114 |
|
|
115 |
// -----------------------------------------------------------------------------
|
|
116 |
// CCaWidgetDescription::NewLC
|
|
117 |
// Two-phased constructor.
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
CCaWidgetDescription* CCaWidgetDescription::NewLC( CCaInnerEntry* aEntry )
|
|
121 |
{
|
|
122 |
CCaWidgetDescription* self = new( ELeave ) CCaWidgetDescription();
|
|
123 |
CleanupStack::PushL( self );
|
|
124 |
self->ConstructL( aEntry );
|
|
125 |
return self;
|
|
126 |
}
|
|
127 |
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
// Destructor
|
|
130 |
// -----------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
CCaWidgetDescription::~CCaWidgetDescription()
|
|
133 |
{
|
|
134 |
iTitle.Close();
|
|
135 |
iDescription.Close();
|
|
136 |
iUri.Close();
|
|
137 |
iIconUri.Close();
|
|
138 |
iLibrary.Close();
|
89
|
139 |
iPath.Close();
|
87
|
140 |
iModificationTime.Close();
|
93
|
141 |
iMmcId.Close();
|
|
142 |
iServiceXml.Close();
|
94
|
143 |
iManifestFilePathName.Close();
|
96
|
144 |
iStringIdTitle.Close();
|
|
145 |
iStringIdDescription.Close();
|
85
|
146 |
}
|
|
147 |
|
|
148 |
// ----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
// ----------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
TBool CCaWidgetDescription::Compare(
|
|
153 |
const CCaWidgetDescription& aFirst,const CCaWidgetDescription& aSecond)
|
|
154 |
{
|
93
|
155 |
if( aFirst.GetUri() == aSecond.GetUri() )
|
85
|
156 |
{
|
|
157 |
return ETrue;
|
|
158 |
}
|
|
159 |
else
|
|
160 |
{
|
|
161 |
return EFalse;
|
|
162 |
}
|
|
163 |
}
|
|
164 |
|
|
165 |
// ----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
// ----------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
TBool CCaWidgetDescription::Compare( const CCaWidgetDescription& aToCompare )
|
|
170 |
{
|
|
171 |
if( aToCompare.GetLibrary() == GetLibrary() &&
|
|
172 |
aToCompare.GetDescription() == GetDescription() &&
|
|
173 |
aToCompare.GetUri() == GetUri() &&
|
|
174 |
aToCompare.GetIconUri() == GetIconUri() &&
|
|
175 |
aToCompare.GetTitle() == GetTitle() &&
|
87
|
176 |
aToCompare.GetLibrary() != KNoLibrary &&
|
93
|
177 |
aToCompare.GetModificationTime() == GetModificationTime() &&
|
|
178 |
aToCompare.GetServiceXml() == GetServiceXml()
|
87
|
179 |
)
|
85
|
180 |
{
|
|
181 |
return ETrue;
|
|
182 |
}
|
|
183 |
else
|
|
184 |
{
|
|
185 |
return EFalse;
|
|
186 |
}
|
|
187 |
}
|
|
188 |
|
|
189 |
// -----------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
// -----------------------------------------------------------------------------
|
|
192 |
//
|
93
|
193 |
void CCaWidgetDescription::SetMmcIdL( const TDesC& aMmcId )
|
85
|
194 |
{
|
93
|
195 |
iMmcId.Close();
|
|
196 |
iMmcId.CreateL( aMmcId );
|
85
|
197 |
}
|
|
198 |
|
|
199 |
// -----------------------------------------------------------------------------
|
|
200 |
//
|
|
201 |
// -----------------------------------------------------------------------------
|
|
202 |
//
|
|
203 |
void CCaWidgetDescription::SetPackageUidL( const TDesC& aPackageUid )
|
|
204 |
{
|
|
205 |
TLex lexer( aPackageUid );
|
|
206 |
User::LeaveIfError( lexer.Val( iPackageUid,EHex));
|
|
207 |
}
|
|
208 |
|
|
209 |
// -----------------------------------------------------------------------------
|
|
210 |
//
|
|
211 |
// -----------------------------------------------------------------------------
|
|
212 |
//
|
|
213 |
void CCaWidgetDescription::SetTitleL( const TDesC& aTitle )
|
|
214 |
{
|
|
215 |
iTitle.Close();
|
|
216 |
iTitle.CreateL(aTitle);
|
|
217 |
}
|
|
218 |
|
|
219 |
// -----------------------------------------------------------------------------
|
|
220 |
//
|
|
221 |
// -----------------------------------------------------------------------------
|
|
222 |
//
|
|
223 |
void CCaWidgetDescription::SetDescriptionL( const TDesC& aDescription )
|
|
224 |
{
|
|
225 |
iDescription.Close();
|
|
226 |
iDescription.CreateL(aDescription);
|
|
227 |
}
|
|
228 |
|
|
229 |
// -----------------------------------------------------------------------------
|
|
230 |
//
|
|
231 |
// -----------------------------------------------------------------------------
|
|
232 |
//
|
|
233 |
void CCaWidgetDescription::SetUriL( const TDesC& aUri )
|
|
234 |
{
|
|
235 |
iUri.Close();
|
|
236 |
iUri.CreateL(aUri);
|
|
237 |
}
|
|
238 |
// -----------------------------------------------------------------------------
|
|
239 |
//
|
|
240 |
// -----------------------------------------------------------------------------
|
|
241 |
//
|
|
242 |
void CCaWidgetDescription::SetIconUriL( const TDesC& aIconUri )
|
|
243 |
{
|
|
244 |
iIconUri.Close();
|
|
245 |
iIconUri.CreateL(aIconUri);
|
|
246 |
}
|
|
247 |
// -----------------------------------------------------------------------------
|
|
248 |
//
|
|
249 |
// -----------------------------------------------------------------------------
|
|
250 |
//
|
|
251 |
void CCaWidgetDescription::SetLibraryL( const TDesC& aLibrary )
|
|
252 |
{
|
|
253 |
iLibrary.Close();
|
|
254 |
iLibrary.CreateL(aLibrary);
|
|
255 |
}
|
|
256 |
|
|
257 |
// -----------------------------------------------------------------------------
|
|
258 |
//
|
|
259 |
// -----------------------------------------------------------------------------
|
|
260 |
//
|
|
261 |
void CCaWidgetDescription::SetMissing( TBool aMissing )
|
|
262 |
{
|
|
263 |
SetFlag( EMissing, aMissing );
|
|
264 |
}
|
|
265 |
|
|
266 |
// -----------------------------------------------------------------------------
|
|
267 |
//
|
|
268 |
// -----------------------------------------------------------------------------
|
|
269 |
//
|
|
270 |
void CCaWidgetDescription::SetVisible( TBool aVisible )
|
|
271 |
{
|
|
272 |
SetFlag( EVisible, aVisible );
|
|
273 |
}
|
|
274 |
|
|
275 |
// -----------------------------------------------------------------------------
|
|
276 |
//
|
|
277 |
// -----------------------------------------------------------------------------
|
|
278 |
//
|
87
|
279 |
void CCaWidgetDescription::SetUsed( TBool aUsed )
|
|
280 |
{
|
|
281 |
SetFlag( EUsed, aUsed );
|
|
282 |
}
|
|
283 |
|
|
284 |
// -----------------------------------------------------------------------------
|
|
285 |
//
|
|
286 |
// -----------------------------------------------------------------------------
|
|
287 |
//
|
85
|
288 |
void CCaWidgetDescription::SetFlag( TInt aFlag, TBool aValue )
|
|
289 |
{
|
|
290 |
if( aValue )
|
|
291 |
{
|
|
292 |
iFlags = iFlags | aFlag;
|
|
293 |
}
|
|
294 |
else
|
|
295 |
{
|
|
296 |
iFlags = iFlags & ~aFlag;
|
|
297 |
}
|
|
298 |
}
|
|
299 |
|
|
300 |
// -----------------------------------------------------------------------------
|
|
301 |
//
|
|
302 |
// -----------------------------------------------------------------------------
|
|
303 |
//
|
87
|
304 |
void CCaWidgetDescription::SetModificationTimeL( const TDesC& aModificationTime )
|
|
305 |
{
|
|
306 |
iModificationTime.Close();
|
|
307 |
iModificationTime.CreateL( aModificationTime );
|
|
308 |
}
|
|
309 |
|
|
310 |
// -----------------------------------------------------------------------------
|
|
311 |
//
|
|
312 |
// -----------------------------------------------------------------------------
|
|
313 |
//
|
96
|
314 |
void CCaWidgetDescription::SetStringIdDescriptionL( const TDesC& aStringIdDescription )
|
|
315 |
{
|
|
316 |
iStringIdDescription.Close();
|
|
317 |
iStringIdDescription.CreateL( aStringIdDescription );
|
|
318 |
}
|
|
319 |
|
|
320 |
// -----------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
// -----------------------------------------------------------------------------
|
|
323 |
//
|
|
324 |
void CCaWidgetDescription::SetStringidTitleL( const TDesC& aStringIdTitle )
|
|
325 |
{
|
|
326 |
iStringIdTitle.Close();
|
|
327 |
iStringIdTitle.CreateL( aStringIdTitle );
|
|
328 |
}
|
|
329 |
|
|
330 |
// -----------------------------------------------------------------------------
|
|
331 |
//
|
|
332 |
// -----------------------------------------------------------------------------
|
|
333 |
//
|
85
|
334 |
TInt CCaWidgetDescription::GetEntryId( ) const
|
|
335 |
{
|
|
336 |
return iEntryId;
|
|
337 |
}
|
|
338 |
|
|
339 |
// -----------------------------------------------------------------------------
|
|
340 |
//
|
|
341 |
// -----------------------------------------------------------------------------
|
|
342 |
//
|
93
|
343 |
TPtrC CCaWidgetDescription::GetMmcId( ) const
|
85
|
344 |
{
|
|
345 |
return iMmcId;
|
|
346 |
}
|
|
347 |
|
|
348 |
// -----------------------------------------------------------------------------
|
|
349 |
//
|
|
350 |
// -----------------------------------------------------------------------------
|
|
351 |
//
|
96
|
352 |
TPtrC CCaWidgetDescription::GetStringIdDescription() const
|
|
353 |
{
|
|
354 |
return iStringIdDescription;
|
|
355 |
}
|
|
356 |
|
|
357 |
// -----------------------------------------------------------------------------
|
|
358 |
//
|
|
359 |
// -----------------------------------------------------------------------------
|
|
360 |
//
|
|
361 |
|
|
362 |
TPtrC CCaWidgetDescription::GetStringIdTitle() const
|
|
363 |
{
|
|
364 |
return iStringIdTitle;
|
|
365 |
}
|
|
366 |
// -----------------------------------------------------------------------------
|
|
367 |
//
|
|
368 |
// -----------------------------------------------------------------------------
|
|
369 |
//
|
85
|
370 |
TPtrC CCaWidgetDescription::GetLibrary( ) const
|
|
371 |
{
|
|
372 |
return iLibrary;
|
|
373 |
}
|
89
|
374 |
// -----------------------------------------------------------------------------
|
|
375 |
//
|
|
376 |
// -----------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
TPtrC CCaWidgetDescription::GetPath( ) const
|
|
379 |
{
|
|
380 |
return iPath;
|
|
381 |
}
|
|
382 |
// -----------------------------------------------------------------------------
|
|
383 |
//
|
|
384 |
// -----------------------------------------------------------------------------
|
|
385 |
//
|
|
386 |
void CCaWidgetDescription::SetPathL( const TDesC& aPath )
|
|
387 |
{
|
|
388 |
iPath.Close();
|
|
389 |
iPath.CreateL(aPath);
|
|
390 |
}
|
85
|
391 |
// -----------------------------------------------------------------------------
|
|
392 |
//
|
|
393 |
// -----------------------------------------------------------------------------
|
|
394 |
//
|
|
395 |
TPtrC CCaWidgetDescription::GetDescription( ) const
|
|
396 |
{
|
|
397 |
return iDescription;
|
|
398 |
}
|
|
399 |
|
|
400 |
// -----------------------------------------------------------------------------
|
|
401 |
//
|
|
402 |
// -----------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
TPtrC CCaWidgetDescription::GetUri( ) const
|
|
405 |
{
|
|
406 |
return iUri;
|
|
407 |
}
|
|
408 |
|
|
409 |
// -----------------------------------------------------------------------------
|
|
410 |
//
|
|
411 |
// -----------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
TPtrC CCaWidgetDescription::GetIconUri( ) const
|
|
414 |
{
|
|
415 |
return iIconUri;
|
|
416 |
}
|
|
417 |
|
|
418 |
// -----------------------------------------------------------------------------
|
|
419 |
//
|
|
420 |
// -----------------------------------------------------------------------------
|
|
421 |
//
|
|
422 |
TPtrC CCaWidgetDescription::GetTitle( ) const
|
|
423 |
{
|
|
424 |
if ( iTitle == KNullDesC )
|
87
|
425 |
{
|
|
426 |
return GetLibraryName();
|
85
|
427 |
}
|
|
428 |
else
|
87
|
429 |
{
|
|
430 |
return iTitle;
|
|
431 |
}
|
|
432 |
}
|
|
433 |
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
//
|
|
436 |
// -----------------------------------------------------------------------------
|
|
437 |
//
|
|
438 |
TPtrC CCaWidgetDescription::GetModificationTime( ) const
|
|
439 |
{
|
|
440 |
return iModificationTime;
|
85
|
441 |
}
|
|
442 |
|
|
443 |
|
|
444 |
// -----------------------------------------------------------------------------
|
|
445 |
//
|
|
446 |
// -----------------------------------------------------------------------------
|
|
447 |
//
|
|
448 |
TBool CCaWidgetDescription::IsMissing( ) const
|
|
449 |
{
|
|
450 |
return iFlags & EMissing;
|
|
451 |
}
|
|
452 |
|
87
|
453 |
|
|
454 |
// -----------------------------------------------------------------------------
|
|
455 |
//
|
|
456 |
// -----------------------------------------------------------------------------
|
|
457 |
//
|
|
458 |
TBool CCaWidgetDescription::IsUsed( ) const
|
|
459 |
{
|
|
460 |
return iFlags & EUsed;
|
|
461 |
}
|
|
462 |
|
93
|
463 |
|
|
464 |
// -----------------------------------------------------------------------------
|
|
465 |
//
|
|
466 |
// -----------------------------------------------------------------------------
|
|
467 |
//
|
|
468 |
TBool CCaWidgetDescription::IsVisible( ) const
|
|
469 |
{
|
|
470 |
return iFlags & EVisible;
|
|
471 |
}
|
|
472 |
|
85
|
473 |
// -----------------------------------------------------------------------------
|
|
474 |
//
|
|
475 |
// -----------------------------------------------------------------------------
|
|
476 |
//
|
|
477 |
CCaInnerEntry* CCaWidgetDescription::GetEntryLC( ) const
|
|
478 |
{
|
|
479 |
CCaInnerEntry* entry = CCaInnerEntry::NewLC();
|
|
480 |
entry->SetEntryTypeNameL( KCaTypeWidget );
|
|
481 |
entry->SetRole( EItemEntryRole );
|
93
|
482 |
entry->SetFlags( iFlags );
|
85
|
483 |
if ( iPackageUid )
|
87
|
484 |
{
|
|
485 |
TBuf<KMaxUidName> uidDesc;
|
|
486 |
uidDesc.AppendNum( iPackageUid,EHex );
|
|
487 |
entry->AddAttributeL( KCaPackageUid, uidDesc );
|
|
488 |
}
|
85
|
489 |
if ( iEntryId != KNoId )
|
|
490 |
{
|
|
491 |
entry->SetId( iEntryId );
|
|
492 |
}
|
93
|
493 |
if ( iMmcId != KNullDesC )
|
85
|
494 |
{
|
93
|
495 |
entry->AddAttributeL( KCaAttrMmcId, iMmcId );
|
85
|
496 |
}
|
|
497 |
if ( iLibrary != KNullDesC )
|
|
498 |
{
|
|
499 |
entry->AddAttributeL(KAttrWidgetLibrary, iLibrary);
|
|
500 |
entry->SetFlags(entry->GetFlags() | ERemovable);
|
|
501 |
if (WidgetScannerUtils::IsFileOnDrive( iLibrary,
|
|
502 |
DriveInfo::EDefaultRom ) )
|
|
503 |
{
|
|
504 |
entry->SetFlags( entry->GetFlags() & ~ERemovable );
|
|
505 |
}
|
|
506 |
}
|
89
|
507 |
if ( iPath != KNullDesC )
|
|
508 |
{
|
|
509 |
entry->AddAttributeL(KAttrWidgetPath, iPath);
|
|
510 |
}
|
85
|
511 |
if ( iTitle != KNullDesC )
|
|
512 |
{
|
|
513 |
entry->SetTextL(iTitle);
|
|
514 |
entry->AddAttributeL(KCaAttrLongName, iTitle);
|
|
515 |
}
|
|
516 |
else
|
|
517 |
{
|
|
518 |
TPtrC libraryName( GetLibraryName() );
|
|
519 |
entry->SetTextL( libraryName );
|
|
520 |
entry->AddAttributeL( KCaAttrLongName, libraryName );
|
|
521 |
}
|
|
522 |
|
|
523 |
if ( iDescription != KNullDesC )
|
|
524 |
{
|
|
525 |
entry->SetDescriptionL( iDescription );
|
|
526 |
}
|
|
527 |
if ( iUri != KNullDesC )
|
|
528 |
{
|
|
529 |
entry->AddAttributeL(KAttrWidgetUri, iUri);
|
|
530 |
}
|
|
531 |
if ( iIconUri != KNullDesC)
|
|
532 |
{
|
88
|
533 |
// aSkinId and AppId not used for widgets - KNullDesC
|
|
534 |
entry->SetIconDataL(iIconUri, KNullDesC, KNullDesC);
|
85
|
535 |
}
|
87
|
536 |
|
|
537 |
if( iModificationTime != KNullDesC )
|
|
538 |
{
|
|
539 |
entry->AddAttributeL( KCaAttrInstallationTime, iModificationTime );
|
|
540 |
}
|
93
|
541 |
if ( iServiceXml != KNullDesC )
|
|
542 |
{
|
|
543 |
entry->AddAttributeL( KAttrWidgetServiceXml, iServiceXml);
|
|
544 |
}
|
85
|
545 |
return entry;
|
|
546 |
}
|
|
547 |
|
|
548 |
// -----------------------------------------------------------------------------
|
|
549 |
//
|
|
550 |
// -----------------------------------------------------------------------------
|
|
551 |
//
|
|
552 |
TPtrC CCaWidgetDescription::GetLibraryName( ) const
|
|
553 |
{
|
|
554 |
TPtrC libraryName( iLibrary );
|
|
555 |
TInt pos( 0 );
|
|
556 |
while ( ( pos = libraryName.Find( KDoubleSlash ) ) != KErrNotFound )
|
|
557 |
{
|
|
558 |
libraryName.Set( libraryName.Mid( pos + 1 ) );
|
|
559 |
}
|
|
560 |
pos = libraryName.Find( KDllExt );
|
|
561 |
if (pos == (libraryName.Length() - KDllExt().Length()))
|
|
562 |
{
|
|
563 |
libraryName.Set( libraryName.Mid( 0, pos ));
|
|
564 |
}
|
|
565 |
return libraryName;
|
|
566 |
}
|
93
|
567 |
|
|
568 |
// -----------------------------------------------------------------------------
|
|
569 |
//
|
|
570 |
// -----------------------------------------------------------------------------
|
|
571 |
//
|
|
572 |
void CCaWidgetDescription::RemoveMmcId( )
|
|
573 |
{
|
|
574 |
iMmcId.Close();
|
|
575 |
}
|
|
576 |
// -----------------------------------------------------------------------------
|
|
577 |
//
|
|
578 |
// -----------------------------------------------------------------------------
|
|
579 |
//
|
|
580 |
void CCaWidgetDescription::SetServiceXmlL(const TDesC& aServiceXml)
|
|
581 |
{
|
|
582 |
iServiceXml.Close();
|
|
583 |
iServiceXml.CreateL( aServiceXml );
|
|
584 |
}
|
|
585 |
// -----------------------------------------------------------------------------
|
|
586 |
//
|
|
587 |
// -----------------------------------------------------------------------------
|
|
588 |
//
|
|
589 |
TPtrC CCaWidgetDescription::GetServiceXml() const
|
|
590 |
{
|
|
591 |
return iServiceXml;
|
|
592 |
}
|
94
|
593 |
|
96
|
594 |
void CCaWidgetDescription::LocalizeTextsL()
|
|
595 |
{
|
|
596 |
|
|
597 |
|
|
598 |
if( iUri.Length() )
|
|
599 |
{
|
|
600 |
RBuf uri;
|
|
601 |
uri.Create( iUri.Length() + 1 );
|
|
602 |
CleanupClosePushL( uri );
|
|
603 |
uri.Copy( iUri );
|
|
604 |
uri.Append( KWidgetScannerUnderline );
|
|
605 |
|
|
606 |
|
|
607 |
if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathC ) )
|
|
608 |
{
|
|
609 |
if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathZ ) )
|
|
610 |
{
|
|
611 |
// this should not be called too often
|
|
612 |
TChar currentDriveLetter;
|
|
613 |
TDriveList driveList;
|
|
614 |
RFs fs;
|
|
615 |
User::LeaveIfError( fs.Connect() );
|
|
616 |
User::LeaveIfError( fs.DriveList( driveList ) );
|
|
617 |
|
|
618 |
RBuf path;
|
|
619 |
path.Create( KLocalizationFilepath().Length() + 1 );
|
|
620 |
CleanupClosePushL( path );
|
|
621 |
|
|
622 |
for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- )
|
|
623 |
{
|
|
624 |
if ( driveList[driveNr] )
|
|
625 |
{
|
|
626 |
User::LeaveIfError( fs.DriveToChar( driveNr,
|
|
627 |
currentDriveLetter ) );
|
|
628 |
path.Append( currentDriveLetter );
|
|
629 |
path.Append( KLocalizationFilepath );
|
|
630 |
if( HbTextResolverSymbian::Init( uri, path ) )
|
|
631 |
{
|
|
632 |
break;
|
|
633 |
}
|
|
634 |
}
|
|
635 |
path.Zero();
|
|
636 |
}
|
|
637 |
CleanupStack::PopAndDestroy( &path );
|
|
638 |
fs.Close();
|
|
639 |
}
|
|
640 |
}
|
|
641 |
|
|
642 |
HBufC* tmp;
|
|
643 |
|
|
644 |
if( iTitle.Length() )
|
|
645 |
{
|
|
646 |
SetStringidTitleL( iTitle );
|
|
647 |
tmp = HbTextResolverSymbian::LoadLC( iTitle );
|
|
648 |
SetTitleL( *tmp );
|
|
649 |
CleanupStack::PopAndDestroy( tmp );
|
|
650 |
}
|
|
651 |
if( iDescription.Length() )
|
|
652 |
{
|
|
653 |
SetStringIdDescriptionL( iDescription );
|
|
654 |
tmp = HbTextResolverSymbian::LoadLC( iDescription );
|
|
655 |
SetDescriptionL( *tmp );
|
|
656 |
CleanupStack::PopAndDestroy( tmp );
|
|
657 |
}
|
|
658 |
CleanupStack::PopAndDestroy( &uri );
|
|
659 |
}
|
|
660 |
}
|
|
661 |
|
94
|
662 |
/*
|
|
663 |
* Set manifest file path name
|
|
664 |
* @param aManifestFilePt
|
|
665 |
*/
|
|
666 |
void CCaWidgetDescription::SetManifestFilePathNameL(
|
|
667 |
const TDesC& aManifestFilePathName )
|
|
668 |
{
|
|
669 |
iManifestFilePathName.Close();
|
|
670 |
iManifestFilePathName.CreateL( aManifestFilePathName );
|
|
671 |
}
|
|
672 |
|
|
673 |
/*
|
|
674 |
* Get service fw xml filename
|
|
675 |
* @return Service xml filename
|
|
676 |
*/
|
|
677 |
TPtrC CCaWidgetDescription::GetManifestFilePathName() const
|
|
678 |
{
|
|
679 |
return iManifestFilePathName;
|
|
680 |
}
|
85
|
681 |
// End of File
|