omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSAdapter.cpp
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Handles MMS settings in provisioning.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CWPWAPMMSAdapter.h"
       
    22 #include <e32base.h>
       
    23 #include <CWPAdapter.h>
       
    24 #include <CWPCharacteristic.h>
       
    25 #include <CWPParameter.h>
       
    26 #include <wpwapadapterresource.rsg>
       
    27 #include <ApDataHandler.h>
       
    28 #include "MWPWAPItemBase.h"
       
    29 #include "WPWAPUtil.h"
       
    30 #include "WPWAPItemFactory.h"
       
    31 
       
    32 // CONSTANTS
       
    33 _LIT( KMMSAppID, "w4" );
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS ===============================
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CWPWAPMMSAdapter::CWPWAPMMSAdapter
       
    39 // C++ default constructor can NOT contain any code, that
       
    40 // might leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CWPWAPMMSAdapter::CWPWAPMMSAdapter()
       
    44     {
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CWPWAPMMSAdapter::ConstructL
       
    49 // Symbian 2nd phase constructor can leave.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 void CWPWAPMMSAdapter::ConstructL()
       
    53     {
       
    54     BaseConstructL();
       
    55 
       
    56     iTitle = WPWAPUtil::ReadHBufCL( R_QTN_SM_MMS_ACCESSPOINTS );
       
    57     iDefaultName = WPWAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME );
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CWPWAPMMSAdapter::NewL
       
    62 // Two-phased constructor.
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 CWPWAPMMSAdapter* CWPWAPMMSAdapter::NewL()
       
    66     {
       
    67     CWPWAPMMSAdapter* self = new(ELeave) CWPWAPMMSAdapter; 
       
    68     CleanupStack::PushL(self);
       
    69     self->ConstructL();
       
    70     CleanupStack::Pop(self);
       
    71     return self;
       
    72     }
       
    73 
       
    74 // Destructor
       
    75 CWPWAPMMSAdapter::~CWPWAPMMSAdapter()
       
    76     {
       
    77     delete iTitle;
       
    78     delete iDefaultName;
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CWPWAPMMSAdapter::ApplicationL
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CWPWAPMMSAdapter::ApplicationL( CWPCharacteristic& aCharacteristic )
       
    86     {
       
    87     if( iItems.Count() == 0 && iAppID == KMMSAppID )
       
    88         {
       
    89         MWPWAPItemBase* item = WPWAPItemFactory::CreateMMSLC( *iTitle, *iDefaultName, 
       
    90             aCharacteristic, iCommsDb, iAPHandler );
       
    91         if( item->ValidateL() )
       
    92             {
       
    93             item->AddL( iItems, iHiddenItems );
       
    94             CleanupStack::Pop(); // item
       
    95             }
       
    96         else
       
    97             {
       
    98             CleanupStack::PopAndDestroy(); // item
       
    99             }
       
   100         }
       
   101     }
       
   102 
       
   103 //  End of File