contentstorage/srvsrc/castorageproxy.cpp
author hgs
Fri, 14 May 2010 17:24:44 +0300
changeset 94 dbb8300717f7
parent 93 82b66994846c
child 98 d2f833ab7940
permissions -rw-r--r--
201019
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
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#include "castorage.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#include "castorageproxy.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
#include "castoragefactory.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
#include "cainnerentry.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
#include "cainnerquery.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
#include "caarraycleanup.inl"
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
#include "calocalizationentry.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
#include "casrvsession.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
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
CCaStorageProxy::CCaStorageProxy()
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
// ---------------------------------------------------------------------------
86
hgs
parents: 85
diff changeset
    38
//
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
// ---------------------------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
void CCaStorageProxy::ConstructL()
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
    iStorage = CaStorageFactory::NewDatabaseL();
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
// ---------------------------------------------------------------------------
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
CCaStorageProxy* CCaStorageProxy::NewL()
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
    CCaStorageProxy* self = CCaStorageProxy::NewLC();
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
    CleanupStack::Pop( self );
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
    return self;
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
// ---------------------------------------------------------------------------
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
CCaStorageProxy* CCaStorageProxy::NewLC()
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
    CCaStorageProxy* self = new ( ELeave ) CCaStorageProxy();
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
    CleanupStack::PushL( self );
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
    self->ConstructL();
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
    return self;
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
// ---------------------------------------------------------------------------
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
CCaStorageProxy::~CCaStorageProxy()
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
    delete iStorage;
7feec50967db 201003_02
hgs
parents:
diff changeset
    76
    iHandlerNotifier.Close();
7feec50967db 201003_02
hgs
parents:
diff changeset
    77
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    78
7feec50967db 201003_02
hgs
parents:
diff changeset
    79
// ---------------------------------------------------------------------------
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
EXPORT_C void CCaStorageProxy::GetEntriesL(const CCaInnerQuery* aQuery,
7feec50967db 201003_02
hgs
parents:
diff changeset
    84
        RPointerArray<CCaInnerEntry>& aResultContainer )
7feec50967db 201003_02
hgs
parents:
diff changeset
    85
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    86
    iStorage->GetEntriesL( aQuery, aResultContainer );
7feec50967db 201003_02
hgs
parents:
diff changeset
    87
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    88
86
hgs
parents: 85
diff changeset
    89
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
    90
//
hgs
parents: 85
diff changeset
    91
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    92
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    93
EXPORT_C void CCaStorageProxy::GetEntriesIdsL(const CCaInnerQuery* aQuery,
7feec50967db 201003_02
hgs
parents:
diff changeset
    94
        RArray<TInt>& aResultIdArray)
