23 #include "cadef.h" |
23 #include "cadef.h" |
24 #include "cainnerentry.h" |
24 #include "cainnerentry.h" |
25 #include "cainnerquery.h" |
25 #include "cainnerquery.h" |
26 #include "castorageproxy.h" |
26 #include "castorageproxy.h" |
27 #include "caarraycleanup.inl" |
27 #include "caarraycleanup.inl" |
|
28 #include "calocalizationentry.h" |
|
29 |
|
30 #include "cawidgetscannerdef.h" |
|
31 |
28 |
32 |
29 using namespace Usif; |
33 using namespace Usif; |
|
34 |
30 |
35 |
31 // ============================ MEMBER FUNCTIONS =============================== |
36 // ============================ MEMBER FUNCTIONS =============================== |
32 |
37 |
33 // ----------------------------------------------------------------------------- |
38 // ----------------------------------------------------------------------------- |
34 // CCaWidgetStorageHandler::CCaWidgetStorageHandler |
39 // CCaWidgetStorageHandler::CCaWidgetStorageHandler |
110 void CCaWidgetStorageHandler::AddL( const CCaWidgetDescription* aWidget ) |
115 void CCaWidgetStorageHandler::AddL( const CCaWidgetDescription* aWidget ) |
111 { |
116 { |
112 CCaInnerEntry* entry = aWidget->GetEntryLC(); |
117 CCaInnerEntry* entry = aWidget->GetEntryLC(); |
113 UpdateComponentIdL( aWidget->GetManifestFilePathName(), *entry ); |
118 UpdateComponentIdL( aWidget->GetManifestFilePathName(), *entry ); |
114 iStorage->AddL( entry ); |
119 iStorage->AddL( entry ); |
|
120 |
|
121 SetLocalizationsL( aWidget, entry->GetId() ); |
|
122 |
115 if( entry->GetFlags() & ERemovable ) |
123 if( entry->GetFlags() & ERemovable ) |
116 { |
124 { |
117 AddWidgetToDownloadCollectionL( entry ); |
125 AddWidgetToDownloadCollectionL( entry ); |
118 } |
126 } |
119 CleanupStack::PopAndDestroy( entry ); |
127 CleanupStack::PopAndDestroy( entry ); |
139 { |
147 { |
140 itemAppearanceChange = EItemAppeared; |
148 itemAppearanceChange = EItemAppeared; |
141 } |
149 } |
142 entry->SetFlags( entry->GetFlags() & ~EMissing | EVisible ); |
150 entry->SetFlags( entry->GetFlags() & ~EMissing | EVisible ); |
143 iStorage->AddL( entry, EFalse, itemAppearanceChange ); |
151 iStorage->AddL( entry, EFalse, itemAppearanceChange ); |
|
152 |
|
153 SetLocalizationsL( aWidget, entry->GetId() ); |
|
154 |
144 if( !aWidget->IsMissing() ) |
155 if( !aWidget->IsMissing() ) |
145 { |
156 { |
146 AddWidgetToDownloadCollectionL( entry ); |
157 AddWidgetToDownloadCollectionL( entry ); |
147 } |
158 } |
148 CleanupStack::PopAndDestroy( entry ); |
159 CleanupStack::PopAndDestroy( entry ); |
155 void CCaWidgetStorageHandler::AddWidgetsL( const RWidgetArray& aWidgets ) |
166 void CCaWidgetStorageHandler::AddWidgetsL( const RWidgetArray& aWidgets ) |
156 { |
167 { |
157 iUpdatedIndexes.Reset(); |
168 iUpdatedIndexes.Reset(); |
158 for( TInt i = 0; i < aWidgets.Count(); i++ ) |
169 for( TInt i = 0; i < aWidgets.Count(); i++ ) |
159 { |
170 { |
|
171 aWidgets[i]->LocalizeTextsL(); |
160 TInt index = iWidgets.Find( |
172 TInt index = iWidgets.Find( |
161 aWidgets[i], CCaWidgetDescription::Compare ); |
173 aWidgets[i], CCaWidgetDescription::Compare ); |
162 if( index != KErrNotFound ) |
174 if( index != KErrNotFound ) |
163 { |
175 { |
164 if( !iWidgets[index]->Compare( *aWidgets[i] ) || |
176 if( !iWidgets[index]->Compare( *aWidgets[i] ) || |
267 CleanupStack::Pop( widgetType ); |
282 CleanupStack::Pop( widgetType ); |
268 |
283 |
269 RPointerArray<CCaInnerEntry> entries; |
284 RPointerArray<CCaInnerEntry> entries; |
270 CleanupResetAndDestroyPushL( entries ); |
285 CleanupResetAndDestroyPushL( entries ); |
271 iStorage->GetEntriesL( query, entries ); |
286 iStorage->GetEntriesL( query, entries ); |
|
287 |
272 iWidgets.ResetAndDestroy(); |
288 iWidgets.ResetAndDestroy(); |
273 for( TInt i = 0; i < entries.Count(); i++ ) |
289 for( TInt i = 0; i < entries.Count(); i++ ) |
274 { |
290 { |
275 CCaWidgetDescription* widget = CCaWidgetDescription::NewLC( |
291 CCaWidgetDescription* widget = CCaWidgetDescription::NewLC( |
276 entries[i] ); |
292 entries[i] ); |
306 // ---------------------------------------------------------------------------- |
322 // ---------------------------------------------------------------------------- |
307 // |
323 // |
308 void CCaWidgetStorageHandler::ClearVisibleFlagL( |
324 void CCaWidgetStorageHandler::ClearVisibleFlagL( |
309 const CCaWidgetDescription* aWidget ) |
325 const CCaWidgetDescription* aWidget ) |
310 { |
326 { |
311 if( aWidget->IsVisible() ) |
327 CCaInnerEntry* entry = aWidget->GetEntryLC(); |
312 { |
328 entry->SetFlags( entry->GetFlags() & ~EVisible & ~EMissing & ~EUsed ); |
313 CCaInnerEntry* entry = aWidget->GetEntryLC(); |
329 iStorage->AddL( entry, EFalse, EItemDisappeared ); |
314 entry->SetFlags( entry->GetFlags() & ~EVisible & ~EMissing & ~EUsed ); |
330 CleanupStack::PopAndDestroy( entry ); |
315 iStorage->AddL( entry, EFalse, EItemDisappeared ); |
|
316 CleanupStack::PopAndDestroy( entry ); |
|
317 } |
|
318 } |
331 } |
319 |
332 |
320 // ---------------------------------------------------------------------------- |
333 // ---------------------------------------------------------------------------- |
321 // |
334 // |
322 // ---------------------------------------------------------------------------- |
335 // ---------------------------------------------------------------------------- |
334 { |
347 { |
335 massStorageNotInUse = EFalse; |
348 massStorageNotInUse = EFalse; |
336 } |
349 } |
337 } |
350 } |
338 return massStorageNotInUse; |
351 return massStorageNotInUse; |
|
352 } |
|
353 // ---------------------------------------------------------------------------- |
|
354 // |
|
355 // ---------------------------------------------------------------------------- |
|
356 // |
|
357 |
|
358 void CCaWidgetStorageHandler::SetLocalizationsL( const CCaWidgetDescription* aWidget, |
|
359 TInt aEntryId ) |
|
360 { |
|
361 RBuf filename; |
|
362 filename.Create( aWidget->GetUri().Length() + 1 ); //1 for _ |
|
363 CleanupClosePushL( filename ); |
|
364 filename.Copy( aWidget->GetUri() ); |
|
365 filename.Append( KWidgetScannerUnderline ); |
|
366 |
|
367 // prepare localizations |
|
368 if ( aWidget->GetTitle().Length() > 0 && |
|
369 aWidget->GetTitle().Compare( aWidget->GetStringIdTitle() ) ) |
|
370 // lets do not add localization when key and value are identical |
|
371 { |
|
372 CCaLocalizationEntry* titleEntry = CCaLocalizationEntry::NewL(); |
|
373 CleanupStack::PushL( titleEntry ); |
|
374 titleEntry->SetTableNameL( KWidgetScannerCaEntry ); |
|
375 titleEntry->SetAttributeNameL( KWidgetScannerEnText ); |
|
376 titleEntry->SetStringIdL( aWidget->GetStringIdTitle() ); |
|
377 titleEntry->SetQmFilenameL( filename ); |
|
378 titleEntry->SetRowId( aEntryId ); |
|
379 iStorage->AddLocalizationL( *titleEntry ); |
|
380 CleanupStack::PopAndDestroy( titleEntry ); |
|
381 } |
|
382 if ( aWidget->GetDescription().Length() > 0 && |
|
383 aWidget->GetDescription().Compare( |
|
384 aWidget->GetStringIdDescription() ) ) |
|
385 // lets do not add localization when key and value are identical |
|
386 { |
|
387 CCaLocalizationEntry* descEntry = CCaLocalizationEntry::NewL(); |
|
388 CleanupStack::PushL( descEntry ); |
|
389 descEntry->SetTableNameL( KWidgetScannerCaEntry ); |
|
390 descEntry->SetAttributeNameL( KWidgetScannerEnDescription ); |
|
391 descEntry->SetStringIdL( aWidget->GetStringIdDescription() ); |
|
392 descEntry->SetQmFilenameL( filename ); |
|
393 descEntry->SetRowId( aEntryId ); |
|
394 iStorage->AddLocalizationL( *descEntry ); |
|
395 CleanupStack::PopAndDestroy( descEntry ); |
|
396 } |
|
397 CleanupStack::PopAndDestroy( &filename ); |
339 } |
398 } |
340 |
399 |
341 // ---------------------------------------------------------------------------- |
400 // ---------------------------------------------------------------------------- |
342 // |
401 // |
343 // ---------------------------------------------------------------------------- |
402 // ---------------------------------------------------------------------------- |