diff -r c8e5c3d81b42 -r 39aa16f3fdc2 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSItem.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSItem.cpp Wed Jun 23 19:10:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* -* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: One MMS setting item. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CWPWAPMMSItem.h" -#include "WPWAPItemFactory.h" -#include "WPWAPUtil.h" - -#ifdef __MESSAGING_API_V2__ -#include -#endif - -// CONSTANTS -const TInt KUrlMaxLength = 255; - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::CWPWAPMMSItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPWAPMMSItem::CWPWAPMMSItem( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aDb, - RCmManagerExt*& aCmManager ) -: CWPWAPItemBase( aTitle, aDefaultName, aCharacteristic, aDb, aCmManager ) - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::ConstructL() - { - BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPWAPMMSItem* CWPWAPMMSItem::NewL( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aDb, - RCmManagerExt*& aCmManager ) - { - CWPWAPMMSItem* self = new(ELeave) CWPWAPMMSItem( aTitle, aDefaultName, - aCharacteristic, aDb, aCmManager ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// Destructor -CWPWAPMMSItem::~CWPWAPMMSItem() - { - iLinks.Close(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::SaveL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::SaveL() - { - CreateDbL(); - TBool check = EFalse; - RCmConnectionMethodExt cm; - TUint32 bearer = 0; - for( TInt i( 0 ); i < iLinks.Count() && check == EFalse ; i++ ) - { - CWPCharacteristic* curr = iLinks[i]; - TPckgBuf uidPckg; - const TInt pkgLength( uidPckg.MaxLength() ); - for( TInt dataNum( 0 ); check == EFalse && curr->Data( dataNum ).Length() == pkgLength;dataNum++ ) - { - uidPckg.Copy( curr->Data( dataNum ) ); - // Read the access point pointed to by TO-NAPID or TO-PROXY - cm = iCmManager->ConnectionMethodL( uidPckg() ); - CleanupClosePushL( cm ); - bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); - if( bearer == KUidPacketDataBearerType ) - { - // Item left on cleanup stack - check = ETrue; - } - else - { - CleanupStack::PopAndDestroy(); // cm - } - } - } - - WriteHomePageL( cm ); - CleanupStack::PopAndDestroy(); // cm - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::CanSetAsDefault -// ----------------------------------------------------------------------------- -// -TBool CWPWAPMMSItem::CanSetAsDefault() const - { - return ETrue; - } - - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::SetAsDefaultL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::SetAsDefaultL() - { - // Open Messaging Server session - CMsvSession* session = CMsvSession::OpenSyncL( *this ); - CleanupStack::PushL( session ); - - // Read the MMS client information via registry - CClientMtmRegistry* registry = CClientMtmRegistry::NewL( *session ); - CleanupStack::PushL( registry ); - - CMmsClientMtm* mmsClient = - static_cast( registry->NewMtmL( KUidMsgTypeMultimedia ) ); - CleanupStack::PushL( mmsClient ); - -#ifdef __MESSAGING_API_V2__ - - CMmsSettings* mmsSettings = CMmsSettings::NewL(); - CleanupStack::PushL( mmsSettings ); - - mmsClient->RestoreSettingsL(); - - mmsSettings->CopyL( mmsClient->MmsSettings() ); - TInt apCount = mmsSettings->AccessPointCount(); - TInt index; - for ( index = 0; index < apCount; index++) - { - mmsSettings->DeleteAccessPointL( 0 ); - } - mmsSettings->AddAccessPointL( iUID, 0 ); - - mmsClient->SetSettingsL( *mmsSettings ); - mmsClient->StoreSettingsL(); - - CleanupStack::PopAndDestroy(); // mmsSettings - -#else - - mmsClient->LoadMessageL(); - // Set the correct access point and save - mmsClient->SetFirstAccessPoint( iUID ); - mmsClient->SaveMessageL(); - -#endif - - CleanupStack::PopAndDestroy(3); // mmsClient, registry, session - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::ValidateL -// ----------------------------------------------------------------------------- -// -TBool CWPWAPMMSItem::ValidateL() - { - return iLinks.Count() > 0 - && iAddr - && iAddr->Length() <=KUrlMaxLength - && WPWAPUtil::CheckURI( *iAddr ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::ResourceL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::ResourceL( CWPCharacteristic& aResource ) - { - RFavouritesDb favouritesDb; - MWPWAPItemBase* item = WPWAPItemFactory::CreateBookmarkLC( KNullDesC, - KNullDesC, aResource, iLink, favouritesDb ); // iDb is NULL but it's not used. - - // Not supporting resources without startpage. - if ( item->CanSetAsDefault() && !iAddr ) - { - iAddr = item->Address().AllocL(); - } - CleanupStack::PopAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::AddL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::AddL( RPointerArray& aShownItems, - RPointerArray& /*aHiddenItems*/ ) - { - User::LeaveIfError( aShownItems.Append( this ) ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::VisitLinkL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::VisitLinkL( CWPCharacteristic& aLink ) - { - CWPWAPItemBase::VisitLinkL( aLink ); - User::LeaveIfError( iLinks.Append( &aLink ) ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::HandleSessionEventL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, - TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) - { - } - - - -// End of File