deviceupdatesui/omadmadapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp
author hgs
Tue, 13 Jul 2010 03:44:34 +0530
changeset 44 137912d1a556
parent 33 deviceupdatesui/adapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp@7464c1e21dae
permissions -rw-r--r--
201021
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     1
/*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     3
* All rights reserved.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     8
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     9
* Initial Contributors:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    11
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    12
* Contributors:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    13
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    14
* Description:    DM-settings adapter
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    15
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    16
*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    17
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    18
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    19
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    20
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    21
// INCLUDE FILES
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    22
#include "NSmlDMSettingsAdapter12.h"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    23
#include "nsmldebug.h"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    24
#include "nsmlconstants.h"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    25
#include "nsmldmconstants.h"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    26
#include "nsmldmiapmatcher.h"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    27
#include "nsmldmauthinfo.h"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    28
#include <featmgr.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    29
#include <implementationproxy.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    30
#include <SyncMLClientDM.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    31
#include <SyncMLTransportProperties.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    32
#include <e32base.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    33
#include <DevManInternalCRKeys.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    34
#include <centralrepository.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    35
#ifndef __WINS__
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    36
// This lowers the unnecessary compiler warning (armv5) to remark.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    37
// "Warning:  #174-D: expression has no effect..." is caused by 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    38
// DBG_ARGS8 macro in no-debug builds.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    39
#pragma diag_remark 174
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    40
#endif
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    41
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    42
const TUint KNSmlDMSettingsAdapterImplUid = 0x10282CE8;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    43
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    44
const TInt KBufSize32   = 32;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    45
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    46
// ============================ MEMBER FUNCTIONS ===============================
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    47
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    48
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    49
//  CNSmlDMSettingsAdapter12::NewL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    50
//  Two-phased constructor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    51
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    52
CNSmlDMSettingsAdapter12* CNSmlDMSettingsAdapter12::NewL( MSmlDmCallback* aDmCallback )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    53
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    54
	_DBG_FILE("CNSmlDMSettingsAdapter12::NewL(): begin");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    55
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    56
	CNSmlDMSettingsAdapter12* self = NewLC( aDmCallback );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    57
	CleanupStack::Pop();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    58
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    59
	_DBG_FILE("CNSmlDMSettingsAdapter12::NewL(): end");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    60
	return self;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    61
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    62
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    63
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    64
//  CNSmlDMSettingsAdapter12::NewLC( )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    65
//  Loads the CNSmlDMSettingsAdapter12 class and pushes it to clenupstack.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    66
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    67
CNSmlDMSettingsAdapter12* CNSmlDMSettingsAdapter12::NewLC( MSmlDmCallback* aDmCallback )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    68
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    69
	_DBG_FILE( "CNSmlDMSettingsAdapter12::NewLC(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    70
	CNSmlDMSettingsAdapter12* self = new ( ELeave ) CNSmlDMSettingsAdapter12( aDmCallback );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    71
	CleanupStack::PushL( self );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    72
    self->iCallBack = aDmCallback;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    73
	self->ConstructL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    74
	self->iLeafType = EDMUnset;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    75
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    76
	_DBG_FILE( "CNSmlDMSettingsAdapter12::NewLC(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    77
	return self;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    78
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    79
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    80
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    81
//  CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    82
//  Default constructor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    83
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    84
CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter12( TAny* aEcomArguments) : 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    85
                                                CSmlDmAdapter(aEcomArguments )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    86
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    87
	_DBG_FILE( "CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    88
	_DBG_FILE( "CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    89
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    90
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    91
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    92
//  CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    93
//  Destructor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    94
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    95
CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter12()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    96
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    97
	_DBG_FILE( "CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    98
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    99
    delete iField;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   100
	delete iURIField;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   101
    // Client API Session & Profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   102
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   103
	iSyncSession.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   104
    iSyncSessionOpen = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   105
	// In Case the Buffer isnt cleared
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   106
	if ( iBuffer)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   107
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   108
		for (TInt val =0; val<iBuffer->Count ();val++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   109
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   110
			delete iBuffer->At(val).iMappingName;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   111
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   112
			ClearBuffer ( iBuffer->At(val).iLeafBuf);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   113
			delete iBuffer->At(val).iLeafBuf;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   114
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   115
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   116
		iBuffer->Reset ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   117
		delete iBuffer;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   118
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   119
    delete iPortNbr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   120
    iPortBuffer.Reset();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   121
    iPortBuffer.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   122
    iProfileLockBuffer.Reset();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   123
    iProfileLockBuffer.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   124
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   125
    iPrivateApi.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   126
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   127
    iCallBack = 0; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   128
    FeatureManager::UnInitializeLib();            
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   129
	_DBG_FILE( "CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   130
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   131
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   132
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   133
//		CNSmlDMSettingsAdapter12::ConstructL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   134
//		Second phase constructor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   135
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   136
void CNSmlDMSettingsAdapter12::ConstructL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   137
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   138
	iField = HBufC8::NewL( KNSmlMaxURLLength );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   139
	iURIField = NULL;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   140
    iSyncSessionOpen = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   141
	FeatureManager::InitializeLibL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   142
	// variables used for Buffering
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   143
	iBufOn = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   144
	iComplete = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   145
	iExecutionIndex = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   146
	iNewProfile = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   147
	// initialising iBuffer
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   148
	iBuffer = new (ELeave) CArrayFixFlat <TNSmlDMBufferElement> (KNSmlDMGranularity);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   149
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   150
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   151
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   152
//  CNSmlDMSettingsAdapter12::DDFVersionL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   153
//  Returns the DDF version number.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   154
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   155
void CNSmlDMSettingsAdapter12::DDFVersionL( CBufBase& aVersion )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   156
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   157
	_DBG_FILE(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   158
            "CNSmlDMSettingsAdapter12::DDFVersionL(CBufBase& aDDFVersion): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   159
	aVersion.InsertL( 0, KVersion );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   160
	_DBG_FILE(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   161
            "CNSmlDMSettingsAdapter12::DDFVersionL(CBufBase& aDDFVersion): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   162
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   163
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   164
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   165
//  CNSmlDMSettingsAdapter12::DDFStructureL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   166
//  Fills the DDF structure of the adapter.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   167
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   168
void CNSmlDMSettingsAdapter12::DDFStructureL( MSmlDmDDFObject& aDDF )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   169
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   170
	_DBG_FILE( "CNSmlDMSettingsAdapter12::DDFStructureL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   171
      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   172
    //Making DMAcc as root 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   173
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   174
	MSmlDmDDFObject* ddfRoot = &aDDF;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   175
	MSmlDmDDFObject& nDmDDF = ddfRoot->AddChildObjectL( KNSmlDefDMAcc );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   176
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   177
	TSmlDmAccessTypes *aclTypes = new ( ELeave ) TSmlDmAccessTypes();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   178
	CleanupStack::PushL( aclTypes );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   179
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   180
    // Set Get as acceptable operations
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   181
    aclTypes->SetGet();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   182
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   183
	nDmDDF.SetDFTitleL( KNSmlDMadapterTitle );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   184
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   185
    FillNodeInfoL( nDmDDF, *aclTypes, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   186
                    MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   187
                    KNullDesC8, KNullDesC8, KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   188
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   189
	aclTypes->SetAdd();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   190
	// Set rest acceptable operations for data itself
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   191
	aclTypes->SetReplace();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   192
	aclTypes->SetDelete();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   193
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   194
	TSmlDmAccessTypes aclTypesNoGet;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   195
	aclTypesNoGet.SetReplace();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   196
	aclTypesNoGet.SetAdd();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   197
	aclTypesNoGet.SetDelete();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   198
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   199
	TSmlDmAccessTypes aclTypesAR;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   200
	aclTypesAR.SetReplace();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   201
	aclTypesAR.SetAdd();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   202
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   203
    TSmlDmAccessTypes aclTypesARG;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   204
	aclTypesARG.SetReplace();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   205
	aclTypesARG.SetAdd();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   206
    aclTypesARG.SetGet();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   207
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   208
    TSmlDmAccessTypes aclTypesG;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   209
    aclTypesG.SetGet();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   210
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   211
    TSmlDmAccessTypes aclTypesAG;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   212
    aclTypesAG.SetGet();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   213
    aclTypesAG.SetAdd();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   214
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   215
    TSmlDmAccessTypes aclTypesAGD;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   216
    aclTypesAGD.SetGet();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   217
    aclTypesAGD.SetAdd();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   218
    aclTypesAGD.SetDelete();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   219
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   220
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   221
	MSmlDmDDFObject& nProDDF = nDmDDF.AddChildObjectGroupL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   222
    FillNodeInfoL( nProDDF, *aclTypes, MSmlDmDDFObject::EZeroOrMore, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   223
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   224
                    KNullDesC8, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   225
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   226
    MSmlDmDDFObject& nAppIdDDF = nProDDF.AddChildObjectL( KNSmlDdfAppId );			// Addr
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   227
    FillNodeInfoL( nAppIdDDF, aclTypesG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   228
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   229
                    KNSmlDdfAppIdDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   230
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   231
      //PrefConRef 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   232
    MSmlDmDDFObject& nPrefConRefDDF = nProDDF.AddChildObjectL( KNSmlDdfPrefConRef );	// PrefConRef
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   233
    FillNodeInfoL( nPrefConRefDDF, aclTypesARG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   234
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   235
                    KNSmlDdfConRefDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   236
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   237
           
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   238
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   239
   // App Address nodes 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   240
    MSmlDmDDFObject& nAppAddrDDF = nProDDF.AddChildObjectL( KNSmlDdfAppAddr );	// AppAddr
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   241
    FillNodeInfoL( nAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   242
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   243
                    KNSmlDdfAddrDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   244
   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   245
    MSmlDmDDFObject& rtToAppAddrRef = nAppAddrDDF.AddChildObjectGroupL();  //AppAddr/<X>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   246
    FillNodeInfoL(rtToAppAddrRef,aclTypesG,MSmlDmDDFObject::EOneOrMore,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   247
                  MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   248
                  KNSmlDdfAddrDescription,KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   249
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   250
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   251
    MSmlDmDDFObject& nAddrForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfAddr );			// Addr
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   252
    FillNodeInfoL( nAddrForAppAddrDDF, aclTypesARG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   253
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   254
                    KNSmlDdfAddrDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   255
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   256
	MSmlDmDDFObject& nAddrTypeForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfAddrType );	// AddrType
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   257
    FillNodeInfoL( nAddrTypeForAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   258
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   259
                    KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   260
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   261
	MSmlDmDDFObject& nPortForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfPort );	// PortNbr
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   262
    FillNodeInfoL( nPortForAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   263
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   264
                    KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   265
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   266
    //Runtime port address
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   267
    MSmlDmDDFObject& nrtToPortDDF = nPortForAppAddrDDF.AddChildObjectGroupL();	// PortNbr
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   268
    FillNodeInfoL( nrtToPortDDF, aclTypesG, MSmlDmDDFObject::EOneOrMore, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   269
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   270
                    KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   271
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   272
    MSmlDmDDFObject& nPortNbrToPortDDF = nrtToPortDDF.AddChildObjectL( KNSmlDdfPortNbr );	// PortNbr
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   273
    FillNodeInfoL( nPortNbrToPortDDF, aclTypesARG, MSmlDmDDFObject::EZeroOrOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   274
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   275
                    KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   276
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   277
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   278
    MSmlDmDDFObject& nAuthSchemeDDF = nProDDF.AddChildObjectL( KNSmlDdfAuthScheme );	// AuthPref
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   279
    FillNodeInfoL( nAuthSchemeDDF, aclTypesARG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   280
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   281
                    KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType );                     
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   282
   //APPAUthNodes 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   283
   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   284
   MSmlDmDDFObject& nAppAuthDDF = nProDDF.AddChildObjectL( KNSmlDdfAppAuth );	// AppAuth
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   285
    FillNodeInfoL( nAppAuthDDF, aclTypesG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   286
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   287
                    KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   288
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   289
   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   290
   MSmlDmDDFObject& nrtToAppAuthDDF = nAppAuthDDF.AddChildObjectGroupL();	// appauth/<x>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   291
    FillNodeInfoL( nrtToAppAuthDDF, aclTypesG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   292
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   293
                    KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   294
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   295
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   296
   MSmlDmDDFObject& nAauthLevelDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthLevel );	// AAuthLevel
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   297
    FillNodeInfoL( nAauthLevelDDF, aclTypesARG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   298
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   299
                    KNSmlDdfAuthLevelDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   300
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   301
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   302
   MSmlDmDDFObject& nAauthtypeDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthType );	// AAuthType
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   303
    FillNodeInfoL( nAauthtypeDDF, aclTypesG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   304
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   305
                    KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   306
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   307
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   308
   MSmlDmDDFObject& nAauthNameDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthName );	// AddrType
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   309
    FillNodeInfoL( nAauthNameDDF, aclTypesARG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   310
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   311
                    KNSmlDdfAuthNameDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   312
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   313
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   314
   MSmlDmDDFObject& nAauthSecretDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthSecret );	// AddrType
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   315
    FillNodeInfoL( nAauthSecretDDF, aclTypesAR, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   316
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   317
                    KNSmlDdfAuthSecretDescription, KNullDesC8, KMimeType );                     
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   318
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   319
    MSmlDmDDFObject& nAauthDataDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthData );	// AddrType
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   320
    FillNodeInfoL( nAauthDataDDF, aclTypesAR, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   321
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   322
                    KNSmlDdfAuthDataDescription, KNullDesC8, KMimeType ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   323
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   324
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   325
	MSmlDmDDFObject& nNameDDF = nProDDF.AddChildObjectL( KNSmlDdfName );	// Name
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   326
    FillNodeInfoL( nNameDDF, aclTypesARG, MSmlDmDDFObject::EZeroOrOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   327
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   328
                    KNSmlDdfNameDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   329
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   330
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   331
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   332
	MSmlDmDDFObject& nServerIdDDF = nProDDF.AddChildObjectL( KNSmlDdfServerId );	// ServerId
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   333
    FillNodeInfoL( nServerIdDDF, aclTypesAG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   334
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   335
                    KNSmlDdfServerIdDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   336
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   337
   	MSmlDmDDFObject& nextDDF = nProDDF.AddChildObjectL( KNSmlDdfExt );	// Ext
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   338
    FillNodeInfoL( nextDDF, aclTypesG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   339
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   340
                    KNSmlDdfServerIdDescription, KNullDesC8, KMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   341
                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   342
   MSmlDmDDFObject& nlockedDDF = nextDDF.AddChildObjectL( KNSmlDdfLocked );	// locked
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   343
    FillNodeInfoL( nlockedDDF, aclTypesARG, MSmlDmDDFObject::EOne, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   344
                    MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   345
                    KNSmlDdfServerIdDescription, KNullDesC8, KMimeType );                 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   346
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   347
	CleanupStack::PopAndDestroy(); //aclTypes
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   348
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   349
	_DBG_FILE("CNSmlDMSettingsAdapter12::DDFStructureL(): end");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   350
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   351
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   352
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   353
//  CNSmlDMSettingsAdapter12::UpdateLeafObjectL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   354
//  Updates profile leaf object data based on URI.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   355
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   356
void CNSmlDMSettingsAdapter12::UpdateLeafObjectL( const TDesC8& aURI,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   357
                                                const TDesC8& aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   358
                                                const TDesC8& aObject, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   359
                                                const TDesC8& /*aType*/, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   360
                                                const TInt aStatusRef )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   361
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   362
	_DBG_FILE("CNSmlDMSettingsAdapter12::UpdateLeafObjectL(): begin");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   363
	TInt index = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   364
	if ( !iBufOn)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   365
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   366
		for (TInt val = 0; val<iBuffer->Count (); val++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   367
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   368
			TPtrC8 firstUri = ParentURI (aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   369
			if ( iBuffer->At(val).iMappingName->Compare (firstUri)== 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   370
				{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   371
				index = iExecutionIndex = val;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   372
				break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   373
				}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   374
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   375
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   376
	if ( index >= 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   377
		AddLeafBufferL (aURI, aObject, aStatusRef);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   378
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   379
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   380
			TInt parentLUID = GetIntObject( aLUID ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   381
			if( parentLUID < 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   382
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   383
				if( IsDMAccUriFormatMatchPredefined(aURI) )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   384
    		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   385
    			parentLUID = ConstructTreeL(aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   386
    		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   387
    		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   388
		if( parentLUID < 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   389
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   390
		_DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL( ): ENotFound end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   391
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   392
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   393
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   394
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   395
	if( parentLUID != iParentLUID )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   396
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   397
		if( FindProfileIdL( parentLUID ) != EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   398
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   399
			iParentLUID = parentLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   400
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   401
		else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   402
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   403
			iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   404
			return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   405
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   406
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   407
	SetField( aURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   408
	SetURIInProcessL( aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   409
	if( !AcceptDMField() )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   410
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   411
		_DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): KErr field end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   412
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   413
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   414
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   415
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   416
    //	Get Database field type 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   417
	TNSmlDMFieldType fType = GetDMFieldType();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   418
	if ( fType == EWrong )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   419
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   420
		_DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   421
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   422
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   423
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   424
 	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   425
    TNSmlDMProfileData fData = GetDMField();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   426
    if( fData == ESyncAccepted )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   427
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   428
        _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   429
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   430
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   431
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   432
    if( NotValidStrLenght( fData, aObject ) )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   433
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   434
		_DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): KErr length end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   435
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   436
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   437
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   438
    //Authentication data leafs to be handled
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   439
    if ( fData == EAuthenticationRequired || fData == EClientNonce 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   440
        || fData == EServerNonce )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   441
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   442
        //Check if replace command and replace data as defined
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   443
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   444
        TInt replaceStatus = KErrGeneral; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   445
        SetAuthInfoL( iParentLUID + KMaxDataSyncID, fData, aObject, replaceStatus );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   446
        if ( replaceStatus == KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   447
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   448
            iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   449
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   450
        else if ( replaceStatus == KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   451
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   452
            iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   453
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   454
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   455
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   456
            iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   457
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   458
       
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   459
        _DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL():end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   460
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   461
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   462
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   463
    TInt rValue = SetDMFieldDataL( iParentLUID, aObject, fData );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   464
    if ( fData == EProfilePort )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   465
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   466
        // in case port is updated, save status ref to be used in 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   467
        // CompleteOutstandingCmdsL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   468
        if(rValue==KErrNone)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   469
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   470
            iPortBuffer[iPortBuffer.Count()-1].iPortBufStatusRef = aStatusRef; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   471
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   472
        else if( rValue == KErrOverflow)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   473
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   474
        	iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   475
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   476
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   477
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   478
        	iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   479
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   480
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   481
    else if ( fData == EProfileLock && iNewProfile )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   482
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   483
        if(rValue == KErrNone)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   484
         iProfileLockBuffer[iProfileLockBuffer.Count()-1].iProfileLockStatusRef = aStatusRef; 	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   485
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   486
         iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   487
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   488
    else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   489
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   490
        if( rValue != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   491
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   492
            if( rValue == KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   493
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   494
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   495
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   496
            else if( rValue == KErrInUse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   497
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   498
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   499
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   500
            else if( rValue == KErrNoMemory )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   501
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   502
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   503
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   504
            else if(rValue == KErrAccessDenied) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   505
               {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   506
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   507
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   508
               }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   509
            else if (  rValue == KErrArgument)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   510
             {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   511
             	iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   512
             	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   513
             } 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   514
            else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   515
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   516
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   517
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   518
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   519
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   520
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   521
            iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   522
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   523
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   524
      }        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   525
	_DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL():end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   526
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   527
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   528
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   529
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   530
//  CNSmlDMSettingsAdapter12::DeleteObjectL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   531
//  Deletes whole profile or leaf object data acording to aURI.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   532
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   533
void CNSmlDMSettingsAdapter12::DeleteObjectL( const TDesC8& aURI, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   534
                                            const TDesC8& aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   535
                                            const TInt aStatusRef )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   536
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   537
	_DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   538
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   539
	if( aURI.Find( KNSmlDdfConRef ) != KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   540
		{	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   541
		_DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL(): NOT ALLOWED end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   542
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   543
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   544
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   545
	iLUID = IntLUID( aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   546
	if(IsProfileLockedL(iLUID))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   547
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   548
	  _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL(): NOT ALLOWED end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   549
	  
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   550
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   551
		return;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   552
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   553
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   554
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   555
    //	Check which field going to be handled
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   556
	SetField( aURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   557
	SetURIInProcessL(aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   558
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   559
    //	Check if valid field
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   560
	if( !AcceptDMField() )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   561
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   562
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   563
        // Delete whole profile if aURI called for node
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   564
		TInt last = aURI.LocateReverse( '/' );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   565
		TInt pos  = aURI.Find( KNSmlDefDMAcc );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   566
		if( last - 5 == pos )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   567
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   568
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   569
            //	If called for node means that profile will deleted from database
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   570
			iLUID = IntLUID( aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   571
			DBG_ARGS8( _S8("DeleteObjectL: URI %S LUID = %d"), &aURI, iLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   572
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   573
			if( FindProfileIdL( iLUID ) == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   574
				{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   575
				_DBG_FILE(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   576
                    "CNSmlDMSettingsAdapter12::DeleteObjectL( ): notfound end");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   577
				
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   578
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   579
				return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   580
				}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   581
			else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   582
				{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   583
				TInt sRet = DeleteProfileL( iLUID + KMaxDataSyncID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   584
				if ( sRet != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   585
					{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   586
                    if( sRet == KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   587
                        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   588
                        iCallBack->SetStatusL( aStatusRef,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   589
                                                CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   590
                        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   591
                    else if( sRet == KErrInUse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   592
                        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   593
                        iCallBack->SetStatusL( aStatusRef,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   594
                                                CSmlDmAdapter::EObjectInUse );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   595
                        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   596
                    else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   597
                        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   598
                        iCallBack->SetStatusL( aStatusRef, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   599
                                                CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   600
					    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   601
					return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   602
					}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   603
				else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   604
					{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   605
					_DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): EOk end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   606
					iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   607
					return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   608
					}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   609
				}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   610
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   611
		else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   612
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   613
			_DBG_FILE(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   614
                "CNSmlDMSettingsAdapter12::DeleteObjectL( ): EInvalidObject end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   615
			iCallBack->SetStatusL( aStatusRef,CSmlDmAdapter::EInvalidObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   616
			return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   617
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   618
		}//Delete whole Profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   619
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   620
	iLUID = IntLUID( aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   621
	if ( iLUID != iParentLUID )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   622
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   623
		if( FindProfileIdL( iLUID ) == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   624
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   625
			_DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   626
			iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   627
			return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   628
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   629
		iParentLUID = iLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   630
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   631
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   632
	if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   633
    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   634
		DeleteDMAuthInfoL( iLUID, EAuthenticationRequired );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   635
        iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   636
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   637
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   638
    else if( iField->Compare( KNSmlDdfClientNonce ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   639
    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   640
		DeleteDMAuthInfoL( iLUID, EClientNonce );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   641
        iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   642
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   643
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   644
    else if( iField->Compare(KNSmlDdfServerNonce) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   645
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   646
		DeleteDMAuthInfoL( iLUID, EServerNonce );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   647
        iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   648
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   649
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   650
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   651
    // Sets default value if not null field
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   652
	HBufC8* dataObject = HBufC8::NewLC( 15 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   653
	dataObject->Des().Format( KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   654
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   655
	_LIT8(aType,		"text/plain");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   656
	iLeafType = EDMDelete;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   657
	UpdateLeafObjectL( aURI, aLUID, *dataObject, aType, aStatusRef );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   658
    CleanupStack::PopAndDestroy(); //dataObject
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   659
	iLeafType = EDMUnset;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   660
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   661
	_DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   662
	return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   663
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   664
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   665
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   666
//  CNSmlDMSettingsAdapter12::FetchLeafObjectL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   667
//  Fetches profile leaf object data acordint to aURI.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   668
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   669
void CNSmlDMSettingsAdapter12::FetchLeafObjectL( const TDesC8& aURI, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   670
                                                const TDesC8& aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   671
                                                const TDesC8& aType, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   672
                                                const TInt aResultsRef, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   673
                                                const TInt aStatusRef )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   674
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   675
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   676
	_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   677
	DBG_ARGS(_S16( "DM:Fetch aURI    - %S - %S"), &aURI, &aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   678
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   679
	iLUID = IntLUID( aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   680
	if ( iLUID >= 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   681
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   682
		if( FindProfileIdL( iLUID ) == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   683
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   684
			_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   685
			iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   686
			return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   687
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   688
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   689
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   690
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   691
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   692
		// Static node feature start
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   693
		iLUID = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   694
		if( IsDMAccUriFormatMatchPredefined(aURI) )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   695
    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   696
    		iLUID = ConstructTreeL(aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   697
    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   698
    	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   699
    	if (iLUID == -1) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   700
    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   701
    			_DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   702
				iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   703
				return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   704
    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   705
		// Static node feature end
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   706
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   707
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   708
    //	Check which field going to be handled
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   709
	SetField(aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   710
	SetURIInProcessL(aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   711
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   712
    //	Check if valid field
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   713
	if( !AcceptDMField() )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   714
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   715
		_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EInvalidObject end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   716
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   717
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   718
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   719
    /*if(iField->Compare(KNSmlDdfExt) == 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   720
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   721
        iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   722
        CBufBase* extNode = CBufFlat::NewL(128);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   723
        CleanupStack::PushL(extNode);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   724
        iCallBack->SetResultsL( aResultsRef, *extNode, KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   725
        CleanupStack::PopAndDestroy(extNode);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   726
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   727
        }*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   728
         
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   729
    //	Get Database field type 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   730
	TInt fType = GetDMFieldType();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   731
	if ( fType == EWrong )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   732
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   733
		_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EError end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   734
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   735
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   736
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   737
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   738
    TNSmlDMProfileData fieldId = GetDMField();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   739
    if( fieldId == ESyncAccepted )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   740
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   741
        _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   742
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   743
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   744
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   745
    CBufBase *lObject = CBufFlat::NewL( 128 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   746
    CleanupStack::PushL( lObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   747
    lObject->Reset();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   748
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   749
    CSmlDmAdapter::TError status;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   750
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   751
    if ( fType == EStr || fType == EInt || fType == EBin )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   752
		{ 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   753
		//  Check for APPId and return w7 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   754
		TInt rValue = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   755
       /* if( iField->Compare(KNSmlDdfAppId ) ==0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   756
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   757
        	status = CSmlDmAdapter::EOk;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   758
        	lObject->InsertL(lObject->Size(),KNSmlDdfAppIdValue);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   759
        	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   760
        }*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   761
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   762
        rValue = GetObjectL( iLUID, fieldId, *lObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   763
		if( rValue != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   764
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   765
            if( rValue == KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   766
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   767
                status = CSmlDmAdapter::ENotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   768
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   769
            else if( rValue == KErrInUse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   770
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   771
                status = CSmlDmAdapter::EObjectInUse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   772
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   773
            else if( rValue == KErrNoMemory )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   774
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   775
                status = CSmlDmAdapter::ENoMemory;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   776
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   777
            else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   778
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   779
                status = CSmlDmAdapter::EError;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   780
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   781
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   782
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   783
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   784
            status = CSmlDmAdapter::EOk;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   785
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   786
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   787
	else 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   788
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   789
		CleanupStack::PopAndDestroy(); //lObject 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   790
        _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   791
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   792
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   793
        iSyncSession.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   794
        iSyncSessionOpen = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   795
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   796
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   797
    iCallBack->SetStatusL( aStatusRef, status );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   798
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   799
    if(status==CSmlDmAdapter::EOk)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   800
    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   801
		iCallBack->SetResultsL( aResultsRef, *lObject, aType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   802
    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   803
  	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   804
    CleanupStack::PopAndDestroy(); //lObject 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   805
	iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   806
    iSyncSession.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   807
    iSyncSessionOpen = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   808
	_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   809
	return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   810
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   811
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   812
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   813
//  CSmlDmSettingsAdapter::ChildURIListL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   814
//  Function returns the list of profiles or leafs of the profile 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   815
//  acording to aURI.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   816
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   817
void CNSmlDMSettingsAdapter12::ChildURIListL( const TDesC8& aURI, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   818
                                            const TDesC8& aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   819
                                            const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   820
                                            const TInt aResultsRef, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   821
                                            const TInt aStatusRef  )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   822
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   823
	_DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   824
	CBufBase *currentURISegmentList = CBufFlat::NewL( 128 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   825
	CleanupStack::PushL( currentURISegmentList );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   826
 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   827
	if(( aURI.Match( KDmAccMatch ) != KErrNotFound ) &&
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   828
	 (aURI.Match( KDmAccMatch3 ) == KErrNotFound ))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   829
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   830
		//	Check if Profile exists
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   831
        TInt checkLUID = GetIntObject( aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   832
        if( FindProfileIdL( checkLUID ) )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   833
        	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   834
            currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAcc );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   835
			iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   836
		    iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   837
        	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   838
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   839
        	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   840
        		// Static node feature start
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   841
				checkLUID = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   842
				if( IsDMAccUriFormatMatchPredefined(aURI) )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   843
		    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   844
		    		checkLUID = ConstructTreeL(aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   845
		    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   846
		    	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   847
		    	if (checkLUID == -1) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   848
		    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   849
		    			_DBG_FILE( "CNSmlDMSettingsAdapter::childURI(): ENotFound end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   850
						iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   851
						 CleanupStack::PopAndDestroy(  ); // currentURISegmentList
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   852
        			_DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   853
						return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   854
		    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   855
		    	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   856
		    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   857
		    		currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAcc );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   858
				iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   859
			    iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   860
		    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   861
		    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   862
    	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   863
    	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   864
		//	iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   865
		// Static node feature start end
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   866
        	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   867
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   868
        CleanupStack::PopAndDestroy(  ); // currentURISegmentList
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   869
        _DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   870
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   871
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   872
    else if(( aURI.Match( KDmAccMatch2 ) != KErrNotFound ) &&
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   873
              (aURI.Match( KDmAccMatch ) == KErrNotFound ))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   874
        {   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   875
        if( iSyncSessionOpen == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   876
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   877
            iSyncSession.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   878
            iSyncSessionOpen = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   879
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   880
        RArray<TSmlProfileId> profileIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   881
        CleanupClosePushL( profileIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   882
        TSmlUsageType usageType = ESmlDevMan;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   883
        iSyncSession.ListProfilesL( profileIdArray, usageType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   884
	    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   885
        for( TInt p = 0; p < profileIdArray.Count(); p++ )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   886
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   887
		    TBool notInList = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   888
		    TInt newline = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   889
            TInt ddId = profileIdArray[p] - KMaxDataSyncID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   890
            
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   891
		    while( notInList && newline < aPreviousURISegmentList.Count() )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   892
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   893
				TInt ppId = GetIntObject( aPreviousURISegmentList.At(newline).iURISegLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   894
				if( ppId == ddId ) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   895
				    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   896
					notInList = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   897
					break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   898
					}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   899
				newline++;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   900
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   901
		    if( notInList )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   902
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   903
			    _LIT8( Kprev, "DMId" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   904
			    TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   905
                TInt fixedProfId = profileIdArray[p] - KMaxDataSyncID; //fit to 3 decimal
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   906
			    addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   907
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   908
    			currentURISegmentList->InsertL( currentURISegmentList->Size(), addNAME );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   909
	    		currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   910
		    	DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   911
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   912
			    // KNSmlDMStart includes start text for URISeg
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   913
			    TBuf8<20> addURI; // SyncML/DMAcc/DMIdnnn , nnn = profileid
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   914
			    addURI.Append( KNSmlDMStart );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   915
			    addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   916
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   917
    			TBuf8<3> addLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   918
	    		addLUID.Num( fixedProfId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   919
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   920
		    	// Also added to mapping
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   921
			    iCallBack->SetMappingL( addURI, addLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   922
    			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   923
	    	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   924
		    	{ // Add those in PreviousList which are on database
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   925
			    currentURISegmentList->InsertL( currentURISegmentList->Size(),
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   926
                                                aPreviousURISegmentList.At(newline).iURISeg );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   927
    			currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   928
//	    		DBG_ARGS8( _S8("InList: Id = %d Name %S"), newline, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   929
//                          aPreviousURISegmentList.At(newline).iURISeg );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   930
		    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   931
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   932
        CleanupStack::PopAndDestroy( 1 );//profileIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   933
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   934
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   935
    // AppAddr subtree
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   936
    else if( ( aURI.Match( KDmAccAppAddrMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortMatch ) == KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound ))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   937
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   938
          currentURISegmentList->InsertL( currentURISegmentList->Size(), KDmAccAppAddrId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   939
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   940
    else if(( aURI.Match( KDmAccAppAddrFullMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortMatch ) == KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound ))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   941
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   942
          currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAddr );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   943
        }   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   944
    else if(( aURI.Match( KDmAccPortMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound ))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   945
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   946
          currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccPortRT );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   947
        } 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   948
   else if( aURI.Match( KDmAccPortFullMatch ) != KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   949
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   950
          currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccport );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   951
        } 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   952
          
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   953
   else if(( aURI.Match( KDmAccAppAuthMatch ) != KErrNotFound ) && (aURI.Match( KDmAccAppAuthFullMatch ) == KErrNotFound ))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   954
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   955
          currentURISegmentList->InsertL( currentURISegmentList->Size(), KDmAccAppAuthNodes );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   956
        } 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   957
    else if((aURI.Match(KDmAccAppAuthSrvMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthCliMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthTransMatch) != KErrNotFound)) //|| (aURI.Match(KDmAccAppAuthObexMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthHttpMatch) != KErrNotFound))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   958
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   959
           currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAuth );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   960
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   961
    else if(( aURI.Match( KDmAccAppAuthFullMatch ) != KErrNotFound ) && (aURI.Find( KDmAccAppAuthNodes ) != KErrNotFound))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   962
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   963
          currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAuth );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   964
        } 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   965
                         
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   966
    else if( aURI.Match( KDmAccExtMatch ) != KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   967
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   968
          currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccLocked );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   969
        }                      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   970
    else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   971
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   972
        iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   973
        CleanupStack::PopAndDestroy( 1 ); // currentURISegmentList
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   974
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   975
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   976
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   977
	iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   978
	iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   979
	CleanupStack::PopAndDestroy(); // currentURISegmentList
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   980
	_DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   981
	return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   982
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   983
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   984
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   985
//  CNSmlDMSettingsAdapter12::AddNodeObjectL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   986
//  Adds new DM-settings profile to database
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   987
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   988
void CNSmlDMSettingsAdapter12::AddNodeObjectL( const TDesC8& aURI, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   989
                                            const TDesC8& aParentLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   990
                                            const TInt aStatusRef )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   991
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   992
	_DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   993
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   994
	if( aParentLUID.Length() > 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   995
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   996
		iParentLUID = GetIntObject( aParentLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   997
        if( FindProfileIdL( iParentLUID ) != EFalse )// iProfile != NULL)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   998
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   999
		    _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): EAlreadyExists end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1000
		    iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1001
		    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1002
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1003
		else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1004
			{						
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1005
			TInt ret = iCallBack->RemoveMappingL(KNSmlDMSettingsAdapterImplUid,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1006
							GetDynamicDMNodeUri( aURI ), ETrue );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1007
			if(ret != KErrNone)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1008
				{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1009
			    iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1010
		    	return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1011
				}			
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1012
			}		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1013
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1014
	iNewProfile = ETrue; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1015
	AddNodeBufferL (aURI, aStatusRef);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1016
	_DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1017
	return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1018
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1019
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1020
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1021
//  CNSmlDMSettingsAdapter12::UpdateLeafObjectL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1022
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1023
void CNSmlDMSettingsAdapter12::UpdateLeafObjectL( const TDesC8&, const TDesC8&, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1024
                                                RWriteStream*&, const TDesC8&, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1025
                                                const TInt )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1026
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1027
	//Not supported because data streaming is not supported by this adapter.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1028
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1029
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1030
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1031
//  CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1032
//  This function fetches leaf object and returns its size.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1033
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1034
void CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL( const TDesC8& aURI, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1035
                                                    const TDesC8& aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1036
                                                    const TDesC8& aType, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1037
                                                    const TInt aResultsRef, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1038
                                                    const TInt aStatusRef )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1039
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1040
	_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL() : begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1041
    DBG_ARGS( _S16("DM:Fetch aURI    - %S - %S"), &aURI, &aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1042
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1043
	iLUID = IntLUID( aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1044
	if ( iLUID >= 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1045
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1046
		if( FindProfileIdL( iLUID ) == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1047
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1048
			_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1049
			iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1050
			return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1051
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1052
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1053
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1054
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1055
		_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1056
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1057
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1058
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1059
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1060
    //	Check which field going to be handled
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1061
	SetField( aURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1062
	SetURIInProcessL (aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1063
     
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1064
    //	Check if valid field
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1065
	if( !AcceptDMField() )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1066
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1067
		_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EInvalidObject end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1068
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1069
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1070
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1071
    /*if(aURI.Find( KNSmlDdfExt ) != KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1072
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1073
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1074
        }*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1075
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1076
    //	Get Database field type 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1077
	TInt fType = GetDMFieldType();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1078
	if ( fType == EWrong )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1079
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1080
		_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EError end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1081
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1082
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1083
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1084
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1085
    CBufBase *lObject = CBufFlat::NewL( 128 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1086
	CleanupStack::PushL( lObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1087
    lObject->Reset();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1088
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1089
	if ( fType == EStr || fType == EInt || fType == EBin )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1090
		{ 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1091
        TInt rValue = GetObjectL( iLUID, GetDMField(), *lObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1092
		if( lObject->Size() == 0 || rValue != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1093
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1094
            if( rValue == KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1095
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1096
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1097
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1098
            else if( rValue == KErrInUse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1099
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1100
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1101
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1102
            else if( rValue == KErrNoMemory )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1103
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1104
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1105
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1106
            else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1107
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1108
                iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1109
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1110
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1111
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1112
	else 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1113
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1114
		CleanupStack::PopAndDestroy();//lObject 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1115
		_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1116
		iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1117
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1118
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1119
    TInt objSizeInBytes = lObject->Size();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1120
	TBuf8<16> stringObjSizeInBytes;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1121
	stringObjSizeInBytes.Num( objSizeInBytes );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1122
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1123
	lObject->Reset();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1124
	lObject->InsertL( 0, stringObjSizeInBytes );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1125
    iCallBack->SetResultsL( aResultsRef, *lObject, aType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1126
	iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1127
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1128
	CleanupStack::PopAndDestroy( 1 ); //lObject
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1129
	_DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1130
	return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1131
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1132
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1133
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1134
// CNSmlDMSettingsAdapter12::ExecuteCommandL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1135
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1136
void CNSmlDMSettingsAdapter12::ExecuteCommandL( const TDesC8&, const TDesC8&,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1137
                                                const TDesC8&, const TDesC8&, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1138
                                                const TInt )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1139
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1140
	//Not supported. Command execution via DM settings adapter not possible.	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1141
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1142
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1143
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1144
// CNSmlDMSettingsAdapter12::ExecuteCommandL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1145
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1146
void CNSmlDMSettingsAdapter12::ExecuteCommandL( const TDesC8&, const TDesC8&, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1147
                                                RWriteStream*&, const TDesC8&, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1148
                                                const TInt )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1149
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1150
	//Not supported. Command execution via DM settings adapter not possible.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1151
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1152
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1153
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1154
// CNSmlDMSettingsAdapter12::CopyCommandL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1155
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1156
void CNSmlDMSettingsAdapter12::CopyCommandL( const TDesC8&, const TDesC8&, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1157
                                            const TDesC8&, const TDesC8&, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1158
                                            const TDesC8&, TInt )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1159
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1160
	//Not supported.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1161
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1162
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1163
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1164
// CNSmlDMSettingsAdapter12::StartAtomicL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1165
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1166
void CNSmlDMSettingsAdapter12::StartAtomicL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1167
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1168
	//Not supported. Handling Atomic command cycles not supported by the adapter.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1169
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1170
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1171
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1172
// CNSmlDMSettingsAdapter12::CommitAtomicL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1173
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1174
void CNSmlDMSettingsAdapter12::CommitAtomicL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1175
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1176
	//Not supported. Handling Atomic command cycles not supported by the adapter.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1177
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1178
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1179
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1180
// CNSmlDMSettingsAdapter12::RollbackAtomicL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1181
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1182
void CNSmlDMSettingsAdapter12::RollbackAtomicL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1183
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1184
	//Not supported. Handling Atomic command cycles not supported by the adapter.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1185
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1186
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1187
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1188
//  CNSmlDMSettingsAdapter12::StreamingSupport()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1189
//  Indicates if streaming is supported.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1190
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1191
TBool CNSmlDMSettingsAdapter12::StreamingSupport( TInt& /*aItemSize*/ )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1192
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1193
	return EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1194
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1195
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1196
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1197
// CNSmlDMSettingsAdapter12::StreamCommittedL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1198
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1199
void CNSmlDMSettingsAdapter12::StreamCommittedL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1200
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1201
	//Not supported. Streaming not supported by the DM settings adapter.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1202
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1203
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1204
// CNSmlDMSettingsAdapter12::CompleteOutstandingCmdsL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1205
// If buffering used, commands must be executed before returning this function.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1206
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1207
void CNSmlDMSettingsAdapter12::CompleteOutstandingCmdsL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1208
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1209
	// Check if Buffered
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1210
	for (int val=0; val<iBuffer->Count ();val++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1211
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1212
		if ( !iBuffer->At(val).iExecuted)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1213
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1214
			TInt count = iBuffer->At(val).iLeafBuf->Count ()-1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1215
			iExecutionIndex = val;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1216
			iComplete = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1217
			ExecuteBufferL ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1218
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1219
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1220
 for (TInt i = 0;i<iProfileLockBuffer.Count(); i++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1221
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1222
	       TInt err = SetProfileLockL(iProfileLockBuffer[i].iProfileLockLUID, iProfileLockBuffer[i].iProfileLock) ;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1223
   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1224
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1225
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1226
	// if port was updated, set it
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1227
	for (TInt i = 0;i<iPortBuffer.Count(); i++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1228
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1229
        TInt err = SetProfileConnectionPortNrL( iPortBuffer[i].iPortBufLUID, iPortBuffer[i].iPortBuf );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1230
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1231
        // set status
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1232
        if ( err != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1233
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1234
            iCallBack->SetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EError );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1235
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1236
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1237
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1238
            iCallBack->SetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EOk );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1239
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1240
	    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1241
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1242
    iPortBuffer.Reset();	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1243
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1244
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1245
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1246
//  CNSmlDMSettingsAdapter12::AcceptDMField
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1247
//  This function checks if field to be handled is valid.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1248
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1249
TBool CNSmlDMSettingsAdapter12::AcceptDMField()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1250
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1251
	_DBG_FILE("CNSmlDMSettingsAdapter12::AcceptDMField(): begin");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1252
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1253
	if ( iField->Compare( KNSmlDdfAddrType ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1254
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1255
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1256
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1257
	else if ( iField->Compare( KNSmlDdfAddr ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1258
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1259
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1260
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1261
	else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1262
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1263
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1264
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1265
	else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1266
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1267
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1268
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1269
	else if ( iField->Compare( KNSmlDdfServerId ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1270
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1271
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1272
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1273
	else if ( iField->Compare( KNSmlDdfServerPW ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1274
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1275
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1276
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1277
	else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1278
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1279
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1280
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1281
	else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1282
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1283
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1284
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1285
	else if ( iField->Compare( KNSmlDdfClientPW ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1286
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1287
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1288
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1289
	else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1290
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1291
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1292
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1293
	else if ( iField->Compare( KNSmlDdfName ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1294
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1295
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1296
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1297
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1298
	else if ( iField->Compare( KNSmlDdfId ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1299
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1300
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1301
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1302
	else if ( iField->Compare(KNSmlDdfAppId) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1303
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1304
	    return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1305
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1306
	else if ( iField->Compare(KNSmlDdfPrefConRef) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1307
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1308
	    return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1309
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1310
	else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1311
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1312
	    return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1313
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1314
  	    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1315
    else if (iField->Compare(KNSmlDdfAAuthType) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1316
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1317
        return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1318
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1319
    else if (iField->Compare(KNSmlDdfAAuthName) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1320
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1321
        return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1322
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1323
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1324
    else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1325
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1326
        return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1327
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1328
    else if (iField->Compare(KNSmlDdfAAuthData) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1329
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1330
        return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1331
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1332
    else if (iField->Compare(KNSmlDdfLocked) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1333
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1334
        return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1335
        }    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1336
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1337
	_DBG_FILE( "CNSmlDMSettingsAdapter12::AcceptDMField(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1338
	return EFalse; // Not a valid Type
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1339
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1340
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1341
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1342
//  CNSmlDMSettingsAdapter12::GetDMField
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1343
//	Matches URI fieldname to DM-database. 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1344
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1345
TNSmlDMProfileData CNSmlDMSettingsAdapter12::GetDMField() 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1346
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1347
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1348
	if ( iField->Compare( KNSmlDdfAddrType ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1349
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1350
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1351
	     return EProfileAddrType;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1352
	      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1353
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1354
	else if ( iField->Compare( KNSmlDdfAddr ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1355
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1356
		return EProfileURL;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1357
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1358
	else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1359
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1360
		return EProfilePort;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1361
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1362
	else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1363
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1364
		return EAuthenticationRequired;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1365
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1366
	else if ( iField->Compare( KNSmlDdfServerId ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1367
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1368
		return EServerId;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1369
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1370
	else if ( iField->Compare( KNSmlDdfServerPW ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1371
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1372
		return ESharedSecret;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1373
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1374
	else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1375
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1376
		return EServerNonce;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1377
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1378
	else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1379
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1380
		return EProfileDMServerUsername;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1381
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1382
	else if ( iField->Compare( KNSmlDdfClientPW ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1383
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1384
		return EProfileDMServerPassword;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1385
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1386
	else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1387
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1388
		return EClientNonce;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1389
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1390
	else if ( iField->Compare( KNSmlDdfName ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1391
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1392
		return EProfileName;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1393
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1394
	else if ( iField->Compare( KNSmlDdfId ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1395
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1396
		return EProfileId;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1397
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1398
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1399
	else if ( iField->Compare( KNSmlDdfPrefConRef ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1400
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1401
		return EProfileIAPId;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1402
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1403
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1404
    else if ( iField->Compare( KNSmlDdfAppId ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1405
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1406
		return EProfileIAPId;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1407
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1408
    else if ( iField->Compare( KNSmlDdfLocked) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1409
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1410
		return EProfileLock;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1411
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1412
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1413
    else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1414
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1415
	     if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1416
	    return EPRofileServerCred;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1417
	     else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1418
	    return EPRofileClientCred;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1419
		else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1420
	    return EProfileTransport;		     
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1421
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1422
  	    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1423
    else if (iField->Compare(KNSmlDdfAAuthType) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1424
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1425
        return EProfileAAuthType;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1426
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1427
    else if (iField->Compare(KNSmlDdfAAuthName) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1428
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1429
        if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1430
	    return EProfileName;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1431
	    else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1432
	    return EProfileDMServerUsername;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1433
	    else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1434
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1435
	       return ETransportAuthName;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1436
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1437
	    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1438
        // return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1439
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1440
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1441
    else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1442
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1443
         if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1444
	    return ESharedSecret;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1445
	        else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1446
	    return EProfileDMServerPassword;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1447
		else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1448
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1449
	       return EProfileTransportPassword;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1450
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1451
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1452
    else if (iField->Compare(KNSmlDdfAAuthData) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1453
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1454
          if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1455
	    return EServerNonce;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1456
	     else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1457
	    return EClientNonce;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1458
	    else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1459
	     return EProfileTransportAuthData;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1460
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1461
        		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1462
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1463
	_DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMField(): Error" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1464
	return ESyncAccepted;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1465
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1466
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1467
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1468
//  CNSmlDMSettingsAdapter12::GetDMFieldType
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1469
//	Gets field data type. 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1470
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1471
TNSmlDMFieldType CNSmlDMSettingsAdapter12::GetDMFieldType() const
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1472
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1473
	if ( iField->Compare( KNSmlDdfAddrType ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1474
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1475
		return EInt;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1476
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1477
	else if ( iField->Compare( KNSmlDdfAddr ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1478
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1479
		return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1480
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1481
	else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1482
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1483
		return EInt;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1484
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1485
	else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1486
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1487
		return EInt;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1488
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1489
	else if ( iField->Compare( KNSmlDdfServerId ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1490
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1491
		return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1492
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1493
	else if ( iField->Compare( KNSmlDdfServerPW ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1494
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1495
		return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1496
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1497
	else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1498
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1499
		return EBin;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1500
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1501
	else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1502
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1503
		return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1504
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1505
	else if ( iField->Compare( KNSmlDdfClientPW ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1506
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1507
		return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1508
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1509
	else if (iField->Compare(KNSmlDdfClientNonce) == 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1510
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1511
		return EBin;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1512
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1513
	else if ( iField->Compare( KNSmlDdfName ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1514
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1515
		return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1516
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1517
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1518
	else if ( iField->Compare( KNSmlDdfId ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1519
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1520
		return EInt;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1521
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1522
    else if( iField->Compare(KNSmlDdfAppId ) ==0 ) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1523
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1524
        	return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1525
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1526
	else if ( iField->Compare( KNSmlDdfPrefConRef ) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1527
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1528
		return EInt;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1529
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1530
	else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1531
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1532
	    return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1533
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1534
  	    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1535
    else if (iField->Compare(KNSmlDdfAAuthType) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1536
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1537
        return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1538
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1539
    else if (iField->Compare(KNSmlDdfAAuthName) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1540
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1541
        return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1542
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1543
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1544
    else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1545
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1546
        return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1547
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1548
    else if (iField->Compare(KNSmlDdfAAuthData) == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1549
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1550
        return EBin;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1551
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1552
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1553
	else if(iField->Compare(KNSmlDdfLocked)==0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1554
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1555
	    return EStr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1556
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1557
		        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1558
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1559
	_DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMFieldType(): Error" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1560
	return EWrong;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1561
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1562
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1563
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1564
//  CNSmlDMSettingsAdapter12::IntLUID
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1565
//	Returns integer value for a profile LUID.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1566
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1567
TInt CNSmlDMSettingsAdapter12::IntLUID( const TDesC8& aLUID )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1568
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1569
	TLex8 lLex( aLUID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1570
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1571
	if( lLex.Val( iLUID ) == KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1572
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1573
	    return iLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1574
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1575
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1576
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1577
        return -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1578
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1579
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1580
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1581
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1582
//  CNSmlDMSettingsAdapter12::GetIntObject
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1583
//	Returns integer value for a aObject.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1584
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1585
TInt CNSmlDMSettingsAdapter12::GetIntObject( const TDesC8& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1586
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1587
	TLex8 lLex( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1588
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1589
	TInt value = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1590
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1591
	if( lLex.Val( value ) != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1592
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1593
	    return KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1594
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1595
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1596
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1597
        return value;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1598
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1599
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1600
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1601
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1602
//	CNSmlDMSettingsAdapter12::GetIntObject16()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1603
//	Returns Integer Value for a 16 bit data object.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1604
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1605
TInt CNSmlDMSettingsAdapter12::GetIntObject16( const TDesC& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1606
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1607
	TLex16 lLex( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1608
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1609
	TInt value = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1610
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1611
	if( lLex.Val( value ) == KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1612
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1613
	    return value;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1614
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1615
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1616
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1617
        return value;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1618
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1619
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1620
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1621
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1622
//  CNSmlDMSettingsAdapter12::SetIntObjectLC
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1623
//	Converts integer to HBufC8 type buffer and returns reference to it.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1624
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1625
TDesC8& CNSmlDMSettingsAdapter12::SetIntObjectLC( const TInt& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1626
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1627
	HBufC8* buf = HBufC8::NewLC( 8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1628
	TPtr8 ptrBuf = buf->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1629
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1630
	ptrBuf.Num( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1631
    return *buf;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1632
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1633
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1634
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1635
//	CNSmlDMSettingsAdapter12::NotValidStrLenght
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1636
//	Checks if data length is valid.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1637
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1638
TBool CNSmlDMSettingsAdapter12::NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1639
                                                const TDesC8& aSource )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1640
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1641
	TInt lLen = aSource.Length();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1642
	TBool lBool = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1643
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1644
	switch ( aProfileItem )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1645
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1646
		case ( EProfileName ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1647
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1648
			if( lLen > KNSmlMaxProfileNameLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1649
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1650
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1651
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1652
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1653
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1654
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1655
		case ( EProfileDMServerUsername ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1656
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1657
			if( lLen > KNSmlMaxUsernameLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1658
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1659
			    lBool = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1660
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1661
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1662
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1663
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1664
		case ( EProfileHttpUsername ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1665
		case (ETransportAuthName):
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1666
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1667
				if( lLen > KNSmlDmMaxHttpAuthUsernameLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1668
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1669
			    lBool = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1670
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1671
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1672
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1673
		case ( EProfileHttpPassword ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1674
		case (EProfileTransportPassword):
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1675
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1676
				if( lLen > KNSmlDmMaxHttpAuthPasswordLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1677
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1678
			    lBool = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1679
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1680
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1681
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1682
		case ( EProfileDMServerPassword ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1683
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1684
			if( lLen > KNSmlMaxPasswordLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1685
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1686
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1687
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1688
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1689
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1690
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1691
		case ( ESharedSecret ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1692
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1693
			if( lLen > KNSmlDmSharedSecretMaxLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1694
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1695
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1696
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1697
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1698
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1699
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1700
		case ( EProfileURL ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1701
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1702
			if( lLen > KNSmlMaxURLLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1703
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1704
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1705
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1706
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1707
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1708
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1709
		case ( EServerId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1710
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1711
			if( lLen > KNSmlDmServerIdMaxLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1712
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1713
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1714
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1715
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1716
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1717
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1718
		case ( EProfileIAPId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1719
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1720
			if( lLen > KNSmlMaxURLLength )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1721
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1722
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1723
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1724
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1725
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1726
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1727
		case ( EAuthenticationRequired ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1728
		case ( EProfileAAuthType ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1729
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1730
			if( lLen > 20 ) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1731
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1732
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1733
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1734
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1735
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1736
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1737
		case ( EProfileId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1738
		case ( EProfilePort ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1739
		case ( EProfileMediumType ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1740
		case ( EProfileAddrType ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1741
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1742
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1743
			if( lLen > 8 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1744
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1745
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1746
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1747
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1748
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1749
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1750
        case ( EServerNonce ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1751
	    case ( EClientNonce ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1752
		case (EProfileTransportAuthData):
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1753
	        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1754
            lBool = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1755
	        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1756
        break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1757
		case ( EProfileTransport ):
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1758
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1759
			lBool = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1760
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1761
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1762
		case EProfileLock :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1763
		 {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1764
		 	if(lLen > 6 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1765
		 	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1766
			    lBool = ETrue;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1767
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1768
		 	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1769
		 }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1770
		  break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1771
		default:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1772
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1773
			lBool = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1774
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1775
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1776
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1777
	return lBool;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1778
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1779
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1780
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1781
//	CNSmlDMSettingsAdapter12::SetField
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1782
//	Last element of the URI (after last '/') is returned.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1783
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1784
TInt CNSmlDMSettingsAdapter12::SetField( const TDesC8& aSource )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1785
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1786
	if ( aSource.LocateReverse( KNSmlDMUriSeparator ) == KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1787
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1788
	    iField->Des().Format( aSource );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1789
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1790
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1791
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1792
        iField->Des().Format( aSource.Mid( aSource.LocateReverse( KNSmlDMUriSeparator ) + 1 ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1793
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1794
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1795
    return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1796
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1797
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1798
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1799
//	CNSmlDMSettingsAdapter12::SetField
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1800
//	Last element of the URI (after last '/') is returned.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1801
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1802
TInt CNSmlDMSettingsAdapter12::SetURIInProcessL( const TDesC8& aSource )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1803
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1804
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1805
    if( iURIField )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1806
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1807
    	delete iURIField;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1808
    	iURIField = NULL;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1809
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1810
    iURIField = HBufC8::NewL( aSource.Length() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1811
    TPtr8 newPortNbr = iURIField->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1812
    newPortNbr.Append( aSource );          
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1813
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1814
    return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1815
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1816
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1817
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1818
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1819
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1820
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1821
//  CNSmlDMSettingsAdapter12::ConvertTo8LC
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1822
//	Converts string value to 8-bit and returns reference.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1823
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1824
TDesC8& CNSmlDMSettingsAdapter12::ConvertTo8LC( const TDesC& aSource )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1825
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1826
	HBufC8* buf = HBufC8::NewLC( aSource.Length() * 2 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1827
	TPtr8 bufPtr = buf->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1828
	CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1829
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1830
    return *buf;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1831
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1832
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1833
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1834
//	CNSmlDMSettingsAdapter12::ConvertTo16LC
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1835
//	Converts string value to 16-bit and returns reference.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1836
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1837
TDesC16& CNSmlDMSettingsAdapter12::ConvertTo16LC( const TDesC8& aSource)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1838
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1839
	HBufC16* buf16 = HBufC16::NewLC( aSource.Length() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1840
	TPtr16 bufPtr16 = buf16->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1841
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1842
	CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aSource );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1843
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1844
    return *buf16; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1845
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1846
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1847
// -------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1848
//  CNSmlDMSettingsAdapter12::GetConRefL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1849
//	Gets the URI for given aObject (IAP ID).
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1850
// -------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1851
TInt CNSmlDMSettingsAdapter12::GetConRefL( CBufBase& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1852
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1853
	_DBG_FILE( "CNSmlDMSettingsAdapter12::GetConRefL() : begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1854
	TInt profIAPid = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1855
    TInt apIdResponse = GetProfileIAPIdL( profIAPid );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1856
    if( profIAPid < 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1857
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1858
    	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1859
    }    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1860
    if( apIdResponse != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1861
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1862
    	return KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1863
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1864
    CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1865
    CleanupStack::PushL( apmatch );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1866
    HBufC8* uri8 = apmatch->URIFromIAPIdL( profIAPid );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1867
    if( uri8 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1868
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1869
        CleanupStack::PushL( uri8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1870
        aObject.InsertL( aObject.Size(), uri8->Des() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1871
        CleanupStack::PopAndDestroy(); // uri8
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1872
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1873
    else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1874
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1875
        CleanupStack::PopAndDestroy(); // apMatch
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1876
        return KErrGeneral;    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1877
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1878
    CleanupStack::PopAndDestroy(); // iapMatch
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1879
	_DBG_FILE( "CNSmlDSSettingsAdapter::GetToNAPIDL() : end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1880
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1881
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1882
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1883
// -------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1884
//  CNSmlDMSettingsAdapter12::SetConRefL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1885
//	Set the profile IAP Id value according to given URI.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1886
// -------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1887
TInt CNSmlDMSettingsAdapter12::SetConRefL( const TInt aLUID, const TDesC8& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1888
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1889
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetConRefL() : begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1890
    CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1891
    CleanupStack::PushL( apmatch );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1892
    TInt lIAPid = apmatch->IAPIdFromURIL( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1893
    CleanupStack::PopAndDestroy(); // iapmatch
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1894
    if(aObject.Length() >0 && lIAPid == KErrNotFound) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1895
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1896
    	return KErrGeneral;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1897
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1898
    TInt apIdResponse = SetProfileConnectionPropertyL( aLUID, lIAPid );    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1899
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetConRefL() : end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1900
	return apIdResponse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1901
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1902
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1903
// ------------------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1904
//  CNSmlDMSettingsAdapter12::ParseUri
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1905
//  Resolves portnbr (separated with ':') as integer from Uri. 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1906
// ------------------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1907
TInt CNSmlDMSettingsAdapter12::ParseUri( const TDesC8& aRealURI, TInt& aPort )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1908
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1909
	TInt offset=0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1910
    //http:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1911
	if( aRealURI.Find( KNSmlDMSettingsHTTP )==0 )//http:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1912
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1913
		offset = KNSmlDMSettingsHTTP().Length();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1914
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1915
	else if( aRealURI.Find( KNSmlDMSettingsHTTPS )==0 )//https:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1916
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1917
		offset = KNSmlDMSettingsHTTPS().Length();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1918
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1919
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1920
	TBool portFound=EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1921
    ////123.234.345.456:80/syncml
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1922
	for( TInt i = offset; i < aRealURI.Length(); i++ )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1923
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1924
		if( aRealURI[i] == KNSmlDMColon )// ':'
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1925
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1926
			portFound = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1927
			offset=i;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1928
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1929
		if( portFound && aRealURI[i] == KNSmlDMUriSeparator ) // '/'
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1930
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1931
			aPort = GetIntObject( aRealURI.Mid( (offset + 1), (i - offset-1) ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1932
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1933
		else if ( portFound && i == aRealURI.Length() - 1 ) // last char
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1934
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1935
		    // port is from offset to the end
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1936
		    aPort = GetIntObject( aRealURI.Right( aRealURI.Length() - offset - 1 ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1937
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1938
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1939
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1940
	if( aPort != 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1941
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1942
		return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1943
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1944
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1945
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1946
		return KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1947
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1948
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1949
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1950
//  CNSmlDMSettingsAdapter12::OpenSyncSessionAndDSProfileL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1951
//  The function opens the server session and DM profile.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1952
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1953
TInt CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL( const TInt aIntLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1954
                                                        TSmlOpenMode aMode )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1955
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1956
    _DBG_FILE( "CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1957
    if( iSyncSessionOpen == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1958
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1959
        iSyncSession.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1960
        iSyncSessionOpen = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1961
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1962
    TInt trueLuid = aIntLUID + KMaxDataSyncID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1963
    TInt rValue(KErrNone);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1964
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1965
    if(trueLuid!=iCurrentProfile)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1966
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1967
	    RArray<TSmlProfileId> profileIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1968
	    CleanupClosePushL( profileIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1969
	    TSmlUsageType usageType = ESmlDevMan;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1970
	    iSyncSession.ListProfilesL( profileIdArray, usageType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1971
	    TInt index = profileIdArray.Find( trueLuid );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1972
	    CleanupStack::PopAndDestroy(); //profileIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1973
	    if( index == KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1974
	        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1975
	        return KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1976
	        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1977
	    TRAP( rValue, iProfile.OpenL( iSyncSession, trueLuid, aMode ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1978
	    iCurrentProfile = trueLuid;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1979
	    if( rValue != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1980
	        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1981
	        iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1982
	        iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1983
			iSyncSession.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1984
	        iSyncSessionOpen = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1985
	        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1986
    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1987
    _DBG_FILE( "CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1988
    return rValue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1989
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1990
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1991
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1992
//  CNSmlDMSettingsAdapter12::FindProfileId
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1993
//  Function checks if profile can be found.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1994
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1995
TBool CNSmlDMSettingsAdapter12::FindProfileIdL( const TInt aIntLUID )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1996
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1997
    _DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1998
	if( iSyncSessionOpen == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  1999
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2000
        iSyncSession.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2001
        iSyncSessionOpen = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2002
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2003
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2004
	RArray <TSmlProfileId> profileList;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2005
    CleanupClosePushL( profileList );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2006
	TSmlUsageType usageType = ESmlDevMan;		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2007
	iSyncSession.ListProfilesL( profileList, usageType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2008
	if( profileList.Count() == 0 ) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2009
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2010
        CleanupStack::PopAndDestroy(); //profileList
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2011
        return EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2012
	    }		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2013
    TInt item = profileList.Find( aIntLUID + KMaxDataSyncID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2014
    CleanupStack::PopAndDestroy(); //profileList
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2015
    if( item != KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2016
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2017
		_DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2018
        return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2019
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2020
    _DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2021
	return EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2022
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2023
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2024
//  CNSmlDMSettingsAdapter12::IsServerIDExistL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2025
//  Function checks if serverid exist.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2026
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2027
TBool CNSmlDMSettingsAdapter12::IsServerIDExistL( const TDesC8& aServerid )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2028
{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2029
	_DBG_FILE( "CNSmlDMSettingsAdapter12::IsServerIDExistL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2030
	if( iSyncSessionOpen == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2031
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2032
       	iSyncSession.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2033
       	iSyncSessionOpen = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2034
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2035
    TBool ret(EFalse);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2036
	RArray <TSmlProfileId> profileList;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2037
    CleanupClosePushL( profileList );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2038
	TSmlUsageType usageType = ESmlDevMan;		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2039
	iSyncSession.ListProfilesL( profileList, usageType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2040
	TInt count = profileList.Count();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2041
	if( count > 0 ) 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2042
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2043
		for(TInt i =0; i< count; i++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2044
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2045
			TInt pid = i + KMaxDataSyncID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2046
			TInt index = profileList.Find(pid );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2047
			if( index >= i  )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2048
			{	    		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2049
	        	TInt rValue(KErrNone);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2050
	        	RSyncMLDevManProfile profile;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2051
	    		TRAP( rValue, profile.OpenL( iSyncSession, pid, ESmlOpenRead ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2052
	    		if( rValue == KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2053
	        	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2054
			        CleanupClosePushL(profile);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2055
	        		if(((aServerid.Compare(profile.ServerId())) == 0) &&
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2056
						((profile.ServerId()).Length() == aServerid.Length()))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2057
	        		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2058
	        			ret = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2059
			            CleanupStack::PopAndDestroy(&profile);//profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2060
						break;	        			
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2061
	        		}						
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2062
			        CleanupStack::PopAndDestroy(&profile);//profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2063
				}				
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2064
			}	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2065
		}        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2066
	}		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2067
    CleanupStack::PopAndDestroy(); //profileList
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2068
    _DBG_FILE( "CNSmlDMSettingsAdapter12::IsServerIDExistL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2069
	return ret;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2070
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2071
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2072
//  CNSmlDMSettingsAdapter12::CreateNewProfileL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2073
//  The function creates new DM profile via client API.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2074
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2075
TInt CNSmlDMSettingsAdapter12::CreateNewProfileL( TInt& aPID )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2076
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2077
    _DBG_FILE("CNSmlDMSettingsAdapter12::CreateNewProfileL(): begin");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2078
	if( iSyncSessionOpen == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2079
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2080
        iSyncSession.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2081
        iSyncSessionOpen = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2082
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2083
    TRAPD( value1, iProfile.CreateL( iSyncSession ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2084
    if( value1 != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2085
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2086
   	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2087
        iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2088
        iSyncSession.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2089
        iSyncSessionOpen = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2090
        return value1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2091
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2092
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2093
    TRAPD( value2, iProfile.UpdateL() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2094
    if( value2 != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2095
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2096
   	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2097
        iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2098
        iSyncSession.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2099
        iSyncSessionOpen = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2100
        return value2;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2101
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2102
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2103
    aPID = iProfile.Identifier();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2104
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2105
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2106
    _DBG_FILE( "CNSmlDMSettingsAdapter12::CreateNewProfileL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2107
    return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2108
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2109
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2110
//  CNSmlDMSettingsAdapter12::SetProfileServerURIL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2111
//  The function sets the server URL for a profile.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2112
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2113
TInt CNSmlDMSettingsAdapter12::SetProfileServerURIL( const TInt aPID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2114
                                                    const TDesC8& aObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2115
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2116
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerURIL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2117
	TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2118
    retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2119
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2120
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2121
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2122
	    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2123
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2124
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2125
	RArray<TSmlTransportId> transportIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2126
    CleanupClosePushL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2127
	iProfile.ListConnectionsL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2128
    if( transportIdArray.Count() == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2129
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2130
        CleanupStack::PopAndDestroy();//transportIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2131
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2132
        iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2133
        return KErrGeneral;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2134
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2135
	    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2136
	TInt newPort(0);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2137
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2138
    RSyncMLConnection conn;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2139
    CleanupClosePushL( conn );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2140
    conn.OpenL( iProfile, transportIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2141
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2142
    if(ParseUri(aObj,newPort)==KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2143
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2144
        TInt port = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2145
        ParseUri(conn.ServerURI(),port);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2146
        if(port==0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2147
        	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2148
        	port = 80;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2149
        	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2150
           	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2151
       	TBuf8<5> buf;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2152
    	buf.Num( port );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2153
        	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2154
        TInt totalSize = aObj.Length() + buf.Length() + 1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2155
        HBufC8* newServerURI = HBufC8::NewLC( totalSize );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2156
        SetPortNrToAddrStr( aObj, newServerURI, buf );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2157
        conn.SetServerURIL( *newServerURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2158
        conn.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2159
    	CleanupStack::PopAndDestroy( newServerURI ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2160
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2161
    else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2162
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2163
        conn.SetServerURIL( aObj );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2164
        conn.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2165
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2166
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2167
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2168
	iProfile.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2169
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2170
	CleanupStack::PopAndDestroy( 2 ); //transportIdArray, conn
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2171
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2172
	iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2173
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerURIL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2174
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2175
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2176
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2177
//  CNSmlDMSettingsAdapter12::SetProfileDisplayNameL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2178
//  The function sets the display name for a profile.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2179
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2180
TInt CNSmlDMSettingsAdapter12::SetProfileDisplayNameL( const TInt aPID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2181
                                                        const TDesC8& aObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2182
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2183
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2184
	TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2185
    retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2186
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2187
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2188
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2189
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2190
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2191
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2192
    iProfile.SetDisplayNameL( ConvertTo16LC( aObj ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2193
    iProfile.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2194
	CleanupStack::PopAndDestroy(); //ConvertTo16LC
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2195
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2196
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2197
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2198
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2199
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2200
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2201
//  CNSmlDMSettingsAdapter12::IsProfileLockedL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2202
//  The function to tell whether the profile is locked
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2203
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2204
TInt CNSmlDMSettingsAdapter12::IsProfileLockedL(const TInt aPID)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2205
{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2206
   _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2207
	TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2208
    retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenRead );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2209
     if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2210
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2211
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2212
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2213
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2214
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2215
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2216
	retVal=iProfile.ProfileLocked(EFalse, EFalse);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2217
	iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2218
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2219
    if(retVal)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2220
      {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2221
      /* CRepository* centrep = NULL;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2222
       TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) );    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2223
       TInt IsPrfoileEditable = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2224
       if(!err)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2225
         centrep->Get( KDevOverrideProfileLock, IsPrfoileEditable );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2226
       delete centrep;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2227
       if (!IsPrfoileEditable)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2228
          retVal=  KErrAccessDenied;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2229
       else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2230
         retVal= KErrNone;*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2231
       retVal=  KErrAccessDenied;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2232
      }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2233
      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2234
      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2235
       
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2236
    return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2237
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2238
}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2239
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2240
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2241
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2242
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2243
//  CNSmlDMSettingsAdapter12::SetProfileLockL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2244
//  The function to setor reset the profile lock.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2245
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2246
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2247
TInt CNSmlDMSettingsAdapter12::SetProfileLockL( const TInt aPID, TInt aLockValue)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2248
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2249
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileLockL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2250
	TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2251
    retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2252
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2253
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2254
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2255
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2256
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2257
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2258
		 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2259
		iProfile.ProfileLocked(ETrue, aLockValue );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2260
    iProfile.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2261
	  iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2262
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2263
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileLockL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2264
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2265
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2266
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2267
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2268
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2269
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2270
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2271
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2272
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2273
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2274
//  CNSmlDMSettingsAdapter12::SetProfileHttpUserNameL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2275
//  The function sets the profile http/network name.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2276
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2277
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2278
TInt CNSmlDMSettingsAdapter12::SetProfileHttpUserNameL( const TInt aPID, const TDesC8& aObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2279
{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2280
	TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2281
	 retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2282
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2283
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2284
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2285
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2286
        return KErrGeneral;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2287
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2288
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2289
	  RSyncMLConnection connection;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2290
	  TBuf8<KBufSize32> key; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2291
      RArray<TSmlTransportId> connIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2292
      CleanupClosePushL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2293
	  iProfile.ListConnectionsL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2294
      if( connIdArray.Count() == 1 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2295
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2296
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2297
		connection.OpenL( iProfile, KUidNSmlMediumTypeInternet.iUid );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2298
		CleanupClosePushL( connection );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2299
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2300
		connection.SetPropertyL( KNSmlHTTPAuth, KNSmlTrueVal );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2301
		connection.SetPropertyL( KNSmlHTTPUsername, aObj );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2302
		connection.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2303
		CleanupStack::PopAndDestroy(  );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2304
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2305
	  else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2306
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2307
		connection.SetPropertyL( KNSmlHTTPAuth, KNSmlFalseVal );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2308
		connection.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2309
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2310
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2311
		       
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2312
        CleanupStack::PopAndDestroy(   );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2313
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2314
	return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2315
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2316
}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2317
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2318
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2319
//  CNSmlDMSettingsAdapter12::SetProfileUserNameL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2320
//  The function sets the profile user name.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2321
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2322
TInt CNSmlDMSettingsAdapter12::SetProfileUserNameL( const TInt aPID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2323
                                                    const TDesC8& aObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2324
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2325
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileUserNameL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2326
	TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2327
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2328
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2329
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2330
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2331
        return KErrGeneral;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2332
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2333
    iProfile.SetUserNameL( aObj );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2334
    iProfile.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2335
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2336
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2337
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileUserNameL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2338
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2339
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2340
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2341
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2342
//  CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2343
//  The function sets the protocol version to be supported.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2344
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2345
TInt CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL( const TInt aPID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2346
                                                            const TDesC8& )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2347
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2348
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2349
	TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2350
    retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2351
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2352
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2353
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2354
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2355
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2356
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2357
	//The syncSession to Sync server is open.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2358
    TSmlProtocolVersion protocol = ESmlVersion1_2;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2359
    iProfile.SetProtocolVersionL( protocol );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2360
	TRAPD( iError, iProfile.UpdateL() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2361
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2362
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2363
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2364
	return iError;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2365
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2366
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2367
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2368
//  CNSmlDMSettingsAdapter12::SetProfileServerIdL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2369
//  The function sets the profile ServerId value.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2370
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2371
TInt CNSmlDMSettingsAdapter12::SetProfileServerIdL( const TInt aPID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2372
                                                    const TDesC8& aObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2373
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2374
    _DBG_FILE("CNSmlDMSettingsAdapter12::SetProfileServerIdL(): begin");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2375
	TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2376
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2377
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2378
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2379
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2380
        return KErrGeneral;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2381
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2382
	iProfile.SetServerIdL( aObj );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2383
    TRAP(retVal,iProfile.UpdateL() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2384
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2385
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2386
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerIdL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2387
	return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2388
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2389
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2390
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2391
//  CNSmlDMSettingsAdapter12::SetProfileServerPasswordL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2392
//  The function sets the profile server password.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2393
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2394
TInt CNSmlDMSettingsAdapter12::SetProfileServerPasswordL( const TInt aPID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2395
                                                        const TDesC8& aObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2396
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2397
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerPasswordL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2398
	TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2399
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2400
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2401
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2402
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2403
        return KErrGeneral;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2404
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2405
	iProfile.SetServerPasswordL( aObj );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2406
    iProfile.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2407
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2408
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2409
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerPasswordL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2410
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2411
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2412
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2413
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2414
//  CNSmlDMSettingsAdapter12::SetProfileHttpPasswordL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2415
//  The function sets the profile network/http password.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2416
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2417
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2418
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2419
  TInt CNSmlDMSettingsAdapter12::SetProfileHttpPasswordL( const TInt aPID, const TDesC8& aObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2420
  {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2421
 TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2422
	 retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2423
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2424
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2425
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2426
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2427
        return KErrGeneral;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2428
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2429
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2430
	  RSyncMLConnection connection;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2431
	  TBuf8<KBufSize32> key; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2432
      RArray<TSmlTransportId> connIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2433
      CleanupClosePushL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2434
	  iProfile.ListConnectionsL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2435
      if( connIdArray.Count() == 1 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2436
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2437
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2438
		connection.OpenL( iProfile, KUidNSmlMediumTypeInternet.iUid );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2439
		CleanupClosePushL( connection );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2440
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2441
		connection.SetPropertyL( KNSmlHTTPAuth, KNSmlTrueVal );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2442
		connection.SetPropertyL( KNSmlHTTPPassword, aObj );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2443
		connection.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2444
		CleanupStack::PopAndDestroy(  );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2445
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2446
	  else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2447
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2448
	//	connection.SetPropertyL( KNSmlHTTPAuth, KNSmlFalseVal );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2449
		connection.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2450
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2451
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2452
		       
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2453
        CleanupStack::PopAndDestroy(   );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2454
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2455
	return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2456
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2457
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2458
  	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2459
  }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2460
  
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2461
  
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2462
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2463
//  CNSmlDMSettingsAdapter12::SetProfilePasswordL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2464
//  The function sets the profile password.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2465
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2466
TInt CNSmlDMSettingsAdapter12::SetProfilePasswordL( const TInt aPID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2467
                                                    const TDesC8& aObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2468
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2469
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfilePasswordL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2470
	TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2471
    retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2472
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2473
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2474
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2475
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2476
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2477
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2478
	iProfile.SetPasswordL( aObj );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2479
    iProfile.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2480
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2481
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2482
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfilePasswordL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2483
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2484
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2485
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2486
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2487
//  CNSmlDMSettingsAdapter12::SetProfileConnectionPropertyL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2488
//  This function sets the profile IAP id.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2489
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2490
TInt CNSmlDMSettingsAdapter12::SetProfileConnectionPropertyL( const TInt aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2491
                                                            const TInt aIAPid )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2492
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2493
    TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2494
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2495
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2496
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2497
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2498
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2499
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2500
    RArray<TSmlTransportId> connIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2501
    CleanupClosePushL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2502
    iProfile.ListConnectionsL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2503
    if( connIdArray.Count() == 1 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2504
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2505
        RSyncMLTransport transport;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2506
        CleanupClosePushL( transport );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2507
	    transport.OpenL( iSyncSession, connIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2508
	    const CSyncMLTransportPropertiesArray& props = transport.Properties();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2509
	    TInt index = props.Find( KNSmlIAPId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2510
        if( index > 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2511
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2512
            RSyncMLConnection conn;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2513
            CleanupClosePushL( conn );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2514
	        conn.OpenL( iProfile, connIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2515
            HBufC8* apIdBuffer = HBufC8::NewLC( 4 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2516
	        TPtr8 ptrIapIdBuf = apIdBuffer->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2517
        	ptrIapIdBuf.Num( aIAPid );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2518
            conn.SetPropertyL( KNSmlIAPId, ptrIapIdBuf );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2519
            conn.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2520
            CleanupStack::PopAndDestroy( 2 ); //conn, apIdBuffer
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2521
            retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2522
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2523
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2524
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2525
            retVal = KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2526
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2527
        CleanupStack::PopAndDestroy( 1 ); //transport
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2528
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2529
    else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2530
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2531
        retVal = KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2532
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2533
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2534
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2535
    CleanupStack::PopAndDestroy(); //connIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2536
    return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2537
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2538
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2539
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2540
//  CNSmlDMSettingsAdapter12::DeleteProfileL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2541
//  The function deleted the profile from DM database.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2542
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2543
TInt CNSmlDMSettingsAdapter12::DeleteProfileL( const TInt aPID )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2544
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2545
    _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteProfileL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2546
	if( iSyncSessionOpen == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2547
	    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2548
        iSyncSession.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2549
        iSyncSessionOpen = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2550
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2551
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2552
	RArray<TSmlProfileId> profileIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2553
    CleanupClosePushL( profileIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2554
	TSmlUsageType usageType = ESmlDevMan;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2555
	iSyncSession.ListProfilesL( profileIdArray, usageType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2556
	TInt index = profileIdArray.Find( aPID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2557
	if ( index == KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2558
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2559
        //No match
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2560
        CleanupStack::PopAndDestroy();//profileIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2561
		return KErrNotFound;		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2562
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2563
    iSyncSession.DeleteProfileL( aPID );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2564
    iSyncSession.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2565
    iSyncSessionOpen = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2566
    CleanupStack::PopAndDestroy();//profileIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2567
    _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteProfileL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2568
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2569
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2570
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2571
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2572
//  CNSmlDMSettingsAdapter12::GetObjectL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2573
//  The function checks which leaf data to be fetched.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2574
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2575
TInt CNSmlDMSettingsAdapter12::GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2576
                                            CBufBase& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2577
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2578
    TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2579
    if( iField->Compare(KNSmlDdfAppId ) ==0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2580
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2581
         	aObject.InsertL(aObject.Size(),KNSmlDdfAppIdValue);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2582
         	return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2583
        	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2584
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2585
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2586
    retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenRead );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2587
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2588
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2589
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2590
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2591
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2592
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2593
    switch ( aDMField )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2594
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2595
		case ( EProfileName ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2596
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2597
            GetProfileNameL( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2598
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2599
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2600
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2601
		case ( EProfileDMServerUsername ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2602
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2603
			GetProfileUserNameL( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2604
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2605
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2606
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2607
		case ( EProfileURL ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2608
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2609
			GetProfileServerURLL( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2610
			TInt port(0);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2611
			if(ParseUri(aObject.Ptr(0),port)==KErrNone)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2612
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2613
			    HBufC8* addr = aObject.Ptr(0).AllocLC();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2614
			    aObject.Reset();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2615
			    TInt portStart = addr->LocateReverse(KNSmlDMColon);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2616
			    aObject.InsertL(aObject.Size(),addr->Left(portStart));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2617
			    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2618
			    TInt portLen=addr->Mid(portStart).Locate(KNSmlDMUriSeparator);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2619
			    if(portLen!=KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2620
			        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2621
			        aObject.InsertL(aObject.Size(),addr->Mid(portStart+portLen));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2622
			        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2623
			    	    			    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2624
			    CleanupStack::PopAndDestroy(); //addr
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2625
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2626
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2627
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2628
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2629
		case ( EServerId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2630
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2631
            GetServerIdL( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2632
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2633
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2634
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2635
		case ( EProfileIAPId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2636
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2637
		    retVal = GetConRefL( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2638
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2639
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2640
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2641
		case ( EProfilePort ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2642
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2643
            GetProfileServerURLL( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2644
            if ( aObject.Size() == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2645
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2646
                retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2647
                break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2648
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2649
            GetProfilePortNumberL ( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2650
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2651
        break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2652
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2653
   		case ( EProfileDMServerPassword ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2654
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2655
			retVal = EInvalidObject;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2656
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2657
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2658
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2659
		case ( ESharedSecret ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2660
            {//ServerPW
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2661
            retVal = EInvalidObject;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2662
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2663
        break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2664
        case ( EProfileId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2665
        break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2666
		case ( EProfileAddrType ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2667
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2668
		    aObject.InsertL(aObject.Size(),KNSmlAddrtype);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2669
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2670
		   break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2671
		case (EProfileHttpUsername ):
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2672
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2673
		       retVal = GetHttpUsernameL(aObject);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2674
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2675
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2676
		case (EPRofileServerCred) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2677
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2678
		    aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelSrv);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2679
		    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2680
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2681
		  break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2682
        case (EPRofileClientCred) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2683
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2684
		    aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelCli);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2685
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2686
		  break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2687
		  
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2688
		case (ETransportAuthName) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2689
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2690
    			TInt mediumType= ENone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2691
    			GetProfileConnectiontypeL( mediumType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2692
    			if( mediumType == EHttp)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2693
    			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2694
    		    retVal = GetHttpUsernameL(aObject);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2695
    		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2696
    		    else if(mediumType == EObex)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2697
    		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2698
    		      aObject.InsertL(aObject.Size(),KNSmlDMNullDesc8);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2699
    		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2700
		    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2701
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2702
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2703
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2704
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2705
		case (EProfileTransport) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2706
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2707
			TInt mediumType= ENone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2708
			GetProfileConnectiontypeL( mediumType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2709
			if( mediumType == EHttp)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2710
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2711
		    aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelHttp);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2712
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2713
		    else if(mediumType == EObex)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2714
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2715
		      aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelObx);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2716
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2717
            
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2718
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2719
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2720
       break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2721
        case ( EAuthenticationRequired ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2722
		case ( EProfileAAuthType ):
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2723
        case ( EServerNonce ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2724
        case ( EClientNonce ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2725
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2726
            retVal = GetDMAuthInfoL( aLUID, aDMField, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2727
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2728
        break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2729
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2730
     case EProfileLock :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2731
      {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2732
        	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2733
       TBool isProfileLocked = iProfile.ProfileLocked(EFalse, EFalse);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2734
       if(isProfileLocked)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2735
       {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2736
       	aObject.InsertL(aObject.Size(),KDmProfileLocked);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2737
       }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2738
       else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2739
       {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2740
       	aObject.InsertL(aObject.Size(),KDmProfileUnLocked);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2741
       }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2742
       
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2743
      }   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2744
     break;		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2745
		default:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2746
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2747
			User::Panic( KNSmlIndexOutOfBoundStr, KNSmlPanicIndexOutOfBound );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2748
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2749
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2750
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2751
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2752
    return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2753
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2754
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2755
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2756
//  CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2757
//  The function sets the profile port number.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2758
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2759
TInt CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL( const TInt aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2760
                                                            const TDesC8& aPort )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2761
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2762
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2763
    TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2764
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2765
    if( iPortNbr )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2766
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2767
        delete iPortNbr;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2768
        iPortNbr = NULL;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2769
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2770
    iPortNbr = HBufC8::NewL( aPort.Length() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2771
    TPtr8 newPortNbr = iPortNbr->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2772
    newPortNbr.Append( aPort );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2773
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2774
    retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2775
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2776
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2777
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2778
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2779
        _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2780
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2781
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2782
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2783
    RArray<TSmlTransportId> transportIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2784
    CleanupClosePushL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2785
    iProfile.ListConnectionsL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2786
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2787
    RSyncMLConnection conn;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2788
    CleanupClosePushL( conn );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2789
    conn.OpenL( iProfile, transportIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2790
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2791
    HBufC8* serverURI = conn.ServerURI().AllocLC();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2792
    if( serverURI->Length() == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2793
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2794
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2795
        iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2796
        CleanupStack::PopAndDestroy( 3 ); //transportIdArray, conn, serverURI
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2797
        _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2798
        return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2799
	    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2800
    TInt totalSize = serverURI->Size() + newPortNbr.Size() + 1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2801
    HBufC8* newServerURI = HBufC8::NewL( totalSize );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2802
    CleanupStack::PushL( newServerURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2803
    SetPortNrToAddrStr( *serverURI, newServerURI, newPortNbr );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2804
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2805
    conn.SetServerURIL( *newServerURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2806
    conn.UpdateL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2807
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2808
    CleanupStack::PopAndDestroy( 4 ); //transportIdArray, conn, serverURI, newServerURI
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2809
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2810
	iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2811
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2812
    return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2813
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2814
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2815
// ------------------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2816
//  CNSmlDMSettingsAdapter12::SetPortNrToAddrStr
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2817
//  Sets a portnbr (separated with ':') to profile server URI. 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2818
// ------------------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2819
void CNSmlDMSettingsAdapter12::SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2820
                                                    const TDesC8& aPort )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2821
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2822
	TInt offset=0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2823
    if( aSrvURI.Find( KNSmlDMSettingsHTTP ) == 0 )//http://
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2824
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2825
		offset = KNSmlDMSettingsHTTP().Length();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2826
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2827
	else if( aSrvURI.Find( KNSmlDMSettingsHTTPS ) == 0 )//https://
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2828
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2829
		offset = KNSmlDMSettingsHTTPS().Length();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2830
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2831
	TInt portStart = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2832
    TInt separatorPos = aSrvURI.Length();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2833
    TInt i = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2834
    for( i = offset; i < aSrvURI.Length(); i++ )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2835
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2836
		if( aSrvURI[i] == KNSmlDMColon )// ':'
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2837
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2838
			portStart = i;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2839
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2840
		if( aSrvURI[i] == KNSmlDMUriSeparator )// '/'
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2841
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2842
            separatorPos = i;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2843
			break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2844
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2845
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2846
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2847
    TPtr8 ptrNewSrvURI = aNewURI->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2848
    if( portStart < 0 && separatorPos > 0 && iLeafType != EDMDelete )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2849
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2850
        ptrNewSrvURI.Append( aSrvURI.Left( separatorPos ) );//http://123.234.345.456
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2851
        ptrNewSrvURI.Append( KNSmlDMColon );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2852
        ptrNewSrvURI.Append( aPort );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2853
        ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2854
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2855
    else if ( portStart > 0 && separatorPos > 0 && iLeafType != EDMDelete )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2856
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2857
        ptrNewSrvURI.Append( aSrvURI.Left( portStart + 1 ) );//123.234.345.456:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2858
        ptrNewSrvURI.Append( aPort );//123.234.345.456:xx(x)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2859
        ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2860
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2861
    else if ( portStart > 0 &&  iLeafType == EDMDelete ) //delete port number from uri
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2862
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2863
        ptrNewSrvURI.Append( aSrvURI.Left( portStart ) );//123.234.345.456
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2864
        ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2865
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2866
    else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2867
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2868
        ptrNewSrvURI.Append( aSrvURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2869
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2870
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2871
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2872
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2873
// ------------------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2874
//  CNSmlDMSettingsAdapter12::SetDMFieldDataL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2875
//  Selects and Sets value to a field based on field id got from URI.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2876
// ------------------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2877
TInt CNSmlDMSettingsAdapter12::SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2878
                                                const TNSmlDMProfileData aField )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2879
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2880
    TInt rValue = KErrGeneral;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2881
    TInt lockvalue =0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2882
     if(aField != EProfileLock)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2883
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2884
      rValue=IsProfileLockedL(aLUID);	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2885
      if (rValue!= KErrNone)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2886
      {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2887
       return rValue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2888
      }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2889
         
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2890
     }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2891
     else if (aField == EProfileLock)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2892
     {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2893
     	 if (! iNewProfile)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2894
     	  {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2895
     	  	 lockvalue =0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2896
     	  	  if(aObject.Length()> 1)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2897
     	  	  {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2898
     	  	    rValue = KErrArgument;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2899
              	 return rValue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2900
     	  	  }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2901
           lockvalue = GetIntObject(aObject);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2902
           if(lockvalue != 0 && lockvalue != 1)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2903
               {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2904
               	  //lockvalue = 0; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2905
               	  rValue = KErrArgument;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2906
               	 return rValue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2907
               }  
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2908
     	  	 rValue  = SetProfileLockL(aLUID , lockvalue);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2909
     	  	 return rValue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2910
     	  }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2911
      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2912
     }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2913
      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2914
    switch ( aField )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2915
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2916
		case ( EProfileURL ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2917
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2918
		    rValue = SetProfileServerURIL( aLUID, aObject );    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2919
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2920
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2921
		case ( EServerId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2922
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2923
		    rValue = SetProfileServerIdL( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2924
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2925
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2926
        case ( ESharedSecret ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2927
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2928
		    rValue = SetProfileServerPasswordL( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2929
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2930
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2931
        case ( EProfileDMServerUsername ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2932
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2933
		    rValue = SetProfileUserNameL( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2934
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2935
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2936
        case ( EProfileDMServerPassword ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2937
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2938
		    rValue = SetProfilePasswordL( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2939
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2940
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2941
        case ( EProfileName ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2942
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2943
		    rValue = SetProfileDisplayNameL( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2944
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2945
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2946
        case ( EProfileIAPId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2947
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2948
            rValue = SetConRefL( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2949
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2950
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2951
		case ( ETransportAuthName ):
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2952
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2953
		    OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2954
		  	TInt mediumType = ENone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2955
	    	GetProfileConnectiontypeL( mediumType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2956
			if( mediumType == EHttp)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2957
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2958
		    rValue = SetProfileHttpUserNameL ( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2959
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2960
		    else if(mediumType == EObex)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2961
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2962
		      rValue = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2963
		      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2964
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2965
			
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2966
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2967
		//break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2968
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2969
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2970
		case ( EProfileTransportPassword ):
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2971
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2972
		 TInt mediumType = ENone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2973
		  OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2974
	    	GetProfileConnectiontypeL( mediumType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2975
			if( mediumType == EHttp)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2976
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2977
		    rValue = SetProfileHttpPasswordL ( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2978
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2979
		    else if(mediumType == EObex)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2980
		    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2981
		      rValue = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2982
		      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2983
		    }		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2984
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2985
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2986
		case (EProfileTransportAuthData) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2987
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2988
				rValue = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2989
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2990
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2991
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2992
		case ( EProfileHttpUsername ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2993
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2994
			rValue = SetProfileHttpUserNameL ( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2995
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2996
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2997
		case ( EProfileHttpPassword ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2998
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  2999
			rValue = SetProfileHttpPasswordL ( aLUID, aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3000
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3001
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3002
        case ( EProfileId ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3003
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3004
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3005
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3006
        case ( EProfilePort ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3007
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3008
			if(aObject.Size()<=5)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3009
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3010
			TInt port = GetIntObject(aObject);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3011
	        if( port > KPortMinSize && port < KPortMaxSize )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3012
		         {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3013
	    			TPortBuffer element;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3014
	    			element.iPortBuf=aObject;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3015
	    			element.iPortBufLUID = aLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3016
	    			iPortBuffer.Append(element);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3017
	    			rValue=KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3018
                 }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3019
                else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3020
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3021
				if (port <= KPortMinSize )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3022
				   rValue = KErrUnderflow;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3023
                	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3024
                   rValue=KErrOverflow;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3025
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3026
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3027
			else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3028
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3029
					rValue=KErrOverflow;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3030
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3031
			// save information of the port
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3032
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3033
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3034
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3035
		case ( EProfileAddrType ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3036
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3037
			  if (aObject.Match(KNSmlAddrtype)!=KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3038
			  rValue=KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3039
			  
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3040
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3041
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3042
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3043
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3044
        case ( EProfileMediumType ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3045
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3046
            if ( iLeafType == EDMDelete )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3047
			    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3048
                return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3049
			    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3050
            iObject = GetIntObject( aObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3051
            if(iObject<0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3052
                {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3053
                iObject = EHttp;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3054
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3055
            rValue = SetProfileAddrTypeL( aLUID, iObject );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3056
		    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3057
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3058
		case ( EProfileTransport) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3059
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3060
			if (aObject.Match(KDmAccAppAuthLevelHttp)!=KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3061
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3062
				iObject = EHttp;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3063
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3064
			else if (aObject.Match(KDmAccAppAuthLevelObx)!=KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3065
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3066
				iObject = EObex;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3067
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3068
		 rValue = SetProfileAddrTypeL( aLUID, iObject );	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3069
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3070
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3071
        case ( EAuthenticationRequired ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3072
        case ( EClientNonce ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3073
        case ( EServerNonce ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3074
		break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3075
     case ( EProfileLock ) :
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3076
              lockvalue =0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3077
              lockvalue = GetIntObject(aObject);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3078
             if(lockvalue != 0 && lockvalue != 1)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3079
                   lockvalue = 0; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3080
            
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3081
            TLockBuffer element;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3082
	    	element.iProfileLock=lockvalue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3083
	    	element.iProfileLockLUID = aLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3084
	    	iProfileLockBuffer.Append(element);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3085
	    	rValue=KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3086
           
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3087
             
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3088
          // rValue  = SetProfileLock(aLUID , lockvalue);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3089
     break;               
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3090
        default:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3091
            rValue = KErrNotSupported;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3092
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3093
    return rValue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3094
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3095
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3096
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3097
//  CNSmlDMSettingsAdapter12::FillNodeInfoL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3098
//  The function fills the node or leaf information.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3099
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3100
void CNSmlDMSettingsAdapter12::FillNodeInfoL( MSmlDmDDFObject& aNode, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3101
                                            TSmlDmAccessTypes aAccTypes, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3102
                                            MSmlDmDDFObject::TOccurence aOccurrence, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3103
                                            MSmlDmDDFObject::TScope aScope, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3104
                                            MSmlDmDDFObject::TDFFormat aFormat, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3105
                                            const TDesC8& aDescription, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3106
                                            const TDesC8& aDefaultValue, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3107
                                            const TDesC8& aMimeType )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3108
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3109
    aNode.AddDFTypeMimeTypeL( aMimeType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3110
    aNode.SetAccessTypesL( aAccTypes );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3111
	aNode.SetDescriptionL( aDescription );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3112
	aNode.SetOccurenceL( aOccurrence );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3113
	aNode.SetDefaultValueL( aDefaultValue );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3114
	aNode.SetScopeL( aScope );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3115
	aNode.SetDFFormatL( aFormat );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3116
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3117
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3118
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3119
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3120
//  CNSmlDMSettingsAdapter12::GetDMAuthInfoL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3121
//  This function gets authentication data from private API.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3122
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3123
TInt CNSmlDMSettingsAdapter12::GetDMAuthInfoL( const TInt aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3124
                                                const TNSmlDMProfileData aField, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3125
                                                CBufBase& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3126
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3127
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMAuthInfoL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3128
   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3129
    CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3130
    CleanupStack::PushL( authInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3131
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3132
    authInfo->iProfileId = aLUID + KMaxDataSyncID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3133
    iPrivateApi.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3134
    TInt ret = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3135
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3136
    TRAPD(err,iPrivateApi.GetDMAuthInfoL( *authInfo ));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3137
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3138
    if(err==KErrNone)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3139
    	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3140
	    if ( aField == EServerNonce )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3141
	        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3142
	        aObject.InsertL( aObject.Size(), *authInfo->iServerNonce );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3143
	        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3144
	    else if ( aField == EClientNonce )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3145
	        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3146
	        aObject.InsertL( aObject.Size(), *authInfo->iClientNonce );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3147
	        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3148
	    else if (( aField == EAuthenticationRequired ) || (aField == EProfileAAuthType))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3149
	        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3150
	        TUint authPref = authInfo->iAuthPref;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3151
	        /*if( authPref == ENoAuth )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3152
	            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3153
	            aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefNoAuth ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3154
	            }*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3155
	         if( authPref == EBasic )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3156
	            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3157
	            if(aField == EAuthenticationRequired)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3158
	            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3159
	            aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefBasic );	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3160
	            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3161
	            else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3162
	            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3163
	            aObject.InsertL( aObject.Size(), KNSmlDMAuthTypeBasic );	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3164
	            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3165
	            
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3166
	            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3167
	        else if( authPref == EMD5 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3168
	            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3169
	            if(aField == EAuthenticationRequired)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3170
	            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3171
	            aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefMD5 );	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3172
	            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3173
	            else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3174
	            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3175
				aObject.InsertL( aObject.Size(), KNSmlDMAuthTypeMD5 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3176
	            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3177
	            
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3178
	            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3179
	        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3180
	            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3181
	            aObject.InsertL( aObject.Size(), KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3182
	            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3183
	        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3184
    	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3185
    iPrivateApi.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3186
    CleanupStack::PopAndDestroy(authInfo);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3187
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMAuthInfoL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3188
    return ret;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3189
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3190
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3191
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3192
//  CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3193
//  This function resets the authentication data.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3194
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3195
TInt CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL( const TInt aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3196
                                                const TNSmlDMProfileData aField )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3197
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3198
    _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3199
    CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo;;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3200
    CleanupStack::PushL( authInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3201
    authInfo->iProfileId = aLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3202
    iPrivateApi.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3203
    iPrivateApi.GetDMAuthInfoL( *authInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3204
    if( aField == EServerNonce )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3205
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3206
        authInfo->iServerNonce->Des().Delete( 0, authInfo->iServerNonce->Des().Size() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3207
        authInfo->iServerNonce->Des().Insert( 0, KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3208
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3209
    else if( aField == EClientNonce )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3210
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3211
        authInfo->iClientNonce->Des().Delete( 0, authInfo->iClientNonce->Des().Size() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3212
        authInfo->iClientNonce->Des().Insert( 0, KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3213
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3214
    else if( aField == EAuthenticationRequired )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3215
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3216
        authInfo->iAuthPref = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3217
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3218
    iPrivateApi.SetDMAuthInfoL( *authInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3219
    iPrivateApi.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3220
    CleanupStack::PopAndDestroy(authInfo);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3221
	_DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3222
    return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3223
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3224
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3225
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3226
// CNSmlDMSettingsAdapter12::SetProfileAddrTypeL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3227
// This function sets the AddrType value.    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3228
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3229
TInt CNSmlDMSettingsAdapter12::SetProfileAddrTypeL( const TInt aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3230
                                                    const TInt aIntObj )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3231
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3232
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3233
    TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3234
    if( retVal != KErrNone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3235
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3236
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3237
		iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3238
        _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3239
        return retVal;	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3240
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3241
    TInt mediumType = ENone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3242
    GetMediumTypeL( aIntObj, mediumType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3243
    if( mediumType == ENone )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3244
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3245
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3246
        iProfile.Close();    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3247
        return KErrGeneral;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3248
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3249
    RArray<TSmlTransportId> transportIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3250
    CleanupClosePushL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3251
    iProfile.ListConnectionsL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3252
    RSyncMLConnection conn;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3253
    CleanupClosePushL( conn );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3254
    conn.OpenL( iProfile, transportIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3255
    HBufC8* sURI = conn.ServerURI().AllocLC();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3256
    if(mediumType!=transportIdArray[0])
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3257
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3258
        if ( !FeatureManager::FeatureSupported( KFeatureIdSyncMlDmObex  ) )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3259
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3260
            CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3261
            return EInvalidObject;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3262
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3263
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3264
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3265
            conn.CreateL(iProfile,mediumType);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3266
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3267
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3268
    conn.SetServerURIL( *sURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3269
    conn.UpdateL(); 	                    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3270
    CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3271
    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3272
    iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3273
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3274
    return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3275
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3276
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3277
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3278
// CNSmlDMSettingsAdapter12::GetHttpUsernameL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3279
// This function gets the httpuser value.    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3280
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3281
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3282
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3283
TInt CNSmlDMSettingsAdapter12::GetHttpUsernameL( CBufBase& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3284
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3285
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3286
	  TInt retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3287
      TBuf8<KBufSize32> key; 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3288
      TInt intValue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3289
      
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3290
      RArray<TSmlTransportId> connIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3291
      CleanupClosePushL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3292
	  iProfile.ListConnectionsL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3293
      if( connIdArray.Count() == 1 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3294
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3295
        RSyncMLTransport transport;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3296
        CleanupClosePushL( transport );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3297
	    transport.OpenL( iSyncSession, connIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3298
    	const CSyncMLTransportPropertiesArray&  arr = transport.Properties();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3299
		const TSyncMLTransportPropertyInfo& info = arr.At( EPropertyHttpUsed );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3300
		key = info.iName;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3301
		RSyncMLConnection conn;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3302
        CleanupClosePushL( conn );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3303
	    conn.OpenL( iProfile, connIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3304
       	HBufC8* value = conn.GetPropertyL( key ).AllocLC();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3305
        intValue = GetIntObject( *value );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3306
        CleanupStack::PopAndDestroy(  ); //value
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3307
        if ( intValue == 1 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3308
        	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3309
                retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3310
                const TSyncMLTransportPropertyInfo& info2 = arr.At( EPropertyHttpUserName );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3311
                key= info2.iName;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3312
                HBufC8* value = conn.GetPropertyL( key ).AllocLC();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3313
                aObject.InsertL(aObject.Size(),value->Des());
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3314
                CleanupStack::PopAndDestroy(  ); //value
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3315
                }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3316
                else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3317
                    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3318
                    retVal = KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3319
                    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3320
               CleanupStack::PopAndDestroy( 2 ); //  conn, transport
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3321
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3322
        CleanupStack::PopAndDestroy(  ); //connIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3323
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3324
	return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3325
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3326
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3327
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3328
//  CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3329
//  The function gets the profile medium type.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3330
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3331
TInt CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL( TInt& aMediumTYpe )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3332
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3333
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3334
	RArray<TSmlTransportId> transportIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3335
    CleanupClosePushL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3336
	iProfile.ListConnectionsL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3337
	TInt transportItems = transportIdArray.Count();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3338
    if( transportItems == 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3339
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3340
		//No matching items
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3341
        CleanupStack::PopAndDestroy(); //transportIdArray	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3342
		return KErrGeneral;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3343
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3344
	else if( transportItems > 1 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3345
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3346
		//Error case : against specification
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3347
        CleanupStack::PopAndDestroy(); //transportIdArray	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3348
		return KErrGeneral;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3349
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3350
	aMediumTYpe = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3351
    if ( transportIdArray[0] == KUidNSmlMediumTypeInternet.iUid )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3352
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3353
        aMediumTYpe = 1; //EHttp;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3354
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3355
    else if ( transportIdArray[0] == KUidNSmlMediumTypeBluetooth.iUid ||
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3356
              transportIdArray[0] == KUidNSmlMediumTypeUSB.iUid ||   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3357
              transportIdArray[0] == KUidNSmlMediumTypeIrDA.iUid  )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3358
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3359
        aMediumTYpe = 3; //EObex;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3360
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3361
    CleanupStack::PopAndDestroy( 1 ); //transportIdArray, SetIntObjectLC
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3362
	return KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3363
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3364
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3365
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3366
//  CNSmlDMSettingsAdapter12::GetProfileIAPIdL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3367
//  The function gets the profile IAP Id.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3368
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3369
TInt CNSmlDMSettingsAdapter12::GetProfileIAPIdL( TInt& aIAPid )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3370
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3371
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileIAPIdL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3372
    TInt retVal = KErrGeneral;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3373
    aIAPid = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3374
    RArray<TSmlTransportId> connIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3375
    CleanupClosePushL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3376
    iProfile.ListConnectionsL( connIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3377
    if( connIdArray.Count() == 1 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3378
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3379
        RSyncMLTransport transport;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3380
        CleanupClosePushL( transport );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3381
	    transport.OpenL( iSyncSession, connIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3382
	    const CSyncMLTransportPropertiesArray& props = transport.Properties();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3383
	    TInt index = props.Find( KNSmlIAPId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3384
        if( index > 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3385
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3386
            RSyncMLConnection conn;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3387
            CleanupClosePushL( conn );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3388
	        conn.OpenL( iProfile, connIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3389
            HBufC8* apId = conn.GetPropertyL( KNSmlIAPId ).AllocLC();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3390
            aIAPid = GetIntObject( *apId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3391
            CleanupStack::PopAndDestroy( 2 ); //conn, apId
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3392
            retVal = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3393
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3394
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3395
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3396
            retVal = KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3397
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3398
        CleanupStack::PopAndDestroy( 1 ); //transport
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3399
	    iCurrentProfile = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3400
        iProfile.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3401
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3402
    else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3403
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3404
        retVal = KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3405
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3406
    CleanupStack::PopAndDestroy(); //connIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3407
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileIAPIdL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3408
    return retVal;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3409
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3410
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3411
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3412
//  CNSmlDMSettingsAdapter12::GetProfileServerURLL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3413
//  The function gets the profile Server URI.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3414
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3415
void CNSmlDMSettingsAdapter12::GetProfileServerURLL( CBufBase& aURL )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3416
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3417
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileServerURLL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3418
    RArray<TSmlTransportId> transportIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3419
    CleanupClosePushL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3420
	iProfile.ListConnectionsL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3421
    if( transportIdArray.Count() > 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3422
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3423
        RSyncMLConnection profConn;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3424
        CleanupClosePushL( profConn );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3425
	    profConn.OpenL( iProfile, transportIdArray[0] );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3426
	    HBufC8* sURI = profConn.ServerURI().AllocL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3427
        CleanupStack::PushL( sURI );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3428
        TPtr8 uriPtr = sURI->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3429
        if( uriPtr.Length() > 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3430
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3431
            aURL.InsertL( aURL.Size(),uriPtr );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3432
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3433
        else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3434
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3435
            aURL.InsertL( aURL.Size(), KNullDesC8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3436
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3437
        CleanupStack::PopAndDestroy( 2 );//profConn, sURI
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3438
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3439
    CleanupStack::PopAndDestroy(); //transportIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3440
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileServerURLL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3441
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3442
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3443
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3444
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3445
//	CNSmlDMSettingsAdapter12::GetMediumTypeL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3446
//	Checks the requested medium type.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3447
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3448
void CNSmlDMSettingsAdapter12::GetMediumTypeL( const TInt aIntObj, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3449
                                            TInt& aMediumType )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3450
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3451
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetMediumTypeL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3452
    if( aIntObj == EHttp || aIntObj == EWsp )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3453
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3454
        aMediumType = KUidNSmlMediumTypeInternet.iUid;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3455
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3456
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3457
    RArray<TSmlTransportId> transportIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3458
    CleanupClosePushL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3459
    iSyncSession.ListTransportsL( transportIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3460
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3461
    if ( transportIdArray.Find( KUidNSmlMediumTypeBluetooth.iUid ) != KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3462
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3463
        aMediumType = KUidNSmlMediumTypeBluetooth.iUid;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3464
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3465
    else if ( transportIdArray.Find( KUidNSmlMediumTypeUSB.iUid ) != KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3466
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3467
        aMediumType = KUidNSmlMediumTypeUSB.iUid;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3468
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3469
    else if ( transportIdArray.Find( KUidNSmlMediumTypeIrDA.iUid ) != KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3470
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3471
        aMediumType = KUidNSmlMediumTypeIrDA.iUid;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3472
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3473
    CleanupStack::PopAndDestroy(); //transportIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3474
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetMediumTypeL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3475
    return;    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3476
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3477
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3478
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3479
//	CNSmlDMSettingsAdapter12::GetServerIdL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3480
//	Gets the server id value.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3481
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3482
void CNSmlDMSettingsAdapter12::GetServerIdL( CBufBase& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3483
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3484
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetServerIdL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3485
    HBufC8* serverId = iProfile.ServerId().AllocL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3486
    CleanupStack::PushL( serverId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3487
    aObject.InsertL( aObject.Size(), *serverId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3488
    CleanupStack::PopAndDestroy( 1 ); //serverId
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3489
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetServerIdL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3490
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3491
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3492
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3493
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3494
//	CNSmlDMSettingsAdapter12::GetProfileNameL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3495
//	Gets the display name value.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3496
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3497
void CNSmlDMSettingsAdapter12::GetProfileNameL( CBufBase& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3498
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3499
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileNameL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3500
    HBufC16* dataBuf = iProfile.DisplayName().AllocL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3501
    CleanupStack::PushL( dataBuf );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3502
    TPtr16 ptrDisplayName = dataBuf->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3503
    HBufC8* dataBuf8 = HBufC8::NewL( ptrDisplayName.Length() * 2 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3504
    CleanupStack::PushL( dataBuf8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3505
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3506
    TPtr8 ptrDisplayName8 = dataBuf8->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3507
    ptrDisplayName8 = ConvertTo8LC( ptrDisplayName );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3508
    aObject.InsertL( aObject.Size(), ptrDisplayName8 );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3509
    CleanupStack::PopAndDestroy( 3 );//dataBuf, ConvertTo8LC
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3510
    _DBG_FILE("CNSmlDMSettingsAdapter12::GetProfileNameL(): end");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3511
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3512
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3513
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3514
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3515
//	CNSmlDMSettingsAdapter12::GetProfileUserNameL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3516
//	Gets the profile user name value.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3517
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3518
void CNSmlDMSettingsAdapter12::GetProfileUserNameL( CBufBase& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3519
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3520
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileUserNameL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3521
    HBufC8* dataBuf = iProfile.UserName().AllocL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3522
    CleanupStack::PushL( dataBuf );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3523
    TPtr8 ptrUserName = dataBuf->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3524
    aObject.InsertL( aObject.Size(), ptrUserName );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3525
    CleanupStack::PopAndDestroy();//dataBuf
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3526
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileUserNameL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3527
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3528
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3529
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3530
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3531
//	CNSmlDMSettingsAdapter12::GetProfilePortNumberL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3532
//	Gets the port number value.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3533
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3534
void CNSmlDMSettingsAdapter12::GetProfilePortNumberL( CBufBase& aObject )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3535
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3536
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfilePortNumberL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3537
    TInt bSize = aObject.Size();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3538
    TInt portNum = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3539
    HBufC8* bufStorage = HBufC8::NewLC( bSize );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3540
	TPtr8 bufStoragePtr = bufStorage->Des();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3541
	aObject.Read( 0, bufStoragePtr, aObject.Size() );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3542
	aObject.Reset();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3543
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3544
    //find out the port number
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3545
    ParseUri( *bufStorage, portNum );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3546
	aObject.InsertL( aObject.Size(), SetIntObjectLC( portNum ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3547
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3548
    CleanupStack::PopAndDestroy( 2 ); //bufStorage, SetIntObjectLC()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3549
    _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfilePortNumberL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3550
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3551
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3552
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3553
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3554
//  CNSmlDMSettingsAdapter12::SetAuthInfoL
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3555
//  The function checks if authinfo already exits. If exits command is replace.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3556
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3557
void CNSmlDMSettingsAdapter12::SetAuthInfoL( const TInt aLUID, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3558
                                            const TNSmlDMProfileData aField, 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3559
                                            const TDesC8& aObject, TInt& aStatus )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3560
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3561
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetAuthInfoL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3562
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3563
    CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3564
    CleanupStack::PushL( authInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3565
    authInfo->iProfileId = aLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3566
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3567
    iPrivateApi.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3568
    TRAPD( err, iPrivateApi.GetDMAuthInfoL( *authInfo ) );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3569
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3570
    if ( err )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3571
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3572
        CleanupStack::PopAndDestroy( authInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3573
        iPrivateApi.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3574
        aStatus = err;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3575
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3576
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3577
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3578
    CNSmlDMAuthInfo* newAuthInfo = new (ELeave) CNSmlDMAuthInfo();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3579
    CleanupStack::PushL( newAuthInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3580
    newAuthInfo->iProfileId = aLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3581
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3582
    if ( aField == EServerNonce )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3583
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3584
        newAuthInfo->iServerNonce = aObject.Alloc();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3585
        newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3586
        newAuthInfo->iAuthPref = authInfo->iAuthPref;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3587
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3588
        iPrivateApi.SetDMAuthInfoL( *newAuthInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3589
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3590
    else if ( aField == EClientNonce )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3591
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3592
        newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3593
        newAuthInfo->iClientNonce = aObject.Alloc();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3594
        newAuthInfo->iAuthPref = authInfo->iAuthPref;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3595
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3596
        iPrivateApi.SetDMAuthInfoL( *newAuthInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3597
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3598
    else if ( aField == EAuthenticationRequired )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3599
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3600
        if ( aObject.Match( KNSmlDMAuthPrefNoAuth ) !=  KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3601
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3602
            newAuthInfo->iAuthPref = ENoAuth;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3603
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3604
        else if ( aObject.Match( KNSmlDMAuthPrefBasic ) !=  KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3605
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3606
            newAuthInfo->iAuthPref = EBasic;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3607
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3608
        else if ( aObject.Match( KNSmlDMAuthPrefMD5 ) !=  KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3609
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3610
            newAuthInfo->iAuthPref = EMD5;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3611
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3612
        newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3613
        newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3614
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3615
        iPrivateApi.SetDMAuthInfoL( *newAuthInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3616
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3617
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3618
    CleanupStack::PopAndDestroy( newAuthInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3619
    CleanupStack::PopAndDestroy( authInfo );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3620
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3621
    iPrivateApi.Close();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3622
    aStatus = KErrNone;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3623
    _DBG_FILE( "CNSmlDMSettingsAdapter12::SetAuthInfoL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3624
    return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3625
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3626
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3627
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3628
// CNSmlDMSettingsAdapter12::AddNodeBufferL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3629
// Buffers Node Object
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3630
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3631
void CNSmlDMSettingsAdapter12::AddNodeBufferL( const TDesC8& aURI,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3632
		const TInt aStatusRef)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3633
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3634
	_DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3635
	TInt index = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3636
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3637
	for (TInt i = 0; i<iBuffer->Count (); i++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3638
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3639
		if ( iBuffer->At(i).iMappingName->Compare (aURI)== 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3640
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3641
			index = i;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3642
			//CallBack for duplicate
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3643
			_DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): EAlreadyExists end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3644
			iCallBack->SetStatusL ( aStatusRef, CSmlDmAdapter::EAlreadyExists);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3645
			break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3646
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3647
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3648
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3649
	if ( index<0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3650
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3651
		TNSmlDMBufferElement newNode;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3652
		newNode.iMappingName = aURI.AllocLC ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3653
		newNode.iLeafBuf = new (ELeave) CArrayFixFlat <TNSmlDMLeafElement> (4);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3654
		newNode.iExecuted = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3655
		newNode.iDMBuffStatusref = aStatusRef;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3656
		newNode.iAddr = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3657
		newNode.iServerId = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3658
		newNode.iUName = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3659
		newNode.iServerName = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3660
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3661
		iBuffer->AppendL (newNode);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3662
		//newNode.iMappingName
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3663
		CleanupStack::Pop ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3664
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3665
	_DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3666
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3667
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3668
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3669
// CNSmlDMSettingsAdapter12::AddLeafBufferL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3670
// Buffers Leaf Obj & checks for Mandatory fields
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3671
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3672
void CNSmlDMSettingsAdapter12::AddLeafBufferL( const TDesC8& aURI,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3673
		const TDesC8& aObject, const TInt aStatusRef)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3674
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3675
	_DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafBufferL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3676
	TNSmlDMLeafElement newCommand;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3677
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3678
	newCommand.iUri = aURI.AllocLC ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3679
	newCommand.iData = aObject.AllocLC ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3680
	newCommand.iLuid = HBufC8::NewLC (8); //Allocate Mem. for iLUID
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3681
	newCommand.iStatusRef = aStatusRef;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3682
	//Add Leaf to the index updated by UpdateLeafObj
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3683
	iBuffer->At(iExecutionIndex).iLeafBuf->AppendL (newCommand);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3684
	// iUri, iData, ILuid
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3685
	CleanupStack::Pop (3);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3686
	SetField ( aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3687
	SetURIInProcessL ( aURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3688
	if ( iField->Compare (KNSmlDdfAddr)== 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3689
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3690
		iBuffer->At(iExecutionIndex).iAddr = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3691
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3692
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3693
		if ( iField->Compare (KNSmlDdfServerId)== 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3694
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3695
			if(!IsServerIDExistL(aObject))
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3696
				iBuffer->At(iExecutionIndex).iServerId = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3697
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3698
		else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3699
			if ( iField->Compare (KNSmlDdfAAuthName)== 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3700
				{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3701
				//AAuthName under AppAuthCli
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3702
				if ( iURIField->Find (KDmAccAppAuthDyn2)!= KErrNotFound)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3703
					iBuffer->At(iExecutionIndex).iUName = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3704
				}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3705
			else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3706
				if ( iField->Compare (KNSmlDdfName)== 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3707
					{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3708
					iBuffer->At(iExecutionIndex).iServerName = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3709
					}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3710
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3711
	//  If Address,ServerId,ServerName,UserName then Add
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3712
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3713
	if ( iBuffer->At(iExecutionIndex).iAddr && iBuffer->At(iExecutionIndex).iServerId &&iBuffer->At(iExecutionIndex).iUName && iBuffer->At(iExecutionIndex).iServerName)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3714
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3715
		ExecuteBufferL ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3716
		iExecutionIndex = -1;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3717
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3718
	_DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafBufferL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3719
	return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3720
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3721
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3722
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3723
// CNSmlDMSettingsAdapter12::ExecuteBufferL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3724
// Adds the Node/Leaf obj to the db
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3725
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3726
void CNSmlDMSettingsAdapter12::ExecuteBufferL()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3727
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3728
	_DBG_FILE( "CNSmlDMSettingsAdapter12::ExecuteBufferL(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3729
	TBuf8<8> newLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3730
	TInt rValue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3731
	//Buffer is being Executed
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3732
	iBufOn = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3733
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3734
	// Robustness check for Execution Index
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3735
	if ( iExecutionIndex<0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3736
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3737
		return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3738
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3739
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3740
	//Execute BufferL is called from CompleteOutstandingCmdsL only when -
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3741
	//mandatory fields are not set. Dont update Node/Leaf to the db, return a failure
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3742
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3743
	if ( !iComplete)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3744
		rValue = CreateNewProfileL (iLUID);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3745
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3746
		rValue = CSmlDmAdapter::EError;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3747
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3748
	iBuffer->At(iExecutionIndex).iExecuted = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3749
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3750
	if ( rValue != KErrNone)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3751
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3752
		if ( rValue == KErrNoMemory)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3753
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3754
			iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::ENoMemory);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3755
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3756
		else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3757
			if ( rValue == KErrNotSupported)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3758
				{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3759
				iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3760
						CSmlDmAdapter::EInvalidObject);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3761
				}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3762
			else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3763
				if ( rValue == KErrInUse)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3764
					{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3765
					iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3766
							CSmlDmAdapter::EObjectInUse);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3767
					}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3768
				else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3769
					if ( rValue == KErrDiskFull)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3770
						{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3771
						iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3772
								CSmlDmAdapter::EDiskFull);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3773
						}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3774
					else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3775
						{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3776
						iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3777
								CSmlDmAdapter::EError);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3778
						}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3779
		// dont return, UpdateLeafObjectL will update the callback status for leaf Nodes 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3780
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3781
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3782
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3783
		if ( iLUID >= KMaxDataSyncID)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3784
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3785
			newLUID.Num ( iLUID - KMaxDataSyncID);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3786
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3787
		else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3788
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3789
			newLUID.Num ( iLUID);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3790
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3791
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3792
		iCallBack->SetMappingL ( *iBuffer->At(iExecutionIndex).iMappingName, newLUID);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3793
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3794
		iCallBack->SetStatusL (iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::EOk);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3795
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3796
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3797
	for (TInt val= 0; val < iBuffer->At(iExecutionIndex).iLeafBuf->Count ();val++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3798
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3799
		//Update the LUID data in the Leaf structure with the Profile LUID before calling UpdateLeafObj
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3800
		TPtr8 tempLUID(iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid->Des ());
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3801
		tempLUID.Append (newLUID);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3802
		UpdateLeafObjectL (*iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iUri, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iData, *iBuffer->At(iExecutionIndex).iMappingName, iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iStatusRef);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3803
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3804
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3805
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3806
	// Delete the dynamically allocated buffers (Node/Leaf obj)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3807
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3808
	ClearBuffer ( iBuffer->At(iExecutionIndex).iLeafBuf);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3809
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3810
	delete iBuffer->At(iExecutionIndex).iLeafBuf;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3811
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3812
	if ( iBuffer->At(iExecutionIndex).iMappingName)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3813
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3814
		delete iBuffer->At(iExecutionIndex).iMappingName;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3815
		iBuffer->At(iExecutionIndex).iMappingName = NULL;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3816
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3817
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3818
	iBuffer->Delete (iExecutionIndex);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3819
	iBuffer->Compress ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3820
	//Buffer Execution Complete
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3821
	iBufOn = EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3822
    _DBG_FILE( "CNSmlDMSettingsAdapter12::ExecuteBufferL(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3823
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3824
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3825
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3826
// TPtrC8 CNSmlDMSettingsAdapter12::ParentURI(const TDesC8& aURI)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3827
// returns parent uri 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3828
// Searches till the 2nd "/" is reached
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3829
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3830
TPtrC8 CNSmlDMSettingsAdapter12::ParentURI(const TDesC8& aURI)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3831
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3832
	_DBG_FILE( "CNSmlDMSettingsAdapter12::ParentURI(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3833
	TInt count;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3834
	TInt flag = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3835
	for (count=0; count<=aURI.Length ()-1;count++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3836
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3837
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3838
		if ( aURI[count]=='/')
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3839
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3840
			flag++;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3841
			if ( flag == KDynNodePosn)   // KDynNodePosn =2 --> DMAcc/DMIDxxx
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3842
				break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3843
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3844
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3845
        _DBG_FILE( "CNSmlDMSettingsAdapter12::ParentURI(): end" ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3846
	return aURI.Left (count);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3847
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3848
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3849
//-----------------------------------------------------------------------------------------    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3850
// Clears the elements of the passed in LeafElement Structure
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3851
//-----------------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3852
void CNSmlDMSettingsAdapter12::ClearBuffer(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3853
		CArrayFixFlat<TNSmlDMLeafElement>* aBuffer)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3854
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3855
	_DBG_FILE( "CNSmlDMSettingsAdapter12::ClearBuffer(): begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3856
	for (TInt i = 0; i < aBuffer->Count (); i++)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3857
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3858
		delete aBuffer->At(i).iUri;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3859
		aBuffer->At(i).iUri = NULL;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3860
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3861
		delete aBuffer->At(i).iData;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3862
		aBuffer->At(i).iData = NULL;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3863
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3864
		delete aBuffer->At(i).iLuid;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3865
		aBuffer->At(i).iLuid = NULL;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3866
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3867
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3868
	aBuffer->Reset ();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3869
	_DBG_FILE( "CNSmlDMSettingsAdapter12::ClearBuffer(): end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3870
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3871
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3872
//--------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3873
//TInt CNSmlDMSettingsAdapter::IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3874
//
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3875
//-------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3876
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3877
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3878
TBool CNSmlDMSettingsAdapter12::IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3879
{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3880
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3881
	// include strings for  tree for Bearer , DNS related Dynamic nodes . 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3882
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3883
	if(aURI.Match(_L8("DMAcc/DMId*"))   != KErrNotFound )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3884
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3885
		return ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3886
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3887
	else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3888
	{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3889
		return EFalse;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3890
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3891
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3892
	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3893
}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3894
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3895
//--------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3896
//TInt CNSmlDMSettingsAdapter::ConstructTreeL(const TDesC8& aURI)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3897
//
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3898
//-------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3899
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3900
TInt CNSmlDMSettingsAdapter12::ConstructTreeL(const TDesC8& aURI)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3901
{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3902
		TInt profileID = KErrNotFound;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3903
		_LIT8( KNSmlDMIdZero,			"DMAcc/DMId000" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3904
		TBuf8<20> zeroURI; // DMAcc/DMIdnnn , nnn = profileid
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3905
		zeroURI.Append( KNSmlDMIdZero );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3906
		HBufC8* ismapInfo = iCallBack->GetLuidAllocL(zeroURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3907
		if (ismapInfo->Length() != 0) // Tree is already constructrd, no need to proceed.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3908
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3909
			delete ismapInfo;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3910
			return profileID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3911
		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3912
	  if( iSyncSessionOpen == EFalse )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3913
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3914
    	iSyncSession.OpenL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3915
      iSyncSessionOpen = ETrue;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3916
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3917
    RArray<TSmlProfileId> profileIdArray;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3918
    CleanupClosePushL( profileIdArray );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3919
    TSmlUsageType usageType = ESmlDevMan;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3920
    iSyncSession.ListProfilesL( profileIdArray, usageType );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3921
	   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3922
    for( TInt p = 0; p < profileIdArray.Count(); p++ )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3923
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3924
      TInt ddId = profileIdArray[p] - KMaxDataSyncID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3925
           
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3926
		  _LIT8( Kprev, "DMId" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3927
		  TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3928
      TInt fixedProfId = profileIdArray[p] - KMaxDataSyncID; //fit to 3 decimal
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3929
		  addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3930
   		DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3931
		  // KNSmlDMStart includes start text for URISeg
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3932
			TBuf8<20> addURI; // DMAcc/DMIdnnn , nnn = profileid
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3933
			addURI.Append( KNSmlDMStart );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3934
			addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3935
			TBuf8<3> addLUID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3936
	    addLUID.Num( fixedProfId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3937
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3938
			HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3939
					
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3940
			if (mapInfo->Length() == 0)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3941
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3942
				iCallBack->SetMappingL(addURI,addLUID);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3943
				if( aURI.Find(addURI) >= 0 )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3944
        { 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3945
         	profileID = fixedProfId;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3946
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3947
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3948
			else
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3949
			{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3950
				delete mapInfo;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3951
			}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3952
 		}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3953
	    	
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3954
    CleanupStack::PopAndDestroy( 1 );//profileIdArray
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3955
    return profileID;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3956
}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3957
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3958
// ========================== OTHER EXPORTED FUNCTIONS =========================
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3959
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3960
#ifndef IMPLEMENTATION_PROXY_ENTRY
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3961
#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr)	{{aUid},(aFuncPtr)}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3962
#endif
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3963
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3964
const TImplementationProxy ImplementationTable[] = 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3965
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3966
		IMPLEMENTATION_PROXY_ENTRY( KNSmlDMSettingsAdapterImplUid, CNSmlDMSettingsAdapter12::NewL )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3967
    };
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3968
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3969
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3970
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3971
// TImplementationProxy* ImplementationGroupProxy()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3972
// -----------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3973
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3974
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3975
	_DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: begin" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3976
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3977
    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3978
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3979
	_DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: end" );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3980
    return ImplementationTable;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3981
	}
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3982
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3983
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3984
// TPtrC8 CNSmlDMSettingsAdapter12::GetDynamicDMNodeUri( const TDesC8& aURI )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3985
// returns DM/xxx URI
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3986
//------------------------------------------------------------------------------
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3987
TPtrC8 CNSmlDMSettingsAdapter12::GetDynamicDMNodeUri(const TDesC8& aURI)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3988
    {    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3989
    TInt i= 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3990
	TBuf8<50> DmAccRoot(KNSmlDefDMAcc);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3991
    for ( i = aURI.Find( KNSmlDefDMAcc ) + DmAccRoot.Length() + 1; i < aURI.Length(); i++ )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3992
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3993
        if( aURI[i] == '/' )
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3994
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3995
            break;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3996
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3997
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3998
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  3999
    return aURI.Left( i );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  4000
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  4001
// End of File
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
  4002