58
|
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 browser Adapter
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
//INCLUDE FILES
|
|
23 |
#include <implementationproxy.h> // For TImplementationProxy definition
|
|
24 |
#include "nsmldmimpluids.h"
|
|
25 |
|
|
26 |
|
|
27 |
#include "nsmldebug.h"
|
|
28 |
#include "nsmlconstants.h"
|
|
29 |
#include "nsmldmconst.h"
|
|
30 |
#include "nsmlbrowseradapter.h"
|
|
31 |
#include "nsmldmiapmatcher.h"
|
|
32 |
|
|
33 |
#include <centralrepository.h>
|
|
34 |
#include <browseruisdkcrkeys.h>
|
|
35 |
#include <commdb.h>
|
|
36 |
#include <cdbcols.h> // CommsDB columname defs
|
|
37 |
#include <ApUtils.h>
|
|
38 |
|
|
39 |
#ifndef __WINS__
|
|
40 |
// This lowers the unnecessary compiler warning (armv5) to remark.
|
|
41 |
// "Warning: #174-D: expression has no effect..." is caused by
|
|
42 |
// DBG_ARGS8 macro in no-debug builds.
|
|
43 |
#pragma diag_remark 174
|
|
44 |
#endif
|
|
45 |
const TInt KUserDefined = 0;
|
|
46 |
|
|
47 |
|
|
48 |
const TUint KNSmlDMBrowserAdapterImplUid = 0x1028335F;
|
|
49 |
|
|
50 |
|
|
51 |
// -----------------------------------------------------------------------------
|
|
52 |
// CNSmlDmBrowserAdapter* CNSmlDmBrowserAdapter::NewL( )
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
CNSmlDmBrowserAdapter* CNSmlDmBrowserAdapter::NewL(MSmlDmCallback* aDmCallback )
|
|
55 |
{
|
|
56 |
_DBG_FILE("CNSmlDmBrowserAdapter::NewL(): begin");
|
|
57 |
CNSmlDmBrowserAdapter* self = NewLC( aDmCallback );
|
|
58 |
CleanupStack::Pop();
|
|
59 |
_DBG_FILE("CNSmlDmBrowserAdapter::NewL(): end");
|
|
60 |
return self;
|
|
61 |
}
|
|
62 |
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
// CNSmlDmBrowserAdapter* CNSmlDmBrowserAdapter::NewLC( )
|
|
65 |
// -----------------------------------------------------------------------------
|
|
66 |
CNSmlDmBrowserAdapter* CNSmlDmBrowserAdapter::NewLC(MSmlDmCallback* aDmCallback )
|
|
67 |
{
|
|
68 |
_DBG_FILE("CNSmlDmBrowserAdapter::NewLC(): begin");
|
|
69 |
CNSmlDmBrowserAdapter* self = new (ELeave) CNSmlDmBrowserAdapter(aDmCallback);
|
|
70 |
CleanupStack::PushL(self);
|
|
71 |
self->iDmCallback = aDmCallback;
|
|
72 |
_DBG_FILE("CNSmlDmBrowserAdapter::NewLC(): end");
|
|
73 |
return self;
|
|
74 |
}
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
// CNSmlDmBrowserAdapter::~CNSmlDmBrowserAdapter()
|
|
80 |
// -----------------------------------------------------------------------------
|
|
81 |
CNSmlDmBrowserAdapter::~CNSmlDmBrowserAdapter()
|
|
82 |
{
|
|
83 |
_DBG_FILE("CNSmlDmBrowserAdapter::~CNSmlDmBrowserAdapter(): begin");
|
|
84 |
_DBG_FILE("CNSmlDmBrowserAdapter::~CNSmlDmBrowserAdapter(): end");
|
|
85 |
}
|
|
86 |
|
|
87 |
// -----------------------------------------------------------------------------
|
|
88 |
// CNSmlDmBrowserAdapter::CNSmlDmBrowserAdapter()
|
|
89 |
// -----------------------------------------------------------------------------
|
|
90 |
|
|
91 |
CNSmlDmBrowserAdapter::CNSmlDmBrowserAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments)
|
|
92 |
{
|
|
93 |
_DBG_FILE("CNSmlDmBrowserAdapter::CNSmlDmBrowserAdapter(aEcomArguments): begin");
|
|
94 |
_DBG_FILE("CNSmlDmBrowserAdapter::CNSmlDmBrowserAdapter(aEcomArguments): end");
|
|
95 |
}
|
|
96 |
|
|
97 |
// -----------------------------------------------------------------------------
|
|
98 |
// CNSmlDmBrowserAdapter::SetLeafPropertiesL()
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
void CNSmlDmBrowserAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject,
|
|
101 |
const TSmlDmAccessTypes& aAccessTypes,
|
|
102 |
const TDesC8& aDescription ) const
|
|
103 |
{
|
|
104 |
aObject.SetAccessTypesL( aAccessTypes );
|
|
105 |
aObject.SetScopeL( MSmlDmDDFObject::EPermanent );
|
|
106 |
aObject.SetDFFormatL( MSmlDmDDFObject::EChr );
|
|
107 |
aObject.AddDFTypeMimeTypeL( KNSmlDMBrowserAdapterTextPlain );
|
|
108 |
aObject.SetDescriptionL( aDescription );
|
|
109 |
}
|
|
110 |
|
|
111 |
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
// CNSmlDmBrowserAdapter::DDFVersionL()
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
void CNSmlDmBrowserAdapter::DDFVersionL(CBufBase& aDDFVersion)
|
|
116 |
{
|
|
117 |
_DBG_FILE("CNSmlDmBrowserAdapter::DDFVersionL(TDes& aDDFVersion): begin");
|
|
118 |
aDDFVersion.InsertL(0,KNSmlDMBrowserAdapterDDFVersion);
|
|
119 |
_DBG_FILE("CNSmlDmBrowserAdapter::DDFVersionL(TDes& aDDFVersion): end");
|
|
120 |
}
|
|
121 |
|
|
122 |
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
// CNSmlDmBrowserAdapter::DDFStructureL()
|
|
125 |
//
|
|
126 |
// -----------------------------------------------------------------------------
|
|
127 |
void CNSmlDmBrowserAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
|
|
128 |
{
|
|
129 |
_DBG_FILE("CNSmlDmBrowserAdapter::DDFStructureL(): begin");
|
|
130 |
|
|
131 |
TSmlDmAccessTypes accessTypes;
|
|
132 |
accessTypes.SetGet();
|
|
133 |
|
|
134 |
TSmlDmAccessTypes accessSetTypes;
|
|
135 |
accessSetTypes.SetGet();
|
|
136 |
accessSetTypes.SetAdd();
|
|
137 |
accessSetTypes.SetReplace();
|
|
138 |
|
|
139 |
MSmlDmDDFObject& dmBrowserAdap = aDDF.AddChildObjectL( KNSmlDMBrowserAdapterNodeName );
|
|
140 |
dmBrowserAdap.SetAccessTypesL( accessTypes );
|
|
141 |
dmBrowserAdap.SetScopeL( MSmlDmDDFObject::EPermanent );
|
|
142 |
dmBrowserAdap.SetDescriptionL( KNSmlDMBrowserAdapterDescription );
|
|
143 |
|
|
144 |
MSmlDmDDFObject& toNapID = dmBrowserAdap.AddChildObjectL(KNSmlDMBrowserAdapterAPNode);
|
|
145 |
toNapID.SetAccessTypesL( accessSetTypes );
|
|
146 |
toNapID.SetScopeL( MSmlDmDDFObject::EDynamic );
|
|
147 |
toNapID.SetDFFormatL( MSmlDmDDFObject::EChr );
|
|
148 |
toNapID.AddDFTypeMimeTypeL( KNSmlDMBrowserAdapterTextPlain );
|
|
149 |
toNapID.SetDescriptionL( KNSmlDMBrowserAdapterAPNodeDescription );
|
|
150 |
|
|
151 |
MSmlDmDDFObject& startpageURL = dmBrowserAdap.AddChildObjectL(KNSmlDMBrowserAdapterStartpageURL);
|
|
152 |
startpageURL.SetAccessTypesL( accessSetTypes );
|
|
153 |
startpageURL.SetScopeL( MSmlDmDDFObject::EPermanent );
|
|
154 |
startpageURL.SetDFFormatL( MSmlDmDDFObject::EChr );
|
|
155 |
startpageURL.AddDFTypeMimeTypeL( KNSmlDMBrowserAdapterTextPlain );
|
|
156 |
startpageURL.SetDescriptionL( KNSmlDMBrowserStartpageURLDescription );
|
|
157 |
_DBG_FILE("CNSmlDmBrowserAdapter::DDFStructureL(): end");
|
|
158 |
}
|
|
159 |
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
// CNSmlDmBrowserAdapter::UpdateLeafObjectL()
|
|
162 |
// -----------------------------------------------------------------------------
|
|
163 |
void CNSmlDmBrowserAdapter::UpdateLeafObjectL( const TDesC8& aURI,
|
|
164 |
const TDesC8& aLUID,
|
|
165 |
const TDesC8& aObject,
|
|
166 |
const TDesC8& aType,
|
|
167 |
const TInt aStatusRef )
|
|
168 |
{
|
|
169 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): begin");
|
|
170 |
|
|
171 |
CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
|
|
172 |
TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
|
|
173 |
if ( ret == KErrNotFound )
|
|
174 |
{
|
|
175 |
retValue = CSmlDmAdapter::EError;
|
|
176 |
iDmCallback->SetStatusL( aStatusRef, retValue );
|
|
177 |
}
|
|
178 |
else
|
|
179 |
{
|
|
180 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
|
|
181 |
TInt len = aURI.Length() - (ret + 1);
|
|
182 |
TPtrC8 segment = aURI.Right( len );
|
|
183 |
|
|
184 |
DBG_ARGS8(_S8(" Value being set URI - <%S> <%S> "), &aURI, &aObject );
|
|
185 |
|
|
186 |
if (segment == KNSmlDMBrowserAdapterAPNode )
|
|
187 |
{
|
|
188 |
// Get IAP ID and then set the browser setting
|
|
189 |
TInt err = KErrNone;
|
|
190 |
CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
|
|
191 |
CleanupStack::PushL(iapmatch);
|
|
192 |
|
|
193 |
TInt iap = iapmatch->IAPIdFromURIL( aObject );
|
|
194 |
|
|
195 |
CleanupStack::PopAndDestroy(); // iapmatch
|
|
196 |
|
|
197 |
if ( iap != KErrNotFound )
|
|
198 |
{
|
|
199 |
CCommsDatabase* commDb = CCommsDatabase::NewL();
|
|
200 |
CleanupStack::PushL(commDb);
|
|
201 |
CApUtils* aputils = CApUtils::NewLC(*commDb);
|
|
202 |
TRAP(err, iap = aputils->WapIdFromIapIdL( iap ) );
|
|
203 |
DBG_ARGS(_S("IAP = %d"), iap);
|
|
204 |
|
|
205 |
CleanupStack::PopAndDestroy(2); //commdb,aputils
|
|
206 |
|
|
207 |
if( err == KErrNone)
|
|
208 |
{
|
|
209 |
CRepository* repository = CRepository::NewLC( KCRUidBrowser );
|
|
210 |
|
|
211 |
// Force the browser to use the User Defined AP selection mode.
|
|
212 |
User::LeaveIfError( repository->Set( KBrowserAccessPointSelectionMode,
|
|
213 |
KUserDefined ) );
|
|
214 |
// This sets the accesspoint default for browser.
|
|
215 |
User::LeaveIfError( repository->Set( KBrowserDefaultAccessPoint,
|
|
216 |
iap ) );
|
|
217 |
CleanupStack::PopAndDestroy(); // repository
|
|
218 |
|
|
219 |
}
|
|
220 |
else
|
|
221 |
{
|
|
222 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): \
|
|
223 |
err!=KErrNone");
|
|
224 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
|
|
225 |
|
|
226 |
}
|
|
227 |
}
|
|
228 |
else
|
|
229 |
{
|
|
230 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): status = \
|
|
231 |
CSmlDmAdapter::EInvalidObject");
|
|
232 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
|
|
233 |
}
|
|
234 |
}
|
|
235 |
else if(segment == KNSmlDMBrowserAdapterStartpageURL )
|
|
236 |
{
|
|
237 |
// To Get the Browser Start page URL
|
|
238 |
TBuf<KMaxLengthStartpageName> aBuf;
|
|
239 |
TInt aErr;
|
|
240 |
aBuf.Zero();
|
|
241 |
aBuf.Copy(aObject);
|
|
242 |
|
|
243 |
if(aBuf.Length() == 0 || aBuf.Length() > KMaxLengthStartpageName)
|
|
244 |
{
|
|
245 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): Error Zero Length String");
|
|
246 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
|
|
247 |
return;
|
|
248 |
}
|
|
249 |
|
|
250 |
|
|
251 |
CRepository* repository = CRepository::NewLC( KCRUidBrowser );
|
|
252 |
|
|
253 |
if(repository)
|
|
254 |
{
|
|
255 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): Before Set for StartPage");
|
|
256 |
User::LeaveIfError( aErr = repository->Set( KBrowserNGStartpageURL,aBuf));
|
|
257 |
if(aErr != KErrNone)
|
|
258 |
{
|
|
259 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): Error in Cenrep Set");
|
|
260 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
|
|
261 |
return;
|
|
262 |
}
|
|
263 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): Before Set for StartPageType");
|
|
264 |
User::LeaveIfError( aErr = repository->Set( KBrowserNGHomepageType,KBrowserHomePageUDefined));
|
|
265 |
if(aErr != KErrNone)
|
|
266 |
{
|
|
267 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): Error in Cenrep Set");
|
|
268 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
|
|
269 |
return;
|
|
270 |
}
|
|
271 |
|
|
272 |
}
|
|
273 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): Before Setting status to OK");
|
|
274 |
CleanupStack::PopAndDestroy(); // repository
|
|
275 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
|
|
276 |
|
|
277 |
}
|
|
278 |
else
|
|
279 |
{
|
|
280 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
|
|
281 |
}
|
|
282 |
}
|
|
283 |
|
|
284 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): end");
|
|
285 |
}
|
|
286 |
|
|
287 |
|
|
288 |
// -----------------------------------------------------------------------------
|
|
289 |
// CNSmlDmBrowserAdapter::DeleteObjectL()
|
|
290 |
// -----------------------------------------------------------------------------
|
|
291 |
void CNSmlDmBrowserAdapter::DeleteObjectL( const TDesC8& /*aURI*/,
|
|
292 |
const TDesC8& /*aLUID*/,
|
|
293 |
const TInt aStatusRef )
|
|
294 |
{
|
|
295 |
_DBG_FILE("CNSmlDmBrowserAdapter::DeleteLeafObjectL( ): begin");
|
|
296 |
_DBG_FILE("CNSmlDmBrowserAdapter::DeleteLeafObjectL( ): end");
|
|
297 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
|
|
298 |
}
|
|
299 |
|
|
300 |
|
|
301 |
// -----------------------------------------------------------------------------
|
|
302 |
// CNSmlDmBrowserAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
303 |
// const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef )
|
|
304 |
// -----------------------------------------------------------------------------
|
|
305 |
void CNSmlDmBrowserAdapter::FetchLeafObjectL( const TDesC8& aURI,
|
|
306 |
const TDesC8& /*aLUID*/,
|
|
307 |
const TDesC8& aType,
|
|
308 |
const TInt aResultsRef,
|
|
309 |
const TInt aStatusRef )
|
|
310 |
{
|
|
311 |
_DBG_FILE("CNSmlDmBrowserAdapter::FetchLeafObjectL(): begin");
|
|
312 |
|
|
313 |
CBufBase *object = CBufFlat::NewL( 1 );
|
|
314 |
CleanupStack::PushL( object );
|
|
315 |
|
|
316 |
CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
|
|
317 |
|
|
318 |
iDmCallback->SetStatusL( aStatusRef, retValue );
|
|
319 |
iDmCallback->SetResultsL( aResultsRef, *object, aType );
|
|
320 |
CleanupStack::PopAndDestroy(); //object
|
|
321 |
_DBG_FILE("CNSmlDmDevInfoAdapt+er::FetchLeafObjectL(): end");
|
|
322 |
}
|
|
323 |
|
|
324 |
|
|
325 |
// -----------------------------------------------------------------------------
|
|
326 |
// CNSmlDmBrowserAdapter::ChildURIListL( const TDesC& aURI,
|
|
327 |
// const TDesC& aParentLUID, const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
|
|
328 |
// const TInt aResultsRef, const TInt aStatusRef )
|
|
329 |
// -----------------------------------------------------------------------------
|
|
330 |
void CNSmlDmBrowserAdapter::ChildURIListL( const TDesC8& aURI,
|
|
331 |
const TDesC8& /*aParentLUID*/,
|
|
332 |
const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/,
|
|
333 |
const TInt aResultsRef,
|
|
334 |
const TInt aStatusRef )
|
|
335 |
{
|
|
336 |
_DBG_FILE("CNSmlDmBrowserAdapter::ChildURIListL(): begin");
|
|
337 |
CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
|
|
338 |
CBufBase* currentURISegmentList = CBufFlat::NewL( 1 );
|
|
339 |
CleanupStack::PushL( currentURISegmentList );
|
|
340 |
TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
|
|
341 |
if ( ret == KErrNotFound )
|
|
342 |
{
|
|
343 |
ret = -1;
|
|
344 |
}
|
|
345 |
TInt len = aURI.Length() - ( ret + 1 );
|
|
346 |
TPtrC8 segment = aURI.Right( len );
|
|
347 |
|
|
348 |
if ( segment == KNSmlDMBrowserAdapterNodeName )
|
|
349 |
{
|
|
350 |
currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMBrowserAdapterBrowserNodes() );
|
|
351 |
}
|
|
352 |
|
|
353 |
else
|
|
354 |
{
|
|
355 |
retValue = CSmlDmAdapter::EError;
|
|
356 |
}
|
|
357 |
iDmCallback->SetStatusL( aStatusRef, retValue );
|
|
358 |
iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
|
|
359 |
CleanupStack::PopAndDestroy(); //currentURISegmentList
|
|
360 |
_DBG_FILE("CNSmlDmBrowserAdapter::ChildURIListL(): end");
|
|
361 |
}
|
|
362 |
|
|
363 |
|
|
364 |
// -----------------------------------------------------------------------------
|
|
365 |
// CNSmlDmBrowserAdapter::AddNodeObjectL( const TDesC8& aURI,
|
|
366 |
// const TDesC8& aParentLUID, const TInt aStatusRef )
|
|
367 |
// -----------------------------------------------------------------------------
|
|
368 |
void CNSmlDmBrowserAdapter::AddNodeObjectL( const TDesC8& /*aURI*/,
|
|
369 |
const TDesC8& /*aParentLUID*/,
|
|
370 |
const TInt aStatusRef )
|
|
371 |
{
|
|
372 |
_DBG_FILE("CNSmlDmBrowserAdapter::AddNodeObjectL(): begin");
|
|
373 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
|
|
374 |
_DBG_FILE("CNSmlDmBrowserAdapter::AddNodeObjectL(): end");
|
|
375 |
}
|
|
376 |
|
|
377 |
// -----------------------------------------------------------------------------
|
|
378 |
// CNSmlDmBrowserAdapter::UpdateLeafObjectL()
|
|
379 |
// -----------------------------------------------------------------------------
|
|
380 |
void CNSmlDmBrowserAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/,
|
|
381 |
const TDesC8& /*aLUID*/,
|
|
382 |
RWriteStream*& /*aStream*/,
|
|
383 |
const TDesC8& /*aType*/,
|
|
384 |
const TInt aStatusRef )
|
|
385 |
{
|
|
386 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): stream: begin");
|
|
387 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
|
|
388 |
_DBG_FILE("CNSmlDmBrowserAdapter::UpdateLeafObjectL(): stream: end");
|
|
389 |
}
|
|
390 |
|
|
391 |
|
|
392 |
// -----------------------------------------------------------------------------
|
|
393 |
// CNSmlDmBrowserAdapter::FetchLeafObjectSizeL( const TDesC8& aURI,
|
|
394 |
// const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef )
|
|
395 |
// -----------------------------------------------------------------------------
|
|
396 |
void CNSmlDmBrowserAdapter::FetchLeafObjectSizeL( const TDesC8& aURI,
|
|
397 |
const TDesC8& /*aLUID*/,
|
|
398 |
const TDesC8& aType,
|
|
399 |
const TInt aResultsRef,
|
|
400 |
const TInt aStatusRef )
|
|
401 |
{
|
|
402 |
|
|
403 |
_DBG_FILE("CNSmlDmBrowserAdapter::FetchLeafObjectSizeL(): begin");
|
|
404 |
|
|
405 |
CBufBase *object = CBufFlat::NewL( 1 );
|
|
406 |
CleanupStack::PushL( object );
|
|
407 |
CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
|
|
408 |
|
|
409 |
TInt objSizeInBytes = object->Size();
|
|
410 |
TBuf8<2> stringObjSizeInBytes;
|
|
411 |
stringObjSizeInBytes.Num( objSizeInBytes );
|
|
412 |
object->Reset();
|
|
413 |
object->InsertL( 0, stringObjSizeInBytes );
|
|
414 |
|
|
415 |
iDmCallback->SetStatusL( aStatusRef, retValue );
|
|
416 |
iDmCallback->SetResultsL( aResultsRef, *object, aType );
|
|
417 |
CleanupStack::PopAndDestroy(); //object
|
|
418 |
_DBG_FILE("CNSmlDmBrowserAdapter::FetchLeafObjectSizeL(): end");
|
|
419 |
}
|
|
420 |
|
|
421 |
|
|
422 |
// -----------------------------------------------------------------------------
|
|
423 |
// CNSmlDmBrowserAdapter::ExecuteCommandL( const TDesC8& aURI,
|
|
424 |
// const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef )
|
|
425 |
// -----------------------------------------------------------------------------
|
|
426 |
void CNSmlDmBrowserAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, const TDesC8& aType, const TInt aStatusRef )
|
|
427 |
{
|
|
428 |
_DBG_FILE("CNSmlDmBrowserAdapter::ExecuteCommandL(): begin");
|
|
429 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
|
|
430 |
_DBG_FILE("CNSmlDmBrowserAdapter::ExecuteCommandL(): end");
|
|
431 |
}
|
|
432 |
|
|
433 |
// -----------------------------------------------------------------------------
|
|
434 |
// CNSmlDmBrowserAdapter::ExecuteCommandL( const TDesC8& aURI,
|
|
435 |
// const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType,
|
|
436 |
// TInt aStatusRef )
|
|
437 |
// -----------------------------------------------------------------------------
|
|
438 |
void CNSmlDmBrowserAdapter::ExecuteCommandL( const TDesC8& /*aURI*/,
|
|
439 |
const TDesC8& /*aParentLUID*/,
|
|
440 |
RWriteStream*& /*aStream*/,
|
|
441 |
const TDesC8& /*aType*/,
|
|
442 |
const TInt aStatusRef )
|
|
443 |
{
|
|
444 |
_DBG_FILE("CNSmlDmBrowserAdapter::ExecuteCommandL(): stream: begin");
|
|
445 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
|
|
446 |
_DBG_FILE("CNSmlDmBrowserAdapter::ExecuteCommandL(): stream: end");
|
|
447 |
}
|
|
448 |
|
|
449 |
// -----------------------------------------------------------------------------
|
|
450 |
// CNSmlDmBrowserAdapter::CopyCommandL( const TDesC8& aTargetURI, const TDesC8&
|
|
451 |
// aSourceURI, const TDesC8& aSourceLUID, const TDesC8& /*aType*/, TInt aStatusRef )
|
|
452 |
// -----------------------------------------------------------------------------
|
|
453 |
void CNSmlDmBrowserAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8&
|
|
454 |
/*aTargetLUID*/, const TDesC8& /*aSourceURI*/,
|
|
455 |
const TDesC8& /*aSourceLUID*/,
|
|
456 |
const TDesC8& /*aType*/, TInt aStatusRef )
|
|
457 |
{
|
|
458 |
_DBG_FILE("CNSmlDmBrowserAdapter::CopyCommandL(): begin");
|
|
459 |
iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
|
|
460 |
_DBG_FILE("CNSmlDmBrowserAdapter::CopyCommandL(): end");
|
|
461 |
}
|
|
462 |
|
|
463 |
// --------------------------------------
|
|
464 |
// CNSmlDmBrowserAdapter::StartAtomicL()
|
|
465 |
// --------------------------------------
|
|
466 |
void CNSmlDmBrowserAdapter::StartAtomicL()
|
|
467 |
{
|
|
468 |
_DBG_FILE("CNSmlDmBrowserAdapter::StartAtomicL(): begin");
|
|
469 |
_DBG_FILE("CNSmlDmBrowserAdapter::StartAtomicL(): end");
|
|
470 |
}
|
|
471 |
|
|
472 |
// ---------------------------------------
|
|
473 |
// CNSmlDmBrowserAdapter::CommitAtomicL()
|
|
474 |
// ---------------------------------------
|
|
475 |
void CNSmlDmBrowserAdapter::CommitAtomicL()
|
|
476 |
{
|
|
477 |
_DBG_FILE("CNSmlDmBrowserAdapter::CommitAtomicL(): begin");
|
|
478 |
_DBG_FILE("CNSmlDmBrowserAdapter::CommitAtomicL(): end");
|
|
479 |
}
|
|
480 |
|
|
481 |
// -----------------------------------------
|
|
482 |
// CNSmlDmBrowserAdapter::RollbackAtomicL()
|
|
483 |
// -----------------------------------------
|
|
484 |
void CNSmlDmBrowserAdapter::RollbackAtomicL()
|
|
485 |
{
|
|
486 |
_DBG_FILE("CNSmlDmBrowserAdapter::RollbackAtomicL(): begin");
|
|
487 |
_DBG_FILE("CNSmlDmBrowserAdapter::RollbackAtomicL(): end");
|
|
488 |
}
|
|
489 |
|
|
490 |
// -----------------------------------------------------------
|
|
491 |
// CNSmlDmBrowserAdapter::StreamingSupport( TInt& aItemSize )
|
|
492 |
// -----------------------------------------------------------
|
|
493 |
TBool CNSmlDmBrowserAdapter::StreamingSupport( TInt& /*aItemSize*/ )
|
|
494 |
{
|
|
495 |
_DBG_FILE("CNSmlDmBrowserAdapter::StreamingSupport(): begin");
|
|
496 |
_DBG_FILE("CNSmlDmBrowserAdapter::StreamingSupport(): end");
|
|
497 |
return EFalse;
|
|
498 |
}
|
|
499 |
|
|
500 |
// ------------------------------------------
|
|
501 |
// CNSmlDmBrowserAdapter::StreamCommittedL()
|
|
502 |
// ------------------------------------------
|
|
503 |
void CNSmlDmBrowserAdapter::StreamCommittedL()
|
|
504 |
{
|
|
505 |
_DBG_FILE("CNSmlDmBrowserAdapter::StreamCommittedL(): begin");
|
|
506 |
_DBG_FILE("CNSmlDmBrowserAdapter::StreamCommittedL(): end");
|
|
507 |
}
|
|
508 |
|
|
509 |
// --------------------------------------------------
|
|
510 |
// CNSmlDmBrowserAdapter::CompleteOutstandingCmdsL()
|
|
511 |
// --------------------------------------------------
|
|
512 |
void CNSmlDmBrowserAdapter::CompleteOutstandingCmdsL()
|
|
513 |
{
|
|
514 |
_DBG_FILE("CNSmlDmBrowserAdapter::CompleteOutstandingCmdsL(): begin");
|
|
515 |
_DBG_FILE("CNSmlDmBrowserAdapter::CompleteOutstandingCmdsL(): end");
|
|
516 |
}
|
|
517 |
|
|
518 |
// -----------------------------------------------------------------------------
|
|
519 |
// CNSmlDmDevDetailAdapter::FetchLeafObjectL()
|
|
520 |
// -----------------------------------------------------------------------------
|
|
521 |
CSmlDmAdapter::TError CNSmlDmBrowserAdapter::FetchLeafObjectL( const TDesC8& aURI,
|
|
522 |
CBufBase& aObject )
|
|
523 |
{
|
|
524 |
_DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): begin");
|
|
525 |
CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
|
|
526 |
TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
|
|
527 |
TInt err = KErrNone;
|
|
528 |
if ( ret == KErrNotFound )
|
|
529 |
{
|
|
530 |
retValue = CSmlDmAdapter::EError;
|
|
531 |
}
|
|
532 |
else
|
|
533 |
{
|
|
534 |
TInt len = aURI.Length() - (ret + 1);
|
|
535 |
TPtrC8 segment = aURI.Right( len );
|
|
536 |
|
|
537 |
if(segment == KNSmlDMBrowserAdapterAPNode)
|
|
538 |
{
|
|
539 |
TInt iap ;
|
|
540 |
CRepository* repository = CRepository::NewLC( KCRUidBrowser );
|
|
541 |
|
|
542 |
// Force the browser to use the User Defined AP selection mode.
|
|
543 |
TInt selectionMode;
|
|
544 |
User::LeaveIfError( repository->Get( KBrowserAccessPointSelectionMode,
|
|
545 |
selectionMode ) );
|
|
546 |
if (selectionMode != KUserDefined)
|
|
547 |
{
|
|
548 |
retValue= CSmlDmAdapter::ENotFound;
|
|
549 |
|
|
550 |
CleanupStack::PopAndDestroy(); // repository
|
|
551 |
}
|
|
552 |
else
|
|
553 |
{
|
|
554 |
// This sets the accesspoint default for browser.
|
|
555 |
User::LeaveIfError( repository->Get( KBrowserDefaultAccessPoint,
|
|
556 |
iap ) );
|
|
557 |
CleanupStack::PopAndDestroy(); // repository
|
|
558 |
|
|
559 |
CCommsDatabase* commDb = CCommsDatabase::NewL();
|
|
560 |
CleanupStack::PushL(commDb);
|
|
561 |
CApUtils* aputils = CApUtils::NewLC(*commDb);
|
|
562 |
TRAP(err, iap = aputils->IapIdFromWapIdL( iap ) );
|
|
563 |
DBG_ARGS(_S("IAP = %d"), iap);
|
|
564 |
|
|
565 |
|
|
566 |
if( iap != -1 && err == KErrNone )
|
|
567 |
{
|
|
568 |
CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
|
|
569 |
CleanupStack::PushL(iapmatch);
|
|
570 |
|
|
571 |
HBufC8* uri8 = iapmatch->URIFromIAPIdL( iap );
|
|
572 |
|
|
573 |
if( uri8 )
|
|
574 |
{
|
|
575 |
CleanupStack::PushL(uri8);
|
|
576 |
aObject.InsertL(0,uri8->Des());
|
|
577 |
retValue= CSmlDmAdapter::EOk;
|
|
578 |
|
|
579 |
CleanupStack::PopAndDestroy(); // uri8
|
|
580 |
}
|
|
581 |
else
|
|
582 |
{
|
|
583 |
retValue= CSmlDmAdapter::ENotFound;
|
|
584 |
|
|
585 |
}
|
|
586 |
CleanupStack::PopAndDestroy(); // iapMatch
|
|
587 |
|
|
588 |
}
|
|
589 |
else
|
|
590 |
{
|
|
591 |
retValue= CSmlDmAdapter::ENotFound;
|
|
592 |
}
|
|
593 |
CleanupStack::PopAndDestroy(); // apUrils
|
|
594 |
CleanupStack::PopAndDestroy(); // commDb
|
|
595 |
}
|
|
596 |
}
|
|
597 |
else if(segment == KNSmlDMBrowserAdapterStartpageURL)
|
|
598 |
{
|
|
599 |
// To Set the Browser Start page URL
|
|
600 |
TBuf8<KMaxLengthStartpageName> aName;
|
|
601 |
CRepository* centrep( NULL);
|
|
602 |
aName.Zero();
|
|
603 |
centrep = CRepository::NewLC(KCRUidBrowser);
|
|
604 |
|
|
605 |
if ( centrep )
|
|
606 |
{
|
|
607 |
TFullName temp;
|
|
608 |
|
|
609 |
if (centrep->Get( KBrowserNGStartpageURL, temp )==KErrNone && temp.Length() )
|
|
610 |
{
|
|
611 |
_DBG_FILE("CNSmlDmBrowserAdapter::FetchLeafObjectL(): Got the value for start page");
|
|
612 |
temp.Trim();
|
|
613 |
aName.Copy(temp);
|
|
614 |
}
|
|
615 |
CleanupStack::PopAndDestroy(centrep);
|
|
616 |
}
|
|
617 |
aObject.InsertL(0,aName);
|
|
618 |
retValue= CSmlDmAdapter::EOk;
|
|
619 |
}
|
|
620 |
|
|
621 |
}
|
|
622 |
_DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): end");
|
|
623 |
return retValue;
|
|
624 |
}
|
|
625 |
|
|
626 |
// -----------------------------------------------------------------------------
|
|
627 |
//
|
|
628 |
// -----------------------------------------------------------------------------
|
|
629 |
#ifndef IMPLEMENTATION_PROXY_ENTRY
|
|
630 |
#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)}
|
|
631 |
#endif
|
|
632 |
|
|
633 |
const TImplementationProxy ImplementationTable[] =
|
|
634 |
{
|
|
635 |
IMPLEMENTATION_PROXY_ENTRY(KNSmlDMBrowserAdapterImplUid, CNSmlDmBrowserAdapter::NewL)
|
|
636 |
};
|
|
637 |
|
|
638 |
// -----------------------------------------------------------------------------
|
|
639 |
//
|
|
640 |
// -----------------------------------------------------------------------------
|
|
641 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
|
|
642 |
{
|
|
643 |
_DBG_FILE("ImplementationGroupProxy() for CNSmlDmBrowserAdapter: begin");
|
|
644 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
|
645 |
_DBG_FILE("ImplementationGroupProxy() for CNSmlDmBrowserAdapter: end");
|
|
646 |
return ImplementationTable;
|
|
647 |
}
|
|
648 |
|
|
649 |
// End of file
|
|
650 |
|