omacpadapters/WAPAdapter/Src/CWPWAPMMSAdapter.cpp
changeset 47 d316aecb87fd
child 67 fdbfe0a95492
equal deleted inserted replaced
46:b9b00b134b0d 47:d316aecb87fd
       
     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 "MWPWAPItemBase.h"
       
    28 #include "WPWAPUtil.h"
       
    29 #include "WPWAPItemFactory.h"
       
    30 
       
    31 // CONSTANTS
       
    32 _LIT( KMMSAppID, "w4" );
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CWPWAPMMSAdapter::CWPWAPMMSAdapter
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CWPWAPMMSAdapter::CWPWAPMMSAdapter()
       
    43     {
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CWPWAPMMSAdapter::ConstructL
       
    48 // Symbian 2nd phase constructor can leave.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CWPWAPMMSAdapter::ConstructL()
       
    52     {
       
    53     BaseConstructL();
       
    54 
       
    55     iTitle = WPWAPUtil::ReadHBufCL( R_QTN_SM_MMS_ACCESSPOINTS );
       
    56     iDefaultName = WPWAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME );
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CWPWAPMMSAdapter::NewL
       
    61 // Two-phased constructor.
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 CWPWAPMMSAdapter* CWPWAPMMSAdapter::NewL()
       
    65     {
       
    66     CWPWAPMMSAdapter* self = new(ELeave) CWPWAPMMSAdapter; 
       
    67     CleanupStack::PushL(self);
       
    68     self->ConstructL();
       
    69     CleanupStack::Pop(self);
       
    70     return self;
       
    71     }
       
    72 
       
    73 // Destructor
       
    74 CWPWAPMMSAdapter::~CWPWAPMMSAdapter()
       
    75     {
       
    76     delete iTitle;
       
    77     delete iDefaultName;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CWPWAPMMSAdapter::ApplicationL
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 void CWPWAPMMSAdapter::ApplicationL( CWPCharacteristic& aCharacteristic )
       
    85     {
       
    86     if( iItems.Count() == 0 && iAppID == KMMSAppID )
       
    87         {
       
    88         MWPWAPItemBase* item = WPWAPItemFactory::CreateMMSLC( *iTitle, *iDefaultName, 
       
    89             aCharacteristic, iCommsDb, iCmManager );
       
    90         if( item->ValidateL() )
       
    91             {
       
    92             item->AddL( iItems, iHiddenItems );
       
    93             CleanupStack::Pop(); // item
       
    94             }
       
    95         else
       
    96             {
       
    97             CleanupStack::PopAndDestroy(); // item
       
    98             }
       
    99         }
       
   100     }
       
   101 
       
   102 //  End of File