100 // --------------------------------------------------------------------------- |
100 // --------------------------------------------------------------------------- |
101 // Finds recursively node by name |
101 // Finds recursively node by name |
102 // @return returns pointer to desired node, NULL if nothing found |
102 // @return returns pointer to desired node, NULL if nothing found |
103 // --------------------------------------------------------------------------- |
103 // --------------------------------------------------------------------------- |
104 // |
104 // |
105 CXnDomNode* FindNodeByName( CXnDomNode* aNode, const TDesC8& aName ) |
105 static CXnDomNode* FindNodeByName( CXnDomNode* aNode, const TDesC8& aName ) |
106 { |
106 { |
107 if ( !aNode ) |
107 if ( !aNode ) |
108 { |
108 { |
109 return NULL; |
109 return NULL; |
110 } |
110 } |
126 return retval; |
126 return retval; |
127 } |
127 } |
128 } |
128 } |
129 |
129 |
130 return NULL; |
130 return NULL; |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // Finds template publisher name |
|
135 // |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 static const TDesC8& FindTemplatePublisherName( CXnDomNode* aNode ) |
|
139 { |
|
140 if ( !aNode ) |
|
141 { |
|
142 return KNullDesC8(); |
|
143 } |
|
144 |
|
145 CXnDomList& list( aNode->ChildNodes() ); |
|
146 |
|
147 for ( TInt i = 0; i < list.Length(); i++ ) |
|
148 { |
|
149 CXnDomNode* node = static_cast< CXnDomNode* >( list.Item( i ) ); |
|
150 |
|
151 // Find <configuration> element |
|
152 if ( node->Name() == KConfigurationModel ) |
|
153 { |
|
154 CXnDomList& attributes( node->AttributeList() ); |
|
155 |
|
156 CXnDomAttribute* name( |
|
157 static_cast< CXnDomAttribute* >( |
|
158 attributes.FindByName( XnPropertyNames::action::KName ) ) ); |
|
159 |
|
160 // Find attribute name="publisher" |
|
161 if ( name && name->Value() == KPublisher ) |
|
162 { |
|
163 CXnDomAttribute* value( |
|
164 static_cast< CXnDomAttribute* >( |
|
165 attributes.FindByName( XnPropertyNames::action::KValue ) ) ); |
|
166 |
|
167 if ( value ) |
|
168 { |
|
169 return value->Value(); |
|
170 } |
|
171 } |
|
172 } |
|
173 } |
|
174 |
|
175 return KNullDesC8(); |
131 } |
176 } |
132 |
177 |
133 // --------------------------------------------------------------------------- |
178 // --------------------------------------------------------------------------- |
134 // FindNodeById |
179 // FindNodeById |
135 // Finds recursively node by id |
180 // Finds recursively node by id |
136 // @return returns pointer to desired node, NULL if nothing found |
181 // @return returns pointer to desired node, NULL if nothing found |
137 // --------------------------------------------------------------------------- |
182 // --------------------------------------------------------------------------- |
138 // |
183 // |
139 CXnDomNode* FindNodeById( CXnDomNode* aNode, const TDesC8& aId ) |
184 static CXnDomNode* FindNodeById( CXnDomNode* aNode, const TDesC8& aId ) |
140 { |
185 { |
141 if ( !aNode ) |
186 if ( !aNode ) |
142 { |
187 { |
143 return NULL; |
188 return NULL; |
144 } |
189 } |
593 |
638 |
594 // if page specific wallpaper feature is enabled |
639 // if page specific wallpaper feature is enabled |
595 if( bgManager.WallpaperType() == CXnBackgroundManager::EPageSpecific ) |
640 if( bgManager.WallpaperType() == CXnBackgroundManager::EPageSpecific ) |
596 { |
641 { |
597 HBufC* bgImage = ItemValueL( *configuration, KWallpaper, KPath ); |
642 HBufC* bgImage = ItemValueL( *configuration, KWallpaper, KPath ); |
598 CleanupStack::PushL( bgImage ); |
643 if ( bgImage ) |
599 if( bgImage && bgImage->Length() > 0 ) |
|
600 { |
644 { |
601 bgManager.CacheWallpaperL( bgImage->Des(), aViewData ); |
645 CleanupStack::PushL( bgImage ); |
|
646 bgImage->Des().Trim(); |
|
647 if( bgImage && bgImage->Length() > 0 ) |
|
648 { |
|
649 bgManager.CacheWallpaperL( bgImage->Des(), aViewData ); |
|
650 } |
|
651 CleanupStack::PopAndDestroy( bgImage ); |
602 } |
652 } |
603 CleanupStack::PopAndDestroy( bgImage ); |
|
604 } |
653 } |
605 if ( pluginNode ) |
654 if ( pluginNode ) |
606 { |
655 { |
607 // This assumes all <plugin> elements are siblings |
656 // This assumes all <plugin> elements are siblings |
608 CXnDomNode* pluginParent( pluginNode->Parent() ); |
657 CXnDomNode* pluginParent( pluginNode->Parent() ); |
734 |
783 |
735 UpdatePluginFromSettingsL( *configuration, *widgetRoot ); |
784 UpdatePluginFromSettingsL( *configuration, *widgetRoot ); |
736 |
785 |
737 if ( info.Type() == KKeyTemplate ) |
786 if ( info.Type() == KKeyTemplate ) |
738 { |
787 { |
739 CXnDomNode* node( FindNodeByName( widgetRoot, KContentSourceNode ) ); |
788 const TDesC8& name( FindTemplatePublisherName( widgetRoot ) ); |
740 |
789 |
741 if ( node ) |
790 aPluginData.SetPublisherNameL( name ); |
742 { |
|
743 CXnDomList& attributes( node->AttributeList() ); |
|
744 |
|
745 CXnDomAttribute* attribute( static_cast< CXnDomAttribute* >( |
|
746 attributes.FindByName( KName ) ) ); |
|
747 |
|
748 if ( attribute ) |
|
749 { |
|
750 aPluginData.SetPublisherNameL( attribute->Value() ); |
|
751 } |
|
752 } |
|
753 } |
791 } |
754 |
792 |
755 retval = KErrNone; |
793 retval = KErrNone; |
756 } |
794 } |
757 |
795 |