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 |
|
98
|
18 |
#include <driveinfo.h>
|
|
19 |
#include <hbtextresolversymbian.h>
|
|
20 |
|
85
|
21 |
#include "castorage.h"
|
|
22 |
#include "castorageproxy.h"
|
|
23 |
#include "castoragefactory.h"
|
|
24 |
#include "cainnerentry.h"
|
|
25 |
#include "cainnerquery.h"
|
|
26 |
#include "caarraycleanup.inl"
|
|
27 |
#include "calocalizationentry.h"
|
|
28 |
#include "casrvsession.h"
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
// ---------------------------------------------------------------------------
|
|
33 |
//
|
|
34 |
// ---------------------------------------------------------------------------
|
|
35 |
//
|
|
36 |
CCaStorageProxy::CCaStorageProxy()
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
// ---------------------------------------------------------------------------
|
86
|
41 |
//
|
85
|
42 |
// ---------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
void CCaStorageProxy::ConstructL()
|
|
45 |
{
|
|
46 |
iStorage = CaStorageFactory::NewDatabaseL();
|
|
47 |
}
|
|
48 |
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
CCaStorageProxy* CCaStorageProxy::NewL()
|
|
54 |
{
|
|
55 |
CCaStorageProxy* self = CCaStorageProxy::NewLC();
|
|
56 |
CleanupStack::Pop( self );
|
|
57 |
return self;
|
|
58 |
}
|
|
59 |
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
CCaStorageProxy* CCaStorageProxy::NewLC()
|
|
65 |
{
|
|
66 |
CCaStorageProxy* self = new ( ELeave ) CCaStorageProxy();
|
|
67 |
CleanupStack::PushL( self );
|
|
68 |
self->ConstructL();
|
|
69 |
return self;
|
|
70 |
}
|
|
71 |
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
CCaStorageProxy::~CCaStorageProxy()
|
|
77 |
{
|
|
78 |
delete iStorage;
|
|
79 |
iHandlerNotifier.Close();
|
|
80 |
}
|
|
81 |
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
// ---------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
EXPORT_C void CCaStorageProxy::GetEntriesL(const CCaInnerQuery* aQuery,
|
|
87 |
RPointerArray<CCaInnerEntry>& aResultContainer )
|
|
88 |
{
|
|
89 |
iStorage->GetEntriesL( aQuery, aResultContainer );
|
|
90 |
}
|
|
91 |
|
86
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
// ---------------------------------------------------------------------------
|
85
|
95 |
//
|
|
96 |
EXPORT_C void CCaStorageProxy::GetEntriesIdsL(const CCaInnerQuery* aQuery,
|
|
97 |
RArray<TInt>& aResultIdArray)
|
|
98 |
{
|
|
99 |
iStorage->GetEntriesIdsL( aQuery, aResultIdArray );
|
|
100 |
}
|
|
101 |
|
86
|
102 |
// ---------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
// ---------------------------------------------------------------------------
|
85
|
105 |
//
|
93
|
106 |
EXPORT_C void CCaStorageProxy::AddL( CCaInnerEntry* aEntry,
|
|
107 |
TBool aUpdate,
|
|
108 |
TItemAppearance aItemAppearanceChange )
|
85
|
109 |
{
|
|
110 |
TChangeType changeType = EAddChangeType;
|
|
111 |
RArray<TInt> parentArray;
|
|
112 |
CleanupClosePushL( parentArray );
|
98
|
113 |
|
85
|
114 |
if( aEntry->GetId() > 0 )
|
|
115 |
{
|
|
116 |
changeType = EUpdateChangeType;
|
|
117 |
RArray<TInt> id;
|
|
118 |
CleanupClosePushL( id );
|
|
119 |
id.AppendL( aEntry->GetId() );
|
98
|
120 |
if (aItemAppearanceChange == EItemUninstallProgressChanged)
|
|
121 |
{
|
|
122 |
// no need to search for parent parents for uninstall
|
|
123 |
// progress change
|
|
124 |
iStorage->GetParentsIdsL( id, parentArray, EFalse );
|
|
125 |
}
|
|
126 |
else
|
|
127 |
{
|
|
128 |
iStorage->GetParentsIdsL( id, parentArray );
|
|
129 |
}
|
85
|
130 |
CleanupStack::PopAndDestroy( &id );
|
|
131 |
}
|
93
|
132 |
|
|
133 |
if( aItemAppearanceChange==EItemDisappeared )
|
|
134 |
{
|
|
135 |
changeType = ERemoveChangeType;
|
|
136 |
}
|
|
137 |
else if( aItemAppearanceChange==EItemAppeared )
|
|
138 |
{
|
|
139 |
changeType = EAddChangeType;
|
|
140 |
}
|
98
|
141 |
|
|
142 |
// do not update entry in db with uninstall progress
|
|
143 |
if (aItemAppearanceChange != EItemUninstallProgressChanged)
|
|
144 |
{
|
|
145 |
RPointerArray<CCaLocalizationEntry> localizations;
|
|
146 |
CleanupResetAndDestroyPushL( localizations );
|
|
147 |
CCaLocalizationEntry* tempLocalization = NULL;
|
|
148 |
if( aEntry->isLocalized( CCaInnerEntry::ENameLocalized ) )
|
|
149 |
{
|
|
150 |
tempLocalization = LocalizeTextL( aEntry );
|
|
151 |
if( tempLocalization )
|
|
152 |
{
|
|
153 |
localizations.Append( tempLocalization );
|
|
154 |
tempLocalization = NULL;
|
|
155 |
}
|
|
156 |
}
|
|
157 |
if( aEntry->isLocalized( CCaInnerEntry::EDescriptionLocalized ) )
|
|
158 |
{
|
|
159 |
tempLocalization = LocalizeDescriptionL( aEntry );
|
|
160 |
if (tempLocalization)
|
|
161 |
{
|
|
162 |
localizations.Append(tempLocalization);
|
|
163 |
tempLocalization = NULL;
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
iStorage->AddL( aEntry, aUpdate );
|
|
168 |
|
|
169 |
for( TInt j =0; j < localizations.Count(); j++ )
|
|
170 |
{
|
|
171 |
localizations[j]->SetRowId( aEntry->GetId() );
|
|
172 |
AddLocalizationL( *( localizations[j] ) );
|
|
173 |
}
|
|
174 |
if( localizations.Count() > 0 )
|
|
175 |
{
|
|
176 |
HbTextResolverSymbian::Init( _L(""), KLocalizationFilepathZ );
|
|
177 |
}
|
|
178 |
CleanupStack::PopAndDestroy( &localizations );
|
|
179 |
}
|
|
180 |
|
|
181 |
|
85
|
182 |
for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
|
|
183 |
{
|
|
184 |
iHandlerNotifier[i]->EntryChanged( aEntry, changeType, parentArray );
|
|
185 |
}
|
|
186 |
CleanupStack::PopAndDestroy( &parentArray );
|
|
187 |
}
|
|
188 |
|
86
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
// ---------------------------------------------------------------------------
|
85
|
192 |
//
|
|
193 |
EXPORT_C void CCaStorageProxy::RemoveL( const RArray<TInt>& aEntryIds )
|
|
194 |
{
|
|
195 |
CCaInnerQuery* query = CCaInnerQuery::NewLC();
|
|
196 |
query->SetIdsL( aEntryIds );
|
|
197 |
RPointerArray<CCaInnerEntry> resultContainer;
|
|
198 |
CleanupResetAndDestroyPushL( resultContainer );
|
|
199 |
RArray<TInt> parentArray;
|
|
200 |
CleanupClosePushL( parentArray );
|
|
201 |
if( aEntryIds.Count() > 0 )
|
|
202 |
{
|
|
203 |
iStorage->GetEntriesL( query, resultContainer );
|
|
204 |
iStorage->GetParentsIdsL( aEntryIds, parentArray );
|
|
205 |
}
|
|
206 |
iStorage->RemoveL( aEntryIds );
|
|
207 |
for( TInt i( 0 ); i < resultContainer.Count(); i++ )
|
|
208 |
{
|
|
209 |
for( TInt j( 0 ); j < iHandlerNotifier.Count(); j++ )
|
|
210 |
{
|
86
|
211 |
iHandlerNotifier[j]->EntryChanged( resultContainer[i],
|
85
|
212 |
ERemoveChangeType, parentArray );
|
|
213 |
}
|
|
214 |
}
|
|
215 |
CleanupStack::PopAndDestroy( &parentArray );
|
|
216 |
CleanupStack::PopAndDestroy( &resultContainer );
|
|
217 |
CleanupStack::PopAndDestroy( query );
|
|
218 |
}
|
|
219 |
|
86
|
220 |
// ---------------------------------------------------------------------------
|
|
221 |
//
|
|
222 |
// ---------------------------------------------------------------------------
|
85
|
223 |
//
|
|
224 |
EXPORT_C void CCaStorageProxy::OrganizeL( const RArray<TInt>& aEntryIds,
|
|
225 |
TCaOperationParams aParams )
|
|
226 |
{
|
|
227 |
iStorage->OrganizeL( aEntryIds, aParams );
|
|
228 |
RArray<TInt> parentArray;
|
|
229 |
CleanupClosePushL( parentArray );
|
|
230 |
parentArray.AppendL( aParams.iGroupId );
|
|
231 |
iStorage->GetParentsIdsL( parentArray, parentArray );
|
|
232 |
for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
|
|
233 |
{
|
|
234 |
iHandlerNotifier[i]->GroupContentChanged( parentArray );
|
|
235 |
}
|
|
236 |
CleanupStack::PopAndDestroy( &parentArray );
|
|
237 |
}
|
|
238 |
|
86
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
// ---------------------------------------------------------------------------
|
85
|
242 |
//
|
|
243 |
EXPORT_C void CCaStorageProxy::TouchL( CCaInnerEntry* aEntry )
|
|
244 |
{
|
|
245 |
CCaInnerQuery* touchQuery = CCaInnerQuery::NewLC();
|
86
|
246 |
|
85
|
247 |
TInt entryId = aEntry->GetId();
|
86
|
248 |
|
85
|
249 |
if ( entryId == 0 && aEntry->GetUid() != 0)
|
|
250 |
{
|
|
251 |
CCaInnerQuery* idQuery = CCaInnerQuery::NewLC();
|
|
252 |
idQuery->SetUid( static_cast<TUint>( aEntry->GetUid()) );
|
86
|
253 |
|
85
|
254 |
RArray<TInt> idArray;
|
|
255 |
CleanupClosePushL( idArray );
|
86
|
256 |
|
85
|
257 |
iStorage->GetEntriesIdsL( idQuery, idArray );
|
86
|
258 |
|
85
|
259 |
if (idArray.Count() == 1 )
|
|
260 |
{
|
|
261 |
entryId = idArray[0];
|
|
262 |
aEntry->SetId( entryId );
|
86
|
263 |
}
|
|
264 |
|
|
265 |
CleanupStack::PopAndDestroy( &idArray );
|
|
266 |
CleanupStack::PopAndDestroy( idQuery );
|
85
|
267 |
}
|
86
|
268 |
|
85
|
269 |
RArray<TInt> id;
|
|
270 |
CleanupClosePushL( id );
|
|
271 |
id.AppendL( entryId );
|
|
272 |
touchQuery->SetIdsL( id );
|
|
273 |
RPointerArray<CCaInnerEntry> resultArray;
|
|
274 |
CleanupResetAndDestroyPushL( resultArray );
|
|
275 |
iStorage->GetEntriesL( touchQuery, resultArray );
|
|
276 |
iStorage->TouchL( entryId );
|
|
277 |
for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
|
|
278 |
{
|
|
279 |
iHandlerNotifier[i]->EntryTouched( entryId );
|
|
280 |
}
|
|
281 |
if( resultArray.Count() > 0 )
|
|
282 |
{
|
|
283 |
if( !( resultArray[0]->GetFlags() & EUsed ) )
|
|
284 |
{
|
|
285 |
RArray<TInt> parentArray;
|
|
286 |
CleanupClosePushL( parentArray );
|
|
287 |
iStorage->GetParentsIdsL( id, parentArray );
|
|
288 |
for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
|
|
289 |
{
|
99
|
290 |
resultArray[0]->SetFlags(
|
|
291 |
resultArray[0]->GetFlags() | EUsed );
|
86
|
292 |
iHandlerNotifier[i]->EntryChanged( resultArray[0],
|
|
293 |
EUpdateChangeType,
|
85
|
294 |
parentArray );
|
|
295 |
}
|
|
296 |
CleanupStack::PopAndDestroy( &parentArray );
|
|
297 |
}
|
|
298 |
}
|
|
299 |
CleanupStack::PopAndDestroy( &resultArray );
|
|
300 |
CleanupStack::PopAndDestroy( &id );
|
|
301 |
CleanupStack::PopAndDestroy( touchQuery );
|
|
302 |
}
|
|
303 |
|
86
|
304 |
// ---------------------------------------------------------------------------
|
|
305 |
//
|
|
306 |
// ---------------------------------------------------------------------------
|
85
|
307 |
//
|
|
308 |
EXPORT_C void CCaStorageProxy::GetLocalizationsL(
|
|
309 |
RPointerArray<CCaLocalizationEntry>& aResultArray )
|
|
310 |
{
|
|
311 |
iStorage->GetLocalizationsL( aResultArray );
|
|
312 |
}
|
|
313 |
|
86
|
314 |
// ---------------------------------------------------------------------------
|
|
315 |
//
|
|
316 |
// ---------------------------------------------------------------------------
|
85
|
317 |
//
|
|
318 |
EXPORT_C void CCaStorageProxy::LocalizeEntryL(
|
|
319 |
CCaLocalizationEntry& aLocalization )
|
|
320 |
{
|
|
321 |
iStorage->LocalizeEntryL( aLocalization );
|
|
322 |
}
|
|
323 |
|
86
|
324 |
// ---------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
// ---------------------------------------------------------------------------
|
85
|
327 |
//
|
94
|
328 |
EXPORT_C void CCaStorageProxy::AddLocalizationL(
|
|
329 |
const CCaLocalizationEntry& aLocalization)
|
|
330 |
{
|
|
331 |
iStorage->AddLocalizationL(aLocalization);
|
|
332 |
}
|
|
333 |
|
|
334 |
// ---------------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
//
|
85
|
338 |
EXPORT_C void CCaStorageProxy::DbPropertyL( const TDesC& aProperty,
|
|
339 |
TDes& aPropertyValue )
|
|
340 |
{
|
|
341 |
iStorage->DbPropertyL( aProperty, aPropertyValue );
|
|
342 |
}
|
|
343 |
|
86
|
344 |
// ---------------------------------------------------------------------------
|
|
345 |
//
|
|
346 |
// ---------------------------------------------------------------------------
|
85
|
347 |
//
|
|
348 |
EXPORT_C void CCaStorageProxy::SetDBPropertyL( const TDesC& aProperty,
|
|
349 |
const TDesC& aPropertyValue )
|
|
350 |
{
|
|
351 |
iStorage->SetDBPropertyL( aProperty, aPropertyValue );
|
|
352 |
}
|
|
353 |
|
86
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
//
|
|
356 |
// ---------------------------------------------------------------------------
|
85
|
357 |
//
|
|
358 |
EXPORT_C void CCaStorageProxy::CustomSortL( const RArray<TInt>& aEntryIds,
|
|
359 |
const TInt aGroupId )
|
|
360 |
{
|
|
361 |
iStorage->CustomSortL( aEntryIds, aGroupId );
|
86
|
362 |
|
85
|
363 |
RArray<TInt> parentArray;
|
|
364 |
CleanupClosePushL( parentArray );
|
|
365 |
parentArray.AppendL( aGroupId );
|
102
|
366 |
iStorage->GetParentsIdsL( parentArray, parentArray );
|
85
|
367 |
for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
|
|
368 |
{
|
|
369 |
iHandlerNotifier[i]->GroupContentChanged( parentArray );
|
|
370 |
}
|
|
371 |
CleanupStack::PopAndDestroy( &parentArray );
|
|
372 |
}
|
|
373 |
|
98
|
374 |
#ifdef COVERAGE_MEASUREMENT
|
|
375 |
#pragma CTC SKIP
|
|
376 |
#endif //COVERAGE_MEASUREMENT (calls another method)
|
86
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
//
|
|
379 |
// ---------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
EXPORT_C void CCaStorageProxy::LoadDataBaseFromRomL()
|
|
382 |
{
|
|
383 |
iStorage->LoadDataBaseFromRomL();
|
|
384 |
}
|
98
|
385 |
#ifdef COVERAGE_MEASUREMENT
|
|
386 |
#pragma CTC ENDSKIP
|
|
387 |
#endif //COVERAGE_MEASUREMENT
|
86
|
388 |
|
85
|
389 |
// ---------------------------------------------------------
|
86
|
390 |
//
|
85
|
391 |
// ---------------------------------------------------------
|
|
392 |
//
|
|
393 |
void CCaStorageProxy::AddSessionL( MCaSessionNorifier* aHandlerNotifier )
|
|
394 |
{
|
86
|
395 |
__ASSERT_ALWAYS(
|
|
396 |
iHandlerNotifier.Find( aHandlerNotifier ) == KErrNotFound,
|
85
|
397 |
User::Invariant() );
|
|
398 |
iHandlerNotifier.AppendL( aHandlerNotifier );
|
|
399 |
}
|
|
400 |
|
|
401 |
// ---------------------------------------------------------
|
86
|
402 |
//
|
85
|
403 |
// ---------------------------------------------------------
|
|
404 |
//
|
|
405 |
void CCaStorageProxy::RemoveSession( MCaSessionNorifier* aHandlerNotifier )
|
|
406 |
{
|
|
407 |
TInt i = iHandlerNotifier.Find( aHandlerNotifier );
|
|
408 |
if( i != KErrNotFound )
|
|
409 |
{
|
|
410 |
iHandlerNotifier.Remove( i );
|
|
411 |
}
|
|
412 |
}
|
98
|
413 |
|
|
414 |
// ---------------------------------------------------------
|
|
415 |
//
|
|
416 |
// ---------------------------------------------------------
|
|
417 |
//
|
|
418 |
CCaLocalizationEntry* CCaStorageProxy::LocalizeTextL( CCaInnerEntry* aEntry )
|
|
419 |
{
|
|
420 |
CCaLocalizationEntry* result = NULL;
|
|
421 |
TInt textLength = aEntry->GetText().Length();
|
|
422 |
if (textLength > 0)
|
|
423 |
{
|
|
424 |
TChar delimiter = '/'; // cannot add it as global
|
|
425 |
RBuf title;
|
|
426 |
CleanupClosePushL( title );
|
|
427 |
title.CreateL( aEntry->GetText() );
|
|
428 |
TInt pos = title.LocateReverse( delimiter );
|
|
429 |
if ( pos > 0 && pos + 1 < textLength ) // 1 is for delimiters
|
|
430 |
{
|
|
431 |
TPtrC16 logString = title.Mid( pos + 1 );
|
|
432 |
TInt qmFileNameLength = textLength - charsToFilename - 1 - logString.Length();
|
|
433 |
TPtrC16 qmFile = title.Mid( charsToFilename, qmFileNameLength );
|
|
434 |
if ( InitializeTranslatorL( qmFile ) )
|
|
435 |
{
|
|
436 |
result = CCaLocalizationEntry::NewLC();
|
|
437 |
HBufC* translatedString = HbTextResolverSymbian::LoadLC( logString );
|
|
438 |
if ( translatedString->Compare( logString ) )
|
|
439 |
{
|
|
440 |
result->SetStringIdL( logString );
|
|
441 |
aEntry->SetTextL( *translatedString );
|
|
442 |
if( translatedString )
|
|
443 |
{
|
|
444 |
CleanupStack::PopAndDestroy( translatedString );
|
|
445 |
}
|
|
446 |
result->SetTableNameL( KLocalizationCaEntry );
|
|
447 |
result->SetAttributeNameL( KLocalizationEnText );
|
|
448 |
result->SetQmFilenameL( qmFile );
|
|
449 |
result->SetRowId( aEntry->GetId() ? 0 : aEntry->GetId() ); // must be added when present
|
99
|
450 |
CleanupStack::Pop( result );
|
98
|
451 |
}
|
|
452 |
else
|
|
453 |
{
|
99
|
454 |
CleanupStack::PopAndDestroy(translatedString);
|
|
455 |
CleanupStack::PopAndDestroy(result);
|
|
456 |
result = NULL;
|
98
|
457 |
}
|
|
458 |
}
|
|
459 |
}
|
|
460 |
CleanupStack::PopAndDestroy( &title );
|
|
461 |
}
|
|
462 |
return result;
|
|
463 |
}
|
|
464 |
|
|
465 |
// ---------------------------------------------------------
|
|
466 |
//
|
|
467 |
// ---------------------------------------------------------
|
|
468 |
//
|
|
469 |
CCaLocalizationEntry* CCaStorageProxy::LocalizeDescriptionL( CCaInnerEntry* aEntry )
|
|
470 |
{
|
|
471 |
CCaLocalizationEntry* result = NULL;
|
|
472 |
TInt dscLength = aEntry->GetDescription().Length();
|
|
473 |
if ( dscLength )
|
|
474 |
{
|
|
475 |
TChar delimiter = '/'; // cannot add it as global
|
|
476 |
RBuf description;
|
|
477 |
CleanupClosePushL( description );
|
|
478 |
description.CreateL( aEntry->GetDescription() );
|
|
479 |
TInt pos = description.LocateReverse( delimiter );
|
|
480 |
if ( pos > 0 && pos + 1 < dscLength ) // 1 is for delimiters
|
|
481 |
{
|
|
482 |
TPtrC16 logString = description.Mid(pos + 1);
|
|
483 |
TInt qmFileNameLength = dscLength - charsToFilename - 1 - logString.Length();
|
|
484 |
TPtrC16 qmFile = description.Mid(charsToFilename, qmFileNameLength);
|
|
485 |
if ( InitializeTranslatorL( qmFile ) )
|
|
486 |
{
|
|
487 |
result = CCaLocalizationEntry::NewLC();
|
|
488 |
HBufC* translatedString = HbTextResolverSymbian::LoadLC( logString );
|
|
489 |
if ( translatedString->Compare( logString ) )
|
|
490 |
{
|
|
491 |
result->SetStringIdL( logString );
|
|
492 |
aEntry->SetDescriptionL( *translatedString );
|
|
493 |
CleanupStack::PopAndDestroy( translatedString );
|
|
494 |
result->SetTableNameL( KLocalizationCaEntry );
|
|
495 |
result->SetAttributeNameL( KLocalizationEnDescription );
|
|
496 |
result->SetQmFilenameL( qmFile );
|
|
497 |
result->SetRowId( aEntry->GetId() ? 0 : aEntry->GetId() ); // must be added when present
|
99
|
498 |
CleanupStack::Pop( result );
|
98
|
499 |
}
|
|
500 |
else
|
|
501 |
{
|
|
502 |
CleanupStack::PopAndDestroy( translatedString );
|
99
|
503 |
CleanupStack::PopAndDestroy( result );
|
|
504 |
result = NULL;
|
98
|
505 |
}
|
99
|
506 |
|
98
|
507 |
}
|
|
508 |
}
|
|
509 |
CleanupStack::PopAndDestroy( &description );
|
|
510 |
}
|
99
|
511 |
|
98
|
512 |
return result;
|
|
513 |
}
|
|
514 |
|
|
515 |
// ---------------------------------------------------------
|
|
516 |
//
|
|
517 |
// ---------------------------------------------------------
|
|
518 |
//
|
|
519 |
TBool CCaStorageProxy::InitializeTranslatorL( TDesC& aQmFilename )
|
|
520 |
{
|
|
521 |
TBool result = HbTextResolverSymbian::Init( aQmFilename, KLocalizationFilepathC );
|
|
522 |
if ( !result )
|
|
523 |
{
|
|
524 |
// this should not be called too often
|
|
525 |
TChar currentDriveLetter;
|
|
526 |
TDriveList driveList;
|
|
527 |
RFs fs;
|
|
528 |
User::LeaveIfError( fs.Connect() );
|
|
529 |
User::LeaveIfError( fs.DriveList( driveList ) );
|
|
530 |
|
|
531 |
RBuf path;
|
|
532 |
CleanupClosePushL( path );
|
|
533 |
path.CreateL( KLocalizationFilepath().Length() + 1 );
|
|
534 |
|
|
535 |
for ( TInt driveNr = EDriveY; driveNr >= EDriveA; driveNr-- )
|
|
536 |
{
|
|
537 |
if ( driveList[driveNr] )
|
|
538 |
{
|
|
539 |
User::LeaveIfError(fs.DriveToChar( driveNr, currentDriveLetter ));
|
|
540 |
path.Append( currentDriveLetter );
|
|
541 |
path.Append( KLocalizationFilepath );
|
|
542 |
if (HbTextResolverSymbian::Init( aQmFilename, path ))
|
|
543 |
{
|
|
544 |
result = ETrue;
|
|
545 |
break;
|
|
546 |
}
|
|
547 |
}
|
|
548 |
path.Zero();
|
|
549 |
}
|
|
550 |
CleanupStack::PopAndDestroy( &path );
|
|
551 |
fs.Close();
|
|
552 |
|
|
553 |
if( !result )
|
|
554 |
{
|
|
555 |
result = HbTextResolverSymbian::Init( aQmFilename, KLocalizationFilepathZ );
|
|
556 |
}
|
|
557 |
}
|
|
558 |
return result;
|
|
559 |
}
|