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