diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/src/upnpaiwmovetoexternalservice.cpp --- a/upnpframework/upnpaiwprovider/src/upnpaiwmovetoexternalservice.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,267 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the UpnpAiwMoveToExternalService -* -*/ - - -#include -#include -#include -#include -#include "upnpaiwengine.h" -#include "upnpaiwmovetoexternalservice.h" -#include "upnpdrmfilter.h" - -_LIT( KComponentLogfile, "upnpaiwprovider.log" ); -#include "upnplog.h" - -// CONSTANTS -_LIT( KResFileName, "\\resource\\upnpaiwmenuresources.rsc" ); - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::NewL -// NewL. -// -------------------------------------------------------------------------- -CUPnPAiwMoveToExternalService* CUPnPAiwMoveToExternalService::NewL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::NewL" ); - - CUPnPAiwMoveToExternalService* self = - new (ELeave) CUPnPAiwMoveToExternalService; - CleanupStack::PushL( self ); - - self->ConstructL(); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::CUPnPAiwMoveToExternalService -// Constructor. -// -------------------------------------------------------------------------- -CUPnPAiwMoveToExternalService::CUPnPAiwMoveToExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\ -CUPnPAiwMoveToExternalService" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::~CUPnPAiwMoveToExternalService -// Destructor. -// -------------------------------------------------------------------------- -CUPnPAiwMoveToExternalService::~CUPnPAiwMoveToExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\ -~CUPnPAiwMoveToExternalService" ); - - // Empty the file name array and close it - EmptyFileNameArray(); - iFileNames.Close(); - - // Release the engine instance - if( iEngine ) - { - CUPnPAiwEngine::ReleaseInstance(); - iEngine = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::ConstructL -// Second phase constructor. -// -------------------------------------------------------------------------- -void CUPnPAiwMoveToExternalService::ConstructL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::ConstructL" ); - - // Create the engine and register as an observer for call backs - iEngine = CUPnPAiwEngine::NewL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::InitializeMenuPaneL -// AIW Framework's method for initialising the menu -// -------------------------------------------------------------------------- -void CUPnPAiwMoveToExternalService::InitializeMenuPaneL( - CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt /*aCascadeId*/, - const CAiwGenericParamList& /*aInParamList*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\ -InitializeMenuPaneL" ); - - TUPnPEngineState engineState = iEngine->EngineState(); - if( engineState == EUPnPEngineNotConnected || - engineState == EUPnPEngineConnectionLost ) - { - // Update the drive letter to the path of the resource file name - TFileName resFile( KResFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' - resFile.Insert( 0, drive ); - - // Add the play menu item to the menu pane - aMenuPane.AddMenuItemsL( resFile, - R_AIW_MOVE_TO_EXTERNAL_MENU, - KAiwCmdUPnPMove, - aIndex ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::HandleMenuCmdL -// AIW Framework's method for handling menu commands -// -------------------------------------------------------------------------- -void CUPnPAiwMoveToExternalService::HandleMenuCmdL( - TInt aMenuCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* /*aCallback*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\ -HandleMenuCmdL" ); - - // Empty the file name array - EmptyFileNameArray(); - - // Get the file name parameters - if( aInParamList.Count() > 0 ) - { - for( TInt index = 0; index < aInParamList.Count(); index++ ) - { - // Get the filenames - if ( aInParamList[index].SemanticId() == EGenericParamFile ) - { - // Store the file name in the array - HBufC* fileName = HBufC::NewLC( - aInParamList[index].Value().AsDes().Length() ); - fileName->Des().Append( - aInParamList[index].Value().AsDes() ); - iFileNames.AppendL( fileName ); - CleanupStack::Pop( fileName ); - } - } - } - - if( aMenuCmdId == KAiwCmdUPnPMove ) - { - if( iEngine ) - { - if( iFileNames.Count()>0 ) - { - // Do the move - TInt returnValue = KErrArgument; - TRAP( returnValue, - iEngine->MoveToExternalL( iFileNames ) ); - - // Do some error translation regarding DRM protected files - if ( returnValue == KErrNotSupported || - returnValue == KErrPermissionDenied ) - { - returnValue = KErrAccessDenied; - } - - // Add the return value on the out param list - TAiwGenericParam statusParameter( - EGenericParamError, - returnValue ); - aOutParamList.AppendL( statusParameter ); - - // Add the files that FAILED to copy to out param list. - // finally, reset the array. - for( TInt index=0; indexHandleNotifyL( KAiwCmdUPnPMove, - eventCode, - *emptyParamlist, - *emptyParamlist ); - - // Clean up - CleanupStack::PopAndDestroy( emptyParamlist ); - emptyParamlist = NULL; - } - } - -// End of file