diff -r 839377eedc2b -r befca0ec475f filedetails/filedetailsplugin/src/filedetailsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filedetails/filedetailsplugin/src/filedetailsplugin.cpp Wed Sep 01 12:30:28 2010 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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 file details plugin* +*/ +#include +#include +#include "filedetailsplugin.h" +#include +#include +#include +#include +#include + +const TInt KThousandNotKilobyte = 1000; + +// ----------------------------------------------------------------------------- +// CFileDetailsPlugin::NewL +// +// ----------------------------------------------------------------------------- +// +CFileDetailsPlugin* CFileDetailsPlugin::NewL() + { + CFileDetailsPlugin* self = + new (ELeave) CFileDetailsPlugin(); + + return self; + } + +// ----------------------------------------------------------------------------- +// CFileDetailsPlugin::CFileDetailsPlugin +// +// ----------------------------------------------------------------------------- +// +CFileDetailsPlugin::CFileDetailsPlugin() + { + } + +// ----------------------------------------------------------------------------- +// CFileDetailsPlugin::~CFileDetailsPlugin +// +// ----------------------------------------------------------------------------- +// +CFileDetailsPlugin::~CFileDetailsPlugin() + { + } + +// ----------------------------------------------------------------------------- +// CFileDetailsPlugin::~CFileDetailsPlugin +// +// ----------------------------------------------------------------------------- +// +void CFileDetailsPlugin::ShowFileDetailsL( const CMPXMedia& aMedia ) + { + CMPFileDetails* details = new (ELeave) CMPFileDetails(); + CleanupStack::PushL( details ); + + //File path + if ( aMedia.IsSupported( KMPXMediaGeneralUri ) ) + { + details->iFilePath = aMedia.ValueText( KMPXMediaGeneralUri ).AllocL(); + } + + //Name + if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) ) + { + details->iTitle = aMedia.ValueText( KMPXMediaGeneralTitle ).AllocL(); + } + else if ( details->iFilePath ) + { + details->iTitle = details->iFilePath->AllocLC(); + } + + //Duration + if ( aMedia.IsSupported( KVcxMediaMyVideosDuration ) ) + { + TReal32 length = *(aMedia.Value( KVcxMediaMyVideosDuration )); + if ( length > 0 ) + { + details->iDurationInSeconds = static_cast( length ); + } + } + + //File size + if ( aMedia.IsSupported( KMPXMediaGeneralExtSizeInt64 ) ) + { + details->iSize = *(aMedia.Value( KMPXMediaGeneralExtSizeInt64 )); + } + + //Copyright + if ( aMedia.IsSupported( KMPXMediaGeneralCopyright ) ) + { + details->iCopyright = aMedia.ValueText( KMPXMediaGeneralCopyright ).AllocL(); + } + + //MIME + if ( aMedia.IsSupported( KMPXMediaGeneralMimeType ) ) + { + details->iFormat = aMedia.ValueText( KMPXMediaGeneralMimeType ).AllocL(); + } + + // File creation date + if ( aMedia.IsSupported( KMPXMediaGeneralDate ) ) + { + details->iTime = *aMedia.Value( KMPXMediaGeneralDate ) ; + } + + // Bit rate + if ( aMedia.IsSupported( KMPXMediaVideoBitRate ) ) + { + // Multiplied by 1k as the value provided by MDS is kbps and file + // details dialog assumes it get bps + details->iBitrate = *aMedia.Value( KMPXMediaVideoBitRate ) * KThousandNotKilobyte ; + } + + // Height + if ( aMedia.IsSupported( KMPXMediaVideoHeight ) ) + { + details->iResolutionHeight = *aMedia.Value( KMPXMediaVideoHeight ); + } + + // Width + if ( aMedia.IsSupported( KMPXMediaVideoWidth ) ) + { + details->iResolutionWidth = *aMedia.Value( KMPXMediaVideoWidth ); + } + + //Artist + if ( aMedia.IsSupported( KMPXMediaVideoArtist ) ) + { + details->iArtist = aMedia.ValueText( KMPXMediaVideoArtist ).AllocL(); + } + + // Show details dialog + CMPFileDetailsDialog* detailsDialog = CMPFileDetailsDialog::NewL(); + detailsDialog->ExecuteLD( details ); + + CleanupStack::PopAndDestroy( details ); + }