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