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 |
*
|
93
|
14 |
* Description:
|
85
|
15 |
*
|
|
16 |
*/
|
|
17 |
// INCLUDE FILES
|
|
18 |
|
|
19 |
#include <badesca.h>
|
94
|
20 |
#include <usif/scr/screntries.h>
|
98
|
21 |
#include <hbtextresolversymbian.h>
|
|
22 |
|
85
|
23 |
#include "widgetscannerutils.h"
|
|
24 |
#include "cawidgetstoragehandler.h"
|
|
25 |
#include "cadef.h"
|
|
26 |
#include "cainnerentry.h"
|
|
27 |
#include "cainnerquery.h"
|
|
28 |
#include "castorageproxy.h"
|
|
29 |
#include "caarraycleanup.inl"
|
96
|
30 |
#include "calocalizationentry.h"
|
98
|
31 |
#include "cawidgetscannerparser.h"
|
96
|
32 |
#include "cawidgetscannerdef.h"
|
|
33 |
|
94
|
34 |
using namespace Usif;
|
|
35 |
|
98
|
36 |
// ============================ MEMBER FUNCTIONS ============================z===
|
85
|
37 |
|
|
38 |
// -----------------------------------------------------------------------------
|
98
|
39 |
//
|
85
|
40 |
// -----------------------------------------------------------------------------
|
|
41 |
//
|
98
|
42 |
CCaWidgetStorageHandler::CCaWidgetStorageHandler( CCaStorageProxy* aStorage,
|
102
|
43 |
Usif::RSoftwareComponentRegistry& aSoftwareRegistry, RFs& aFs ) :
|
|
44 |
iSoftwareRegistry(aSoftwareRegistry)
|
85
|
45 |
{
|
|
46 |
iStorage = aStorage;
|
|
47 |
iFs = aFs;
|
|
48 |
}
|
|
49 |
|
|
50 |
// -----------------------------------------------------------------------------
|
98
|
51 |
//
|
85
|
52 |
// -----------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
void CCaWidgetStorageHandler::ConstructL()
|
|
55 |
{
|
98
|
56 |
iParser = CCaWidgetScannerParser::NewL( iFs );
|
85
|
57 |
}
|
|
58 |
|
|
59 |
// -----------------------------------------------------------------------------
|
98
|
60 |
//
|
85
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
CCaWidgetStorageHandler* CCaWidgetStorageHandler::NewL(
|
102
|
64 |
CCaStorageProxy* aStorage,
|
|
65 |
Usif::RSoftwareComponentRegistry& aSoftwareRegistry, RFs& aFs )
|
85
|
66 |
{
|
102
|
67 |
CCaWidgetStorageHandler* self = NewLC( aStorage, aSoftwareRegistry, aFs );
|
85
|
68 |
CleanupStack::Pop( self );
|
|
69 |
return self;
|
|
70 |
}
|
|
71 |
|
|
72 |
// -----------------------------------------------------------------------------
|
98
|
73 |
//
|
85
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
CCaWidgetStorageHandler* CCaWidgetStorageHandler::NewLC(
|
102
|
77 |
CCaStorageProxy* aStorage,
|
|
78 |
Usif::RSoftwareComponentRegistry& aSoftwareRegistry, RFs& aFs )
|
85
|
79 |
{
|
|
80 |
CCaWidgetStorageHandler* self = new ( ELeave ) CCaWidgetStorageHandler(
|
102
|
81 |
aStorage, aSoftwareRegistry, aFs );
|
85
|
82 |
CleanupStack::PushL( self );
|
|
83 |
self->ConstructL();
|
|
84 |
return self;
|
|
85 |
}
|
|
86 |
|
|
87 |
// -----------------------------------------------------------------------------
|
98
|
88 |
//
|
85
|
89 |
// -----------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
CCaWidgetStorageHandler::~CCaWidgetStorageHandler()
|
|
92 |
{
|
98
|
93 |
delete iParser;
|
107
|
94 |
iWidgetDBCache.ResetAndDestroy();
|
85
|
95 |
}
|
|
96 |
|
|
97 |
// ----------------------------------------------------------------------------
|
93
|
98 |
//
|
85
|
99 |
// ----------------------------------------------------------------------------
|
93
|
100 |
//
|
98
|
101 |
void CCaWidgetStorageHandler::SynchronizeL()
|
85
|
102 |
{
|
|
103 |
FetchWidgetsL();
|
107
|
104 |
AddWidgetsL( iParser->WidgetsScanL( iWidgetDBCache ) );
|
85
|
105 |
RemoveWidgetsL();
|
125
|
106 |
MakeNotEmptyCollectionsVisibleL();
|
85
|
107 |
}
|
|
108 |
|
|
109 |
// ----------------------------------------------------------------------------
|
93
|
110 |
//
|
85
|
111 |
// ----------------------------------------------------------------------------
|
93
|
112 |
//
|
85
|
113 |
void CCaWidgetStorageHandler::AddL( const CCaWidgetDescription* aWidget )
|
|
114 |
{
|
|
115 |
CCaInnerEntry* entry = aWidget->GetEntryLC();
|
106
|
116 |
UpdateCompIdAndRemovableFlagL( aWidget->GetManifestFilePathName(), *entry );
|
85
|
117 |
iStorage->AddL( entry );
|
96
|
118 |
|
|
119 |
SetLocalizationsL( aWidget, entry->GetId() );
|
98
|
120 |
|
|
121 |
if ( entry->GetFlags() & ERemovable )
|
85
|
122 |
{
|
|
123 |
AddWidgetToDownloadCollectionL( entry );
|
|
124 |
}
|
|
125 |
CleanupStack::PopAndDestroy( entry );
|
|
126 |
}
|
|
127 |
|
|
128 |
// ----------------------------------------------------------------------------
|
93
|
129 |
//
|
85
|
130 |
// ----------------------------------------------------------------------------
|
93
|
131 |
//
|
85
|
132 |
void CCaWidgetStorageHandler::UpdateL( const CCaWidgetDescription* aWidget,
|
|
133 |
TUint aEntryId )
|
|
134 |
{
|
|
135 |
CCaInnerEntry* entry = aWidget->GetEntryLC();
|
106
|
136 |
UpdateCompIdAndRemovableFlagL( aWidget->GetManifestFilePathName(), *entry );
|
85
|
137 |
entry->SetId( aEntryId );
|
98
|
138 |
if ( !aWidget->IsMissing() && aWidget->IsUsed() )
|
85
|
139 |
{
|
|
140 |
entry->SetFlags( entry->GetFlags() & ~EUsed );
|
|
141 |
}
|
93
|
142 |
TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged;
|
98
|
143 |
if ( ( entry->GetFlags() & EMissing ) || !( entry->GetFlags() & EVisible ) )
|
87
|
144 |
{
|
93
|
145 |
itemAppearanceChange = EItemAppeared;
|
87
|
146 |
}
|
93
|
147 |
entry->SetFlags( entry->GetFlags() & ~EMissing | EVisible );
|
|
148 |
iStorage->AddL( entry, EFalse, itemAppearanceChange );
|
98
|
149 |
|
96
|
150 |
SetLocalizationsL( aWidget, entry->GetId() );
|
98
|
151 |
|
106
|
152 |
if ( !aWidget->IsMissing() && ( entry->GetFlags() & ERemovable ) )
|
85
|
153 |
{
|
|
154 |
AddWidgetToDownloadCollectionL( entry );
|
|
155 |
}
|
|
156 |
CleanupStack::PopAndDestroy( entry );
|
|
157 |
}
|
|
158 |
|
|
159 |
// ----------------------------------------------------------------------------
|
93
|
160 |
//
|
85
|
161 |
// ----------------------------------------------------------------------------
|
93
|
162 |
//
|
85
|
163 |
void CCaWidgetStorageHandler::AddWidgetsL( const RWidgetArray& aWidgets )
|
|
164 |
{
|
107
|
165 |
const TInt newWidgetsCount = aWidgets.Count();
|
|
166 |
|
|
167 |
for ( TInt i = 0; i < newWidgetsCount; ++i )
|
85
|
168 |
{
|
107
|
169 |
CCaWidgetDescription *const newWidget = aWidgets[i];
|
|
170 |
|
|
171 |
newWidget->LocalizeTextsL();
|
|
172 |
|
|
173 |
const TInt dbCacheIndex =
|
|
174 |
iWidgetDBCache.Find(
|
|
175 |
newWidget, CCaWidgetDescription::CompareUri );
|
|
176 |
|
|
177 |
if ( dbCacheIndex != KErrNotFound )
|
85
|
178 |
{
|
107
|
179 |
CCaWidgetDescription *const cachedWidget =
|
|
180 |
iWidgetDBCache[dbCacheIndex];
|
|
181 |
|
|
182 |
cachedWidget->SetValid( ETrue );
|
|
183 |
|
|
184 |
const TBool cachedDifferentThanNew =
|
|
185 |
!cachedWidget->Compare( *newWidget );
|
|
186 |
|
|
187 |
if ( cachedDifferentThanNew || cachedWidget->IsMissing() )
|
85
|
188 |
{
|
107
|
189 |
newWidget->SetFlag( EMissing, cachedWidget->IsMissing() );
|
|
190 |
newWidget->SetFlag( EUsed, cachedWidget->IsUsed() );
|
|
191 |
newWidget->SetFlag( EVisible, cachedWidget->IsVisible() );
|
|
192 |
|
|
193 |
UpdateL( newWidget, cachedWidget->GetEntryId() );
|
85
|
194 |
}
|
|
195 |
}
|
|
196 |
else
|
|
197 |
{
|
107
|
198 |
AddL( newWidget );
|
85
|
199 |
}
|
|
200 |
}
|
98
|
201 |
HbTextResolverSymbian::Init( _L(""), KLocalizationFilepathZ );
|
85
|
202 |
}
|
|
203 |
|
|
204 |
// ----------------------------------------------------------------------------
|
93
|
205 |
//
|
85
|
206 |
// ----------------------------------------------------------------------------
|
93
|
207 |
//
|
85
|
208 |
void CCaWidgetStorageHandler::RemoveWidgetsL()
|
|
209 |
{
|
107
|
210 |
const TInt cacheCount = iWidgetDBCache.Count();
|
|
211 |
for ( TInt i = 0; i < cacheCount; ++i)
|
85
|
212 |
{
|
107
|
213 |
CCaWidgetDescription *const cachedWidget = iWidgetDBCache[i];
|
|
214 |
if ( !cachedWidget->IsValid() )
|
85
|
215 |
{
|
107
|
216 |
if ( cachedWidget->GetMmcId() != KNullDesC )
|
85
|
217 |
{
|
93
|
218 |
RBuf currentMmcId;
|
|
219 |
currentMmcId.CreateL( KMassStorageIdLength );
|
|
220 |
currentMmcId.CleanupClosePushL();
|
|
221 |
WidgetScannerUtils::CurrentMmcId( iFs, currentMmcId );
|
107
|
222 |
if( cachedWidget->GetMmcId() == currentMmcId ||
|
|
223 |
( cachedWidget->GetMmcId() == KCaMassStorage() &&
|
93
|
224 |
MassStorageNotInUse() ) )
|
|
225 |
{
|
|
226 |
//item was uninstalled so we remove its mmc id
|
107
|
227 |
cachedWidget->RemoveMmcId();
|
|
228 |
ClearVisibleFlagL( cachedWidget );
|
93
|
229 |
}
|
|
230 |
else
|
|
231 |
{
|
107
|
232 |
SetMissingFlagL( cachedWidget );
|
93
|
233 |
}
|
98
|
234 |
CleanupStack::PopAndDestroy( ¤tMmcId );
|
85
|
235 |
}
|
|
236 |
else
|
|
237 |
{
|
93
|
238 |
//item was uninstalled so we remove its mmc id
|
107
|
239 |
ClearVisibleFlagL( cachedWidget );
|
85
|
240 |
}
|
|
241 |
}
|
|
242 |
}
|
|
243 |
}
|
|
244 |
|
|
245 |
// ----------------------------------------------------------------------------
|
93
|
246 |
//
|
85
|
247 |
// ----------------------------------------------------------------------------
|
93
|
248 |
//
|
85
|
249 |
void CCaWidgetStorageHandler::AddWidgetToDownloadCollectionL(
|
|
250 |
const CCaInnerEntry* aEntry )
|
|
251 |
{
|
|
252 |
CCaInnerQuery* queryDownload = CCaInnerQuery::NewLC();
|
|
253 |
CDesC16ArrayFlat* downloadType = new ( ELeave ) CDesC16ArrayFlat(
|
|
254 |
KGranularityOne );
|
|
255 |
CleanupStack::PushL( downloadType );
|
|
256 |
downloadType->AppendL( KCaTypeCollectionDownload );
|
|
257 |
queryDownload->SetEntryTypeNames( downloadType );//query takes ownership
|
|
258 |
CleanupStack::Pop( downloadType );
|
|
259 |
queryDownload->SetRole( EGroupEntryRole );
|
|
260 |
|
|
261 |
RArray<TInt> idsGroup;
|
|
262 |
CleanupClosePushL( idsGroup );
|
|
263 |
iStorage->GetEntriesIdsL( queryDownload, idsGroup );
|
|
264 |
|
|
265 |
TCaOperationParams operParams;
|
|
266 |
operParams.iOperationType = TCaOperationParams::EPrepend;
|
|
267 |
operParams.iGroupId = idsGroup[0];
|
|
268 |
operParams.iBeforeEntryId = 0;
|
|
269 |
CleanupStack::PopAndDestroy( &idsGroup );
|
|
270 |
|
|
271 |
RArray<TInt> idsEntry;
|
|
272 |
CleanupClosePushL( idsEntry );
|
|
273 |
idsEntry.Append( aEntry->GetId() );
|
|
274 |
iStorage->OrganizeL( idsEntry, operParams );
|
|
275 |
|
|
276 |
CleanupStack::PopAndDestroy( &idsEntry );
|
|
277 |
CleanupStack::PopAndDestroy( queryDownload );
|
|
278 |
}
|
|
279 |
|
|
280 |
// ----------------------------------------------------------------------------
|
93
|
281 |
//
|
85
|
282 |
// ----------------------------------------------------------------------------
|
93
|
283 |
//
|
85
|
284 |
void CCaWidgetStorageHandler::FetchWidgetsL()
|
|
285 |
{
|
|
286 |
CCaInnerQuery* query = CCaInnerQuery::NewLC();
|
|
287 |
CDesC16ArrayFlat* widgetType = new ( ELeave ) CDesC16ArrayFlat(
|
|
288 |
KGranularityOne );
|
|
289 |
CleanupStack::PushL( widgetType );
|
|
290 |
widgetType->AppendL( KCaTypeWidget );
|
|
291 |
query->SetEntryTypeNames( widgetType );//transfers ownership to query
|
|
292 |
CleanupStack::Pop( widgetType );
|
|
293 |
|
|
294 |
RPointerArray<CCaInnerEntry> entries;
|
|
295 |
CleanupResetAndDestroyPushL( entries );
|
|
296 |
iStorage->GetEntriesL( query, entries );
|
98
|
297 |
|
107
|
298 |
iWidgetDBCache.ResetAndDestroy();
|
98
|
299 |
for ( TInt i = 0; i < entries.Count(); i++ )
|
85
|
300 |
{
|
98
|
301 |
CCaWidgetDescription* widget = CCaWidgetDescription::NewLC( entries[i] );
|
107
|
302 |
iWidgetDBCache.AppendL( widget ); //iWidgets takes ownership
|
85
|
303 |
CleanupStack::Pop( widget );
|
|
304 |
}
|
|
305 |
CleanupStack::PopAndDestroy( &entries );
|
|
306 |
CleanupStack::PopAndDestroy( query );
|
|
307 |
}
|
|
308 |
|
|
309 |
// ----------------------------------------------------------------------------
|
93
|
310 |
//
|
85
|
311 |
// ----------------------------------------------------------------------------
|
93
|
312 |
//
|
85
|
313 |
void CCaWidgetStorageHandler::SetMissingFlagL(
|
|
314 |
const CCaWidgetDescription* aWidget )
|
|
315 |
{
|
98
|
316 |
if ( !aWidget->IsMissing() )
|
87
|
317 |
{
|
93
|
318 |
CCaInnerEntry* entry = aWidget->GetEntryLC();
|
98
|
319 |
entry->SetFlags( ( entry->GetFlags() | EMissing ) & ~EUninstall );
|
|
320 |
if ( aWidget->IsUsed() )
|
93
|
321 |
{
|
|
322 |
entry->SetFlags( entry->GetFlags() | EUsed );
|
|
323 |
}
|
|
324 |
iStorage->AddL( entry, EFalse, EItemDisappeared );
|
|
325 |
CleanupStack::PopAndDestroy( entry );
|
87
|
326 |
}
|
85
|
327 |
}
|
|
328 |
|
93
|
329 |
// ----------------------------------------------------------------------------
|
|
330 |
//
|
|
331 |
// ----------------------------------------------------------------------------
|
|
332 |
//
|
|
333 |
void CCaWidgetStorageHandler::ClearVisibleFlagL(
|
|
334 |
const CCaWidgetDescription* aWidget )
|
|
335 |
{
|
98
|
336 |
if ( aWidget->IsVisible() )
|
|
337 |
{
|
|
338 |
CCaInnerEntry* entry = aWidget->GetEntryLC();
|
|
339 |
entry->SetFlags( entry->GetFlags()
|
|
340 |
& ~EUninstall
|
|
341 |
& ~EVisible
|
|
342 |
& ~EMissing
|
|
343 |
& ~EUsed );
|
|
344 |
iStorage->AddL( entry, EFalse, EItemDisappeared );
|
|
345 |
CleanupStack::PopAndDestroy( entry );
|
|
346 |
}
|
93
|
347 |
}
|
|
348 |
|
|
349 |
// ----------------------------------------------------------------------------
|
|
350 |
//
|
|
351 |
// ----------------------------------------------------------------------------
|
|
352 |
//
|
|
353 |
TBool CCaWidgetStorageHandler::MassStorageNotInUse()
|
|
354 |
{
|
|
355 |
TBool massStorageNotInUse( ETrue );
|
|
356 |
TInt drive;
|
119
|
357 |
if( DriveInfo::GetDefaultDrive(
|
|
358 |
DriveInfo::EDefaultMassStorage, drive ) == KErrNone )
|
93
|
359 |
{
|
119
|
360 |
TVolumeInfo volumeInfo;
|
|
361 |
if( iFs.Volume( volumeInfo, drive ) == KErrNotReady )
|
93
|
362 |
{
|
|
363 |
massStorageNotInUse = EFalse;
|
|
364 |
}
|
|
365 |
}
|
|
366 |
return massStorageNotInUse;
|
|
367 |
}
|
96
|
368 |
// ----------------------------------------------------------------------------
|
|
369 |
//
|
|
370 |
// ----------------------------------------------------------------------------
|
|
371 |
//
|
98
|
372 |
void CCaWidgetStorageHandler::SetLocalizationsL(
|
|
373 |
const CCaWidgetDescription* aWidget, TInt aEntryId )
|
96
|
374 |
{
|
|
375 |
RBuf filename;
|
99
|
376 |
filename.CreateL( aWidget->GetTranslationFileName().Length() + 1 ); //1 for _
|
96
|
377 |
CleanupClosePushL( filename );
|
99
|
378 |
filename.Copy( aWidget->GetTranslationFileName() );
|
96
|
379 |
filename.Append( KWidgetScannerUnderline );
|
98
|
380 |
|
96
|
381 |
// prepare localizations
|
98
|
382 |
if ( aWidget->GetTitle().Length() > 0 && aWidget->GetTitle().Compare(
|
|
383 |
aWidget->GetStringIdTitle() ) )
|
|
384 |
// lets do not add localization when key and value are identical
|
96
|
385 |
{
|
|
386 |
CCaLocalizationEntry* titleEntry = CCaLocalizationEntry::NewL();
|
|
387 |
CleanupStack::PushL( titleEntry );
|
98
|
388 |
titleEntry->SetTableNameL( KLocalizationCaEntry );
|
|
389 |
titleEntry->SetAttributeNameL( KLocalizationEnText );
|
96
|
390 |
titleEntry->SetStringIdL( aWidget->GetStringIdTitle() );
|
|
391 |
titleEntry->SetQmFilenameL( filename );
|
|
392 |
titleEntry->SetRowId( aEntryId );
|
|
393 |
iStorage->AddLocalizationL( *titleEntry );
|
|
394 |
CleanupStack::PopAndDestroy( titleEntry );
|
|
395 |
}
|
|
396 |
if ( aWidget->GetDescription().Length() > 0 &&
|
|
397 |
aWidget->GetDescription().Compare(
|
|
398 |
aWidget->GetStringIdDescription() ) )
|
98
|
399 |
// lets do not add localization when key and value are identical
|
96
|
400 |
{
|
|
401 |
CCaLocalizationEntry* descEntry = CCaLocalizationEntry::NewL();
|
|
402 |
CleanupStack::PushL( descEntry );
|
98
|
403 |
descEntry->SetTableNameL( KLocalizationCaEntry );
|
|
404 |
descEntry->SetAttributeNameL( KLocalizationEnDescription );
|
96
|
405 |
descEntry->SetStringIdL( aWidget->GetStringIdDescription() );
|
|
406 |
descEntry->SetQmFilenameL( filename );
|
|
407 |
descEntry->SetRowId( aEntryId );
|
|
408 |
iStorage->AddLocalizationL( *descEntry );
|
|
409 |
CleanupStack::PopAndDestroy( descEntry );
|
|
410 |
}
|
|
411 |
CleanupStack::PopAndDestroy( &filename );
|
|
412 |
}
|
93
|
413 |
|
94
|
414 |
// ----------------------------------------------------------------------------
|
|
415 |
//
|
|
416 |
// ----------------------------------------------------------------------------
|
|
417 |
//
|
106
|
418 |
void CCaWidgetStorageHandler::UpdateCompIdAndRemovableFlagL(
|
98
|
419 |
const TDesC& aManifestFilePathName, CCaInnerEntry& aEntry ) const
|
94
|
420 |
{
|
|
421 |
RArray<TComponentId> componentIds;
|
|
422 |
CleanupClosePushL( componentIds );
|
98
|
423 |
|
94
|
424 |
CComponentFilter* const fileNameFilter = CComponentFilter::NewLC();
|
|
425 |
fileNameFilter->SetFileL( aManifestFilePathName );
|
|
426 |
iSoftwareRegistry.GetComponentIdsL( componentIds, fileNameFilter );
|
|
427 |
|
|
428 |
CleanupStack::PopAndDestroy( fileNameFilter );
|
98
|
429 |
|
106
|
430 |
if( componentIds.Count() == 1 )
|
94
|
431 |
{
|
|
432 |
RBuf newComponentId;
|
|
433 |
newComponentId.CleanupClosePushL();
|
|
434 |
newComponentId.CreateL( sizeof(TComponentId) + 1 );
|
|
435 |
newComponentId.AppendNum( componentIds[0] );
|
98
|
436 |
|
94
|
437 |
RBuf oldComponentId;
|
|
438 |
oldComponentId.CleanupClosePushL();
|
|
439 |
oldComponentId.CreateL( KCaMaxAttrValueLen );
|
98
|
440 |
|
|
441 |
const TBool componentIdAttributeFound = aEntry.FindAttribute(
|
|
442 |
KCaComponentId, oldComponentId );
|
|
443 |
|
106
|
444 |
if( !componentIdAttributeFound || oldComponentId.Compare(
|
98
|
445 |
newComponentId ) != 0 )
|
94
|
446 |
{
|
|
447 |
// 'add' or 'update' the component id attribute value
|
98
|
448 |
aEntry.AddAttributeL( KCaComponentId, newComponentId );
|
94
|
449 |
}
|
106
|
450 |
CComponentEntry* entry = CComponentEntry::NewLC();
|
|
451 |
iSoftwareRegistry.GetComponentL( componentIds[0] , *entry );
|
|
452 |
if( entry->IsRemovable() )
|
|
453 |
{
|
|
454 |
aEntry.SetFlags( aEntry.GetFlags() | ERemovable );
|
|
455 |
}
|
|
456 |
CleanupStack::PopAndDestroy( entry );
|
94
|
457 |
CleanupStack::PopAndDestroy( &oldComponentId );
|
|
458 |
CleanupStack::PopAndDestroy( &newComponentId );
|
|
459 |
}
|
|
460 |
|
|
461 |
CleanupStack::PopAndDestroy( &componentIds );
|
|
462 |
}
|
|
463 |
|
125
|
464 |
// ---------------------------------------------------------
|
|
465 |
//
|
|
466 |
// ---------------------------------------------------------
|
|
467 |
//
|
|
468 |
void CCaWidgetStorageHandler::MakeNotEmptyCollectionsVisibleL()
|
|
469 |
{
|
|
470 |
RPointerArray<CCaInnerEntry> resultArray;
|
|
471 |
CleanupResetAndDestroyPushL( resultArray );
|
|
472 |
CCaInnerQuery* hiddenCollectionsQuery = CCaInnerQuery::NewLC();
|
|
473 |
CDesC16ArrayFlat* entryType = new ( ELeave ) CDesC16ArrayFlat(
|
|
474 |
KGranularityOne );
|
|
475 |
CleanupStack::PushL( entryType );
|
|
476 |
entryType->AppendL( KCaTypeCollection );
|
|
477 |
hiddenCollectionsQuery->SetEntryTypeNames( entryType );
|
|
478 |
hiddenCollectionsQuery->SetFlagsOff( EVisible );
|
|
479 |
iStorage->GetEntriesL( hiddenCollectionsQuery, resultArray );
|
|
480 |
CleanupStack::Pop( entryType );
|
|
481 |
CleanupStack::PopAndDestroy( hiddenCollectionsQuery );
|
|
482 |
if( resultArray.Count()>0 )
|
|
483 |
{
|
|
484 |
for( TInt i=0; i<resultArray.Count(); i++ )
|
|
485 |
{
|
|
486 |
// for any not visible collection
|
|
487 |
MakeCollectionVisibleIfHasVisibleEntryL( resultArray[i] );
|
|
488 |
}
|
|
489 |
}
|
|
490 |
CleanupStack::PopAndDestroy( &resultArray );
|
|
491 |
}
|
|
492 |
|
|
493 |
// ---------------------------------------------------------
|
|
494 |
//
|
|
495 |
// ---------------------------------------------------------
|
|
496 |
//
|
|
497 |
void CCaWidgetStorageHandler::MakeCollectionVisibleIfHasVisibleEntryL(
|
|
498 |
CCaInnerEntry* aEntry )
|
|
499 |
{
|
|
500 |
RPointerArray<CCaInnerEntry> resultEntriesArray;
|
|
501 |
CleanupResetAndDestroyPushL( resultEntriesArray );
|
|
502 |
CCaInnerQuery* visibleEntriesQuery = CCaInnerQuery::NewLC();
|
|
503 |
visibleEntriesQuery->SetParentId( aEntry->GetId() );
|
|
504 |
visibleEntriesQuery->SetFlagsOn( EVisible );
|
|
505 |
visibleEntriesQuery->SetFlagsOff( EMissing );
|
|
506 |
iStorage->GetEntriesL( visibleEntriesQuery, resultEntriesArray );
|
|
507 |
if( resultEntriesArray.Count()>0 )
|
|
508 |
{
|
|
509 |
// set collection visible if hidden
|
|
510 |
if( !( aEntry->GetFlags() & EVisible ) )
|
|
511 |
{
|
|
512 |
aEntry->SetFlags( aEntry->GetFlags() | EVisible );
|
|
513 |
// update here this collection
|
|
514 |
iStorage->AddL( aEntry );
|
|
515 |
}
|
|
516 |
}
|
|
517 |
CleanupStack::PopAndDestroy( visibleEntriesQuery );
|
|
518 |
CleanupStack::PopAndDestroy( &resultEntriesArray );
|
|
519 |
}
|
|
520 |
|
93
|
521 |
// End of File
|