69 |
69 |
70 TPtrC attribute; |
70 TPtrC attribute; |
71 aEntry->FindAttribute( KPreviewImageAttrName, attribute ); |
71 aEntry->FindAttribute( KPreviewImageAttrName, attribute ); |
72 iPreviewImageName.CreateL( attribute.Length() ); |
72 iPreviewImageName.CreateL( attribute.Length() ); |
73 iPreviewImageName = attribute; |
73 iPreviewImageName = attribute; |
74 |
74 |
75 //library |
75 //library |
76 iLibrary.CreateL( KCaMaxAttrValueLen ); |
76 iLibrary.CreateL( KCaMaxAttrValueLen ); |
77 aEntry->FindAttribute( KAttrWidgetLibrary, iLibrary ); |
77 aEntry->FindAttribute( KAttrWidgetLibrary, iLibrary ); |
|
78 //path |
|
79 iPath.CreateL( KCaMaxAttrValueLen ); |
|
80 aEntry->FindAttribute( KAttrWidgetPath, iPath ); |
78 //uri |
81 //uri |
79 iUri.CreateL( KCaMaxAttrValueLen ); |
82 iUri.CreateL( KCaMaxAttrValueLen ); |
80 aEntry->FindAttribute( KAttrWidgetUri, iUri ); |
83 aEntry->FindAttribute( KAttrWidgetUri, iUri ); |
|
84 //translation filename |
|
85 iTranslationFileName.CreateL( KCaMaxAttrValueLen ); |
|
86 aEntry->FindAttribute( KAttrWidgetTranslationFileName, iTranslationFileName ); |
81 //mmc id |
87 //mmc id |
82 iMmcId.CreateL(KMassStorageIdLength); |
88 iMmcId.CreateL(KMassStorageIdLength); |
83 aEntry->FindAttribute( KCaAttrMmcId, iMmcId ); |
89 aEntry->FindAttribute( KCaAttrMmcId, iMmcId ); |
84 //service xml |
90 //service xml |
85 iServiceXml.CreateL( KCaMaxAttrValueLen ); |
91 iServiceXml.CreateL( KCaMaxAttrValueLen ); |
180 aToCompare.GetDescription() == GetDescription() && |
187 aToCompare.GetDescription() == GetDescription() && |
181 aToCompare.GetUri() == GetUri() && |
188 aToCompare.GetUri() == GetUri() && |
182 aToCompare.GetIconUri() == GetIconUri() && |
189 aToCompare.GetIconUri() == GetIconUri() && |
183 aToCompare.GetPreviewImageName() == GetPreviewImageName() && |
190 aToCompare.GetPreviewImageName() == GetPreviewImageName() && |
184 aToCompare.GetTitle() == GetTitle() && |
191 aToCompare.GetTitle() == GetTitle() && |
|
192 aToCompare.GetTranslationFileName() == GetTranslationFileName() && |
185 aToCompare.GetLibrary() != KNoLibrary && |
193 aToCompare.GetLibrary() != KNoLibrary && |
186 aToCompare.GetModificationTime() == GetModificationTime() && |
194 aToCompare.GetModificationTime() == GetModificationTime() && |
187 aToCompare.GetServiceXml() == GetServiceXml() |
195 aToCompare.GetServiceXml() == GetServiceXml() |
188 ) |
196 ) |
189 { |
197 { |
253 void CCaWidgetDescription::SetUriL( const TDesC& aUri ) |
261 void CCaWidgetDescription::SetUriL( const TDesC& aUri ) |
254 { |
262 { |
255 iUri.Close(); |
263 iUri.Close(); |
256 iUri.CreateL(aUri); |
264 iUri.CreateL(aUri); |
257 } |
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 void CCaWidgetDescription::SetTranslationFileNameL( |
|
272 const TDesC& aTranslationFileName ) |
|
273 { |
|
274 iTranslationFileName.Close(); |
|
275 iTranslationFileName.CreateL( aTranslationFileName ); |
|
276 } |
|
277 |
258 // ----------------------------------------------------------------------------- |
278 // ----------------------------------------------------------------------------- |
259 // |
279 // |
260 // ----------------------------------------------------------------------------- |
280 // ----------------------------------------------------------------------------- |
261 // |
281 // |
262 void CCaWidgetDescription::SetIconUriL( const TDesC& aIconUri ) |
282 void CCaWidgetDescription::SetIconUriL( const TDesC& aIconUri ) |
371 // |
391 // |
372 TPtrC CCaWidgetDescription::GetLibrary( ) const |
392 TPtrC CCaWidgetDescription::GetLibrary( ) const |
373 { |
393 { |
374 return iLibrary; |
394 return iLibrary; |
375 } |
395 } |
|
396 |
|
397 // ----------------------------------------------------------------------------- |
|
398 // |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 TPtrC CCaWidgetDescription::GetPath( ) const |
|
402 { |
|
403 return iPath; |
|
404 } |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 // ----------------------------------------------------------------------------- |
|
408 // |
|
409 void CCaWidgetDescription::SetPathL( const TDesC& aPath ) |
|
410 { |
|
411 iPath.Close(); |
|
412 iPath.CreateL(aPath); |
|
413 } |
|
414 |
376 // ----------------------------------------------------------------------------- |
415 // ----------------------------------------------------------------------------- |
377 // |
416 // |
378 // ----------------------------------------------------------------------------- |
417 // ----------------------------------------------------------------------------- |
379 // |
418 // |
380 TPtrC CCaWidgetDescription::GetDescription( ) const |
419 TPtrC CCaWidgetDescription::GetDescription( ) const |
587 // ----------------------------------------------------------------------------- |
644 // ----------------------------------------------------------------------------- |
588 // |
645 // |
589 // ----------------------------------------------------------------------------- |
646 // ----------------------------------------------------------------------------- |
590 // |
647 // |
591 void CCaWidgetDescription::LocalizeTextsL() |
648 void CCaWidgetDescription::LocalizeTextsL() |
592 { |
649 { |
593 |
650 if( iTranslationFileName.Length() ) |
594 |
651 { |
595 if( iUri.Length() ) |
652 RBuf translationFileName; |
596 { |
653 translationFileName.Create( iTranslationFileName.Length() + 1 ); |
597 RBuf uri; |
654 CleanupClosePushL( translationFileName ); |
598 uri.Create( iUri.Length() + 1 ); |
655 translationFileName.Copy( iTranslationFileName ); |
599 CleanupClosePushL( uri ); |
656 translationFileName.Append( KWidgetScannerUnderline ); |
600 uri.Copy( iUri ); |
657 |
601 uri.Append( KWidgetScannerUnderline ); |
658 |
602 |
659 if( !HbTextResolverSymbian::Init( translationFileName, KLocalizationFilepathC ) ) |
603 |
660 { |
604 if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathC ) ) |
661 if( !HbTextResolverSymbian::Init( translationFileName, KLocalizationFilepathZ ) ) |
605 { |
662 { |
606 if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathZ ) ) |
663 // this should not be called too often |
607 { |
|
608 // this should not be called too often |
|
609 TChar currentDriveLetter; |
664 TChar currentDriveLetter; |
610 TDriveList driveList; |
665 TDriveList driveList; |
611 RFs fs; |
666 RFs fs; |
612 User::LeaveIfError( fs.Connect() ); |
667 User::LeaveIfError( fs.Connect() ); |
613 User::LeaveIfError( fs.DriveList( driveList ) ); |
668 User::LeaveIfError( fs.DriveList( driveList ) ); |
614 |
669 |
615 RBuf path; |
670 RBuf path; |
616 path.Create( KLocalizationFilepath().Length() + 1 ); |
671 path.Create( KLocalizationFilepath().Length() + 1 ); |
617 CleanupClosePushL( path ); |
672 CleanupClosePushL( path ); |
618 |
673 |
619 for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- ) |
674 for( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- ) |
620 { |
675 { |
621 if ( driveList[driveNr] ) |
676 if( driveList[driveNr] ) |
622 { |
677 { |
623 User::LeaveIfError( fs.DriveToChar( driveNr, |
678 User::LeaveIfError( fs.DriveToChar( driveNr, |
624 currentDriveLetter ) ); |
679 currentDriveLetter ) ); |
625 path.Append( currentDriveLetter ); |
680 path.Append( currentDriveLetter ); |
626 path.Append( KLocalizationFilepath ); |
681 path.Append( KLocalizationFilepath ); |
627 if( HbTextResolverSymbian::Init( uri, path ) ) |
682 if( HbTextResolverSymbian::Init( translationFileName, path ) ) |
628 { |
683 { |
629 break; |
684 break; |
630 } |
685 } |
631 } |
686 } |
632 path.Zero(); |
687 path.Zero(); |
633 } |
688 } |
634 CleanupStack::PopAndDestroy( &path ); |
689 CleanupStack::PopAndDestroy( &path ); |
635 fs.Close(); |
690 fs.Close(); |
636 } |
691 } |
637 } |
692 } |
638 |
693 |
639 HBufC* tmp; |
694 HBufC* tmp; |
640 |
695 |
641 if( iTitle.Length() ) |
696 if( iTitle.Length() ) |
642 { |
697 { |
643 SetStringidTitleL( iTitle ); |
698 SetStringidTitleL( iTitle ); |
644 tmp = HbTextResolverSymbian::LoadLC( iTitle ); |
699 tmp = HbTextResolverSymbian::LoadLC( iTitle ); |
645 SetTitleL( *tmp ); |
700 SetTitleL( *tmp ); |
646 CleanupStack::PopAndDestroy( tmp ); |
701 CleanupStack::PopAndDestroy( tmp ); |
647 } |
702 } |
648 if( iDescription.Length() ) |
703 if( iDescription.Length() ) |
649 { |
704 { |
650 SetStringIdDescriptionL( iDescription ); |
705 SetStringIdDescriptionL( iDescription ); |
651 tmp = HbTextResolverSymbian::LoadLC( iDescription ); |
706 tmp = HbTextResolverSymbian::LoadLC( iDescription ); |
652 SetDescriptionL( *tmp ); |
707 SetDescriptionL( *tmp ); |
653 CleanupStack::PopAndDestroy( tmp ); |
708 CleanupStack::PopAndDestroy( tmp ); |
654 } |
709 } |
655 CleanupStack::PopAndDestroy( &uri ); |
710 CleanupStack::PopAndDestroy( &translationFileName ); |
656 } |
711 } |
657 } |
712 } |
658 |
713 |
659 // ----------------------------------------------------------------------------- |
714 // ----------------------------------------------------------------------------- |
660 // |
715 // |
661 // ----------------------------------------------------------------------------- |
716 // ----------------------------------------------------------------------------- |
662 // |
717 // |