7feec50967db 201003_02
hgs
parents:
diff changeset
    95
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    96
    iStorage->GetEntriesIdsL( aQuery, aResultIdArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
    97
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    98
86
hgs
parents: 85
diff changeset
    99
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   100
//
hgs
parents: 85
diff changeset
   101
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   102
//
93
hgs
parents: 86
diff changeset
   103
EXPORT_C void CCaStorageProxy::AddL( CCaInnerEntry* aEntry,
hgs
parents: 86
diff changeset
   104
    TBool aUpdate,
hgs
parents: 86
diff changeset
   105
    TItemAppearance aItemAppearanceChange )
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   106
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   107
    TChangeType changeType = EAddChangeType;
7feec50967db 201003_02
hgs
parents:
diff changeset
   108
    RArray<TInt> parentArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
   109
    CleanupClosePushL( parentArray );
93
hgs
parents: 86
diff changeset
   110
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   111
    if( aEntry->GetId() > 0 )
7feec50967db 201003_02
hgs
parents:
diff changeset
   112
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   113
        changeType = EUpdateChangeType;
7feec50967db 201003_02
hgs
parents:
diff changeset
   114
        RArray<TInt> id;
7feec50967db 201003_02
hgs
parents:
diff changeset
   115
        CleanupClosePushL( id );
7feec50967db 201003_02
hgs
parents:
diff changeset
   116
        id.AppendL( aEntry->GetId() );
7feec50967db 201003_02
hgs
parents:
diff changeset
   117
        iStorage->GetParentsIdsL( id, parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   118
        CleanupStack::PopAndDestroy( &id );
7feec50967db 201003_02
hgs
parents:
diff changeset
   119
        }
93
hgs
parents: 86
diff changeset
   120
hgs
parents: 86
diff changeset
   121
    if( aItemAppearanceChange==EItemDisappeared )
hgs
parents: 86
diff changeset
   122
        {
hgs
parents: 86
diff changeset
   123
        changeType = ERemoveChangeType;
hgs
parents: 86
diff changeset
   124
        }
hgs
parents: 86
diff changeset
   125
    else if( aItemAppearanceChange==EItemAppeared )
hgs
parents: 86
diff changeset
   126
        {
hgs
parents: 86
diff changeset
   127
        changeType = EAddChangeType;
hgs
parents: 86
diff changeset
   128
        }
hgs
parents: 86
diff changeset
   129
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   130
    iStorage->AddL( aEntry, aUpdate );
7feec50967db 201003_02
hgs
parents:
diff changeset
   131
    for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
7feec50967db 201003_02
hgs
parents:
diff changeset
   132
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   133
        iHandlerNotifier[i]->EntryChanged( aEntry, changeType, parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   134
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   135
    CleanupStack::PopAndDestroy( &parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   136
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   137
86
hgs
parents: 85
diff changeset
   138
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   139
//
hgs
parents: 85
diff changeset
   140
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   141
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   142
EXPORT_C void CCaStorageProxy::RemoveL( const RArray<TInt>& aEntryIds )
7feec50967db 201003_02
hgs
parents:
diff changeset
   143
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   144
    CCaInnerQuery* query = CCaInnerQuery::NewLC();
7feec50967db 201003_02
hgs
parents:
diff changeset
   145
    query->SetIdsL( aEntryIds );
7feec50967db 201003_02
hgs
parents:
diff changeset
   146
    RPointerArray<CCaInnerEntry> resultContainer;
7feec50967db 201003_02
hgs
parents:
diff changeset
   147
    CleanupResetAndDestroyPushL( resultContainer );
7feec50967db 201003_02
hgs
parents:
diff changeset
   148
    RArray<TInt> parentArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
   149
    CleanupClosePushL( parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   150
    if( aEntryIds.Count() > 0 )
7feec50967db 201003_02
hgs
parents:
diff changeset
   151
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   152
        iStorage->GetEntriesL( query, resultContainer );
7feec50967db 201003_02
hgs
parents:
diff changeset
   153
        iStorage->GetParentsIdsL( aEntryIds, parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   154
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   155
    iStorage->RemoveL( aEntryIds );
7feec50967db 201003_02
hgs
parents:
diff changeset
   156
    for( TInt i( 0 ); i < resultContainer.Count(); i++ )
7feec50967db 201003_02
hgs
parents:
diff changeset
   157
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   158
        for( TInt j( 0 ); j < iHandlerNotifier.Count(); j++ )
7feec50967db 201003_02
hgs
parents:
diff changeset
   159
            {
86
hgs
parents: 85
diff changeset
   160
            iHandlerNotifier[j]->EntryChanged( resultContainer[i],
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   161
                    ERemoveChangeType, parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   162
            }
7feec50967db 201003_02
hgs
parents:
diff changeset
   163
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   164
    CleanupStack::PopAndDestroy( &parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   165
    CleanupStack::PopAndDestroy( &resultContainer );
7feec50967db 201003_02
hgs
parents:
diff changeset
   166
    CleanupStack::PopAndDestroy( query );
7feec50967db 201003_02
hgs
parents:
diff changeset
   167
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   168
86
hgs
parents: 85
diff changeset
   169
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   170
//
hgs
parents: 85
diff changeset
   171
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   172
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   173
EXPORT_C void CCaStorageProxy::OrganizeL( const RArray<TInt>& aEntryIds,
7feec50967db 201003_02
hgs
parents:
diff changeset
   174
        TCaOperationParams aParams )
7feec50967db 201003_02
hgs
parents:
diff changeset
   175
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   176
    iStorage->OrganizeL( aEntryIds, aParams );
7feec50967db 201003_02
hgs
parents:
diff changeset
   177
    RArray<TInt> parentArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
   178
    CleanupClosePushL( parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   179
    parentArray.AppendL( aParams.iGroupId );
7feec50967db 201003_02
hgs
parents:
diff changeset
   180
    iStorage->GetParentsIdsL( parentArray, parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   181
    for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
7feec50967db 201003_02
hgs
parents:
diff changeset
   182
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   183
        iHandlerNotifier[i]->GroupContentChanged( parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   184
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   185
    CleanupStack::PopAndDestroy( &parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   186
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   187
86
hgs
parents: 85
diff changeset
   188
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   189
//
hgs
parents: 85
diff changeset
   190
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   191
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   192
EXPORT_C void CCaStorageProxy::TouchL( CCaInnerEntry* aEntry )
7feec50967db 201003_02
hgs
parents:
diff changeset
   193
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   194
    CCaInnerQuery* touchQuery = CCaInnerQuery::NewLC();
86
hgs
parents: 85
diff changeset
   195
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   196
    TInt entryId = aEntry->GetId();
86
hgs
parents: 85
diff changeset
   197
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   198
    if ( entryId == 0 && aEntry->GetUid() != 0)
7feec50967db 201003_02
hgs
parents:
diff changeset
   199
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   200
        CCaInnerQuery* idQuery = CCaInnerQuery::NewLC();
7feec50967db 201003_02
hgs
parents:
diff changeset
   201
        idQuery->SetUid( static_cast<TUint>( aEntry->GetUid()) );
86
hgs
parents: 85
diff changeset
   202
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   203
        RArray<TInt> idArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
   204
        CleanupClosePushL( idArray );
86
hgs
parents: 85
diff changeset
   205
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   206
        iStorage->GetEntriesIdsL( idQuery, idArray );
86
hgs
parents: 85
diff changeset
   207
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   208
        if (idArray.Count() == 1 )
7feec50967db 201003_02
hgs
parents:
diff changeset
   209
            {
7feec50967db 201003_02
hgs
parents:
diff changeset
   210
            entryId = idArray[0];
7feec50967db 201003_02
hgs
parents:
diff changeset
   211
            aEntry->SetId( entryId );
86
hgs
parents: 85
diff changeset
   212
            }
hgs
parents: 85
diff changeset
   213
hgs
parents: 85
diff changeset
   214
        CleanupStack::PopAndDestroy( &idArray );
hgs
parents: 85
diff changeset
   215
        CleanupStack::PopAndDestroy( idQuery );
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   216
        }
86
hgs
parents: 85
diff changeset
   217
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   218
    RArray<TInt> id;
7feec50967db 201003_02
hgs
parents:
diff changeset
   219
    CleanupClosePushL( id );
7feec50967db 201003_02
hgs
parents:
diff changeset
   220
    id.AppendL( entryId );
7feec50967db 201003_02
hgs
parents:
diff changeset
   221
    touchQuery->SetIdsL( id );
7feec50967db 201003_02
hgs
parents:
diff changeset
   222
    RPointerArray<CCaInnerEntry> resultArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
   223
    CleanupResetAndDestroyPushL( resultArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   224
    iStorage->GetEntriesL( touchQuery, resultArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   225
    iStorage->TouchL( entryId );
7feec50967db 201003_02
hgs
parents:
diff changeset
   226
    for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
7feec50967db 201003_02
hgs
parents:
diff changeset
   227
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   228
        iHandlerNotifier[i]->EntryTouched( entryId );
7feec50967db 201003_02
hgs
parents:
diff changeset
   229
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   230
    if( resultArray.Count() > 0 )
7feec50967db 201003_02
hgs
parents:
diff changeset
   231
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   232
        if( !( resultArray[0]->GetFlags() & EUsed ) )
7feec50967db 201003_02
hgs
parents:
diff changeset
   233
            {
7feec50967db 201003_02
hgs
parents:
diff changeset
   234
            RArray<TInt> parentArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
   235
            CleanupClosePushL( parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   236
            iStorage->GetParentsIdsL( id, parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   237
            for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
7feec50967db 201003_02
hgs
parents:
diff changeset
   238
                {
86
hgs
parents: 85
diff changeset
   239
                iHandlerNotifier[i]->EntryChanged( resultArray[0],
hgs
parents: 85
diff changeset
   240
                        EUpdateChangeType,
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   241
                        parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   242
                }
7feec50967db 201003_02
hgs
parents:
diff changeset
   243
            CleanupStack::PopAndDestroy( &parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   244
            }
7feec50967db 201003_02
hgs
parents:
diff changeset
   245
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   246
    CleanupStack::PopAndDestroy( &resultArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   247
    CleanupStack::PopAndDestroy( &id );
7feec50967db 201003_02
hgs
parents:
diff changeset
   248
    CleanupStack::PopAndDestroy( touchQuery );
7feec50967db 201003_02
hgs
parents:
diff changeset
   249
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   250
86
hgs
parents: 85
diff changeset
   251
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   252
//
hgs
parents: 85
diff changeset
   253
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   254
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   255
EXPORT_C void CCaStorageProxy::GetLocalizationsL(
7feec50967db 201003_02
hgs
parents:
diff changeset
   256
        RPointerArray<CCaLocalizationEntry>& aResultArray )
7feec50967db 201003_02
hgs
parents:
diff changeset
   257
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   258
    iStorage->GetLocalizationsL( aResultArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   259
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   260
86
hgs
parents: 85
diff changeset
   261
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   262
//
hgs
parents: 85
diff changeset
   263
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   264
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   265
EXPORT_C void CCaStorageProxy::LocalizeEntryL(
7feec50967db 201003_02
hgs
parents:
diff changeset
   266
        CCaLocalizationEntry& aLocalization )
7feec50967db 201003_02
hgs
parents:
diff changeset
   267
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   268
    iStorage->LocalizeEntryL( aLocalization );
7feec50967db 201003_02
hgs
parents:
diff changeset
   269
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   270
86
hgs
parents: 85
diff changeset
   271
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   272
//
hgs
parents: 85
diff changeset
   273
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   274
//
94
hgs
parents: 93
diff changeset
   275
EXPORT_C void CCaStorageProxy::AddLocalizationL(
hgs
parents: 93
diff changeset
   276
		const CCaLocalizationEntry& aLocalization)
hgs
parents: 93
diff changeset
   277
	{
hgs
parents: 93
diff changeset
   278
	iStorage->AddLocalizationL(aLocalization);
hgs
parents: 93
diff changeset
   279
	}
hgs
parents: 93
diff changeset
   280
hgs
parents: 93
diff changeset
   281
// ---------------------------------------------------------------------------
hgs
parents: 93
diff changeset
   282
//
hgs
parents: 93
diff changeset
   283
// ---------------------------------------------------------------------------
hgs
parents: 93
diff changeset
   284
//
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   285
EXPORT_C void CCaStorageProxy::DbPropertyL( const TDesC& aProperty,
7feec50967db 201003_02
hgs
parents:
diff changeset
   286
        TDes& aPropertyValue )
7feec50967db 201003_02
hgs
parents:
diff changeset
   287
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   288
    iStorage->DbPropertyL( aProperty, aPropertyValue );
7feec50967db 201003_02
hgs
parents:
diff changeset
   289
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   290
86
hgs
parents: 85
diff changeset
   291
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   292
//
hgs
parents: 85
diff changeset
   293
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   294
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   295
EXPORT_C void CCaStorageProxy::SetDBPropertyL( const TDesC& aProperty,
7feec50967db 201003_02
hgs
parents:
diff changeset
   296
        const TDesC& aPropertyValue )
7feec50967db 201003_02
hgs
parents:
diff changeset
   297
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   298
    iStorage->SetDBPropertyL( aProperty, aPropertyValue );
7feec50967db 201003_02
hgs
parents:
diff changeset
   299
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   300
86
hgs
parents: 85
diff changeset
   301
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   302
//
hgs
parents: 85
diff changeset
   303
// ---------------------------------------------------------------------------
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   304
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   305
EXPORT_C void CCaStorageProxy::CustomSortL( const RArray<TInt>& aEntryIds,
7feec50967db 201003_02
hgs
parents:
diff changeset
   306
        const TInt aGroupId )
7feec50967db 201003_02
hgs
parents:
diff changeset
   307
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   308
    iStorage->CustomSortL( aEntryIds, aGroupId );
86
hgs
parents: 85
diff changeset
   309
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   310
    RArray<TInt> parentArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
   311
    CleanupClosePushL( parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   312
    parentArray.AppendL( aGroupId );
7feec50967db 201003_02
hgs
parents:
diff changeset
   313
    for( TInt i = 0; i < iHandlerNotifier.Count(); i++ )
7feec50967db 201003_02
hgs
parents:
diff changeset
   314
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   315
        iHandlerNotifier[i]->GroupContentChanged( parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   316
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   317
    CleanupStack::PopAndDestroy( &parentArray );
7feec50967db 201003_02
hgs
parents:
diff changeset
   318
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   319
86
hgs
parents: 85
diff changeset
   320
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   321
//
hgs
parents: 85
diff changeset
   322
// ---------------------------------------------------------------------------
hgs
parents: 85
diff changeset
   323
//
hgs
parents: 85
diff changeset
   324
EXPORT_C void CCaStorageProxy::LoadDataBaseFromRomL()
hgs
parents: 85
diff changeset
   325
    {
hgs
parents: 85
diff changeset
   326
    iStorage->LoadDataBaseFromRomL();
hgs
parents: 85
diff changeset
   327
    }
hgs
parents: 85
diff changeset
   328
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   329
// ---------------------------------------------------------
86
hgs
parents: 85
diff changeset
   330
//
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   331
// ---------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
   332
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   333
void CCaStorageProxy::AddSessionL( MCaSessionNorifier* aHandlerNotifier )
7feec50967db 201003_02
hgs
parents:
diff changeset
   334
    {
86
hgs
parents: 85
diff changeset
   335
    __ASSERT_ALWAYS(
hgs
parents: 85
diff changeset
   336
            iHandlerNotifier.Find( aHandlerNotifier ) == KErrNotFound,
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   337
            User::Invariant() );
7feec50967db 201003_02
hgs
parents:
diff changeset
   338
    iHandlerNotifier.AppendL( aHandlerNotifier );
7feec50967db 201003_02
hgs
parents:
diff changeset
   339
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   340
7feec50967db 201003_02
hgs
parents:
diff changeset
   341
// ---------------------------------------------------------
86
hgs
parents: 85
diff changeset
   342
//
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   343
// ---------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
   344
//
7feec50967db 201003_02
hgs
parents:
diff changeset
   345
void CCaStorageProxy::RemoveSession( MCaSessionNorifier* aHandlerNotifier )
7feec50967db 201003_02
hgs
parents:
diff changeset
   346
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   347
    TInt i = iHandlerNotifier.Find( aHandlerNotifier );
7feec50967db 201003_02
hgs
parents:
diff changeset
   348
    if( i != KErrNotFound )
7feec50967db 201003_02
hgs
parents:
diff changeset
   349
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   350
        iHandlerNotifier.Remove( i );
7feec50967db 201003_02
hgs
parents:
diff changeset
   351
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   352
    }