omads/omadsextensions/adapters/contacts/src/NSmlContactsDataStore.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 20:55:10 +0300
branchRCL_3
changeset 26 3e6957da2ff8
parent 25 4f0867e42d62
permissions -rw-r--r--
Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  DS contacts dataprovider
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
// INCLUDE FILES
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <barsc.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <bautils.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <e32base.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <s32strm.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <e32cmn.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <e32des16.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <s32mem.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <implementationproxy.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include <vtoken.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include <sysutil.h>
26
3e6957da2ff8 Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    30
#include <nsmlcontactsdatastoreformat_1_1_2.rsg>
3e6957da2ff8 Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    31
#include <nsmlcontactsdatastoreformat_1_2.rsg>
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include <data_caging_path_literals.hrh>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include <SmlDataFormat.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include <SmlDataProvider.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include <e32property.h>
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include <DataSyncInternalPSKeys.h>
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    37
#include <e32hashtab.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    38
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    39
#include <CVPbkContactStoreUriArray.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    40
#include <VPbkContactStoreUris.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    41
#include <TVPbkContactStoreUriPtr.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    42
#include <MVPbkContactStoreList.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    43
#include <MVPbkContactStoreProperties.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    44
#include <MVPbkStoreContactProperties.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    45
#include <MVPbkViewContact.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    46
#include <MVPbkStoreContact.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    47
#include <MVPbkStoreContact2.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    48
#include <MVPbkFieldType.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    49
#include <MVPbkContactFieldTextData.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    50
#include <CVPbkContactFieldIterator.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    51
#include <CVPbkContactViewDefinition.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    52
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    53
#include <MVPbkContactLink.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    54
#include <s32mem.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    55
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    56
#include <NSmlContactsDataStore.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    57
#include "NSmlContactsModsFetcher.h"
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
#include "nsmldebug.h"
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
#include "nsmlconstants.h"
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    60
#include <NSmlDataModBase.h>
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    61
#include "nsmlcontactsdefs.h"
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
#include "nsmldsimpluids.h"
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
#include "nsmlsnapshotitem.h"
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
#include "nsmlchangefinder.h"
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    65
#include <VPbkEng.rsg>
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
#ifndef __WINS__
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
// This lowers the unnecessary compiler warning (armv5) to remark.
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
// "Warning:  #174-D: expression has no effect..." is caused by 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
// DBG_ARGS8 macro in no-debug builds.
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
#pragma diag_remark 174
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
#endif
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
// CNSmlContactsDataStore::CNSmlContactsBufferItem::~CNSmlContactsBufferItem
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
    78
EXPORT_C CNSmlContactsDataStore::CNSmlContactsBufferItem::~CNSmlContactsBufferItem()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
	delete iItemData;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
	delete iMimeType;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
	delete iMimeVersion;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
// CNSmlContactsDataStore::NewL
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
    88
EXPORT_C CNSmlContactsDataStore* CNSmlContactsDataStore::NewL()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
	_DBG_FILE("CNSmlContactsDataStore::NewL: BEGIN");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
	CNSmlContactsDataStore* self = new ( ELeave ) CNSmlContactsDataStore();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
	CleanupStack::PushL(self);
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
	self->ConstructL();
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
    95
	CleanupStack::Pop(self); // self
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
	_DBG_FILE("CNSmlContactsDataStore::NewL: END");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
	return self;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
