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