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