// CNSmlContactsDataStore::CNSmlContactsDataStore() 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
// ----------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   104
EXPORT_C CNSmlContactsDataStore::CNSmlContactsDataStore() : 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   105
	iKey( TKeyArrayFix( _FOFF( TNSmlSnapshotItem,ItemId() ),ECmpTInt )),
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   106
	iContactManager(NULL),
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   107
	iStore(NULL),
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   108
	iIdConverter(NULL),
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   109
	iContactViewBase(NULL),
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   110
	iSize(NULL),	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   111
	iBuf(NULL),
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   112
	iVCardEngine(NULL),
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   113
	iContactLnks(NULL)
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
	_DBG_FILE("CNSmlContactsDataStore::CNSmlContactsDataStore(): begin");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   116
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
	iSyncHistory = EFalse;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
	iSnapshotRegistered = EFalse;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   120
	iServerMaxObjectSize = 0; // Maximum size default value 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
	iItemPos = -1;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
	iModificationCount = KNSmlCompactAfterChanges;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
	iState = ENSmlClosed;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
	iStoreName = NULL;
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   126
	iRetCommand = KErrNone;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   127
	iLastOperation = ENSmlNone;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   128
	if(iDeleteAllOperation)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   129
	    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   130
	    delete iDeleteAllOperation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   131
	    iDeleteAllOperation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   132
	    }
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
	_DBG_FILE("CNSmlContactsDataStore::CNSmlContactsDataStore(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
// CNSmlContactsDataStore::ConstructL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   139
EXPORT_C void CNSmlContactsDataStore::ConstructL()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
	{
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   141
	_DBG_FILE("CNSmlContactsDataStore::ConstructL(): begin");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   142
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   143
	ConstructL( ( VPbkContactStoreUris::DefaultCntDbUri() ), KLegacySymbianDatabase );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   144
		
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
	_DBG_FILE("CNSmlContactsDataStore::ConstructL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
	}
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   147
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   148
// ----------------------------------------------------------------------------
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   149
// CNSmlContactsDataStore::ConstructL()
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   150
// ----------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   151
EXPORT_C void CNSmlContactsDataStore::ConstructL(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   152
    const TDesC& aStoreName, const TDesC& aLegacyStore )
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   153
    {
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   154
    _DBG_FILE("CNSmlContactsDataStore::ConstructL(): begin");
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   155
    
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   156
    User::LeaveIfError( iRfs.Connect() );
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   157
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   158
    iStringPool.OpenL();
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   159
    
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   160
    // Uid Sets
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   161
    iNewUids = new (ELeave) CNSmlDataItemUidSet();
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   162
    iDeletedUids = new (ELeave) CNSmlDataItemUidSet();
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   163
    iSoftDeletedUids = new (ELeave) CNSmlDataItemUidSet();
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   164
    iMovedUids = new (ELeave) CNSmlDataItemUidSet();
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   165
    iReplacedUids = new (ELeave) CNSmlDataItemUidSet();
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   166
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   167
    // Create iDataMod
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   168
    // This should be done after OpenL if there are more than one database
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   169
    iDataMod = new (ELeave) CNSmlVCardMod();
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   170
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   171
    SetOwnStoreFormatL();
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   172
    // open  contact database
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   173
    CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   174
    uriArray->AppendL( TVPbkContactStoreUriPtr( aStoreName ));
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   175
    
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   176
    iContactManager = CVPbkContactManager::NewL(*uriArray);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   177
    CleanupStack::PopAndDestroy(uriArray);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   178
    //Default store name
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   179
    iDefaultStoreName = aStoreName.AllocL();
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   180
    
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   181
    //Fill iPacketStoreName buffer with legacy store name
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   182
    TBuf<KOldSymbianDBLength> dataBase(aLegacyStore);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   183
    iPacketStoreName = HBufC::NewL(dataBase.Length());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   184
    TPtr pktStorePtr(iPacketStoreName->Des());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   185
    pktStorePtr.Copy(dataBase);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   186
    iDeleteAllOperation = NULL;
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   187
        
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   188
    _DBG_FILE("CNSmlContactsDataStore::ConstructL(): end");    
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   189
    }
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   190
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
// CNSmlContactsDataStore::~CNSmlContactsDataStore()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   194
EXPORT_C CNSmlContactsDataStore::~CNSmlContactsDataStore()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
	_DBG_FILE("CNSmlContactsDataStore::~CNSmlContactsDataStore(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
	delete iStoreFormat; // SetOwnStoreFormatL creates
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
	iStringPool.Close();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
	iRfs.Close();
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   202
	iWriteStream.Close();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   203
	iReadStream.Close();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   204
	delete iBuf;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   205
	
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
	if ( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
		TRAP_IGNORE( iChangeFinder->CloseL() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
		delete iChangeFinder;
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   210
		iChangeFinder = NULL;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   213
	if(iIdConverter)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   214
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   215
		delete iIdConverter;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   216
		iIdConverter = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   217
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   218
	if(iContactLnks)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   219
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   220
        delete iContactLnks;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   221
		iContactLnks = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   222
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   223
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   224
	if(iContactViewBase)
12
4d5e9526124e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   225
	    {
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   226
	    delete iContactViewBase;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   227
	    iContactViewBase = NULL;
12
4d5e9526124e Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   228
	    }
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   229
	if ( iContactsModsFetcher )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   230
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   231
		iContactsModsFetcher->CancelRequest(); 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   232
		delete iContactsModsFetcher;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   233
		iContactsModsFetcher = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   234
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   235
	if ( iContactManager )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   236
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   237
			if(iStore)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   238
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   239
			iStore->Close( *this );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   240
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   241
	    delete iContactManager;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   242
	    iContactManager = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   243
		}
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   245
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   246
	delete iVCardEngine;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   247
	//  Delete UidSets		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   248
	//
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
	delete iNewUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
	delete iDeletedUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
	delete iSoftDeletedUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
	delete iMovedUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
	delete iReplacedUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   255
	//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   256
	//	Empty BufferItemList if any
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   257
	//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   258
	if ( iContactsBufferItemList.Count() > 0 )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   259
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   260
		if ( iContactsBufferItemList[iContactsBufferItemList.Count() - 1]->iItemData == iItemData )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   261
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   262
			iItemData = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   263
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   264
		}
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
	iContactsBufferItemList.ResetAndDestroy();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
	delete iDataMod;
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   267
	delete iMergeItem;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   268
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
	if(iItemData)
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
    	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
	    if(iItemData->Size() > 0 )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
	        {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
		    delete iItemData;       
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
	        }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
	    }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
	if(iItemDataAddBatch != iItemData)
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
		delete iItemDataAddBatch;	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
	delete iDefaultStoreName;
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   283
	delete iPacketStoreName;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
	delete iStoreName;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
	iAddResultArray.Close();
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   288
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   289
	if(iDeleteAllOperation)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   290
	    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   291
	    delete iDeleteAllOperation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   292
	    iDeleteAllOperation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   293
	    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   294
	
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
// void CNSmlContactsDataStore::DoOpenL(const TDesC& 		  aStoreName, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
//									    MSmlSyncRelationship& aContext,
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
//									    TRequestStatus& 	  aStatus)
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   302
EXPORT_C void CNSmlContactsDataStore::DoOpenL( const TDesC& aStoreName, 
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   303
									MSmlSyncRelationship& aContext, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   304
									TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
	DBG_ARGS(_S("CNSmlContactsDataStore::DoOpenL(): '%S' begin"), &aStoreName);
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
	if( iState != ENSmlClosed )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   312
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
		User::RequestComplete( iCallerStatus, KErrInUse );	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
		return;	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   317
	if( RFs::CharToDrive(aStoreName[0], iDrive) != KErrNone )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
		RFs::CharToDrive( KNSmlDriveC()[0], iDrive );
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   320
		}
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
	iOpened = EFalse;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
	if( iStoreName )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
		delete iStoreName;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
		iStoreName = NULL;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
		
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   329
		if ( iChangeFinder )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
		iChangeFinder->CloseL();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
		delete iChangeFinder;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   333
		iChangeFinder = NULL;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
		}
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   335
	// The Change finder maintains a list of all changes to the database.
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   336
	iChangeFinder = CNSmlChangeFinder::NewL(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   337
					 aContext, iKey, iSyncHistory, KNSmlContactsAdapterImplUid );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   338
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   339
	iState = ENSmlOpenAndWaiting;			
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   341
	//find and open the store
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   342
	if ( aStoreName == KNSmlContactStoreNameForDefaultDB )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   343
	    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   344
	iStore = iContactManager->ContactStoresL().Find(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   345
	TVPbkContactStoreUriPtr(*iDefaultStoreName));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   346
	    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   347
	else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   348
	   {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   349
	    iStore = iContactManager->ContactStoresL().Find(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   350
	TVPbkContactStoreUriPtr(aStoreName));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   351
	    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   352
	iStore->OpenL(*this);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   353
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   354
	iStoreName = aStoreName.AllocL();
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   356
	iVCardEngine = CVPbkVCardEng::NewL( *iContactManager );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   357
	iIdConverter = CVPbkContactIdConverter::NewL(*iStore );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   358
	if ( iContactsModsFetcher )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   359
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   360
		iContactsModsFetcher->CancelRequest();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   361
		delete iContactsModsFetcher;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   362
		iContactsModsFetcher = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   363
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   364
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   365
	iContactsModsFetcher = CreateModsFetcherL();
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   367
#ifdef __NSML_MODULETEST__
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   368
	CActiveScheduler::Start();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   369
#endif
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
	_DBG_FILE("CNSmlContactsDataStore::DoOpenL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   374
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   375
// void CNSmlContactsDataStore::DoCancelRequest()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   377
EXPORT_C void CNSmlContactsDataStore::DoCancelRequest()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
	_DBG_FILE("CNSmlContactsDataStore::DoCancelRequest(): begin");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   380
	if(iLastOperation == ENSMLDeleteAllOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   381
	    {   
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   382
	    if(iDeleteAllOperation)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   383
	        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   384
	        delete iDeleteAllOperation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   385
	        iDeleteAllOperation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   386
	        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   387
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   388
	    if( iChangeFinder )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   389
	        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   390
            TRAP_IGNORE(iChangeFinder->ResetL());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   391
	        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   392
	    iSnapshotRegistered = EFalse;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   393
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   394
	    if(iContactLnks)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   395
	        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   396
	        delete iContactLnks;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   397
	        iContactLnks = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   398
			iContactLink = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   399
	        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   400
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   401
	    if(iContactViewBase)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   402
	        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   403
	        delete iContactViewBase;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   404
	        iContactViewBase = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   405
	        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   406
	    User::RequestComplete( iCallerStatus, KErrCancel );  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   407
	    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   408
		if(iContactsModsFetcher)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   409
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   410
		iContactsModsFetcher->CancelRequest();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   411
		}
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
	_DBG_FILE("CNSmlContactsDataStore::DoCancelRequest(): NOT NEEDED end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
// void CNSmlContactsDataStore::DoStoreName()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   419
EXPORT_C const TDesC& CNSmlContactsDataStore::DoStoreName() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
	_DBG_FILE("CNSmlContactsDataStore::DoStoreName(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
	_DBG_FILE("CNSmlContactsDataStore::DoStoreName(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
	return *iStoreName;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
// void CNSmlContactsDataStore::DefaultStoreNameL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   429
EXPORT_C const TDesC& CNSmlContactsDataStore::DefaultStoreNameL() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
	_DBG_FILE("CNSmlContactsDataStore::DefaultStoreNameL(): begin");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   432
	
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
	if ( !iDefaultStoreName )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
		return KNullDesC;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   437
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   438
	_DBG_FILE("CNSmlContactsDataStore::DefaultStoreNameL(): end");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   439
	//The engine methods that create syncml packet, use this information in Database fields
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   440
	return *iPacketStoreName;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
// void CNSmlContactsDataStore::DoBeginTransactionL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   446
EXPORT_C void CNSmlContactsDataStore::DoBeginTransactionL()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
	_DBG_FILE("CNSmlContactsDataStore::DoBeginTransactionL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
	User::Leave( KErrNotSupported );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
	_DBG_FILE("CNSmlContactsDataStore::DoBeginTransactionL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
// void CNSmlContactsDataStore::DoCommitTransactionL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   456
EXPORT_C void CNSmlContactsDataStore::DoCommitTransactionL(TRequestStatus& aStatus)
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
	_DBG_FILE("CNSmlContactsDataStore::DoCommitTransactionL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
	User::RequestComplete( iCallerStatus, KErrNotSupported );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   464
	_DBG_FILE("CNSmlContactsDataStore::DoCommitTransactionL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   466
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
// void CNSmlContactsDataStore::DoRevertTransaction()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   469
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   470
EXPORT_C void CNSmlContactsDataStore::DoRevertTransaction(TRequestStatus& aStatus)
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   472
	_DBG_FILE("CNSmlContactsDataStore::DoRevertTransaction(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
	User::RequestComplete( iCallerStatus, KErrNotSupported );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
	_DBG_FILE("CNSmlContactsDataStore::DoRevertTransaction(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   479
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   480
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
// void CNSmlContactsDataStore::DoBeginBatchL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   484
EXPORT_C void CNSmlContactsDataStore::DoBeginBatchL()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
	_DBG_FILE("CNSmlContactsDataStore::DoBeginBatchL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
	iBatchMode = ETrue;			// SUPPORTED on Contacts
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   489
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
	_DBG_FILE("CNSmlContactsDataStore::DoBeginBatchL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
// void CNSmlContactsDataStore::DoCommitBatchL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
// ----------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   496
EXPORT_C void CNSmlContactsDataStore::DoCommitBatchL( RArray<TInt>& aResultArray, TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
	_DBG_FILE("CNSmlContactsDataStore::DoCommitBatchL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
	if( !iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   504
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
		User::RequestComplete( iCallerStatus, KErrNotReady );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
		_DBG_FILE("CNSmlContactsDataStore::DoCommitBatchL(): NOT ON BATCH MODE end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
//		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
// Go through Buffer and execute all commands return aResultArray
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
//
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   512
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   513
	iResultArray = &aResultArray;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   514
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   515
	iIndex = 0;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   516
	TRAPD( leavecode,ExecuteBufferL() );
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   518
	if( leavecode != KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   519
		{
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   520
		User::RequestComplete( iCallerStatus, leavecode );
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
		}
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   522
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   523
	_DBG_FILE("CNSmlContactsDataStore::DoCommitBatchL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   524
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
// void CNSmlContactsDataStore::ExecuteBufferL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
// ----------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   529
EXPORT_C void CNSmlContactsDataStore::ExecuteBufferL() 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   530
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   531
	_DBG_FILE("CNSmlContactsDataStore::ExecuteBufferL(): begin");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   532
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   533
	TInt  retCommand( KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   534
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   535
	//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   536
	// Loop through buffered commands
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   537
	//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   538
		if( iIndex < iContactsBufferItemList.Count())
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   539
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   540
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   541
		if( iContactsBufferItemList[iIndex]->iStatus!= KNSmlNoError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   542
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   543
			retCommand = iContactsBufferItemList[iIndex]->iStatus;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   544
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   545
		else if( iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemAdd )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   546
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   547
			retCommand = ExecuteAddL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   548
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   549
		else if( iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemReplace ||
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   550
            iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemFieldLevelReplace )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   551
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   552
			ExecuteUpdateL();		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   553
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   554
		else if( iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemMove )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   555
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   556
			ExecuteMoveL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   557
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   558
		else if( iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemDelete ||
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   559
				 iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemSoftDelete )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   560
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   561
			ExecuteDeleteL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   562
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   563
		//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   564
		//	Set allready set commands from iContactsBufferItemList
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   565
		//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   566
		if( ( iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemAdd     ||
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   567
		      iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemReplace ||
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   568
		      iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemFieldLevelReplace ||
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   569
		      iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemDelete  ||
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   570
		      iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemSoftDelete ) &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   571
		      iContactsBufferItemList[iIndex]->iStatus  != KNSmlNoError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   572
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   573
			retCommand = iContactsBufferItemList[iIndex]->iStatus;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   574
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   575
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   576
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   577
		//if an error occurs when performing any operation
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   578
		//return the error status 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   579
			else if(retCommand!=KErrNone)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   580
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   581
			User::RequestComplete( iCallerStatus, retCommand );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   582
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   583
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   584
			iRetCommand = retCommand;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   585
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   586
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   587
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   588
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   589
// void CNSmlContactsDataStore::ExecuteAddL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   590
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   591
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   592
EXPORT_C TInt CNSmlContactsDataStore::ExecuteAddL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   593
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   594
	TInt  retCommand( KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   595
	StripPropertyL( iItemDataAddBatch, KVersitTokenUID() ); // Remove UID's from data
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   596
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   597
	TInt err( KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   598
	if(iBatchMode)			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   599
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   600
		TRAP( err,LdoAddItemsL( iItemDataAddBatch,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   601
		                   iItemDataAddBatch->Ptr(0).Length()) );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   602
		if(err!=KErrNone)			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   603
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   604
			retCommand = err;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   605
			TInt j = iIndex;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   606
			while( j < iContactsBufferItemList.Count() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   607
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   608
				if( iContactsBufferItemList[j]->iModType == ENSmlCntItemAdd &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   609
				iContactsBufferItemList[j]->iStatus  == KNSmlNoError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   610
					{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   611
					iContactsBufferItemList[j]->iStatus = KErrNotSupported;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   612
					iResultArray->AppendL(KErrNotSupported);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   613
					}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   614
				j++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   615
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   616
			}			                          
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   617
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   618
	else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   619
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   620
		const TPtr8 dataPtr = iItemDataAddBatch->Ptr(0);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   621
		TRAP( err, LdoAddItemL( dataPtr,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   622
					iContactsBufferItemList[iIndex]->iSize));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   623
		if(err!=KErrNone)			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   624
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   625
			retCommand = err;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   626
			}	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   627
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   628
	return retCommand; 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   629
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   630
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   631
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   632
// void CNSmlContactsDataStore::ExecuteDeleteL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   633
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   634
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   635
EXPORT_C void CNSmlContactsDataStore:: ExecuteDeleteL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   636
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   637
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   638
	if(iBatchMode)			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   639
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   640
		iContactLnks = CVPbkContactLinkArray::NewL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   641
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   642
		TInt j=iIndex;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   643
		while( j < iContactsBufferItemList.Count() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   644
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   645
			if( (iContactsBufferItemList[j]->iModType == ENSmlCntItemDelete ||
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   646
			iContactsBufferItemList[j]->iModType == ENSmlCntItemSoftDelete) &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   647
			iContactsBufferItemList[j]->iStatus  == KNSmlNoError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   648
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   649
				TContactItemId id = iContactsBufferItemList[j]->iUid; 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   650
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   651
				if( id != 0 )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   652
					{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   653
					MVPbkContactLink* contactLink = iIdConverter->IdentifierToLinkLC(id);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   654
					//check if the contact link is valid
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   655
					TInt index = iContactViewBase->IndexOfLinkL(*contactLink);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   656
					if(index != KErrNotFound)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   657
						{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   658
						iContactLnks->AppendL(contactLink);	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   659
						}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   660
						else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   661
						{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   662
						iContactsBufferItemList[j]->iStatus  = KErrNotFound;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   663
						}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   664
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   665
					CleanupStack::Pop();//contactLink				
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   666
					}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   667
					else 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   668
					{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   669
					iContactsBufferItemList[j]->iStatus  = KErrNotFound;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   670
					}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   671
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   672
			j++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   673
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   674
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   675
		delete iContactViewBase;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   676
		iContactViewBase = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   677
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   678
		iContactManager->DeleteContactsL( *iContactLnks, *this );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   679
		iLastOperation = ENSmlDeleteOp;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   680
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   681
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   682
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   683
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   684
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   685
// void CNSmlContactsDataStore::ExecuteUpdateL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   686
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   687
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   688
EXPORT_C void CNSmlContactsDataStore::ExecuteUpdateL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   689
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   690
	iUid  = iContactsBufferItemList[iIndex]->iUid;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   691
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   692
	iDataMod->SetUsedMimeType( iServerMimeType, iServerMimeVersion );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   693
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   694
	// Check whether merging is needed or not.
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   695
	if( iDataMod->NeedsMerge() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   696
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   697
		iMergeItem = CBufFlat::NewL(64);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   698
		iWriteStream.Open(*iMergeItem);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   699
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   700
		MVPbkContactLink* contactLink = iIdConverter->IdentifierToLinkLC(iUid);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   701
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   702
		iVCardEngine->ExportVCardForSyncL(iWriteStream,*contactLink,*this);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   703
		CleanupStack::PopAndDestroy();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   704
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   705
		iLastOperation = ENSMLUpdateExportOp;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   706
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   707
	else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   708
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   709
			LdoUpdateItemL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   710
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   711
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   712
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   713
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   714
// void CNSmlContactsDataStore::ExecuteMoveL
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   715
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   716
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   717
EXPORT_C void CNSmlContactsDataStore::ExecuteMoveL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   718
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   719
	// move command is not supported
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   720
	if(!iBatchMode)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   721
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   722
		ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   723
		User::RequestComplete( iCallerStatus, KErrNotSupported );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   724
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   725
	else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   726
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   727
		iResultArray->AppendL(KErrNotSupported);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   728
		iIndex++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   729
		if(iIndex == iContactsBufferItemList.Count() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   730
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   731
			ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   732
			User::RequestComplete( iCallerStatus, KErrNone );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   733
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   734
		else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   735
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   736
				ExecuteBufferL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   737
			}		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   738
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   739
	}
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   740
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   741
// void CNSmlContactsDataStore::DoCancelBatch()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   742
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   743
EXPORT_C void CNSmlContactsDataStore::DoCancelBatch()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   744
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   745
	_DBG_FILE("CNSmlContactsDataStore::DoCancelBatch(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   746
	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   748
		iBatchMode = EFalse;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   749
	//
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   750
	//	Empty BufferItemList if any
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
	//
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   752
		iContactsBufferItemList.ResetAndDestroy();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   753
		iItemData = NULL;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   754
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   755
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   756
	_DBG_FILE("CNSmlContactsDataStore::DoCancelBatch(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   757
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   758
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   759
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   760
// void CNSmlContactsDataStore::DoSetRemoteStoreFormatL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   761
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   762
EXPORT_C void CNSmlContactsDataStore::DoSetRemoteStoreFormatL( const CSmlDataStoreFormat& aServerDataStoreFormat )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   763
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   764
	_DBG_FILE("CNSmlContactsDataStore::DoSetRemoteStoreFormatL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   765
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   766
	TBool foundMime = EFalse;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   767
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   768
	//
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
	// KErrNotSupported is returned if server does not support same mime type 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
	// and same mime type version as Data Provider.
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   771
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   772
	TInt i=0;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   773
	while( i< aServerDataStoreFormat.MimeFormatCount() && !foundMime )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
		if( iUsedMimeType.MatchF(aServerDataStoreFormat.MimeFormat(i).MimeType().DesC())      ==0 &&
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
		    iUsedMimeVersion.MatchF(aServerDataStoreFormat.MimeFormat(i).MimeVersion().DesC())==0 )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
			foundMime = ETrue;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
			iServerMimeType    = aServerDataStoreFormat.MimeFormat(i).MimeType();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   780
			iServerMimeVersion = aServerDataStoreFormat.MimeFormat(i).MimeVersion();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   782
		i++;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
	if( !foundMime )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
		_DBG_FILE("CNSmlContactsDataStore::DoSetRemoteStoreFormatL(): SERVER MIMETYPE NOTSUPPORTED end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   788
		User::Leave( KErrNotSupported );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   790
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
	iDataMod->SetPartnerStoreFormat( (CSmlDataStoreFormat&) aServerDataStoreFormat );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   792
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   793
	SetOwnStoreFormatL();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
			
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
	TInt error = iDataMod->SetUsedMimeType( iServerMimeType, iServerMimeVersion );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
	User::LeaveIfError( error );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   798
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   799
	_DBG_FILE("CNSmlContactsDataStore::DoSetRemoteStoreFormatL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   800
	return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   801
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   803
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
// void CNSmlContactsDataStore::SetOwnStoreFormatL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   805
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   806
EXPORT_C void CNSmlContactsDataStore::SetOwnStoreFormatL()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
	_DBG_FILE("CNSmlContactsDataStore::SetOwnStoreFormatL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
	if( !iStoreFormat )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   812
		TFileName fileName;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   813
		TParse parse;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   814
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   815
		parse.Set( GetStoreFormatResourceFileL(), &KDC_RESOURCE_FILES_DIR, NULL  );
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   816
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   817
		fileName = parse.FullName();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   818
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   819
		RResourceFile resourceFile; 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   820
		BaflUtils::NearestLanguageFile( iRfs, fileName );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   821
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   822
		resourceFile.OpenL( iRfs, fileName );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   823
		CleanupClosePushL( resourceFile );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   824
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
		HBufC8* contactsDataFormat = resourceFile.AllocReadLC( NSML_CONTACTS_DATA_STORE_FORMAT );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   826
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   827
		TResourceReader reader;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   828
		reader.SetBuffer( contactsDataFormat );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   830
		iStoreFormat = CSmlDataStoreFormat::NewLC( iStringPool, reader );
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   831
		CleanupStack::Pop(iStoreFormat); // iStoreFormat
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   833
		CleanupStack::PopAndDestroy(2); // contactsDataFormat, resourceFile  
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   834
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   835
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   836
	iDataMod->SetOwnStoreFormat( *iStoreFormat );
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   837
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   838
	// Set own MIME type based on store format resource definition. Allows inherited classes to 
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   839
    // use non-standard MIME type by recource change. E.g. Operator specific MIME types can be used.
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   840
    iUsedMimeType.Set( iStoreFormat->MimeFormat(0).MimeType().DesC() );
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   841
    iUsedMimeVersion.Set( iStoreFormat->MimeFormat(0).MimeVersion().DesC() );
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   842
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   843
	_DBG_FILE("CNSmlContactsDataStore::SetOwnStoreFormatL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   844
	return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   845
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   846
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
// void CNSmlContactsDataStore::DoSetRemoteMaxObjectSize()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   849
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   850
EXPORT_C void CNSmlContactsDataStore::DoSetRemoteMaxObjectSize( TInt aServerMaxObjectSize )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   851
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   852
	_DBG_FILE("CNSmlContactsDataStore::DoSetRemoteMaxObjectSize(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   853
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   854
	iServerMaxObjectSize = aServerMaxObjectSize;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   855
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
	_DBG_FILE("CNSmlContactsDataStore::DoSetRemoteMaxObjectSize(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   858
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   859
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   860
// void CNSmlContactsDataStore::DoMaxObjectSize()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   861
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   862
EXPORT_C TInt CNSmlContactsDataStore::DoMaxObjectSize() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   863
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   864
	_DBG_FILE("CNSmlContactsDataStore::DoMaxObjectSize(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   865
	_DBG_FILE("CNSmlContactsDataStore::DoMaxObjectSize() 100 k: end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   866
	return KNSmlDataStoreMaxSize;  // 100 k
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   867
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   868
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   869
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   870
// void CNSmlContactsDataStore::DoOpenItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   871
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   872
EXPORT_C void CNSmlContactsDataStore::DoOpenItemL( TSmlDbItemUid aUid, 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
										  TBool& aFieldChange, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
										  TInt& aSize, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   875
										  TSmlDbItemUid& aParent, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
										  TDes8& aMimeType, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   877
										  TDes8& aMimeVer, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   878
										  TRequestStatus& aStatus )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   879
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   880
	_DBG_FILE("CNSmlContactsDataStore::DoOpenItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   881
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   882
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   883
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   884
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   885
	if ( iState != ENSmlOpenAndWaiting )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   886
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   887
		User::RequestComplete( iCallerStatus, KErrNotReady );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   888
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   889
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   890
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   891
	iItemPos = 0;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   892
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   893
	aFieldChange = EFalse; // Whole item sent NOT SUPPORT ON FIELDCHANGE
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   894
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   895
	aMimeType    = iStoreFormat->MimeFormat( 0 ).MimeType().DesC();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   896
	aMimeVer	 = iStoreFormat->MimeFormat( 0 ).MimeVersion().DesC();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   897
	aParent      = KNullDataItemId;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   898
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   899
	iModType = ENSmlCntItemRead;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   900
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   901
	if( !iItemData )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   902
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   903
		iItemData= CBufFlat::NewL( KNSmlItemDataExpandSize );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   904
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   905
	else
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   906
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   907
		iItemData->Reset();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   908
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   909
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   910
	 LdoFetchItemL( aUid, *iItemData );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   911
	 iSize = &aSize;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   912
	
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   913
	_DBG_FILE("CNSmlContactsDataStore::DoOpenItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   914
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   915
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   916
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   917
// void CNSmlContactsDataStore::DoCreateItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   918
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   919
EXPORT_C void CNSmlContactsDataStore::DoCreateItemL( TSmlDbItemUid& aUid, 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   920
											TInt aSize, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   921
											TSmlDbItemUid /*aParent*/, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   922
											const TDesC8& aMimeType, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   923
											const TDesC8& aMimeVer, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   924
											TRequestStatus& aStatus )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   925
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   926
	_DBG_FILE("CNSmlContactsDataStore::DoCreateItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   927
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   928
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   929
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   930
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   931
	TInt err = KErrNone;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   932
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   933
	if ( iState != ENSmlOpenAndWaiting )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   934
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   935
		User::RequestComplete( iCallerStatus, KErrNotReady );
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   936
		_DBG_FILE("CNSmlContactsDataStore::DoCreateItemL - KErrNotReady: END");
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   937
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   938
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   939
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   940
	iItemSize = aSize; // Size sent from server
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   941
	iModType  = ENSmlCntItemAdd;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   942
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   943
	iMimeTypeItem.Set( aMimeType );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   944
	iMimeVersionItem.Set( aMimeVer );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   945
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   946
	if ( iItemPos == -1 || !iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   947
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   948
		iItemPos = 0;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   949
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   950
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   951
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   952
	if( iItemData )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   953
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   954
		iItemData->Reset();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   955
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   956
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   957
	if( !iItemDataAddBatch )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   958
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   959
		iItemDataAddBatch= CBufFlat::NewL( KNSmlItemDataExpandSize );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   960
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   961
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   962
	// Check MimeType and MimeVersion
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   963
	if( ( aMimeType.MatchF( KNSmlvCard21Name ) < 0 ) &&
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   964
	    ( aMimeType.MatchF( KNSmlvCard30Name ) < 0 ) &&
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   965
	    // Allow using custom MIME type defined in store format resource file
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   966
	    ( aMimeType.MatchF( iUsedMimeType ) < 0 ) )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   967
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   968
		User::RequestComplete( iCallerStatus, KErrNotSupported );
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   969
		_DBG_FILE("CNSmlContactsDataStore::DoCreateItemL - KErrNotSupported: END");
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   970
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   971
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   972
    
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
   973
    // Is there enough space on drive 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   974
	if( DriveBelowCriticalLevelL( aSize ) )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   975
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   976
		err = KErrDiskFull;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   977
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   978
				
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   979
	iItemData = AddBufferListL( aUid,aSize, err );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   980
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   981
	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   982
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   983
		iState = ENSmlItemCreating;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   984
		User::RequestComplete( iCallerStatus, KErrNone );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   985
		_DBG_FILE("CNSmlContactsDataStore::DoCreateItemL(): begin BATCH");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   986
		return ; // Put into buffer
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   987
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   988
				
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   989
	if ( err == KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   990
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   991
		iState = ENSmlItemCreating;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   992
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   993
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   994
	User::RequestComplete( iCallerStatus, err );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   995
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   996
	_DBG_FILE("CNSmlContactsDataStore::DoCreateItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   997
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   998
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   999
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1000
// void CNSmlContactsDataStore::DoReplaceItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1001
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1002
EXPORT_C void CNSmlContactsDataStore::DoReplaceItemL( TSmlDbItemUid aUid, 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1003
											 TInt aSize, 
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1004
											 TSmlDbItemUid /*aParent*/,
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1005
											 TBool aFieldChange, 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1006
											 TRequestStatus& aStatus )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1007
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1008
	_DBG_FILE("CNSmlContactsDataStore::DoReplaceItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1009
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1010
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1011
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1012
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1013
	TInt err = KErrNone;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1014
			
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1015
	iUid      = aUid;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1016
	iItemSize = aSize;
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1017
	iModType  =  aFieldChange ? ENSmlCntItemFieldLevelReplace : ENSmlCntItemReplace;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1018
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1019
	if ( iItemPos == -1 || !iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1020
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1021
		iItemPos = 0;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1022
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1023
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1024
	if ( iItemData )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1025
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1026
		iItemData->Reset();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1027
		}
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1028
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1029
	iFieldLevelReplace = aFieldChange;
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1030
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1031
	iItemData = AddBufferListL( aUid, aSize, err );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1032
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1033
	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1034
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1035
		iState = ENSmlItemUpdating;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1036
		_DBG_FILE("CNSmlContactsDataStore::DoReplaceItemL(): BATCHMODE end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1037
		User::RequestComplete( iCallerStatus, KErrNone );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1038
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1039
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1040
	if ( err == KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1041
	    {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1042
	    iState = ENSmlItemUpdating;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1043
	    }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1044
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1045
	User::RequestComplete( iCallerStatus, err );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1046
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1047
	_DBG_FILE("CNSmlContactsDataStore::DoReplaceItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1048
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1049
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1050
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1051
// void CNSmlContactsDataStore::DoReadItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1052
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1053
EXPORT_C void CNSmlContactsDataStore::DoReadItemL( TDes8& aBuffer )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1054
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1055
	_DBG_FILE("CNSmlContactsDataStore::DoReadItemL(): begin");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1056
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1057
    if ( iState != ENSmlItemOpen || !iItemData )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1058
        {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1059
        iItemPos = -1;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1060
        User::Leave( KErrNotReady );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1061
        }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1062
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1063
    if ( iItemPos == -1 )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1064
        {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1065
        User::Leave( KErrEof );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1066
        }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1067
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1068
    if ( aBuffer.Size() < iItemData->Size() - iItemPos )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1069
        {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1070
        iItemData->Read( iItemPos, aBuffer );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1071
        iItemPos += aBuffer.Size();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1072
        }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1073
    else
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1074
        {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1075
        iItemData->Read( iItemPos, aBuffer, iItemData->Size() - iItemPos );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1076
        iItemPos = -1;
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1077
        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1078
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1079
	_DBG_FILE("CNSmlContactsDataStore::DoReadItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1080
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1081
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1082
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1083
// void CNSmlContactsDataStore::DoWriteItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1084
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1085
EXPORT_C void CNSmlContactsDataStore::DoWriteItemL( const TDesC8& aData )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1086
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1087
	_DBG_FILE("CNSmlContactsDataStore::DoWriteItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1088
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1089
	/* Data must be accumulated from pieces of information */
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1090
	if ( iState == ENSmlItemCreating || iState == ENSmlItemUpdating )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1091
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1092
		if ( iItemData )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1093
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1094
			if ( iItemPos == -1 )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1095
				{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1096
            	iStateItem = KErrEof;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1097
            	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1098
            		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1099
            		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1100
            		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1101
				User::Leave( KErrEof );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1102
				}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1103
			iItemData->InsertL( iItemData->Size(), aData );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1104
			iItemPos += aData.Size();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1105
			
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1106
			if ( aData.Size() > iItemSize )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1107
				{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1108
				iState =     ENSmlItemOverflow;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1109
            	iStateItem = KErrOverflow;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1110
            	_DBG_FILE("CNSmlContactsDataStore::DoWriteItemL(): KErrOverflow End");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1111
        		DBG_ARGS(_S("CNSmlContactsDataStore::DoWriteItemL(): Server sent=(%d) Item=(%d)"),
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1112
        		            iItemSize, aData.Size()); 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1113
            	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1114
            		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1115
            		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1116
            		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1117
				User::Leave( KErrOverflow );				
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1118
				}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1119
			if ( aData.Size() == iItemSize )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1120
			    {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1121
            	iStateItem = KErrNone;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1122
			    }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1123
			return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1124
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1125
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1126
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1127
	iStateItem = KErrNotReady;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1128
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1129
	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1130
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1131
       	_DBG_FILE("CNSmlContactsDataStore::DoWriteItemL(): KErrNotReady End");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1132
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1133
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1134
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1135
	User::Leave( KErrNotReady );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1136
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1137
	_DBG_FILE("CNSmlContactsDataStore::DoWriteItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1138
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1139
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1140
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1141
// void CNSmlContactsDataStore::DoCommitItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1142
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1143
EXPORT_C void CNSmlContactsDataStore::DoCommitItemL( TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1144
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1145
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1146
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1147
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1148
	_DBG_FILE("CNSmlContactsDataStore::DoCommitItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1149
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1150
	// Data OK => insert to total buffer
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1151
	if (iModType   == ENSmlCntItemAdd && 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1152
      	iStateItem == KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1153
	    {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1154
	    iItemDataAddBatch->InsertL( iItemDataAddBatch->Size(),iItemData->Ptr(0), iItemData->Size() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1155
	    iItemDataAddBatch->InsertL( iItemDataAddBatch->Size(), KVersitTokenCRLF() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1156
      	if( iContactsBufferItemList.Count() > 0 )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1157
      	    {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1158
            iContactsBufferItemList[iContactsBufferItemList.Count()-1]->iStatus  = KNSmlNoError; 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1159
      	    }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1160
	    }
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1161
	 else if ((iModType   == ENSmlCntItemAdd ||         // If some write problems
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1162
         iModType   == ENSmlCntItemReplace ||
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1163
         iModType   == ENSmlCntItemFieldLevelReplace ) &&  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1164
      	 iStateItem != KErrNone &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1165
      	 iContactsBufferItemList.Count() > 0) 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1166
	    {
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1167
        iContactsBufferItemList[iContactsBufferItemList.Count()-1]->iStatus  = iStateItem; 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1168
	    }
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1169
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1170
	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1171
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1172
		iItemData = NULL;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1173
		iState = ENSmlOpenAndWaiting;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1174
		User::RequestComplete( iCallerStatus, KErrNone );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1175
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1176
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1177
		
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1178
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1179
	iIndex = 0;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1180
	ExecuteBufferL();
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1181
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1182
	iItemData = NULL;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1183
	iState = ENSmlOpenAndWaiting;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1184
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1185
	_DBG_FILE("CNSmlContactsDataStore::DoCommitItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1186
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1187
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1188
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1189
// void CNSmlContactsDataStore::DoCloseItem()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1190
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1191
EXPORT_C void CNSmlContactsDataStore::DoCloseItem()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1192
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1193
	_DBG_FILE("CNSmlContactsDataStore::DoCloseItem(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1194
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1195
	if ( iState == ENSmlItemOpen )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1196
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1197
		iItemPos = -1;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1198
		if ( iItemData )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1199
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1200
			delete iItemData;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1201
			iItemData = NULL;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1202
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1203
		iState = ENSmlOpenAndWaiting;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1204
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1205
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1206
	_DBG_FILE("CNSmlContactsDataStore::DoCloseItem(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1207
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1208
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1209
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1210
// void CNSmlContactsDataStore::DoMoveItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1211
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1212
EXPORT_C void CNSmlContactsDataStore::DoMoveItemL( TSmlDbItemUid aUid, TSmlDbItemUid /*aNewParent*/, TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1213
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1214
	_DBG_FILE("CNSmlContactsDataStore::DoMoveItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1215
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1216
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1217
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1218
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1219
	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1220
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1221
		iModType = ENSmlCntItemMove;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1222
		TInt fSize = 0;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1223
		AddBufferListL( aUid, fSize, KErrNotSupported );	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1224
		User::RequestComplete( iCallerStatus, KErrNone );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1225
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1226
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1227
	User::RequestComplete( iCallerStatus, KErrNotSupported );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1228
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1229
	_DBG_FILE("CNSmlContactsDataStore::DoMoveItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1230
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1231
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1232
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1233
// void CNSmlContactsDataStore::DoDeleteItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1234
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1235
EXPORT_C void CNSmlContactsDataStore::DoDeleteItemL( TSmlDbItemUid aUid, TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1236
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1237
	_DBG_FILE("CNSmlContactsDataStore::DoDeleteItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1238
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1239
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1240
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1241
	if( iBatchMode )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1242
		{
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1243
		if(iContactViewBase ==NULL)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1244
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1245
		CreateViewL();	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1246
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1247
	if( iModType != ENSmlCntItemSoftDelete ) // Treated like deletes
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1248
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1249
		iModType  = ENSmlCntItemDelete;	
24
8e7494275d3a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 12
diff changeset
  1250
		}
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1251
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1252
	TInt fSize = 0;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1253
	AddBufferListL( aUid, fSize, KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1254
	User::RequestComplete( iCallerStatus, KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1255
	return;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1256
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1257
	iUid = aUid;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1258
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1259
	//add the contactlink to CVPbkContactLinkArray
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1260
	MVPbkContactLink* contactLink  = iIdConverter->IdentifierToLinkLC(aUid);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1261
	CleanupStack::Pop();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1262
	CVPbkContactLinkArray* contactLnks = CVPbkContactLinkArray::NewLC();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1263
	contactLnks->AppendL( contactLink );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1264
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1265
 	iContactManager->DeleteContactsL( *contactLnks, *this );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1266
	CleanupStack::PopAndDestroy(); 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1267
	iLastOperation = ENSmlDeleteOp;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1268
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1269
	_DBG_FILE("CNSmlContactsDataStore::DoDeleteItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1270
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1271
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1272
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1273
// void CNSmlContactsDataStore::DoSoftDeleteItemL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1274
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1275
EXPORT_C void CNSmlContactsDataStore::DoSoftDeleteItemL( TSmlDbItemUid /*aUid*/, TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1276
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1277
	_DBG_FILE("CNSmlContactsDataStore::DoSoftDeleteItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1278
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1279
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1280
	User::RequestComplete( iCallerStatus, KErrNotSupported );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1281
	_DBG_FILE("CNSmlContactsDataStore::DoSoftDeleteItemL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1282
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1283
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1284
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1285
// void CNSmlContactsDataStore::DoDeleteAllItemsL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1286
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1287
EXPORT_C void CNSmlContactsDataStore::DoDeleteAllItemsL( TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1288
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1289
	_DBG_FILE("CNSmlContactsDataStore::DoDeleteAllItemsL(): begin");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1290
	
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1291
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1292
	*iCallerStatus = KRequestPending;
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1293
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1294
	//create view to get all the contactlinks to delete
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1295
	if(iContactViewBase ==NULL)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1296
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1297
		CreateViewL();	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1298
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1299
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1300
	iLastOperation = ENSMLDeleteAllOp;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1301
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1302
	_DBG_FILE("CNSmlContactsDataStore::DoDeleteAllItemsL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1303
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1304
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1305
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1306
// TBool CNSmlContactsDataStore::DoHasSyncHistory()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1307
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1308
EXPORT_C TBool CNSmlContactsDataStore::DoHasSyncHistory() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1309
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1310
	_DBG_FILE("CNSmlContactsDataStore::DoHasSyncHistory(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1311
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1312
	TBool doHasSyncHistory = EFalse;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1313
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1314
	if( !iOpened ) 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1315
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1316
		_DBG_FILE("CNSmlContactsDataStore::DoHasSyncHistory(): NOT OPEN end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1317
		return doHasSyncHistory;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1318
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1319
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1320
	if( iSyncHistory )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1321
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1322
		if ( iOpenedStoreId != iChangeFinder->DataStoreUid() )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1323
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1324
			iChangeFinder->SetDataStoreUid( iOpenedStoreId );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1325
			doHasSyncHistory = EFalse;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1326
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1327
		else
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1328
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1329
			doHasSyncHistory = ETrue;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1330
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1331
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1332
	else
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1333
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1334
		iChangeFinder->SetDataStoreUid( iOpenedStoreId );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1335
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1336
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1337
	_DBG_FILE("CNSmlContactsDataStore::DoHasSyncHistory(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1338
	return doHasSyncHistory;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1339
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1340
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1341
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1342
// void CNSmlContactsDataStore::DoAddedItems()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1343
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1344
EXPORT_C const MSmlDataItemUidSet& CNSmlContactsDataStore::DoAddedItems() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1345
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1346
	_DBG_FILE("CNSmlContactsDataStore::DoAddedItems(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1347
	if ( iState == ENSmlOpenAndWaiting )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1348
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1349
		iNewUids->Reset();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1350
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1351
		if( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1352
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1353
			TRAPD( err,iChangeFinder->FindNewItemsL( *iNewUids ) );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1354
			if( err != KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1355
				{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1356
				_DBG_FILE("CNSmlContactsDataStore::DoAddedItems(): LEAVE end");				
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1357
				}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1358
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1359
		}	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1360
	_DBG_FILE("CNSmlContactsDataStore::DoAddedItems(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1361
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1362
	return *iNewUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1363
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1364
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1365
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1366
// void CNSmlContactsDataStore::DoDeletedItems()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1367
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1368
EXPORT_C const MSmlDataItemUidSet& CNSmlContactsDataStore::DoDeletedItems() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1369
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1370
	_DBG_FILE("CNSmlContactsDataStore::DoDeletedItems(): begin");	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1371
	if ( iState == ENSmlOpenAndWaiting )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1372
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1373
		iDeletedUids->Reset();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1374
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1375
		if( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1376
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1377
			TRAPD(err,iChangeFinder->FindDeletedItemsL( *iDeletedUids ) );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1378
			if( err != KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1379
				{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1380
				_DBG_FILE("CNSmlContactsDataStore::DoDeletedItems(): LEAVE end");				
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1381
				}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1382
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1383
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1384
	_DBG_FILE("CNSmlContactsDataStore::DoDeletedItems(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1385
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1386
	return *iDeletedUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1387
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1388
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1389
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1390
// void CNSmlContactsDataStore::DoSoftDeletedItems()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1391
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1392
EXPORT_C const MSmlDataItemUidSet& CNSmlContactsDataStore::DoSoftDeletedItems() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1393
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1394
	_DBG_FILE("CNSmlContactsDataStore::DoSoftDeletedItems(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1395
	if ( iState == ENSmlOpenAndWaiting )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1396
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1397
		iSoftDeletedUids->Reset();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1398
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1399
		if( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1400
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1401
			TRAPD( err, iChangeFinder->FindSoftDeletedItemsL( *iSoftDeletedUids ) );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1402
			if( err != KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1403
				{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1404
				_DBG_FILE("CNSmlContactsDataStore::DoSoftDeletedItems(): LEAVE end");				
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1405
				}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1406
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1407
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1408
	_DBG_FILE("CNSmlContactsDataStore::DoSoftDeletedItems: END");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1409
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1410
	return *iSoftDeletedUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1411
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1412
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1413
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1414
// void CNSmlContactsDataStore::DoModifiedItems()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1415
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1416
EXPORT_C const MSmlDataItemUidSet& CNSmlContactsDataStore::DoModifiedItems() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1417
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1418
	_DBG_FILE("CNSmlContactsDataStore::DoModifiedItems(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1419
	if ( iState == ENSmlOpenAndWaiting )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1420
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1421
		iReplacedUids->Reset();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1422
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1423
		if( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1424
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1425
			TRAPD( err, iChangeFinder->FindChangedItemsL( *iReplacedUids ) );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1426
			if( err != KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1427
				{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1428
				_DBG_FILE("CNSmlContactsDataStore::DoModifiedItems(): LEAVE end");				
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1429
				}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1430
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1431
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1432
	_DBG_FILE("CNSmlContactsDataStore::DoModifiedItems: END");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1433
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1434
	return *iReplacedUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1435
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1436
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1437
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1438
// void CNSmlContactsDataStore::DoMovedItems()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1439
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1440
EXPORT_C const MSmlDataItemUidSet& CNSmlContactsDataStore::DoMovedItems() const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1441
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1442
	_DBG_FILE("CNSmlContactsDataStore::DoMovedItems(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1443
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1444
	if ( iState == ENSmlOpenAndWaiting )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1445
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1446
		iMovedUids->Reset();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1447
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1448
		if( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1449
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1450
			TRAPD( err, iChangeFinder->FindMovedItemsL( *iMovedUids ) );	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1451
			if( err != KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1452
				{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1453
				_DBG_FILE("CNSmlContactsDataStore::DoMovedItems(): LEAVE end");				
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1454
				}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1455
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1456
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1457
	_DBG_FILE("CNSmlContactsDataStore::DoMovedItems: END");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1458
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1459
	return *iMovedUids;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1460
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1461
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1462
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1463
// void CNSmlContactsDataStore::DoResetChangeInfoL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1464
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1465
EXPORT_C void CNSmlContactsDataStore::DoResetChangeInfoL( TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1466
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1467
	_DBG_FILE("CNSmlContactsDataStore::DoResetChangeInfoL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1468
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1469
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1470
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1471
	if( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1472
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1473
		iChangeFinder->ResetL();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1474
		}
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1475
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1476
	iSnapshotRegistered = EFalse;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1477
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1478
		if ( iContactsModsFetcher )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1479
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1480
		iContactsModsFetcher->FetchModificationsL( aStatus );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1481
#ifdef __NSML_MODULETEST__
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1482
		CActiveScheduler::Start();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1483
#endif
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1484
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1485
	else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1486
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1487
		User::RequestComplete( iCallerStatus, KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1488
		}
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1489
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1490
	_DBG_FILE("CNSmlContactsDataStore::DoResetChangeInfoL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1491
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1492
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1493
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1494
// void CNSmlContactsDataStore::DoCommitChangeInfoL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1495
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1496
EXPORT_C void CNSmlContactsDataStore::DoCommitChangeInfoL( TRequestStatus& aStatus, 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1497
												  const MSmlDataItemUidSet& aItems )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1498
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1499
	_DBG_FILE("CNSmlContactsDataStore::DoCommitChangeInfoL(aItems): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1500
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1501
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1502
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1503
	if( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1504
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1505
		iChangeFinder->CommitChangesL( aItems );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1506
		User::RequestComplete( iCallerStatus, KErrNone );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1507
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1508
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1509
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1510
	User::RequestComplete( iCallerStatus, KErrNotReady );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1511
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1512
	_DBG_FILE("CNSmlContactsDataStore::DoCommitChangeInfoL(aItems): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1513
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1514
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1515
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1516
// void CNSmlContactsDataStore::DoCommitChangeInfoL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1517
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1518
EXPORT_C void CNSmlContactsDataStore::DoCommitChangeInfoL( TRequestStatus& aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1519
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1520
	_DBG_FILE("CNSmlContactsDataStore::DoCommitChangeInfoL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1521
	iCallerStatus = &aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1522
	*iCallerStatus = KRequestPending;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1523
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1524
	if( iChangeFinder )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1525
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1526
		iChangeFinder->CommitChangesL();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1527
		User::RequestComplete( iCallerStatus, KErrNone );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1528
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1529
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1530
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1531
	User::RequestComplete( iCallerStatus, KErrNotReady );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1532
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1533
	_DBG_FILE("CNSmlContactsDataStore::DoCommitChangeInfoL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1534
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1535
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1536
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1537
// CDesCArray* CNSmlContactsDataStore::DoListStoresLC()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1538
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1539
EXPORT_C CDesCArray* CNSmlContactsDataStore::DoListStoresLC()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1540
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1541
	_DBG_FILE("CNSmlContactsDataStore::DoListStoresLC(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1542
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1543
	MVPbkContactStoreList& storeList = iContactManager->ContactStoresL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1544
	CDesCArrayFlat* stores = new (ELeave) CDesCArrayFlat(storeList.Count());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1545
	CleanupStack::PushL( stores );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1546
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1547
  TBuf<KVPbhkPrefixLength> phoneDataBasePrefix(KVPbhkSymbianDBPrefix);
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1548
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1549
	for(TInt i=0 ; i< storeList.Count(); i++)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1550
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1551
	    TBuf<KNSmlDefaultStoreNameMaxSize>  currentStore(storeList.At(i).StoreProperties().Uri().UriDes());	    	   
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1552
	    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1553
	    if(currentStore.Find(phoneDataBasePrefix) == 0)//Check if Symbian Database
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1554
	    {	    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1555
	    		//For backward compatability with local and remote servers
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1556
        	    //The Symbian Db name remains unchanged	   
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1557
        	    //The engine methods that create syncml packet, use this information in Database fields
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1558
	            stores->AppendL(*iPacketStoreName);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1559
	    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1560
	    else//End Symbian Database check
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1561
	    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1562
		     stores->AppendL(storeList.At(i).StoreProperties().Uri().UriDes());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1563
	    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1564
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1565
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1566
	_DBG_FILE("CNSmlContactsDataStore::DoListStoresLC(): end");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1567
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1568
	return stores;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1569
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1570
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1571
// ------------------------------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1572
// TInt CNSmlContactsDataStore::LdoFetchItemL( TSmlDbItemUid& aUid, CBufBase& aItem )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1573
// ------------------------------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1574
EXPORT_C void CNSmlContactsDataStore::LdoFetchItemL( TSmlDbItemUid& aUid, CBufBase& aItem )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1575
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1576
	_DBG_FILE("CNSmlContactsDataStore::LdoFetchItemL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1577
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1578
	 iWriteStream.Open(aItem);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1579
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1580
	 MVPbkContactLink* contactLink  = iIdConverter->IdentifierToLinkLC(aUid);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1581
	 iVCardEngine->ExportVCardForSyncL(iWriteStream,*contactLink,*this);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1582
	 CleanupStack::PopAndDestroy();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1583
	 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1584
	 iLastOperation = ENSMLFetchOp;
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1585
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1586
	_DBG_FILE("CNSmlContactsDataStore::LdoFetchItemL(): end");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1587
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1588
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1589
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1590
// ------------------------------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1591
// TInt CNSmlContactsDataStore::LdoAddItemL( TSmlDbItemUid& aUid,
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1592
//                                           const TDesC8& aItem,
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1593
//                                           TInt aSize,
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1594
//                                           TTime& aLastModified,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1595
//                                           TBool& aConfidential )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1596
// ------------------------------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1597
EXPORT_C void CNSmlContactsDataStore::LdoAddItemL( const TDesC8& aItem,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1598
                                          TInt aSize)
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1599
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1600
	_DBG_FILE("CNSmlContactsDataStore::LdoAddItemL(): begin");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1601
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1602
	if( !iOpened )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1603
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1604
		User::Leave( KErrNotReady );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1605
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1606
		
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1607
	// Is there enough space on drive 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1608
	if( DriveBelowCriticalLevelL( aSize ) )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1609
		{
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1610
		User::Leave( KErrDiskFull );
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1611
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1612
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1613
	 iBuf = aItem.AllocLC();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1614
	StripPropertyL( iBuf, KVersitTokenUID() );
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1615
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1616
	 iReadStream.Open( *iBuf );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1617
	// import a vcard without checking for duplicates
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1618
	iVCardEngine->ImportVCardForSyncL(*iStore,iReadStream,*this);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1619
	iLastOperation = ENSmlAddOp;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1620
	CleanupStack::Pop(iBuf);
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1621
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1622
	_DBG_FILE("CNSmlContactsDataStore::LdoAddItemL(): end");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1623
	
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1624
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1625
// ------------------------------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1626
// TInt CNSmlContactsDataStore::LdoAddItemsL( CBufBase*& aItems,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1627
//                                           TInt aSize)
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1628
// ------------------------------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1629
EXPORT_C void CNSmlContactsDataStore::LdoAddItemsL( CBufBase*& aItems,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1630
                                          TInt aSize)
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1631
	{
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1632
	_DBG_FILE("CNSmlContactsDataStore::LdoAddItemL(): begin");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1633
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1634
	if( !iOpened )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1635
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1636
		User::Leave( KErrNotReady );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1637
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1638
		
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1639
	// Is there enough space on drive 
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1640
	if( DriveBelowCriticalLevelL( aSize ) )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1641
		{
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1642
		User::Leave( KErrDiskFull );
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1643
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1644
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1645
	iReadStream.Open( aItems->Ptr(0) );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1646
	 // import vcards without checking for duplicates
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1647
	iVCardEngine->ImportVCardForSyncL(*iStore,iReadStream,*this);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1648
	iLastOperation = ENSmlAddOp;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1649
	_DBG_FILE("CNSmlContactsDataStore::LdoAddItemL(): end");
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1650
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1651
	}
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1652
		
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1653
// ------------------------------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1654
// TInt CNSmlContactsDataStore::LdoUpdateItemL(TSmlDbItemUid aUid,
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1655
//                                             const TDesC8& aItem,
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1656
//                                             TInt aSize,
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1657
//                                             TTime& aLastModified )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1658
// ------------------------------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1659
EXPORT_C void CNSmlContactsDataStore::LdoUpdateItemL()
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1660
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1661
	_DBG_FILE("CNSmlContactsDataStore::LdoUpdateItemL(): begin");
24
8e7494275d3a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 12
diff changeset
  1662
	
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1663
	iBuf = iContactsBufferItemList[iIndex]->iItemData->Ptr(0).AllocLC();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1664
	// Remove UID's from data
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1665
	StripPropertyL( iBuf, KVersitTokenUID() );
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1666
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1667
	iReadStream.Open( *iBuf );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1668
	iContactLink = iIdConverter->IdentifierToLinkLC(iUid);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1669
	iVCardEngine->ImportVCardMergeL(*iContactLink, *iStore, iReadStream, *this);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1670
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1671
	CleanupStack::Pop();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1672
	iLastOperation = ENSMLUpdateImportOp;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1673
	CleanupStack::Pop(iBuf);
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1674
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1675
	_DBG_FILE("CNSmlContactsDataStore::LdoUpdateItemL(): end");
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1676
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1677
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1678
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1679
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1680
// ------------------------------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1681
// CNSmlContactsDataStore::DriveBelowCriticalLevelL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1682
// ------------------------------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1683
EXPORT_C TBool CNSmlContactsDataStore::DriveBelowCriticalLevelL( TInt aSize )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1684
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1685
	return SysUtil::DiskSpaceBelowCriticalLevelL( &iRfs, aSize, iDrive );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1686
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1687
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1688
// ----------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1689
// CBufBase* CNSmlContactsDataStore::AddBufferListL()
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1690
// ----------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1691
EXPORT_C CBufBase* CNSmlContactsDataStore::AddBufferListL( TSmlDbItemUid& aUid, TInt aSize, TInt aStatus )
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1692
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1693
	_DBG_FILE("CNSmlContactsDataStore::AddBufferListL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1694
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1695
	CNSmlContactsBufferItem* newBufferItem = new (ELeave) CNSmlContactsBufferItem;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1696
	CleanupStack::PushL( newBufferItem );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1697
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1698
	if( iModType == ENSmlCntItemAdd )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1699
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1700
		newBufferItem->iPUid     = &aUid;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1701
		newBufferItem->iItemData = CBufFlat::NewL( KNSmlItemDataExpandSize );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1702
    	newBufferItem->iStatus   = KErrGeneral; // Default for add
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1703
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1704
	else
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1705
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1706
		newBufferItem->iPUid = &aUid;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1707
		newBufferItem->iUid = aUid;		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1708
		newBufferItem->iItemData = CBufFlat::NewL( KNSmlItemDataExpandSize );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1709
    	newBufferItem->iStatus = KNSmlNoError; // Default if not handled
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1710
		}		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1711
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1712
	newBufferItem->iModType = iModType;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1713
	newBufferItem->iMimeType = iMimeTypeItem.AllocL();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1714
	newBufferItem->iMimeVersion = iMimeVersionItem.AllocL();
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1715
	newBufferItem->iSize = aSize;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1716
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1717
	if( aStatus != KErrNone )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1718
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1719
		newBufferItem->iStatus  = aStatus;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1720
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1721
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1722
	iContactsBufferItemList.AppendL( newBufferItem );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1723
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1724
	iMimeTypeItem.Set( KNullDesC8 ); 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1725
	iMimeVersionItem.Set( KNullDesC8 );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1726
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1727
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1728
	CleanupStack::Pop();	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1729
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1730
	if( iModType == ENSmlCntItemAdd && 
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1731
	    aStatus  == KErrNotSupported )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1732
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1733
		iStateItem = KErrNotSupported;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1734
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1735
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1736
	_DBG_FILE("CNSmlContactsDataStore::AddBufferListL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1737
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1738
	return newBufferItem->iItemData;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1739
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1740
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1741
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1742
// ------------------------------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1743
// void CNSmlContactsDataStore::StripPropertyL( HBufC8*& aItem, const TDesC8& aProperty )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1744
// ------------------------------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1745
EXPORT_C void CNSmlContactsDataStore::StripPropertyL( HBufC8*& aItem, const TDesC8& aProperty ) const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1746
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1747
	_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1748
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1749
	if( !aItem )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1750
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1751
		_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): NULL pointer");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1752
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1753
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1754
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1755
	TPtr8 hItemPtr( aItem->Des() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1756
	HBufC8* propBuf = HBufC8::NewLC( aProperty.Length() + 2 );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1757
	TPtr8 propPtr( propBuf->Des() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1758
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1759
	propPtr.Append( KVersitTokenCRLF() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1760
	propPtr.Append( aProperty );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1761
	TInt propPos = hItemPtr.Find( propPtr );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1762
	if( propPos != KErrNotFound )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1763
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1764
		_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): property found in item data -> removing it");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1765
		_DBG_FILE( aProperty.Ptr() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1766
		TPtrC8 propPosPtr( hItemPtr.Mid( propPos + KVersitTokenCRLF().Length() ) );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1767
		TInt propEndPos = propPosPtr.Find( KVersitTokenCRLF() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1768
		hItemPtr.Delete( propPos, propEndPos + KVersitTokenCRLF().Length() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1769
		_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): property removed");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1770
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1771
	CleanupStack::PopAndDestroy(); // propBuf
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1772
	_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1773
	}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1774
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1775
// ------------------------------------------------------------------------------------------------
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1776
// void CNSmlContactsDataStore::StripPropertyL( CBufBase*& aItem, const TDesC8& aProperty )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1777
// ------------------------------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  1778
EXPORT_C void CNSmlContactsDataStore::StripPropertyL( CBufBase*& aItem, const TDesC8& aProperty ) const
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1779
	{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1780
	_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): begin");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1781
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1782
	if( !aItem )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1783
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1784
		_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): NULL pointer");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1785
		return;
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1786
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1787
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1788
	HBufC8* propBuf = HBufC8::NewLC( aProperty.Length() + 2 );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1789
	TPtr8 propPtr( propBuf->Des() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1790
	propPtr.Append( KVersitTokenCRLF() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1791
	propPtr.Append( aProperty );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1792
	TInt propPos = aItem->Ptr(0).Find( propPtr );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1793
	
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1794
	while( propPos != KErrNotFound )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1795
		{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1796
		_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): property found in item data -> removing it");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1797
		_DBG_FILE( aProperty.Ptr() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1798
		TInt propEndPos = aItem->Ptr( propPos + KVersitTokenCRLF().Length()).Find(KVersitTokenCRLF() );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1799
		if( propEndPos != KErrNotFound )
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1800
			{
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1801
			aItem->Delete( propPos + KVersitTokenCRLF().Length(), propEndPos );		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1802
			}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1803
		
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1804
		propPos = aItem->Ptr(0).Find( propPtr );
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1805
		_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): property removed");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1806
		}
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1807
	CleanupStack::PopAndDestroy(); // propBuf
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1808
	_DBG_FILE("CNSmlContactsDataStore::StripPropertyL(): end");
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1809
	}
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1810
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1811
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1812
// CNSmlContactsDataStore::IsConfidentialL
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1813
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1814
//	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1815
EXPORT_C TBool CNSmlContactsDataStore::IsConfidentialL(  MVPbkStoreContact& aItem )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1816
    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1817
    _DBG_FILE("CNSmlContactsDataStore::IsConfidentialL(): begin");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1818
    TBool ret( EFalse );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1819
    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1820
    //find X-CLASS field type
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1821
	const MVPbkFieldType* syncclass = 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1822
        iContactManager->FieldTypes().Find(R_VPBK_FIELD_TYPE_SYNCCLASS );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1823
	CVPbkBaseContactFieldTypeIterator* itr = 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1824
        CVPbkBaseContactFieldTypeIterator::NewLC( *syncclass, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1825
            aItem.Fields() );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1826
	while ( itr->HasNext() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1827
        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1828
        const MVPbkBaseContactField* field = itr->Next();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1829
        const MVPbkContactFieldTextData& data = MVPbkContactFieldTextData::Cast(field->FieldData());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1830
        TPtrC ptr = data.Text();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1831
        //compare the sync type
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1832
        if ( ptr.Compare( KNSmlContactSyncNoSync ) == 0 )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1833
            {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1834
            _DBG_FILE("CNSmlContactsDataStore::IsConfidentialL(): \
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1835
                       find confidential");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1836
            ret = ETrue;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1837
            }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1838
         
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1839
        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1840
	CleanupStack::PopAndDestroy( itr );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1841
    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1842
    _DBG_FILE("CNSmlContactsDataStore::IsConfidentialL(): end");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1843
    return ret;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1844
    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1845
    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1846
 // ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1847
// CNSmlContactsDataStore::ResetBuffer
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1848
// ----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1849
//	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1850
EXPORT_C void CNSmlContactsDataStore:: ResetBuffer()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1851
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1852
	if( iItemDataAddBatch )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1853
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1854
		iItemDataAddBatch->Reset();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1855
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1856
	iContactsBufferItemList.ResetAndDestroy();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1857
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1858
// -----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1859
// From MVPbkContactStoreListObserver  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1860
// Called when a contact store is ready to use.
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1861
// -----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1862
 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1863
EXPORT_C void CNSmlContactsDataStore::StoreReady( MVPbkContactStore& /*aContactStore*/ )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1864
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1865
	_DBG_FILE("CNSmlContactsDataStore::StoreReady(): begin");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1866
	//The contact data base opened successfully
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1867
	iOpened = ETrue;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1868
	//id to uniquely identify the opened store 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1869
	iOpenedStoreId = DefaultHash::Des16(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1870
						iStore->StoreProperties().Uri().UriDes());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1871
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1872
	TRAPD(error, iContactsModsFetcher->FetchModificationsL( *iCallerStatus ));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1873
	if(error != KErrNone)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1874
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1875
		User::RequestComplete( iCallerStatus, error );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1876
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1877
	_DBG_FILE("CNSmlContactsDataStore::StoreReady(): end");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1878
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1879
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1880
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1881
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1882
//  From MVPbkContactStoreListObserver  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1883
//	Called when a contact store becomes unavailable.
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1884
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1885
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1886
EXPORT_C void CNSmlContactsDataStore::StoreUnavailable(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1887
        MVPbkContactStore& /*aContactStore*/,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1888
        TInt aReason )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1889
    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1890
    _DBG_FILE("CNSmlContactsDataStore::StoreUnavailable(): begin");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1891
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1892
    //Unable open the default contact data base
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1893
	iOpened = EFalse;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1894
	delete iStoreName;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1895
	iStoreName = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1896
	iOpenedStoreId = 0;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1897
	User::RequestComplete( iCallerStatus, aReason );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1898
	_DBG_FILE("CNSmlContactsDataStore::StoreUnavailable(): end");		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1899
	return;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1900
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1901
    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1902
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1903
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1904
// From MVPbkContactStoreListObserver  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1905
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1906
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1907
EXPORT_C void CNSmlContactsDataStore::HandleStoreEventL(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1908
        MVPbkContactStore& /*aContactStore*/,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1909
        TVPbkContactStoreEvent /*aStoreEvent*/ )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1910
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1911
	//Indication not needed.
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1912
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1913
    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1914
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1915
//  CNSmlContactsDataStore::VPbkSingleContactOperationComplete
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1916
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1917
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1918
EXPORT_C void CNSmlContactsDataStore::VPbkSingleContactOperationComplete(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1919
		MVPbkContactOperationBase& aOperation,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1920
		MVPbkStoreContact* aContact )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1921
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1922
	MVPbkContactOperationBase* operation = &aOperation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1923
	if ( operation )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1924
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1925
		delete operation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1926
		operation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1927
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1928
	TRAPD(error ,SingleContactOperationCompleteL(aContact));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1929
	delete aContact;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1930
	if(error!= KErrNone)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1931
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1932
			User::RequestComplete( iCallerStatus, error );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1933
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1934
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1935
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1936
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1937
//  CNSmlContactsDataStore::VPbkSingleContactOperationFailed
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1938
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1939
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1940
EXPORT_C void CNSmlContactsDataStore::VPbkSingleContactOperationFailed(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1941
    MVPbkContactOperationBase& aOperation,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1942
    TInt aError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1943
    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1944
	MVPbkContactOperationBase* operation = &aOperation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1945
	if ( operation )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1946
	    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1947
		delete operation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1948
		operation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1949
	    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1950
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1951
	 if(iLastOperation == ENSMLFetchOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1952
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1953
	 	iWriteStream.Close();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1954
	 	User::RequestComplete( iCallerStatus, aError );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1955
	 	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1956
	else if (iLastOperation == ENSMLUpdateExportOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1957
        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1958
        iWriteStream.Close();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1959
        delete iMergeItem;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1960
        iMergeItem = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1961
        User::RequestComplete( iCallerStatus, aError );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1962
        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1963
	else if (iLastOperation == ENSMLUpdateImportOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1964
        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1965
        if(iBatchMode)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1966
            {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1967
            iResultArray->Append( aError ); 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1968
            } 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1969
		delete iContactLink;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1970
        iContactLink = NULL;	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1971
        delete iBuf;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1972
        iBuf = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1973
        iReadStream.Close();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1974
        iIndex++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1975
        if(iIndex == iContactsBufferItemList.Count() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1976
            {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1977
            ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1978
            User::RequestComplete( iCallerStatus, aError );    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1979
            }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1980
        else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1981
            {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1982
            _DBG_FILE("VPbkSingleContactOperationFailed, Continuing to complete the Batch Operation");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1983
            ExecuteBufferL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1984
            }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1985
        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1986
	else if(iLastOperation == ENSmlRetrieveOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1987
	    {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1988
        iRetrieveCount--;	        
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1989
        if(iBatchMode)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1990
            {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1991
            iResultArray->AppendL( aError ); 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1992
            }        
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1993
        iIndex++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1994
        if(iIndex == iContactsBufferItemList.Count() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1995
            {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1996
            ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1997
            User::RequestComplete( iCallerStatus, aError );    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1998
            }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  1999
        else if(!iRetrieveCount)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2000
            {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2001
            _DBG_FILE("VPbkSingleContactOperationFailed, Continuing to complete the Batch Operation");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2002
            ExecuteBufferL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2003
            }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2004
	    }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2005
    else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2006
        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2007
        _DBG_FILE("VPbkSingleContactOperationFailed, No Matching LastOperation Completing the Operation");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2008
        User::RequestComplete( iCallerStatus, aError );    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2009
        }	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2010
	_DBG_FILE("CNSmlContactsDataStore::VPbkSingleContactOperationFailed(): end");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2011
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2012
 // ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2013
//  CNSmlContactsDataStore::VPbkSingleContactOperationFailed
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2014
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2015
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2016
EXPORT_C void CNSmlContactsDataStore::SingleContactOperationCompleteL(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2017
 		MVPbkStoreContact* aContact)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2018
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2019
	if(iLastOperation == ENSMLFetchOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2020
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2021
		iWriteStream.Close();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2022
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2023
		iItemData->Compress();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2024
		//strip the fields not supported by server
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2025
		iDataMod->StripTxL( *iItemData );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2026
		*iSize = iItemData->Size();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2027
		iState = ENSmlItemOpen;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2028
		if ( iServerMaxObjectSize == 0 || *iSize <= iServerMaxObjectSize )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2029
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2030
			User::RequestComplete( iCallerStatus, KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2031
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2032
		else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2033
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2034
			User::RequestComplete( iCallerStatus, KErrTooBig );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2035
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2036
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2037
	else if (iLastOperation == ENSMLUpdateExportOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2038
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2039
		iDataMod->MergeRxL( *iContactsBufferItemList[iIndex]->iItemData, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2040
		    *iMergeItem, iFieldLevelReplace );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2041
		iWriteStream.Close();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2042
		delete iMergeItem;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2043
		iMergeItem = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2044
		LdoUpdateItemL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2045
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2046
	else if (iLastOperation == ENSMLUpdateImportOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2047
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2048
		iFieldLevelReplace = EFalse;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2049
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2050
		if(!IsConfidentialL(*aContact))
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2051
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2052
			TInt32 id = iIdConverter->LinkToIdentifier(*aContact->CreateLinkLC());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2053
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2054
			TNSmlSnapshotItem item(id);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2055
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2056
			MVPbkStoreContact2* tempContact = 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2057
					reinterpret_cast<MVPbkStoreContact2*> (aContact->StoreContactExtension (KMVPbkStoreContactExtension2Uid));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2058
       		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2059
			MVPbkStoreContactProperties *contactProterties 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2060
										= tempContact ->PropertiesL();;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2061
			CleanupDeletePushL(contactProterties);				
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2062
			item.SetLastChangedDate(contactProterties->LastModifiedL());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2063
			CleanupStack::PopAndDestroy();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2064
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2065
			item.SetSoftDelete( EFalse );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2066
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2067
			TRAP_IGNORE(iChangeFinder->ItemUpdatedL( item ));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2068
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2069
			CleanupStack::PopAndDestroy();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2070
			if(iBatchMode)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2071
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2072
				iResultArray->Append(KErrNone);	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2073
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2074
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2075
	        delete iContactLink;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2076
	        iContactLink = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2077
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2078
			delete iBuf;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2079
			iBuf = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2080
			iReadStream.Close();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2081
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2082
			iIndex++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2083
			if(iIndex == iContactsBufferItemList.Count() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2084
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2085
				ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2086
				User::RequestComplete( iCallerStatus, iRetCommand );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2087
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2088
			else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2089
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2090
					ExecuteBufferL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2091
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2092
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2093
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2094
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2095
	else if(iLastOperation == ENSmlRetrieveOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2096
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2097
		iRetrieveCount--;	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2098
		if(!IsConfidentialL(*aContact))
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2099
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2100
			TInt32 id = iIdConverter->LinkToIdentifier(*aContact->CreateLinkLC());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2101
			*iContactsBufferItemList[iIndex]->iPUid = id;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2102
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2103
			TNSmlSnapshotItem item(id);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2104
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2105
       		MVPbkStoreContact2* tempContact = 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2106
       		    reinterpret_cast<MVPbkStoreContact2*> (aContact->StoreContactExtension (KMVPbkStoreContactExtension2Uid));  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2107
       		       			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2108
			MVPbkStoreContactProperties *contactProterties 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2109
										= tempContact ->PropertiesL();;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2110
			CleanupDeletePushL(contactProterties);				
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2111
			item.SetLastChangedDate(contactProterties->LastModifiedL());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2112
			CleanupStack::PopAndDestroy();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2113
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2114
			item.SetSoftDelete( EFalse );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2115
			// Add the snapshot item to the Change Finder.
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2116
			TRAP_IGNORE(iChangeFinder->ItemAddedL( item ));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2117
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2118
			CleanupStack::PopAndDestroy();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2119
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2120
			if(iBatchMode)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2121
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2122
			iResultArray->AppendL(iRetCommand);	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2123
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2124
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2125
			iIndex++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2126
			if(iIndex == iContactsBufferItemList.Count() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2127
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2128
				ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2129
				User::RequestComplete( iCallerStatus, iRetCommand );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2130
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2131
			else if(!iRetrieveCount)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2132
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2133
					ExecuteBufferL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2134
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2135
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2136
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2137
 }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2138
 // ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2139
//  CNSmlContactsDataStore::ContactsSaved.
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2140
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2141
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2142
EXPORT_C void CNSmlContactsDataStore::ContactsSaved( 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2143
		MVPbkContactOperationBase& aOperation,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2144
        MVPbkContactLinkArray* aResults ) 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2145
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2146
	MVPbkContactOperationBase* operation = &aOperation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2147
	if ( operation )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2148
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2149
		delete operation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2150
		operation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2151
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2152
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2153
	if(iLastOperation == ENSmlAddOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2154
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2155
		//Count of contacts to be added from server to client 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2156
		TInt  cntAddCount( 0 );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2157
		TInt i(iIndex);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2158
		while( i<iContactsBufferItemList.Count() )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2159
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2160
			if ( iContactsBufferItemList[i]->iModType == ENSmlCntItemAdd &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2161
			     iContactsBufferItemList[i]->iStatus  == KNSmlNoError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2162
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2163
				cntAddCount++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2164
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2165
			i++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2166
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2167
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2168
		//Count of contacts successfully added to client	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2169
		iRetrieveCount = aResults->Count();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2170
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2171
		//Count of contacts which could not be added
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2172
		TInt cntAddFailedCount(0);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2173
		cntAddFailedCount = cntAddCount-iRetrieveCount;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2174
		while(cntAddFailedCount > 0)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2175
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2176
			iContactsBufferItemList[iIndex++]->iStatus  = KErrGeneral;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2177
			iResultArray->Append(KErrGeneral);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2178
			cntAddFailedCount--;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2179
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2180
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2181
		if ( aResults->Count() > 0 )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2182
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2183
			for(TInt i=0;i<aResults->Count();i++)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2184
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2185
				//retrieve the contact
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2186
				TRAPD(error,iContactManager->RetrieveContactL( aResults->At(i), *this ));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2187
				if(error != KErrNone)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2188
					{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2189
					User::RequestComplete( iCallerStatus, error );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2190
					}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2191
			iLastOperation = ENSmlRetrieveOp;				 	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2192
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2193
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2194
		delete iBuf;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2195
		delete aResults;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2196
		iBuf = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2197
		iReadStream.Close();	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2198
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2199
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2200
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2201
        
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2202
 // ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2203
//  CNSmlContactsDataStore::ContactsSavingFailed
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2204
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2205
//       
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2206
EXPORT_C void CNSmlContactsDataStore::ContactsSavingFailed( 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2207
        MVPbkContactOperationBase& aOperation, TInt aError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2208
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2209
	MVPbkContactOperationBase* operation = &aOperation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2210
	if ( operation )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2211
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2212
		delete operation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2213
		operation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2214
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2215
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2216
	if(iLastOperation == ENSmlAddOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2217
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2218
	if(iBatchMode)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2219
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2220
		while( iIndex < iContactsBufferItemList.Count() &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2221
		iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemAdd )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2222
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2223
			iContactsBufferItemList[iIndex++]->iStatus  = KErrGeneral;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2224
			iResultArray->Append(KErrGeneral);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2225
			}	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2226
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2227
	else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2228
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2229
		iIndex++;			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2230
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2231
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2232
	if(iIndex == iContactsBufferItemList.Count())
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2233
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2234
		User::RequestComplete( iCallerStatus, aError );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2235
		ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2236
		delete iBuf;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2237
	 	iBuf = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2238
	 	iReadStream.Close();	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2239
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2240
		//Execute the remaining commands in batch
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2241
		else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2242
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2243
			TRAPD(error,ExecuteBufferL());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2244
			if(error != KErrNone)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2245
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2246
			User::RequestComplete( iCallerStatus, error );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2247
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2248
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2249
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2250
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2251
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2252
//  CNSmlContactsDataStore::StepComplete
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2253
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2254
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2255
EXPORT_C void CNSmlContactsDataStore::StepComplete(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2256
		 MVPbkContactOperationBase& /*aOperation*/, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2257
        TInt aStepSize )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2258
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2259
	if(iLastOperation == ENSmlDeleteOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2260
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2261
		if(iBatchMode)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2262
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2263
			for(TInt i = 0 ; i<aStepSize && iIndex < iContactsBufferItemList.Count() ;i++)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2264
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2265
				iResultArray->Append(KErrNone);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2266
				if( iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemDelete &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2267
			    iContactsBufferItemList[iIndex]->iStatus  == KNSmlNoError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2268
					{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2269
					iContactsBufferItemList[iIndex]->iStatus  = KErrNone;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2270
					iUid  = iContactsBufferItemList[iIndex]->iUid;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2271
					iChangeFinder->ItemDeleted( TNSmlSnapshotItem( iUid ));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2272
					}						
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2273
					else if( iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemSoftDelete &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2274
				   		 iContactsBufferItemList[iIndex]->iStatus  == KNSmlNoError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2275
					{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2276
					
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2277
					iContactsBufferItemList[iIndex]->iStatus  = KErrNone;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2278
					iUid  = iContactsBufferItemList[iIndex]->iUid;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2279
					TRAP_IGNORE(iChangeFinder->ItemSoftDeletedL( TNSmlSnapshotItem( iUid ) ));
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2280
					}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2281
					iIndex++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2282
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2283
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2284
			else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2285
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2286
			iChangeFinder->ItemDeleted( TNSmlSnapshotItem( iUid ) );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2287
			User::RequestComplete( iCallerStatus, KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2288
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2289
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2290
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2291
 // ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2292
//  CNSmlContactsDataStore::StepFailed
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2293
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2294
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2295
EXPORT_C TBool CNSmlContactsDataStore::StepFailed(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2296
        MVPbkContactOperationBase& /*aOperation*/,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2297
        TInt /*aStepSize*/,
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2298
        TInt aError )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2299
 {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2300
 if(iLastOperation == ENSmlDeleteOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2301
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2302
	 	if(iBatchMode)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2303
	 	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2304
			if( iIndex < iContactsBufferItemList.Count() &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2305
			iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemDelete )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2306
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2307
			iContactsBufferItemList[iIndex++]->iStatus  = KErrGeneral;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2308
			iResultArray->Append(KErrGeneral);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2309
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2310
		 	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2311
	 	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2312
	 	else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2313
	 	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2314
	 		User::RequestComplete( iCallerStatus, aError );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2315
	 	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2316
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2317
	return ETrue;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2318
 }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2319
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2320
//  CNSmlContactsDataStore::OperationComplete
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2321
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2322
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2323
EXPORT_C void CNSmlContactsDataStore::OperationComplete
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2324
		( MVPbkContactOperationBase& aOperation )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2325
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2326
	MVPbkContactOperationBase* operation = &aOperation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2327
	if ( operation )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2328
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2329
		delete operation;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2330
		operation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2331
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2332
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2333
	TRAPD(error ,OperationCompleteL());	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2334
	if(error != KErrNone)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2335
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2336
		User::RequestComplete( iCallerStatus, error );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2337
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2338
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2339
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2340
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2341
//  CNSmlContactsDataStore::OperationCompleteL
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2342
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2343
//
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2344
EXPORT_C void CNSmlContactsDataStore::OperationCompleteL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2345
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2346
	if(iLastOperation == ENSmlDeleteOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2347
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2348
		if(iBatchMode )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2349
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2350
			if(iResultArray->Count() != iContactsBufferItemList.Count())
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2351
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2352
				while( iIndex < iContactsBufferItemList.Count() && 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2353
				iContactsBufferItemList[iIndex]->iModType == ENSmlCntItemDelete 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2354
				&& iContactsBufferItemList[iIndex]->iStatus  == KErrNotFound )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2355
					{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2356
					iResultArray->Append(KErrNotFound);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2357
					iIndex++;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2358
					}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2359
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2360
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2361
			if(iIndex == iContactsBufferItemList.Count())
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2362
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2363
				if(iItemData)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2364
					{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2365
					iItemData->Reset();    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2366
					}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2367
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2368
				ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2369
				User::RequestComplete( iCallerStatus, KErrNone );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2370
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2371
				else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2372
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2373
				ExecuteBufferL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2374
				}	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2375
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2376
			else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2377
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2378
			
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2379
			if(iItemData)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2380
				{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2381
				iItemData->Reset();    
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2382
				}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2383
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2384
			ResetBuffer();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2385
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2386
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2387
		else
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2388
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2389
		if(iLastOperation == ENSMLDeleteAllOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2390
	        {
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2391
	        iDeleteAllOperation = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2392
	        }
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2393
		if( iChangeFinder )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2394
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2395
			iChangeFinder->ResetL();		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2396
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2397
		iSnapshotRegistered = EFalse;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2398
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2399
		delete iContactLnks;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2400
		iContactLnks = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2401
		iContactLink = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2402
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2403
		delete iContactViewBase;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2404
		iContactViewBase = NULL;
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2405
		User::RequestComplete( iCallerStatus, KErrNone );	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2406
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2407
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2408
		
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2409
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2410
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2411
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2412
// CNSmlContactsDataStore::ContactViewReady
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2413
// Implements the view ready function of MVPbkContactViewObserver
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2414
// --------------------------------------------------------------------------- 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2415
EXPORT_C void CNSmlContactsDataStore::ContactViewReady(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2416
                MVPbkContactViewBase& /*aView*/ ) 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2417
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2418
	if(iLastOperation == ENSMLDeleteAllOp)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2419
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2420
		TRAPD(error,DoDeleteAllContactsL());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2421
		if(error != KErrNone)
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2422
			{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2423
			User::RequestComplete( iCallerStatus, error );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2424
			}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2425
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2426
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2427
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2428
// CNSmlContactsDataStore::PrepareForContactsDeleteL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2429
// Delete all the contacts at client
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2430
// ---------------------------------------------------------------------------	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2431
EXPORT_C void CNSmlContactsDataStore::DoDeleteAllContactsL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2432
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2433
	iContactLnks = CVPbkContactLinkArray::NewL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2434
	TInt contactCount = iContactViewBase->ContactCountL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2435
	//add all the contact links to  ContactLinkArray
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2436
	for( TInt i = 0; i < contactCount; i++ )
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2437
		{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2438
			const MVPbkViewContact& contact = 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2439
						iContactViewBase->ContactAtL(i);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2440
			iContactLink = contact.CreateLinkLC();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2441
			iContactLnks->AppendL(iContactLink);
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2442
			CleanupStack::Pop();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2443
		}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2444
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2445
	iDeleteAllOperation = iContactManager->DeleteContactsL( *iContactLnks, *this );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2446
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2447
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2448
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2449
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2450
// CNSmlContactsDataStore::ContactViewUnavailable
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2451
// Implements the view unavailable function of MVPbkContactViewObserver
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2452
// --------------------------------------------------------------------------- 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2453
EXPORT_C void CNSmlContactsDataStore::ContactViewUnavailable(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2454
                MVPbkContactViewBase& /*aView*/ )  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2455
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2456
	   
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2457
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2458
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2459
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2460
// CNSmlContactsDataStore::ContactAddedToView
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2461
// Implements the add contact function of MVPbkContactViewObserver
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2462
// --------------------------------------------------------------------------- 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2463
EXPORT_C void CNSmlContactsDataStore::ContactAddedToView(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2464
            MVPbkContactViewBase& /*aView*/, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2465
            TInt /*aIndex*/, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2466
            const MVPbkContactLink& /*aContactLink*/ ) 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2467
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2468
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2469
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2470
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2471
// CNSmlContactsDataStore::ContactRemovedFromView
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2472
// Implements the remove contact function of MVPbkContactViewObserver
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2473
// --------------------------------------------------------------------------- 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2474
EXPORT_C void CNSmlContactsDataStore::ContactRemovedFromView(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2475
                MVPbkContactViewBase& /*aView*/, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2476
                TInt /*aIndex*/, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2477
                const MVPbkContactLink& /*aContactLink*/ )  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2478
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2479
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2480
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2481
// ---------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2482
// CNSmlContactsDataStore::ContactViewError
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2483
// Implements the view error function of MVPbkContactViewObserver
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2484
// --------------------------------------------------------------------------- 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2485
EXPORT_C void CNSmlContactsDataStore::ContactViewError(
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2486
            MVPbkContactViewBase& /*aView*/, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2487
            TInt /*aError*/, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2488
            TBool /*aErrorNotified*/ )  
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2489
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2490
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2491
	}
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2492
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2493
// -----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2494
// CNSmlContactsDataStore::CreateViewL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2495
// Create a contact view 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2496
// -----------------------------------------------------------------------------
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2497
EXPORT_C void CNSmlContactsDataStore::CreateViewL()
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2498
	{
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2499
	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2500
	CVPbkContactViewDefinition* viewDef = CVPbkContactViewDefinition::NewL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2501
	CleanupStack::PushL( viewDef );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2502
	viewDef->SetType( EVPbkContactsView );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2503
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2504
	viewDef->SetUriL(iStore->StoreProperties().Uri().UriDes());
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2505
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2506
	 iContactViewBase = iContactManager->CreateContactViewLC( 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2507
				                         *this, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2508
				                         *viewDef, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2509
				                         iContactManager->FieldTypes()  );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2510
	CleanupStack::Pop();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2511
	CleanupStack::PopAndDestroy(viewDef);	
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2512
	}
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2513
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2514
// ------------------------------------------------------------------------------------------------
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2515
// CNSmlContactsDataStore::GetStoreFormatResourceFileL
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2516
// ------------------------------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2517
EXPORT_C const TDesC& CNSmlContactsDataStore::GetStoreFormatResourceFileL()
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2518
    {
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2519
    _DBG_FILE("CNSmlContactsDataStore::GetStoreFormatResourceFileL(): begin");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2520
    
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2521
    // Check correct Data Sync protocol
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2522
    TInt value( EDataSyncNotRunning );
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2523
    TInt error = RProperty::Get( KPSUidDataSynchronizationInternalKeys,
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2524
        KDataSyncStatus, value );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2525
    if ( error == KErrNone &&
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2526
         value == EDataSyncRunning )
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2527
        {
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2528
        return KNSmlContactsStoreFormatRsc_1_1_2;
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2529
        }
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2530
    else // error or protocol version 1.2 
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2531
        {
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2532
        return KNSmlContactsStoreFormatRsc_1_2;
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2533
        }
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2534
    _DBG_FILE("CNSmlContactsDataStore::GetStoreFormatResourceFileL(): end");
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2535
    }
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2536
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2537
// ------------------------------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2538
// CNSmlContactsDataStore::CreateModsFetcherL
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2539
// ------------------------------------------------------------------------------------------------
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2540
EXPORT_C MContactsModsFetcher* CNSmlContactsDataStore::CreateModsFetcherL()
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2541
    {
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2542
    _DBG_FILE("CNSmlContactsDataStore::CreateModsFetcherL(): begin");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2543
    CNSmlContactsModsFetcher* modsFetcher = 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2544
        new ( ELeave ) CNSmlContactsModsFetcher( iSnapshotRegistered, 
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2545
        *iContactManager,*iStore, iKey, *iChangeFinder );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2546
    CleanupStack::PushL( modsFetcher );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2547
    modsFetcher->ConstructL();
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2548
    CleanupStack::Pop( modsFetcher );
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2549
    _DBG_FILE("CNSmlContactsDataStore::CreateModsFetcherL(): end");
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2550
    return modsFetcher;
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2551
    }
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2552
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2553
// ------------------------------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2554
// CNSmlContactsDataStore::GetDataMod
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2555
// ------------------------------------------------------------------------------------------------
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2556
EXPORT_C CNSmlDataModBase& CNSmlContactsDataStore::GetDataMod()
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2557
    {
25
4f0867e42d62 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 24
diff changeset
  2558
    _DBG_FILE("CNSmlContactsDataStore::GetDataMod()");
10
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2559
    return *iDataMod;
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2560
    }
b922b9936679 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
  2561
0
dab8a81a92de Revision: 200948
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2562
// End of File