44
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 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 MMS Settings Adapter
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include <iapprefs.h>
|
|
21 |
#include <msvids.h>
|
|
22 |
#include <msvuids.h>
|
|
23 |
#include <utf.h>
|
|
24 |
#include <implementationproxy.h> // For TImplementationProxy definition
|
|
25 |
#include <commdb.h>
|
|
26 |
#include <cdbcols.h> // CommsDB columname defs
|
|
27 |
#include <mmsclient.h>
|
|
28 |
#include <MmsConformance.h>
|
|
29 |
#include <protectdb.h>
|
|
30 |
#include <cmconnectionmethoddef.h>
|
|
31 |
#include <cmmanagerext.h>
|
|
32 |
|
|
33 |
#include "nsmldmimpluids.h"
|
|
34 |
#include "nsmldmmmsadapter.h"
|
|
35 |
#include "nsmldebug.h"
|
|
36 |
#include "nsmlconstants.h"
|
|
37 |
#include "nsmldmconst.h"
|
|
38 |
#include "nsmldmiapmatcher.h"
|
|
39 |
#include "nsmldmtreedbclient.h"
|
|
40 |
|
|
41 |
#ifndef __WINS__
|
|
42 |
// This lowers the unnecessary compiler warning (armv5) to remark.
|
|
43 |
// "Warning: #174-D: expression has no effect..." is caused by
|
|
44 |
// DBG_ARGS8 macro in no-debug builds.
|
|
45 |
#pragma diag_remark 174
|
|
46 |
#endif
|
|
47 |
|
|
48 |
|
|
49 |
// -----------------------------------------------------------------------------
|
|
50 |
// CNSmlDmMMSAdapter* CNSmlDmMMSAdapter::NewL( )
|
|
51 |
// -----------------------------------------------------------------------------
|
|
52 |
CNSmlDmMMSAdapter* CNSmlDmMMSAdapter::NewL(MSmlDmCallback* aDmCallback )
|
|
53 |
{
|
|
54 |
_DBG_FILE("CNSmlDmMMSAdapter::NewL(): begin");
|
|
55 |
CNSmlDmMMSAdapter* self = new (ELeave) CNSmlDmMMSAdapter(aDmCallback);
|
|
56 |
CleanupStack::PushL(self);
|
|
57 |
self->ConstructL();
|
|
58 |
CleanupStack::Pop();
|
|
59 |
_DBG_FILE("CNSmlDmMMSAdapter::NewL(): end");
|
|
60 |
return self;
|
|
61 |
}
|
|
62 |
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
// CNSmlDmMMSAdapter::CNSmlDmMMSAdapter()
|
|
65 |
// -----------------------------------------------------------------------------
|
|
66 |
CNSmlDmMMSAdapter::CNSmlDmMMSAdapter(MSmlDmCallback* aDmCallback)
|
|
67 |
: CSmlDmAdapter(aDmCallback)
|
|
68 |
{
|
|
69 |
_DBG_FILE("CNSmlDmMMSAdapter::CNSmlDmMMSAdapter(): begin");
|
|
70 |
_DBG_FILE("CNSmlDmMMSAdapter::CNSmlDmMMSAdapter(): end");
|
|
71 |
}
|
|
72 |
|
|
73 |
// -----------------------------------------------------------------------------
|
|
74 |
// CNSmlDmMMSAdapter::ConstructL()
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
void CNSmlDmMMSAdapter::ConstructL()
|
|
77 |
{
|
|
78 |
_DBG_FILE("CNSmlDmMMSAdapter::ConstructL(): begin");
|
|
79 |
iStatusRef = KNSmlMMSUndefinedStatusRef;
|
|
80 |
iImgSizeStatusRef = KNSmlMMSUndefinedStatusRef;
|
|
81 |
iDatabase = CCommsDatabase::NewL(EDatabaseTypeIAP);
|
|
82 |
_DBG_FILE("CNSmlDmMMSAdapter::ConstructL(): end");
|
|
83 |
}
|
|
84 |
|
|
85 |
|
|
86 |
// -----------------------------------------------------------------------------
|
|
87 |
// CNSmlDmMMSAdapter::~CNSmlDmMMSAdapter()
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
CNSmlDmMMSAdapter::~CNSmlDmMMSAdapter()
|
|
90 |
{
|
|
91 |
_DBG_FILE("CNSmlDmMMSAdapter::~CNSmlDmMMSAdapter(): begin");
|
|
92 |
delete iMmsClient;
|
|
93 |
delete iClientMtmRegistry;
|
|
94 |
delete iMsvSession;
|
|
95 |
delete iMMSSAddr;
|
|
96 |
delete iMmsSettings;
|
|
97 |
if(iDatabase)
|
|
98 |
delete iDatabase;
|
|
99 |
_DBG_FILE("CNSmlDmMMSAdapter::~CNSmlDmMMSAdapter(): end");
|
|
100 |
}
|
|
101 |
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
// CNSmlDmMMSAdapter::DDFVersionL()
|
|
104 |
// Returns the DDF version of the adapter
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
void CNSmlDmMMSAdapter::DDFVersionL(CBufBase& aDDFVersion)
|
|
107 |
{
|
|
108 |
_DBG_FILE("CNSmlDmMMSAdapter::DDFVersionL(TDes& aDDFVersion): begin");
|
|
109 |
aDDFVersion.InsertL(0,KNSmlDMMMSDDFVersion);
|
|
110 |
_DBG_FILE("CNSmlDmMMSAdapter::DDFVersionL(TDes& aDDFVersion): end");
|
|
111 |
}
|
|
112 |
|
|
113 |
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
// CNSmlDmMMSAdapter::DDFStructureL()
|
|
116 |
// Builds the DDF structure of adapter
|
|
117 |
// -----------------------------------------------------------------------------
|
|
118 |
void CNSmlDmMMSAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
|
|
119 |
{
|
|
120 |
_DBG_FILE("CNSmlDmMMSAdapter::DDFStructureL(): begin");
|
|
121 |
|
|
122 |
TSmlDmAccessTypes accessTypesGetAdd;
|
|
123 |
accessTypesGetAdd.SetGet();
|
|
124 |
accessTypesGetAdd.SetAdd();
|
|
125 |
|
|
126 |
TSmlDmAccessTypes accessTypesGet;
|
|
127 |
accessTypesGet.SetGet();
|
|
128 |
|
|
129 |
TSmlDmAccessTypes accessTypesNoDelete;
|
|
130 |
accessTypesNoDelete.SetGet();
|
|
131 |
accessTypesNoDelete.SetAdd();
|
|
132 |
accessTypesNoDelete.SetReplace();
|
|
133 |
|
|
134 |
// MMS
|
|
135 |
MSmlDmDDFObject& MMS = aDDF.AddChildObjectL(KNSmlDMMMSNodeName);
|
|
136 |
FillNodeInfoL(MMS,accessTypesGet,MSmlDmDDFObject::EOne,
|
|
137 |
MSmlDmDDFObject::EPermanent,MSmlDmDDFObject::ENode,
|
|
138 |
KNSmlDMMMSNodeNameDescription);
|
|
139 |
|
|
140 |
//run time node
|
|
141 |
MSmlDmDDFObject& rtAcc = MMS.AddChildObjectGroupL();
|
|
142 |
FillNodeInfoL(rtAcc,accessTypesGet,MSmlDmDDFObject::EOne,
|
|
143 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode,
|
|
144 |
KNSmlDMMMSDynamicNodeDescription);
|
|
145 |
|
|
146 |
//level of mms protocol operations
|
|
147 |
MSmlDmDDFObject& mmRecep = rtAcc.AddChildObjectL(KNSmlDMMMSMMRecep);
|
|
148 |
FillNodeInfoL(mmRecep,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne,
|
|
149 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
|
|
150 |
KNSmlDMMMSMMRecepDescription);
|
|
151 |
|
|
152 |
//Creation mode
|
|
153 |
MSmlDmDDFObject& creMode = rtAcc.AddChildObjectL(KNSmlDMMMSCreMode);
|
|
154 |
FillNodeInfoL(creMode,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne,
|
|
155 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
|
|
156 |
KNSmlDMMMSCreModeDescription);
|
|
157 |
|
|
158 |
//anonymous messages allowed
|
|
159 |
MSmlDmDDFObject& amsg = rtAcc.AddChildObjectL(KNSmlDMMMSAMsg);
|
|
160 |
FillNodeInfoL(amsg,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne,
|
|
161 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool,
|
|
162 |
KNSmlDMMMSAMsgDescription);
|
|
163 |
|
|
164 |
//adverts messages allowed
|
|
165 |
MSmlDmDDFObject& rcvAds = rtAcc.AddChildObjectL(KNSmlDMMMSRcvAds);
|
|
166 |
FillNodeInfoL(rcvAds,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne,
|
|
167 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool,
|
|
168 |
KNSmlDMMMSRcvAdsDescription);
|
|
169 |
|
|
170 |
//image size in sending
|
|
171 |
MSmlDmDDFObject& imgSize = rtAcc.AddChildObjectL(KNSmlDMMMSImgSize);
|
|
172 |
FillNodeInfoL(imgSize,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne,
|
|
173 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
|
|
174 |
KNSmlDMMMSImgSizeDescription);
|
|
175 |
|
|
176 |
//deny delivery report sending
|
|
177 |
MSmlDmDDFObject& dRepSnd = rtAcc.AddChildObjectL(KNSmlDMMMSDRepSnd);
|
|
178 |
FillNodeInfoL(dRepSnd,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne,
|
|
179 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool,
|
|
180 |
KNSmlDMMMSDRepSndDescription);
|
|
181 |
|
|
182 |
//delivery report requested by default
|
|
183 |
MSmlDmDDFObject& rcvRep = rtAcc.AddChildObjectL(KNSmlDMMMSRcvRep);
|
|
184 |
FillNodeInfoL(rcvRep,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne,
|
|
185 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool,
|
|
186 |
KNSmlDMMMSRcvRepDescription);
|
|
187 |
|
|
188 |
//message validity time
|
|
189 |
MSmlDmDDFObject& msgVal = rtAcc.AddChildObjectL(KNSmlDMMMSMsgVal);
|
|
190 |
FillNodeInfoL(msgVal,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne,
|
|
191 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
|
|
192 |
KNSmlDMMMSMsgValDescription);
|
|
193 |
|
|
194 |
// MMS/<X>/Con
|
|
195 |
MSmlDmDDFObject& con = rtAcc.AddChildObjectL(KNSmlDMMMSCon);
|
|
196 |
FillNodeInfoL(con,accessTypesGet,MSmlDmDDFObject::EOne,
|
|
197 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode,
|
|
198 |
KNSmlDMMMSConNodeDescription);
|
|
199 |
|
|
200 |
|
|
201 |
// MMS/<X>/Con/<X>
|
|
202 |
MSmlDmDDFObject& rtCon = con.AddChildObjectL(KNSmlDMMMSConDynamicName16);
|
|
203 |
FillNodeInfoL(rtCon,accessTypesGet,MSmlDmDDFObject::EOne,
|
|
204 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode,
|
|
205 |
KNSmlDMMMSConRtNodeDescription);
|
|
206 |
|
|
207 |
|
|
208 |
// MMS/<X>/Con/<X>/MMSSAddr
|
|
209 |
MSmlDmDDFObject& mmsAddr = rtCon.AddChildObjectL(KNSmlDMMMSMMSSAddr);
|
|
210 |
FillNodeInfoL(mmsAddr,accessTypesNoDelete,MSmlDmDDFObject::EOne,
|
|
211 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
|
|
212 |
KNSmlDMMMSMMSSAddrDescription);
|
|
213 |
|
|
214 |
// MMS/<X>/Con/<X>/MToNapID
|
|
215 |
MSmlDmDDFObject& mToNapID = rtCon.AddChildObjectL(KNSmlDMMMSMToNapID);
|
|
216 |
FillNodeInfoL(mToNapID,accessTypesGet,MSmlDmDDFObject::EZeroOrOne,
|
|
217 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode,
|
|
218 |
KNSmlDMMMSConRtNodeDescription);
|
|
219 |
|
|
220 |
// MMS/<X>/Con/<X>/MToNapID/<X>
|
|
221 |
MSmlDmDDFObject& rtNapIds = mToNapID.AddChildObjectL(KNullDesC8);
|
|
222 |
FillNodeInfoL(rtNapIds,accessTypesGet,MSmlDmDDFObject::EZeroOrOne,
|
|
223 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode,
|
|
224 |
KNSmlDMMMSConRtNodeDescription);
|
|
225 |
|
|
226 |
// MMS/<X>/Con/<X>/MToNapID/<X>/MToNapIdL
|
|
227 |
MSmlDmDDFObject& mToNapIDL = rtNapIds.AddChildObjectL(KNSmlDMMMSMToNapIDL);
|
|
228 |
FillNodeInfoL(mToNapIDL,accessTypesNoDelete,MSmlDmDDFObject::EOneOrMore,
|
|
229 |
MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
|
|
230 |
KNSmlDMMMSMToNapIDLDescription);
|
|
231 |
|
|
232 |
RNSmlDMCallbackSession session;
|
|
233 |
User::LeaveIfError( session.Connect() );
|
|
234 |
CleanupClosePushL(session);
|
|
235 |
|
|
236 |
session.UpdateAclL(KNSmlDMMMSLevel3Parents,KNSmlDmMMSAclGet);
|
|
237 |
session.UpdateAclL(KNSmlDMMMSAclName,KNSmlDmMMSAclDefault);
|
|
238 |
session.UpdateAclL(KNSmlDMMMSAclMMRecep,KNSmlDmMMSAclDefault);
|
|
239 |
session.UpdateAclL(KNSmlDMMMSAclCreMode,KNSmlDmMMSAclDefault);
|
|
240 |
session.UpdateAclL(KNSmlDMMMSAclAMsg,KNSmlDmMMSAclDefault);
|
|
241 |
session.UpdateAclL(KNSmlDMMMSAclRcvAds,KNSmlDmMMSAclDefault);
|
|
242 |
session.UpdateAclL(KNSmlDMMMSAclImgSize,KNSmlDmMMSAclDefault);
|
|
243 |
session.UpdateAclL(KNSmlDMMMSAclDRepSnd,KNSmlDmMMSAclDefault);
|
|
244 |
session.UpdateAclL(KNSmlDMMMSAclRcvRep,KNSmlDmMMSAclDefault);
|
|
245 |
session.UpdateAclL(KNSmlDMMMSAclMsgVal,KNSmlDmMMSAclDefault);
|
|
246 |
session.UpdateAclL(KNSmlDMMMSAclMMSSAddr,KNSmlDmMMSAclDefault);
|
|
247 |
session.UpdateAclL(KNSmlDMMMSAclPrimaryMToNapIDL,KNSmlDmMMSAclDefault);
|
|
248 |
CleanupStack::PopAndDestroy(); //session
|
|
249 |
|
|
250 |
_DBG_FILE("CNSmlDmMMSAdapter::DDFStructureL(): end");
|
|
251 |
}
|
|
252 |
|
|
253 |
// -----------------------------------------------------------------------------
|
|
254 |
// CNSmlDmMMSAdapter::UpdateLeafObjectL()
|
|
255 |
// Updates value of leaf object
|
|
256 |
// -----------------------------------------------------------------------------
|
|
257 |
void CNSmlDmMMSAdapter::UpdateLeafObjectL( const TDesC8& aURI,
|
|
258 |
const TDesC8& aLUID,
|
|
259 |
const TDesC8& aObject,
|
|
260 |
const TDesC8& /*aType*/,
|
|
261 |
const TInt aStatusRef )
|
|
262 |
{
|
|
263 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(): begin");
|
|
264 |
CSmlDmAdapter::TError status = ValidateUriL( aURI );
|
|
265 |
if ( status == EOk )
|
|
266 |
{
|
|
267 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(): OK update");
|
|
268 |
status = UpdateDataL(aURI, aLUID, aObject, aStatusRef);
|
|
269 |
}
|
|
270 |
// ImgSize and MMSAddr are always stored last, from the
|
|
271 |
// CompleteOutstandingCmdsL() function
|
|
272 |
if( ( aStatusRef != iStatusRef ) && (aStatusRef != iImgSizeStatusRef ))
|
|
273 |
{
|
|
274 |
StoreSettingsL();
|
|
275 |
Callback().SetStatusL(aStatusRef, status);
|
|
276 |
}
|
|
277 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(): end");
|
|
278 |
}
|
|
279 |
// -----------------------------------------------------------------------------
|
|
280 |
// CNSmlDmMMSAdapter::DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID )
|
|
281 |
// This should delete values or accounts, but in case of MMS adapter the delete
|
|
282 |
// is not allowed
|
|
283 |
// and the adapters returns allways the EError.
|
|
284 |
// -----------------------------------------------------------------------------
|
|
285 |
void CNSmlDmMMSAdapter::DeleteObjectL( const TDesC8& /*aURI*/,
|
|
286 |
const TDesC8& /*aLUID*/,
|
|
287 |
const TInt aStatusRef )
|
|
288 |
{
|
|
289 |
_DBG_FILE("CNSmlDmMMSAdapter::DeleteLeafObjectL( ): begin");
|
|
290 |
|
|
291 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
292 |
_DBG_FILE("CNSmlDmMMSAdapter::DeleteLeafObjectL( ): end");
|
|
293 |
}
|
|
294 |
// -----------------------------------------------------------------------------
|
|
295 |
// CNSmlDmMMSAdapter::FetchLeafObjectL( const TDesC8& aURI,
|
|
296 |
// const TDesC8& aLUID,
|
|
297 |
// const TDesC8& aType,
|
|
298 |
// const TInt aResultsRef,
|
|
299 |
// const TInt aStatusRef )
|
|
300 |
// Fetches the values of leaf objects.
|
|
301 |
// -----------------------------------------------------------------------------
|
|
302 |
void CNSmlDmMMSAdapter::FetchLeafObjectL( const TDesC8& aURI,
|
|
303 |
const TDesC8& /*aLUID*/,
|
|
304 |
const TDesC8& aType,
|
|
305 |
const TInt aResultsRef,
|
|
306 |
const TInt aStatusRef )
|
|
307 |
{
|
|
308 |
_DBG_FILE("CNSmlDmMMSAdapter::FetchLeafObjectL(): begin");
|
|
309 |
CBufBase* result = CBufFlat::NewL(64);
|
|
310 |
CleanupStack::PushL(result);
|
|
311 |
CSmlDmAdapter::TError status = FetchObjectL(aURI, *result);
|
|
312 |
if(status == CSmlDmAdapter::EOk)
|
|
313 |
{
|
|
314 |
Callback().SetResultsL(aResultsRef,*result,aType);
|
|
315 |
}
|
|
316 |
Callback().SetStatusL(aStatusRef, status);
|
|
317 |
|
|
318 |
CleanupStack::PopAndDestroy(); //result
|
|
319 |
_DBG_FILE("CNSmlDmMMSAdapter::FetchLeafObjectL(): end");
|
|
320 |
}
|
|
321 |
|
|
322 |
//----------------------------------------------------------------------
|
|
323 |
// TUint32 GetIapIdL( TUint32 aUid )
|
|
324 |
// Gets the IAP ID
|
|
325 |
//----------------------------------------------------------------------
|
|
326 |
TUint32 CNSmlDmMMSAdapter::GetIapIdL( TUint32 aUid )
|
|
327 |
{
|
|
328 |
TUint32 retval( 0 );
|
|
329 |
RCmManagerExt cmmanagerExt;
|
|
330 |
cmmanagerExt.OpenL();
|
|
331 |
CleanupClosePushL(cmmanagerExt);
|
|
332 |
RCmConnectionMethodExt cm;
|
|
333 |
cm = cmmanagerExt.ConnectionMethodL( aUid );
|
|
334 |
CleanupClosePushL( cm );
|
|
335 |
retval = cm.GetIntAttributeL(CMManager::ECmIapId);
|
|
336 |
CleanupStack::PopAndDestroy( 2 ); //cmmanagerext,cm
|
|
337 |
return retval;
|
|
338 |
|
|
339 |
}
|
|
340 |
|
|
341 |
|
|
342 |
// -----------------------------------------------------------------------------
|
|
343 |
// CNSmlDmMMSAdapter::ChildURIListL( const TDesC8& aURI,
|
|
344 |
// const TDesC8& /*aLUID*/,
|
|
345 |
// const CArrayFix<TSmlDmMappingInfo>&
|
|
346 |
// /*aPreviousURISegmentList*/,
|
|
347 |
// const TInt aResultsRef,
|
|
348 |
// const TInt aStatusRef )
|
|
349 |
// Retuns the list of children of the node
|
|
350 |
// -----------------------------------------------------------------------------
|
|
351 |
void CNSmlDmMMSAdapter::ChildURIListL( const TDesC8& aURI,
|
|
352 |
const TDesC8& /*aLUID*/,
|
|
353 |
const CArrayFix<TSmlDmMappingInfo>&
|
|
354 |
/*aPreviousURISegmentList*/,
|
|
355 |
const TInt aResultsRef,
|
|
356 |
const TInt aStatusRef )
|
|
357 |
{
|
|
358 |
_DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): begin");
|
|
359 |
TRAPD(err, CreateMMSClientL());
|
|
360 |
if(err!=KErrNone)
|
|
361 |
{
|
|
362 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
363 |
_DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): EError end");
|
|
364 |
return;
|
|
365 |
}
|
|
366 |
|
|
367 |
CBufBase* currentList = CBufFlat::NewL(1);
|
|
368 |
CleanupStack::PushL(currentList);
|
|
369 |
|
|
370 |
TMsvId id = iMmsSettings->Service();
|
|
371 |
if(id==KMsvNullIndexEntryId)
|
|
372 |
{
|
|
373 |
if(aURI.Compare(KNSmlDMMMSNodeName)==0)
|
|
374 |
{
|
|
375 |
Callback().SetResultsL(aResultsRef,*currentList,KNullDesC8);
|
|
376 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
377 |
_DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): end");
|
|
378 |
}
|
|
379 |
else
|
|
380 |
{
|
|
381 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
382 |
_DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): ENotFound end");
|
|
383 |
}
|
|
384 |
CleanupStack::PopAndDestroy(); //currentList
|
|
385 |
return;
|
|
386 |
}
|
|
387 |
|
|
388 |
CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
|
|
389 |
TPtrC8 lastSeg = LastURISeg(aURI);
|
|
390 |
TInt num = NumOfURISegs(aURI);
|
|
391 |
|
|
392 |
if(aURI.Compare(KNSmlDMMMSNodeName)==0)
|
|
393 |
{
|
|
394 |
currentList->InsertL(0,KNSmlDMMMSAccount8);
|
|
395 |
}
|
|
396 |
else if(num==2&&aURI.Find(KNSmlDMMMSAccount8)>=0)
|
|
397 |
{
|
|
398 |
currentList->InsertL(0,KNSmlDMMMSListOfLeafsLo);
|
|
399 |
}
|
|
400 |
else if(num==3&&lastSeg.Compare(KNSmlDMMMSCon)==0)
|
|
401 |
{
|
|
402 |
currentList->InsertL(0,KNSmlDMMMSConDynamicName8);
|
|
403 |
}
|
|
404 |
else if(num==4&&lastSeg.Compare(KNSmlDMMMSConDynamicName16)==0)
|
|
405 |
{
|
|
406 |
currentList->InsertL(0,KNSmlDMMMSListOfLeafsMid);
|
|
407 |
}
|
|
408 |
else if(num==5&&lastSeg.Compare(KNSmlDMMMSMToNapID)==0)
|
|
409 |
{
|
|
410 |
currentList->InsertL(0,KNSmlDMMMSValuePrimary);
|
|
411 |
}
|
|
412 |
else if(num==6&&(lastSeg.Compare(KNSmlDMMMSDynamicPrimary)==0))
|
|
413 |
{
|
|
414 |
currentList->InsertL(0,KNSmlDMMMSListOfLeafsHi);
|
|
415 |
}
|
|
416 |
else
|
|
417 |
{
|
|
418 |
status=CSmlDmAdapter::ENotFound;
|
|
419 |
}
|
|
420 |
Callback().SetStatusL(aStatusRef, status);
|
|
421 |
if(status==CSmlDmAdapter::EOk)
|
|
422 |
{
|
|
423 |
Callback().SetResultsL(aResultsRef,*currentList,KNullDesC8);
|
|
424 |
}
|
|
425 |
CleanupStack::PopAndDestroy(); //currentList
|
|
426 |
|
|
427 |
_DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): end");
|
|
428 |
}
|
|
429 |
// -----------------------------------------------------------------------------
|
|
430 |
// CNSmlDmMMSAdapter::AddNodeObjectL( const TDesC8& aURI,
|
|
431 |
// const TDesC8& aParentLUID )
|
|
432 |
// This should add a new account, but in case of MMS settings only one
|
|
433 |
// account exist,
|
|
434 |
// and so the add is not possible. Returns allways CSmlDmAdapter::EError.
|
|
435 |
// -----------------------------------------------------------------------------
|
|
436 |
void CNSmlDmMMSAdapter::AddNodeObjectL( const TDesC8& /*aURI*/,
|
|
437 |
const TDesC8& /*aParentLUID*/,
|
|
438 |
const TInt aStatusRef )
|
|
439 |
{
|
|
440 |
_DBG_FILE("CNSmlDmMMSAdapter::AddNodeObjectL(): begin");
|
|
441 |
//If add is needed in future then add call to AddObjectL function here
|
|
442 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
443 |
_DBG_FILE("CNSmlDmMMSAdapter::AddNodeObjectL(): end");
|
|
444 |
}
|
|
445 |
// -----------------------------------------------------------------------------
|
|
446 |
// CNSmlDmMMSAdapter::UpdateLeafObjectL( const TDesC8& aURI,
|
|
447 |
// const TDesC8& aLUID, RWriteStream*& aStream, const TDesC8& aType,
|
|
448 |
// const TInt aStatusRef )
|
|
449 |
// This should update a stream object, but in case of MMS settings streaming is
|
|
450 |
// not supported.
|
|
451 |
// -----------------------------------------------------------------------------
|
|
452 |
void CNSmlDmMMSAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/,
|
|
453 |
const TDesC8& /*aLUID*/,
|
|
454 |
RWriteStream*& /*aStream*/,
|
|
455 |
const TDesC8& /*aType*/,
|
|
456 |
const TInt aStatusRef )
|
|
457 |
{
|
|
458 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(stream): begin");
|
|
459 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
460 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(stream): end");
|
|
461 |
}
|
|
462 |
// -----------------------------------------------------------------------------
|
|
463 |
// void CNSmlDmMMSAdapter::FetchLeafObjectSizeL( const TDesC8& aURI,
|
|
464 |
// const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef,
|
|
465 |
// const TInt aStatusRef )
|
|
466 |
// Fetches data object and returns its size.
|
|
467 |
// -----------------------------------------------------------------------------
|
|
468 |
void CNSmlDmMMSAdapter::FetchLeafObjectSizeL( const TDesC8& aURI,
|
|
469 |
const TDesC8& /*aLUID*/,
|
|
470 |
const TDesC8& aType,
|
|
471 |
const TInt aResultsRef,
|
|
472 |
const TInt aStatusRef )
|
|
473 |
{
|
|
474 |
_DBG_FILE("CNSmlDmMMSAdapter::FetchLeafObjectSizeL(): begin");
|
|
475 |
|
|
476 |
CBufBase* result = CBufFlat::NewL(64);
|
|
477 |
CleanupStack::PushL(result);
|
|
478 |
CSmlDmAdapter::TError status = FetchObjectL(aURI, *result);
|
|
479 |
if( status == CSmlDmAdapter::EOk )
|
|
480 |
{
|
|
481 |
TInt objSizeInBytes = result->Size();
|
|
482 |
TBuf8<KNSmlDmMmsObjectSizeWidth> stringObjSizeInBytes;
|
|
483 |
stringObjSizeInBytes.Num( objSizeInBytes );
|
|
484 |
result->Reset();
|
|
485 |
result->InsertL( 0, stringObjSizeInBytes );
|
|
486 |
Callback().SetResultsL(aResultsRef, *result, aType);
|
|
487 |
}
|
|
488 |
Callback().SetStatusL(aStatusRef, status);
|
|
489 |
CleanupStack::PopAndDestroy(); //result
|
|
490 |
_DBG_FILE("CNSmlDmMMSAdapter::FetchLeafObjectSizeL(): end");
|
|
491 |
}
|
|
492 |
//==============================================================================
|
|
493 |
// CNSmlDmMMSAdapter::ExecuteCommandL()
|
|
494 |
//==============================================================================
|
|
495 |
void CNSmlDmMMSAdapter::ExecuteCommandL( const TDesC8& /*aURI*/,
|
|
496 |
const TDesC8& /*aLUID*/,
|
|
497 |
const TDesC8& /*aArgument*/,
|
|
498 |
const TDesC8& /*aType*/,
|
|
499 |
const TInt aStatusRef )
|
|
500 |
{
|
|
501 |
//Not supported
|
|
502 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
503 |
}
|
|
504 |
|
|
505 |
//==============================================================================
|
|
506 |
// CNSmlDmMMSAdapter::ExecuteCommandL()
|
|
507 |
//==============================================================================
|
|
508 |
void CNSmlDmMMSAdapter::ExecuteCommandL( const TDesC8& /*aURI*/,
|
|
509 |
const TDesC8& /*aLUID*/,
|
|
510 |
RWriteStream*& /*aStream*/,
|
|
511 |
const TDesC8& /*aType*/,
|
|
512 |
const TInt aStatusRef )
|
|
513 |
{
|
|
514 |
//Not supported
|
|
515 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
516 |
}
|
|
517 |
|
|
518 |
//==============================================================================
|
|
519 |
// CNSmlDmMMSAdapter::CopyCommandL()
|
|
520 |
//==============================================================================
|
|
521 |
void CNSmlDmMMSAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/,
|
|
522 |
const TDesC8& /*aTargetLUID*/,
|
|
523 |
const TDesC8& /*aSourceURI*/,
|
|
524 |
const TDesC8& /*aSourceLUID*/,
|
|
525 |
const TDesC8& /*aType*/,
|
|
526 |
TInt aStatusRef )
|
|
527 |
{
|
|
528 |
//Not supported
|
|
529 |
Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
530 |
|
|
531 |
}
|
|
532 |
|
|
533 |
//==============================================================================
|
|
534 |
// CNSmlDmMMSAdapter::StartAtomicL()
|
|
535 |
//==============================================================================
|
|
536 |
void CNSmlDmMMSAdapter::StartAtomicL()
|
|
537 |
{
|
|
538 |
//Not supported
|
|
539 |
}
|
|
540 |
|
|
541 |
//==============================================================================
|
|
542 |
// CNSmlDmMMSAdapter::CommitAtomicL()
|
|
543 |
//==============================================================================
|
|
544 |
void CNSmlDmMMSAdapter::CommitAtomicL()
|
|
545 |
{
|
|
546 |
//Not supported
|
|
547 |
}
|
|
548 |
|
|
549 |
//==============================================================================
|
|
550 |
// CNSmlDmMMSAdapter::RollbackAtomicL()
|
|
551 |
//==============================================================================
|
|
552 |
void CNSmlDmMMSAdapter::RollbackAtomicL()
|
|
553 |
{
|
|
554 |
//Not supported
|
|
555 |
}
|
|
556 |
|
|
557 |
//==============================================================================
|
|
558 |
// CNSmlDmMMSAdapter::StreamingSupport()
|
|
559 |
//==============================================================================
|
|
560 |
TBool CNSmlDmMMSAdapter::StreamingSupport( TInt& /*aItemSize*/ )
|
|
561 |
{
|
|
562 |
return EFalse;
|
|
563 |
}
|
|
564 |
|
|
565 |
//==============================================================================
|
|
566 |
// CNSmlDmMMSAdapter::StreamCommittedL()
|
|
567 |
//==============================================================================
|
|
568 |
void CNSmlDmMMSAdapter::StreamCommittedL()
|
|
569 |
{
|
|
570 |
//Not supported
|
|
571 |
}
|
|
572 |
// -----------------------------------------------------------------------------
|
|
573 |
// CNSmlDmMMSAdapter::CompleteOutstandingCmdsL()
|
|
574 |
// Indication of message ending. The buffered commands must be executed before
|
|
575 |
// return of this function.
|
|
576 |
// -----------------------------------------------------------------------------
|
|
577 |
void CNSmlDmMMSAdapter::CompleteOutstandingCmdsL()
|
|
578 |
{
|
|
579 |
_DBG_FILE("CNSmlDmMMSAdapter::CompleteOutstandingCmdsL(): begin");
|
|
580 |
if(iStatusRef!=KNSmlMMSUndefinedStatusRef)
|
|
581 |
{
|
|
582 |
Callback().SetStatusL(iStatusRef,UpdateMMSAddrL());
|
|
583 |
delete iMMSSAddr;
|
|
584 |
iMMSSAddr = 0;
|
|
585 |
iStatusRef = KNSmlMMSUndefinedStatusRef;
|
|
586 |
}
|
|
587 |
StoreSettingsL();
|
|
588 |
_DBG_FILE("CNSmlDmMMSAdapter::CompleteOutstandingCmdsL(): end");
|
|
589 |
}
|
|
590 |
|
|
591 |
// -----------------------------------------------------------------------------
|
|
592 |
// CNSmlDmMMSAdapter::HandleSessionEventL()
|
|
593 |
// Inherited from MMsvSessionObserver, and this is needs to implemented for
|
|
594 |
// opening the CMsvSession
|
|
595 |
// -----------------------------------------------------------------------------
|
|
596 |
void CNSmlDmMMSAdapter::HandleSessionEventL( TMsvSessionEvent /*aEvent*/,
|
|
597 |
TAny* /*aArg1*/,
|
|
598 |
TAny* /*aArg2*/,
|
|
599 |
TAny* /*aArg3*/ )
|
|
600 |
{
|
|
601 |
}
|
|
602 |
|
|
603 |
|
|
604 |
// -----------------------------------------------------------------------------
|
|
605 |
// CSmlDmAdapter::TError CNSmlDmMMSAdapter::UpdateDataL()
|
|
606 |
// The function is used for updating the MMS settings. The function is used in
|
|
607 |
// AddLeafObjectL() and UpdateLeafObjectL()
|
|
608 |
// -----------------------------------------------------------------------------
|
|
609 |
CSmlDmAdapter::TError CNSmlDmMMSAdapter::UpdateDataL(const TDesC8& aURI,
|
|
610 |
const TDesC8& /*aParentLUID*/,
|
|
611 |
const TDesC8& aObject,
|
|
612 |
TInt aStatusRef)
|
|
613 |
{
|
|
614 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): begin");
|
|
615 |
HBufC8* data = NULL;
|
|
616 |
TRAPD(err, CreateMMSClientL());
|
|
617 |
if(err!=KErrNone)
|
|
618 |
{
|
|
619 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): EError end");
|
|
620 |
return CSmlDmAdapter::EError;
|
|
621 |
}
|
|
622 |
|
|
623 |
TMsvId id = iMmsSettings->Service();
|
|
624 |
|
|
625 |
if( id == KMsvNullIndexEntryId || aURI.Find( KNSmlDMMMSAccount8 )
|
|
626 |
==KErrNotFound )
|
|
627 |
{
|
|
628 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): ENotFound end");
|
|
629 |
return CSmlDmAdapter::ENotFound;
|
|
630 |
}
|
|
631 |
|
|
632 |
TPtrC8 uriSeg = LastURISeg(aURI);
|
|
633 |
CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
|
|
634 |
|
|
635 |
if(uriSeg.Compare(KNSmlDMMMSName)==0)
|
|
636 |
{
|
|
637 |
// Not supported.
|
|
638 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): ENotFound end");
|
|
639 |
status = CSmlDmAdapter::ENotFound;
|
|
640 |
}
|
|
641 |
else if(uriSeg.Compare(KNSmlDMMMSMMRecep)==0)
|
|
642 |
{
|
|
643 |
data = aObject.AllocLC();
|
|
644 |
TPtr8 dataPtr = data->Des();
|
|
645 |
dataPtr.Capitalize();
|
|
646 |
if(dataPtr.Find(KNSmlDMMMSValueAlwaysOn)==0)
|
|
647 |
{
|
|
648 |
iMmsSettings->SetReceivingModeHome(EMmsReceivingAutomatic);
|
|
649 |
iMmsSettings->SetReceivingModeForeign(EMmsReceivingAutomatic);
|
|
650 |
}
|
|
651 |
else if(dataPtr.Compare(KNSmlDMMMSValueOff)==0)
|
|
652 |
{
|
|
653 |
iMmsSettings->SetReceivingModeHome(EMmsReceivingReject);
|
|
654 |
iMmsSettings->SetReceivingModeForeign(EMmsReceivingReject);
|
|
655 |
}
|
|
656 |
else if(dataPtr.Find(KNSmlDMMMSValueAutomaticAtHome)==0)
|
|
657 |
{
|
|
658 |
iMmsSettings->SetReceivingModeHome(EMmsReceivingAutomatic);
|
|
659 |
iMmsSettings->SetReceivingModeForeign(EMmsReceivingReject);
|
|
660 |
}
|
|
661 |
else if (dataPtr.Find(KNSmlDMMMSValueAlwaysManual2)==0 ||
|
|
662 |
dataPtr.Find(KNSmlDMMMSValueAlwaysManual)==0 )
|
|
663 |
{
|
|
664 |
iMmsSettings->SetReceivingModeHome(EMmsReceivingManual);
|
|
665 |
iMmsSettings->SetReceivingModeForeign(EMmsReceivingManual);
|
|
666 |
}
|
|
667 |
else
|
|
668 |
{
|
|
669 |
status = CSmlDmAdapter::EInvalidObject;
|
|
670 |
}
|
|
671 |
CleanupStack::PopAndDestroy(); //data
|
|
672 |
}
|
|
673 |
else if(uriSeg.Compare(KNSmlDMMMSCreMode)==0)
|
|
674 |
{
|
|
675 |
data = aObject.AllocLC();
|
|
676 |
TPtr8 dataPtr = data->Des();
|
|
677 |
dataPtr.Capitalize();
|
|
678 |
if(dataPtr.Find(KNSmlDMMMSValueFree)==0)
|
|
679 |
{
|
|
680 |
iMmsSettings->SetCreationMode(EMmsCreationModeFree);
|
|
681 |
}
|
|
682 |
else if(dataPtr.Find(KNSmlDMMMSValueRestricted)==0)
|
|
683 |
{
|
|
684 |
iMmsSettings->SetImageWidth(KImageRichWidth);
|
|
685 |
iMmsSettings->SetImageHeight(KImageRichHeight);
|
|
686 |
iMmsSettings->SetCreationMode(EMmsCreationModeRestricted);
|
|
687 |
}
|
|
688 |
else if(dataPtr.Find(KNSmlDMMMSValueWarning)==0)
|
|
689 |
{
|
|
690 |
iMmsSettings->SetCreationMode(EMmsCreationModeWarning);
|
|
691 |
}
|
|
692 |
else
|
|
693 |
{
|
|
694 |
status = CSmlDmAdapter::EInvalidObject;
|
|
695 |
}
|
|
696 |
CleanupStack::PopAndDestroy(); //data
|
|
697 |
}
|
|
698 |
else if( uriSeg.Compare(KNSmlDMMMSAMsg) == 0 )
|
|
699 |
{
|
|
700 |
data = aObject.AllocLC();
|
|
701 |
TPtr8 dataPtr = data->Des();
|
|
702 |
dataPtr.Capitalize();
|
|
703 |
TBool object=EFalse;
|
|
704 |
if(dataPtr.Find(KNSmlDMMMSValueTrue)>=0)
|
|
705 |
{
|
|
706 |
object = ETrue;
|
|
707 |
}
|
|
708 |
iMmsSettings->SetAcceptAnonymousMessages(object);
|
|
709 |
CleanupStack::PopAndDestroy(); //data
|
|
710 |
}
|
|
711 |
else if( uriSeg.Compare(KNSmlDMMMSRcvAds) == 0 )
|
|
712 |
{
|
|
713 |
data = aObject.AllocLC();
|
|
714 |
TPtr8 dataPtr = data->Des();
|
|
715 |
dataPtr.Capitalize();
|
|
716 |
TBool object=EFalse;
|
|
717 |
if(dataPtr.Find(KNSmlDMMMSValueTrue)>=0)
|
|
718 |
{
|
|
719 |
object = ETrue;
|
|
720 |
}
|
|
721 |
iMmsSettings->SetAcceptAdvertisementMessages(object);
|
|
722 |
CleanupStack::PopAndDestroy(); //data
|
|
723 |
}
|
|
724 |
else if(uriSeg.Compare(KNSmlDMMMSImgSize)==0)
|
|
725 |
{
|
|
726 |
data = aObject.AllocLC();
|
|
727 |
TPtr8 dataPtr = data->Des();
|
|
728 |
dataPtr.Capitalize();
|
|
729 |
if(dataPtr.Compare(KNSmlDMMMSValueLarge)==0)
|
|
730 |
{
|
|
731 |
switch(iMmsSettings->CreationMode())
|
|
732 |
{
|
|
733 |
case EMmsCreationModeRestricted:
|
|
734 |
status = CSmlDmAdapter::EInvalidObject;
|
|
735 |
break;
|
|
736 |
default :
|
|
737 |
iMmsSettings->SetImageWidth(KImageMegapixelWidth);
|
|
738 |
iMmsSettings->SetImageHeight(KImageMegapixelHeight);
|
|
739 |
break;
|
|
740 |
}
|
|
741 |
iImgSizeStatusRef = KNSmlMMSUndefinedStatusRef;
|
|
742 |
}
|
|
743 |
else if(dataPtr.Compare(KNSmlDMMMSValueSmall)==0)
|
|
744 |
{
|
|
745 |
iMmsSettings->SetImageWidth(KImageRichWidth);
|
|
746 |
iMmsSettings->SetImageHeight(KImageRichHeight);
|
|
747 |
iImgSizeStatusRef = KNSmlMMSUndefinedStatusRef;
|
|
748 |
}
|
|
749 |
else
|
|
750 |
{
|
|
751 |
status = CSmlDmAdapter::EInvalidObject;
|
|
752 |
}
|
|
753 |
CleanupStack::PopAndDestroy(); //data
|
|
754 |
}
|
|
755 |
else if(uriSeg.Compare(KNSmlDMMMSDRepSnd)==0)
|
|
756 |
{
|
|
757 |
data = aObject.AllocLC();
|
|
758 |
TPtr8 dataPtr = data->Des();
|
|
759 |
dataPtr.Capitalize();
|
|
760 |
if(dataPtr.Compare(KNSmlDMMMSValueFalse)==0)
|
|
761 |
{
|
|
762 |
iMmsSettings->SetDeliveryReportSendingAllowed(KMmsYes);
|
|
763 |
}
|
|
764 |
else
|
|
765 |
{
|
|
766 |
iMmsSettings->SetDeliveryReportSendingAllowed(KMmsNo);
|
|
767 |
}
|
|
768 |
CleanupStack::PopAndDestroy(); //data
|
|
769 |
}
|
|
770 |
else if(uriSeg.Compare(KNSmlDMMMSRcvRep)==0)
|
|
771 |
{
|
|
772 |
data = aObject.AllocLC();
|
|
773 |
TPtr8 dataPtr = data->Des();
|
|
774 |
dataPtr.Capitalize();
|
|
775 |
if(dataPtr.Compare(KNSmlDMMMSValueTrue)==0)
|
|
776 |
{
|
|
777 |
iMmsSettings->SetDeliveryReportWanted(KMmsYes);
|
|
778 |
}
|
|
779 |
else
|
|
780 |
{
|
|
781 |
iMmsSettings->SetDeliveryReportWanted(KMmsNo);
|
|
782 |
}
|
|
783 |
CleanupStack::PopAndDestroy(); //data
|
|
784 |
}
|
|
785 |
else if(uriSeg.Compare(KNSmlDMMMSMsgVal)==0)
|
|
786 |
{
|
|
787 |
data = aObject.AllocLC();
|
|
788 |
TPtr8 dataPtr = data->Des();
|
|
789 |
dataPtr.LowerCase();
|
|
790 |
if(dataPtr.Compare(KNSmlDMMMSValueHour)==0 ||
|
|
791 |
dataPtr.Compare(KNSmlDMMMSValueHourShort)==0)
|
|
792 |
{
|
|
793 |
iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryHour);
|
|
794 |
}
|
|
795 |
else if(dataPtr.Find(KNSmlDMMMSValueSixHoursShort)==0 ||
|
|
796 |
dataPtr.Find(KNSmlDMMMSValueSixHoursShortNum)==0)
|
|
797 |
{
|
|
798 |
iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpirySixHours);
|
|
799 |
}
|
|
800 |
else if(dataPtr.Find(KNSmlDMMMSValueDayShort)==0)
|
|
801 |
{
|
|
802 |
iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryDay);
|
|
803 |
}
|
|
804 |
else if(dataPtr.Find(KNSmlDMMMSValueThreeDaysShort)==0 ||
|
|
805 |
dataPtr.Find(KNSmlDMMMSValueThreeDaysShortNum)==0)
|
|
806 |
{
|
|
807 |
iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryThreeDays);
|
|
808 |
}
|
|
809 |
else if(dataPtr.Find(KNSmlDMMMSValueWeekShort)>=0)
|
|
810 |
{
|
|
811 |
iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryWeek);
|
|
812 |
}
|
|
813 |
else if(dataPtr.Find(KNSmlDMMMSValueMaximumTimeShort)==0)
|
|
814 |
{
|
|
815 |
iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryMaximum);
|
|
816 |
}
|
|
817 |
else
|
|
818 |
{
|
|
819 |
status = CSmlDmAdapter::EInvalidObject;
|
|
820 |
}
|
|
821 |
CleanupStack::PopAndDestroy(); //data
|
|
822 |
}
|
|
823 |
else if(uriSeg.Compare(KNSmlDMMMSMToNapIDL)==0)
|
|
824 |
{
|
|
825 |
TPtrC8 seg=LastURISeg(RemoveLastURISeg(aURI));
|
|
826 |
if( seg.Compare(KNSmlDMMMSDynamicPrimary)==0 )
|
|
827 |
{
|
|
828 |
CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
|
|
829 |
CleanupStack::PushL(iapmatch);
|
|
830 |
|
|
831 |
TInt iap = iapmatch->IAPIdFromURIL( aObject );
|
|
832 |
|
|
833 |
CleanupStack::PopAndDestroy(); // iapmatch
|
|
834 |
|
|
835 |
if ( iap != KErrNotFound )
|
|
836 |
{
|
|
837 |
TRAP(err, iap = GetIapIdL( iap ) );
|
|
838 |
DBG_ARGS(_S("IAP = %d"), iap);
|
|
839 |
|
|
840 |
if( err == KErrNone)
|
|
841 |
{
|
|
842 |
ReplaceAPL( iap, KNSmlDMMMSFirstAccessPointId );
|
|
843 |
}
|
|
844 |
else
|
|
845 |
{
|
|
846 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): \
|
|
847 |
err!=KErrNone");
|
|
848 |
iap = KNSmlDMMMSIapNotDefined;
|
|
849 |
status = CSmlDmAdapter::EInvalidObject;
|
|
850 |
}
|
|
851 |
}
|
|
852 |
else
|
|
853 |
{
|
|
854 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): status = \
|
|
855 |
CSmlDmAdapter::EInvalidObject");
|
|
856 |
status = CSmlDmAdapter::EInvalidObject;
|
|
857 |
}
|
|
858 |
}
|
|
859 |
else
|
|
860 |
{
|
|
861 |
if( status == CSmlDmAdapter::EOk )
|
|
862 |
{
|
|
863 |
status = CSmlDmAdapter::ENotFound;
|
|
864 |
}
|
|
865 |
}
|
|
866 |
}
|
|
867 |
else if(uriSeg.Compare(KNSmlDMMMSMMSSAddr)==0)
|
|
868 |
{
|
|
869 |
if(iMMSSAddr)
|
|
870 |
{
|
|
871 |
delete iMMSSAddr;
|
|
872 |
iMMSSAddr = 0;
|
|
873 |
}
|
|
874 |
if(iStatusRef != KNSmlMMSUndefinedStatusRef)
|
|
875 |
{
|
|
876 |
Callback().SetStatusL(iStatusRef,CSmlDmAdapter::EError);
|
|
877 |
}
|
|
878 |
iMMSSAddr = aObject.AllocL();
|
|
879 |
iStatusRef = aStatusRef;
|
|
880 |
}
|
|
881 |
|
|
882 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): end");
|
|
883 |
return status;
|
|
884 |
}
|
|
885 |
|
|
886 |
// -----------------------------------------------------------------------------
|
|
887 |
// void CNSmlDmMMSAdapter::ReplaceAP( TInt aIapId, TInt aPos )
|
|
888 |
// replace AP, if no AP exitst in aPos then just add it.
|
|
889 |
// -----------------------------------------------------------------------------
|
|
890 |
void CNSmlDmMMSAdapter::ReplaceAPL( TInt aIapId, TInt aPos )
|
|
891 |
{
|
|
892 |
if( iMmsSettings->AccessPoint( aPos ) != KErrNotFound )
|
|
893 |
{
|
|
894 |
iMmsSettings->DeleteAccessPointL( aPos );
|
|
895 |
}
|
|
896 |
iMmsSettings->AddAccessPointL( aIapId, aPos );
|
|
897 |
}
|
|
898 |
|
|
899 |
// -----------------------------------------------------------------------------
|
|
900 |
// CNSmlDmMMSAdapter::UpdateMMSAddrL()
|
|
901 |
// Executes the buffered MMSSAddr update command.
|
|
902 |
// This command is called from CompleteOutstandingCmdsL()
|
|
903 |
// -----------------------------------------------------------------------------
|
|
904 |
CSmlDmAdapter::TError CNSmlDmMMSAdapter::UpdateMMSAddrL()
|
|
905 |
{
|
|
906 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL(): begin");
|
|
907 |
CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
|
|
908 |
|
|
909 |
TBool ok = EFalse;
|
|
910 |
TUint32 wapid = iMmsSettings->AccessPoint(KNSmlDMMMSFirstAccessPointId);
|
|
911 |
|
|
912 |
//Check if locked , if locked unlock else execute normal sequence.
|
|
913 |
|
|
914 |
TBool reclock = EFalse;
|
|
915 |
TBool lockerror =KErrNone;
|
|
916 |
reclock = IsWAPAccessPointRecordLockedL(wapid);
|
|
917 |
if(reclock)
|
|
918 |
{
|
|
919 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL():making record unlock");
|
|
920 |
//unlock the record
|
|
921 |
lockerror = DoProtectWAPAccessRecordL(wapid,EFalse);
|
|
922 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL():record unlocked with error as ");
|
|
923 |
DBG_ARGS(_S("err = %d"), lockerror);
|
|
924 |
}
|
|
925 |
|
|
926 |
|
|
927 |
CCommsDbTableView* tableView=0;
|
|
928 |
tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT),
|
|
929 |
TPtrC(COMMDB_ID), wapid );
|
|
930 |
if(tableView->GotoFirstRecord()==KErrNone)
|
|
931 |
{
|
|
932 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL(): GotoFirstRecord");
|
|
933 |
|
|
934 |
|
|
935 |
//If it was unlocked, lock it again
|
|
936 |
|
|
937 |
if(lockerror == KErrNone)
|
|
938 |
{
|
|
939 |
TInt err = tableView->UpdateRecord();
|
|
940 |
if(err == KErrNone)
|
|
941 |
{
|
|
942 |
HBufC* object = HBufC::NewLC(iMMSSAddr->Length());
|
|
943 |
TPtr obPtr = object->Des();
|
|
944 |
CnvUtfConverter::ConvertToUnicodeFromUtf8( obPtr, *iMMSSAddr);
|
|
945 |
|
|
946 |
TRAPD(err,tableView->WriteLongTextL(TPtrC(WAP_START_PAGE),obPtr));
|
|
947 |
DBG_ARGS(_S("err = %d"), err);
|
|
948 |
if(err==KErrNone)
|
|
949 |
{
|
|
950 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL(): Write OK");
|
|
951 |
tableView->PutRecordChanges();
|
|
952 |
ok = ETrue;
|
|
953 |
}
|
|
954 |
CleanupStack::PopAndDestroy(); //object
|
|
955 |
|
|
956 |
}
|
|
957 |
|
|
958 |
}
|
|
959 |
|
|
960 |
}
|
|
961 |
CleanupStack::PopAndDestroy(1); //tableview //, commDb--iDatabase
|
|
962 |
if(reclock)
|
|
963 |
{
|
|
964 |
TInt err = DoProtectWAPAccessRecordL(wapid,ETrue);
|
|
965 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL():record again locked with error as ");
|
|
966 |
DBG_ARGS(_S("err = %d"), err);
|
|
967 |
reclock = EFalse;
|
|
968 |
}
|
|
969 |
if(!ok)
|
|
970 |
{
|
|
971 |
status = CSmlDmAdapter::EError;
|
|
972 |
}
|
|
973 |
|
|
974 |
_DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL(): end");
|
|
975 |
return status;
|
|
976 |
}
|
|
977 |
|
|
978 |
// -----------------------------------------------------------------------------
|
|
979 |
// CNSmlDmMMSAdapter::DesToInt()
|
|
980 |
// Converts a 16 bit descriptor to TInt
|
|
981 |
// -----------------------------------------------------------------------------
|
|
982 |
TInt CNSmlDmMMSAdapter::DesToInt(const TDesC& aLuid)
|
|
983 |
{
|
|
984 |
TLex16 lex(aLuid);
|
|
985 |
TInt value = 0;
|
|
986 |
lex.Val(value);
|
|
987 |
return value;
|
|
988 |
}
|
|
989 |
|
|
990 |
|
|
991 |
// -----------------------------------------------------------------------------
|
|
992 |
// TPtrC8 CNSmlDmMMSAdapter::RemoveLastURISeg(const TDesC8& aURI)
|
|
993 |
// returns parent uri, i.e. removes last uri segment
|
|
994 |
// -----------------------------------------------------------------------------
|
|
995 |
TPtrC8 CNSmlDmMMSAdapter::RemoveLastURISeg(const TDesC8& aURI)
|
|
996 |
{
|
|
997 |
TInt i;
|
|
998 |
for(i=aURI.Length()-1;i>=0;i--)
|
|
999 |
{
|
|
1000 |
if(aURI[i]==KNSmlDMMMSSeparatorDef)
|
|
1001 |
{
|
|
1002 |
break;
|
|
1003 |
}
|
|
1004 |
}
|
|
1005 |
return aURI.Left(i);
|
|
1006 |
}
|
|
1007 |
|
|
1008 |
|
|
1009 |
|
|
1010 |
// -----------------------------------------------------------------------------
|
|
1011 |
// TInt CNSmlDmMMSAdapter::NumOfURISegs(const TDesC8& aURI)
|
|
1012 |
// Returns the num of uri segs
|
|
1013 |
// -----------------------------------------------------------------------------
|
|
1014 |
TInt CNSmlDmMMSAdapter::NumOfURISegs(const TDesC8& aURI)
|
|
1015 |
{
|
|
1016 |
TInt numOfURISegs = 1;
|
|
1017 |
for(TInt i=0;i<aURI.Length();i++)
|
|
1018 |
{
|
|
1019 |
if(aURI[i]==KNSmlDMMMSSeparatorDef)
|
|
1020 |
{
|
|
1021 |
numOfURISegs++;
|
|
1022 |
}
|
|
1023 |
}
|
|
1024 |
return numOfURISegs;
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
|
|
1028 |
// -----------------------------------------------------------------------------
|
|
1029 |
// TPtrC8 CNSmlDmMMSAdapter::LastURISeg(const TDesC8& aURI)
|
|
1030 |
// Returns only the last uri segemnt
|
|
1031 |
// -----------------------------------------------------------------------------
|
|
1032 |
TPtrC8 CNSmlDmMMSAdapter::LastURISeg(const TDesC8& aURI)
|
|
1033 |
{
|
|
1034 |
_DBG_FILE("CNSmlDmMMSAdapter::LastURISeg() : begin");
|
|
1035 |
TInt i;
|
|
1036 |
for(i=aURI.Length()-1;i>=0;i--)
|
|
1037 |
{
|
|
1038 |
if(aURI[i]==KNSmlDMMMSSeparatorDef)
|
|
1039 |
{
|
|
1040 |
break;
|
|
1041 |
}
|
|
1042 |
}
|
|
1043 |
_DBG_FILE("CNSmlDmMMSAdapter::LastURISeg() : end");
|
|
1044 |
if(i==0)
|
|
1045 |
{
|
|
1046 |
return aURI;
|
|
1047 |
}
|
|
1048 |
else
|
|
1049 |
{
|
|
1050 |
return aURI.Mid(i+1);
|
|
1051 |
}
|
|
1052 |
}
|
|
1053 |
|
|
1054 |
|
|
1055 |
// -----------------------------------------------------------------------------
|
|
1056 |
// CNSmlDmMMSAdapter::CreateMMSClientL()
|
|
1057 |
// Creates MMS client mtm
|
|
1058 |
// -----------------------------------------------------------------------------
|
|
1059 |
void CNSmlDmMMSAdapter::CreateMMSClientL()
|
|
1060 |
{
|
|
1061 |
if(iMmsClient ==0)
|
|
1062 |
{
|
|
1063 |
iMsvSession = CMsvSession::OpenSyncL( *this );
|
|
1064 |
iClientMtmRegistry = CClientMtmRegistry::NewL(* iMsvSession );
|
|
1065 |
iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->
|
|
1066 |
NewMtmL( KUidMsgTypeMultimedia );
|
|
1067 |
iMmsClient->RestoreSettingsL();
|
|
1068 |
iMmsSettings = CMmsSettings::NewL();
|
|
1069 |
iMmsSettings->CopyL( iMmsClient->MmsSettings() );
|
|
1070 |
}
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
// -----------------------------------------------------------------------------
|
|
1074 |
// CNSmlDmMMSAdapter::FillNodeInfoL()
|
|
1075 |
// Fills the node info in ddf structure
|
|
1076 |
// -----------------------------------------------------------------------------
|
|
1077 |
void CNSmlDmMMSAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode,
|
|
1078 |
TSmlDmAccessTypes aAccTypes,
|
|
1079 |
MSmlDmDDFObject::TOccurence aOccurrence,
|
|
1080 |
MSmlDmDDFObject::TScope aScope,
|
|
1081 |
MSmlDmDDFObject::TDFFormat aFormat,
|
|
1082 |
const TDesC8& aDescription)
|
|
1083 |
{
|
|
1084 |
aNode.SetAccessTypesL(aAccTypes);
|
|
1085 |
aNode.SetOccurenceL(aOccurrence);
|
|
1086 |
aNode.SetScopeL(aScope);
|
|
1087 |
aNode.SetDFFormatL(aFormat);
|
|
1088 |
if(aFormat!=MSmlDmDDFObject::ENode)
|
|
1089 |
{
|
|
1090 |
aNode.AddDFTypeMimeTypeL(KNSmlDMMMSTextPlain);
|
|
1091 |
}
|
|
1092 |
aNode.SetDescriptionL(aDescription);
|
|
1093 |
|
|
1094 |
}
|
|
1095 |
|
|
1096 |
// -----------------------------------------------------------------------------
|
|
1097 |
// CSmlDmAdapter::TError FetchObjectL(const TDesC8& aURI, const TDesC8& aObject)
|
|
1098 |
// Fetches data object and returns it in parameter.
|
|
1099 |
// Return values according to CSmlDmAdapter::TError.
|
|
1100 |
// -----------------------------------------------------------------------------
|
|
1101 |
CSmlDmAdapter::TError CNSmlDmMMSAdapter::FetchObjectL(const TDesC8& aURI,
|
|
1102 |
CBufBase& aObject)
|
|
1103 |
{
|
|
1104 |
_DBG_FILE("CNSmlDmMMSAdapter::FetchObjectL(): begin");
|
|
1105 |
TRAPD(err, CreateMMSClientL());
|
|
1106 |
if(err!=KErrNone)
|
|
1107 |
{
|
|
1108 |
_DBG_FILE("CNSmlDmMMSAdapter::FetchObjectL(): EError end");
|
|
1109 |
return CSmlDmAdapter::EError;
|
|
1110 |
}
|
|
1111 |
|
|
1112 |
TMsvId id = iMmsSettings->Service();
|
|
1113 |
|
|
1114 |
if(id == KMsvNullIndexEntryId||aURI.Find(KNSmlDMMMSAccount8)==KErrNotFound)
|
|
1115 |
{
|
|
1116 |
_DBG_FILE("CNSmlDmMMSAdapter::FetchObjectL(): ENotFound end");
|
|
1117 |
return CSmlDmAdapter::ENotFound;
|
|
1118 |
}
|
|
1119 |
|
|
1120 |
TPtrC8 uriSeg = LastURISeg(aURI);
|
|
1121 |
CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
|
|
1122 |
|
|
1123 |
if(uriSeg.Compare(KNSmlDMMMSName)==0)
|
|
1124 |
{
|
|
1125 |
status = CSmlDmAdapter::ENotFound;
|
|
1126 |
}
|
|
1127 |
else if(uriSeg.Compare(KNSmlDMMMSMMRecep)==0)
|
|
1128 |
{
|
|
1129 |
TMmsReceivingMode rcvHome = iMmsSettings->ReceivingModeHome();
|
|
1130 |
TMmsReceivingMode rcvForeign = iMmsSettings->ReceivingModeForeign();
|
|
1131 |
if ( rcvHome == EMmsReceivingAutomatic )
|
|
1132 |
{
|
|
1133 |
if ( rcvForeign == EMmsReceivingAutomatic )
|
|
1134 |
{
|
|
1135 |
aObject.InsertL( 0, KNSmlDMMMSValueAlwaysOn );
|
|
1136 |
}
|
|
1137 |
else
|
|
1138 |
{
|
|
1139 |
aObject.InsertL( 0, KNSmlDMMMSValueAutomaticAtHome );
|
|
1140 |
}
|
|
1141 |
}
|
|
1142 |
else if ( rcvHome == EMmsReceivingReject )
|
|
1143 |
{
|
|
1144 |
aObject.InsertL( 0, KNSmlDMMMSValueOff );
|
|
1145 |
}
|
|
1146 |
else if ( rcvHome == EMmsReceivingManual )
|
|
1147 |
{
|
|
1148 |
aObject.InsertL( 0, KNSmlDMMMSValueAlwaysManual );
|
|
1149 |
}
|
|
1150 |
else
|
|
1151 |
{
|
|
1152 |
aObject.InsertL( 0, KNSmlDMMMSValueAutomaticAtHome );
|
|
1153 |
}
|
|
1154 |
|
|
1155 |
}
|
|
1156 |
else if(uriSeg.Compare(KNSmlDMMMSCreMode)==0)
|
|
1157 |
{
|
|
1158 |
switch(iMmsSettings->CreationMode())
|
|
1159 |
{
|
|
1160 |
case EMmsCreationModeWarning:
|
|
1161 |
aObject.InsertL(0,KNSmlDMMMSValueWarning);
|
|
1162 |
break;
|
|
1163 |
|
|
1164 |
case EMmsCreationModeFree:
|
|
1165 |
aObject.InsertL(0,KNSmlDMMMSValueFree);
|
|
1166 |
break;
|
|
1167 |
|
|
1168 |
case EMmsCreationModeRestricted:
|
|
1169 |
aObject.InsertL(0,KNSmlDMMMSValueRestricted);
|
|
1170 |
break;
|
|
1171 |
|
|
1172 |
default:
|
|
1173 |
aObject.InsertL(0,KNSmlDMMMSValueWarning);
|
|
1174 |
break;
|
|
1175 |
}
|
|
1176 |
}
|
|
1177 |
else if(uriSeg.Compare(KNSmlDMMMSAMsg)==0)
|
|
1178 |
{
|
|
1179 |
if(iMmsSettings->AcceptAnonymousMessages())
|
|
1180 |
{
|
|
1181 |
aObject.InsertL(0,KNSmlDMMMSValueTrue);
|
|
1182 |
}
|
|
1183 |
else
|
|
1184 |
{
|
|
1185 |
aObject.InsertL(0,KNSmlDMMMSValueFalse);
|
|
1186 |
}
|
|
1187 |
}
|
|
1188 |
else if(uriSeg.Compare(KNSmlDMMMSRcvAds)==0)
|
|
1189 |
{
|
|
1190 |
if(iMmsSettings->AcceptAdvertisementMessages())
|
|
1191 |
{
|
|
1192 |
aObject.InsertL(0,KNSmlDMMMSValueTrue);
|
|
1193 |
}
|
|
1194 |
else
|
|
1195 |
{
|
|
1196 |
aObject.InsertL(0,KNSmlDMMMSValueFalse);
|
|
1197 |
}
|
|
1198 |
}
|
|
1199 |
else if(uriSeg.Compare(KNSmlDMMMSImgSize)==0)
|
|
1200 |
{
|
|
1201 |
if( iMmsSettings->ImageWidth() == KImageRichWidth &&
|
|
1202 |
iMmsSettings->ImageHeight() == KImageRichHeight )
|
|
1203 |
{
|
|
1204 |
aObject.InsertL(0,KNSmlDMMMSValueSmall);
|
|
1205 |
}
|
|
1206 |
else if ( iMmsSettings->ImageWidth() == KImageMegapixelWidth &&
|
|
1207 |
iMmsSettings->ImageHeight() == KImageMegapixelHeight )
|
|
1208 |
{
|
|
1209 |
aObject.InsertL(0,KNSmlDMMMSValueLarge);
|
|
1210 |
}
|
|
1211 |
}
|
|
1212 |
else if(uriSeg.Compare(KNSmlDMMMSDRepSnd)==0)
|
|
1213 |
{
|
|
1214 |
if( iMmsSettings->DeliveryReportSendingAllowed() == KMmsYes)
|
|
1215 |
{
|
|
1216 |
aObject.InsertL(0,KNSmlDMMMSValueFalse);
|
|
1217 |
}
|
|
1218 |
else
|
|
1219 |
{
|
|
1220 |
aObject.InsertL(0,KNSmlDMMMSValueTrue);
|
|
1221 |
}
|
|
1222 |
}
|
|
1223 |
else if(uriSeg.Compare(KNSmlDMMMSRcvRep)==0)
|
|
1224 |
{
|
|
1225 |
if( iMmsSettings->DeliveryReportWanted() == KMmsYes)
|
|
1226 |
{
|
|
1227 |
aObject.InsertL(0,KNSmlDMMMSValueTrue);
|
|
1228 |
}
|
|
1229 |
else
|
|
1230 |
{
|
|
1231 |
aObject.InsertL(0,KNSmlDMMMSValueFalse);
|
|
1232 |
}
|
|
1233 |
}
|
|
1234 |
else if( uriSeg.Compare( KNSmlDMMMSMsgVal ) == 0 )
|
|
1235 |
{
|
|
1236 |
switch(iMmsSettings->ExpiryInterval())
|
|
1237 |
{
|
|
1238 |
case KNSmlDMMMSExpiryHour:
|
|
1239 |
aObject.InsertL(0,KNSmlDMMMSValueHourShort);
|
|
1240 |
break;
|
|
1241 |
|
|
1242 |
case KNSmlDMMMSExpirySixHours:
|
|
1243 |
aObject.InsertL(0,KNSmlDMMMSValueSixHours);
|
|
1244 |
break;
|
|
1245 |
|
|
1246 |
case KNSmlDMMMSExpiryDay:
|
|
1247 |
aObject.InsertL(0,KNSmlDMMMSValueDay);
|
|
1248 |
break;
|
|
1249 |
|
|
1250 |
case KNSmlDMMMSExpiryThreeDays:
|
|
1251 |
aObject.InsertL(0,KNSmlDMMMSValueThreeDays);
|
|
1252 |
break;
|
|
1253 |
|
|
1254 |
case KNSmlDMMMSExpiryWeek:
|
|
1255 |
aObject.InsertL(0,KNSmlDMMMSValueWeek);
|
|
1256 |
break;
|
|
1257 |
|
|
1258 |
case KNSmlDMMMSExpiryMaximum:
|
|
1259 |
aObject.InsertL(0,KNSmlDMMMSValueMaximumTime);
|
|
1260 |
break;
|
|
1261 |
|
|
1262 |
default:
|
|
1263 |
aObject.InsertL(0,KNSmlDMMMSValueThreeDays);
|
|
1264 |
break;
|
|
1265 |
}
|
|
1266 |
}
|
|
1267 |
else if(uriSeg.Compare(KNSmlDMMMSMToNapIDL)==0)
|
|
1268 |
{
|
|
1269 |
TUint32 iap = KNSmlDMMMSIapNotDefined;
|
|
1270 |
TInt32 mmsIap = -1;
|
|
1271 |
|
|
1272 |
|
|
1273 |
if(LastURISeg(RemoveLastURISeg(aURI)).Compare(
|
|
1274 |
KNSmlDMMMSDynamicPrimary)==0)
|
|
1275 |
{
|
|
1276 |
mmsIap = iMmsSettings->AccessPoint( KNSmlDMMMSFirstAccessPointId );
|
|
1277 |
}
|
|
1278 |
|
|
1279 |
if(mmsIap != KErrNotFound )
|
|
1280 |
{
|
|
1281 |
iap = mmsIap;
|
|
1282 |
TRAPD(err, iap =GetIapIdL(iap) );
|
|
1283 |
|
|
1284 |
if( iap != KNSmlDMMMSIapNotDefined && err == KErrNone )
|
|
1285 |
{
|
|
1286 |
CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
|
|
1287 |
CleanupStack::PushL(iapmatch);
|
|
1288 |
|
|
1289 |
HBufC8* uri8 = iapmatch->URIFromIAPIdL( iap );
|
|
1290 |
|
|
1291 |
if( uri8 )
|
|
1292 |
{
|
|
1293 |
CleanupStack::PushL(uri8);
|
|
1294 |
aObject.InsertL(0,uri8->Des());
|
|
1295 |
status = CSmlDmAdapter::EOk;
|
|
1296 |
CleanupStack::PopAndDestroy(); // uri8
|
|
1297 |
}
|
|
1298 |
CleanupStack::PopAndDestroy(); // iapMatch
|
|
1299 |
}
|
|
1300 |
}
|
|
1301 |
}
|
|
1302 |
else if(uriSeg.Compare(KNSmlDMMMSMMSSAddr)==0)
|
|
1303 |
{
|
|
1304 |
CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
|
|
1305 |
CleanupStack::PushL(commDb);
|
|
1306 |
|
|
1307 |
TBool ok = EFalse;
|
|
1308 |
|
|
1309 |
CCommsDbTableView* tableView=0;
|
|
1310 |
|
|
1311 |
TInt apId = iMmsSettings->AccessPoint(KNSmlDMMMSFirstAccessPointId);
|
|
1312 |
|
|
1313 |
if ( apId != KErrNotFound )
|
|
1314 |
{
|
|
1315 |
|
|
1316 |
tableView = commDb->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT),
|
|
1317 |
TPtrC(COMMDB_ID),
|
|
1318 |
apId);
|
|
1319 |
|
|
1320 |
if(tableView->GotoFirstRecord()==KErrNone)
|
|
1321 |
{
|
|
1322 |
TBuf<KCommsDbSvrMaxFieldLength> columnValue;
|
|
1323 |
HBufC* tmpPage;
|
|
1324 |
tmpPage = tableView->ReadLongTextLC(TPtrC(WAP_START_PAGE));
|
|
1325 |
|
|
1326 |
if(err==KErrNone)
|
|
1327 |
{
|
|
1328 |
HBufC8* val8 = HBufC8::NewLC(tmpPage->Size());
|
|
1329 |
TPtr8 valPtr = val8->Des();
|
|
1330 |
CnvUtfConverter::ConvertFromUnicodeToUtf8( valPtr,
|
|
1331 |
*tmpPage);
|
|
1332 |
aObject.InsertL(0,valPtr);
|
|
1333 |
ok = ETrue;
|
|
1334 |
CleanupStack::PopAndDestroy(); //val8
|
|
1335 |
}
|
|
1336 |
CleanupStack::PopAndDestroy(tmpPage);
|
|
1337 |
}
|
|
1338 |
CleanupStack::PopAndDestroy(); //tableview
|
|
1339 |
}
|
|
1340 |
CleanupStack::PopAndDestroy(); //commDb
|
|
1341 |
if(!ok)
|
|
1342 |
{
|
|
1343 |
status = CSmlDmAdapter::EError;
|
|
1344 |
}
|
|
1345 |
}
|
|
1346 |
else
|
|
1347 |
{
|
|
1348 |
status = CSmlDmAdapter::ENotFound;
|
|
1349 |
}
|
|
1350 |
_DBG_FILE("CNSmlDmMMSAdapter::FetchObjectL(): end");
|
|
1351 |
return status;
|
|
1352 |
}
|
|
1353 |
|
|
1354 |
// -----------------------------------------------------------------------------
|
|
1355 |
// void StoreSettingsL()
|
|
1356 |
// Stores the MMS settings to the phone.
|
|
1357 |
//
|
|
1358 |
// -----------------------------------------------------------------------------
|
|
1359 |
void CNSmlDmMMSAdapter::StoreSettingsL()
|
|
1360 |
{
|
|
1361 |
_DBG_FILE("CNSmlDmMMSAdapter::StoreSettingsL(): begin");
|
|
1362 |
if ( iMmsSettings && iMmsClient )
|
|
1363 |
{
|
|
1364 |
iMmsSettings->SaveSettingsL();
|
|
1365 |
iMmsClient->SetSettingsL( *iMmsSettings );
|
|
1366 |
}
|
|
1367 |
_DBG_FILE("CNSmlDmMMSAdapter::StoreSettingsL(): end");
|
|
1368 |
}
|
|
1369 |
|
|
1370 |
// -----------------------------------------------------------------------------
|
|
1371 |
// CSmlDmAdapter::TError ValidateUriL( const TDesC8& aURI )
|
|
1372 |
// Validate URI, return error if not valid.
|
|
1373 |
//
|
|
1374 |
// -----------------------------------------------------------------------------
|
|
1375 |
CSmlDmAdapter::TError CNSmlDmMMSAdapter::ValidateUriL( const TDesC8& aURI )
|
|
1376 |
{
|
|
1377 |
_DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): begin");
|
|
1378 |
CSmlDmAdapter::TError status = EOk;
|
|
1379 |
TPtrC8 parentUri = RemoveLastURISeg(aURI);
|
|
1380 |
switch ( NumOfURISegs( aURI ) )
|
|
1381 |
{
|
|
1382 |
case 3:
|
|
1383 |
if ( parentUri.Match( KNSmlDMMMSLevel3Parents ) != 0 )
|
|
1384 |
{
|
|
1385 |
_DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): 3");
|
|
1386 |
status = ENotFound;
|
|
1387 |
}
|
|
1388 |
break;
|
|
1389 |
case 5:
|
|
1390 |
if ( parentUri.Match( KNSmlDMMMSLevel5Parents ) != 0 )
|
|
1391 |
{
|
|
1392 |
_DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): 5");
|
|
1393 |
status = ENotFound;
|
|
1394 |
}
|
|
1395 |
break;
|
|
1396 |
case 7:
|
|
1397 |
if ( parentUri.Match( KNSmlDMMMSLevel7Parents1 ) != 0 &&
|
|
1398 |
parentUri.Match( KNSmlDMMMSLevel7Parents2 ) != 0)
|
|
1399 |
{
|
|
1400 |
_DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): 7");
|
|
1401 |
status = ENotFound;
|
|
1402 |
}
|
|
1403 |
break;
|
|
1404 |
default:
|
|
1405 |
status = ENotFound;
|
|
1406 |
break;
|
|
1407 |
|
|
1408 |
}
|
|
1409 |
_DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): end");
|
|
1410 |
return status;
|
|
1411 |
}
|
|
1412 |
|
|
1413 |
// -----------------------------------------------------------------------------
|
|
1414 |
// TImplementationProxy ImplementationTable[]
|
|
1415 |
// Needed because of ECOM architecture
|
|
1416 |
// -----------------------------------------------------------------------------
|
|
1417 |
|
|
1418 |
#ifndef IMPLEMENTATION_PROXY_ENTRY
|
|
1419 |
#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)}
|
|
1420 |
#endif
|
|
1421 |
|
|
1422 |
const TImplementationProxy ImplementationTable[] =
|
|
1423 |
{
|
|
1424 |
IMPLEMENTATION_PROXY_ENTRY(KNSmlDMMMSAdapterImplUid,
|
|
1425 |
CNSmlDmMMSAdapter::NewL)
|
|
1426 |
};
|
|
1427 |
|
|
1428 |
// -----------------------------------------------------------------------------
|
|
1429 |
// ImplementationGroupProxy()
|
|
1430 |
// Needed because of ECOM architecture
|
|
1431 |
// -----------------------------------------------------------------------------
|
|
1432 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt&
|
|
1433 |
aTableCount )
|
|
1434 |
{
|
|
1435 |
_DBG_FILE("ImplementationGroupProxy() for CNSmlDmMMSAdapter: begin");
|
|
1436 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
|
1437 |
_DBG_FILE("ImplementationGroupProxy() for CNSmlDmMMSAdapter: end");
|
|
1438 |
return ImplementationTable;
|
|
1439 |
}
|
|
1440 |
|
|
1441 |
|
|
1442 |
//----------------------------------------------------------------------
|
|
1443 |
//TBool CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL(TUint32 aRecord)
|
|
1444 |
//check for wap access point record lock status
|
|
1445 |
//----------------------------------------------------------------------
|
|
1446 |
|
|
1447 |
TBool CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL(TUint32 aRecord)
|
|
1448 |
{
|
|
1449 |
_DBG_FILE("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL(): BEGIN");
|
|
1450 |
|
|
1451 |
TBool ret = EFalse;
|
|
1452 |
CCommsDbTableView* wapView;
|
|
1453 |
DBG_ARGS8(_S8("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL record being checked = %d"),aRecord);
|
|
1454 |
wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT),
|
|
1455 |
TPtrC(COMMDB_ID),
|
|
1456 |
aRecord);
|
|
1457 |
|
|
1458 |
TInt aAccess( 0 );
|
|
1459 |
if(wapView!=NULL)
|
|
1460 |
{
|
|
1461 |
_DBG_FILE("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL():wap record exists, check for access type");
|
|
1462 |
TInt err = (((CCommsDbProtectTableView*) wapView )->GetRecordAccess( aAccess ) );
|
|
1463 |
DBG_ARGS8(_S8("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess);
|
|
1464 |
CleanupStack::PopAndDestroy( wapView);
|
|
1465 |
if(aAccess == RDbRowSet::EReadOnly)
|
|
1466 |
ret = ETrue;
|
|
1467 |
}
|
|
1468 |
|
|
1469 |
_DBG_FILE("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL(): END");
|
|
1470 |
return ret;
|
|
1471 |
|
|
1472 |
}
|
|
1473 |
//----------------------------------------------------------------------
|
|
1474 |
//TBool CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect)
|
|
1475 |
// protect or unprotect wapaccesspoint record of access point being altered
|
|
1476 |
//----------------------------------------------------------------------
|
|
1477 |
|
|
1478 |
|
|
1479 |
TInt CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect)
|
|
1480 |
{
|
|
1481 |
_DBG_FILE("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(): BEGIN");
|
|
1482 |
DBG_ARGS8(_S8("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL , record and protect value =%d = %d"),aRecord, aProtect);
|
|
1483 |
TInt err = KErrNone;
|
|
1484 |
|
|
1485 |
CCommsDbTableView* wapView;
|
|
1486 |
wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT),
|
|
1487 |
TPtrC(COMMDB_ID),
|
|
1488 |
aRecord);
|
|
1489 |
if( wapView != NULL )
|
|
1490 |
{
|
|
1491 |
_DBG_FILE("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(): wap record exists");
|
|
1492 |
if( !aProtect )
|
|
1493 |
{
|
|
1494 |
err = ( (CCommsDbProtectTableView*) wapView )->UnprotectRecord();
|
|
1495 |
DBG_ARGS8(_S8("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL ,error code of Unprotectrecord = %d"),err);
|
|
1496 |
}
|
|
1497 |
|
|
1498 |
else
|
|
1499 |
{
|
|
1500 |
err = ( (CCommsDbProtectTableView*) wapView )->ProtectRecord();
|
|
1501 |
DBG_ARGS8(_S8("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL ,error code of ProtectRecord = %d"),err);
|
|
1502 |
}
|
|
1503 |
|
|
1504 |
CleanupStack::PopAndDestroy( wapView);
|
|
1505 |
}
|
|
1506 |
|
|
1507 |
_DBG_FILE("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(): END");
|
|
1508 |
return err;
|
|
1509 |
}
|
|
1510 |
|
|
1511 |
|
|
1512 |
|
|
1513 |
|
|
1514 |
// End of File
|