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