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