# HG changeset patch # User William Roberts # Date 1279812950 -3600 # Node ID 442486f870da77422101cb14eb2084f178b2df0c # Parent abec8b1bb37cdaaf1f4f83eb078814ebd9896c40# Parent e824080bd1195c389e3e13cca948519d819b06d4 Catchup to latest Symbian^4 diff -r abec8b1bb37c -r 442486f870da commondrm/commondrm.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/commondrm.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2010 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: Commondrm main level project file. +# + +TEMPLATE = subdirs + +SYMBIAN_PLATFORMS = WINSCW ARMV5 + +SUBDIRS += drmbrowserlauncher/drmbrowserlauncher.pro +SUBDIRS += drmqtencryptor/qt_drmencryptor.pro +SUBDIRS += drmutility/group/qt/drmutilitydmgrwrapper.pro +SUBDIRS += drmutility/group/qt/drmuihandlingimpl.pro +SUBDIRS += drmui/drmuinotifications/drmuinotifications.pro diff -r abec8b1bb37c -r 442486f870da commondrm/drmbrowserlauncher/bwinscw/DRMBrowserLauncheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmbrowserlauncher/bwinscw/DRMBrowserLauncheru.def Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + ?LaunchUrlL@CDrmBrowserLauncher@DRM@@QAEXAAVTDesC16@@@Z @ 1 NONAME ; void DRM::CDrmBrowserLauncher::LaunchUrlL(class TDesC16 &) + ?NewLC@CDrmBrowserLauncher@DRM@@SAPAV12@XZ @ 2 NONAME ; class DRM::CDrmBrowserLauncher * DRM::CDrmBrowserLauncher::NewLC(void) + ?NewL@CDrmBrowserLauncher@DRM@@SAPAV12@XZ @ 3 NONAME ; class DRM::CDrmBrowserLauncher * DRM::CDrmBrowserLauncher::NewL(void) + diff -r abec8b1bb37c -r 442486f870da commondrm/drmbrowserlauncher/drmbrowserlauncher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmbrowserlauncher/drmbrowserlauncher.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,52 @@ +# +# Copyright (c) 2010 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: +# + + +TEMPLATE = lib +TARGET = drmbrowserlauncher + +symbian: +{ +TARGET.UID1 = 0x1000008D +TARGET.UID3 = 0x200315BC + +TARGET.CAPABILITY = CAP_GENERAL_DLL +TARGET.VID = VID_DEFAULT +TARGET.EPOCALLOWDLLDATA = 1 + +defBlock = \ + "$${LITERAL_HASH}if defined(ARMCC)" \ + "DEFFILE ./eabi/" \ + "$${LITERAL_HASH}elif defined( WINSCW )" \ + "DEFFILE ./bwinscw/" \ + "$${LITERAL_HASH}elif defined( WINS )" \ + "DEFFILE ./bwins/" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ./bmarm/" \ + "$${LITERAL_HASH}endif" + + MMP_RULES += defBlock + + MMP_RULES -= "OPTION_REPLACE ARMCC --export_all_vtbl // don't use --export_all_vtbl" +} + +DEPENDPATH += . +DEPENDPATH += ./src + +INCLUDEPATH += ../../inc + +SOURCES += drmbrowserlauncher.cpp + diff -r abec8b1bb37c -r 442486f870da commondrm/drmbrowserlauncher/eabi/DRMBrowserLauncheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmbrowserlauncher/eabi/DRMBrowserLauncheru.def Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + _ZN3DRM19CDrmBrowserLauncher10LaunchUrlLER7TDesC16 @ 1 NONAME + _ZN3DRM19CDrmBrowserLauncher4NewLEv @ 2 NONAME + _ZN3DRM19CDrmBrowserLauncher5NewLCEv @ 3 NONAME + diff -r abec8b1bb37c -r 442486f870da commondrm/drmbrowserlauncher/src/drmbrowserlauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmbrowserlauncher/src/drmbrowserlauncher.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2006-2009 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: DRM Browser Launcher class +* +*/ + + +// INCLUDE FILES +#include "drmbrowserlauncher.h" +#include +#include +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +DRM::CDrmBrowserLauncher::CDrmBrowserLauncher() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +DRM::CDrmBrowserLauncher::~CDrmBrowserLauncher() + { + } + +// ----------------------------------------------------------------------------- +// CDrmBrowserLauncher::NewLC +// First phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C DRM::CDrmBrowserLauncher* DRM::CDrmBrowserLauncher::NewLC() + { + DRM::CDrmBrowserLauncher* self( new( ELeave ) CDrmBrowserLauncher ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CDrmBrowserLauncher::NewL +// First phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C DRM::CDrmBrowserLauncher* DRM::CDrmBrowserLauncher::NewL() + { + DRM::CDrmBrowserLauncher* self( NewLC() ); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// CDrmBrowserLauncher::LaunchUrlL +// Static method for launching the Browser with a given URL. +// ----------------------------------------------------------------------------- +// +EXPORT_C void DRM::CDrmBrowserLauncher::LaunchUrlL(TDesC &aUrl) + { + // convert given URL to QUrl format + QString urlString = QString::fromUtf16(aUrl.Ptr(), aUrl.Length()); + QUrl* url = new QUrl(urlString); + bool ret = QDesktopServices::openUrl(*url); + if(!ret) + { + User::Leave(KErrNotFound); + } + + } + +void DRM::CDrmBrowserLauncher::ConstructL() + { + } + + + +// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/data/DRMEncryptor.rss --- a/commondrm/drmencryptor/data/DRMEncryptor.rss Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,466 +0,0 @@ -/* -* Copyright (c) 2004 - 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: -* -*/ - - -// RESOURCE IDENTIFIER -NAME DRME // 4 letter ID - -// INCLUDES - -#include "DRMEncryptor.rh" -#include "DRMEncryptor.hrh" -#include -#include - -#include -#include -#include -#include - -#include - -RESOURCE RSS_SIGNATURE {} - -RESOURCE TBUF { buf= ""; } - -RESOURCE EIK_APP_INFO - { - cba = R_AVKON_SOFTKEYS_EXIT; - cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; - menubar = r_DrmEncryptor_menubar; - // no menu bar - } - -// --------------------------------------------------------- -// -// r_helloworldbasic_menubar -// Menubar for HelloWorldBasic example -// -// --------------------------------------------------------- -// -RESOURCE MENU_BAR r_DrmEncryptor_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_DrmEncryptor_menu; - } - }; - } - - -// --------------------------------------------------------- -// -// r_helloworldbasic_menu -// Menu for "Options" -// -// --------------------------------------------------------- -// -RESOURCE MENU_PANE r_DrmEncryptor_menu - { - items = - { - MENU_ITEM - { - command = EDrmEncryptorUICommand1; - txt = "Encrypt"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDrmEncryptorKeyCommand; - txt = "Import Keys"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDrmEncryptorDeleteCommand; - txt = "Delete Database"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDrmTimeCommand; - txt = "DRMClock time"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = ESetDrmTimeCommand; - txt = "Set DRMClock"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EAddROsIntoDb; - txt = "Process multiple ROs"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDrmBb5KeyTestCommand; - txt = "Bb5KeyTest"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDRMPlayServerCommand; - txt = "DrmPlayServerTest"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDRM_API_BATUICommand3; - txt = "Run Performance test"; - cascade=r_DRM_API_sub_menu_1; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDrmEncryptorDeleteWmDrmCommand; - txt = "Delete WmDrm Rights"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDrmEncryptorBackupWmDrmCommand; - txt = "Backup WmDrm DB"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDrmEncryptorRestoreWmDrmCommand; - txt = "Restore WmDrm DB"; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EAknSoftkeyExit; - txt = "Exit"; - } - }; - } - - -RESOURCE TITLE_PANE r_DRMEncryptor_title_pane - { - txt = "DRMEncryptor"; - } - -// Texts and images appear in this order on the DRMEncryptor screen. -// Every new text item starts from a new line. - -RESOURCE DRMEncryptor_ITEM_LIST r_DRMEncryptor_main_text - { - items = - { - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_1; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_2; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_3; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_4; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_5; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_6; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_7; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_8; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_9; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_10; - }, - DRMEncryptor_TEXT - { - txt = r_DRMEncryptor_copyright_text_11; - } - }; - } - -RESOURCE DIALOG r_drm_time_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtMultilineQuery; - id = EMultilineFirstLine; - control = AVKON_DATA_QUERY - { - layout = EMultiDataFirstDateEd; - label = "Date"; - control = DATE_EDITOR - { - minDate = DATE - { - year = 1900; - }; - maxDate = DATE - { - year = 2100; - }; - flags = 0; - }; - }; - }, - DLG_LINE - { - type = EAknCtMultilineQuery; - id = EMultilineSecondLine; - control = AVKON_DATA_QUERY - { - layout = EMultiDataSecondTimeEd; - label = "Time"; - control = TIME_EDITOR - { - minTime = TIME - { - second = 0; - minute = 0; - hour = 0; - }; - maxTime = TIME - { - second = 59; - minute = 59; - hour = 23; - }; - flags = 0; - }; - }; - } - }; - } - -///////////////////////////////// -// PERFORMANCE -/////////////////////////////// - -// --------------------------------------------------------- -// -// r_DRM_API_sub_menu_1 -// SubMenu for "Options->Performance" -// -// --------------------------------------------------------- -// -RESOURCE MENU_PANE r_DRM_API_sub_menu_1 - { - items= - { - MENU_ITEM - { - command=EDRM_API_SubMenuId_1; - txt="Generate test files"; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - txt="RFile plain"; - cascade=r_DRM_API_sub_menu_1_1; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - txt="CAF plain"; - cascade=r_DRM_API_sub_menu_1_2; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - txt="DRM"; - cascade=r_DRM_API_sub_menu_1_3; - flags = EEikMenuItemSpecific; - } - }; - } - -// --------------------------------------------------------- -// -// r_DRM_API_sub_menu_1 -// SubMenu for "Options->Performance->RFile" -// -// --------------------------------------------------------- -// -RESOURCE MENU_PANE r_DRM_API_sub_menu_1_1 - { - items= - { - MENU_ITEM - { - command=EDRM_API_SubMenuId_1_1; - txt="File opening"; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command=EDRM_API_SubMenuId_1_2; - txt="Sequential"; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command=EDRM_API_SubMenuId_1_3; - txt="Random"; - flags = EEikMenuItemSpecific; - } - }; - } -// --------------------------------------------------------- -// -// r_DRM_API_sub_menu_1 -// SubMenu for "Options->Performance->CAF" -// -// --------------------------------------------------------- -// -RESOURCE MENU_PANE r_DRM_API_sub_menu_1_2 - { - items= - { - MENU_ITEM - { - command=EDRM_API_SubMenuId_2_1; - txt="File opening"; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command=EDRM_API_SubMenuId_2_2; - txt="Sequential"; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command=EDRM_API_SubMenuId_2_3; - txt="Random"; - flags = EEikMenuItemSpecific; - } - }; - } - -// --------------------------------------------------------- -// -// r_DRM_API_sub_menu_1 -// SubMenu for "Options->Performance->DRM" -// -// --------------------------------------------------------- -// -RESOURCE MENU_PANE r_DRM_API_sub_menu_1_3 - { - items= - { - MENU_ITEM - { - command=EDRM_API_SubMenuId_3_1_1; - txt="File Opening"; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command=EDRM_API_SubMenuId_3_1_2; - txt="File Opening with ExecuteIntent"; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command=EDRM_API_SubMenuId_3_1_3; - txt="Sequential"; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command=EDRM_API_SubMenuId_3_1_4; - txt="Random"; - flags = EEikMenuItemSpecific; - } - }; - } - -RESOURCE DIALOG r_aknicon_icon_size_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = ENumberLayout; - label = "Add multiplier"; - control = AVKON_INTEGER_EDWIN - { - min = 0; - max = 1000; - }; - }; - } - }; - } - -RESOURCE TBUF r_DRMEncryptor_copyright_text_1 { buf = "DRMEncryptor - tool to process OMA DRM 1.0 content into terminal."; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_2 { buf = "Encryptor tool will process DRM messages (.dm) from e:\DRM - directory. If the directory does not exist, it will be created during the first execution. Output files will be placed into e:\Others -directory. On the emulator, the c: drive is used instead of the e: drive"; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_3 { buf = "Encryptor tool process separate delivery rights objects (.oro && .ro && .drc && dr). Place the files under e:\DRM directory and press Encrypt."; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_4 { buf = "With tool the PKI -keys can be imported into hardware. PKI -key files should be placed under e:\DRM\keys."; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_5 { buf = "The tool also allows removal of all rights in the rights database."; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_6 { buf = "DRMClock can be viewed via menu. DRM Time is shown as nitz time."; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_7 { buf = "DRMClock can be set via menu. Use Options -> Set DRM clock."; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_8 { buf = "DRMEncryptor can be used for processing same RO for multiple times. Place ROs into e:\drm -folder and choose Options->Process multiple ROs->add multiplier which will be used for every processed RO."; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_9 { buf = "DRMEncryptor can be used for checking that DrmPlayServer's usage is prohibited for WMDRM files. Place any WMDRM file named as test.wma into e:\drm and choose Options->DrmPlayServerTest"; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_10 { buf = "DRMEncryptor can be used for making backup and restoring WMDRM SQlite License Store. Backup will make a copy of [10282F1B]hds.db to e:\[10282F1B]hds.db. Restore will copy e:\[10282F1B]hds.db back to c:\private\10281e17\[10282F1B]hds.db"; } -RESOURCE TBUF r_DRMEncryptor_copyright_text_11 { buf = "This tool is purposed only for R&D and should not be used commercially. Copyright © 2004 Nokia. All rights reserved."; } - - -RESOURCE LOCALISABLE_APP_INFO r_DRMEncryptor_localisable_app_info - { - short_caption = "DRMEncryptor"; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = "DRMEncryptor"; - }; - } - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/data/DRMEncryptor_caption.rss --- a/commondrm/drmencryptor/data/DRMEncryptor_caption.rss Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#include - -RESOURCE CAPTION_DATA - { - caption = "DRMEncryptor"; - shortcaption = "DRM"; - } diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/data/DRMEncryptor_reg.rss --- a/commondrm/drmencryptor/data/DRMEncryptor_reg.rss Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2004 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: -* -*/ - - -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x01105901 // 0x10005A22 // Define your application UID here - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "DRMEncryptor"; - - - localisable_resource_file = APP_RESOURCE_DIR"\\DRMEncryptor"; - - localisable_resource_id = R_DRMENCRYPTOR_LOCALISABLE_APP_INFO; - datatype_list = - { - DATATYPE - { - priority = EDataTypePriorityNormal; - type = "application/x-device-key-chain"; - } - }; - } - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/group/DRMEncryptor.mmp --- a/commondrm/drmencryptor/group/DRMEncryptor.mmp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2002-2009 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: Internal drm test tool -* -*/ - -#include -#include - -TARGET DRMEncryptor.exe -TARGETTYPE exe - -UID 0x100039CE 0x01105901 - -CAPABILITY CAP_APPLICATION ReadUserData AllFiles DRM PowerMgmt CommDD -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE DrmKeyStorage.cpp -SOURCE DrmBb5KeyStorage.cpp -SOURCE DRMEncryptorApp.cpp -SOURCE DRMEncryptorAppUi.cpp -SOURCE DRMEncryptorDocument.cpp -SOURCE DRMEncryptorContainer.cpp -SOURCE DRMEncryptorImage.cpp -SOURCE DrmEncryptor.cpp -SOURCE DRMPlayServerTest.cpp -SOURCE Performance.cpp - - -START RESOURCE ../data/DRMEncryptor.rss - -HEADER -TARGETPATH APP_RESOURCE_DIR - -END //RESOURCE - -START RESOURCE ../data/DRMEncryptor_reg.rss -DEPENDS drmencryptor.rsg - TARGETPATH /private/10003a3f/apps -END - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -LIBRARY DrmParsers.lib -LIBRARY DrmDcf.lib -LIBRARY DrmRights.lib -LIBRARY DrmServerInterfaces.lib -LIBRARY DRMCommon.lib -LIBRARY apparc.lib -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY eikcoctl.lib -LIBRARY eikcore.lib -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY asn1.lib -LIBRARY cryptography.lib -LIBRARY crypto.lib -LIBRARY x509.lib -LIBRARY pkixcert.lib -LIBRARY random.lib -LIBRARY hash.lib -LIBRARY flogger.lib -LIBRARY ezip.lib - -// DRMKeyStorage -LIBRARY DrmKeyStorage.lib -LIBRARY DrmCrypto.lib - -LIBRARY gdi.lib - - -LIBRARY caf.lib -LIBRARY cafutils.lib -LIBRARY drmhelper.lib -LIBRARY XmlFramework.lib -LIBRARY apmime.lib -LIBRARY DcfRep.lib -LIBRARY ecom.lib - -#ifdef RD_MULTIPLE_DRIVE -LIBRARY platformenv.lib -#endif - -LIBRARY drmaudioplayutility.lib - -SMPSAFE -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/group/DRMEncryptor.pkg --- a/commondrm/drmencryptor/group/DRMEncryptor.pkg Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -; -; 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 "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: -; -; Languages -; ========= -&EN - -; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component -; ================================================================================================== -#{"DRMEncryptor"}, (0x01105901),1,0,0,TYPE=SA - -;Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -"\epoc32\release\armv5\urel\DRMEncryptor.exe"-"!:\sys\bin\DRMEncryptor.exe" -"\epoc32\data\Z\private\10003a3f\apps\DRMEncryptor_reg.RSC"-"!:\private\10003a3f\import\apps\DRMEncryptor_reg.rsc" - - -"\epoc32\data\Z\Resource\apps\DRMEncryptor.mbm"-"!:\resource\apps\DRMEncryptor.mbm" -"\epoc32\data\Z\Resource\apps\DRMEncryptor.mif"-"!:\resource\apps\DRMEncryptor.mif" -"\epoc32\data\Z\Resource\apps\DRMEncryptor.RSC"-"!:\resource\apps\DRMEncryptor.RSC" -"\epoc32\data\Z\Resource\apps\DRMEncryptor_AIF.mif"-"!:\resource\apps\DRMEncryptor_AIF.mif" - -; eof diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/group/icon.bmp Binary file commondrm/drmencryptor/group/icon.bmp has changed diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/group/icon_mask_soft.bmp Binary file commondrm/drmencryptor/group/icon_mask_soft.bmp has changed diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/group/qgn_menu_DRMEncryptor.bmp Binary file commondrm/drmencryptor/group/qgn_menu_DRMEncryptor.bmp has changed diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_cxt.bmp Binary file commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_cxt.bmp has changed diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_cxt_mask_soft.bmp Binary file commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_cxt_mask_soft.bmp has changed diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_mask_soft.bmp Binary file commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_mask_soft.bmp has changed diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/DRMEncryptor.hrh --- a/commondrm/drmencryptor/inc/DRMEncryptor.hrh Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#ifndef DRMEncryptor_HRH -#define DRMEncryptor_HRH - -enum TDRMEncryptorItemType - { - EDRMEncryptorTextItem, - EDRMEncryptorImageItem - }; - -// DrmEncryptor enumerate command codes -enum TDrmEncryptorIds - { - EDrmEncryptorUICommand1 = 1, // start value must not be 0 - EDrmEncryptorKeyCommand, - EDrmEncryptorDeleteCommand, - ESetDrmTimeCommand, - EAddROsIntoDb, - EDrmTimeCommand, - EDrmBb5KeyTestCommand, - EDRMPlayServerCommand, - EDRM_API_BATUICommand3, - EDRM_API_SubMenuId_1, - EDRM_API_SubMenuId_1_1, - EDRM_API_SubMenuId_1_2, - EDRM_API_SubMenuId_1_3, - EDRM_API_SubMenuId_2_1, - EDRM_API_SubMenuId_2_2, - EDRM_API_SubMenuId_2_3, - EDRM_API_SubMenuId_3_1_1, - EDRM_API_SubMenuId_3_1_2, - EDRM_API_SubMenuId_3_1_3, - EDRM_API_SubMenuId_3_1_4, - EDrmEncryptorDeleteWmDrmCommand, - EDrmEncryptorBackupWmDrmCommand, - EDrmEncryptorRestoreWmDrmCommand - }; - -#endif // DRMEncryptor_HRH diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/DRMEncryptor.rh --- a/commondrm/drmencryptor/inc/DRMEncryptor.rh Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#ifndef DRMEncryptor_RH -#define DRMEncryptor_RH - -#include "DRMEncryptor.hrh" - -STRUCT DRMEncryptor_TEXT - { - BYTE type = EDRMEncryptorTextItem; - LLINK txt; // set this - } - -STRUCT DRMEncryptor_IMAGE - { - BYTE type = EDRMEncryptorImageItem; - LTEXT16 bmpfile = ""; // set this - WORD bmpid = 0xffff; // set this - } - -STRUCT DRMEncryptor_ITEM_LIST - { - STRUCT items[]; // text or image items - } - -#endif // DRMEncryptor_RH diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/DRMEncryptorApp.h --- a/commondrm/drmencryptor/inc/DRMEncryptorApp.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2002-2009 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: Declares main application class -* -*/ - - -#ifndef DRMEncryptorAPP_H -#define DRMEncryptorAPP_H - -// INCLUDES -#include - -// CONSTANTS -// UID of the application -const TUid KUidDRMEncryptor = { 0x01105901 }; - -// CLASS DECLARATION - -/** -* CDRMEncryptorApp application class. -* Provides factory to create concrete document object. -* -*/ -class CDRMEncryptorApp : public CAknApplication - { - - public: // Functions from base classes - private: - - /** - * From CApaApplication, creates CDRMEncryptorDocument document object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication, returns application's UID (KUidDRMEncryptor). - * @return The value of KUidDRMEncryptor. - */ - TUid AppDllUid() const; - }; - -#endif - -// End of File - diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/DRMEncryptorAppUi.h --- a/commondrm/drmencryptor/inc/DRMEncryptorAppUi.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2002-2009 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: Declares UI class for application. -* -*/ - - -#ifndef DRMEncryptorAPPUI_H -#define DRMEncryptorAPPUI_H - -// INCLUDES -#include -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CDRMEncryptorContainer; - -// CONSTANTS - -// CLASS DECLARATION - -/** -* Application UI class. -* Provides support for the following features: -* - EIKON control architecture -* -*/ -class CDRMEncryptorAppUi : public CAknAppUi - { - public: // Constructors and destructor - - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CDRMEncryptorAppUi(); - - public: // New functions - - public: // Functions from base classes - - TBool ProcessCommandParametersL( - TApaCommand aCommand, - TFileName& aDocumentName, - const TDesC8& aTail); - - - private: - /** - * From CEikAppUi, takes care of command handling. - * @param aCommand command to be handled - */ - void HandleCommandL( TInt aCommand ); - - private: // Data - CDRMEncryptorContainer* iAppContainer; - }; - -#endif - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/DRMEncryptorContainer.h --- a/commondrm/drmencryptor/inc/DRMEncryptorContainer.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2002 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: Declares container control for application. -* -*/ - - -#ifndef DRMEncryptorCONTAINER_H -#define DRMEncryptorCONTAINER_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CEikScrollBarFrame; -class CDRMEncryptorImage; -class CFont; -class TRect; -class TBidiText; - -// CLASS DECLARATION - -/** -* CDRMEncryptorContainer container control class. -* -*/ -class CDRMEncryptorContainer : public CCoeControl - { - public: // Constructors and destructor - CDRMEncryptorContainer(); - void ConstructL( const TRect& aRect ); - ~CDRMEncryptorContainer(); - - private: // from CCoeControl - - void Draw( const TRect& aRect ) const; - void ActivateL(); - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aModifiers ); - - private: // new functions - - void SetTextL( const TDesC& aText ); - void SetImageL( const TDesC& aFileName, TInt aBitmapId ); - void UpdateScrollIndicatorL(); - - private: // Data - - CArrayPtr* iText; - CArrayPtr* iImages; - CArrayFixFlat* iScreenStarts; - TInt iCurrentScreen; - TBool iDoNotShowLastLineAgain; - CGraphicsContext::TTextAlign iTextAlign; - CEikScrollBarFrame* iSBFrame; - const CFont* iFont; // not owned - TInt iLineWidth; - TInt iBaseLineDelta; - TInt iTopBaseLineX; - TInt iTopBaseLineY; - TInt iLinesPerScreen; - }; - -#endif - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/DRMEncryptorDocument.h --- a/commondrm/drmencryptor/inc/DRMEncryptorDocument.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#ifndef DRMEncryptorDOCUMENT_H -#define DRMEncryptorDOCUMENT_H - -// INCLUDES -#include - -// CONSTANTS - -// FORWARD DECLARATIONS -class CEikAppUi; - -// CLASS DECLARATION - -/** -* CDRMEncryptorDocument application class. -*/ -class CDRMEncryptorDocument : public CAknDocument - { - public: // Constructors and destructor - /** - * Two-phased constructor. - */ - static CDRMEncryptorDocument* NewL( CEikApplication& aApp ); - - /** - * Destructor. - */ - virtual ~CDRMEncryptorDocument(); - - virtual CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs); - - private: - - /** - * Constructor. - */ - CDRMEncryptorDocument( CEikApplication& aApp ); - - /** - * From CEikDocument, create CDRMEncryptorAppUi "App UI" object. - */ - CEikAppUi* CreateAppUiL(); - }; - -#endif - -// End of File - diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/DRMEncryptorImage.h --- a/commondrm/drmencryptor/inc/DRMEncryptorImage.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2002-2009 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: Image to be shown in DRMEncryptor screen. -* -*/ - - -#ifndef DRMEncryptorIMAGE_H -#define DRMEncryptorIMAGE_H - -// INCLUDES - -// FORWARD DECLARATIONS -class CFbsBitmap; - -// CONSTANTS - -const TInt KImageTopMargin = 4 ; -const TInt KImageBottomMargin = 4; - -// CLASS DECLARATION - -/** -* CDRMEncryptorImage -*/ -class CDRMEncryptorImage : public CBase - { - public: // Constructors and destructor - - static CDRMEncryptorImage* NewLC( const TDesC& aFileName, TInt aBitmapId, - TInt aStartLine, TInt aBaseLineDelta ); - - /** - * Destructor - */ - ~CDRMEncryptorImage(); - - public: // New functions - - TInt HeightInPixels() const; - TInt WidthInPixels() const; - TInt StartLine() const; - TInt EndLine() const; - TInt Lines() const; - const CFbsBitmap* Bitmap() const; - - private: // private constructor - - /** - * C++ default constructor. - */ - CDRMEncryptorImage(); - - private: // Data - - CFbsBitmap* iBitmap; // owned - TInt iStartLine; - TInt iEndLine; - }; - -#endif // DRMEncryptorIMAGE_H - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/DRMPlayServerTest.h --- a/commondrm/drmencryptor/inc/DRMPlayServerTest.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 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: -* -*/ - - -#ifndef DRMPLAYSERVERTEST_H -#define DRMPLAYSERVERTEST_H - -#include -#include - -class CDRMPlayServerTest : public CBase, public MDrmAudioPlayerCallback - { - - public: - - static CDRMPlayServerTest* NewLC(); - - ~CDRMPlayServerTest(); - - TInt ExecutePlayServerTest(); - - void MdapcInitComplete( TInt aError, - const TTimeIntervalMicroSeconds& aDuration ); - - void MdapcPlayComplete( TInt aError ); - - private: - - CDRMPlayServerTest(); - - void ConstructL(); - - private: // Data - - CDrmPlayerUtility* iDrmPlayerUtility; - CActiveSchedulerWait* iWait; - TInt iError; - - }; - -#endif // DRMPLAYSERVERTEST_H - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/inc/Performance.h --- a/commondrm/drmencryptor/inc/Performance.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2002-2004 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: ?Description -* -*/ - - - -#ifndef PERFORMANCE_H -#define PERFORMANCE_H - -void TestPerformanceL(TInt aCommand); - -#endif // PERFORMANCE_H - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DRMEncryptorApp.cpp --- a/commondrm/drmencryptor/src/DRMEncryptorApp.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -// INCLUDE FILES -#include "DRMEncryptorApp.h" -#include "DRMEncryptorDocument.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CDRMEncryptorApp::AppDllUid() -// Returns application UID -// --------------------------------------------------------- -// -TUid CDRMEncryptorApp::AppDllUid() const - { - return KUidDRMEncryptor; - } - - -// --------------------------------------------------------- -// CDRMEncryptorApp::CreateDocumentL() -// Creates CDRMEncryptorDocument object -// --------------------------------------------------------- -// -CApaDocument* CDRMEncryptorApp::CreateDocumentL() - { - return CDRMEncryptorDocument::NewL( *this ); - } - -#include - -LOCAL_C CApaApplication* NewApplication() - { - return new CDRMEncryptorApp; - } - -// --------------------------------------------------------- -// E32Main() -// Main startup entry point -// Returns: KErrNone -// --------------------------------------------------------- -// -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - - -// End of File - diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DRMEncryptorAppUi.cpp --- a/commondrm/drmencryptor/src/DRMEncryptorAppUi.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,257 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -// INCLUDE FILES -#include "DRMEncryptorAppUi.h" -#include "DRMEncryptorContainer.h" -#include "DRMEncryptor.hrh" -#include "Performance.h" -#include "DRMPlayServerTest.h" - -#include -#include - -extern TUint EncryptL(TUint& aEncryptedCount, TUint& aRightsCount, TUint& aMessagesProcessed); -extern TUint KeyStorage(); -extern void DeleteRdbL(); -extern void GetDrmClockL(); -extern void SetDrmClockL(); -extern TUint Bb5KeyStorage(); -extern void DeleteWmDrmRdbL(); -extern void BackupWmDrmDbL(); -extern void RestoreWmDrmDbL(); - - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CDRMEncryptorAppUi::ConstructL() -// ?implementation_description -// ---------------------------------------------------------- -// -void CDRMEncryptorAppUi::ConstructL() - { - BaseConstructL(); - iAppContainer = new( ELeave ) CDRMEncryptorContainer; - iAppContainer->SetMopParent( this ); - iAppContainer->ConstructL( ClientRect() ); - AddToStackL( iAppContainer ); - } - -// ---------------------------------------------------- -// CDRMEncryptorAppUi::~CDRMEncryptorAppUi() -// Destructor -// Frees reserved resources -// ---------------------------------------------------- -// -CDRMEncryptorAppUi::~CDRMEncryptorAppUi() - { - if ( iAppContainer ) - { - RemoveFromStack( iAppContainer ); - delete iAppContainer; - } - } - -// ---------------------------------------------------- -// CDRMEncryptorAppUi::HandleCommandL( TInt aCommand ) -// ?implementation_description -// ---------------------------------------------------- -// -void CDRMEncryptorAppUi::HandleCommandL( TInt aCommand ) - { - TUint result = 0; - TUint aEncryptedCount = 0; - TUint aRightsCount = 0; - TUint aMessagesProcessed = 0; - TBuf<128> buffer; - - switch ( aCommand ) - { - case EAknSoftkeyExit: - case EAknSoftkeyBack: - case EEikCmdExit: - { - Exit(); - break; - } - case EDrmEncryptorUICommand1: - { - - result = EncryptL(aEncryptedCount, aRightsCount, aMessagesProcessed); - - buffer.Append(_L("Encryption done\n")); - if(result < 1) - { - buffer.Append(_L("No files found")); - } - if(aMessagesProcessed != 0) - { - buffer.AppendNum(aMessagesProcessed); - buffer.Append(_L(" messages processed\n")); - } - if(aRightsCount != 0) - { - buffer.AppendNum(aRightsCount); - buffer.Append(_L(" rights objects processed\n")); - } - if(aMessagesProcessed != 0) - { - buffer.AppendNum(aEncryptedCount); - buffer.Append(_L(" files encrypted\n")); - } - - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(buffer); - - break; - } - case EDrmEncryptorKeyCommand: - { - result = KeyStorage(); - - if(result < 1) - { - buffer.Append(_L("No key files found")); - } - else - { - buffer.Append(_L("Keys imported\n")); - buffer.AppendNum(result); - buffer.Append(_L(" keys imported")); - } - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(buffer); - break; - } - case EDrmEncryptorDeleteCommand: - { - DeleteRdbL(); - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(_L("Database deleted")); - break; - } - case EDrmTimeCommand: - { - GetDrmClockL(); - break; - } - case ESetDrmTimeCommand: - { - SetDrmClockL(); - break; - } - case EDrmBb5KeyTestCommand: - { - result = Bb5KeyStorage(); - - if(result != KErrNone) - { - buffer.Append(_L("No CMLA keys available")); - buffer.AppendNum(result); - - } - else - { - buffer.Append(_L(" CMLA data OK! \n")); - buffer.AppendNum(result); - buffer.Append(_L(" \n Check log for Root.")); - } - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(buffer); - break; - } - case EDRMPlayServerCommand: - { - CDRMPlayServerTest* test = CDRMPlayServerTest::NewLC(); - TInt error = test->ExecutePlayServerTest(); - CleanupStack::PopAndDestroy( test ); - if ( error == KErrCANoRights ) - { - buffer.Append(_L("Test succeeded\n")); - buffer.Append(_L("DRMPlayServer can't be used with WMDRM")); - } - else - { - buffer.Append(_L("Test failed with error code: ")); - buffer.AppendNum(error); - } - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(buffer); - break; - } - case EDrmEncryptorDeleteWmDrmCommand: - { - DeleteWmDrmRdbL(); - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(_L("WmDrm Rights Deleted")); - break; - } - case EDrmEncryptorBackupWmDrmCommand: - { - TRAPD( error, BackupWmDrmDbL() ); - if ( !error ) - { - buffer.Append(_L("WmDrm License DB backup succeeded")); - } - else - { - buffer.Append(_L("WmDrm License DB backup failed")); - } - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(buffer); - break; - } - case EDrmEncryptorRestoreWmDrmCommand: - { - TRAPD( error, RestoreWmDrmDbL() ); - if ( !error ) - { - buffer.Append(_L("WmDrm License DB restore succeeded")); - } - else - { - buffer.Append(_L("WmDrm License DB restore failed")); - } - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(buffer); - break; - } - default: - TestPerformanceL(aCommand); - - buffer.Append(_L("Performance test done\n")); - buffer.Append(_L("See results from \nc:\\logs\\performance.log")); - - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(buffer); - - break; - } - } - - -TBool CDRMEncryptorAppUi::ProcessCommandParametersL( - TApaCommand /*aCommand*/, - TFileName& /*aDocumentName*/, - const TDesC8& /*aTail*/) - { - return EFalse; - } - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DRMEncryptorContainer.cpp --- a/commondrm/drmencryptor/src/DRMEncryptorContainer.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,444 +0,0 @@ -/* -* Copyright (c) 2002-2009 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: -* -*/ - - -// INCLUDE FILES - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "DRMEncryptorContainer.h" -#include "DRMEncryptorImage.h" -#include "DRMEncryptor.hrh" - -// CONSTANTS - -_LIT( KDRMEncryptorPanicCategory, "DRMEncryptor" ); - -enum TDRMEncryptorPanic - { - EDRMEncryptorNotSupported = 0 - }; - -// constructors - -CDRMEncryptorContainer::CDRMEncryptorContainer() - { - } - -void CDRMEncryptorContainer::ConstructL( const TRect& aRect ) - { - CreateWindowL(); - - // In case of APAC layout, use APAC font - TAknLayoutId layoutId; - iAvkonEnv->GetCurrentLayoutId( layoutId ); - - if ( layoutId == EAknLayoutIdAPAC ) - { - iFont = ApacPlain12(); - } - else - { - iFont = LatinPlain12(); - } - - // Calculate various text positioning parameters - iBaseLineDelta = iFont->HeightInPixels() * 4 / 3; - - TInt mainPaneWidth( aRect.iBr.iX - aRect.iTl.iX ); - TInt mainPaneHeight( aRect.iBr.iY - aRect.iTl.iY ); - // Line width is 87% of client rect, horizontal margins 13% - iLineWidth = mainPaneWidth * 87 / 100; - - iTopBaseLineX = ( mainPaneWidth - iLineWidth ) / 2; - - // top margin is 6.5% of the client rect - TInt topMargin = mainPaneHeight * 65 / 1000; - iTopBaseLineY = topMargin + iFont->AscentInPixels(); - - // minimum bottom margin is 3% of the client rect - TInt bottomMargin = mainPaneHeight * 3 / 100; - iLinesPerScreen = - ( mainPaneHeight - topMargin - bottomMargin ) / iBaseLineDelta; - - iTextAlign = CGraphicsContext::ELeft; - - // Every text line on screen is one entry in this array - iText = new( ELeave ) CArrayPtrFlat( 20 ); - // Every image on screen is one entry in this array - iImages = new( ELeave ) CArrayPtrFlat( 1 ); - // This array contains indices for lines that start the subsequent - // screens, for custom scrolling - iScreenStarts = new( ELeave ) CArrayFixFlat( 5 ); - // Initialisation: first screen starts at line 0. - iScreenStarts->AppendL( 0 ); - - // Read text and image items to be shown on the screen from a resource file. - - // real resource - TResourceReader reader; - iEikonEnv->CreateResourceReaderLC( reader, R_DRMENCRYPTOR_MAIN_TEXT ); - - TInt numItems( reader.ReadInt16() ); - - for ( TInt i = 0 ; i < numItems ; i++ ) - { - TInt type = reader.ReadInt8(); - - if ( type == EDRMEncryptorTextItem ) - { - HBufC* text = iEikonEnv->AllocReadResourceLC( reader.ReadInt32() ); - SetTextL( *text ); - - - CleanupStack::PopAndDestroy(); // text - } - else if ( type == EDRMEncryptorImageItem ) - { - TPtrC bitmapFile = reader.ReadTPtrC(); - TInt bitmapId = reader.ReadInt16(); - SetImageL( bitmapFile, bitmapId ); - } - else - { - User::Panic( KDRMEncryptorPanicCategory, EDRMEncryptorNotSupported ); - } - } - - CleanupStack::PopAndDestroy(); // reader - - UpdateScrollIndicatorL(); - SetRect( aRect ); - ActivateL(); - } - -// destructor - -CDRMEncryptorContainer::~CDRMEncryptorContainer() - { - delete iSBFrame; - delete iScreenStarts; - - if ( iText ) - { - iText->ResetAndDestroy(); - delete iText; - } - - if ( iImages ) - { - iImages->ResetAndDestroy(); - delete iImages; - } - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorContainer::Draw() -// ----------------------------------------------------------------------------- - -void CDRMEncryptorContainer::Draw( const TRect& aRect ) const - { - CWindowGc& gc = SystemGc(); - - // clear the area - - gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ); - gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - gc.Clear( aRect ); - - // draw text - gc.UseFont( iFont ); - - // index of the first line on the screen in the text array - TInt firstLine( (*iScreenStarts)[ iCurrentScreen ] ); - // index of the last line on the screen in the text array - TInt lastLine( firstLine + iLinesPerScreen - 1 ); - - gc.SetBrushStyle( CGraphicsContext::ENullBrush ); - TPoint position( iTopBaseLineX, iTopBaseLineY ); - TPoint topLeft; - TSize rectSize( iLineWidth, iBaseLineDelta +iFont->DescentInPixels() ); - - for ( TInt index = firstLine ; - index < iText->Count() && index <= lastLine ; - index++, position.iY += iBaseLineDelta ) - { - HBufC* text = (*iText)[ index ]; - - if ( text ) - { - topLeft = TPoint( position.iX, position.iY-iBaseLineDelta ); - gc.DrawText( *text, - TRect( topLeft, rectSize ), - iBaseLineDelta, - iTextAlign ); - } - } - - gc.DiscardFont(); - - // draw images - - for ( TInt i = 0 ; i < iImages->Count() ; i++ ) - { - CDRMEncryptorImage* image = (*iImages)[ i ]; - - // If part of the image resides in visible lines, draw it. - if ( image->StartLine() <= lastLine && image->EndLine() >= firstLine ) - { - position.SetXY( iTopBaseLineX, iTopBaseLineY ); - position.iY += ( image->StartLine() - firstLine ) * iBaseLineDelta; - - position.iY -= iBaseLineDelta - iFont->DescentInPixels(); - // Now iY is the top line of rectangle where the picture is - // centered in. - position.iY += ( (image->Lines()+1) * iBaseLineDelta - - iFont->HeightInPixels() - - image->HeightInPixels() ) / 2; - - // If text is right-aligned, also align images to the right. - - if ( iTextAlign == CGraphicsContext::ERight ) - { - position.iX += ( iLineWidth - image->WidthInPixels() ); - } - - gc.BitBlt( position, image->Bitmap(), aRect ); - } - } - - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorContainer::ActivateL() -// ----------------------------------------------------------------------------- - -void CDRMEncryptorContainer::ActivateL() - { - CCoeControl::ActivateL(); - UpdateScrollIndicatorL(); - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorContainer::SetTextL() -// ----------------------------------------------------------------------------- - -void CDRMEncryptorContainer::SetTextL( const TDesC& aText ) - { - CArrayFix* wrappedArray = - new( ELeave ) CArrayFixFlat( 10 ); - - CleanupStack::PushL( wrappedArray ); - - HBufC* dataToDestroy = - AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( - aText, iLineWidth, *iFont, *wrappedArray - ); - - TInt numLines( wrappedArray->Count() ); - for ( TInt i = 0 ; i < numLines ; i++ ) - { - HBufC* line = (*wrappedArray)[i].AllocLC(); - - if(!line->Length()) - { - iText->AppendL( NULL ); - - CleanupStack::PopAndDestroy(); // line - } - else - { - iText->AppendL( line ); - CleanupStack::Pop(); // line - } - } - iText->AppendL( NULL ); - - // If the last char was newline, add one extra, since - // wrapping automatically removes it. - if ( aText[ aText.Length() - 1 ] == '\n' ) - { - iText->AppendL( NULL ); - } - - CleanupStack::PopAndDestroy(); // wrappedArray - delete dataToDestroy; - - // update screen scrolling info array - - TInt lastLine( iText->Count() - 1 ); - TInt screenStart( (*iScreenStarts)[ iScreenStarts->Count() - 1 ] ); - - TBool firstNewScreenHandled( EFalse ); - - while ( lastLine >= screenStart + iLinesPerScreen ) - { - if ( !firstNewScreenHandled && iDoNotShowLastLineAgain ) - { - screenStart++; - firstNewScreenHandled = ETrue; - } - - screenStart += iLinesPerScreen - 1; - iScreenStarts->AppendL( screenStart ); - } - - // if text, last line is shown again in next screen - iDoNotShowLastLineAgain = EFalse; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorContainer::SetImageL() -// ----------------------------------------------------------------------------- - -void CDRMEncryptorContainer::SetImageL( const TDesC& aFileName, TInt aBitmapId ) - { - TInt firstLineOfImage( iText->Count() ); - - CDRMEncryptorImage* image = - CDRMEncryptorImage::NewLC( aFileName, aBitmapId, firstLineOfImage, iBaseLineDelta ); - - // new lines to make room for the picture - - for ( TInt i = 0 ; i < image->Lines() ; i++ ) - { - iText->AppendL( NULL ); - } - - iImages->AppendL( image ); - CleanupStack::Pop(); // image - - // update screen scrolling info array - - TInt lastLineOfImage( iText->Count() - 1 ); - TInt screenStart( (*iScreenStarts)[ iScreenStarts->Count() - 1 ] ); - - TBool firstNewScreenHandled( EFalse ); - - // If the image was not fully shown in the first screen, - // start the next screen with the image. - - if ( firstLineOfImage < screenStart + iLinesPerScreen && - lastLineOfImage >= screenStart + iLinesPerScreen ) - { - screenStart = firstLineOfImage; - iScreenStarts->AppendL( screenStart ); - firstNewScreenHandled = ETrue; - } - - while ( lastLineOfImage >= screenStart + iLinesPerScreen ) - { - if ( !firstNewScreenHandled && iDoNotShowLastLineAgain ) - { - screenStart++; - firstNewScreenHandled = ETrue; - } - - screenStart += iLinesPerScreen - 1; - iScreenStarts->AppendL( screenStart ); - } - - if ( lastLineOfImage == screenStart + iLinesPerScreen - 1 ) - { - iDoNotShowLastLineAgain = ETrue; - } - else - { - iDoNotShowLastLineAgain = EFalse; - } - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorContainer::OfferKeyEventL() -// ----------------------------------------------------------------------------- - -TKeyResponse CDRMEncryptorContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - if ( aType == EEventKey && iScreenStarts->Count() > 1 ) - { - switch ( aKeyEvent.iCode ) - { - case EKeyUpArrow: - if ( iCurrentScreen > 0 ) - { - iCurrentScreen--; - DrawNow(); - UpdateScrollIndicatorL(); - } - break; - - case EKeyDownArrow: - if ( iCurrentScreen < iScreenStarts->Count() - 1 ) - { - iCurrentScreen++; - DrawNow(); - UpdateScrollIndicatorL(); - } - break; - - default: - break; - } - } - - return EKeyWasConsumed; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorContainer::UpdateScrollIndicatorL() -// ----------------------------------------------------------------------------- - -void CDRMEncryptorContainer::UpdateScrollIndicatorL() - { - if ( iScreenStarts->Count() <= 1 ) - { - return; - } - - if ( !iSBFrame ) - { - iSBFrame = new( ELeave ) CEikScrollBarFrame( this, NULL, ETrue ); - iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, - CEikScrollBarFrame::EAuto ); - iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EArrowHead ); - } - - TEikScrollBarModel hSbarModel; - TEikScrollBarModel vSbarModel; - vSbarModel.iThumbPosition = iCurrentScreen; - vSbarModel.iScrollSpan = iScreenStarts->Count(); - vSbarModel.iThumbSpan = 1; - - TEikScrollBarFrameLayout layout; - TRect rect( Rect() ); - iSBFrame->TileL( &hSbarModel, &vSbarModel, rect, rect, layout ); - iSBFrame->SetVFocusPosToThumbPos( vSbarModel.iThumbPosition ); - } - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DRMEncryptorDocument.cpp --- a/commondrm/drmencryptor/src/DRMEncryptorDocument.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -// INCLUDE FILES -#include "DRMEncryptorDocument.h" -#include "DRMEncryptorAppUi.h" -#include "DrmKeyStorage.h" - -extern TUint KeyStorageFromZipL(const TDesC&, RFs&); - -// ================= MEMBER FUNCTIONS ======================= - -// constructor -CDRMEncryptorDocument::CDRMEncryptorDocument( CEikApplication& aApp ) : CAknDocument( aApp ) - { - } - -// destructor -CDRMEncryptorDocument::~CDRMEncryptorDocument() - { - } - -// Two-phased constructor. -CDRMEncryptorDocument* CDRMEncryptorDocument::NewL( CEikApplication& aApp ) - { - return new( ELeave ) CDRMEncryptorDocument( aApp ); - } - -CFileStore* CDRMEncryptorDocument::OpenFileL(TBool /*aDoOpen*/, const TDesC& aFileName, RFs& aFs) - { - KeyStorageFromZipL(aFileName, aFs); - return NULL; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorDocument::CreateAppUiL() -// constructs CDRMEncryptorAppUi -// ----------------------------------------------------------------------------- -// -CEikAppUi* CDRMEncryptorDocument::CreateAppUiL() - { - return new( ELeave ) CDRMEncryptorAppUi; - } - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DRMEncryptorImage.cpp --- a/commondrm/drmencryptor/src/DRMEncryptorImage.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -// INCLUDE FILES -#include -#include "DRMEncryptorImage.h" - -// ================= MEMBER FUNCTIONS ========================================== - -CDRMEncryptorImage::CDRMEncryptorImage() - { - } - -CDRMEncryptorImage::~CDRMEncryptorImage() - { - delete iBitmap; - } - -CDRMEncryptorImage* CDRMEncryptorImage::NewLC( const TDesC& aFileName, - TInt aBitmapId, - TInt aStartLine, - TInt aBaseLineDelta ) - { - CDRMEncryptorImage* self = new( ELeave ) CDRMEncryptorImage(); - CleanupStack::PushL( self ); - - self->iBitmap = new( ELeave ) CFbsBitmap; - self->iBitmap->Load( aFileName, aBitmapId ); - - self->iStartLine = aStartLine; - - // enough lines so that image and margins fit in them. - - TInt lines( ( self->HeightInPixels() + - KImageTopMargin + - KImageBottomMargin + - aBaseLineDelta - 1 ) / aBaseLineDelta ); - - self->iEndLine = aStartLine + lines - 1; - return self; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorImage::HeightInPixels() -// ----------------------------------------------------------------------------- - -TInt CDRMEncryptorImage::HeightInPixels() const - { - return iBitmap->SizeInPixels().iHeight; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorImage::WidthInPixels() -// ----------------------------------------------------------------------------- - -TInt CDRMEncryptorImage::WidthInPixels() const - { - return iBitmap->SizeInPixels().iWidth; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorImage::StartLine() -// ----------------------------------------------------------------------------- - -TInt CDRMEncryptorImage::StartLine() const - { - return iStartLine; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorImage::EndLine() -// ----------------------------------------------------------------------------- - -TInt CDRMEncryptorImage::EndLine() const - { - return iEndLine; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorImage::Lines() -// ----------------------------------------------------------------------------- - -TInt CDRMEncryptorImage::Lines() const - { - return iEndLine - iStartLine + 1; - } - -// ----------------------------------------------------------------------------- -// CDRMEncryptorImage::Bitmap() -// ----------------------------------------------------------------------------- - -const CFbsBitmap* CDRMEncryptorImage::Bitmap() const - { - return iBitmap; - } - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DRMPlayServerTest.cpp --- a/commondrm/drmencryptor/src/DRMPlayServerTest.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 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: -* -*/ - - -#include - -#include "DRMPlayServerTest.h" - -#ifdef __WINS__ -_LIT( KTestFile, "c:\\data\\drm\\test.wma" ); -#else -_LIT( KTestFile, "e:\\drm\\test.wma" ); -#endif - -// ================= MEMBER FUNCTIONS ========================================== - -CDRMPlayServerTest::CDRMPlayServerTest() - { - } - - -void CDRMPlayServerTest::ConstructL() - { - iWait = new (ELeave) CActiveSchedulerWait(); - iDrmPlayerUtility = CDrmPlayerUtility::NewL( *this, - 0, - EMdaPriorityPreferenceNone ); - } - -CDRMPlayServerTest::~CDRMPlayServerTest() - { - delete iWait; - delete iDrmPlayerUtility; - } - -CDRMPlayServerTest* CDRMPlayServerTest::NewLC() - { - CDRMPlayServerTest* self = new( ELeave ) CDRMPlayServerTest(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -TInt CDRMPlayServerTest::ExecutePlayServerTest() - { - iError = KErrNone; - TRAP( iError, iDrmPlayerUtility->OpenFileL( KTestFile ) ); - if ( iError ) - { - return iError; - } - iWait->Start(); - return iError; - } - -void CDRMPlayServerTest::MdapcInitComplete( - TInt aError, - const TTimeIntervalMicroSeconds& /*aDuration*/ ) - { - iWait->AsyncStop(); - iError = aError; - } - -void CDRMPlayServerTest::MdapcPlayComplete( TInt aError ) - { - iWait->AsyncStop(); - iError = aError; - } - -// End of File - diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp --- a/commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* -* Copyright (c) 2003-2009 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: -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include - -#ifdef RD_MULTIPLE_DRIVE -#include -#endif - -#include "DrmKeyStorage.h" - - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// Test logging macros - -#ifdef RD_MULTIPLE_DRIVE -_LIT(KFullLogDir, "%c:\\logs\\drm\\"); -#else -_LIT(KFullLogDir, "c:\\logs\\drm\\"); -#endif - -_LIT(KLogDir, "drm"); -_LIT(KLogName, "DrmEncryptorBb5KeyStorage.log"); - -#define TEST_STEP(string) \ - GBb5Log.WriteFormat(_L("Next Test: %S"), &string); - -#define CHECK(condition) \ - if (!condition) GBb5Log.WriteFormat(_L("FAIL: line %d"), __LINE__); - -// MODULE DATA STRUCTURES - -RFs GBb5Fs; -RFileLogger GBb5Log; - -// STATIC TEST CONTENT AND RIGHTS OBJECTS - -// LOCAL FUNCTION PROTOTYPES - -// ==================== LOCAL FUNCTIONS ==================== - -HBufC8* I2OSPL( - RInteger& aInt) - { - HBufC8* r = aInt.BufferLC(); - CleanupStack::Pop(r); - return r; - } - -RInteger OS2IPL( - const TDesC8& aOctetStream) - { - RInteger r; - TInt i; - - r = RInteger::NewL(0); - for (i = 0; i < aOctetStream.Length(); i++) - { - r *= 256; - r += aOctetStream[i]; - } - return r; - } - -HBufC8* RsaEncryptL( - CRSAPublicKey* aKey, - const TDesC8& aInput) - { - RInteger result; - RInteger input; - HBufC8* output; - - input = OS2IPL(aInput); - CleanupClosePushL(input); - result = TInteger::ModularExponentiateL(input, aKey->E(), aKey->N()); - CleanupClosePushL(result); - output = I2OSPL(result); - CleanupStack::PopAndDestroy(2); // result, input - return output; - } - -LOCAL_C TUint MDrmKeyStorage_GetCertificateChainL() - { - MDrmKeyStorage* storage = NULL; - RPointerArray chain; - TInt i; - TUint result = NULL; - - GBb5Log.WriteFormat(_L("MDrmKeyStorage_GetCertificateChainL -> DrmKeyStorageNewL")); - TRAPD(err,storage = DrmKeyStorageNewL()); - if (err != KErrNone) - { - result = err; - } - - GBb5Log.WriteFormat(_L("MDrmKeyStorage_GetCertificateChainL -> SelectDefaultRootL")); - storage->SelectDefaultRootL(); - - GBb5Log.WriteFormat(_L("MDrmKeyStorage_GetCertificateChainL -> GetCertificateChainL")); - storage->GetCertificateChainL(chain); - - for (i = 0; i < chain.Count(); i++) - { - GBb5Log.WriteFormat(_L("Certificate %d:"), i); - GBb5Log.HexDump(_S(""), _S(""), chain[i]->Ptr(), chain[i]->Length()); - } - chain.ResetAndDestroy(); - chain.Close(); - delete storage; - return result; - } - -LOCAL_C TUint MDrmKeyStorage_DecryptL() - { - MDrmKeyStorage* storage = NULL; - RPointerArray chain; - CRSAPublicKey* key = NULL; - CX509Certificate* cert = NULL; - TX509KeyFactory factory; - TBuf8<128> data; - HBufC8* encData; - HBufC8* decData; - TUint result = KErrNone; - - - GBb5Log.WriteFormat(_L("MDrmKeyStorage_Decrypt")); - storage = DrmKeyStorageNewL(); - storage->SelectDefaultRootL(); - storage->GetCertificateChainL(chain); - cert = CX509Certificate::NewL(*chain[0]); - chain.ResetAndDestroy(); - chain.Close(); - key = factory.RSAPublicKeyL(cert->PublicKey().KeyData()); - data.SetLength(128); - data.Fill(1); - GBb5Log.WriteFormat(_L("data:")); - GBb5Log.HexDump(_S(""), _S(""), &data[0], sizeof(data)); - - encData = RsaEncryptL(key, data); - GBb5Log.WriteFormat(_L("encrypted data:")); - GBb5Log.HexDump(_S(""), _S(""), encData->Ptr(), encData->Length()); - - decData = storage->RsaDecryptL(*encData); - GBb5Log.WriteFormat(_L("decrypted data :")); - GBb5Log.HexDump(_S(""), _S(""), decData->Ptr(), decData->Length()); - - delete cert; - delete key; - delete storage; - return result; - } - -// ==================== TEST FUNCTIONS ===================== - - - -TUint Bb5KeyStorage() - { - TUint result = 0; - TInt catchy = 0; - result = GBb5Fs.Connect(); - if( result != KErrNone ) - { - return result; - } - -#ifndef RD_MULTIPLE_DRIVE - - GBb5Fs.MkDirAll(KFullLogDir); - -#else //RD_MULTIPLE_DRIVE - - TInt driveNumber( -1 ); - TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - GBb5Fs.DriveToChar( driveNumber, driveLetter ); - - TFileName fullLogDir; - fullLogDir.Format( KFullLogDir, (TUint)driveLetter ); - - GBb5Fs.MkDirAll(fullLogDir); - -#endif - - result = GBb5Log.Connect(); - if( result != KErrNone ) - { - GBb5Fs.Close(); - return result; - } - GBb5Log.CreateLog(KLogDir, KLogName, EFileLoggingModeOverwrite); - GBb5Log.Write(_L("Start %D")); - - TRAPD(err,result = MDrmKeyStorage_GetCertificateChainL()); - CHECK(err == KErrNone); - if (err ==KErrNone) - { - TRAP(catchy, result = MDrmKeyStorage_DecryptL()); - if( catchy ) - { - result = catchy; - } - } - CHECK(err == KErrNone); - GBb5Log.CloseLog(); - GBb5Fs.Close(); - return result; - } - diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DrmEncryptor.cpp --- a/commondrm/drmencryptor/src/DrmEncryptor.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,577 +0,0 @@ -/* -* Copyright (c) 2003-2009 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: DRM Encryption tool for DRM5 -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifdef RD_MULTIPLE_DRIVE -#include -#endif - -#include -#include -#include -#include -#include -#include "DRMClockClient.h" - -#include -#include - -#include - -#include -#include - -#include - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -_LIT( KWmdrmBd, "c:\\private\\10281e17\\[10282F1B]hds.db" ); -_LIT( KWmdrmBdBackup, "e:\\[10282F1B]hds.db" ); - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// ==================== LOCAL FUNCTIONS ==================== - -LOCAL_C void ReadFileL(HBufC8*& aContent, const TDesC& aName, RFs& aFs) - { - TInt size = 0; - RFile file; - User::LeaveIfError(file.Open(aFs, aName, EFileRead)); - User::LeaveIfError(file.Size(size)); - aContent = HBufC8::NewLC(size); - TPtr8 ptr(aContent->Des()); - User::LeaveIfError(file.Read(ptr, size)); - CleanupStack::Pop(); //aContent - } - -// --------------------------------------------------------- -// UpdateDCFRepositoryL() -// Update saved file to DCFRepository -// --------------------------------------------------------- -// -LOCAL_C void UpdateDCFRepositoryL( const TDesC& aFileName) - { - CDcfEntry* dcf( NULL ); - CDcfRep* dcfRep( NULL ); - - dcf = CDcfEntry::NewL(); - CleanupStack::PushL( dcf ); - - dcfRep = CDcfRep::NewL(); - CleanupStack::PushL( dcfRep ); - - dcf->SetLocationL( aFileName, 0 ); - dcfRep->UpdateL( dcf ); - - CleanupStack::PopAndDestroy(2); // dcf, dcfRep - } - - - - -// ==================== TEST FUNCTIONS ===================== - -const TInt KBufferSize = 20000; - -void ProcessMessageL(const TDesC& aFile, const TDesC& aOutput) - { - CDRMMessageParser* c = NULL; - HBufC8* d = NULL; - RFs fs; - TPtr8 inRead(NULL, 0); - TInt error = 1; - __UHEAP_MARK; - - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - c = CDRMMessageParser::NewL(); - CleanupStack::PushL(c); - - d = HBufC8::NewLC( KBufferSize ); - - RFile input; - User::LeaveIfError(input.Open( fs, aFile, EFileRead )); - CleanupClosePushL( input ); - - RFileWriteStream output; - output.Replace( fs, aOutput, EFileWrite ); - CleanupClosePushL( output ); - - c->InitializeMessageParserL( output ); - - while( error ) - { - inRead.Set( const_cast(d->Ptr()),0,KBufferSize); - error = input.Read( inRead ); - - if( error ) - { - c->FinalizeMessageParserL(); - - User::Leave( error ); - } - else - { - error = inRead.Length(); - } - - if( error ) - { - c->ProcessMessageDataL(inRead); - } - } - - c->FinalizeMessageParserL(); - - - CleanupStack::PopAndDestroy( 5 ); // fs, c, d, input, output - UpdateDCFRepositoryL( aOutput ); - __UHEAP_MARKEND; - } - -void ProcessRightsL(const TDesC& aFile) - { - CDRMMessageParser* c = NULL; - HBufC8* d = NULL; - RFs fs; - RPointerArray rights; - - User::LeaveIfError(fs.Connect()); - c = CDRMMessageParser::NewL(); - ReadFileL(d, aFile, fs); - c->ProcessRightsObject(*d, rights); - rights.ResetAndDestroy(); - delete d; - delete c; - fs.Close(); - } - -void EncryptFileL(const TDesC& aFile, TDesC& aOutput, TInt aMultiplier) - { - COma1DcfCreator* c = NULL; - CDRMRights* rights = NULL; - TBuf8<64> mime; - RFs fs; - TFileName aDcfFile; - TInt aOriginalFileNameLength(aOutput.Length() - 4); - - User::LeaveIfError(fs.Connect()); - if (aFile.Right(3).CompareF(_L("amr")) == 0) //AMR - { - mime.Copy(_L8("audio/amr")); - } - else if (aFile.Right(3).CompareF(_L("awb")) == 0) //AMR-AWB - { - mime.Copy(_L8("audio/amr-wb")); - } - else if (aFile.Right(3).CompareF(_L("mp3")) == 0) //MP3 - { - mime.Copy(_L8("audio/mpeg")); - } - else if (aFile.Right(3).CompareF(_L("mp4")) == 0) //MP4 - { - mime.Copy(_L8("audio/mp4")); - } - else if (aFile.Right(3).CompareF(_L("m4a")) == 0) //M4A - { - mime.Copy(_L8("audio/mp4")); - } - else if (aFile.Right(3).CompareF(_L("3gp")) == 0) //3GPP - { - mime.Copy(_L8("audio/3gpp")); - } - else if (aFile.Right(3).CompareF(_L("3g2")) == 0) //3GPP2 - { - mime.Copy(_L8("audio/3gpp2")); - } - else if (aFile.Right(3).CompareF(_L("aac")) == 0) //AAC - { - mime.Copy(_L8("audio/aac")); - } - else if (aFile.Right(3).CompareF(_L("mid")) == 0) //MIDI - { - mime.Copy(_L8("audio/midi")); - } - else if (aFile.Right(5).CompareF(_L(".spmid")) == 0) //SP-MIDI - { - mime.Copy(_L8("audio/sp-midi")); - } - else if (aFile.Right(3).CompareF(_L("rmf")) == 0) //RMF - { - mime.Copy(_L8("audio/rmf")); - } - else if (aFile.Right(4).CompareF(_L("mxmf")) == 0) //Mobile-XMF - { - mime.Copy(_L8("audio/mobile-xmf")); - } - else if (aFile.Right(3).CompareF(_L("wav")) == 0) //WAV - { - mime.Copy(_L8("audio/x-wav")); - } - else if (aFile.Right(3).CompareF(_L("gif")) == 0) // GIF - { - mime.Copy(_L8("image/gif")); - } - else if (aFile.Right(3).CompareF(_L("jpg")) == 0) // JPEG - { - mime.Copy(_L8("image/jpeg")); - } - else if (aFile.Right(3).CompareF(_L("txt")) == 0) // text - { - mime.Copy(_L8("text/plain")); - } - else if (aFile.Right(3).CompareF(_L("pip")) == 0) // PIP - { - mime.Copy(_L8("application/x-pip")); - } - - aDcfFile.Append(aOutput); - - for(TInt i = 0; i < aMultiplier ; ++i) - { - aDcfFile.Delete(aOriginalFileNameLength, aDcfFile.Length()); - aDcfFile.Append(_L("-")); - aDcfFile.AppendNum(i); - aDcfFile.Append(_L(".dcf")); - c = COma1DcfCreator::NewL(); - CleanupStack::PushL(c); - fs.Delete(aOutput); - c->EncryptFileL(aFile, aDcfFile, mime, rights); - UpdateDCFRepositoryL( aDcfFile ); - delete rights; - CleanupStack::PopAndDestroy(); // c - } - fs.Close(); - - } - -TUint EncryptL(TUint& aEncryptedCount, TUint& aRightsCount, TUint& aMessagesProcessed) - { - TInt i; - CDir* files; - TFileName input; - TFileName output; - TUint inputNameSize = 0; - TUint outputNameSize = 0; - RFs fs; - User::LeaveIfError(fs.Connect()); - TInt aMultiplier(1); - - -#ifdef __WINS__ - input.Append(_L("c:\\data\\DRM\\")); - output.Append(_L("c:\\data\\Others\\")); -#else -#ifndef RD_MULTIPLE_DRIVE - - input.Append(_L("e:\\DRM\\")); - output.Append(_L("e:\\Others\\")); - -#else //RD_MULTIPLE_DRIVE - - TInt driveNumber( -1 ); - TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber ); - fs.DriveToChar( driveNumber, driveLetter ); - - _LIT( KdrmDir, "%c:\\DRM\\" ); - input.Format( KdrmDir, (TUint)driveLetter ); - - _LIT( KothersDir, "%c:\\Others\\" ); - output.Format( KothersDir, (TUint)driveLetter ); - -#endif -#endif - - inputNameSize = input.Length(); - outputNameSize = output.Length(); - - - fs.MkDir(input); - fs.MkDir(output); - - fs.GetDir(input, KEntryAttNormal, ESortNone, files); - for (i = 0; i < files->Count(); i++) - { - input.Append((*files)[i].iName); - - output.Append((*files)[i].iName); - - if (input.Right(2).CompareF(_L("dm")) == 0) - { - - for(TInt ii = 0; ii < aMultiplier ; ++ii) - { - output.Delete(outputNameSize +(*files)[i].iName.Length() , output.Length()-1); - output.Append(_L("-")); - output.AppendNum(ii); - output.Append(_L(".dcf")); - ProcessMessageL(input, output); - ++aMessagesProcessed; - } - } - else if (input.Right(3).CompareF(_L("oro")) == 0 || - input.Right(3).CompareF(_L("drc")) == 0 || - input.Right(2).CompareF(_L("ro")) == 0 || - input.Right(2).CompareF(_L("dr")) == 0 ) - { - for (TInt iii = 0; iii < aMultiplier; ++iii) - { - ProcessRightsL(input); - ++aRightsCount; - } - } - else if (input.Right(3).CompareF(_L("dcf")) != 0) - { - output.Append(_L(".dcf")); - EncryptFileL(input, output, aMultiplier); - ++aEncryptedCount; - } - - //restore paths - input.Delete(inputNameSize, input.Length()-1); - output.Delete(outputNameSize, output.Length()-1); - } - - fs.Close(); - - TRequestStatus status; - CDcfRep* rep = CDcfRep::NewL(); - CleanupStack::PushL(rep); - rep->RefreshDcf(status); - User::WaitForRequest( status ); - CleanupStack::PopAndDestroy( rep ); - - delete files; - - return (aEncryptedCount*aMultiplier + aRightsCount + aMessagesProcessed); - } - -void DeleteRdbL() - { - RDRMRightsClient client; - - User::LeaveIfError(client.Connect()); - client.DeleteAll(); - client.Close(); - } - - - - -// ----------------------------------------------------------------------------- -// GetCafDataL -// ----------------------------------------------------------------------------- -// -ContentAccess::CManager* GetCafDataL( TAgent& aAgent ) - { - TPtr8 ptr(NULL, 0, 0); - RArray agents; - TRequestStatus status; - TInt i; - - CleanupClosePushL( agents ); - CManager* manager = CManager::NewLC(); - - manager->ListAgentsL( agents ); - - for (i = 0; i < agents.Count(); i++) - { - if (agents[i].Name().Compare(KWmDrmAgentName) == 0) - { - aAgent = agents[i]; - break; - } - } - CleanupStack::Pop( manager ); - CleanupStack::PopAndDestroy(); // agents - return manager; - } - - -// ----------------------------------------------------------------------------- -// DeleteWmDrmRdbL -//----------------------------------------------------------------------------- -// - -void DeleteWmDrmRdbL() - { - // get the data part - ContentAccess::CManager* manager = NULL; - ContentAccess::TAgent agent; - TPtr8 ptr(NULL, 0, 0); - TPtrC8 ptr2; - - // Find the caf agent and create manager - manager = GetCafDataL( agent ); - CleanupStack::PushL( manager ); - - User::LeaveIfError( - manager->AgentSpecificCommand( agent, - (TInt)DRM::EWmDrmDeleteRights, - ptr2, - ptr) ); - CleanupStack::PopAndDestroy( manager ); - } - - - -void GetDrmClockL() - { - RDRMClockClient client; - - TTime drmTime; - TDateTime date; - TInt aTimeZone; - DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure; - TBuf< 80 > buf; - - - - User::LeaveIfError( client.Connect() ); - - client.GetSecureTime(drmTime, aTimeZone, secLevel); - - client.Close(); - - date = drmTime.DateTime(); - - if(secLevel == DRMClock::KSecure) - { - _LIT(KFormatTxt,"DRMClock Time:\n%d/%d/%d\n%d:%d:%d\nNitz available"); - buf.Format( KFormatTxt, - date.Day()+1, - TInt(date.Month()+1), - date.Year(), - date.Hour(), - date.Minute(), - date.Second()); - } - else - { - _LIT(KFormatTxt,"DRMClock Time:\n%d/%d/%d\n%d:%d:%d\nNitz unavailable"); - buf.Format( KFormatTxt, - date.Day()+1, - TInt(date.Month()+1), - date.Year(), - date.Hour(), - date.Minute(), - date.Second()); - } - - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(buf); - - - } - -void SetDrmClockL() - { - RDRMClockClient client; - - TTime drmTime (_L("20000111:200600.000000")); - TTime aDate (_L("20040000:")); - TDateTime date; - TInt aTimeZone; - DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure; - - User::LeaveIfError(client.Connect()); - CleanupClosePushL(client); - - client.GetSecureTime(drmTime, aTimeZone, secLevel); - - aDate = drmTime; - - CAknMultiLineDataQueryDialog* dlg = CAknMultiLineDataQueryDialog::NewL(aDate, drmTime); - if ( dlg->ExecuteLD( R_DRM_TIME_QUERY ) ) - { - TTime aTime = aDate.Int64() + drmTime.Int64(); - client.UpdateSecureTime(aTime, aTimeZone); - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(_L("DRM time changed")); - } - else - { - //User pressed cancel on confirmation screen - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(_L("DRM time not changed")); - } - CleanupStack::PopAndDestroy(); - } - -void BackupWmDrmDbL() - { - RProcess process; - TFullName name; - TFindProcess wmDrmServerFinder( _L( "*wmdrmserver*" ) ); - if ( wmDrmServerFinder.Next( name ) == KErrNone && process.Open( name ) == KErrNone ) - { - process.Kill( -1 ); - process.Close(); - } - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - CFileMan* fileMan = CFileMan::NewL( fs ); - CleanupStack::PushL( fileMan ); - User::LeaveIfError( fileMan->Copy( KWmdrmBd, KWmdrmBdBackup, CFileMan::EOverWrite ) ); - CleanupStack::PopAndDestroy( 2, &fs ); //fs, fileMan - } - -void RestoreWmDrmDbL() - { - RProcess process; - TFullName name; - TFindProcess wmDrmServerFinder( _L( "*wmdrmserver*" ) ); - if ( wmDrmServerFinder.Next( name ) == KErrNone && process.Open( name ) == KErrNone ) - { - process.Kill( -1 ); - process.Close(); - } - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - CFileMan* fileMan = CFileMan::NewL( fs ); - CleanupStack::PushL( fileMan ); - User::LeaveIfError( fileMan->Copy( KWmdrmBdBackup, KWmdrmBd, CFileMan::EOverWrite ) ); - CleanupStack::PopAndDestroy( 2, &fs ); //fs, fileMan - } - -// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/DrmKeyStorage.cpp --- a/commondrm/drmencryptor/src/DrmKeyStorage.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,334 +0,0 @@ -/* -* Copyright (c) 2003-2009 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: -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include - -#ifdef RD_MULTIPLE_DRIVE -#include -#endif - -#include -#include - -#include "DrmKeyStorage.h" - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// Test logging macros - -#ifdef RD_MULTIPLE_DRIVE -_LIT(KPrivateRightsDir, "%c:\\private\\101F51F2\\PKI"); -_LIT(KFullLogDir, "%c:\\logs\\drm\\"); -#else -_LIT(KPrivateRightsDir, "c:\\private\\101F51F2\\PKI"); -_LIT(KFullLogDir, "c:\\logs\\drm\\"); -#endif - - -#ifdef __WINS__ -_LIT(KInputDir, "c:\\data\\drm\\keys\\"); -_LIT(KInputFilePattern, "c:\\data\\drm\\keys\\SigningCert*"); -#else -#ifdef RD_MULTIPLE_DRIVE -_LIT(KInputDir, "%c:\\drm\\keys\\"); -_LIT(KInputFilePattern, "%c:\\drm\\keys\\SigningCert*"); -#else -_LIT(KInputDir, "e:\\drm\\keys\\"); -_LIT(KInputFilePattern, "e:\\drm\\keys\\SigningCert*"); -#endif -#endif - -_LIT(KLogDir, "drm"); -_LIT(KLogName, "MtDrmKeyStorage.log"); -_LIT(KDeviceKeyFileName, "DevicePrivateKey.der"); -_LIT(KDeviceCertFileName, "DeviceCert.der"); - -#define TEST_STEP(string) \ - GLog.WriteFormat(_L("Next Test: %S"), &string); - -#define CHECK(condition) \ - if (!condition) GLog.WriteFormat(_L("FAIL: line %d"), __LINE__); - -// MODULE DATA STRUCTURES - -RFs GFs; -RFileLogger GLog; - -// STATIC TEST CONTENT AND RIGHTS OBJECTS - -// LOCAL FUNCTION PROTOTYPES - -// ==================== LOCAL FUNCTIONS ==================== - -LOCAL_C void ReadFileL(HBufC8*& aContent, const TDesC& aName) - { - TInt size = 0; - RFile file; - - User::LeaveIfError(file.Open(GFs, aName, EFileRead)); - User::LeaveIfError(file.Size(size)); - aContent = HBufC8::NewLC(size); - TPtr8 ptr(aContent->Des()); - User::LeaveIfError(file.Read(ptr, size)); - CleanupStack::Pop(); //aContent - } - - -// ==================== TEST FUNCTIONS ===================== - -LOCAL_C TUint MDrmKeyStorage_ImportDataL() - { - MDrmKeyStorage* storage = NULL; - HBufC8* privateKey = NULL; - HBufC8* cert = NULL; - RArray certChain; - RPointerArray buffers; - TFileName fileName; - TInt i; - CDir* dir; - TEntry entry; - TUint fileCount = 0; - - storage = DrmKeyStorageNewL(); - -#ifndef RD_MULTIPLE_DRIVE - - GFs.SetSessionPath(KInputDir); - -#else //RD_MULTIPLE_DRIVE - - TFileName tempPath; - TInt driveNumber( -1 ); - TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber ); - GFs.DriveToChar( driveNumber, driveLetter ); - - tempPath.Format( KInputDir, (TUint)driveLetter ); - - GFs.SetSessionPath(tempPath); - -#endif - - ReadFileL(privateKey, KDeviceKeyFileName); - ReadFileL(cert, KDeviceCertFileName); - buffers.Append(cert); - -#ifndef RD_MULTIPLE_DRIVE - - GFs.GetDir(KInputFilePattern, KEntryAttNormal, ESortByName, dir); - -#else //RD_MULTIPLE_DRIVE - - tempPath.Format( KInputFilePattern, (TUint)driveLetter ); - - GFs.GetDir(tempPath, KEntryAttNormal, ESortByName, dir); - -#endif - - for (i = 0; i < dir->Count(); i++) - { - ReadFileL(cert, (*dir)[i].iName); - buffers.Append(cert); - } - for (i = 0; i < buffers.Count(); i++) - { - certChain.Append(*(buffers[i])); - } - storage->ImportDataL(*privateKey, certChain); - delete storage; - delete privateKey; - fileCount = buffers.Count(); - certChain.Close(); - buffers.ResetAndDestroy(); - buffers.Close(); - return fileCount; - } - - -TUint KeyStorage() - { - TUint result = 0; - result = GFs.Connect(); - if( result != KErrNone ) - { - return result; - } - -#ifndef RD_MULTIPLE_DRIVE - - GFs.MkDirAll(KFullLogDir); - GFs.MkDirAll(KPrivateRightsDir); - GFs.MkDirAll(KInputDir); - -#else //RD_MULTIPLE_DRIVE - - TFileName tempPath; - TInt driveNumber( -1 ); - TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - GFs.DriveToChar( driveNumber, driveLetter ); - - tempPath.Format( KFullLogDir, (TUint)driveLetter ); - GFs.MkDirAll(tempPath); - - tempPath.Format( KPrivateRightsDir, (TUint)driveLetter ); - GFs.MkDirAll(tempPath); - - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber ); - GFs.DriveToChar( driveNumber, driveLetter ); - - tempPath.Format( KInputDir, (TUint)driveLetter ); - GFs.MkDirAll(tempPath); - -#endif - - - result = GLog.Connect(); - if( result != KErrNone ) - { - GFs.Close(); - return result; - } - GLog.CreateLog(KLogDir, KLogName, EFileLoggingModeOverwrite); - GLog.Write(_L("Start %D")); - - TRAPD(err,result = MDrmKeyStorage_ImportDataL()); - - GLog.WriteFormat(_L("Result: %d"), err); - CHECK(err == KErrNone); - GLog.CloseLog(); - GFs.Close(); - return result; - } - -TUint KeyStorageFromZipL(const TDesC& aFileName, RFs& aFs) - { - RFile f; - CZipFile* file; - CZipFileMemberIterator* iter; - CZipFileMember* member; - MDrmKeyStorage* storage = NULL; - TInt err = KErrNone; - HBufC8* privateKey = NULL; - HBufC8* cert = NULL; - RArray certChain; - TInt numCerts; - TInt i; - RZipFileMemberReaderStream* data; - TPtr8 ptr(NULL, 0); - TFileName fileName; - RPointerArray buffers; - - storage = DrmKeyStorageNewL(); - - err = f.Open( aFs, aFileName, EFileShareReadersOrWriters | EFileRead ); - if ( err == KErrInUse ) - { - err = f.Open( aFs, aFileName, EFileShareAny | EFileRead ); - if ( err == KErrInUse ) - { - err = f.Open( aFs, aFileName, EFileShareReadersOnly| EFileRead ); - } - } - User::LeaveIfError( err ); - - CleanupClosePushL( f ); - file = CZipFile::NewL( aFs, f ); - CleanupStack::PushL( file ); - iter = file->GetMembersL(); - CleanupStack::PushL( iter ); - member = iter->NextL(); - numCerts = 0; - while ( member != NULL ) - { - if (member->Name()->Left(11).CompareF(_L("SigningCert")) == 0) - { - numCerts++; - } - delete member; - member = iter->NextL(); - } - - member = file->CaseInsensitiveMemberL(_L("DeviceCert.der")); - cert = HBufC8::NewL(member->UncompressedSize()); - buffers.Append(cert); - file->GetInputStreamL(member, data); - ptr.Set(cert->Des()); - data->Read(ptr, member->UncompressedSize()); - certChain.Append(ptr); - delete data; - delete member; - for (i = 0; i < numCerts; i++) - { - fileName.Copy(_L("SigningCert")); - if (i < 10) - { - fileName.Append(_L("0")); - } - fileName.AppendNum(i); - fileName.Append(_L(".der")); - member = file->CaseInsensitiveMemberL(fileName); - cert = HBufC8::NewL(member->UncompressedSize()); - buffers.Append(cert); - file->GetInputStreamL(member, data); - ptr.Set(cert->Des()); - data->Read(ptr, member->UncompressedSize()); - certChain.Append(ptr); - delete data; - delete member; - } - member = file->CaseInsensitiveMemberL(_L("DevicePrivateKey.der")); - privateKey = HBufC8::NewL(member->UncompressedSize()); - file->GetInputStreamL(member, data); - ptr.Set(privateKey->Des()); - data->Read(ptr, member->UncompressedSize()); - delete data; - delete member; - - storage->ImportDataL(*privateKey, certChain); - delete privateKey; - certChain.Close(); - buffers.ResetAndDestroy(); - - CleanupStack::PopAndDestroy(3); - delete storage; - - numCerts++; - fileName.SetLength(0); - fileName.AppendNum(numCerts); - fileName.Append(_L(" keys imported")); - CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; - informationNote->ExecuteLD(fileName); - - return KErrNone; - } - diff -r abec8b1bb37c -r 442486f870da commondrm/drmencryptor/src/Performance.cpp --- a/commondrm/drmencryptor/src/Performance.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,861 +0,0 @@ -/* -* Copyright (c) 2002-2009 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: ?Description -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef RD_MULTIPLE_DRIVE -#include -#endif - -#include "Base64.h" -#include "Performance.h" -#include "DRMEncryptor.hrh" - -_LIT(KLogDir, "DRM"); -_LIT(KLogName, "Performance.log"); -#include "flogger.h" -#define LOG(string) \ - RFileLogger::Write(KLogDir, KLogName, \ - EFileLoggingModeAppend, string); -#define LOG2(string, a) \ - RFileLogger::WriteFormat(KLogDir, KLogName, \ - EFileLoggingModeAppend, string, a); -#define LOGHEX(buffer) \ - RFileLogger::HexDump(KLogDir, KLogName, \ - EFileLoggingModeAppend, _S(""), _S(""), \ - buffer.Ptr(), buffer.Length()); - -_LIT8(KMidiContent, -"TVRoZAAAAAYAAQAGAHhNVHJrAAAAGQD/WAQEAhgIAP9ZAgAAAP9RAwehIAD/LwBN\n\ -VHJrAAAKsgD/IQEAALkHaQCZLmQAM2QAI2QOIwAAMwAALgAuM2QOMwAuKGQAM2QO\n\ -MwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAu\n\ -M2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQOKAAAMwAuI2QAM2QO\n\ -MwAAIwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQOKAAAMwAuMWQAM2QO\n\ -MwAAMQAuLmQAM2QAI2QOIwAAMwAALgAuM2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAu\n\ -I2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QO\n\ -MwAAIwAuI2QAM2QOMwAAIwAuMmQAM2QAKGQOKAAAMwAAMgAuMmQAI2QAM2QOMwAA\n\ -IwAAMgAuMGQAI2QAM2QOMwAAIwAAMAAuMGQAI2QAM2QOMwAAIwAAMAAuMmQAM2QA\n\ -KGQOKAAAMwAAMgAQMmQOMgAQMGQAM2QOMwAAMAAQLWQOLQAQMWQALmQAM2QAI2QO\n\ -IwAAMQAALgAAMwAuM2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAu\n\ -I2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QO\n\ -MwAAIwAuM2QAKGQOKAAAMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuI2QAM2QO\n\ -MwAAIwAuM2QAKGQOKAAAMwAuMWQAM2QOMwAAMQAuLmQAM2QAI2QOIwAAMwAALgAu\n\ -M2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAu\n\ -KGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQO\n\ -KAAAMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQO\n\ -KAAAMwAuMWQAM2QOMwAAMQAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuMmQAM2QA\n\ -KGQOKAAAMwAAMgAuMmQAI2QAM2QOMwAAIwAAMgAuMGQAI2QAM2QOMwAAIwAAMAAu\n\ -MGQAI2QAM2QOMwAAIwAAMAAuMmQAM2QAKGQOKAAAMwAAMgAQMmQOMgAQMGQAM2QO\n\ -MwAAMAAQLWQOLQAQMWQALmQAM2QAI2QOIwAAMQAALgAAMwAuM2QOMwAuKGQAM2QO\n\ -MwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAu\n\ -M2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQOKAAAMwAuI2QAM2QO\n\ -MwAAIwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQOKAAAMwAuMWQAM2QO\n\ -MwAAMQAuLmQAM2QAI2QOIwAAMwAALgAuM2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAu\n\ -I2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAuM2QOMwAuMWQALmQA\n\ -M2QAI2QOIwAAMQAALgAAMwAuM2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QO\n\ -MwAAIwAuI2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAu\n\ -I2QAM2QOMwAAIwAuM2QAKGQOKAAAMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAu\n\ -I2QAM2QOMwAAIwAuM2QAKGQOKAAAMwAuMWQAM2QOMwAAMQAuLmQAM2QAI2QOIwAA\n\ -MwAALgAuM2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QO\n\ -MwAAIwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAu\n\ -M2QAKGQOKAAAMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAu\n\ -M2QAKGQOKAAAMwAuMWQAM2QOMwAAMQAuMWQALmQAM2QAI2QOIwAAMQAALgAAMwAu\n\ -M2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAu\n\ -KGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQO\n\ -KAAAMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQO\n\ -KAAAMwAuMWQAM2QOMwAAMQAuLmQAM2QAI2QOIwAAMwAALgAuM2QOMwAuKGQAM2QO\n\ -MwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAu\n\ -M2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuMmQAM2QAKGQOKAAAMwAAMgAu\n\ -MmQAI2QAM2QOMwAAIwAAMgAuMGQAI2QAM2QOMwAAIwAAMAAuMGQAI2QAM2QOMwAA\n\ -IwAAMAAuMmQAM2QAKGQOKAAAMwAAMgAQMmQOMgAQMGQAM2QOMwAAMAAQLWQOLQAQ\n\ -MWQALmQAM2QAI2QOIwAAMQAALgAAMwAuM2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAu\n\ -I2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QO\n\ -MwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQOKAAAMwAuI2QAM2QOMwAAIwAuI2QAM2QO\n\ -MwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQOKAAAMwAuMWQAM2QOMwAAMQAuLmQAM2QA\n\ -I2QOIwAAMwAALgAuM2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAu\n\ -I2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QO\n\ -MwAAIwAuM2QAKGQOKAAAMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuI2QAM2QO\n\ -MwAAIwAuM2QAKGQOKAAAMwAuMWQAM2QOMwAAMQAuI2QAM2QOMwAAIwAuI2QAM2QO\n\ -MwAAIwAuMmQAM2QAKGQOKAAAMwAAMgAuMmQAI2QAM2QOMwAAIwAAMgAuMGQAI2QA\n\ -M2QOMwAAIwAAMAAuMGQAI2QAM2QOMwAAIwAAMAAuMmQAM2QAKGQOKAAAMwAAMgAQ\n\ -MmQOMgAQMGQAM2QOMwAAMAAQLWQOLQAQMWQALmQAM2QAI2QOIwAAMQAALgAAMwAu\n\ -M2QOMwAuKGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAu\n\ -KGQAM2QOMwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQO\n\ -KAAAMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuM2QAKGQO\n\ -KAAAMwAuMWQAM2QOMwAAMQAuLmQAM2QAI2QOIwAAMwAALgAuM2QOMwAuKGQAM2QO\n\ -MwAAKAAuM2QOMwAuI2QAM2QOMwAAIwAuI2QAM2QOMwAAIwAuKGQAM2QOMwAAKAAu\n\ -M2QOMwAA/y8ATVRyawAABTMA/yEBAADAIwCwB2kAkCRkHSQAHyRkDiQALiRkHSQA\n\ -HyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQA\n\ -HyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQA\n\ -HyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQA\n\ -HyRkDiQALiRkHSQAHyRkDiQALiRkHSQAWyRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAWyRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQA\n\ -HyRkDiQALiRkHSQAWyRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALitkHSsAHytkDisALitkHSsAHytkDisALitkHSsAHytkDisA\n\ -LitkHSsAHytkDisALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALilkHSkAHylkDikALilkHSkAHylkDikALilkHSkAHylkDikA\n\ -LilkHSkAHylkDikALitkHSsAHytkDisALitkHSsAHytkDisALitkHSsAHytkDisA\n\ -LitkHSsAHyRkDiQALilkHSkAHylkDikALilkHSkAHylkDikALilkHSkAHylkDikA\n\ -LilkHSkAHy1kDi0ALitkHSsAHytkDisALitkHSsAHytkDisALitkHSsAHytkDisA\n\ -LitkHSsAHytkDisALilkHSkAHylkDikALilkHSkAHylkDikALilkHSkAHylkDikA\n\ -LilkHSkAHylkDikALitkHSsAHytkDisALitkHSsAHytkDisALitkHSsAHytkDisA\n\ -LitkHSsAHytkDisALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LiRkHSQAWyRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQA\n\ -WyRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -LitkHSsAHytkDisALitkHSsAHytkDisALitkHSsAHytkDisALitkHSsAHytkDisA\n\ -LiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQALiRkHSQAHyRkDiQA\n\ -AP8vAE1UcmsAAAEeAP8hAQAAwQGOCJFTZABUZA5UAABTAAFPZABRZA5RAABPAAFM\n\ -ZABNZA5NAABMAAFIZABKZA5KAABIAAFFZABHZA5HAABFAAFBZABDZA5DAABBAAE+\n\ -ZABAZA5AAAA+AAE8ZA48AJ0JU2QAVGQOVAAAUwABT2QAUWQOUQAATwABTGQATWQO\n\ -TQAATAABSGQASmQOSgAASAABRWQAR2QORwAARQABQWQAQ2QOQwAAQQABPmQAQGQO\n\ -QAAAPgABPGQOPAC7CVNkAFRkDlQAAFMAAU9kAFFkDlEAAE8AAUxkAE1kDk0AAEwA\n\ -AUhkAEpkDkoAAEgAAUVkAEdkDkcAAEUAAUFkAENkDkMAAEEAAT5kAEBkDkAAAD4A\n\ -ATxkDjwAAP8vAE1UcmsAAAQ9AP8hAQAAwh4AsgdkjwCSTGQANGQAMGR3MAAANAAA\n\ -TAABNGQAMGQdMAAANAAfLmQPRmQsRgAALgABSmQANGQAL2Q7LwAANAAASgABSmQA\n\ -NGQAL2Q7LwAANAAASgA9SGQATGQAMGQANGR3NAAASAAATAAAMACCLS5kOy4AAS9k\n\ -Oy8AAUxkADBkADRkdzQAADAAAEwAATRkADBkHTAAADQAH0hkAC5kOy4AAEgAAVFk\n\ -ADlkADVkOzUAADkAAFEAAVBkADlkADVkOzUAADkAAFAAAUxkHUwAAU1kHU0AAVRk\n\ -AExkADdkADRkdzQAADcAAEwAgyRUAAFMZAA0ZAAwZHcwAAA0AABMAAE0ZAAwZB0w\n\ -AAA0AB8uZA9GZCxGAAAuAAFKZAA0ZAAvZDsvAAA0AABKAAFKZAA0ZAAvZDsvAAA0\n\ -AABKAD1IZABMZAAwZAA0ZHc0AABIAABMAAAwAIMlR2QAQ2QAO2QAN2R3NwAARwAA\n\ -QwAAOwABQ2QAR2QAO2QAN2QdNwAAQwAARwAAOwAfSmQAPmQ7PgAASgABSGQAPGR3\n\ -PAAASAABT2QAN2QAO2Q7OwAANwAATwA9VGSDX1QAATlkADVkdzUAADkAPUhkO0gA\n\ -AUdkd0cAPUVkO0UAAUdkd0cAgXEwZHcwAAE5ZAA1ZHc1AAA5AD1IZDtIAAFKZHdK\n\ -AD1IZDtIAAFHZDtHAIMpOWQANWR3NQAAOQA9SGQ7SAABSmR3SgA9SGQ4NGQAN2QA\n\ -T2QATGQDSAA4TwAANAAANwAATAA9NGQAN2QAT2QATGQ7TAAANAAANwAATwA9MmQA\n\ -SmQ7SgAAMgABMGQASGQ7SAAAMAABL2QAR2Q7RwAALwABMGQASGQ7MACHQEgAAUxk\n\ -ADRkADBkdzAAADQAAEwAATRkADBkHTAAADQAHy5kD0ZkLEYAAC4AAUpkADRkAC9k\n\ -Oy8AADQAAEoAAUpkADRkAC9kOy8AADQAAEoAPUhkAExkADBkADRkdzQAAEgAAEwA\n\ -ADAAgi0uZDsuAAEvZDsvAAFMZAAwZAA0ZHc0AAAwAABMAAE0ZAAwZB0wAAA0AB9I\n\ -ZAAuZDsuAABIAAFRZAA5ZAA1ZDs1AAA5AABRAAFQZAA5ZAA1ZDs1AAA5AABQAAFM\n\ -ZB1MAAFNZB1NAAFUZABMZAA3ZAA0ZHc0AAA3AABMAIMkVAABTGQANGQAMGR3MAAA\n\ -NAAATAABNGQAMGQdMAAANAAfLmQPRmQsRgAALgABSmQANGQAL2Q7LwAANAAASgAB\n\ -SmQANGQAL2Q7LwAANAAASgA9SGQATGQAMGQANGR3NAAASAAATAAAMACDJUdkAENk\n\ -ADtkADdkdzcAAEcAAEMAADsAAUNkAEdkADtkADdkHTcAAEMAAEcAADsAH0pkAD5k\n\ -Oz4AAEoAAUhkADxkdzwAAEgAAU9kADdkADtkOzsAADcAAE8APVRkg19UAAD/LwBN\n\ -VHJrAAAAWAD/IQEAAMNQALMHeK0AkzVkg181AAE3ZINfNwABNWSDXzUAATdkg183\n\ -AAE1ZINfNQABN2SDXzcAATBkhz8wAAEwZJY/MAABN2SDXzcAATBkg18wAAD/LwA=\n"); - -_LIT8(KContentHeader, "--boundary\r\nContent-type: audio/midi\r\nContent-Transfer-Encoding: base64\r\n\r\n"); -_LIT8(KCdStartEndHeader, -"--boundary\r\n\ -Content-Type: application/vnd.oma.drm.rights+xml\r\n\ -Content-Transfer-Encoding: binary\r\n\ -\r\n\ -\ -1.0\ -\ -cid:content0000@localhost\ -\ -\ -\ -2020-01-01T00:00:001980-01-01T00:00:00\ -\ -\ -\r\n\ -\r\n"); -_LIT8(KCdCountHeader, -"--boundary\r\n\ -Content-Type: application/vnd.oma.drm.rights+xml\r\n\ -Content-Transfer-Encoding: binary\r\n\ -\r\n\ -\ -1.0\ -\ -cid:content0001@localhost\ -\ -\ -1000000\ -\ -\r\n\ -\r\n"); -_LIT8(KFooter, "\r\n--boundary--\r\n"); - -const TInt KFileNumber = 50; -const TInt KOpenCount = 10; - -#ifdef __WINS__ -_LIT(KFilesDir, "c:\\data\\others\\DrmTest\\"); -#else -#ifdef RD_MULTIPLE_DRIVE -_LIT(KFilesDir, "%c:\\others\\DrmTest\\"); -#else -_LIT(KFilesDir, "e:\\others\\DrmTest\\"); -#endif -#endif -_LIT(KFlFileNameBase, "-fl"); -_LIT(KPlainFileNameBase, "-plain.mid"); -_LIT(KCdStartEndFileNameBase, "-cd-se"); -_LIT(KCdCountFileNameBase, "-cd-count"); -_LIT(KFileSuffix, ".dcf"); -_LIT(KBigFilePlain, "bigfile.txt"); -_LIT(KBigFileEncrypted, "bigfile.dcf"); - -enum ETestFileType - { - EFl, - ECdStartEnd, - ECdCount, - EPlain - }; - -void SetupDirectoryL(const TDesC& aDir) - { - RFs fs; - TFileName fileName; - CFileMan* fm = NULL; - - LOG(_L("SetupDirectoryL")); - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - fm = CFileMan::NewL(fs); - CleanupStack::PushL(fm); - fm->RmDir(aDir); - fs.MkDirAll(aDir); - CleanupStack::PopAndDestroy(2); // fm, fs - } - -void CreateFileL(RFs& aFs, CDRMMessageParser* aParser, ETestFileType aType, TInt aNumber) - { - TFileName fileName; - RFileWriteStream out; - HBufC8* buffer = NULL; - - fileName.AppendNum(aNumber); - switch (aType) - { - case EPlain: - fileName.Append(KPlainFileNameBase); - break; - case EFl: - fileName.Append(KFlFileNameBase); - fileName.Append(KFileSuffix); - break; - case ECdStartEnd: - fileName.Append(KCdStartEndFileNameBase); - fileName.Append(KFileSuffix); - break; - case ECdCount: - fileName.Append(KCdCountFileNameBase); - fileName.Append(KFileSuffix); - break; - } - out.Create(aFs, fileName, EFileWrite); - CleanupClosePushL(out); - if (aType != EPlain) - { - aParser->InitializeMessageParserL(out); - switch (aType) - { - case ECdStartEnd: - aParser->ProcessMessageDataL(KCdStartEndHeader); - break; - case ECdCount: - aParser->ProcessMessageDataL(KCdCountHeader); - break; - } - aParser->ProcessMessageDataL(KContentHeader); - aParser->ProcessMessageDataL(KMidiContent); - aParser->ProcessMessageDataL(KFooter); - aParser->FinalizeMessageParserL(); - } - else - { - buffer = Base64DecodeL(KMidiContent); - CleanupStack::PushL(buffer); - out.WriteL(*buffer); - CleanupStack::PopAndDestroy(); // buffer - } - CleanupStack::PopAndDestroy(); // out - } - -void GenerateFilesL(const TDesC& aDir, TInt aCount) - { - CDRMMessageParser* parser = NULL; - TInt i; - RFs fs; - - LOG(_L("GenerateFilesL")); - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - fs.SetSessionPath(aDir); - parser = CDRMMessageParser::NewL(); - CleanupStack::PushL(parser); - for (i = 0; i < aCount; i++) - { - CreateFileL(fs, parser, EPlain, i); - CreateFileL(fs, parser, EFl, i); - CreateFileL(fs, parser, ECdStartEnd, i); - CreateFileL(fs, parser, ECdCount, i); - } - CleanupStack::PopAndDestroy(2); // parser, fs - } - - -void GenerateBigFilesL(const TDesC& aDir) - { - RFs fs; - RFileWriteStream out; - COma1DcfCreator* creator = NULL; - HBufC8* buffer = NULL; - TPtr8 ptr(NULL, 0); - TInt i; - - LOG(_L("GenerateBigFilesL")); - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - fs.SetSessionPath(aDir); - creator = COma1DcfCreator::NewL(); - CleanupStack::PushL(creator); - - buffer = HBufC8::NewMax(50 * 1024); - CleanupStack::PushL(buffer); - ptr.Set(buffer->Des()); - ptr.Fill('0'); - - LOG(_L("Creating plain file")); - fs.Delete(KBigFilePlain); - out.Create(fs, KBigFilePlain, EFileWrite); - CleanupClosePushL(out); - for (i = 0; i < 40; i++) - { - out.WriteL(ptr); - } - CleanupStack::PopAndDestroy(); // out - - LOG(_L("Creating encrypted file")); - fs.Delete(KBigFileEncrypted); - out.Create(fs, KBigFileEncrypted, EFileWrite); - CleanupClosePushL(out); - creator->EncryptInitializeL(out, _L8("text/plain"), NULL); - for (i = 0; i < 40; i++) - { - creator->EncryptUpdateL(ptr); - } - creator->EncryptFinalizeL(); - CleanupStack::PopAndDestroy(4); // out, creator, buffer, fs - } - - -void TestDecryptionSpeedL(const TDesC& aDir, TBool aRandom, TInt aType) - { - TInt i; - TInt j; - HBufC8* buffer = NULL; - RFs fs; - TPtr8 ptr(NULL, 0); - CData* data = NULL; - RFile file; - TInt blockSize[5] = {64, 512, 1024, 2048, 4096}; - TFileName fileName; - TInt pos = 0; - - LOG(_L("TestDecryptionSpeedL")); - if (aRandom) - { - LOG(_L("Random Reading")); - } - else - { - LOG(_L("Sequential Reading")); - } - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - fs.SetSessionPath(aDir); - - buffer = HBufC8::NewL(4096); - CleanupStack::PushL(buffer); - ptr.Set(buffer->Des()); - for (j = 0; j < 5; j++) - { - LOG2(_L("Block size: %d"), blockSize[j]); - - switch (aType) - { - case 1: //Plain file with RFile - { - LOG(_L("Reading plain file (RFile)")); - User::LeaveIfError(file.Open(fs, KBigFilePlain, EFileRead)); - CleanupClosePushL(file); - for (i = 0; i < 40 * 50 * 1024 / blockSize[j]; i++) - { - if (aRandom) - { - pos = Abs(Math::Random() % (40 * 50 * 1024 - 2 * blockSize[j])); - file.Seek(ESeekStart, pos); - } - file.Read(ptr, blockSize[j]); - } - CleanupStack::PopAndDestroy(); // file - LOG2(_L("Reading plain file (RFile) done (%d blocks)"), i); - } - break; - case 2: //Plain file with CAF - { - LOG(_L("Reading plain file (CAF)")); - fileName.Copy(aDir); - fileName.Append(KBigFilePlain); - data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), - EPeek, EContentShareReadOnly); - CleanupStack::PushL(data); - for (i = 0; i < 40 * 50 * 1024 / blockSize[j]; i++) - { - if (aRandom) - { - pos = Abs(Math::Random() % (40 * 50 * 1024 - 2 * blockSize[j])); - data->Seek(ESeekStart, pos); - } - data->Read(ptr, blockSize[j]); - } - CleanupStack::PopAndDestroy(); // data - LOG2(_L("Reading plain file (CAF) done (%d blocks)"), i); - } - break; - case 3: //DRM Protected on server side - { - LOG(_L("Reading encrypted file (server decryption)")); - fileName.Copy(aDir); - fileName.Append(KBigFileEncrypted); - __UHEAP_MARK; - data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), - EPeek, EContentShareReadOnly); - CleanupStack::PushL(data); - data->ExecuteIntent(EView); //!!!!!!!!!!!!! - for (i = 0; i < 40 * 50 * 1024 / blockSize[j]; i++) - { - if (aRandom) - { - pos = Abs(Math::Random() % (40 * 50 * 1024 - 2 * blockSize[j])); - data->Seek(ESeekStart, pos); - } - data->Read(ptr, blockSize[j]); - } - - CleanupStack::PopAndDestroy(); // data - __UHEAP_MARKEND; - LOG2(_L("Reading encrypted file done (%d blocks)"), i); - - // DRM protected on client side - LOG(_L("Reading encrypted file (client decryption)")); - fileName.Copy(aDir); - fileName.Append(KBigFileEncrypted); - __UHEAP_MARK; - data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), - EPeek, EContentShareReadOnly); - CleanupStack::PushL(data); - data->ExecuteIntent(EView); - for (i = 0; i < 40 * 50 * 1024 / blockSize[j]; i++) - { - if (aRandom) - { - pos = Math::Random() % (40 * 50 * 1024 - blockSize[j]); - data->Seek(ESeekStart, pos); - } - data->Read(ptr, blockSize[j]); - } - CleanupStack::PopAndDestroy(); // data - __UHEAP_MARKEND; - LOG2(_L("Reading encrypted file done (%d blocks)"), i); - } - break; - } - } - CleanupStack::PopAndDestroy(); // buffer - - CleanupStack::PopAndDestroy(); // fs - } - -void TestFileOpeningSpeedL(const TDesC& aDir, TInt aType) - { - TFileName fileName; - TInt j; - TInt i; - CData* data = NULL; - RFs fs; - RFile file; - - LOG2(_L("TestFileOpeningSpeedL (%d files)"), KFileNumber * KOpenCount); - - switch( aType) - { - case 1: // With RFile - { - LOG(_L("Opening plain files (with RFs::Connect)")); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KFlFileNameBase); - fileName.Append(KFileSuffix); - for (j = 0; j < KOpenCount; j++) - { - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - User::LeaveIfError(file.Open(fs, fileName, EFileRead)); - file.Close(); - CleanupStack::PopAndDestroy(); - } - } - LOG(_L("Opening plain files done")); - - LOG(_L("Opening plain files (without RFs::Connect)")); - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KFlFileNameBase); - fileName.Append(KFileSuffix); - for (j = 0; j < KOpenCount; j++) - { - User::LeaveIfError(file.Open(fs, fileName, EFileRead)); - file.Close(); - } - } - CleanupStack::PopAndDestroy(); - LOG(_L("Opening plain files done")); - } - break; - - case 2: //With CAF - { - - LOG(_L("Opening plain files (CAF)")); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KPlainFileNameBase); - for (j = 0; j < KOpenCount; j++) - { - data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), - EPlay, EContentShareReadOnly); - delete data; - } - } - - - LOG(_L("Opening plain files done")); - - User::After(3000000); - - LOG(_L("Opening plain files CAF with Filehandle")); - - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KPlainFileNameBase); - for (j = 0; j < KOpenCount; j++) - { - User::LeaveIfError(file.Open(fs, fileName, EFileRead | EFileShareAny)); - CleanupClosePushL(file); - data = CData::NewL(file, KDefaultContentObject, EPlay ); - delete data; - CleanupStack::PopAndDestroy(); // file - } - } - CleanupStack::PopAndDestroy(); - - - LOG(_L("Opening plain files (CAF with filehandle) done")); - } - break; - - case 3: //With DRM - { - - LOG(_L("Opening FL files")); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KFlFileNameBase); - fileName.Append(KFileSuffix); - for (j = 0; j < KOpenCount; j++) - { - data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), - EPlay, EContentShareReadOnly); - delete data; - } - } - LOG(_L("Opening FL files done")); - - User::After(3000000); - - LOG(_L("Opening DRM FL files (CAF with filehandle)")); - - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KFlFileNameBase); - fileName.Append(KFileSuffix); - for (j = 0; j < KOpenCount; j++) - { - User::LeaveIfError(file.Open(fs, fileName, EFileRead | EFileShareAny)); - CleanupClosePushL(file); - data = CData::NewL(file, KDefaultContentObject, EPlay ); - delete data; - CleanupStack::PopAndDestroy(); - } - } - CleanupStack::PopAndDestroy(); - - LOG(_L("Opening DRM FL files (CAF with filehandle) done")); - - User::After(3000000); - - LOG(_L("Opening CD (Start/End) files")); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KCdStartEndFileNameBase); - fileName.Append(KFileSuffix); - for (j = 0; j < KOpenCount; j++) - { - data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), - EPlay, EContentShareReadOnly); - delete data; - } - } - LOG(_L("Opening CD (Start/End) files done")); - - User::After(3000000); - - LOG(_L("Opening CD (Count) files")); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KCdCountFileNameBase); - fileName.Append(KFileSuffix); - for (j = 0; j < KOpenCount; j++) - { - data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), - EPlay, EContentShareReadOnly); - delete data; - } - } - LOG(_L("Opening CD (Count) files done")); - - } - break; - case 4: - { - LOG(_L("Opening CD (Count) files with Consumption")); - for (i = 0; i < KFileNumber; i++) - { - fileName.Copy(aDir); - fileName.AppendNum(i); - fileName.Append(KCdCountFileNameBase); - fileName.Append(KFileSuffix); - for (j = 0; j < KOpenCount; j++) - { - data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), - EPlay, EContentShareReadOnly); - data->ExecuteIntent(EPlay); - delete data; - } - } - LOG(_L("Opening CD (Count) files with Consumption done")); - } - break; - } - } -void TestDatabasePerformanceL() - { - LOG(_L("TestDatabasePerformanceL")); - } - -void TestPerformanceL(TInt aCommand) - { - LOG(_L("TestPerformanceL")); - -#ifndef RD_MULTIPLE_DRIVE - - switch(aCommand) - { - case EDRM_API_SubMenuId_1: // Generate files - { - SetupDirectoryL(KFilesDir); - GenerateFilesL(KFilesDir, KFileNumber); - GenerateBigFilesL(KFilesDir); - break; - } - case EDRM_API_SubMenuId_1_1: // RFile opening - { - TestFileOpeningSpeedL(KFilesDir, 1); - break; - } - case EDRM_API_SubMenuId_1_2: // RFile Sequential - { - TestDecryptionSpeedL(KFilesDir, EFalse, 1); - break; - } - case EDRM_API_SubMenuId_1_3: // RFile Random - { - TestDecryptionSpeedL(KFilesDir, ETrue, 1); - break; - } - case EDRM_API_SubMenuId_2_1: // CAF File Opening - { - TestFileOpeningSpeedL(KFilesDir, 2); - break; - } - case EDRM_API_SubMenuId_2_2: // CAF Sequential - { - TestDecryptionSpeedL(KFilesDir, EFalse, 2); - break; - } - case EDRM_API_SubMenuId_2_3: // CAF Random - { - TestDecryptionSpeedL(KFilesDir, ETrue, 2); - break; - } - case EDRM_API_SubMenuId_3_1_1: // DRM file opening - { - TestFileOpeningSpeedL(KFilesDir, 3); - break; - } - case EDRM_API_SubMenuId_3_1_2: // DRM file opening with consume - { - TestFileOpeningSpeedL(KFilesDir, 4); - break; - } - case EDRM_API_SubMenuId_3_1_3: // Sequential DRM - { - TestDecryptionSpeedL(KFilesDir, EFalse, 3); - break; - } - case EDRM_API_SubMenuId_3_1_4: // Random DRM - { - TestDecryptionSpeedL(KFilesDir, ETrue, 3); - break; - } - } - -#else //RD_MULTIPLE_DRIVE - - RFs fs; - TInt driveNumber( -1 ); - TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber ); - - User::LeaveIfError( fs.Connect() ); - fs.DriveToChar( driveNumber, driveLetter ); - fs.Close(); - - TFileName filesDir; - filesDir.Format( KFilesDir, (TUint)driveLetter ); - - switch(aCommand) - { - case EDRM_API_SubMenuId_1: // Generate files - { - SetupDirectoryL(filesDir); - GenerateFilesL(filesDir, KFileNumber); - GenerateBigFilesL(filesDir); - break; - } - case EDRM_API_SubMenuId_1_1: // RFile opening - { - TestFileOpeningSpeedL(filesDir, 1); - break; - } - case EDRM_API_SubMenuId_1_2: // RFile Sequential - { - TestDecryptionSpeedL(filesDir, EFalse, 1); - break; - } - case EDRM_API_SubMenuId_1_3: // RFile Random - { - TestDecryptionSpeedL(filesDir, ETrue, 1); - break; - } - case EDRM_API_SubMenuId_2_1: // CAF File Opening - { - TestFileOpeningSpeedL(filesDir, 2); - break; - } - case EDRM_API_SubMenuId_2_2: // CAF Sequential - { - TestDecryptionSpeedL(filesDir, EFalse, 2); - break; - } - case EDRM_API_SubMenuId_2_3: // CAF Random - { - TestDecryptionSpeedL(filesDir, ETrue, 2); - break; - } - case EDRM_API_SubMenuId_3_1_1: // DRM file opening - { - TestFileOpeningSpeedL(filesDir, 3); - break; - } - case EDRM_API_SubMenuId_3_1_2: // DRM file opening with consume - { - TestFileOpeningSpeedL(filesDir, 4); - break; - } - case EDRM_API_SubMenuId_3_1_3: // Sequential DRM - { - TestDecryptionSpeedL(filesDir, EFalse, 3); - break; - } - case EDRM_API_SubMenuId_3_1_4: // Random DRM - { - TestDecryptionSpeedL(filesDir, ETrue, 3); - break; - } - } - -#endif - - //TestDatabasePerformanceL(); - } diff -r abec8b1bb37c -r 442486f870da commondrm/drmqtencryptor/drmencryptor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmqtencryptor/drmencryptor.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2003-2009 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: DRM Encryption tool. +* +*/ + +#ifndef DRMENCRYPTOR_H +#define DRMENCRYPTOR_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/*namespace Ui +{ + class mainWindow; + class QPushButton; +}*/ + +//forward declarations +class DateTimeDialog; + +class DRMEncryptor : public QMainWindow +{ + Q_OBJECT + +public: + DRMEncryptor(); + ~DRMEncryptor(); + +private: + void ProcessMessageL(const TDesC& aFile, const TDesC& aOutput); + //ContentAccess::CManager* GetCafDataL( ContentAccess::TAgent& aAgent ); + void DeleteWmDrmRdbL(); + + +signals: + +private slots: + void onTextChanged(const QString &); + void setDRMClock(); + void getDRMClock(); + void startEncrypt(); + void deleteWmDrmDB(); + void launchBrowser(); + TUint EncryptL(TUint& aEncryptedCount, TUint& aRightsCount, TUint& aMessagesProcessed); + + //void onDateTimeChanged(const QDateTime & datetime ); + +private: + QMenu *iOptionsMenu; + QPushButton *iSetDRMClockButton; + + // Menu options + QAction *iSetDRMClockAct; + QAction *iGetDRMClockAct; + QAction *iEncryptAct; + QAction *iDeleteWMDRMDBAct; + QAction *iLaunchBrowserAct; + + DateTimeDialog *iDateTimeDialog; + QDateTime iDatetime; +}; + +class DateTimeDialog : public QDialog +{ + Q_OBJECT + +public: + DateTimeDialog(); + ~DateTimeDialog(); + +private slots: + void setDRMClock(); + +private: + QHBoxLayout *iLayout; + QDateTimeEdit *iDateEdit; + /*QDateTimeEdit *iDateEdit; + QPushButton *iOkButton; + QPushButton *iCancelButton;*/ + +}; + + +#endif // DRMENCRYPTOR_H diff -r abec8b1bb37c -r 442486f870da commondrm/drmqtencryptor/drmencryptor.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmqtencryptor/drmencryptor.ui Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2003-2009 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: DRM Encryption tool. +* +*/ + + + + mainWindow + + + + 0 + 0 + 310 + 498 + + + + DRMEncryptor + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmqtencryptor/drmencyptor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmqtencryptor/drmencyptor.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,780 @@ +/* +* Copyright (c) 2003-2009 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: DRM Encryption tool. +* +*/ + +#include "drmencryptor.h" +//#include "ui_dialog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_MULTIPLE_DRIVE +#include +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +//#include + +#include "drmserviceapi.h" +#include "DRMTypes.h" + +const TInt KBufferSize = 20000; + +DRMEncryptor::DRMEncryptor() +{ + QWidget *widget = new QWidget(); + setCentralWidget(widget); + + setBackgroundRole( QPalette::Window ); + + QVBoxLayout *layout = new QVBoxLayout; + layout->setAlignment(Qt::AlignCenter); + + QLabel *mainWindowLabel = new QLabel("DRM Encryptor"); + layout->addWidget(mainWindowLabel); + + //layout->addStretch(); + + //ui->setupUi(this); + //iOptionsMenu = menuBar()->addMenu(tr("&Options")); + + // Create menu options + iSetDRMClockAct = new QAction(tr("&Set DRM Clock"), this); + iSetDRMClockAct->setStatusTip(tr("Set DRM secure clock time.")); + + iGetDRMClockAct = new QAction(tr("&Get DRM Clock Time"), this); + iGetDRMClockAct->setStatusTip(tr("Get DRM secure clock time.")); + + iEncryptAct = new QAction(tr("&Encrypt"), this); + iEncryptAct->setStatusTip(tr("Encrypt")); + + iLaunchBrowserAct = new QAction(tr("&Launch Browser"), this); + iLaunchBrowserAct->setStatusTip(tr("Launch Browser")); + + iDeleteWMDRMDBAct = new QAction(tr("&Delete WMDRM DB"), this); + iDeleteWMDRMDBAct->setStatusTip(tr("Delete WMDRM Database rights.")); + + menuBar()->addAction(iSetDRMClockAct); + menuBar()->addAction(iGetDRMClockAct); + menuBar()->addAction(iEncryptAct); + menuBar()->addAction(iDeleteWMDRMDBAct); + menuBar()->addAction(iLaunchBrowserAct); + + connect(iSetDRMClockAct, SIGNAL(triggered()), this, SLOT(setDRMClock())); + connect(iGetDRMClockAct, SIGNAL(triggered()), this, SLOT(getDRMClock())); + connect(iEncryptAct, SIGNAL(triggered()), this, SLOT(startEncrypt())); + connect(iDeleteWMDRMDBAct, SIGNAL(triggered()), this, SLOT(deleteWmDrmDB())); + connect(iLaunchBrowserAct, SIGNAL(triggered()), this, SLOT(launchBrowser())); + + //setDRMClockButton = new QPushButton("Set DRM Clock", this); + //connect(setDRMClockButton, SIGNAL(clicked()), this, SLOT(setDRMClock())); + //setDRMClockButton->show(); + +/* ui->pushButton->setEnabled(false); + + ui->lineEdit->setValidator(new QDoubleValidator(this)); + ui->lineEdit_2->setValidator(new QDoubleValidator(this)); +*/ + //connect(ui->mainMenu,SIGNAL(onChanged()),this,SLOT(onLaske())); + //connect(ui->lineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(onTextChanged(const QString &))); + //connect(ui->mainMenu,SIGNAL(textChanged(const QString &)),this,SLOT(onTextChanged(const QString &))); + + widget->setLayout(layout); +} + +DRMEncryptor::~DRMEncryptor() +{ + //delete ui; +} + +void DRMEncryptor::setDRMClock() +{ + DateTimeDialog *dateTimeDialog = new DateTimeDialog(); + dateTimeDialog->show(); +} + +void DRMEncryptor::getDRMClock() +{ + TTime time; + TInt timeZone; + TDateTime date; + DRMClock::ESecurityLevel level; + TInt error( KErrNone ); + TBuf< 80 > buf; + + DRM::CDrmServiceApi* service = NULL; + + TRAPD(err, service = DRM::CDrmServiceApi::NewL()); + if(err!=KErrNone) + { + QMessageBox::information(this, tr("DRM Clock"),tr("Error creating CDrmServiceApi.")); + buf.AppendNum(error); + QString string((QChar*)buf.Ptr(),buf.Length()); + QMessageBox::information(this, tr("DRM Clock"),string); + delete service; // service + return; + } + + error = service->GetSecureTime( time, timeZone, level ); + if(!error==KErrNone) + { + QMessageBox::information(this, tr("DRM Clock"),tr("Error getting secure time.")); + + buf.AppendNum(error); + QString string((QChar*)buf.Ptr(),buf.Length()); + QMessageBox::information(this, tr("DRM Clock"),string); + delete service; + return; + } + + date = time.DateTime(); + + if(level == DRMClock::KSecure) + { + _LIT(KFormatTxt,"DRMClock Time:\n%d/%d/%d\n%d:%d:%d\nNitz available"); + buf.Format( KFormatTxt, + date.Day()+1, + TInt(date.Month()+1), + date.Year(), + date.Hour(), + date.Minute(), + date.Second()); + } + else + { + _LIT(KFormatTxt,"DRMClock Time:\n%d/%d/%d\n%d:%d:%d\nNitz unavailable"); + buf.Format( KFormatTxt, + date.Day()+1, + TInt(date.Month()+1), + date.Year(), + date.Hour(), + date.Minute(), + date.Second()); + } + + QGridLayout *layout = new QGridLayout; + layout->setAlignment(Qt::AlignCenter); + setLayout(layout); + + + QString datetimeString((QChar*)buf.Ptr(),buf.Length()); + + QMessageBox *drmClockTime = new QMessageBox(this); + drmClockTime->setWindowTitle(tr("DRM Clock")); + drmClockTime->setText(datetimeString); + + layout->addWidget(drmClockTime); + drmClockTime->show(); + +} + +LOCAL_C void ReadFileL(HBufC8*& aContent, const TDesC& aName, RFs& aFs) + { + TInt size = 0; + RFile file; + User::LeaveIfError(file.Open(aFs, aName, EFileRead)); + User::LeaveIfError(file.Size(size)); + aContent = HBufC8::NewLC(size); + TPtr8 ptr(aContent->Des()); + User::LeaveIfError(file.Read(ptr, size)); + CleanupStack::Pop(); //aContent + } + +// --------------------------------------------------------- +// UpdateDCFRepositoryL() +// Update saved file to DCFRepository +// --------------------------------------------------------- +// +LOCAL_C void UpdateDCFRepositoryL( const TDesC& aFileName) + { + CDcfEntry* dcf( NULL ); + CDcfRep* dcfRep( NULL ); + + dcf = CDcfEntry::NewL(); + CleanupStack::PushL( dcf ); + + dcfRep = CDcfRep::NewL(); + CleanupStack::PushL( dcfRep ); + + dcf->SetLocationL( aFileName, 0 ); + dcfRep->UpdateL( dcf ); + + CleanupStack::PopAndDestroy(2); // dcf, dcfRep + } + +void ProcessRightsL(const TDesC& aFile) + { + CDRMMessageParser* c = NULL; + HBufC8* d = NULL; + RFs fs; + RPointerArray rights; + + User::LeaveIfError(fs.Connect()); + c = CDRMMessageParser::NewL(); + ReadFileL(d, aFile, fs); + c->ProcessRightsObject(*d, rights); + rights.ResetAndDestroy(); + delete d; + delete c; + fs.Close(); + } + +void DRMEncryptor::ProcessMessageL(const TDesC& aFile, const TDesC& aOutput) + { + CDRMMessageParser* c = NULL; + HBufC8* d = NULL; + RFs fs; + TPtr8 inRead(NULL, 0); + TInt error = 1; + __UHEAP_MARK; + + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + c = CDRMMessageParser::NewL(); + CleanupStack::PushL(c); + + d = HBufC8::NewLC( KBufferSize ); + + RFile input; + User::LeaveIfError(input.Open( fs, aFile, EFileRead )); + CleanupClosePushL( input ); + + RFileWriteStream output; + output.Replace( fs, aOutput, EFileWrite ); + CleanupClosePushL( output ); + + c->InitializeMessageParserL( output ); + + while( error ) + { + inRead.Set( const_cast(d->Ptr()),0,KBufferSize); + error = input.Read( inRead ); + + if( error ) + { + c->FinalizeMessageParserL(); + + User::Leave( error ); + } + else + { + error = inRead.Length(); + } + + if( error ) + { + c->ProcessMessageDataL(inRead); + } + } + + c->FinalizeMessageParserL(); + + + CleanupStack::PopAndDestroy( 5 ); // fs, c, d, input, output + UpdateDCFRepositoryL( aOutput ); + __UHEAP_MARKEND; + } + +void EncryptFileL(const TDesC& aFile, TDesC& aOutput, TInt aMultiplier) + { + COma1DcfCreator* c = NULL; + CDRMRights* rights = NULL; + TBuf8<64> mime; + RFs fs; + TFileName aDcfFile; + TInt aOriginalFileNameLength(aOutput.Length() - 4); + + User::LeaveIfError(fs.Connect()); + if (aFile.Right(3).CompareF(_L("amr")) == 0) //AMR + { + mime.Copy(_L8("audio/amr")); + } + else if (aFile.Right(3).CompareF(_L("awb")) == 0) //AMR-AWB + { + mime.Copy(_L8("audio/amr-wb")); + } + else if (aFile.Right(3).CompareF(_L("mp3")) == 0) //MP3 + { + mime.Copy(_L8("audio/mpeg")); + } + else if (aFile.Right(3).CompareF(_L("mp4")) == 0) //MP4 + { + mime.Copy(_L8("audio/mp4")); + } + else if (aFile.Right(3).CompareF(_L("m4a")) == 0) //M4A + { + mime.Copy(_L8("audio/mp4")); + } + else if (aFile.Right(3).CompareF(_L("3gp")) == 0) //3GPP + { + mime.Copy(_L8("audio/3gpp")); + } + else if (aFile.Right(3).CompareF(_L("3g2")) == 0) //3GPP2 + { + mime.Copy(_L8("audio/3gpp2")); + } + else if (aFile.Right(3).CompareF(_L("aac")) == 0) //AAC + { + mime.Copy(_L8("audio/aac")); + } + else if (aFile.Right(3).CompareF(_L("mid")) == 0) //MIDI + { + mime.Copy(_L8("audio/midi")); + } + else if (aFile.Right(5).CompareF(_L(".spmid")) == 0) //SP-MIDI + { + mime.Copy(_L8("audio/sp-midi")); + } + else if (aFile.Right(3).CompareF(_L("rmf")) == 0) //RMF + { + mime.Copy(_L8("audio/rmf")); + } + else if (aFile.Right(4).CompareF(_L("mxmf")) == 0) //Mobile-XMF + { + mime.Copy(_L8("audio/mobile-xmf")); + } + else if (aFile.Right(3).CompareF(_L("wav")) == 0) //WAV + { + mime.Copy(_L8("audio/x-wav")); + } + else if (aFile.Right(3).CompareF(_L("gif")) == 0) // GIF + { + mime.Copy(_L8("image/gif")); + } + else if (aFile.Right(3).CompareF(_L("jpg")) == 0) // JPEG + { + mime.Copy(_L8("image/jpeg")); + } + else if (aFile.Right(3).CompareF(_L("txt")) == 0) // text + { + mime.Copy(_L8("text/plain")); + } + else if (aFile.Right(3).CompareF(_L("pip")) == 0) // PIP + { + mime.Copy(_L8("application/x-pip")); + } + + aDcfFile.Append(aOutput); + + for(TInt i = 0; i < aMultiplier ; ++i) + { + aDcfFile.Delete(aOriginalFileNameLength, aDcfFile.Length()); + aDcfFile.Append(_L("-")); + aDcfFile.AppendNum(i); + aDcfFile.Append(_L(".dcf")); + c = COma1DcfCreator::NewL(); + CleanupStack::PushL(c); + fs.Delete(aOutput); + c->EncryptFileL(aFile, aDcfFile, mime, rights); + UpdateDCFRepositoryL( aDcfFile ); + delete rights; + CleanupStack::PopAndDestroy(); // c + } + fs.Close(); + + } + +void DRMEncryptor::startEncrypt() + { + TUint result = 0; + TUint aEncryptedCount = 0; + TUint aRightsCount = 0; + TUint aMessagesProcessed = 0; + TBuf<128> buffer; + + result = EncryptL(aEncryptedCount, aRightsCount, aMessagesProcessed); + + buffer.Append(_L("Encryption done\n")); + if(result < 1) + { + buffer.Append(_L("No files found")); + } + if(aMessagesProcessed != 0) + { + buffer.AppendNum(aMessagesProcessed); + buffer.Append(_L(" messages processed\n")); + } + if(aRightsCount != 0) + { + buffer.AppendNum(aRightsCount); + buffer.Append(_L(" rights objects processed\n")); + } + if(aMessagesProcessed != 0) + { + buffer.AppendNum(aEncryptedCount); + buffer.Append(_L(" files encrypted\n")); + } + + QGridLayout *layout = new QGridLayout; + layout->setAlignment(Qt::AlignCenter); + setLayout(layout); + + QString encryptString((QChar*)buffer.Ptr(),buffer.Length()); + QMessageBox *encrpytMessage = new QMessageBox(this); + encrpytMessage->setWindowTitle(tr("Encrypt")); + encrpytMessage->setText(encryptString); + + layout->addWidget(encrpytMessage); + encrpytMessage->show(); + + } + +TUint DRMEncryptor::EncryptL(TUint& aEncryptedCount, TUint& aRightsCount, TUint& aMessagesProcessed) + { + TInt i; + CDir* files; + TFileName input; + TFileName output; + TUint inputNameSize = 0; + TUint outputNameSize = 0; + RFs fs; + User::LeaveIfError(fs.Connect()); + TInt aMultiplier(1); + + +#ifdef __WINS__ + input.Append(_L("c:\\data\\DRM\\")); + output.Append(_L("c:\\data\\Others\\")); +#else +#ifndef RD_MULTIPLE_DRIVE + + input.Append(_L("e:\\DRM\\")); + output.Append(_L("e:\\Others\\")); + +#else //RD_MULTIPLE_DRIVE + + TInt driveNumber( -1 ); + TChar driveLetter; + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber ); + fs.DriveToChar( driveNumber, driveLetter ); + + _LIT( KdrmDir, "%c:\\DRM\\" ); + input.Format( KdrmDir, (TUint)driveLetter ); + + _LIT( KothersDir, "%c:\\Others\\" ); + output.Format( KothersDir, (TUint)driveLetter ); + +#endif +#endif + + inputNameSize = input.Length(); + outputNameSize = output.Length(); + + + fs.MkDir(input); + fs.MkDir(output); + + fs.GetDir(input, KEntryAttNormal, ESortNone, files); + for (i = 0; i < files->Count(); i++) + { + input.Append((*files)[i].iName); + + output.Append((*files)[i].iName); + + if (input.Right(2).CompareF(_L("dm")) == 0) + { + + for(TInt ii = 0; ii < aMultiplier ; ++ii) + { + output.Delete(outputNameSize +(*files)[i].iName.Length() , output.Length()-1); + output.Append(_L("-")); + output.AppendNum(ii); + output.Append(_L(".dcf")); + ProcessMessageL(input, output); + ++aMessagesProcessed; + } + } + else if (input.Right(3).CompareF(_L("oro")) == 0 || + input.Right(3).CompareF(_L("drc")) == 0 || + input.Right(2).CompareF(_L("ro")) == 0 || + input.Right(2).CompareF(_L("dr")) == 0 ) + { + for (TInt iii = 0; iii < aMultiplier; ++iii) + { + ProcessRightsL(input); + ++aRightsCount; + } + } + else if (input.Right(3).CompareF(_L("dcf")) != 0) + { + output.Append(_L(".dcf")); + EncryptFileL(input, output, aMultiplier); + ++aEncryptedCount; + } + + //restore paths + input.Delete(inputNameSize, input.Length()-1); + output.Delete(outputNameSize, output.Length()-1); + } + + fs.Close(); + + TRequestStatus status; + CDcfRep* rep = CDcfRep::NewL(); + CleanupStack::PushL(rep); + rep->RefreshDcf(status); + User::WaitForRequest( status ); + CleanupStack::PopAndDestroy( rep ); + + delete files; + + return (aEncryptedCount*aMultiplier + aRightsCount + aMessagesProcessed); + + } + +ContentAccess::CManager* GetCafDataL( TAgent& aAgent ) + { + TPtr8 ptr(NULL, 0, 0); + RArray agents; + TRequestStatus status; + TInt i; + + CleanupClosePushL( agents ); + CManager* manager = CManager::NewLC(); + + manager->ListAgentsL( agents ); + + for (i = 0; i < agents.Count(); i++) + { + if (agents[i].Name().Compare(KWmDrmAgentName) == 0) + { + aAgent = agents[i]; + break; + } + } + CleanupStack::Pop( manager ); + CleanupStack::PopAndDestroy(); // agents + return manager; + } + +void DRMEncryptor::DeleteWmDrmRdbL() + { + // get the data part + ContentAccess::CManager* manager = NULL; + ContentAccess::TAgent agent; + TPtr8 ptr(NULL, 0, 0); + TPtrC8 ptr2; + + // Find the caf agent and create manager + manager = GetCafDataL( agent ); + CleanupStack::PushL( manager ); + + User::LeaveIfError( + manager->AgentSpecificCommand( agent, + (TInt)DRM::EWmDrmDeleteRights, + ptr2, + ptr) ); + CleanupStack::PopAndDestroy( manager ); + } + +void DRMEncryptor::deleteWmDrmDB() + { + TRAPD(err, DeleteWmDrmRdbL()); + if(!err) + { + QMessageBox::information(this, tr("WMDRM DB"),tr("DRM rights deleted.")); + } + else + { + QMessageBox::information(this, tr("WMDRM DB"),tr("Error deleting WMDRM rights.")); + } + } + +void DRMEncryptor::launchBrowser() + { + /*_LIT( KTestDrmFile, "c:\\data\\others\\sd_water003.dcf" ); + TInt urlLength = 256; + TFileName fileName(KTestDrmFile); + RFile file; + RFs fs; + + User::LeaveIfError(fs.Connect()); + TInt result = 0; + + result = file.Open(fs, fileName, EFileRead | EFileShareReadersOrWriters); + + CData* content = CData::NewLC( file, KDefaultContentObject, EPeek ); + + HBufC* rightsIssuerBuf = HBufC::NewLC( urlLength ); // Content issuer max URL length + TPtr rightsIssuer(const_cast(rightsIssuerBuf->Ptr()), 0, urlLength); + + // Get value of rights-issuer header field + TInt error = content->GetStringAttribute( ERightsIssuerUrl, rightsIssuer ); + rightsIssuer.TrimAll(); + + rightsIssuer.Insert(0, _L("http://")); + + HBufC* finalUrl = rightsIssuer.AllocLC(); + + DRM::CDrmBrowserLauncher::LaunchUrlL(*finalUrl); + + CleanupStack::PopAndDestroy(3); // finalUrl, rightsIssuerBuf, content;*/ + } + +/* +void DRMEncryptorsetDRMClock() +{ + + double value1 = ui->lineEdit->text().toDouble(&bOK1); + double value2 = ui->lineEdit_2->text().toDouble(&bOK2); + + ui->lineEdit_3->setText(""); + + if(bOK1 && bOK2) + { + if(value2 != 0) + { + double result = value1 / value2; + ui->lineEdit_3->setText(QString::number(result)); + } + else + { + box.setText("Et voi jakaa nollalla"); + box.exec(); + } + } + else + { + box.setText("Virheellinen syöte"); + box.exec(); + } +} + + void DRMEncryptoronDateTimeChanged(const QDateTime & datetime ) + { + + } +*/ + +void DRMEncryptor::onTextChanged(const QString &) +{ + //ui->pushButton->setEnabled(ui->lineEdit->text() != "" && ui->lineEdit_2->text() != ""); +} + +DateTimeDialog::DateTimeDialog() + { + //iLayout = new QHBoxLayout; + QGridLayout *layout = new QGridLayout; + layout->setAlignment(Qt::AlignCenter); + setLayout(layout); + + iDateEdit = new QDateTimeEdit(QDate::currentDate()); + iDateEdit->setAlignment(Qt::AlignHCenter); + iDateEdit->setDisplayFormat("yyyy.mm.dd hh.mm.ss"); + iDateEdit->setWindowTitle("Set DRM Clock yyyy.MM.dd hh.mm.ss"); + QPushButton *okButton = new QPushButton("OK", this); + QPushButton *cancelButton = new QPushButton("Cancel", this); + + layout->addWidget(iDateEdit); + layout->addWidget(okButton); + layout->addWidget(cancelButton); + + connect(okButton, SIGNAL(clicked()), this, SLOT(setDRMClock())); + connect(cancelButton, SIGNAL(clicked()), this, SLOT(close())); + + //this->setLayout(iLayout); + okButton->show(); + cancelButton->show(); + this->show(); + } + +DateTimeDialog::~DateTimeDialog() + { + + } + +void DateTimeDialog::setDRMClock() + { + DRM::CDrmServiceApi* service = NULL; + TBuf<5> buf; + TRAPD(err, service = DRM::CDrmServiceApi::NewL()); + if(err!=KErrNone) + { + QMessageBox::information(this, tr("DRM Clock"),tr("Error creating CDrmServiceApi.")); + buf.AppendNum(err); + QString string((QChar*)buf.Ptr(),buf.Length()); + QMessageBox::information(this, tr("DRM Clock"),string); + delete service; // service + return; + } + + QString datetimeString = iDateEdit->dateTime().toString("yyyy.mm.dd hh.mm.ss"); + + // datetime in format YYYYMMDD:HHMMSS for TTime + datetimeString.remove(QChar('.')); + datetimeString.replace(" ", ":"); + datetimeString.append(".000000"); + + TPtrC datetimePtr(reinterpret_cast(datetimeString.constData())); + HBufC *datetimeBuf = NULL; + TBuf<5> errorBuf; + TRAPD(errorCode, datetimeBuf = datetimePtr.AllocL()); + if(errorCode!=KErrNone) + { + QMessageBox::information(this, tr("DRM Clock"),tr("Error in datetimePtr.AllocL.")); + errorBuf.AppendNum(errorCode); + QString string((QChar*)buf.Ptr(),buf.Length()); + QMessageBox::information(this, tr("DRM Clock"),string); + delete service; + delete datetimeBuf; + return; + } + + + TTime inputTime(*datetimeBuf); + TInt timezone = 0; + delete datetimeBuf; + + // Get secure time from service api to get timezone + DRMClock::ESecurityLevel level; + TInt error( KErrNone ); + + TTime currentTime; + error = service->GetSecureTime(currentTime, timezone, level); + + if(error != KErrNone) + { + return; + } + + error = service->UpdateSecureTime(inputTime, timezone); + + if(error != KErrNone) + { + return; + } + + delete service; + + QMessageBox::information(this, tr("DRM Clock"),tr("DRM Clock Set")); + } + diff -r abec8b1bb37c -r 442486f870da commondrm/drmqtencryptor/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmqtencryptor/main.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2003-2009 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: DRM Encryption tool. +* +*/ + +#include +#include "drmencryptor.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + DRMEncryptor w; + w.showMaximized(); + return a.exec(); +} diff -r abec8b1bb37c -r 442486f870da commondrm/drmqtencryptor/qt_drmencryptor.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmqtencryptor/qt_drmencryptor.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,33 @@ +# +# Copyright (c) 2003-2009 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: DRM Encryption tool project file. +# +# + +TEMPLATE = app +TARGET = drmencryptor +DEPENDPATH += . +INCLUDEPATH += . +INCLUDEPATH += ../../inc + +symbian: +{ +TARGET.CAPABILITY += DRM +} + +# Input +HEADERS += drmencryptor.h +FORMS += drmencryptor.ui +SOURCES += drmencyptor.cpp main.cpp +LIBS += -lplatformenv -ldrmserviceapi -ldcfrep -ldrmparsers -lfbscli -lcone -lestor -lcaf -lefsrv diff -r abec8b1bb37c -r 442486f870da commondrm/drmrightsmanagerui/data/DRMRightsManager.rss --- a/commondrm/drmrightsmanagerui/data/DRMRightsManager.rss Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmrightsmanagerui/data/DRMRightsManager.rss Thu Jul 22 16:35:50 2010 +0100 @@ -74,7 +74,7 @@ caption_and_icon = CAPTION_AND_ICON_INFO { - caption = qtn_drm_mgr; + caption = " "; #ifdef __SCALABLE_ICONS number_of_icons = 1; diff -r abec8b1bb37c -r 442486f870da commondrm/drmrightsmanagerui/group/DRMRightsManager.mmp --- a/commondrm/drmrightsmanagerui/group/DRMRightsManager.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmrightsmanagerui/group/DRMRightsManager.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -59,7 +59,6 @@ LIBRARY aknskins.lib commonui.lib servicehandler.lib LIBRARY dcfrep.lib caf.lib cafutils.lib LIBRARY ecom.lib -LIBRARY commondialogs.lib LIBRARY directorylocalizer.lib LIBRARY drmparsers.lib diff -r abec8b1bb37c -r 442486f870da commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h --- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h Thu Jul 22 16:35:50 2010 +0100 @@ -25,9 +25,9 @@ #include #include #include -#include +#include -#include "drmclockclient.h" +#include "DRMClockClient.h" #include "DrmViewItems.h" #include "DRMRightsManager.hrh" diff -r abec8b1bb37c -r 442486f870da commondrm/drmrightsmanagerui/loc/DRMRightsManager.loc --- a/commondrm/drmrightsmanagerui/loc/DRMRightsManager.loc Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmrightsmanagerui/loc/DRMRightsManager.loc Thu Jul 22 16:35:50 2010 +0100 @@ -1260,4 +1260,4 @@ //w: //r:9.1 // -#define qtn_drm_mgr_det_ex_unlimited "Unlimited" \ No newline at end of file +#define qtn_drm_mgr_det_ex_unlimited "Unlimited" diff -r abec8b1bb37c -r 442486f870da commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -33,6 +33,8 @@ #include // for resource reader #include #include +#include + #include @@ -241,7 +243,8 @@ // void CDRMRightsMgrAppUi::HandleCommandL( TInt aCommand ) { - + CEikAppServer* server = iEikonEnv->AppServer(); + switch ( aCommand ) { case EEikCmdExit: @@ -250,6 +253,17 @@ Exit(); break; } + case EAknSoftkeyClose: + { + + if (server) + { + server->NotifyServerExit(EAknSoftkeyClose); + } + + Exit(); + break; + } default: break; } @@ -1082,7 +1096,7 @@ if ( i == 0 ) { // No need to check if the parent UID is a duplicate - parentUidList.Append( permissionList[i]->iParentUID ); + parentUidList.AppendL ( permissionList[i]->iParentUID ); } else { @@ -1118,7 +1132,7 @@ for ( k = 0; k < permissionTempList.Count(); k++ ) { // Store the pointer to the main list of permissions - permissionList.Append( permissionTempList[k] ); + permissionList.AppendL ( permissionTempList[k] ); } // Close the temporary pointer array so that the referenced diff -r abec8b1bb37c -r 442486f870da commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -184,7 +184,7 @@ if ( aCommand == EAknSoftkeyOk ) { - appUi.HandleCommandL( EEikCmdExit ); // Ok softkey was pressed + appUi.HandleCommandL( EAknSoftkeyClose ); // Ok softkey was pressed } else { diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuidialogs/bwinscw/drmuidialogsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuidialogs/bwinscw/drmuidialogsu.def Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + ?NewL@CDrmUIDialogs@@SAPAV1@XZ @ 1 NONAME ; class CDrmUIDialogs * CDrmUIDialogs::NewL(void) + ?ShowNoteL@CDrmUIDialogs@@QAEHHABVTDesC16@@H@Z @ 2 NONAME ; int CDrmUIDialogs::ShowNoteL(int, class TDesC16 const &, int) + ?NewLC@CDrmUIDialogs@@SAPAV1@XZ @ 3 NONAME ; class CDrmUIDialogs * CDrmUIDialogs::NewLC(void) + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuidialogs/eabi/drmuidialogsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuidialogs/eabi/drmuidialogsu.def Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + _ZN13CDrmUIDialogs4NewLEv @ 1 NONAME + _ZN13CDrmUIDialogs5NewLCEv @ 2 NONAME + _ZN13CDrmUIDialogs9ShowNoteLEiRK7TDesC16i @ 3 NONAME + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuidialogs/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuidialogs/group/bld.inf Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 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: Build information for DRM UI dialogs +* +* +*/ + +#include + +PRJ_PLATFORMS +default + +PRJ_EXPORTS +//drmuidialogs iby files +../rom/drmuidialogs.iby CORE_MW_LAYER_IBY_EXPORT_PATH(drmuidialogs.iby) + +PRJ_MMPFILES +../group/drmuidialogs.mmp diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuidialogs/group/drmuidialogs.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuidialogs/group/drmuidialogs.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2010 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: Project definition file for DRM UI dialogs +* +*/ + +#include +#include + + +TARGET drmuidialogs.dll +TARGETTYPE dll +UID 0x1000008D 0x20026836 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +USERINCLUDE ../inc +USERINCLUDE ../../../../inc // ADo level inc dir + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +#ifdef __DRM +SOURCE ../src/drmuidialogs.cpp +#endif + +LIBRARY euser.lib +LIBRARY sysutil.lib +LIBRARY HbCore.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined( WINSCW ) +deffile ../bwinscw/ +#endif + +// end of file \ No newline at end of file diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuidialogs/inc/drmuidialogs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuidialogs/inc/drmuidialogs.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2010 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: CDrmUIDialogs API can be used to show UI dialogs via +* notification dialog plugin. +*/ + + +#ifndef C_DRMUIDIALOGS_H +#define C_DRMUIDIALOGS_H + +#include // CActive +#include // MHbDeviceDialogObserver + +class CHbSymbianVariantMap; +class CActiveSchedulerWait; + +/** + * CDrmUIDialogs manages and controls DRM UI notes and queries. + * An Orbit device dialog plugin implements the UI dialogs. + * + * @dll drmuidialogs.dll + * @since 10.1 + */ +NONSHARABLE_CLASS( CDrmUIDialogs ) : public CActive, + public MHbDeviceDialogObserver + { + public: // constructor and destructor + /** + * Creates new CDrmUIDialogs object and pushes it into cleanup stack. + * @returns CDrmUIDialogs* -- new CDrmUIDialogs object + */ + IMPORT_C static CDrmUIDialogs* NewLC(); + + /** + * Creates new CDrmUIDialogs object. + * @returns CDrmUIDialogs* -- new CDrmUIDialogs object + */ + IMPORT_C static CDrmUIDialogs* NewL(); + + /** + * Destructor. + */ + CDrmUIDialogs::~CDrmUIDialogs(); + + public: + /** + * Displays a note or query dialog synchronously. Synchronous function. + * Returns after the user has accepted or cancelled the query. + * @param aDialogId dialog id of dialog to be displayed + * @param aString string that replaces %U in resource string + * @param aValue integer that replaces %N in resource string + * @return EOk if user accepted the query, ECancelled otherwise + */ + IMPORT_C TInt ShowNoteL( TInt aDialogId, + const TDesC& aString = KNullDesC, + TInt aValue = -1 ); + + protected: // from CActive + void DoCancel(); + void RunL(); + + private: // from MHbDeviceDialogObserver + void DataReceived( CHbSymbianVariantMap& aData ); + void DeviceDialogClosed( TInt aCompletionCode ); + + private: + CDrmUIDialogs(); + void ConstructL(); + void ClearParamsL(); + void ClearParamsAndSetDialogIdL( TInt aDialogId ); + void AddParamL( const TDesC& aKey, TInt aValue ); + void AddParamL( const TDesC& aKey, const TDesC& aValue ); + void DisplayDeviceDialogL(); + TInt WaitUntilDeviceDialogClosed(); + + private: // data + CHbDeviceDialogSymbian* iDeviceDialog; // own + CHbSymbianVariantMap* iVariantMap; // own + CActiveSchedulerWait* iWait; // own + TBool iIsDisplayingDialog; + TInt iCompletionCode; + TInt iReturnValue; + }; + +#endif // C_DRMUIDIALOGS_H diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuidialogs/rom/drmuidialogs.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuidialogs/rom/drmuidialogs.iby Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2010 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: +* +*/ + +#ifndef __DRMUIDIALOGS_IBY__ +#define __DRMUIDIALOGS_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\drmuidialogs.dll SHARED_LIB_DIR\drmuidialogs.dll + +#endif//__DRMUIDIALOGS_IBY__ diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuidialogs/src/drmuidialogs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuidialogs/src/drmuidialogs.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,255 @@ +/* +* Copyright (c) 2010 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 CDrmUIDialogs class. +* +*/ + +#include "drmuidialogs.h" // CDrmUIDialogs +#include // CHbSymbianVariantMap + +// Identifier of DRM UI device notification dialog plugin +_LIT( KDrmUIDeviceDialogPlugin, "com.nokia.hb.drmuidialog/1.0" ); + +// Keys for the parameters passed to notification dialog plugin +_LIT( KDrmUIDialogId, "dialogId" ); +_LIT( KDrmUIInsertText, "insertText" ); +_LIT( KDrmUIInsertInt, "insertInt" ); + +// Keys name for result sent from notification dialog plugin +_LIT( KDrmUIDialogResult, "result"); + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CDrmUIDialogs* CDrmUIDialogs::NewLC() + { + CDrmUIDialogs* self = new( ELeave ) CDrmUIDialogs(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CDrmUIDialogs* CDrmUIDialogs::NewL() + { + CDrmUIDialogs* self = CDrmUIDialogs::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::~CDrmUIDialogs() +// --------------------------------------------------------------------------- +// +CDrmUIDialogs::~CDrmUIDialogs() + { + Cancel(); + delete iWait; + delete iDeviceDialog; + delete iVariantMap; + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::ShowNoteL() +// --------------------------------------------------------------------------- +EXPORT_C TInt CDrmUIDialogs::ShowNoteL( TInt aDialogId, const TDesC& aString, TInt aValue ) + { + // Add the dialog id to the variant map + AddParamL( KDrmUIDialogId, aDialogId ); + + // Add the string to the variant map if it exists + if ( aString.Compare( KNullDesC ) ) + { + AddParamL( KDrmUIInsertText, aString ); + } + + // Add the int to the variant map + if ( aValue >= 0 ) + { + AddParamL( KDrmUIInsertInt, aValue ); + } + + DisplayDeviceDialogL(); + + TInt error = WaitUntilDeviceDialogClosed(); + User::LeaveIfError( error ); + + return iReturnValue; + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::DoCancel() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::DoCancel() + { + if( iWait && iWait->IsStarted() && iWait->CanStopNow() ) + { + iCompletionCode = KErrCancel; + iWait->AsyncStop(); + } + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::RunL() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::RunL() + { + if( iWait ) + { + iWait->AsyncStop(); + } + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::DataReceived() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::DataReceived( CHbSymbianVariantMap& aData ) + { + const CHbSymbianVariant* resultVariant = aData.Get( KDrmUIDialogResult ); + + if( resultVariant ) + { + TInt* result = resultVariant->Value(); + + if( result ) + { + iReturnValue = *result; + } + } + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::DeviceDialogClosed() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::DeviceDialogClosed( TInt aCompletionCode ) + { + iCompletionCode = aCompletionCode; + iIsDisplayingDialog = EFalse; + + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, KErrNone ); + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::CDrmUIDialogs() +// --------------------------------------------------------------------------- +// +CDrmUIDialogs::CDrmUIDialogs() : CActive( CActive::EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::ConstructL() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::ConstructL() + { + iReturnValue = KErrNone; + iWait = new( ELeave ) CActiveSchedulerWait; + iDeviceDialog = CHbDeviceDialogSymbian::NewL(); + iVariantMap = CHbSymbianVariantMap::NewL(); + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::ClearParamsL() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::ClearParamsL() + { + if( iVariantMap ) + { + delete iVariantMap; + iVariantMap = NULL; + } + iVariantMap = CHbSymbianVariantMap::NewL(); + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::ClearParamsAndSetDialogIdL() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::ClearParamsAndSetDialogIdL( TInt aDialogId ) + { + ClearParamsL(); + AddParamL( KDrmUIDialogId, aDialogId ); + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::AddParamL() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::AddParamL( const TDesC& aKey, TInt aValue ) + { + CHbSymbianVariant* variant = NULL; + variant = CHbSymbianVariant::NewL( &aValue, CHbSymbianVariant::EInt ); + iVariantMap->Add( aKey, variant ); // Takes ownership of variant + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::AddParamL() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::AddParamL( const TDesC& aKey, const TDesC& aValue ) + { + CHbSymbianVariant* variant = NULL; + variant = CHbSymbianVariant::NewL( &aValue, CHbSymbianVariant::EDes ); + iVariantMap->Add( aKey, variant ); // Takes ownership of variant + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::DisplayDeviceDialogL() +// --------------------------------------------------------------------------- +// +void CDrmUIDialogs::DisplayDeviceDialogL() + { + if( iIsDisplayingDialog ) + { + iDeviceDialog->Update( *iVariantMap ); + } + else + { + iDeviceDialog->Show( KDrmUIDeviceDialogPlugin, *iVariantMap, this ); + iIsDisplayingDialog = ETrue; + } + } + +// --------------------------------------------------------------------------- +// CDrmUIDialogs::WaitUntilDeviceDialogClosed() +// --------------------------------------------------------------------------- +// +TInt CDrmUIDialogs::WaitUntilDeviceDialogClosed() + { + iCompletionCode = KErrInUse; + + if( !IsActive() && iWait && !iWait->IsStarted() ) + { + iStatus = KRequestPending; + SetActive(); + iWait->Start(); + } + return iCompletionCode; + } diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/DRMUINotifications.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/DRMUINotifications.rss Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,21 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-05-24T18:48:20 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#include +#include + +RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info + { + short_caption = STRING_r_short_caption; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = STRING_r_caption; + number_of_icons = 0; + icon_file = ""; + }; + } + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/drmuinotifications.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/drmuinotifications.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,41 @@ +TEMPLATE = lib +TARGET = drmuinotifications +CONFIG += hb \ + plugin +INCLUDEPATH += . \ + ../../../inc +DEPENDPATH += . +DESTDIR = $${HB_BUILD_DIR}/plugins/devicedialogs +MOC_DIR = moc +OBJECTS_DIR = obj + +# dependencies +HEADERS += inc/drmuidialogsbuilder.h \ + inc/drmuidialogpluginkeys.h \ + inc/drmuidialogplugin.h +SOURCES += src/drmuidialogsbuilder.cpp \ + src/drmuidialogplugin.cpp \ + DRMUINotifications_reg.rss +FORMS += +symbian:TARGET.UID3 = 0x20026835 +RESOURCES += resource/drmuinotifications.qrc +symbian: { + SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.UID3 = 20026835 + hblib.sources = Hb.dll + hblib.path = \sys\bin + hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}" + pluginstub.sources = drmuinotifications.dll + pluginstub.path = /resource/plugins/devicedialogs + DEPLOYMENT += pluginstub +} +!local { + target.path = $${HB_PLUGINS_DIR}/devicedialogs + INSTALLS += target +} +BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ + "rom/drmuinotifications.iby CORE_MW_LAYER_IBY_EXPORT_PATH(drmuinotifications.iby)" \ + "qmakepluginstubs/drmuinotifications.qtplugin /epoc32/data/z/pluginstub/drmuinotifications.qtplugin" diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/inc/drmuidialogplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/inc/drmuidialogplugin.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2010 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: Plugin error constants + * + */ + +#ifndef DRMUIDIALOGPLUGIN_H +#define DRMUIDIALOGPLUGIN_H + +#include +#include + +#include + + +class DrmUIDialogPlugin : public HbDeviceDialogPlugin + + { +Q_OBJECT + +public: + + DrmUIDialogPlugin(); + ~DrmUIDialogPlugin(); + + // from base HbDeviceDialogPluginInterface + virtual HbDeviceDialogInterface *createDeviceDialog( + const QString &deviceDialogType, const QVariantMap ¶meters); + + // from base HbDeviceDialogPlugin + virtual bool + accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, + const QVariantMap &securityInfo) const; + virtual bool deviceDialogInfo(const QString &deviceDialogType, + const QVariantMap ¶meters, DeviceDialogInfo *info) const; + virtual QStringList deviceDialogTypes() const; + virtual PluginFlags pluginFlags() const; + virtual int error() const; + +private: + Q_DISABLE_COPY(DrmUIDialogPlugin) + + }; + +#endif diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/inc/drmuidialogpluginkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/inc/drmuidialogpluginkeys.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2010 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: DrmUi notification keys. +* +*/ + +#ifndef DRMUIPLUGINKEYS_H +#define DRMUIPLUGINKEYS_H + +#include + + +// Keys for the parameters passed to notification framework plugin +const QString KDrmUIDialogId("dialogId"); +const QString KDrmUIInsertText("insertText"); +const QString KDrmUIInsertInt("insertInt"); +// Keys name for result sent from notification dialog plugin +const QString KDrmUIDialogResult("result"); + + +#endif // DRMUIPLUGINKEYS_H diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/inc/drmuidialogsbuilder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/inc/drmuidialogsbuilder.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2010 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: + * + */ + +#ifndef DRUMUIDIALOGSBUILDER_H +#define DRUMUIDIALOGSBUILDER_H + +#include +#include +#include + +class HbDocumentLoader; +class HbDialog; + +class DrmUiDialogsBuilder : public QObject, public HbDeviceDialogInterface + { +Q_OBJECT +public: + DrmUiDialogsBuilder(const QVariantMap ¶meters); + ~DrmUiDialogsBuilder(); + +public: + // from HbDeviceDialogInterface + virtual bool setDeviceDialogParameters(const QVariantMap ¶meters); + virtual int deviceDialogError() const; + virtual void closeDeviceDialog(bool byClient); + virtual HbPopup *deviceDialogWidget() const; + virtual QObject *signalSender() const; + + +public slots: + void cancelDialog(); + void confirmDialog(); + +private: + bool constructDialog(const QVariantMap ¶meters); + +signals: + // signlas needed by HbDeviceDialogInterface + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + +private: + HbDocumentLoader *mLoader; + HbDialog * mDialog; + + Q_DISABLE_COPY(DrmUiDialogsBuilder) + }; + +#endif /* DRUMUIDIALOGSBUILDER_H */ diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/Registeringprog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/Registeringprog.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/accountupdatequery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/accountupdatequery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/acquiringlicenceprog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/acquiringlicenceprog.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/copyobjectsquery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/copyobjectsquery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/deletedrmfilequery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/deletedrmfilequery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/deregisteredconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/deregisteredconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/deregisteringprog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/deregisteringprog.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/drmuinotifications.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/drmuinotifications.qrc Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,154 @@ + + + + norightsobjectquery.docml + + + + rightsobjectexpiredquery.docml + + + + simnotallowedquery.docml + + + + waitingforrightsobjconf.docml + + + + copyobjectsquery.docml + + + + filedeletedconf.docml + + + + deletedrmfilequery.docml + + + + moveobjectsquery.docml + + + + nocountquery.docml + + + + nousagequery.docml + + + + objectlockedconf.docml + + + + unabletocopyconf.docml + + + + unabletomoveconf.docml + + + + unsupportedconf.docml + + + + noconnectiondefinednote.docml + + + + invalidornoapnote.docml + + + + openingfailpermnote.docml + + + + deregisteredconf.docml + + + + forwardprotectedconf.docml + + + + licenceexpiredconf.docml + + + + notrecognizedconf.docml + + + + registeredconf.docml + + + + registerfailureconf.docml + + + + unabletoderegisterconf.docml + + + + unabletosendconf.docml + + + + updatedconf.docml + + + + updatefailureconf.docml + + + + viewrestrictionconf.docml + + + + accountupdatequery.docml + + + + getnewlicencequery.docml + + + + retryforlicencequery.docml + + + + unabletosendquery.docml + + + + rightsobjectsrecievednote.docml + + + + waitingforlicenceconf.docml + + + + acquiringlicenceprog.docml + + + + deregisteringprog.docml + + + + Registeringprog.docml + + + + updatingprog.docml + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/filedeletedconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/filedeletedconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/forwardprotectedconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/forwardprotectedconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/getnewlicencequery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/getnewlicencequery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/infoexpiredornoronote.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/infoexpiredornoronote.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/invalidornoapnote.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/invalidornoapnote.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/licenceexpiredconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/licenceexpiredconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/moveobjectsquery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/moveobjectsquery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/noconnectiondefinednote.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/noconnectiondefinednote.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/nocountquery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/nocountquery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/norightsobjectquery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/norightsobjectquery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/notrecognizedconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/notrecognizedconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/nousagequery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/nousagequery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/objectlockedconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/objectlockedconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/openingfailpermnote.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/openingfailpermnote.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/registeredconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/registeredconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/registerfailureconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/registerfailureconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/retryforlicencequery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/retryforlicencequery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/rightsobjectexpiredquery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/rightsobjectexpiredquery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/rightsobjectsrecievednote.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/rightsobjectsrecievednote.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/simnotallowedquery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/simnotallowedquery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/unabletocopyconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/unabletocopyconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/unabletoderegisterconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/unabletoderegisterconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/unabletomoveconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/unabletomoveconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/unabletosendconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/unabletosendconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/unabletosendquery.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/unabletosendquery.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/unsupportedconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/unsupportedconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/updatedconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/updatedconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/updatefailureconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/updatefailureconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/updatingprog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/updatingprog.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/viewrestrictionconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/viewrestrictionconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/waitingforlicenceconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/waitingforlicenceconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/resource/waitingforrightsobjconf.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/resource/waitingforrightsobjconf.docml Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/rom/drmuinotifications.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/rom/drmuinotifications.iby Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2003-2010 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: Image description file for project +* +*/ + + +#ifndef DRMUINOTIFICATIONS_IBY +#define DRMUINOTIFICATIONS_IBY + +#include + +file=ABI_DIR/BUILD_DIR/drmuinotifications.dll SHARED_LIB_DIR/drmuinotifications.dll +data=/epoc32/data/z/pluginstub/drmuinotifications.qtplugin resource/plugins/devicedialogs/drmuinotifications.qtplugin + + +#endif // drmuinotifications_IBY \ No newline at end of file diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/src/drmuidialogplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/src/drmuidialogplugin.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2010 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: DrmUIDialogPlugin class implementation. + * + */ + +#include "DrmUIDialogPlugin.h" +#include +#include +#include "drmuidialogsbuilder.h" +#include "drmuidialogpluginkeys.h" + +Q_EXPORT_PLUGIN2(DrmUIDialogPlugin, DrmUIDialogPlugin) + +const int NmMaxDialogCount = 10; +static const QString drmUiDialog = "com.nokia.hb.drmuidialog/1.0"; + +/*! + DrmUIDialogPlugin Constructor + */ +DrmUIDialogPlugin::DrmUIDialogPlugin() + { + + } + +/*! + Destructor + */ +DrmUIDialogPlugin::~DrmUIDialogPlugin() + { + + } + +/*! + Check if client is allowed to use device dialog widget + */ +bool DrmUIDialogPlugin::accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, const QVariantMap &securityInfo) const + { + Q_UNUSED (deviceDialogType) + Q_UNUSED(parameters) + Q_UNUSED(securityInfo) + + // This plugin doesn't perform operations that may compromise security. + // All clients are allowed to use. + return true; + } + +/*! + From interface class. + Use the dialog type in the parameter to create widget. + */ +HbDeviceDialogInterface *DrmUIDialogPlugin::createDeviceDialog( + const QString &deviceDialogType, const QVariantMap ¶meters) + { + Q_UNUSED(deviceDialogType) + return new DrmUiDialogsBuilder(parameters); + } + +/*! + Return information of device dialog the plugin creates + Currently only supporting 1 device dialog type, so no need to check the type. + */ +bool DrmUIDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, + const QVariantMap ¶meters, DeviceDialogInfo *info) const + { + Q_UNUSED(parameters) + Q_UNUSED(deviceDialogType) + // set return values + info->group = GenericDeviceDialogGroup; + info->flags = NoDeviceDialogFlags; + info->priority = DefaultPriority; + return true; + } + +/*! + Return device dialog types this plugin implements + Function will work fine (unchanged) when new dialogs are added. + */ +QStringList DrmUIDialogPlugin::deviceDialogTypes() const + { + QStringList types; + types.append(drmUiDialog); + return types; + + } + +/*! + Return plugin flags + */ +HbDeviceDialogPlugin::PluginFlags DrmUIDialogPlugin::pluginFlags() const + { + return NoPluginFlags; + } + +/*! + Return last error + */ +int DrmUIDialogPlugin::error() const + { + return 0; + } + diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/drmuinotifications/src/drmuidialogsbuilder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/drmuinotifications/src/drmuidialogsbuilder.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,439 @@ +/* + * Copyright (c) 2010 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: + * + */ +#include "drmuidialogsbuilder.h" +#include +#include "drmuidialogpluginkeys.h" +#include +#include +#include +#include +#include +#include + +static const QString DOCML_NO_RIGHTS_OBJECT_DIALOG_QUERY = + ":/xml/norightsobjectquery.docml"; +static const QString DOCML_SIM_NOT_ALLOWED_QUERY = + ":/xml/simnotallowedquery.docml"; +static const QString DOCML_RIGHTS_OBJECT_EXPIRED_QUERY = + ":/xml/rightsobjectexpiredquery.docml"; +static const QString DOCML_WAITING_FOR_RIGHTS_OBJECT_CONF = + ":/xml/waitingforrightsobjconf.docml"; +static const QString DOCML_COPY_OBJECTS_QUERY = + ":/xml/copyobjectsquery.docml"; +static const QString DOCML_DELETED_CONF = ":/xml/filedeletedconf.docml"; +static const QString DOCML_DELETED_DRM_FILE_QUERY = + ":/xml/deletedrmfilequery.docml"; +static const QString DOCML_MOVE_OBJECTS_QUERY = + ":/xml/moveobjectsquery.docml"; +static const QString DOCML_NO_COUNT_QUERY = ":/xml/nocountquery.docml"; +static const QString DOCML_NO_USAGE_QUERY = ":/xml/nousagequery.docml"; +static const QString DOCML_OBJECT_LOCKED_CONF = + ":/xml/objectlockedconf.docml"; +static const QString DOCML_UNABLE_TO_COPY_CONF = + ":/xml/unabletocopyconf.docml"; +static const QString DOCML_UNABLE_TO_MOVE_CONF = + ":/xml/unabletomoveconf.docml"; +static const QString DOCML_UNSUPPORTED_CONF = ":/xml/unsupportedconf.docml"; +static const QString DOCML_DEREGISTERED_CONF = ":/xml/deregisteredconf.docml"; +static const QString DOCML_FILEDELETED_CONF = ":/xml/filedeletedconf.docml"; +static const QString DOCML_FORWARD_PROTECTED_CONF = + ":/xml/forwardprotectedconf.docml"; +static const QString DOCML_LICENCE_EXPIRED_CONF = + ":/xml/licenceexpiredconf.docml"; +static const QString DOCML_NOT_RECOGNIZED_CONF = + ":/xml/notrecognizedconf.docml"; +static const QString DOCML_REGISTERED_CONF = ":/xml/registeredconf.docml"; +static const QString DOCML_REGISTER_FAILURE_CONF = + ":/xml/registerfailureconf.docml"; +static const QString DOCML_UNABLE_TO_DEREGISTER_CONF = + ":/xml/unabletoderegisterconf.docml"; +static const QString DOCML_UNABLE_TO_SEND_CONF = + ":/xml/unabletosendconf.docml"; +static const QString DOCML_UPDATED_CONF = ":/xml/updatedconf.docml"; +static const QString DOCML_UPDATE_FAILURE_CONF = + ":/xml/updatefailureconf.docml"; +static const QString DOCML_VIEW_RESTRICTION_CONF = + ":/xml/viewrestrictionconf.docml"; +static const QString DOCML_ACCOUNT_UPDATE_QUERY = + ":/xml/accountupdatequery.docml"; +static const QString DOCML_GET_LICENCE_QUERY = + ":/xml/getnewlicencequery.docml"; +static const QString DOCML_RETRY_FOR_LICENCE_QUERY = + ":/xml/retryforlicencequery.docml"; +static const QString DOCML_UNABLE_TO_SEND_QUERY = + ":/xml/unabletosendquery.docml"; +static const QString DOCML_RIGHTS_OBJECTS_RECIEVED_NOTE = + ":/xml/rightsobjectsrecievednote.docml"; +static const QString DOCML_WAITING_FOR_LICENCE_CONF = + ":/xml/waitingforlicenceconf.docml"; +static const QString DOCML_ACQUIRING_LICENCE_PROG = + ":/xml/acquiringlicenceprog.docml"; +static const QString DOCML_REGISTERING_PROG = + ":/xml/Registeringprog.docml"; +static const QString DOCML_UPDATING_PROG = + ":/xml/updatingprog.docml"; +static const QString DOCML_DEREGISTERING_PROG = + ":/xml/deregisteringprog.docml"; + +// Notes have not been defined in the XLS document yet hence commented out +/* + static const QString DOCML_NO_CONNECTION_DEFINED = + ":/xml/noconnectiondefined.docml"; + static const QString DOCML_INVALID_OR_NO_AP = ":/xml/invalidornoap.docml"; + static const QString DOCML_OPENING_FAIL_PERM = ":/xml/openingfailperm.docml"; + */ + +/*! + class Constructor + */ +DrmUiDialogsBuilder::DrmUiDialogsBuilder(const QVariantMap ¶meters) : + QObject() + { + constructDialog(parameters); + } + +DrmUiDialogsBuilder::~DrmUiDialogsBuilder() + { + delete mLoader; + mLoader = NULL; + } + +/*! + Get error, implementation of interface + */ +int DrmUiDialogsBuilder::deviceDialogError() const + { + return 0; + } + +/*! + Set parameters, implementation of interface + Invoked when HbDeviceDialog::update calls. + */ +bool DrmUiDialogsBuilder::setDeviceDialogParameters( + const QVariantMap ¶meters) + { + constructDialog(parameters); + return true; + } + +/*! + Close notification, implementation of interface + */ +void DrmUiDialogsBuilder::closeDeviceDialog(bool byClient) + { + Q_UNUSED(byClient); + emit deviceDialogClosed(); + } +/*! + Return display widget, implementation of interface + */ +QObject *DrmUiDialogsBuilder::signalSender() const + { + return const_cast (this); + } + +/*! + Return display widget, implementation of interface + */ +HbPopup* DrmUiDialogsBuilder::deviceDialogWidget() const + { + return mDialog; + } + +/*! + Construct display widget + */ +bool DrmUiDialogsBuilder::constructDialog(const QVariantMap ¶meters) + { + if (mLoader == 0) + { + mLoader = new HbDocumentLoader(); + } + bool ok = false; + int mQueryType; + if (parameters.contains(KDrmUIDialogId)) + { + + mQueryType = parameters.value(KDrmUIDialogId).toInt(); + //switch cases to set load docml files for the parameters + switch (mQueryType) + { + case EQueryNoRightsObj: + mLoader->load(DOCML_NO_RIGHTS_OBJECT_DIALOG_QUERY, &ok); + break; + + case EQueryFileLockedForSim: + mLoader->load(DOCML_SIM_NOT_ALLOWED_QUERY, &ok); + break; + + case EQueryRightsObjExpired: + mLoader->load(DOCML_RIGHTS_OBJECT_EXPIRED_QUERY, &ok); + break; + + case EConfWaitingForLicence: + mLoader->load(DOCML_WAITING_FOR_LICENCE_CONF, &ok); + break; + + case EConfDeleted: + mLoader->load(DOCML_DELETED_CONF, &ok); + break; + + case EConfObjLocked: + mLoader->load(DOCML_OBJECT_LOCKED_CONF, &ok); + break; + + case EConfUnableToCopy: + mLoader->load(DOCML_UNABLE_TO_COPY_CONF, &ok); + break; + case EConfUnableToMove: + mLoader->load(DOCML_UNABLE_TO_MOVE_CONF, &ok); + break; + + case EConfUnsupportedObj: + mLoader->load(DOCML_UNSUPPORTED_CONF, &ok); + break; + + case EQueryCopyObjects: + mLoader->load(DOCML_COPY_OBJECTS_QUERY, &ok); + break; + + case EQueryDeleteDRMFile: + mLoader->load(DOCML_DELETED_DRM_FILE_QUERY, &ok); + break; + + case EQueryMoveObjects: + mLoader->load(DOCML_MOVE_OBJECTS_QUERY, &ok); + break; + + case EQueryNoCount: + mLoader->load(DOCML_NO_COUNT_QUERY, &ok); + break; + + case EQueryNoUsage: + mLoader->load(DOCML_NO_USAGE_QUERY, &ok); + break; + + case EQuerySendUnprotectedObjs: + mLoader->load(DOCML_UNABLE_TO_SEND_QUERY, &ok); + break; + + case EQueryAccountUpdate: + mLoader->load(DOCML_ACCOUNT_UPDATE_QUERY, &ok); + break; + + case EQueryRetryForLicence: + mLoader->load(DOCML_RETRY_FOR_LICENCE_QUERY, &ok); + break; + + case EQueryGetNewLicence: + mLoader->load(DOCML_GET_LICENCE_QUERY, &ok); + break; + + case EConfLicenceExpired: + mLoader->load(DOCML_LICENCE_EXPIRED_CONF, &ok); + break; + + case EConfForwardProtected: + mLoader->load(DOCML_FORWARD_PROTECTED_CONF, &ok); + break; + + case EConfUnableToSend: + mLoader->load(DOCML_UNABLE_TO_SEND_CONF, &ok); + break; + + case EConfViewRestriction: + mLoader->load(DOCML_VIEW_RESTRICTION_CONF, &ok); + break; + + case EConfUnableToDeregister: + mLoader->load(DOCML_UNABLE_TO_DEREGISTER_CONF, &ok); + break; + + case EConfPhoneDeregistered: + mLoader->load(DOCML_DEREGISTERED_CONF, &ok); + break; + + case EConfRegUpdateFailure: + mLoader->load(DOCML_UPDATE_FAILURE_CONF, &ok); + break; + + case EConfAccountNotRecognized: + mLoader->load(DOCML_NOT_RECOGNIZED_CONF, &ok); + break; + + case EConfPhoneRegistered: + mLoader->load(DOCML_REGISTERED_CONF, &ok); + break; + + case EConfRegistrationUpdated: + mLoader->load(DOCML_UPDATED_CONF, &ok); + break; + + case EConfRegistrationFailure: + mLoader->load(DOCML_REGISTER_FAILURE_CONF, &ok); + break; + + case ENoteRightsObjReceived: + mLoader->load(DOCML_RIGHTS_OBJECTS_RECIEVED_NOTE, &ok); + break; + + case EProgDeregisteringPhone: + mLoader->load(DOCML_DEREGISTERING_PROG, &ok); + break; + + case EProgAcquiringLicence: + mLoader->load(DOCML_ACQUIRING_LICENCE_PROG, &ok); + break; + + case EProgRegisteringPhone: + mLoader->load(DOCML_REGISTERING_PROG, &ok); + break; + case EProgUpdatingRegistration: + mLoader->load(DOCML_UPDATING_PROG, &ok); + break; + + //Notes are not defined in the locatization xls hence commented out + /*case ENoteNoConnectionDefined: + mLoader->load(DOCML_NO_CONNECTION_DEFINED, &ok); + break; + + case ENoteInvalidOrNoAP: + mLoader->load(DOCML_INVALID_OR_NO_AP, &ok); + break; + + case ENoteOpeningFailPerm: + mLoader->load(DOCML_OPENING_FAIL_PERM, &ok); + break;*/ + default: + break; + + } + if (ok) + { + QGraphicsWidget *widget = mLoader->findWidget(QString("dialog")); + mDialog = qobject_cast (widget); + switch (mQueryType) + { + //Cases for two push button dialogs + case EQueryNoRightsObj: + case EQueryFileLockedForSim: + case EQueryRightsObjExpired: + case EQueryCopyObjects: + case EQueryDeleteDRMFile: + case EQueryMoveObjects: + case EQueryNoCount: + case EQueryNoUsage: + case EQuerySendUnprotectedObjs: + case EQueryAccountUpdate: + case EQueryRetryForLicence: + case EQueryGetNewLicence: + connect(qobject_cast (mLoader->findObject( + "secondary")), SIGNAL( + triggered()), this, SLOT(cancelDialog())); + connect(qobject_cast (mLoader->findObject( + "primary")), SIGNAL( + triggered()), this, SLOT(confirmDialog())); + mDialog->setTimeout(HbPopup::NoTimeout); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + mDialog->setModal(true); + break; + + //Cases single push button dialogs + case EConfWaitingForLicence: + case EConfDeleted: + case EConfObjLocked: + case EConfUnableToCopy: + case EConfUnableToMove: + case EConfUnsupportedObj: + case EConfLicenceExpired: + case EConfForwardProtected: + case EConfUnableToSend: + case EConfViewRestriction: + case EConfUnableToDeregister: + case EConfPhoneDeregistered: + case EConfRegUpdateFailure: + case EConfAccountNotRecognized: + case EConfPhoneRegistered: + case EConfRegistrationUpdated: + case EConfRegistrationFailure: + connect(qobject_cast (mLoader->findObject( + "primary")), SIGNAL( + triggered()), this, SLOT(confirmDialog())); + mDialog->setTimeout(HbPopup::NoTimeout); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + mDialog->setModal(true); + break; + + // Cases for progress bar or wait notes + case EProgDeregisteringPhone: + case EProgAcquiringLicence: + case EProgRegisteringPhone: + case EProgUpdatingRegistration: + connect(qobject_cast (mLoader->findObject( + "primary")), SIGNAL( + triggered()), this, SLOT(cancelDialog())); + mDialog->setTimeout(HbPopup::NoTimeout); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + mDialog->setModal(true); + break; + + //DrmUi Notes + //Notes are not defined in the locatization xls hence commented out + // case ENoteNoConnectionDefined: + // case ENoteInvalidOrNoAP: + // case ENoteOpeningFailPerm: + case ENoteRightsObjReceived: + mDialog->setTimeout(HbPopup::StandardTimeout); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + break; + default: + break; + + } + } + else + { + qFatal("Unable to load %S"); + return EFalse; + } + } + + return ETrue; + } +/*! + Handle secondary push button triggered + */ +void DrmUiDialogsBuilder::cancelDialog() + { + QVariantMap val; + QVariant index(ECancelled); + val.insert("result", index); + emit deviceDialogData(val); + emit deviceDialogClosed(); + } +/*! + Handle Primary push button triggered + */ +void DrmUiDialogsBuilder::confirmDialog() + { + QVariantMap val; + QVariant index(EOk); + val.insert("result", index); + emit deviceDialogData(val); + emit deviceDialogClosed(); + } diff -r abec8b1bb37c -r 442486f870da commondrm/drmui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmui/group/bld.inf Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2010 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: +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +#include "../drmuidialogs/group/bld.inf" + + +PRJ_TESTMMPFILES + +// End of File diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/eabi/DrmUtilityDmgrWrapperu.def --- a/commondrm/drmutility/eabi/DrmUtilityDmgrWrapperu.def Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/eabi/DrmUtilityDmgrWrapperu.def Thu Jul 22 16:35:50 2010 +0100 @@ -1,5 +1,3 @@ -EXPORTS +EXPORTS _Z16GateFunctionDMgrv @ 1 NONAME - _ZTI22CDrmUtilityDmgrWrapper @ 2 NONAME ; ## - _ZTV22CDrmUtilityDmgrWrapper @ 3 NONAME ; ## diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/group/DRMUiHandlingImpl.mmp --- a/commondrm/drmutility/group/DRMUiHandlingImpl.mmp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* Copyright (c) 2006-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: Project definition file for DRM Utility -* -*/ - -#include -#include - -TARGET DRMUiHandlingImpl.dll -TARGETTYPE dll -UID 0x1000008D 0x10205CBE - -CAPABILITY CAP_GENERAL_DLL DRM -VENDORID VID_DEFAULT - -#ifdef __DRM -SOURCE ../src/DrmUiHandlingImpl.cpp -SOURCE ../src/drmuihandlingdata.cpp -SOURCE ../src/DrmUtilityDownloadManager.cpp -#endif - -USERINCLUDE ../inc -USERINCLUDE ../../../omadrm/drmengine/roap/inc -USERINCLUDE ../../../omadrm/drmengine/roapstorage/inc -USERINCLUDE ../../../omadrm/drmengine/server/inc -USERINCLUDE ../../../inc // ADo level inc dir - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom // needed because of SchemeHandler - -LIBRARY euser.lib -LIBRARY apparc.lib // for launching rights mgr ui embedded -LIBRARY avkon.lib -LIBRARY efsrv.lib // for launching rights mgr ui embedded -LIBRARY apgrfx.lib -LIBRARY ws32.lib -LIBRARY centralrepository.lib -LIBRARY servicehandler.lib -LIBRARY caf.lib -LIBRARY cafutils.lib -LIBRARY charconv.lib -LIBRARY ecom.lib // for scheme handling -LIBRARY cmmanager.lib - -#ifdef __DRM -LIBRARY drmutilitycommon.lib -LIBRARY drmutility.lib -LIBRARY roaphandler.lib -LIBRARY drmparsers.lib -LIBRARY drmdcf.lib -LIBRARY dcfrep.lib -LIBRARY drmrights.lib -LIBRARY drmserverinterfaces.lib -LIBRARY drmcommon.lib -#endif - -DOCUMENT bld.inf - -#if defined(EABI) -deffile ../eabi/ -#elif defined( WINSCW ) -deffile ../bwinscw/ -#elif defined( WINS ) -deffile ../bwins/ -#else -deffile ../bmarm/ -#endif - -SMPSAFE diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/group/bld.inf --- a/commondrm/drmutility/group/bld.inf Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/group/bld.inf Thu Jul 22 16:35:50 2010 +0100 @@ -33,8 +33,6 @@ #if (defined __WINDOWS_MEDIA_DRM) drmutilitywmdrmwrapper.mmp #endif // __WINDOWS_MEDIA_DRM -DrmUtilityDmgrWrapper.mmp -DRMUiHandlingImpl.mmp DRMAutomatedUsageImpl.mmp DrmRightsInfoImpl.mmp diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/group/drmutilitycommon.mmp --- a/commondrm/drmutility/group/drmutilitycommon.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/group/drmutilitycommon.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -42,6 +42,7 @@ USERINCLUDE ../inc USERINCLUDE ../../../omadrm/drmengine/server/inc USERINCLUDE ../../../inc // ADo level inc dir +USERINCLUDE ../../drmui/drmuidialogs/inc // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE @@ -61,6 +62,7 @@ LIBRARY aknnotify.lib LIBRARY drmrights.lib // Permission, Constraint LIBRARY drmserverinterfaces.lib // DrmClockClient, DrmRightsClient +LIBRARY drmuidialogs.lib DOCUMENT bld.inf diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/group/qt/drmuihandlingimpl.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/group/qt/drmuihandlingimpl.pri Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,23 @@ + +# +# Copyright (c) 2010 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: +# + + +# Input +HEADERS += ../../inc/DrmUiHandlingImpl.h \ + ../../inc/drmuihandlingdata.h \ + ../../inc/DrmUtilityDownloadManager.h + diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/group/qt/drmuihandlingimpl.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/group/qt/drmuihandlingimpl.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,96 @@ + +# +# Copyright (c) 2010 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: +# + +include ( drmuihandlingimpl.pri ) + +IncludeBlock = \ + "$${LITERAL_HASH}include " \ + "$${LITERAL_HASH}include " +MMP_RULES += IncludeBlock + +TEMPLATE = lib +TARGET = DRMUiHandlingImpl + +SrcIfdefBlock = \ + "$${LITERAL_HASH}ifdef __DRM" \ + "SOURCE ../../src/DrmUiHandlingImpl.cpp" \ + "SOURCE ../../src/drmuihandlingdata.cpp" \ + "SOURCE ../../src/DrmUtilityDownloadManager.cpp" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += SrcIfdefBlock + +symbian: { + TARGET.CAPABILITY = CAP_GENERAL_DLL DRM + TARGET.VID = VID_DEFAULT + TARGET.UID3 = 0x10205CBE + TARGET.EPOCALLOWDLLDATA = 1 + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += ../../inc + INCLUDEPATH += ../../../../omadrm/drmengine/roap/inc + INCLUDEPATH += ../../../../omadrm/drmengine/roapstorage/inc + INCLUDEPATH += ../../../../omadrm/drmengine/server/inc + INCLUDEPATH += ../../../../inc // ADo level inc dir + INCLUDEPATH += /epoc32/include/platform/mw/cwrt + INCLUDEPATH += /epoc32/include/ecom + + LIBS += -leuser + LIBS += -lapparc // for launching rights mgr ui embedded + LIBS += -lavkon + LIBS += -lefsrv // for launching rights mgr ui embedded + LIBS += -lapgrfx + LIBS += -lws32 + LIBS += -lcentralrepository + LIBS += -lservicehandler + LIBS += -lcaf + LIBS += -lcafutils + LIBS += -lcharconv + LIBS += -lecom // for scheme handling + LIBS += -lcmmanager + LIBS += -ldrmbrowserlauncher + + IfdefLibBlock = \ + "$${LITERAL_HASH}ifdef __DRM" \ + "LIBRARY drmutilitycommon.lib" \ + "LIBRARY drmutility.lib" \ + "LIBRARY roaphandler.lib" \ + "LIBRARY drmparsers.lib" \ + "LIBRARY drmdcf.lib" \ + "LIBRARY dcfrep.lib" \ + "LIBRARY drmrights.lib" \ + "LIBRARY drmserverinterfaces.lib" \ + "LIBRARY drmcommon.lib" \ + "$${LITERAL_HASH}endif" + + MMP_RULES += IfdefLibBlock + + defBlock = \ + "$${LITERAL_HASH}if defined(ARMCC)" \ + "DEFFILE ../../eabi/" \ + "$${LITERAL_HASH}elif defined( WINSCW )" \ + "DEFFILE ../../bwinscw/" \ + "$${LITERAL_HASH}elif defined( WINS )" \ + "DEFFILE ../../bwins/" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../../bmarm/" \ + "$${LITERAL_HASH}endif" + + MMP_RULES += defBlock + + } + diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/group/qt/drmutilitydmgrwrapper.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/group/qt/drmutilitydmgrwrapper.pri Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,25 @@ + +# +# Copyright (c) 2010 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: +# + + +# Input +HEADERS += ../../../../inc/DrmUtilityDmgrWrapper.h \ + ../../inc/drmutilityconnection.h \ + ../../inc/qdrmutilitydmgreventhandler.h + + + diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/group/qt/drmutilitydmgrwrapper.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/group/qt/drmutilitydmgrwrapper.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,81 @@ + +# +# Copyright (c) 2010 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: +# + +include ( drmutilitydmgrwrapper.pri ) + +TEMPLATE = lib +TARGET = DrmUtilityDmgrWrapper + +SrcIfdefBlock = \ + "$${LITERAL_HASH}ifdef __DRM" \ + "SOURCE ../../src/DrmUtilityDmgrWrapper.cpp" \ + "SOURCE ../../src/drmutilityconnection.cpp" \ + "SOURCE ../../src/qdrmutilitydmgreventhandler.cpp" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += SrcIfdefBlock + +symbian: { + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.VID = VID_DEFAULT + TARGET.UID3 = 0x102830FE + TARGET.EPOCALLOWDLLDATA = 1 + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += ../../inc + INCLUDEPATH += ../../../../omadrm/drmengine/roap/inc + INCLUDEPATH += ../../../../inc // ADo level inc dir + INCLUDEPATH += ../../traces // OST definitions + INCLUDEPATH += /epoc32/include/platform/mw/cwrt + + LIBS += -leuser + LIBS += -lcmmanager // RCmManager CCmApplicationSettingsUi + LIBS += -lesock // RConnection, RSocketServ + LIBS += -lextendedconnpref + LIBS += -lnetmeta // TExtendedConnPref + LIBS += -lWrtDownloadMgr + LIBS += -lroaphandler + LIBS += -lefsrv + LIBS += -lavkon + LIBS += -lcommonengine + LIBS += -leikctl + LIBS += -lplatformenv + LIBS += -lflogger + + ResourceBlock = \ + "START RESOURCE ../../data/DrmUtilityDmgrWrapper.rss" \ + "HEADER" \ + "TARGETPATH RESOURCE_FILES_DIR" \ + "LANGUAGE_IDS" \ + "END" + + MMP_RULES += ResourceBlock + + defBlock = \ + "$${LITERAL_HASH}if defined(ARMCC)" \ + "DEFFILE ../../eabi/" \ + "$${LITERAL_HASH}elif defined( WINSCW )" \ + "DEFFILE ../../bwinscw/" \ + "$${LITERAL_HASH}elif defined( WINS )" \ + "DEFFILE ../../bwins/" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../../bmarm/" \ + "$${LITERAL_HASH}endif" + + MMP_RULES += defBlock + + } + diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/inc/DrmUiHandlingImpl.h --- a/commondrm/drmutility/inc/DrmUiHandlingImpl.h Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/inc/DrmUiHandlingImpl.h Thu Jul 22 16:35:50 2010 +0100 @@ -32,7 +32,6 @@ //*** forward declarations go here: class CCoeEnv; class CDRMConstraint; -class CSchemeHandler; namespace ContentAccess { @@ -807,7 +806,7 @@ * CallSilentAvailble after right * @return Etrue, if silent RO rerieval led to usable content */ - TBool CDrmUiHandlingImpl::GetSilentAndCallL( + TBool GetSilentAndCallL( MDrmHandleErrorObserver* aObserver, TInt aOperationId, const ContentAccess::TIntent aIntent, @@ -820,7 +819,7 @@ * checks status if launched embedded. * CallRightsAvailable, if launched embedded or righsUrl not present */ - void CDrmUiHandlingImpl::GetRightsAndCallL( + void GetRightsAndCallL( MDrmHandleErrorObserver* aObserver, TInt aOperationId, const ContentAccess::TIntent aIntent, @@ -856,9 +855,6 @@ // Wait for the notes and queries CActiveSchedulerWait iWait; - // Schemehandler for url handling - CSchemeHandler* iSchemeHandler; - // Operation Queue: CDrmUiHandlingData* iFirst; CDrmUiHandlingData* iLast; diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/inc/qdrmutilitydmgreventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/inc/qdrmutilitydmgreventhandler.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2010 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: +* +*/ + + +#ifndef QDRMUTILITYDMGREVENTHANDLER_H +#define QDRMUTILITYDMGREVENTHANDLER_H + +#include + +namespace WRT + { + class Download; + class DownloadEvent; + } + +class CDrmUtilityDmgrWrapper; + +class QDrmUtilityDmgrEventHandler : public QObject + { + Q_OBJECT + + public: + QDrmUtilityDmgrEventHandler( CDrmUtilityDmgrWrapper& aDrmUtilityDmgrWrapper , WRT::Download& aDownload ); + + public slots: + + /** + * Handle download manager events + * + * @param aEvent the event + */ + void HandleDownloadEventL( WRT::DownloadEvent* aEvent ); + + private: + WRT::Download& iDownload; + CDrmUtilityDmgrWrapper& iDrmUtilityDmgrWrapper; + + }; + +#endif // QDRMUTILITYDMGREVENTHANDLER_H diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/src/DrmUiHandlingImpl.cpp --- a/commondrm/drmutility/src/DrmUiHandlingImpl.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/src/DrmUiHandlingImpl.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -38,12 +38,13 @@ #include #include +// DCF repository +#include +#include + // character conversions #include -// handling urls -#include - // resources #include #include @@ -58,6 +59,7 @@ #include #include #include +#include //connectivity logic #include // RCmConnectionMethod @@ -87,6 +89,7 @@ #include "DRMDomainContext.h" #include "DrmUtilityInternalcrkeys.h" // Cenrep extension for OmaBased +#include "drmuidialogids.h" // CONSTANTS const TInt KCommandHandleErrorFile( 1 ); @@ -119,6 +122,8 @@ const TInt KresOmaBasedBuf( 512 ); const TInt KNameBuf( 256 ); +const TInt KNoValue = -1; + #ifdef _DEBUG // debug panic _LIT( KDRMUtilityDebugPanicMessage, "DrmUiHandlingDebugPanic" ); @@ -214,6 +219,69 @@ return found; } +// --------------------------------------------------------- +// UpdateDCFRepositoryL() +// Update saved file to DCFRepository +// --------------------------------------------------------- + +LOCAL_C void UpdateDCFRepositoryL( TDesC& aFullFileName ) + { + CDcfEntry* dcfEntry( NULL ); + CDcfRep* dcfRep( NULL ); + + dcfEntry = CDcfEntry::NewL(); + CleanupStack::PushL( dcfEntry ); + + dcfRep = CDcfRep::NewL(); + CleanupStack::PushL( dcfRep ); + + dcfEntry->SetLocationL( aFullFileName, 0 ); + dcfRep->UpdateL( dcfEntry ); + CleanupStack::PopAndDestroy( dcfRep ); + CleanupStack::PopAndDestroy( dcfEntry ); + } + +// --------------------------------------------------------- +// FindFullFileNameAndUpdateDCFRepositoryL() +// Find full file name for the content and update saved +// file to DCFRepository +// --------------------------------------------------------- + +LOCAL_C void FindFullFileNameAndUpdateDCFRepositoryL( + const RFile& aFileHandle ) + { + HBufC* fullPath( NULL ); + TPtr fullPathPtr( NULL, 0 ); + + fullPath = HBufC::NewLC( KUrlMaxLen ); + fullPathPtr.Set( fullPath->Des() ); + + aFileHandle.FullName( fullPathPtr ); + UpdateDCFRepositoryL( fullPathPtr ); + CleanupStack::PopAndDestroy( fullPath ); + } + +// --------------------------------------------------------- +// FindFullFileNameAndUpdateDCFRepositoryL() +// Find full file name for the content and update saved +// file to DCFRepository +// --------------------------------------------------------- + +LOCAL_C void FindFullFileNameAndUpdateDCFRepositoryL( + const ContentAccess::CData& aFileData ) + { + HBufC* fullPath( NULL ); + TPtr fullPathPtr( NULL, 0 ); + + fullPath = HBufC::NewLC( KUrlMaxLen ); + fullPathPtr.Set( fullPath->Des() ); + + aFileData.GetStringAttribute( DRM::EDrmFullName, + fullPathPtr ); + + UpdateDCFRepositoryL( fullPathPtr ); + CleanupStack::PopAndDestroy( fullPath ); + } // ============================ MEMBER FUNCTIONS =============================== @@ -369,8 +437,6 @@ delete iDrmUtilityUi; - delete iSchemeHandler; - delete iWrapperLoader; delete iOmaBasedAgentName; @@ -1455,6 +1521,9 @@ if ( ( !agent.Compare( DRM::KDrmOmaAgentName ) ) || ( iOmaBasedAgentName && !agent.Compare( *iOmaBasedAgentName ) ) ) { + // To embed Domain RO in superdistribution case, register the content + TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( *aData.iFile ) ); + HandleOmaErrorL( *content, aData.iIntent, aData.iError, aData.iErrorObserver, aData.iOperationId ); } @@ -1476,6 +1545,7 @@ void DRM::CDrmUiHandlingImpl::PerformHandleErrorDataL( DRM::CDrmUiHandlingData& aData ) { + DRM::TDrmAgentUid agentUid( DRM::EDrmOmaAgent ); IsProtectedL( aData.iFileData, agentUid ); IsProperErrorL( aData.iError ); @@ -1484,7 +1554,11 @@ switch ( agentUid ) { case DRM::EDrmOmaAgent: - + + // To embed Domain RO in superdistribution case, register the content + TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( + *aData.iFileData ) ); + HandleOmaErrorL( *aData.iFileData, aData.iIntent, aData.iError, aData.iErrorObserver, aData.iOperationId ); @@ -1592,7 +1666,10 @@ HBufC* riUrl( NULL ); HBufC* domainRiUrl( NULL ); DRM::TDrmUiUrlType urlType( DRM::EUHRightsIssuerUrl ); - + + // To embed Domain RO in superdistribution case, register the content + TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( aContent ) ); + User::LeaveIfError( GetContentIdLC( aContent, contentId ) ); GetOmaSilentRightsUrlLC( aContent, silentUrl ); GetOmaRightsIssuerLC( aContent, riUrl ); @@ -1749,7 +1826,7 @@ TInt previewType( ContentAccess::ENoPreview ); TUint32 reason( 0 ); TBool handled( EFalse ); - + User::LeaveIfError( GetContentIdLC( aContent, contentId ) ); // Check that this really is an error situation @@ -1759,8 +1836,8 @@ TBool onlyMeteringRejection( reason == DRM::EURejectionMetering ); if ( onlyMeteringRejection ) { - iDrmUtilityUi->DisplayQueryWithIdL( R_DRM_QUERY_METERING_DISABLED, - R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); + // Qt dialog not implemented yet + iDrmUtilityUi->DisplayNoteL( EConfUnableToOpen ); CleanupStack::PopAndDestroy( contentId ); return; @@ -2891,9 +2968,8 @@ if ( RejectReason( aReason ) == DRM::EURejectionMetering ) { // Show that only reason for error was rejected metering. - iDrmUtilityUi->DisplayQueryWithIdL( - R_DRM_QUERY_METERING_DISABLED, - R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); + // Qt dialog not implemented yet + iDrmUtilityUi->DisplayNoteL( EConfUnableToOpen ); } else { @@ -3414,7 +3490,7 @@ HBufC* etaBuf( NULL ); TBool isRegistered( EFalse ); TBool isJoined( EFalse ); - TInt ret( 0 ); + TInt ret( ECancelled ); TInt err( KErrNone ); TInt eta( 0 ); TFileName fileName; @@ -3440,16 +3516,13 @@ // rights should have come already if ( aRightsUrl ) { - ret = iDrmUtilityUi->DisplayQueryWithIdL( - R_DRMUTILITY_RIGHTS_SHOULD_HAVE_COME, - R_DRMUTILITY_CONFIRMATION_QUERY ); + ret = iDrmUtilityUi->DisplayQueryL( EQueryGetNewLicence, KNoValue ); } else { // no rights issuer - iDrmUtilityUi->DisplayQueryWithIdL( - R_DRMUTILITY_RIGHTS_SHOULD_HAVE_COME_NO_RI, - R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); + // Qt dialog not implemented yet + iDrmUtilityUi->DisplayNoteL( EConfLicenceNotReceived ); } } else if ( !eta || err || eta == -1 ) @@ -3463,17 +3536,13 @@ if ( aRightsUrl && isRegistered && !isJoined ) // Domain ro case { - ret = iDrmUtilityUi->DisplayQueryWithIdL( - R_DRMUTILITY_ACTIVATE_ACCOUNT, - R_DRMUTILITY_CONFIRMATION_QUERY ); + ret = iDrmUtilityUi->DisplayQueryL( EQueryAccountUpdate, KNoValue ); } else if ( aRightsUrl ) // Device ro case { if ( aReason & EConstraintIndividual ) { - ret = iDrmUtilityUi->DisplayQueryWithIdL( - R_DRMUTILITY_INVALID_SIM, - R_DRMUTILITY_CONFIRMATION_QUERY ); + ret = iDrmUtilityUi->DisplayQueryL( EQueryFileLockedForSim, KNoValue ); } else { @@ -3481,19 +3550,20 @@ User::LeaveIfError( aContent.GetStringAttribute( EFileName, fileName ) ); - ret = iDrmUtilityUi->DisplayQueryL( - R_DRM_QUERY_EXPIRED_OR_NO_RO, fileName ); + // Qt dialog not implemented yet + ret = iDrmUtilityUi->DisplayQueryL( EQueryFileWithNoRightsObj, fileName ); } } else // no rights issuer { if ( aReason & EConstraintIndividual ) { - iDrmUtilityUi->DisplayNoteL( R_DRM_INFO_SIM_NOT_ALLOWED ); + // Qt dialog not implemented yet + iDrmUtilityUi->DisplayNoteL( EConfFileLockedForSim ); } else { - iDrmUtilityUi->DisplayNoteL( R_DRM_INFO_EXPIRED_OR_NO_RO ); + iDrmUtilityUi->DisplayNoteL( EConfLicenceExpired ); } } } @@ -3503,31 +3573,25 @@ if ( eta != KErrCAPendingRights ) { // rights expected to arrive in eta seconds - iDrmUtilityUi->DisplayQueryWithIdL( - R_DRMUTILITY_WAITING_FOR_RIGHTS, - R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); + iDrmUtilityUi->DisplayNoteL( EConfWaitingForLicence ); } else { // rights should have come if ( aRightsUrl ) { - ret = iDrmUtilityUi->DisplayQueryWithIdL( - R_DRMUTILITY_RIGHTS_SHOULD_HAVE_COME, - R_DRMUTILITY_CONFIRMATION_QUERY ); + ret = iDrmUtilityUi->DisplayQueryL( EQueryGetNewLicence, KNoValue ); } else { // no rights issuer - iDrmUtilityUi->DisplayQueryWithIdL( - R_DRMUTILITY_RIGHTS_SHOULD_HAVE_COME_NO_RI, - R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); + // Qt dialog not implemented yet + iDrmUtilityUi->DisplayNoteL( EConfLicenceNotReceived ); } } } } - - if ( ret == EAknSoftkeyYes || ret == EAknSoftkeyOk ) + if ( ret == EOk ) { rightsRenewalWanted = ETrue; } @@ -4006,25 +4070,11 @@ ptrc.Set( *newUrl ); } - CSchemeHandler* schemeHandler( CSchemeHandler::NewL( ptrc ) ); - CleanupStack::PushL( schemeHandler ); - if ( iCoeEnv ) - { - embeddedLaunch = ETrue; - // launch embedded - schemeHandler->Observer( this ); - schemeHandler->HandleUrlEmbeddedL(); - CleanupStack::Pop( schemeHandler ); - iSchemeHandler = schemeHandler; - iWait.Start(); - } - else - { - // no CoeEnv, launch standalone with scheme app - schemeHandler->HandleUrlStandaloneL(); - CleanupStack::PopAndDestroy( schemeHandler ); - } - schemeHandler = NULL; + CDrmBrowserLauncher* browserLauncher = CDrmBrowserLauncher::NewLC(); + + browserLauncher->LaunchUrlL(ptrc); + + CleanupStack::PopAndDestroy(); // browserLauncher // delete newUrl if needed if ( newUrl ) @@ -4043,31 +4093,29 @@ const TBool aShowNotes ) { TInt r( KErrCancel ); - TInt buttonCode( EAknSoftkeyYes ); + TInt buttonCode( EOk ); HBufC8* url( NULL ); if ( !SilentRightsAllowedL() ) { - buttonCode = EAknSoftkeyNo; + buttonCode = ECancelled; if ( aShowNotes ) { - buttonCode = iDrmUtilityUi->DisplayQueryWithIdL( - R_DRM_QRY_CONNECT_TO_ACTIVATE, - R_DRMUTILITY_CONFIRMATION_QUERY ); + // Qt dialog not implemented yet + buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryConnectToActivate, KNoValue ); } } else if ( !(HasDefConn()) ) { - buttonCode = EAknSoftkeyNo; + buttonCode = ECancelled; if ( aShowNotes ) { - buttonCode = iDrmUtilityUi->DisplayQueryWithIdL( - R_DRM_QRY_CONNECT_TO_ACTIVATE, - R_DRMUTILITY_CONFIRMATION_QUERY ); + // Qt dialog not implemented yet + buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryConnectToActivate, KNoValue ); } } - if ( buttonCode == EAknSoftkeyYes || buttonCode == EAknSoftkeyOk ) + if ( buttonCode == EOk ) { TBool APs( HasAccessPointsL() ); if ( !APs ) @@ -4075,7 +4123,8 @@ // No AP defined if ( aShowNotes ) { - iDrmUtilityUi->DisplayNoteL( R_DRM_WARN_NO_CONN_DEFINED ); + // Qt dialog not implemented yet + iDrmUtilityUi->DisplayNoteL( EConfNoAccessPoint ); } r = KErrCANoRights; } @@ -4109,8 +4158,8 @@ // Connection failed with selected AP if ( aShowNotes ) { - iDrmUtilityUi->DisplayNoteL( - R_DRM_WARN_INVALID_OR_NO_AP ); + // Qt dialog not implemented yet + iDrmUtilityUi->DisplayNoteL( EConfConnectionFailed ); } r = KErrCANoRights; } @@ -4127,13 +4176,10 @@ if ( errorUrl ) { // ask user whether error url should be opened - buttonCode - = iDrmUtilityUi->DisplayQueryWithIdL( - R_DRM_QUERY_OPEN_ERROR_URL, - R_DRMUTILITY_CONFIRMATION_QUERY ); - - if ( buttonCode == EAknSoftkeyYes - || buttonCode == EAknSoftkeyOk ) + // Qt dialog not implemented yet + buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryOpenErrorUrl, KNoValue ); + + if ( buttonCode == EOk ) { // Launch browser LaunchBrowserL( errorUrl ); @@ -4141,8 +4187,8 @@ } else { - iDrmUtilityUi->DisplayNoteL( - R_DRM_ERR_OPENING_FAIL_PERM ); + // Qt dialog not implemented yet + iDrmUtilityUi->DisplayNoteL( EConfUnableToUnlock ); } CleanupStack::PopAndDestroy( errorUrl ); } @@ -4174,17 +4220,11 @@ // void DRM::CDrmUiHandlingImpl::HandleServerAppExit( TInt aReason ) { - if ( aReason == EAknCmdExit && !iSchemeHandler ) + if ( aReason == EAknCmdExit) { CAknEnv::RunAppShutter(); } - if ( iSchemeHandler ) - { - delete iSchemeHandler; - iSchemeHandler = NULL; - } - if ( iWait.IsStarted() ) { iWait.AsyncStop(); diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp --- a/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -26,7 +26,6 @@ #include #include -#include //download manager #include // tconnectioninfo #include // TConnectionInfoV2 #include // rconnection rsocket @@ -41,6 +40,13 @@ #include #include +// including files related to qt changes +#include +#include +#include +#include +#include + #include "RoapSyncWrapper.h" #include "RoapDef.h" #include "DrmUtilityDmgrWrapper.h" @@ -49,6 +55,7 @@ #include "buffercontainers.h" //CnameContainer etc. #include "cleanupresetanddestroy.h" #include "buffercontainers.h" +#include "qdrmutilitydmgreventhandler.h" #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE @@ -68,6 +75,8 @@ const TInt KProgressInfoIncrementMedium(10); const TInt KProgressInfoIncrementLarge(30); +using namespace WRT; + // ======== LOCAL FUNCTIONS ======== // --------------------------------------------------------------------------- @@ -93,13 +102,76 @@ // --------------------------------------------------------------------------- -// DeleteHttpDowload +// Calls the appropriate member function of the object during object cleanup // --------------------------------------------------------------------------- // -LOCAL_C void DeleteHttpDowload(TAny* aDownload) - { - reinterpret_cast (aDownload)->Delete(); - } +template class mem_auto_ptr + { + public: + explicit mem_auto_ptr(_Ty _P = 0, _Tf _F = 0) + : _Owns(_P != 0), _Ptr(_P), _Fn(_F) + {} + + mem_auto_ptr(const mem_auto_ptr<_Ty,_Tf>& _Y) + : _Owns(_Y._Owns), _Ptr(_Y.release()), _Fn(_Y.function()) + {} + + mem_auto_ptr<_Ty,_Tf>& operator=(const mem_auto_ptr<_Ty,_Tf>& _Y) + { + if (this != &_Y) + { + _Fn = _Y.function(); + if (_Ptr != _Y.get()) + { + if (_Owns) + delete _Ptr; + _Owns = _Y._Owns; + } + else if (_Y._Owns) + _Owns = true; + _Ptr = _Y.release(); + } + return (*this); + } + + ~mem_auto_ptr() + { + if (_Owns) + { + (_Ptr->*_Fn)(); + } + } + + _Ty& operator*() const + { + return (*get()); + } + + _Ty *operator->() const + { + return (get()); + } + + _Ty *get() const + { + return (_Ptr); + } + + _Ty *release() const + { + ((mem_auto_ptr<_Ty,_Tf> *)this)->_Owns = false; + return (_Ptr); + } + + _Tf *function() const + { + return (_Fn); + } + private: + bool _Owns; + _Ty _Ptr; + _Tf _Fn; + }; // --------------------------------------------------------------------------- @@ -142,7 +214,16 @@ CLOG_WRITE( "DMgrWrapper::ConstructL" ); const TInt KDrmUtilityDmgrWrapperUid = 0x102830FE; iConnection = DRM::CDrmUtilityConnection::NewL(ETrue); - iDlMgr.ConnectL(TUid::Uid(KDrmUtilityDmgrWrapperUid), *this, EFalse); + + try + { + QString drmUtilityDmgrWrapperUid(QString::number(KDrmUtilityDmgrWrapperUid)); + iDlMgr = q_check_ptr(new DownloadManager(drmUtilityDmgrWrapperUid)); + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } iProgressInfo = NULL; iProgressNoteDialog = NULL; iDialogDismissed = ETrue; @@ -202,22 +283,11 @@ delete iTriggerBuf; delete iFileName; delete iRoapEng; - -#ifdef _DEBUG - - if (iDlMgr.Handle()) - { - iDlMgr.Close(); - } - -#else - - iDlMgr.Close(); - -#endif - + iDownload->cancel(); + delete iDlMgr; + delete iDrmUtilityDmgrEventHandler; + iFs.Close(); - } @@ -299,10 +369,11 @@ TUint32 iapId(0); if (iConnection->IsConnected(iapId)) { - iDlMgr.SetIntAttribute( EDlMgrIap, iapId ); + const QVariant qIapId( static_cast(iapId) ); + iDlMgr->setAttribute( WRT::ClientName, qIapId ); } RFile roapTrigger; - TBool result(EFalse); + CleanupClosePushL(roapTrigger); DRM::CFileNameContainer* triggerFileName(NULL); // If no Trigger URL then nothing to download. So finish transaction @@ -318,20 +389,22 @@ } TPtrC8 KNullPtr8(NULL, 0); - RHttpDownload* downloadPtr(iDlMgr.FindDownload(*iTriggerUrl, KNullPtr8)); - if (downloadPtr) + QString downloadUrl((QChar*)iTriggerUrl->Des().Ptr(),iTriggerUrl->Length()); + //uncomment + Download* download = NULL;//iDlMgr->findDownload( downloadUrl ); + if (download) { // Stale download found. // Remove it, and re-create a new download. - downloadPtr->Delete(); - downloadPtr = NULL; + download->cancel(); + download = NULL; if (iFileName) { iFs.Delete(*iFileName); } } - triggerFileName=DRM::CFileNameContainer::NewLC(); + #ifndef RD_MULTIPLE_DRIVE User::LeaveIfError( roapTrigger.Temp( @@ -358,33 +431,46 @@ UpdateBufferL (iFileName, triggerFileName->iBuffer); CleanupStack::PopAndDestroy( triggerFileName ); triggerFileName=NULL; - // create and start download - RHttpDownload& download = iDlMgr.CreateDownloadL(*iTriggerUrl, result); - // Put download for proper cleanup. - TCleanupItem item(DeleteHttpDowload, &download); - CleanupStack::PushL(item); - - CleanupClosePushL(roapTrigger); - - if (result) - { - iDownloadSuccess = EFalse; - iConnectionError = EFalse; + downloadUrl = ((QChar*)iTriggerUrl->Des().Ptr(),iTriggerUrl->Length()); + + iDownload = iDlMgr->createDownload(downloadUrl); + try + { + iDrmUtilityDmgrEventHandler = q_check_ptr(new QDrmUtilityDmgrEventHandler(*this, *iDownload)); + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } + + iDownloadSuccess = EFalse; + iConnectionError = EFalse; - User::LeaveIfError(download.SetFileHandleAttribute(roapTrigger)); - User::LeaveIfError(download.SetBoolAttribute( - EDlAttrNoContentTypeCheck, ETrue)); - User::LeaveIfError(download.Start()); - - // wait until download is finished - iState = aNextState; - TRequestStatus* status(&iStatus); - *status = KRequestPending; - SetActive(); - } + try + { + RBuf fileName; + fileName.Create(KMaxFileName); + CleanupClosePushL(fileName); + roapTrigger.Name(fileName); + const QVariant& roapTriggerValue( QString((QChar*) fileName.Ptr(), fileName.Length()) ); + CleanupStack::PopAndDestroy(&fileName); + iDownload->setAttribute(FileName,roapTriggerValue); + const QVariant& val(ETrue); + iDownload->setAttribute(ContentType, val); + iDownload->start(); + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } + // wait until download is finished + iState = aNextState; + TRequestStatus* status(&iStatus); + *status = KRequestPending; + SetActive(); + CleanupStack::PopAndDestroy(&roapTrigger); - CleanupStack::Pop(&download); // Left open for DoSaveRoapTrigger } // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::DoSaveRoapTriggerL @@ -395,15 +481,19 @@ // Check success of download // Fetch download created in DoDownloadRoapTriggerL - RHttpDownload* download = iDlMgr.FindDownload(*iTriggerUrl, KNullDesC8()); + QString downloadUrl((QChar*)iTriggerUrl->Des().Ptr(),iTriggerUrl->Length()); + + typedef void (Download::*download_cancel_fnptr) (); + //uncomment + Download* dwnld = NULL;//iDlMgr->findDownload( downloadUrl ); + mem_auto_ptr downloadPtr(dwnld,&WRT::Download::cancel); + // Delete trigger URL so that it is possible to check // whether or not meteringResponse has PrUrl. delete iTriggerUrl; iTriggerUrl = NULL; iStatus = KRequestPending; - // Put download for proper cleanup. - TCleanupItem item(DeleteHttpDowload, download); - CleanupStack::PushL(item); + RFile roapTrigger; if (!iDownloadSuccess) @@ -448,8 +538,7 @@ // And let ROAP handle it... CleanupStack::PopAndDestroy(&readBuf); CleanupStack::PopAndDestroy(&roapTrigger); - CleanupStack::PopAndDestroy(download); - + iFs.Delete(*iFileName); delete iFileName; iFileName = NULL; @@ -506,65 +595,63 @@ // CDrmUtilityDmgrWrapper::HandleDMgrEventL // --------------------------------------------------------------------------- // -void CDrmUtilityDmgrWrapper::HandleDMgrEventL(RHttpDownload& aDownload, - THttpDownloadEvent aEvent) +void CDrmUtilityDmgrWrapper::HandleDownloadEventL( WRT::DownloadEvent* aEvent ) { - _LIT8( KDrmUtilityMimeTypeROAPTrigger, - "application/vnd.oma.drm.roap-trigger+xml" ); - - - - if (aEvent.iProgressState == EHttpContentTypeReceived) + QString KDrmUtilityMimeTypeROAPTrigger("application/vnd.oma.drm.roap-trigger+xml"); + + try + { + if (aEvent->type() == DownloadEvent::HeadersReceived) { // check received mimetype - RBuf8 contentType; - contentType.CleanupClosePushL(); - contentType.CreateL(KMaxContentTypeLength); - User::LeaveIfError(aDownload.GetStringAttribute(EDlAttrContentType, - contentType)); - if (!contentType.FindF(KDrmUtilityMimeTypeROAPTrigger)) + QString contentType = iDownload->attribute(ContentType).toString(); + if (!contentType.contains(KDrmUtilityMimeTypeROAPTrigger)) { // ROAP trigger found, continue download - User::LeaveIfError(aDownload.Start()); + iDownload->start(); } else { // wrong MIME type, so stop download iDownloadSuccess = EFalse; - User::LeaveIfError(aDownload.Delete()); + iDownload->cancel(); } - CleanupStack::PopAndDestroy(&contentType); } - - if (aEvent.iDownloadState == EHttpDlCreated) + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } + + if (aEvent->type() == DownloadEvent::Created) { - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCreated" ); + CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: Created" ); if (iUseCoeEnv && iProgressInfo) { iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium); } } - else if (aEvent.iProgressState == EHttpProgDisconnected) + else if (aEvent->type() == DownloadEvent::NetworkLoss) { - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpProgDisconnected" ); + CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: NetworkLoss" ); // store failure iDownloadSuccess = EFalse; iConnectionError = ETrue; // finished } - else if (aEvent.iDownloadState == EHttpDlInprogress) + else if (aEvent->type() == DownloadEvent::InProgress) { - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlInprogress" ); + CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: InProgress" ); if (iUseCoeEnv) { iProgressInfo->IncrementAndDraw(KProgressInfoIncrementSmall); } } - else if (aEvent.iDownloadState == EHttpDlCompleted) + else if (aEvent->type() == DownloadEvent::Completed) { // store success - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCompleted" ); + CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: Completed" ); iDownloadSuccess = ETrue; iConnectionError = EFalse; if (iUseCoeEnv) @@ -575,34 +662,41 @@ TRequestStatus* status(&iStatus); User::RequestComplete(status, KErrNone); } - else if (aEvent.iDownloadState == EHttpDlFailed) + else if (aEvent->type() == DownloadEvent::Failed) { - TInt32 err(KErrNone); - - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlFailed" ); - // store failure - iDownloadSuccess = EFalse; - User::LeaveIfError(aDownload.GetIntAttribute(EDlAttrErrorId, err)); - CLOG_WRITE_FORMAT( "EDlAttrErrorId = %d", err ); - - if (err == EConnectionFailed || err == ETransactionFailed) - { - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EConnectionFailed" ); - iConnectionError = ETrue; - } - User::LeaveIfError(aDownload.Delete()); // remove useless download - User::LeaveIfError(iDlMgr.Disconnect()); // disconnects Dmgr instantly. - // finished - TRequestStatus* status(&iStatus); - if ( iConnection->HasMoreConnectionAttempts() ) - { - iState = EInit; // re-try with another conection - User::RequestComplete(status, KErrNone); - } - else - { - User::RequestComplete(status, KErrCancel); - } + try + { + TInt32 err(KErrNone); + + CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: Failed" ); + // store failure + iDownloadSuccess = EFalse; + err = (iDownload->attribute(LastError)).toInt(); + CLOG_WRITE_FORMAT( "EDlAttrErrorId = %d", err ); + + if (err == ConnectionFailed || err == TransactionFailed) + { + CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: ConnectionFailed" ); + iConnectionError = ETrue; + } + iDownload->cancel(); // remove useless download + iDlMgr->pauseAll(); // disconnects Dmgr instantly. + // finished + TRequestStatus* status(&iStatus); + if ( iConnection->HasMoreConnectionAttempts() ) + { + iState = EInit; // re-try with another conection + User::RequestComplete(status, KErrNone); + } + else + { + User::RequestComplete(status, KErrCancel); + } + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } } } @@ -707,7 +801,7 @@ } } //For avoiding active object deadlock - iDlMgr.DeleteAll(); + iDlMgr->removeAll(); } @@ -881,6 +975,7 @@ } return KErrNone; } + // ======== GLOBAL FUNCTIONS ======== //------------------------------------------------------------------------------ diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/src/drmutilityui.cpp --- a/commondrm/drmutility/src/drmutilityui.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/src/drmutilityui.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -58,6 +58,9 @@ #include "DrmUtilityGlobalNoteWrapper.h" #include "DrmUtilityInfoNoteWrapper.h" +#include "drmuidialogids.h" +#include "drmuidialogs.h" + // CONSTANTS #ifndef RD_MULTIPLE_DRIVE _LIT( KDriveZ, "z:" ); @@ -74,6 +77,7 @@ const TInt KDRMUtilityMaxTimeFormatLen( 30 ); const TInt KDRMUtilityMaxTimeLen( 30 ); const TInt KDRMUtilityNoteMaxSize ( 256 ); +const TInt KNoValue = -1; #ifdef _DEBUG // debug panic @@ -313,38 +317,12 @@ TInt aTextResourceId, TInt aValue ) { - TInt buttonCode( 0 ); - - if ( iCoeEnv ) - { - TPtr bufPtr( NULL, 0 ); - - HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, - aValue, - iCoeEnv ) ); - CAknQueryDialog* dlg( - CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) ); - - bufPtr.Set( stringholder->Des() ); - AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); - PrepareSecondaryDisplayL( *dlg, aTextResourceId, KNullDesC, aValue ); + TInt resultCode( ECancelled ); - buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, - *stringholder ); - - CancelSecondaryDisplayL( aTextResourceId ); - CleanupStack::PopAndDestroy( stringholder ); - } - else - { - DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( - DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); - - buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aValue ); - - CleanupStack::PopAndDestroy( noteWrapper ); - } - return buttonCode; + CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); + resultCode = drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, aValue ); + CleanupStack::PopAndDestroy( drmUiDialog ); + return resultCode; } // ----------------------------------------------------------------------------- @@ -355,39 +333,12 @@ TInt aTextResourceId, const TDesC& aString ) { - TInt buttonCode( 0 ); - - if ( iCoeEnv ) - { - TPtr bufPtr( NULL, 0 ); - - HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, - aString, - iCoeEnv ) ); - CAknQueryDialog* dlg( - CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) ); - - bufPtr.Set( stringholder->Des() ); - AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); - PrepareSecondaryDisplayL( *dlg, aTextResourceId, aString, -1 ); + TInt resultCode( ECancelled ); - buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, - *stringholder ); - - CancelSecondaryDisplayL( aTextResourceId ); - CleanupStack::PopAndDestroy( stringholder ); - } - else - { - DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( - DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); - - buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aString ); - - CleanupStack::PopAndDestroy( noteWrapper ); - } - - return buttonCode; + CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); + resultCode = drmUiDialog->ShowNoteL( aTextResourceId, aString, KNoValue ); + CleanupStack::PopAndDestroy( drmUiDialog ); + return resultCode; } // ----------------------------------------------------------------------------- @@ -485,7 +436,7 @@ __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, KDRMUtilityDebugPanicCode ) ); - TInt buttonCode( 1 ); + TInt buttonCode( EOk ); if ( aConstraint->iActiveConstraints & EConstraintEndTime ) { @@ -506,13 +457,14 @@ } endTime.FormatL( endDate, dateFormat ); - buttonCode = DisplayQueryL(R_DRM_QUERY_SET_AUTOMATED, endDate ); + + // Qt dialog not implmented yet. + buttonCode = DisplayQueryL( EQueryLicenceValidUntil, endDate ); } else if ( aConstraint->iActiveConstraints & EConstraintInterval ) { - buttonCode = DisplayQueryWithIdL( R_DRM_QUERY_SET_AUTO_INTERVAL, - R_DRMUTILITY_CONFIRMATION_QUERY ); - + // Qt dialog not implemented yet. + buttonCode = DisplayQueryL( EQueryValidForLimitedTime, KNoValue ); } return buttonCode; } @@ -556,7 +508,8 @@ startDateBuf.Append( startTimeBuf ); // display note with start date - DisplayNoteL( R_DRMUTILITY_USAGE_RIGHTS_IN_FUTURE, startDateBuf ); + // Qt dialog not implemented yet + DisplayNoteL( EConfUnableToUse, startDateBuf ); } // ----------------------------------------------------------------------------- @@ -565,20 +518,9 @@ // EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( TInt aTextResourceId ) { - if ( iCoeEnv ) - { - HBufC* msgText( StringLoader::LoadLC( aTextResourceId, iCoeEnv ) ); - DisplayNoteL( *msgText, aTextResourceId ); - CleanupStack::PopAndDestroy( msgText ); - } - - else - { - TBuf buffer( - iUtilityStringResourceReader->ReadResourceString( aTextResourceId ) ); - - DisplayNoteL( buffer, aTextResourceId ); - } + CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); + drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, KNoValue ); + CleanupStack::PopAndDestroy( drmUiDialog ); } // ----------------------------------------------------------------------------- @@ -589,26 +531,9 @@ TInt aTextResourceId, const TDesC& aString ) { - if ( iCoeEnv ) - { - HBufC* msgText( StringLoader::LoadLC( aTextResourceId, - aString, - iCoeEnv ) ); - DisplayNoteL( *msgText, aTextResourceId ); - CleanupStack::PopAndDestroy( msgText ); - } - else - { - TBuf destBuffer; - - - TBuf buffer( - iUtilityStringResourceReader->ReadResourceString( aTextResourceId ) ); - - - StringLoader::Format( destBuffer, buffer, -1, aString ); - DisplayNoteL( destBuffer, aTextResourceId, aString, -1 ); - } + CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); + drmUiDialog->ShowNoteL( aTextResourceId, aString, KNoValue ); + CleanupStack::PopAndDestroy( drmUiDialog ); } // ----------------------------------------------------------------------------- @@ -619,26 +544,9 @@ TInt aTextResourceId, TInt aValue ) { - if ( iCoeEnv ) - { - HBufC* msgText( StringLoader::LoadLC( aTextResourceId, - aValue, - iCoeEnv ) ); - - DisplayNoteL( *msgText, aTextResourceId, KNullDesC, aValue ); - CleanupStack::PopAndDestroy( msgText ); - } - else - { - TBuf destBuffer; - - TBuf buffer( - iUtilityStringResourceReader->ReadResourceString( aTextResourceId ) ); - - - StringLoader::Format( destBuffer, buffer, -1, aValue ); - DisplayNoteL( destBuffer, aTextResourceId, KNullDesC, aValue ); - } + CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); + drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, aValue ); + CleanupStack::PopAndDestroy( drmUiDialog ); } // ----------------------------------------------------------------------------- diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp --- a/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -55,6 +55,7 @@ #include "drmutilitywmdrmutilities.h" #include "wmdrmdlawrapper.h" +#include "drmuidialogids.h" // CONSTANTS const TInt KMaxUrlLength( 1024 ); @@ -546,7 +547,7 @@ TRAPD( err, LoadDlaWrapperL() ); if ( !err ) { - TInt ret( EAknSoftkeyYes ); + TInt ret( EOk ); RFile file; GetRFileFromCDataL( aContent, file ); CleanupClosePushL( file ); @@ -560,10 +561,11 @@ } TFileName fileName; User::LeaveIfError( aContent.GetStringAttribute( DRM::EDrmFileName, fileName ) ); - ret = iDrmUtilityUi->DisplayQueryL( R_DRM_QUERY_EXPIRED_OR_NO_RO, fileName ); + // Qt dialog not implemented yet + ret = iDrmUtilityUi->DisplayQueryL( EQueryFileWithNoRightsObj, fileName ); } - if ( !err && ( ret == EAknSoftkeyYes || ret == EAknSoftkeyOk ) ) + if ( !err && ret == EOk ) { TRAP_IGNORE( DlaLicenseAcquisitionL( file ) ); } @@ -575,7 +577,7 @@ { iDrmUtilityUi = DRM::CDrmUtilityUI::NewL( iCoeEnv ); } - iDrmUtilityUi->DisplayNoteL( R_DRM_INFO_EXPIRED_OR_NO_RO ); + iDrmUtilityUi->DisplayNoteL( EConfLicenceExpired ); } } diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/src/qdrmutilitydmgreventhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/src/qdrmutilitydmgreventhandler.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,22 @@ + +#include + +#include "qdrmutilitydmgreventhandler.h" +#include "drmutilitydmgrwrapper.h" + +QDrmUtilityDmgrEventHandler::QDrmUtilityDmgrEventHandler( CDrmUtilityDmgrWrapper& aDrmUtilityDmgrWrapper, WRT::Download& aDownload ) + : iDownload(aDownload), + iDrmUtilityDmgrWrapper(aDrmUtilityDmgrWrapper) + { + QT_TRAP_THROWING( + QObject::connect( &iDownload, + SIGNAL(downloadEvent(DownloadEvent*)), + this, SLOT(HandleDownloadEventL(DownloadEvent*)) + ) + ); + } + +void QDrmUtilityDmgrEventHandler::HandleDownloadEventL( WRT::DownloadEvent* aEvent ) + { + iDrmUtilityDmgrWrapper.HandleDownloadEventL(aEvent); + } diff -r abec8b1bb37c -r 442486f870da commondrm/drmutility/traces/OstTraceDefinitions.h --- a/commondrm/drmutility/traces/OstTraceDefinitions.h Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/drmutility/traces/OstTraceDefinitions.h Thu Jul 22 16:35:50 2010 +0100 @@ -1,23 +1,7 @@ -/* -* 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 "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: -* -*/ #ifndef __OSTTRACEDEFINITIONS_H__ #define __OSTTRACEDEFINITIONS_H__ // OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler // REMOVE BEFORE CHECK-IN TO VERSION CONTROL // #define OST_TRACE_COMPILER_IN_USE -#include +#include #endif diff -r abec8b1bb37c -r 442486f870da commondrm/group/bld.inf --- a/commondrm/group/bld.inf Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/group/bld.inf Thu Jul 22 16:35:50 2010 +0100 @@ -43,15 +43,16 @@ ../rom/drmutility_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( drmutility_resources.iby ) ../rom/drmserviceapiwrapper.iby CORE_MW_LAYER_IBY_EXPORT_PATH( drmserviceapiwrapper.iby ) ../rom/drmrightsstoringlocation.iby CORE_MW_LAYER_IBY_EXPORT_PATH( drmrightsstoringlocation.iby ) +../rom/drmbrowserlauncher.iby CORE_MW_LAYER_IBY_EXPORT_PATH( drmbrowserlauncher.iby ) PRJ_MMPFILES -// DRMEncryptor -../drmencryptor/group/DRMEncryptor.mmp - // DRMRightsManagerUi ../drmrightsmanagerui/group/DRMRightsManager.mmp +// drmui +#include "../drmui/group/bld.inf" + // drmutility #include "../drmutility/group/bld.inf" @@ -72,19 +73,6 @@ PRJ_EXTENSIONS START EXTENSION s60/mifconv -OPTION TARGETFILE drmencryptor.mif -OPTION HEADERFILE drmencryptor.mbg -OPTION SOURCES -c8,8 qgn_menu_DRMEncryptor_cxt -c8 icon -OPTION SOURCEDIR ../drmencryptor/group -END - -START EXTENSION s60/mifconv -OPTION TARGETFILE drmencryptor_aif.mif -OPTION SOURCES -c8,8 qgn_menu_drmencryptor -c8 icon -OPTION SOURCEDIR ../drmencryptor/group -END - -START EXTENSION s60/mifconv OPTION TARGETFILE drmrightsmanager.mif OPTION HEADERFILE drmrightsmanager.mbg OPTION SOURCES \ diff -r abec8b1bb37c -r 442486f870da commondrm/rom/DRMEncryptor.iby --- a/commondrm/rom/DRMEncryptor.iby Wed Jun 16 17:39:50 2010 +0100 +++ b/commondrm/rom/DRMEncryptor.iby Thu Jul 22 16:35:50 2010 +0100 @@ -20,18 +20,9 @@ #define __DRMENCRYPTOR_IBY__ #include -#ifndef _IMAGE_TYPE_PRD S60_APP_EXE(DRMENCRYPTOR) - - -SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,DRMEncryptor) - +data = ZRESOURCE\apps\drmencryptor.mif APP_RESOURCE_DIR\drmencryptor.mif +data = ZPRIVATE\10003a3f\import\APPS\drmencryptor_reg.rsc PRIVATE\10003a3f\import\apps\drmencryptor_reg.rsc -S60_APP_AIF_ICONS(DRMENCRYPTOR) -S60_APP_AIF_RSC(DRMENCRYPTOR) - -data=DATAZ_\APP_RESOURCE_DIR\drmencryptor.rsc APP_RESOURCE_DIR\drmencryptor.rsc - -#endif //_IMAGE_TYPE_PRD #endif diff -r abec8b1bb37c -r 442486f870da commondrm/rom/drmbrowserlauncher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/rom/drmbrowserlauncher.iby Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2007-2010 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: Image description file for project Drmbrowserlauncher +* +*/ + + +#ifndef DRMBROWSERLAUNCHER_IBY +#define DRMBROWSERLAUNCHER_IBY + +#include + +file=ABI_DIR\BUILD_DIR\drmbrowserlauncher.dll SHARED_LIB_DIR\drmbrowserlauncher.dll + +#endif // DRMBROWSERLAUNCHER_IBY diff -r abec8b1bb37c -r 442486f870da drm.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drm.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,22 @@ +# +# Copyright (c) 2010 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: qt changes for DRM +# + +TEMPLATE = subdirs + +CONFIG += ordered + +SUBDIRS += commondrm/commondrm.pro +SUBDIRS += omadrm/omadrm.pro \ No newline at end of file diff -r abec8b1bb37c -r 442486f870da drm_plat/camese_framework_api/camese_framework_api.metaxml --- a/drm_plat/camese_framework_api/camese_framework_api.metaxml Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_plat/camese_framework_api/camese_framework_api.metaxml Thu Jul 22 16:35:50 2010 +0100 @@ -1,14 +1,16 @@ - - -camese framework api -WMDRM DLA framework plugin interfaces -c++ -WMDRM - - - - -yes -no - + + + camese framework api + WMDRM DLA framework plugin interfaces +WMDRM DLA Client API + c++ + WMDRM + + + + + + yes + no + diff -r abec8b1bb37c -r 442486f870da drm_plat/camese_framework_api/group/bld.inf --- a/drm_plat/camese_framework_api/group/bld.inf Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_plat/camese_framework_api/group/bld.inf Thu Jul 22 16:35:50 2010 +0100 @@ -29,3 +29,4 @@ ../inc/wmdrmdlahttpplugin.inl MW_LAYER_PLATFORM_EXPORT_PATH( wmdrmdlahttpplugin.inl ) ../inc/wmdrmdlauiplugin.h MW_LAYER_PLATFORM_EXPORT_PATH( wmdrmdlauiplugin.h ) ../inc/wmdrmdlauiplugin.inl MW_LAYER_PLATFORM_EXPORT_PATH( wmdrmdlauiplugin.inl ) +../inc/wmdrmdlahandler.h MW_LAYER_PLATFORM_EXPORT_PATH( wmdrmdlahandler.h ) \ No newline at end of file diff -r abec8b1bb37c -r 442486f870da drm_plat/camese_framework_api/inc/wmdrmdlahandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drm_plat/camese_framework_api/inc/wmdrmdlahandler.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2008-2010 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: Interface class for WMDRM DLA functionality +* +*/ + + +#ifndef C_WMDRMDLAHANDLER_H +#define C_WMDRMDLAHANDLER_H + +#include +#include + +class CWmDrmDlaHandlerImpl; + +/** + * WMDRM DLA Interface + * + * @lib wmdrmdla.lib + * @since S60 v9.1 + */ +NONSHARABLE_CLASS( CWmDrmDlaHandler ) : public CBase + { + +public: + + IMPORT_C static CWmDrmDlaHandler* NewL(); + IMPORT_C static CWmDrmDlaHandler* NewLC(); + + /** + * Destructor. + */ + virtual ~CWmDrmDlaHandler(); + + /** + * Checks if license acquisition for file is silent + * + * @param aFile wmdrm file + * @return ETrue if license acquisition is silent + * @leave KErrNotFound if there is no handler for the file + */ + IMPORT_C TBool SilentL( const RFile& aFile ); + + /** + * Acquire license based on the file handle + * + * @param aFile wmdrm file + * @param aContentUrl contains content URL on return. Can be NULL. + * If it's not NULL, it must be freed by caller. + * @param aHtmlData contains HTML data returned by license server on + * return. Can be NULL. + * If it's not NULL, it must be freed by caller. + * @leave KErrNotFound if there is no handler for the file + */ + IMPORT_C void AcquireLicenseL( const RFile& aFile, HBufC*& aContentUrl, + HBufC*& aHtmlData ); + + /** + * Acquire license based on the file handle, asynchronous version + * + * @param aFile wmdrm file + * @param aContentUrl contains content URL on completion. Can be NULL. + * If it's not NULL, it must be freed by caller. + * @param aHtmlData contains HTML data returned by license server on + * completion. Can be NULL. + * If it's not NULL, it must be freed by caller. + * @param aStatus Request status. On completion contains the error code. + */ + IMPORT_C void AcquireLicense( const RFile& aFile, HBufC*& aContentUrl, + HBufC*& aHtmlData, TRequestStatus& aStatus ); + + /** + * Acquire license based on the DRM Header + * + * @param aDrmHeader DRM Header + * @param aErrorUrl URL where error code is sent. Can be NULL. + * @param aContentUrl contains content URL on return. Can be NULL. + * If it's not NULL, it must be freed by caller. + * @param aHtmlData contains HTML data returned by license server on + * return. Can be NULL. + * If it's not NULL, it must be freed by caller. + * @leave KErrNotFound if there is no handler for the file + */ + IMPORT_C void AcquireLicenseFromDrmHeaderL( const TDesC8& aDrmHeader, + HBufC* aErrorUrl, + HBufC*& aContentUrl, + HBufC*& aHtmlData ); + + /** + * Acquire license based on the DRM Header, asynchronous version + * + * @param aDrmHeader DRM Header + * @param aErrorUrl URL where error code is sent. Can be NULL. + * @param aContentUrl contains content URL on completion. Can be NULL. + * If it's not NULL, it must be freed by caller. + * @param aHtmlData contains HTML data returned by license server on + * completion. Can be NULL. + * If it's not NULL, it must be freed by caller. + * @param aStatus Request status. On completion contains the error code. + */ + IMPORT_C void AcquireLicenseFromDrmHeader( const TDesC8& aDrmHeader, + HBufC* aErrorUrl, + HBufC*& aContentUrl, + HBufC*& aHtmlData, + TRequestStatus& aStatus ); + + /** + * Cancels ongoing license acquisition + * + */ + IMPORT_C void CancelLicenseAcquisition(); + + /** + * Handles metering certificate OTA + * + * @param aCertificate metering certificate + */ + IMPORT_C void ProcessMeteringCertificateL( const TDesC8& aCertificate ); + + /** + * Handles metering certificate OTA, asynchronous version + * + * @param aCertificate metering certificate + * @param aStatus Request status. On completion contains the error code. + */ + IMPORT_C void ProcessMeteringCertificate( const TDesC8& aCertificate, + TRequestStatus& aStatus ); + + /** + * Cancels ongoing metering + * + */ + IMPORT_C void CancelMetering(); + + /** + * Sets the IAP to be used in the HTTP transactions + * + * @param aIapId Internet Access Point id + */ + IMPORT_C void SetIapId( TInt aIapId ); + +protected: + +private: + + CWmDrmDlaHandler(); + + void ConstructL(); + +private: // data + + /** + * Implementation class + * Own. + */ + CWmDrmDlaHandlerImpl* iImpl; + + }; + +#endif // C_WMDRMDLAHANDLER_H diff -r abec8b1bb37c -r 442486f870da drm_plat/dcf_repository_api/inc/DcfRep.h --- a/drm_plat/dcf_repository_api/inc/DcfRep.h Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_plat/dcf_repository_api/inc/DcfRep.h Thu Jul 22 16:35:50 2010 +0100 @@ -23,7 +23,7 @@ // INCLUDES #include #include -#include +#include #include "DcfRepCli.h" // CONSTANTS // MACROS diff -r abec8b1bb37c -r 442486f870da drm_plat/drm_common_api/tsrc/data/mmc/DRM/content.dcf diff -r abec8b1bb37c -r 442486f870da drm_plat/drm_rights_api/tsrc/data/c/content.dcf diff -r abec8b1bb37c -r 442486f870da drm_plat/wmdrm_access_api/inc/wmdrmaccessecominterface.inl --- a/drm_plat/wmdrm_access_api/inc/wmdrmaccessecominterface.inl Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_plat/wmdrm_access_api/inc/wmdrmaccessecominterface.inl Thu Jul 22 16:35:50 2010 +0100 @@ -15,7 +15,7 @@ * wmdrmaccessecominterface.inl * */ -#include // for interface +#include // for interface // --------------------------------------------------------------------------- // CWmDrmAccessEcomInterface::NewL diff -r abec8b1bb37c -r 442486f870da drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccess.h --- a/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccess.h Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccess.h Thu Jul 22 16:35:50 2010 +0100 @@ -28,7 +28,9 @@ * Functionality * * @code -* // Way to use CWmDrmOtaAccess +* Only one asynchronous operation can be happening at a time. +* If another call for async operation is received, this will result in +* KErrInUse leave code. * * CWmDrmOtaAccess* access( CWmDrmOtaAccess::NewL() ); * delete access; @@ -104,6 +106,17 @@ */ IMPORT_C void HandleLicenseResponseL( const TDesC8& aResponse, TRequestStatus& aStatus ); + + + /** + * CancelAllAsync + * + * Cancel all async methods + * + * @return None + */ + IMPORT_C void CancelAllAsync(); + private: /** Default constructor */ @@ -116,3 +129,4 @@ }; #endif // _WMDRM_OTA_ACCESS_API_H_ + diff -r abec8b1bb37c -r 442486f870da drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.h --- a/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.h Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.h Thu Jul 22 16:35:50 2010 +0100 @@ -22,9 +22,9 @@ #include // Class declaration -// CWmDrmAccessEcomInterface -// ecom plugin interface for WM DRM access implementation -// @see CWmDrmAccess +// CWmDrmOtaAccessEcomInterface +// ecom plugin interface for WM DRM ota access implementation +// @see CWmDrmOtaAccess NONSHARABLE_CLASS( CWmDrmOtaAccessEcomInterface ) : public CBase { public: @@ -94,6 +94,16 @@ */ virtual void HandleLicenseResponseL( const TDesC8& aResponse, TRequestStatus& aStatus ) = 0; + + /** + * CancelAllAsync + * + * Cancel all async methods + * + * @return None + */ + virtual void CancelAllAsync() = 0; + private: // internal variable used on freeing ecom related resources @@ -101,4 +111,6 @@ }; #include "wmdrmotaaccessecominterface.inl" + #endif _WMDRMOTAACCESSECOMINTERFACE_H_ + diff -r abec8b1bb37c -r 442486f870da drm_pub/drm_helper_api/inc/Drmhelper.h --- a/drm_pub/drm_helper_api/inc/Drmhelper.h Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_pub/drm_helper_api/inc/Drmhelper.h Thu Jul 22 16:35:50 2010 +0100 @@ -63,7 +63,6 @@ class CAknGlobalNote; class CAknWaitDialog; class CDRMHelperInfoNoteWrapper; -class CSchemeHandler; class CMediatorEventProvider; // CLASS DECLARATION @@ -1575,8 +1574,6 @@ // Used to queue up global notes RPointerArray iNoteList; - CSchemeHandler* iSchemeHandler; - TBool iReturnCancel; // Used to send cancel events to cover ui diff -r abec8b1bb37c -r 442486f870da drm_pub/oma_drm_caf_agent_api/tsrc/bc/BCDRMCAFCAPS_exe/group/BCDRMCAFCAPS_exe.mmp --- a/drm_pub/oma_drm_caf_agent_api/tsrc/bc/BCDRMCAFCAPS_exe/group/BCDRMCAFCAPS_exe.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/BCDRMCAFCAPS_exe/group/BCDRMCAFCAPS_exe.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -32,12 +32,8 @@ /* Remove comments and replace 0x00000000 with correct secure id */ // SECUREID 0x00000000 -#if defined(__S60_) - MW_LAYER_SYSTEMINCLUDE -#else // __S60_ not defined - SYSTEMINCLUDE /epoc32/include - SYSTEMINCLUDE /epoc32/include/internal -#endif // __S60_ +MW_LAYER_SYSTEMINCLUDE + /* Source files */ SOURCEPATH ../src diff -r abec8b1bb37c -r 442486f870da drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/data/content.dcf diff -r abec8b1bb37c -r 442486f870da drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/group/DRM_CAF.mmp --- a/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/group/DRM_CAF.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/group/DRM_CAF.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -33,12 +33,8 @@ USERINCLUDE ../inc -#if defined(__S60_) - MW_LAYER_SYSTEMINCLUDE -#else // __S60_ not defined - SYSTEMINCLUDE /epoc32/include - SYSTEMINCLUDE /epoc32/include/internal -#endif // __S60_ +MW_LAYER_SYSTEMINCLUDE + SOURCEPATH ../src @@ -54,10 +50,6 @@ LANG SC - -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE /epoc32/include/caf LIBRARY apparc.lib LIBRARY avkon.lib diff -r abec8b1bb37c -r 442486f870da drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/group/DRM_CAF_nrm.mmp --- a/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/group/DRM_CAF_nrm.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/group/DRM_CAF_nrm.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -36,12 +36,9 @@ USERINCLUDE ../inc -#if defined(__S60_) - MW_LAYER_SYSTEMINCLUDE -#else // __S60_ not defined - SYSTEMINCLUDE /epoc32/include - SYSTEMINCLUDE /epoc32/include/internal -#endif // __S60_ + +MW_LAYER_SYSTEMINCLUDE + SOURCEPATH ../src diff -r abec8b1bb37c -r 442486f870da drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/inc/DRM_CAF.h --- a/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/inc/DRM_CAF.h Wed Jun 16 17:39:50 2010 +0100 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/inc/DRM_CAF.h Thu Jul 22 16:35:50 2010 +0100 @@ -38,8 +38,7 @@ #include #include #include -#include -//#include +#include #include #include diff -r abec8b1bb37c -r 442486f870da inc/DrmUtilityDmgrWrapper.h --- a/inc/DrmUtilityDmgrWrapper.h Wed Jun 16 17:39:50 2010 +0100 +++ b/inc/DrmUtilityDmgrWrapper.h Thu Jul 22 16:35:50 2010 +0100 @@ -20,10 +20,13 @@ #define CDRMUTILITYDMGRWRAPPER_H #include // RFs -#include #include // Roap::MRoapObserver #include // MAknProgressDialogCallback CAknProgressDialog +// download apis +#include +#include +#include namespace Roap { @@ -36,7 +39,8 @@ } class CDRMRights; class CEikProgressInfo; - +class DrmUtilityEventHandler; +class QDrmUtilityDmgrEventHandler; /** * Environment gate function @@ -67,7 +71,6 @@ */ class CDrmUtilityDmgrWrapper : public CActive, - public MHttpDownloadMgrObserver, public Roap::MRoapObserver, public MDrmUtilityDmgrWrapper, public MProgressDialogCallback @@ -105,18 +108,6 @@ HBufC8* GetErrorUrlL(); - - // from base class MHttpDownloadMgrObserver - - /** - * From MHttpDownloadMgrObserver. - * Handle download manager events - * - * @param aDownload the download - * @param aEvent the event - */ - void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); - // From Roap::MRoapObserver /** * ConnectionConfL @@ -252,6 +243,14 @@ * @param aButtonId ID of the button pressed */ void DialogDismissedL( TInt aButtonId ); + + /** + * Handle download manager events + * + * @param aEvent the event + */ + + void HandleDownloadEventL( WRT::DownloadEvent* aEvent ); protected: //from Cactive @@ -287,15 +286,22 @@ void DoHandleRoapTriggerL( TDownloadState aNextState ); void CompleteToState( TDownloadState aNextState, TInt aError ); + + void ProcessDownloadEventL( WRT::Download& aDownload, WRT::DownloadEvent& aEvent ); private: // data /** * Download manager session */ - RHttpDownloadMgr iDlMgr; + WRT::DownloadManager* iDlMgr; /** + * Download instance needs to be stored for handling signal slot mechanism + */ + WRT::Download* iDownload; + + /** * Used to make downloads synchronous */ CActiveSchedulerWait iWait; @@ -360,6 +366,8 @@ HBufC* iFileName; DRM::CDrmUtilityConnection* iConnection; + + QDrmUtilityDmgrEventHandler* iDrmUtilityDmgrEventHandler; }; #endif // CDRMUTILITYDMGRWRAPPER_H diff -r abec8b1bb37c -r 442486f870da inc/drmbrowserlauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/drmbrowserlauncher.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2004 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: API for QT browser launcher +* +*/ + + +#ifndef DRMBROWSERLAUNCHER_H +#define DRMBROWSERLAUNCHER_H + +// INCLUDES +#include +// DATA TYPES + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +namespace DRM +{ + + +/** +* API for QT browser launcher +* +* +* @lib drmbrowserlauncher.dll +* @since Symbian V4 +*/ +NONSHARABLE_CLASS( CDrmBrowserLauncher ): public CBase +{ + public: // Constructors and destructor + + /** + * Destructor. + * @since Symbian V4 + */ + ~CDrmBrowserLauncher(); + + /** + * Two-phased constructor. + * @since Symbian V4 + * + * @return New drmbrowserlauncher instace. + */ + IMPORT_C static CDrmBrowserLauncher* NewLC(); + + /** + * Two-phased constructor. + * @since Symbian V4 + * + * @return New drmbrowserlauncher instace. + */ + IMPORT_C static CDrmBrowserLauncher* NewL(); + + /** + * Static method for launching the Browser with a given URL. + * @since Symbian V4 + * @param &aUrl URL to be launched in browser. + */ + IMPORT_C void LaunchUrlL(TDesC &aUrl); + + private: + + /** + * Constructor. + * @since Symbian V4 + */ + CDrmBrowserLauncher(); + + /** + * Two-phased constructor second part. + * @since Symbian V4 + */ + void ConstructL(); + +}; + +} // namespace DRM + +#endif // DRMHELPERSESSION_H + +// End of File diff -r abec8b1bb37c -r 442486f870da inc/drmrightsdb.h --- a/inc/drmrightsdb.h Wed Jun 16 17:39:50 2010 +0100 +++ b/inc/drmrightsdb.h Thu Jul 22 16:35:50 2010 +0100 @@ -57,6 +57,7 @@ class CDRMRightsCleaner; class CDRMRightsServer; class CDcfRep; +class CDRMRightsServer; // FUNCTION PROTOTYPES @@ -91,7 +92,8 @@ static CDRMRightsDB* NewLC( RFs& aFs, const TDesC& aDatabasePath, const TDesC8& aKey, - const TDesC& aImei ); + const TDesC& aImei, + CDRMRightsServer* aServer ); /** * NewL @@ -110,7 +112,8 @@ static CDRMRightsDB* NewL( RFs& aFs, const TDesC& aDatabasePath, const TDesC8& aKey, - const TDesC& aImei ); + const TDesC& aImei, + CDRMRightsServer* aServer ); /** * Destructor @@ -327,6 +330,7 @@ */ CDRMRightsCleaner* DeleteExpiredPermissionsL( const TTime& aTime, TRequestStatus& aStatus ); + /** * NameContentL @@ -369,6 +373,21 @@ */ TBool DeleteExpiredL( const TFileName& aFileName, const TTime& aTime ); + + /** + * DeleteExpiredL + * + * Delete expired from the current file store + * + * @since 3.0 + * @param aFileName : name of the permission file store + * @param aTime : current time. + * @return TBool : ETrue if the file can be deleted + * EFalse if the file can't be deleted + */ + TBool DeleteExpiredL( const TFileName& aFileName, + const TTime& aTime, + const TDesC8& aContentId ); /** * GetUdtDataL @@ -507,7 +526,7 @@ /** * Default Constructor - First phase. */ - CDRMRightsDB( RFs& aFs ); + CDRMRightsDB( RFs& aFs, CDRMRightsServer* aServer ); /** * ConstructL @@ -675,6 +694,8 @@ // Time stamp of the last update operation TTime iLastUpdate; + + CDRMRightsServer* iRightsServer; }; #endif // DRMRIGHTSDB_H diff -r abec8b1bb37c -r 442486f870da inc/drmuidialogids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/drmuidialogids.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2010 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: Defines an enumeration for the DRM dialog IDs +*/ + + +#ifndef C_DRMUIDIALOGIDS_H +#define C_DRMUIDIALOGIDS_H + +// Enumeration for the dialog IDs to be launched. +enum TDrmUIDialogId + { + EQueryNoRightsObj, + EQueryFileLocked, // %U is filename. dialog to be implemented + EQueryFileLockedForSim, + EQueryRightsObjExpired, + EQueryFileWithNoRightsObj, // %U is filename. dialog to be implemented + EQueryNoUsage, + EQueryNoCount, + EQueryDeleteDRMFile, + EQueryMoveObjects, + EQueryCopyObjects, + EQuerySendUnprotectedObjs, + EQueryAccountUpdate, + EQueryRetryForLicence, + EQueryGetNewLicence, + EQueryConnectToActivate, // dialog to be implemented + EQueryOpenErrorUrl, // dialog to be implemented + EQueryLicenceValidUntil, // %U is expiration date. dialog to be implemented yet + EQueryValidForLimitedTime, // dialog to be implemented + EQueryUnlockRingToneForSim, // %U is filename. dialog to be implemented + EQueryGetRingToneLicence, // %U is filename. dialog to be implemented + EQueryUnlockMsgToneForSim, // %U is filename. dialgo to be implemented + EQueryGetMsgToneLicence, // %U is filename. dialog to be implemented + EQueryUnlockEmailToneForSim, // %U is filename. dialog to be implemented + EQueryGetEmailToneLicence, // %U is filename. dialog to be implemented + EQueryUseDefaultEmailTone, // %U is filename. dialog to be implemented + EQueryActivateIMToneLicence, // %U is filename. dialog to be implemented + EQueryUnlockCalToneForSim, // %U is filename. dialog to be implemented + EQueryGetCalToneLicence, // %U is filename. dialog to be implemented + + EConfObjLocked, + EConfUnsupportedObj, + EConfWaitingForLicence, + EConfDeleted, + EConfUnableToMove, + EConfUnableToCopy, + EConfLicenceExpired, + EConfFileDeleted, // %U is filename. dialog to be implemented + EConfForwardProtected, + EConfUnableToSend, + EConfViewRestriction, + EConfUnableToUse, // %U is start date of RO. dialog to be implemented + EConfUnableToDeregister, + EConfAccountNotRecognized, + EConfPhoneDeregistered, + EConfRegUpdateFailure, + EConfRegistrationUpdated, + EConfPhoneRegistered, + EConfRegistrationFailure, + EConfUnableToOpen, // dialog to be implemented + EConfLicenceNotReceived, // dialog to be implemented + EConfFileLockedForSim, + EConfNoAccessPoint, // dialog to be implemented + EConfConnectionFailed, // dialog to be implemented + EConfUnableToUnlock, // dialog to be implemented + EConfUseDefaultRingTone, // %U is filename. dialog to be implemented + EConfRingToneLicenceExpired, // %U is filename. dialog to be implemented + EConfUseDefaultMsgTone, // %U is filename. dialog to be implemented + EConfMsgToneLicenceExpired, // %U is filename. dialog to be implemented + EConfEmailToneLicenceExpired, // %U is filename. dialog to be implemented + EConfIMToneLicenceExpired, // %U is filename. dialog to be implemented + EConfUseDefaultCalTone, // %U is filename. dialog to be implemented + EConfCalToneExpired, // %U is filename. dialog to be implemented + + EProgDeregisteringPhone, // progress bar to be implemented + EProgAcquiringLicence, // progress bar to be implemented + EProgRegisteringPhone, // progress bar to be implemented + EProgUpdatingRegistration, // progress bar to be implemented + + ENoteRightsObjReceived, // popup + EUnusedId // The last ID + }; + +enum TDrmUiResultCode + { + ECancelled, + EOk + }; + +#endif // C_DRMUIDIALOGIDS_H + diff -r abec8b1bb37c -r 442486f870da inc/wmdrmclient.h --- a/inc/wmdrmclient.h Wed Jun 16 17:39:50 2010 +0100 +++ b/inc/wmdrmclient.h Thu Jul 22 16:35:50 2010 +0100 @@ -384,6 +384,18 @@ */ IMPORT_C TInt GetTime( TTime& aTime, TBool& aValid ); + + /** + * CommitData + * Commits any cached data to storage + * + * @return KErrNone if successful + * Otherwise Symbian OS error code + */ + + IMPORT_C TInt CommitData(); + + }; #endif diff -r abec8b1bb37c -r 442486f870da layers.sysdef.xml --- a/layers.sysdef.xml Wed Jun 16 17:39:50 2010 +0100 +++ b/layers.sysdef.xml Thu Jul 22 16:35:50 2010 +0100 @@ -9,6 +9,9 @@ + + + diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -467,7 +467,11 @@ case DRM::EDrmAllowedOutputs: if( dcf2 ) { - value = DRM::EDrmAllowAudioAnalog | DRM::EDrmAllowAudioBluetooth | DRM::EDrmAllowVideoMacroVision | DRM::EDrmAllowAudioFmTransmitter; + value = DRM::EDrmAllowAudioAnalog | + DRM::EDrmAllowAudioBluetooth | + DRM::EDrmAllowVideoMacroVision | + DRM::EDrmAllowAudioFmTransmitter | + DRM::EDrmAllowAudioUsb; } else { @@ -706,7 +710,11 @@ case DRM::EDrmAllowedOutputs: if( dcf2 ) { - value = DRM::EDrmAllowAudioAnalog | DRM::EDrmAllowAudioBluetooth | DRM::EDrmAllowVideoMacroVision | DRM::EDrmAllowAudioFmTransmitter; + value = DRM::EDrmAllowAudioAnalog | + DRM::EDrmAllowAudioBluetooth | + DRM::EDrmAllowVideoMacroVision | + DRM::EDrmAllowAudioFmTransmitter | + DRM::EDrmAllowAudioUsb; } else { diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -26,7 +26,7 @@ #include -#include +//#include #include "Oma2AgentContent.h" @@ -604,7 +604,10 @@ { TRequestStatus *ptr = &aStatus; TInt r; - HBufC* b = NULL; + //HBufC* b = NULL; + + r = KErrNotSupported; +/* CSchemeHandler* handler = NULL; r = iDcf->OpenPart(aUniqueId); @@ -623,6 +626,7 @@ delete b; } } +*/ User::RequestComplete(ptr, r); } diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005 - 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005 - 2010 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" @@ -972,27 +972,7 @@ // void COma2AgentManager::DisplayManagementInfoL() { - TUid KRightsManagerUid = TUid::Uid(0x101F85C7); - RWsSession wsSession; - RApaLsSession appArcSession; - TThreadId id; - - User::LeaveIfError(wsSession.Connect()); - CleanupClosePushL(wsSession); - TApaTaskList tasklist(wsSession); - TApaTask task = tasklist.FindApp(KRightsManagerUid); - if (task.Exists()) - { - task.SendMessage(TUid::Uid(KUidApaMessageSwitchOpenFileValue), - KNullDesC8); - } - else - { - User::LeaveIfError(appArcSession.Connect()); - appArcSession.StartDocument(_L("0"), KRightsManagerUid, id); - appArcSession.Close(); - } - CleanupStack::PopAndDestroy(); - } + User::Leave(KErrCANotSupported); + } // End of File diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/drmbackup/inc/DRMBackup.h --- a/omadrm/drmengine/drmbackup/inc/DRMBackup.h Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/drmbackup/inc/DRMBackup.h Thu Jul 22 16:35:50 2010 +0100 @@ -22,7 +22,7 @@ // INCLUDES #include // CBase -#include +#include // CONSTANTS diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/drmbackup/src/DRMBackupObserver.cpp --- a/omadrm/drmengine/drmbackup/src/DRMBackupObserver.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/drmbackup/src/DRMBackupObserver.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -21,7 +21,7 @@ #include #include #include -#include //for KUidBackupRestoreStatus +#include //for KUidBackupRestoreStatus #include "DRMBackupObserver.h" #include "DRMRightsServer.h" /* diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/CryptoPrep.flm --- a/omadrm/drmengine/group/CryptoPrep.flm Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/CryptoPrep.flm Thu Jul 22 16:35:50 2010 +0100 @@ -13,11 +13,6 @@ # Description: DRM Crypto Library build configuration # -# Bug 2707 - cryptoprep.flm changes the value of EPOCROOT -# -# TMPROOT:=$(subst \,/,$(EPOCROOT)) -# EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/ - CREATABLEPATH:=$(EXTENSION_ROOT)/../drmengine/drmcrypto/build CLEANTARGETS:=$(CREATABLEPATH)/cmlacrypto.cpp $(CREATABLEPATH)/omacrypto.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/DRMCommon.mmp --- a/omadrm/drmengine/group/DRMCommon.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/DRMCommon.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -37,8 +37,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/caf -SYSTEMINCLUDE /epoc32/include/libc + SOURCEPATH ../legacy/src SOURCE DRMCommon.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/DRM_BAT.mmp --- a/omadrm/drmengine/group/DRM_BAT.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/DRM_BAT.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -38,9 +38,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE /epoc32/include/caf + SOURCEPATH ../tsrc SOURCE DRM_BAT.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/DrmCrypto.mmp --- a/omadrm/drmengine/group/DrmCrypto.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/DrmCrypto.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -31,8 +31,6 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom SOURCEPATH ../utils/src SOURCE Base64.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/DrmKeyStorage.mmp --- a/omadrm/drmengine/group/DrmKeyStorage.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/DrmKeyStorage.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -30,8 +30,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom + SOURCEPATH ../keystorage/src SOURCE DrmKeyStorage.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/DrmParsers.mmp --- a/omadrm/drmengine/group/DrmParsers.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/DrmParsers.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -40,9 +40,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE /epoc32/include/caf + SOURCEPATH ../dm/src SOURCE Oma1DcfCreator.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/DrmRights.mmp --- a/omadrm/drmengine/group/DrmRights.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/DrmRights.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -38,9 +38,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE /epoc32/include/caf + SOURCEPATH ../ro/src SOURCE DrmRights.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/DrmServerInterfaces.mmp --- a/omadrm/drmengine/group/DrmServerInterfaces.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/DrmServerInterfaces.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -42,9 +42,6 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE /epoc32/include/caf SOURCEPATH ../server/src SOURCE DRMRightsClient.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/DrmStdKeyStorage.mmp --- a/omadrm/drmengine/group/DrmStdKeyStorage.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/DrmStdKeyStorage.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -30,8 +30,6 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom SOURCEPATH ../keystorage/src SOURCE DrmStdKeyStorage.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/OmaDrmAgent.mmp --- a/omadrm/drmengine/group/OmaDrmAgent.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/OmaDrmAgent.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -36,7 +36,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom + SOURCEPATH ../agentv2/src SOURCE Oma2Agent.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/ROAPHandler.mmp --- a/omadrm/drmengine/group/ROAPHandler.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/ROAPHandler.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -39,8 +39,6 @@ // Default system include paths for middleware layer modules. APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom SOURCEPATH ../roap/src diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/group/RightsServer.mmp --- a/omadrm/drmengine/group/RightsServer.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/group/RightsServer.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -27,8 +27,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/connect + USERINCLUDE ../server/inc USERINCLUDE ../agentv2/inc diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp --- a/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -576,7 +576,9 @@ for (i = 0; i < dir->Count(); i++) { ReadFileL(iFs, (*dir)[i].iName, cert); + CleanupStack::PushL( cert ); aCertChain.AppendL(cert); + CleanupStack::Pop( cert ); } CleanupStack::PopAndDestroy(); // dir LOG(_L("CDrmStdKeyStorage::GetCertificateChainL <-")); diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/notifier/inc/DRMMessageStorage.h --- a/omadrm/drmengine/notifier/inc/DRMMessageStorage.h Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/notifier/inc/DRMMessageStorage.h Thu Jul 22 16:35:50 2010 +0100 @@ -78,7 +78,7 @@ * @param : aMessage - Message related to the reques * @return None */ - void AddSession( CDRMNotifierSession* aSession ); + TInt AddSession( CDRMNotifierSession* aSession ); /** * UpdateMessage diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/notifier/src/DRMMessageStorage.cpp --- a/omadrm/drmengine/notifier/src/DRMMessageStorage.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/notifier/src/DRMMessageStorage.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -94,9 +94,9 @@ // CDRMMessageStorage::AddSession // ----------------------------------------------------------------------------- // -void CDRMMessageStorage::AddSession( CDRMNotifierSession* aSession ) +TInt CDRMMessageStorage::AddSession( CDRMNotifierSession* aSession ) { - iSessions.Append( aSession ); + return iSessions.Append( aSession ); }; // ----------------------------------------------------------------------------- @@ -218,7 +218,9 @@ } else { - iMessages.Append( message ); + CleanupStack::PushL( message ); + iMessages.AppendL ( message ); + CleanupStack::Pop( message ); CleanupStack::Pop(); // message->iData; CleanupStack::Pop(); // eventBuf CleanupStack::Pop(); // message diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/notifier/src/DRMNotifierSession.cpp --- a/omadrm/drmengine/notifier/src/DRMNotifierSession.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/notifier/src/DRMNotifierSession.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -142,7 +142,7 @@ if( !iIsListening || iMessageQueue.Count() ) { - iMessageQueue.Append( aMessage ); + iMessageQueue.AppendL ( aMessage ); return ETrue; } NotifyL( aMessage, EFalse ); @@ -274,8 +274,9 @@ if( !iIsInStorage ) { - iIsInStorage = ETrue; - iStorage->AddSession( this ); + + User::LeaveIfError( iStorage->AddSession( this ) ); + iIsInStorage = ETrue; } // Check if there are any notifications in queue if so process first one @@ -354,7 +355,7 @@ content->iContentID = NULL; content->iEventType = eventType; - iContentIDList.Append( content ); + iContentIDList.AppendL ( content ); aMessage.Complete( KErrNone ); } @@ -422,7 +423,7 @@ content->iContentID = contentID; content->iEventType = eventType; - iContentIDList.Append( content ); + iContentIDList.AppendL ( content ); CleanupStack::Pop(); aMessage.Complete( KErrNone ); diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/ro/inc/DRMProtectedRoParser.h --- a/omadrm/drmengine/ro/inc/DRMProtectedRoParser.h Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/ro/inc/DRMProtectedRoParser.h Thu Jul 22 16:35:50 2010 +0100 @@ -278,9 +278,8 @@ * @since Series 60 3.0 * @param aProtectedRo protected RO element * @return protected RO element, if namespace was not added NULL - */ - HBufC8* CDrmProtectedRoParser::AddRoapNamespaceL( - TDesC8& aProtectedRo ) const; + */ + HBufC8* AddRoapNamespaceL( TDesC8& aProtectedRo ) const; private: diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/ro/src/DrmRightsParser.cpp --- a/omadrm/drmengine/ro/src/DrmRightsParser.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/ro/src/DrmRightsParser.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -1113,7 +1113,7 @@ GetAttributeValueL( aAttributes, KIdAttribute ); iRights->iCurrentAsset->iIdRef = GetAttributeValueL( aAttributes, KIdRefAttribute ); - iRights->iAssets.Append( iRights->iCurrentAsset ); + iRights->iAssets.AppendL ( iRights->iCurrentAsset ); break; case EPermissionAssetState: iRights->iCurrentAsset = CParsedAsset::NewL(); @@ -1126,8 +1126,7 @@ break; case EPermissionState: iRights->iCurrentPermission = CParsedPermission::NewL(); - iRights->iPermissions.Append( - iRights->iCurrentPermission ); + iRights->iPermissions.AppendL ( iRights->iCurrentPermission ); iRights->iCurrentPermission->iOnExpiredUrl = GetAttributeValueL( aAttributes, KOnExpiredUrlAttribute ); break; diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/roap/src/RoapEng.cpp --- a/omadrm/drmengine/roap/src/RoapEng.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/roap/src/RoapEng.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -2366,7 +2366,7 @@ TPair pair; pair.iCid = aContentIDs[i]; pair.iTtid = aTransIDs[i]; - array.Append( pair ); + array.AppendL( pair ); } iDcfRep->SetTtid( array, status ); diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/roap/src/RoapSigner.cpp --- a/omadrm/drmengine/roap/src/RoapSigner.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/roap/src/RoapSigner.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -185,7 +185,9 @@ ptr.Copy( aResponse.Left( startPoint ) ); ptr.Append( aResponse.Right( aResponse.Length() - endPoint ) ); - iResponses.Append( tempMessage ); + CleanupStack::PushL( tempMessage ); + iResponses.AppendL ( tempMessage ); + CleanupStack::Pop( tempMessage ); iHash->Reset(); for ( i = 0; i < iResponses.Count(); i++ ) { @@ -290,7 +292,9 @@ CleanupStack::PopAndDestroy( s ); CleanupStack::PopAndDestroy( signature ); - iRequests.Append( r->Des().AllocL() ); + CleanupStack::PushL( r ); + iRequests.AppendL ( r->Des().AllocL() ); + CleanupStack::Pop( r ); return r; } diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/server/inc/DRMRightsServer.h --- a/omadrm/drmengine/server/inc/DRMRightsServer.h Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/server/inc/DRMRightsServer.h Thu Jul 22 16:35:50 2010 +0100 @@ -22,7 +22,7 @@ // INCLUDES #include #include -#include +#include #include "drmcommonclientserver.h" #include "DRMReplayCache.h" #include "drmmeteringdb.h" @@ -40,7 +40,20 @@ class CDRMBackup; class RMobilePhone; -// CLASS DECLARATION +// CLASS DECLARATIONS + +// Data Class: +NONSHARABLE_CLASS( CUsageUrl ) : public CBase + { + public: + CUsageUrl(); + virtual ~CUsageUrl(); + + public: // Data + HBufC8* iUrl; + TInt iRefCounter; + }; + /** * This class implements the DRM5 Rights Server functionality. @@ -49,7 +62,7 @@ * @since S60Rel2.5 */ NONSHARABLE_CLASS( CDRMRightsServer ) : public CServer2, public MWatcherObserver - { + { public: // Constructors and destructor /** @@ -162,6 +175,34 @@ */ void AddActiveCountConstraintL( const TDesC8& aContentId ); + + /** + * Checks if a content ID is in the list of currently consumed contents + * + * @since 5.2 + * @param aContentId content ID to search for + * @return Index or the Url if the content ID is in the list + * KErrNotFound if the content ID is not in the list + */ + TInt IsAccessingUrl( const TDesC8& aContentId ); + + /** + * Removes a content ID from the list of currently consumed contents + * + * @since 5.2 + * @param aContentId content ID to remove + */ + void RemoveAccessingUrl( const TDesC8& aContentId ); + + /** + * Adds a content ID to the list of currently consumed contents + * + * @since 5.2 + * @param aContentId content ID to add + */ + void AddAccessingUrlL( const TDesC8& aContentId ); + + /** * Import rights objects on startup * @@ -275,6 +316,7 @@ RDRMClockClient iClock; RPointerArray* iXOmaHeaders; RPointerArray iActiveCountConstraints; + RPointerArray iActiveUrls; HBufC* iIMEI; @@ -307,6 +349,7 @@ }; + #endif // CDRMRIGHTSSERVER_H // End of File diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/server/src/DRMDbSession.cpp --- a/omadrm/drmengine/server/src/DRMDbSession.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/server/src/DRMDbSession.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -1743,7 +1743,8 @@ // Count constraints are valid for the duration of the // session after they have been consumed earlier if ( !( iConsume && iConsume->CountConstraintActive() || - SERVER->HasActiveCountConstraint( *CID ) ) ) + SERVER->HasActiveCountConstraint( *CID ) || + SERVER->IsAccessingUrl( *CID ) != KErrNotFound ) ) { CDRMPermission* child( NULL ); HBufC8* uri( NULL ); diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/server/src/DRMRightsClient.cpp --- a/omadrm/drmengine/server/src/DRMRightsClient.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/server/src/DRMRightsClient.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -841,7 +841,9 @@ Mem::Copy( &roSize, ptr.Ptr()+offset, sizeof(TInt) ); offset += sizeof (TInt); ro = ptr.Mid(offset, roSize).AllocL(); - aRoList.Append(ro); + CleanupStack::PushL( ro ); + aRoList.AppendL (ro); + CleanupStack::Pop( ro ); offset += roSize; } CleanupStack::PopAndDestroy(); diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/server/src/DRMRightsServer.cpp --- a/omadrm/drmengine/server/src/DRMRightsServer.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/server/src/DRMRightsServer.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -294,6 +294,29 @@ // ============================ MEMBER FUNCTIONS =============================== +// CUsageUrl: + +//-------------------------------------------------------------------------- +// CUsageUrl::CUsageUrl +// Storage class default constructor +//-------------------------------------------------------------------------- +// +CUsageUrl::CUsageUrl() + { + } + +//-------------------------------------------------------------------------- +// CUsageUrl::~CUsageUrl +// Storage class destructor +//-------------------------------------------------------------------------- +// +CUsageUrl::~CUsageUrl() + { + delete iUrl; + } + +// CDRMRightsServer: + // ----------------------------------------------------------------------------- // CDRMRightsServer::NewLC // Two-phased constructor. @@ -354,6 +377,8 @@ delete iNotifier; iNotifier = NULL; } + iActiveUrls.ResetAndDestroy(); + //An empty semaphore RSemaphore semaphore; } @@ -599,13 +624,13 @@ #ifndef RD_MULTIPLE_DRIVE - iDb = CDRMRightsDB::NewL( iFs, KRightsDir, key, *iIMEI ); + iDb = CDRMRightsDB::NewL( iFs, KRightsDir, key, *iIMEI, const_cast(this) ); #else //RD_MULTIPLE_DRIVE tempPath.Format( KRightsDir, (TUint)driveLetter ); - iDb = CDRMRightsDB::NewL( iFs, tempPath, key, *iIMEI ); + iDb = CDRMRightsDB::NewL( iFs, tempPath, key, *iIMEI, const_cast(this) ); #endif @@ -1337,6 +1362,85 @@ } } + + +// ----------------------------------------------------------------------------- +// CDRMRightsServer::IsAccessingUrl +// Add ID to count constraint list +// ----------------------------------------------------------------------------- +// +TInt CDRMRightsServer::IsAccessingUrl( const TDesC8& aContentId ) + { + for( TInt i = 0; i < iActiveUrls.Count(); i++ ) + { + if( !iActiveUrls[i]->iUrl->Compare( aContentId ) ) + { + return i; + } + } + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// CDRMRightsServer::RemoveAccessingUrl +// Add ID to count constraint list +// ----------------------------------------------------------------------------- +// +void CDRMRightsServer::RemoveAccessingUrl( const TDesC8& aContentId ) + { + CUsageUrl* usage = NULL; + TInt index = KErrNotFound; + + index = IsAccessingUrl( aContentId ); + + if( index != KErrNotFound ) + { + // If there are negative or 0 values in the list for some reason + // remove them + if( iActiveUrls[index]->iRefCounter <= 1 ) + { + usage = iActiveUrls[index]; + iActiveUrls.Remove( index ); + delete usage; + } + else + { + iActiveUrls[index]->iRefCounter--; + } + } + } + +// ----------------------------------------------------------------------------- +// CDRMRightsServer::AddAccessingUrlL +// Add ID to count constraint list +// ----------------------------------------------------------------------------- +// +void CDRMRightsServer::AddAccessingUrlL( const TDesC8& aContentId ) + { + CUsageUrl* usage = NULL; + TInt index = KErrNotFound; + + index = IsAccessingUrl( aContentId ); + + if( index == KErrNotFound ) + { + usage = new ( ELeave ) CUsageUrl(); + CleanupStack::PushL( usage ); + usage->iUrl = aContentId.AllocL(); + usage->iRefCounter = 1; + iActiveUrls.AppendL( usage ); + CleanupStack::Pop( usage ); + } + else + { + usage = iActiveUrls[index]; + usage->iRefCounter++; + } + } + + + + // ----------------------------------------------------------------------------- // CDRMRightsServer::StopWatchingL // Delete the watchers @@ -1425,6 +1529,8 @@ } #endif + + // ========================== OTHER EXPORTED FUNCTIONS ========================= diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/server/src/drmconsume.cpp --- a/omadrm/drmengine/server/src/drmconsume.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/server/src/drmconsume.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -140,6 +140,12 @@ CDRMConsume::~CDRMConsume() { DRMLOG( _L( "CDRMConsume::~" ) ); + + if( iURI ) + { + SERVER->RemoveAccessingUrl( *iURI ); + } + TInt error( KErrNone ); if( IsActive() ) @@ -203,6 +209,8 @@ { iParentId = aParentId->AllocL(); } + + SERVER->AddAccessingUrlL( aURI ); } // ------------------------------------------------------------------------ diff -r abec8b1bb37c -r 442486f870da omadrm/drmengine/server/src/drmrightsdb.cpp --- a/omadrm/drmengine/server/src/drmrightsdb.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmengine/server/src/drmrightsdb.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -45,6 +45,7 @@ #include "DrmKeyStorage.h" #include "utf.h" // charconv, ConvertFromUnicodeToUtf8L #include "drmlog.h" +#include "DRMRightsServer.h" #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL #include "DRMClockClient.h" @@ -161,10 +162,11 @@ // might leave. // ----------------------------------------------------------------------------- // -CDRMRightsDB::CDRMRightsDB( RFs& aFs ) : +CDRMRightsDB::CDRMRightsDB( RFs& aFs, CDRMRightsServer* aServer ) : iFileServer( aFs ), iImei( NULL ), - iLastUpdate( Time::NullTTime() ) + iLastUpdate( Time::NullTTime() ), + iRightsServer( aServer ) { }; @@ -215,9 +217,10 @@ CDRMRightsDB* CDRMRightsDB::NewLC( RFs& aFs, const TDesC& aDatabasePath, const TDesC8& aKey, - const TDesC& aImei ) + const TDesC& aImei, + CDRMRightsServer* aServer ) { - CDRMRightsDB* self = new( ELeave ) CDRMRightsDB( aFs ); + CDRMRightsDB* self = new( ELeave ) CDRMRightsDB( aFs, aServer ); CleanupStack::PushL( self ); self->ConstructL( aDatabasePath, aKey, aImei ); @@ -232,9 +235,10 @@ CDRMRightsDB* CDRMRightsDB::NewL( RFs& aFs, const TDesC& aDatabaseFile, const TDesC8& aKey, - const TDesC& aImei ) + const TDesC& aImei, + CDRMRightsServer* aServer ) { - CDRMRightsDB* self = NewLC( aFs, aDatabaseFile, aKey, aImei ); + CDRMRightsDB* self = NewLC( aFs, aDatabaseFile, aKey, aImei, aServer ); CleanupStack::Pop(); return self; @@ -315,7 +319,7 @@ } // Delete expired: - TRAP_IGNORE( deleteAllowed = DeleteExpiredL( path, time ) ); + TRAP_IGNORE( deleteAllowed = DeleteExpiredL( path, time, aContentID ) ); // Check if it's possible to delete the file as well if( deleteAllowed ) @@ -1074,6 +1078,77 @@ // ----------------------------------------------------------------------------- +// CDRMRightsDB::DeleteExpiredL +// ----------------------------------------------------------------------------- +// +TBool CDRMRightsDB::DeleteExpiredL( const TFileName& aFileName, + const TTime& aTime, + const TDesC8& aContentId ) + { + CDRMRightsData* rights = NULL; + TInt amountLeft = -1; + TBool retVal = EFalse; + TBool parents = EFalse; + + DRMLOG( _L( "CDRMRightsDB::DeleteExpiredL(2) ->" ) ); + + // if there is a consumption session ongoing, we can't delete it at all + // or the decryption will not function properly after pause etc + if( iRightsServer->IsAccessingUrl( aContentId ) != KErrNotFound ) + { + return EFalse; + } + + // Indicate that the DB is updated + iLastUpdate.HomeTime(); + + // Open the rights file + DRMLOG( _L("Opening the file")); + rights = CDRMRightsData::OpenLC( aFileName, iFileServer ); + + DRMLOG( _L("Running Delete")); + amountLeft = rights->DeleteExpiredPermissionsL( aTime, parents ); + + DRMLOG2( _L("Checking for left RO:s %d"), amountLeft ); + + // See if any permissions are left if not check if the whole file + // can be proposed to be deleted or not, Java files require uninstallation + // so those need to be checked + if( !amountLeft && !parents ) + { + // get the common data + const CDRMCommonData* common= rights->GetCommonDataL(); + + // If it is a java file, dont allow deletion + if( !common->ContentName().Right(4).CompareF(KJavaExtension) ) + { + DRMLOG( _L("Is java file, do not delete")); + retVal = EFalse; + } + else if( !common->ContentName().Right(4).CompareF(KSISExtension) ) + { + DRMLOG( _L("Is an installation package, do not delete")); + retVal = EFalse; + } + else + { + retVal = ETrue; + } + } + CleanupStack::PopAndDestroy(); // rights + + DRMLOG( _L( "CDRMRightsDB::DeleteExpiredL <-" ) ); + + if( iRightsServer->HasActiveCountConstraint( aContentId )) + { + retVal = EFalse; + } + + return retVal; + } + + +// ----------------------------------------------------------------------------- // CDRMRightsDB::GetUdtDataLC // ----------------------------------------------------------------------------- // diff -r abec8b1bb37c -r 442486f870da omadrm/drmhelper/group/Drmhelper.mmp --- a/omadrm/drmhelper/group/Drmhelper.mmp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2003-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: Project definition file for DRMHelper -* -*/ - -#include -#include - -TARGET DRMHelper.dll -TARGETTYPE dll -UID 0x1000008D 0x101F8647 - -CAPABILITY CAP_GENERAL_DLL DRM -VENDORID VID_DEFAULT - -#ifdef __DRM -SOURCE ../src/drmhelper.cpp -SOURCE ../src/ConsumeData.cpp -SOURCE ../src/RDRMHelper.cpp -SOURCE ../src/DRMHelperGlobalNoteWrapper.cpp -SOURCE ../src/DRMHelperDownloadManager.cpp -SOURCE ../src/DRMHelperInfoNoteWrapper.cpp -#else -SOURCE ../src/DRMHelperStub.cpp -SOURCE ../src/RDRMHelperStub.cpp -SOURCE ../src/DRMHelperGlobalNoteWrapper.cpp -#endif -SOURCE ../src/DRMHelperDll.cpp - -START RESOURCE Drmhelper.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -USERINCLUDE ../inc -USERINCLUDE ../../drmengine/server/inc -USERINCLUDE ../../drmengine/roap/inc -USERINCLUDE ../../drmengine/roapstorage/inc -USERINCLUDE ../../../inc // ADo level inc dir - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom // needed because of SchemeHandler -// needed for drmhelpersecondarydisplay.h - -LIBRARY euser.lib -LIBRARY commonengine.lib -LIBRARY cone.lib -LIBRARY flogger.lib -LIBRARY aknnotify.lib -LIBRARY apparc.lib // for launching rights mgr ui embedded -LIBRARY avkon.lib - -#ifdef __DRM -LIBRARY DrmParsers.lib -LIBRARY DrmDcf.lib -LIBRARY DrmRights.lib -LIBRARY DrmServerInterfaces.lib -LIBRARY DRMCommon.lib -LIBRARY eikdlg.lib -LIBRARY StarterClient.lib -LIBRARY efsrv.lib // for launching rights mgr ui embedded -LIBRARY APGRFX.lib -LIBRARY WS32.lib -LIBRARY dcfrep.lib -LIBRARY centralrepository.lib - -LIBRARY ServiceHandler.lib - -LIBRARY caf.lib -LIBRARY cafutils.lib -LIBRARY charconv.lib -LIBRARY ecom.lib // for scheme handling -LIBRARY cmmanager.lib - -LIBRARY estor.lib // Cover Display -LIBRARY featmgr.lib - -LIBRARY RoapHandler.lib -LIBRARY mediatorclient.lib - -#ifdef RD_MULTIPLE_DRIVE -LIBRARY platformenv.lib -#endif - -#endif - - -#if defined(EABI) -deffile ../EABI/ -#elif defined( WINSCW ) -deffile ../BWINSCW/ -#elif defined( WINS ) -deffile ../bwins/ -#else -deffile ../bmarm/ -#endif - -SMPSAFE diff -r abec8b1bb37c -r 442486f870da omadrm/drmhelper/group/bld.inf --- a/omadrm/drmhelper/group/bld.inf Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2003 - 2010 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: Project definition for DRMHelper -* -*/ - - - -PRJ_PLATFORMS -DEFAULT -ARMI - -PRJ_MMPFILES - -DRMHelper.mmp - -// End of File - diff -r abec8b1bb37c -r 442486f870da omadrm/drmhelper/group/drmhelper.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmhelper/group/drmhelper.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,130 @@ + +# +# Copyright (c) 2010 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: +# + +TEMPLATE = lib +TARGET = DRMHelper + +IncludeBlock = \ + "$${LITERAL_HASH}include " \ + "$${LITERAL_HASH}include " + +MMP_RULES += IncludeBlock + +SrcIfdefBlock = \ + "$${LITERAL_HASH}ifdef __DRM" \ + "SOURCE ../src/drmhelper.cpp" \ + "SOURCE ../src/ConsumeData.cpp" \ + "SOURCE ../src/RDRMHelper.cpp" \ + "SOURCE ../src/DRMHelperGlobalNoteWrapper.cpp" \ + "SOURCE ../src/DRMHelperDownloadManager.cpp" \ + "SOURCE ../src/DRMHelperInfoNoteWrapper.cpp" \ + "$${LITERAL_HASH}else" \ + "SOURCE ../src/DRMHelperStub.cpp" \ + "SOURCE ../src/RDRMHelperStub.cpp" \ + "SOURCE ../src/DRMHelperGlobalNoteWrapper.cpp" \ + "$${LITERAL_HASH}endif" \ + "SOURCE ../src/DRMHelperDll.cpp" + +MMP_RULES += SrcIfdefBlock + +symbian: { + TARGET.CAPABILITY = CAP_GENERAL_DLL DRM + TARGET.VID = VID_DEFAULT + TARGET.UID3 = 0x101F8647 + TARGET.EPOCALLOWDLLDATA = 1 + + INCLUDEPATH += ../inc + INCLUDEPATH += ../../drmengine/server/inc + INCLUDEPATH += ../../drmengine/roap/inc + INCLUDEPATH += ../../drmengine/roapstorage/inc + INCLUDEPATH += ../../../inc // ADo level inc dir + INCLUDEPATH += /epoc32/include/platform/mw/cwrt + + #// Default system include paths for middleware layer modules. + INCLUDEPATH += APP_LAYER_SYSTEMINCLUDE + + # needed because of SchemeHandler + INCLUDEPATH += /epoc32/include/ecom + + # needed for drmhelpersecondarydisplay.h + + LIBS += -leuser + LIBS += -lcommonengine + LIBS += -lcone + LIBS += -lflogger + LIBS += -laknnotify + LIBS += -lapparc // for launching rights mgr ui embedded + LIBS += -lavkon + LIBS += -ldrmbrowserlauncher + + IfdefLibBlock = \ + "$${LITERAL_HASH}ifdef __DRM" \ + "LIBRARY DrmParsers.lib" \ + "LIBRARY DrmDcf.lib" \ + "LIBRARY DrmRights.lib" \ + "LIBRARY DrmServerInterfaces.lib" \ + "LIBRARY DRMCommon.lib" \ + "LIBRARY eikdlg.lib" \ + "LIBRARY StarterClient.lib" \ + "LIBRARY efsrv.lib // for launching rights mgr ui embedded" \ + "LIBRARY APGRFX.lib" \ + "LIBRARY WS32.lib" \ + "LIBRARY dcfrep.lib" \ + "LIBRARY centralrepository.lib" \ + "LIBRARY ServiceHandler.lib" \ + "LIBRARY caf.lib" \ + "LIBRARY cafutils.lib" \ + "LIBRARY charconv.lib" \ + "LIBRARY ecom.lib // for scheme handling" \ + "LIBRARY cmmanager.lib" \ + "LIBRARY estor.lib // Cover Display" \ + "LIBRARY featmgr.lib" \ + "LIBRARY RoapHandler.lib" \ + "LIBRARY mediatorclient.lib" \ + "$${LITERAL_HASH}ifdef RD_MULTIPLE_DRIVE" \ + "LIBRARY platformenv.lib" \ + "$${LITERAL_HASH}endif" \ + "$${LITERAL_HASH}endif" + + MMP_RULES += IfdefLibBlock + + + ResourceBlock = \ + "START RESOURCE Drmhelper.rss" \ + "HEADER" \ + "TARGETPATH RESOURCE_FILES_DIR" \ + "LANGUAGE_IDS" \ + "END" + + MMP_RULES += ResourceBlock + + defBlock = \ + "$${LITERAL_HASH}if defined(ARMCC)" \ + "DEFFILE ../eabi/" \ + "$${LITERAL_HASH}elif defined( WINSCW )" \ + "DEFFILE ../bwinscw/" \ + "$${LITERAL_HASH}elif defined( WINS )" \ + "DEFFILE ../bwins/" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bmarm/" \ + "$${LITERAL_HASH}endif" + + MMP_RULES += defBlock + + MMP_RULES -= "OPTION_REPLACE ARMCC --export_all_vtbl // don't use --export_all_vtbl" + } + diff -r abec8b1bb37c -r 442486f870da omadrm/drmhelper/src/drmhelper.cpp --- a/omadrm/drmhelper/src/drmhelper.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmhelper/src/drmhelper.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -59,12 +59,12 @@ #include -#include // for handling URLs #include "DRMHelperServer.h" #include "ConsumeData.h" #include "DRMTypes.h" #include "DRMClockClient.h" #include "DRMPointerArray.h" +#include #include // for secondary display support #include @@ -862,7 +862,6 @@ FeatureManager::UnInitializeLib(); - delete iSchemeHandler; delete iEventProvider; } @@ -5549,25 +5548,14 @@ i = 0; } - CSchemeHandler* schemeHandler( CSchemeHandler::NewL( ptr.Mid( i ) ) ); - CleanupStack::PushL( schemeHandler ); - if ( iUseCoeEnv ) - { - // launch embedded - schemeHandler->Observer( this ); - schemeHandler->HandleUrlEmbeddedL(); - CleanupStack::Pop( schemeHandler ); - iSchemeHandler = schemeHandler; - iWait.Start(); - } - else - { - // no CoeEnv, launch standalone with scheme app - schemeHandler->HandleUrlStandaloneL(); - CleanupStack::PopAndDestroy( schemeHandler ); - } - schemeHandler = NULL; - + // convert given URL to QUrl format + DRM::CDrmBrowserLauncher* browserLauncher = DRM::CDrmBrowserLauncher::NewLC(); + + browserLauncher->LaunchUrlL(ptr); + + CleanupStack::PopAndDestroy(); // browserLauncher + + // delete newUrl if needed if ( newUrl ) { @@ -7048,17 +7036,11 @@ // void CDRMHelper::HandleServerAppExit( TInt aReason ) { - if ( aReason == EAknCmdExit && !iSchemeHandler ) + if ( aReason == EAknCmdExit ) { CAknEnv::RunAppShutter(); } - if ( iSchemeHandler ) - { - delete iSchemeHandler; - iSchemeHandler = NULL; - } - if ( iWait.IsStarted() ) { iWait.AsyncStop(); diff -r abec8b1bb37c -r 442486f870da omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp --- a/omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -26,7 +26,6 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc USERINCLUDE ../inc USERINCLUDE ../../../inc // ADo level inc dir diff -r abec8b1bb37c -r 442486f870da omadrm/drmlicensemanager/group/DRMLicenseManager.mmp --- a/omadrm/drmlicensemanager/group/DRMLicenseManager.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmlicensemanager/group/DRMLicenseManager.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -26,7 +26,6 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc USERINCLUDE ../inc USERINCLUDE ../../../inc // ADo level inc dir diff -r abec8b1bb37c -r 442486f870da omadrm/drmlicensemanager/group/drm_lm_bat.mmp --- a/omadrm/drmlicensemanager/group/drm_lm_bat.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmlicensemanager/group/drm_lm_bat.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -23,7 +23,6 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc USERINCLUDE ../inc USERINCLUDE ../../../inc // ADo level inc dir diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmfilter/group/HTTPFilterDRM.mmp --- a/omadrm/drmplugins/drmfilter/group/HTTPFilterDRM.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmfilter/group/HTTPFilterDRM.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -35,7 +35,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom + SOURCEPATH ../data diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp --- a/omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -518,8 +518,11 @@ /** * */ - iDataSups.Append( drmData ); + CleanupStack::PushL( drmData ); + iDataSups.AppendL ( drmData ); + CleanupStack::Pop( drmData ); response.SetBody( *drmData ); + // change the mime type to "application/vnd.oma.drm.content" headers.RemoveField( fieldNameStr ); @@ -566,7 +569,9 @@ = CHTTPFilterDRMDataSupplier::NewL( aTrans.Id(), response.Body(), const_cast ( this ) ); - iDataSups.Append( drmData ); + CleanupStack::PushL( drmData ); + iDataSups.AppendL ( drmData ); + CleanupStack::Pop( drmData ); } } @@ -662,7 +667,10 @@ User::Leave( KErrUnknown ); } - iDataSups.Append( drmData ); + CleanupStack::PushL( drmData ); + iDataSups.AppendL ( drmData ); + CleanupStack::Pop( drmData ); + response.SetBody( *drmData ); /// diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrecognizer/group/RecDRM.mmp --- a/omadrm/drmplugins/drmrecognizer/group/RecDRM.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmrecognizer/group/RecDRM.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -32,7 +32,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE -systeminclude /epoc32/include/ecom + source RecDRM.cpp diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrecognizer/src/101F51F4.RSS --- a/omadrm/drmplugins/drmrecognizer/src/101F51F4.RSS Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmrecognizer/src/101F51F4.RSS Thu Jul 22 16:35:50 2010 +0100 @@ -16,7 +16,7 @@ */ -#include +#include RESOURCE REGISTRY_INFO r_registry { dll_uid = 0x101F51F4; diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/group/bld.inf --- a/omadrm/drmplugins/drmrohandler/group/bld.inf Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2002 - 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: Information required for building the required abld.bat -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../loc/rohandler.loc MW_LAYER_LOC_EXPORT_PATH( rohandler.loc ) - -PRJ_MMPFILES - -#ifdef __DRM_FULL -CRohandler.mmp -#endif - -// End of File diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/group/crohandler.mmp --- a/omadrm/drmplugins/drmrohandler/group/crohandler.mmp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2002-2009 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: This is project specification file for the rohandler.dll -* -*/ - - -#include - -TARGET RoHandler.dll -targettype PLUGIN -VENDORID VID_DEFAULT -// uid2 specifies an ECom dll -// uid3 specifies a unique identifier -UID 0x10009D8D 0x101F7B92 -CAPABILITY CAP_ECOM_PLUGIN DRM - -SOURCEPATH ../src -SOURCE CRoHandler.cpp -SOURCE StringResourceReader.cpp -SOURCE rohandlerdmgrwrapper.cpp - -START RESOURCE 101F7B92.rss -TARGET RoHandler - -END - -#include - -START RESOURCE RoHandler.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - - -USERINCLUDE ../inc -USERINCLUDE ../../../drmengine/roap/inc -USERINCLUDE ../../drmromtm/client/inc -USERINCLUDE ../../../../inc // ADo level inc dir - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE - -LIBRARY DrmParsers.lib -LIBRARY DrmDcf.lib -LIBRARY DrmRights.lib -LIBRARY DrmServerInterfaces.lib -LIBRARY drmroapwbxmlparser.lib // ROAP Wbxml to XML parsers - -LIBRARY centralrepository.lib // Browser default AP -LIBRARY cmmanager.lib -LIBRARY DownloadMgr.lib - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY RoapHandler.lib -LIBRARY WapPushUtils.lib -LIBRARY msgs.lib // for MMsvSessionObserver - -LIBRARY efsrv.lib // RFs -LIBRARY inetprotutil.lib // TUri16 and so on -LIBRARY bafl.lib // RResourceFile -LIBRARY flogger.lib -LIBRARY sysutil.lib // SysUtil -LIBRARY esock.lib - -#ifdef RD_MULTIPLE_DRIVE -LIBRARY platformenv.lib -#endif - -SMPSAFE diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/group/rohandler.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/group/rohandler.pri Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,27 @@ +# +# Copyright (c) 2010 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: This is project specification file for the rohandler.dll +# + +# Input +HEADERS += ../inc/CRoHandler.h \ + ../inc/RoHandlerStringResourceReader.h \ + ../inc/rohandlerdmgrwrapper.h \ + ../inc/qrohandlerdmgreventhandler.h + +SOURCES += ../src/CRoHandler.cpp \ + ../src/RoHandlerStringResourceReader.cpp \ + ../src/rohandlerdmgrwrapper.cpp \ + ../src/qrohandlerdmgreventhandler.cpp + diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/group/rohandler.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/group/rohandler.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,102 @@ +# +# Copyright (c) 2010 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: This is project specification file for the rohandler.dll +# + +include ( rohandler.pri ) + +IncludeBlock = \ + "$${LITERAL_HASH}include " \ + "$${LITERAL_HASH}include " + +MMP_RULES += IncludeBlock + +TEMPLATE = lib +TARGET = RoHandler +MMP_RULES += "TARGETTYPE plugin" + +symbian: { + TARGET.CAPABILITY = CAP_ECOM_PLUGIN DRM + TARGET.VID = VID_DEFAULT + TARGET.UID2 = 0x10009D8D + TARGET.UID3 = 0x101F7B92 + TARGET.EPOCALLOWDLLDATA = 1 + INCLUDEPATH += ../inc + INCLUDEPATH += ../../../drmengine/roap/inc + INCLUDEPATH += ../../drmromtm/client/inc + INCLUDEPATH += ../../../../inc // ADo level inc dir + INCLUDEPATH += /epoc32/include/platform/mw/cwrt + + LIBS += -lDrmParsers + LIBS += -lDrmDcf + LIBS += -lDrmRights + LIBS += -lDrmServerInterfaces + LIBS += -ldrmroapwbxmlparser // ROAP Wbxml to XML parsers + LIBS += -lcentralrepository // Browser default AP + LIBS += -lcmmanager + LIBS += -lWrtDownloadMgr + LIBS += -leuser + LIBS += -lecom + LIBS += -lRoapHandler + LIBS += -lWapPushUtils + LIBS += -lmsgs // for MMsvSessionObserver + + LIBS += -lefsrv + LIBS += -linetprotutil // TUri16 and so on + LIBS += -lbafl // RResourceFile + LIBS += -lflogger + LIBS += -lsysutil // SysUtil + LIBS += -lesock + + ResourceBlock1 = \ + "START RESOURCE 101F7B92.rss" \ + "TARGET RoHandler" \ + "END" + + ResourceBlock2 = \ + "START RESOURCE RoHandler.rss" \ + "HEADER" \ + "TARGETPATH RESOURCE_FILES_DIR" \ + "LANGUAGE_IDS" \ + "END" + + MMP_RULES += ResourceBlock1 + MMP_RULES += ResourceBlock2 + + IfdefLibBlock = \ + "$${LITERAL_HASH}ifdef RD_MULTIPLE_DRIVE" \ + "LIBRARY platformenv.lib" \ + "$${LITERAL_HASH}endif" + + MMP_RULES += IfdefLibBlock + + MWIncPath = \ + "// Default system include paths for middleware layer modules." \ + "MW_LAYER_SYSTEMINCLUDE" \ + + MMP_RULES += MWIncPath + + SMPSafeBlock = "SMPSAFE" + + MMP_RULES += SMPSafeBlock + + BLD_INF_RULES.prj_exports += "../loc/rohandler.loc MW_LAYER_LOC_EXPORT_PATH( rohandler.loc )" + + defBlock = " " + + MMP_RULES += defBlock + + + } + diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/inc/RoHandlerStringResourceReader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/inc/RoHandlerStringResourceReader.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2010 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: +* Declaration of CRoHandlerStringResourceReader. +* +* +*/ + + +#ifndef ROHANDLERSTRINGRESOURCEREADER_H +#define ROHANDLERSTRINGRESOURCEREADER_H + +// INCLUDE FILES + +#include +#include +#include + +// FORWARD DECLARATIONS + +class RFs; + +// CLASS DECLARATION + +/** +* Utility class that helps reading string resources without CONE. +* Not intended for derivation. +*/ +class CRoHandlerStringResourceReader : public CBase + { + public: // Constructors and destructor + + CRoHandlerStringResourceReader( RFs& aFs, const TDesC& aRscFileWithPathAndDrive ); + + ~CRoHandlerStringResourceReader(); + + public: // New functions + + /** + * Return a given string from resource. + * @param aResId Resource ID. + * @return See above. + */ + HBufC* AllocReadResourceL( TInt aResId ); + + private: // New functions + + void InitializeL(); + + private: // Data members + + RFs& iFs; ///< File server session. + TBuf<256> iRscFileName; + RResourceFile iResourceFile; + TBool iInitialized; + }; + +#endif // ROHANDLERSTRINGRESOURCEREADER_H + +// End of file. diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/inc/StringResourceReader.h --- a/omadrm/drmplugins/drmrohandler/inc/StringResourceReader.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Declaration of CStringResourceReader. -* -* -*/ - - -#ifndef STRINGRESOURCEREADER_H -#define STRINGRESOURCEREADER_H - -// INCLUDE FILES - -#include -#include -#include - -// FORWARD DECLARATIONS - -class RFs; - -// CLASS DECLARATION - -/** -* Utility class that helps reading string resources without CONE. -* Not intended for derivation. -*/ -class CStringResourceReader : public CBase - { - public: // Constructors and destructor - - CStringResourceReader( RFs& aFs, const TDesC& aRscFileWithPathAndDrive ); - - ~CStringResourceReader(); - - public: // New functions - - /** - * Return a given string from resource. - * @param aResId Resource ID. - * @return See above. - */ - HBufC* AllocReadResourceL( TInt aResId ); - - private: // New functions - - void InitializeL(); - - private: // Data members - - RFs& iFs; ///< File server session. - TBuf<256> iRscFileName; - RResourceFile iResourceFile; - TBool iInitialized; - }; - -#endif // STRINGRESOURCEREADER_H - -// End of file. diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/inc/qrohandlerdmgreventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/inc/qrohandlerdmgreventhandler.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2010 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: +* +*/ + + +#ifndef QROHANDLERDMGREVENTHANDLER_H +#define QROHANDLERDMGREVENTHANDLER_H + +#include + +namespace WRT + { + class Download; + class DownloadEvent; + } + +class CRoHandlerDMgrWrapper; + +class QRoHandlerDMgrEventHandler : public QObject + { + Q_OBJECT + + public: + QRoHandlerDMgrEventHandler( CRoHandlerDMgrWrapper& aRoHandlerDMgrWrapper , WRT::Download& aDownload ); + + private slots: + /** + * Handle download manager events + * + * @param aEvent the event + */ + void HandleDownloadEventL( WRT::DownloadEvent* aEvent ); + + private: + WRT::Download& iDownload; + CRoHandlerDMgrWrapper& iRoHandlerDMgrWrapper; + + }; + +#endif // QROHANDLERDMGREVENTHANDLER_H + diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h --- a/omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h Thu Jul 22 16:35:50 2010 +0100 @@ -19,14 +19,18 @@ #ifndef ROHANDLERDMGRWRAPPER_H #define ROHANDLERDMGRWRAPPER_H -namespace Roap - { - class MRoapObserver; - } +#include +#include + +#include +#include + +#include +#include +#include class CDRMRights; - -class MHttpDownloadMgrObserver; +class QRoHandlerDMgrEventHandler; class MRoHandlerDMgrWrapper { @@ -40,7 +44,6 @@ */ class CRoHandlerDMgrWrapper: public CActive, // Now active - public MHttpDownloadMgrObserver, public Roap::MRoapObserver, public MRoHandlerDMgrWrapper { @@ -72,19 +75,6 @@ */ void HandleRoapTriggerL( const TDesC8& aTrigger ); - -// from base class MHttpDownloadMgrObserver - - /** - * From MHttpDownloadMgrObserver. - * Handle download manager events - * - * @since S60 3.2 - * @param aDownload the download - * @param aEvent the event - */ - void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); - // From Roap::MRoapObserver /** * ConnectionConfL @@ -211,6 +201,13 @@ * @leave System wide error code */ void PostResponseUrlL( const TDesC8& aPostResponseUrl ); + /** + * Handle download manager events + * + * @param aEvent the event + */ + void HandleDownloadEventL( WRT::DownloadEvent* aEvent ); + protected: //from Cactive virtual void DoCancel(); @@ -246,8 +243,9 @@ /** * Download manager session */ - RHttpDownloadMgr iDlMgr; + WRT::DownloadManager* iDlMgr; + WRT::Download* iDownload; /** * Used to make downloads synchronous */ @@ -277,6 +275,9 @@ RFs iFs; HBufC* iFileName; + + QRoHandlerDMgrEventHandler* iRoHandlerDMgrEventHandler; + }; #endif // ROHANDLERDMGRWRAPPER_H diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp --- a/omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -30,7 +30,6 @@ #include // link against centralrepository.lib #include #include -#include #ifdef RD_MULTIPLE_DRIVE #include @@ -46,7 +45,7 @@ #include "RoMtmCli.h" // for CRightsObjectMtmClient #include "RoapSyncWrapper.h" -#include "StringResourceReader.h" +#include "RoHandlerStringResourceReader.h" #include "rohandlerdmgrwrapper.h" #include "rohandlerinternalcrkeys.h" @@ -99,7 +98,6 @@ _LIT( KRoHandlerTriggerFilePath, "c:\\system\\data\\" ); #endif -_LIT( KPushMtmRes, "PushMtmUi.rsc" ); _LIT( KRoHandlerResourceFile, "RoHandler.rsc" ); _LIT8( KRoapTriggerElement, "roapTrigger" ); @@ -1188,10 +1186,10 @@ TRAP( r, WriteL( _L8( "ReadFromResourceLC-fs.Connect" ) ) ); #endif CleanupClosePushL( fs ); - CStringResourceReader* reader( - new ( ELeave ) CStringResourceReader( fs, aFile ) ); + CRoHandlerStringResourceReader* reader( + new ( ELeave ) CRoHandlerStringResourceReader( fs, aFile ) ); #ifdef _DRM_TESTING - TRAP( r, WriteL( _L8( "ReadFromResourceLC-CStringResourceReader" ) ) ); + TRAP( r, WriteL( _L8( "ReadFromResourceLC-CRoHandlerStringResourceReader" ) ) ); #endif CleanupStack::PushL( reader ); aBuf = reader->AllocReadResourceL( aIndex ); diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/src/RoHandlerStringResourceReader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/src/RoHandlerStringResourceReader.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2002-2010 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 CRoHandlerStringResourceReader +* +* +*/ + + +// INCLUDE FILES + +#include "RoHandlerStringResourceReader.h" +#include +#include +#include + + +// ============================= LOCAL FUNCTIONS =============================== + +//#define _DRM_TESTING + +#ifdef _DRM_TESTING +LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs ); +LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName ); +LOCAL_C void CreateLogL(); +LOCAL_C void WriteL( const TDesC8& aText ); +LOCAL_C void WriteL( const TDesC& aText ); +LOCAL_C void WriteL( const TDesC8& aText , TInt aErr ); +LOCAL_C void WriteCurrentTimeL(); +#endif + +// ----------------------------------------------------------------------------- +// Testing stuff +// ----------------------------------------------------------------------------- +// + +#ifdef _DRM_TESTING +LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs ) + { + _LIT( KLogFile , "c:\\StringResourceReader.txt" ); + WriteFileL( text , aFs , KLogFile ); + } + +LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName ) + { + RFile file; + TInt size; + User::LeaveIfError( file.Open( aFs, aName , EFileWrite ) ); + CleanupClosePushL( file ); + User::LeaveIfError( file.Size( size ) ); + User::LeaveIfError( file.Write( size, text ) ); + CleanupStack::PopAndDestroy(); //file + } + +LOCAL_C void CreateLogL() + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + RFile file; + User::LeaveIfError( file.Replace( fs , _L("c:\\StringResourceReader.txt") , EFileWrite ) ); + file.Close(); + CleanupStack::PopAndDestroy(); //fs + } + +LOCAL_C void WriteL( const TDesC& aText ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + HBufC8* text = HBufC8::NewLC(1000); + TPtr8 textptr(text->Des() ); + textptr.Append( aText ); + textptr.Append( _L8("\r\n") ); + WriteLogL(textptr , fs); + CleanupStack::PopAndDestroy(text); + CleanupStack::PopAndDestroy(); //fs + WriteCurrentTimeL(); + } + +LOCAL_C void WriteL( const TDesC8& aText ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + HBufC8* text = HBufC8::NewLC(1000); + TPtr8 textptr(text->Des() ); + textptr.Append( aText ); + textptr.Append( _L8("\r\n") ); + WriteLogL(textptr , fs); + CleanupStack::PopAndDestroy(text); + CleanupStack::PopAndDestroy(); //fs + WriteCurrentTimeL(); + } + +LOCAL_C void WriteL( const TDesC8& aText , TInt aErr ) + { + _LIT8(KErr,": %d"); + HBufC8* text = HBufC8::NewLC(1000+20); + TBuf8<20> num; + TPtr8 textptr(text->Des()); + textptr.Append(aText); + num.Format(KErr(),aErr); + textptr.Append(num); + WriteL(textptr); + CleanupStack::PopAndDestroy(text); + } + +LOCAL_C void WriteCurrentTimeL() + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + HBufC8* text = HBufC8::NewLC(100); + TPtr8 textptr(text->Des() ); +// Date and Time display + TTime time; + time.HomeTime(); + TBuf<256> dateString; + _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3"); + time.FormatL(dateString,KDate); + textptr.Append(_L( "\r\n\t\tData:\t" ) ); + textptr.Append( dateString ); + _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B"); + time.FormatL(dateString,KTime); + textptr.Append(_L( "\r\n\t\tTime:\t" ) ); + textptr.Append( dateString ); + textptr.Append(_L( "\r\n" ) ); + textptr.Append(_L( "\r\n" ) ); + WriteLogL(textptr , fs); + CleanupStack::PopAndDestroy(text); + CleanupStack::PopAndDestroy(); //fs + } +#endif + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// CRoHandlerStringResourceReader::CRoHandlerStringResourceReader +// --------------------------------------------------------- +// +CRoHandlerStringResourceReader::CRoHandlerStringResourceReader + ( RFs& aFs, const TDesC& aRscFileWithPathAndDrive ) +: CBase(), iFs( aFs ), iInitialized( EFalse ) + { +#ifdef _DRM_TESTING + TRAPD(r,CreateLogL()); + TRAP(r,WriteL(_L8("CRoHandlerStringResourceReader"))); +#endif + iRscFileName.Copy( aRscFileWithPathAndDrive ); + } + +// --------------------------------------------------------- +// CRoHandlerStringResourceReader::~CRoHandlerStringResourceReader +// --------------------------------------------------------- +// +CRoHandlerStringResourceReader::~CRoHandlerStringResourceReader() + { + iResourceFile.Close(); +#ifdef _DRM_TESTING + TRAPD(r,WriteL(_L8("~CRoHandlerStringResourceReader"))); +#endif + } + +// --------------------------------------------------------- +// CRoHandlerStringResourceReader::AllocReadResourceL +// --------------------------------------------------------- +// +HBufC* CRoHandlerStringResourceReader::AllocReadResourceL( TInt aResId ) + { +#ifdef _DRM_TESTING + TRAPD(r,WriteL(_L8("AllocReadResourceL"),aResId)); +#endif + + InitializeL(); + +#ifdef _DRM_TESTING + TRAP(r,WriteL(_L8("AllocReadResourceL-InitializeL"))); +#endif + + HBufC8* buf8 = iResourceFile.AllocReadLC( aResId ); + +#ifdef _DRM_TESTING + TRAP(r,WriteL(_L8("AllocReadResourceL-iResourceFile.AllocReadLC"))); +#endif + +#ifdef _UNICODE + const TPtrC buf( (const TUint16*)buf8->Ptr(), buf8->Size()/2 ); +#else + const TPtrC buf( buf8->Ptr(), buf8->Size() ); +#endif + HBufC* retBuf = buf.AllocL(); + CleanupStack::PopAndDestroy( buf8 ); + +#ifdef _DRM_TESTING + TRAP(r,WriteL(_L8("AllocReadResourceL-End"))); +#endif + return retBuf; + } + +// --------------------------------------------------------- +// CRoHandlerStringResourceReader::InitializeL +// --------------------------------------------------------- +// +void CRoHandlerStringResourceReader::InitializeL() + { +#ifdef _DRM_TESTING + TRAPD(r,WriteL(_L8("InitializeL"))); +#endif + if ( !iInitialized ) + { + TFileName resourceFileName( iRscFileName ); +#ifdef _DRM_TESTING + TRAP(r,WriteL(_L8("InitializeL-NearestLanguageFile"))); +#endif + +#ifdef _DRM_TESTING + TRAP(r,WriteL(resourceFileName)); +#endif + BaflUtils::NearestLanguageFile( iFs, resourceFileName ); +#ifdef _DRM_TESTING + TRAP(r,WriteL(_L8("InitializeL-NearestLanguageFile-End"))); +#endif + + iResourceFile.OpenL( iFs, resourceFileName ); +#ifdef _DRM_TESTING + TRAP(r,WriteL(_L8("InitializeL-OpenL-End"))); +#endif + + iResourceFile.ConfirmSignatureL( iResourceFile.SignatureL() ); +#ifdef _DRM_TESTING + TRAP(r,WriteL(_L8("InitializeL-ConfirmSignatureL-End"))); +#endif + iInitialized = ETrue; + } +#ifdef _DRM_TESTING + TRAP(r,WriteL(_L8("InitializeL-End"))); +#endif + } + +// End of file. diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/src/StringResourceReader.cpp --- a/omadrm/drmplugins/drmrohandler/src/StringResourceReader.cpp Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* -* Copyright (c) 2002 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 CStringResourceReader -* -* -*/ - - -// INCLUDE FILES - -#include "StringResourceReader.h" -#include -#include -#include - - -// ============================= LOCAL FUNCTIONS =============================== - -//#define _DRM_TESTING - -#ifdef _DRM_TESTING -LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs ); -LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName ); -LOCAL_C void CreateLogL(); -LOCAL_C void WriteL( const TDesC8& aText ); -LOCAL_C void WriteL( const TDesC& aText ); -LOCAL_C void WriteL( const TDesC8& aText , TInt aErr ); -LOCAL_C void WriteCurrentTimeL(); -#endif - -// ----------------------------------------------------------------------------- -// Testing stuff -// ----------------------------------------------------------------------------- -// - -#ifdef _DRM_TESTING -LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs ) - { - _LIT( KLogFile , "c:\\StringResourceReader.txt" ); - WriteFileL( text , aFs , KLogFile ); - } - -LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName ) - { - RFile file; - TInt size; - User::LeaveIfError( file.Open( aFs, aName , EFileWrite ) ); - CleanupClosePushL( file ); - User::LeaveIfError( file.Size( size ) ); - User::LeaveIfError( file.Write( size, text ) ); - CleanupStack::PopAndDestroy(); //file - } - -LOCAL_C void CreateLogL() - { - RFs fs; - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - RFile file; - User::LeaveIfError( file.Replace( fs , _L("c:\\StringResourceReader.txt") , EFileWrite ) ); - file.Close(); - CleanupStack::PopAndDestroy(); //fs - } - -LOCAL_C void WriteL( const TDesC& aText ) - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL(fs); - HBufC8* text = HBufC8::NewLC(1000); - TPtr8 textptr(text->Des() ); - textptr.Append( aText ); - textptr.Append( _L8("\r\n") ); - WriteLogL(textptr , fs); - CleanupStack::PopAndDestroy(text); - CleanupStack::PopAndDestroy(); //fs - WriteCurrentTimeL(); - } - -LOCAL_C void WriteL( const TDesC8& aText ) - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL(fs); - HBufC8* text = HBufC8::NewLC(1000); - TPtr8 textptr(text->Des() ); - textptr.Append( aText ); - textptr.Append( _L8("\r\n") ); - WriteLogL(textptr , fs); - CleanupStack::PopAndDestroy(text); - CleanupStack::PopAndDestroy(); //fs - WriteCurrentTimeL(); - } - -LOCAL_C void WriteL( const TDesC8& aText , TInt aErr ) - { - _LIT8(KErr,": %d"); - HBufC8* text = HBufC8::NewLC(1000+20); - TBuf8<20> num; - TPtr8 textptr(text->Des()); - textptr.Append(aText); - num.Format(KErr(),aErr); - textptr.Append(num); - WriteL(textptr); - CleanupStack::PopAndDestroy(text); - } - -LOCAL_C void WriteCurrentTimeL() - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL(fs); - HBufC8* text = HBufC8::NewLC(100); - TPtr8 textptr(text->Des() ); -// Date and Time display - TTime time; - time.HomeTime(); - TBuf<256> dateString; - _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3"); - time.FormatL(dateString,KDate); - textptr.Append(_L( "\r\n\t\tData:\t" ) ); - textptr.Append( dateString ); - _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B"); - time.FormatL(dateString,KTime); - textptr.Append(_L( "\r\n\t\tTime:\t" ) ); - textptr.Append( dateString ); - textptr.Append(_L( "\r\n" ) ); - textptr.Append(_L( "\r\n" ) ); - WriteLogL(textptr , fs); - CleanupStack::PopAndDestroy(text); - CleanupStack::PopAndDestroy(); //fs - } -#endif - -// ================= MEMBER FUNCTIONS ======================= - - -// --------------------------------------------------------- -// CStringResourceReader::CStringResourceReader -// --------------------------------------------------------- -// -CStringResourceReader::CStringResourceReader - ( RFs& aFs, const TDesC& aRscFileWithPathAndDrive ) -: CBase(), iFs( aFs ), iInitialized( EFalse ) - { -#ifdef _DRM_TESTING - TRAPD(r,CreateLogL()); - TRAP(r,WriteL(_L8("CStringResourceReader"))); -#endif - iRscFileName.Copy( aRscFileWithPathAndDrive ); - } - -// --------------------------------------------------------- -// CStringResourceReader::~CStringResourceReader -// --------------------------------------------------------- -// -CStringResourceReader::~CStringResourceReader() - { - iResourceFile.Close(); -#ifdef _DRM_TESTING - TRAPD(r,WriteL(_L8("~CStringResourceReader"))); -#endif - } - -// --------------------------------------------------------- -// CStringResourceReader::AllocReadResourceL -// --------------------------------------------------------- -// -HBufC* CStringResourceReader::AllocReadResourceL( TInt aResId ) - { -#ifdef _DRM_TESTING - TRAPD(r,WriteL(_L8("AllocReadResourceL"),aResId)); -#endif - - InitializeL(); - -#ifdef _DRM_TESTING - TRAP(r,WriteL(_L8("AllocReadResourceL-InitializeL"))); -#endif - - HBufC8* buf8 = iResourceFile.AllocReadLC( aResId ); - -#ifdef _DRM_TESTING - TRAP(r,WriteL(_L8("AllocReadResourceL-iResourceFile.AllocReadLC"))); -#endif - -#ifdef _UNICODE - const TPtrC buf( (const TUint16*)buf8->Ptr(), buf8->Size()/2 ); -#else - const TPtrC buf( buf8->Ptr(), buf8->Size() ); -#endif - HBufC* retBuf = buf.AllocL(); - CleanupStack::PopAndDestroy( buf8 ); - -#ifdef _DRM_TESTING - TRAP(r,WriteL(_L8("AllocReadResourceL-End"))); -#endif - return retBuf; - } - -// --------------------------------------------------------- -// CStringResourceReader::InitializeL -// --------------------------------------------------------- -// -void CStringResourceReader::InitializeL() - { -#ifdef _DRM_TESTING - TRAPD(r,WriteL(_L8("InitializeL"))); -#endif - if ( !iInitialized ) - { - TFileName resourceFileName( iRscFileName ); -#ifdef _DRM_TESTING - TRAP(r,WriteL(_L8("InitializeL-NearestLanguageFile"))); -#endif - -#ifdef _DRM_TESTING - TRAP(r,WriteL(resourceFileName)); -#endif - BaflUtils::NearestLanguageFile( iFs, resourceFileName ); -#ifdef _DRM_TESTING - TRAP(r,WriteL(_L8("InitializeL-NearestLanguageFile-End"))); -#endif - - iResourceFile.OpenL( iFs, resourceFileName ); -#ifdef _DRM_TESTING - TRAP(r,WriteL(_L8("InitializeL-OpenL-End"))); -#endif - - iResourceFile.ConfirmSignatureL( iResourceFile.SignatureL() ); -#ifdef _DRM_TESTING - TRAP(r,WriteL(_L8("InitializeL-ConfirmSignatureL-End"))); -#endif - iInitialized = ETrue; - } -#ifdef _DRM_TESTING - TRAP(r,WriteL(_L8("InitializeL-End"))); -#endif - } - -// End of file. diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/src/qrohandlerdmgreventhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/src/qrohandlerdmgreventhandler.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,26 @@ + +#include + +#include "qrohandlerdmgreventhandler.h" +#include "rohandlerdmgrwrapper.h" + +QRoHandlerDMgrEventHandler::QRoHandlerDMgrEventHandler( + CRoHandlerDMgrWrapper& aRoHandlerDMgrWrapper, + WRT::Download& aDownload ) + : iDownload(aDownload), + iRoHandlerDMgrWrapper(aRoHandlerDMgrWrapper) + { + QT_TRAP_THROWING + ( + QObject::connect + ( + &iDownload, SIGNAL(downloadEvent(DownloadEvent*)), + this, SLOT(HandleDownloadEventL(DownloadEvent*)) + ) + ); + } + +void QRoHandlerDMgrEventHandler::HandleDownloadEventL( WRT::DownloadEvent* aEvent ) + { + iRoHandlerDMgrWrapper.HandleDownloadEventL(aEvent); + } diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp --- a/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -32,8 +32,6 @@ #include -#include - #include // tconnectioninfo #include // rconnection rsocket #include @@ -41,9 +39,15 @@ #include #include "RoapSyncWrapper.h" +// Download manager apis +#include +#include +#include + #include "rohandlerdmgrwrapper.h" #include "cleanupresetanddestroy.h" #include "buffercontainers.h" +#include "qrohandlerdmgreventhandler.h" #ifdef _DEBUG #define DRMDEBUG( a ) RDebug::Print( a ) @@ -110,8 +114,7 @@ _LIT( KStrEConnectionFailed, "EConnectionFailed" ); _LIT( KFormatEDlAttrErrorId, "EDlAttrErrorId = %d" ); - _LIT( KMiDownLoadState, "iDownLoadState" ); - _LIT( KMiProgressState, "iProgressState" ); + _LIT( KMiState, "iState" ); } @@ -134,16 +137,7 @@ _LIT( KHelperTriggerFilePath, "d:\\" ); #endif -// ============================== LOCAL FUNCTIONS ============================== - -// --------------------------------------------------------------------------- -// DeleteHttpDowload -// --------------------------------------------------------------------------- -// -LOCAL_C void DeleteHttpDowload( TAny* aDownload ) - { - reinterpret_cast< RHttpDownload* >( aDownload )->Delete(); - } +using namespace WRT; // --------------------------------------------------------------------------- // UpdateBufferL @@ -185,7 +179,15 @@ DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethConstructL() ); // Get UID from process const TInt KRoHandlerDMgrWrapperUid = 0x101F7B92; - iDlMgr.ConnectL( TUid::Uid( KRoHandlerDMgrWrapperUid ), *this, EFalse ); + try + { + QString roHandlerDmgrWrapperUid(QString::number(KRoHandlerDMgrWrapperUid)); + iDlMgr = q_check_ptr(new DownloadManager(roHandlerDmgrWrapperUid)); + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } User::LeaveIfError( iFs.Connect() ); User::LeaveIfError( iFs.ShareProtected() ); @@ -230,20 +232,11 @@ delete iFileName; delete iRoapEng; -#ifdef _DEBUG - - if ( iDlMgr.Handle() ) - { - iDlMgr.Close(); - } - -#else - - iDlMgr.Close(); - -#endif - + delete iDlMgr; + delete iRoHandlerDMgrEventHandler; + iFs.Close(); + } // --------------------------------------------------------------------------- @@ -269,7 +262,6 @@ void CRoHandlerDMgrWrapper::DoDownloadRoapTriggerL( TMeterState aNextState ) { RFile roapTrigger; - TBool result( EFalse ); DRM::CFileNameContainer* triggerFileName(NULL); DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethDoDownloadAndHandleRoapTriggerL() ); @@ -308,36 +300,54 @@ CleanupStack::PopAndDestroy( triggerFileName ); triggerFileName=NULL; - // create and start download - RHttpDownload& download = iDlMgr.CreateDownloadL( *iTriggerUrl, result ); - // Put download for proper cleanup. - TCleanupItem item( DeleteHttpDowload, &download ); - CleanupStack::PushL( item ); - + try + { + // create and start download + QString downloadUrl((QChar*)iTriggerUrl->Des().Ptr(),iTriggerUrl->Length()); + iDownload = iDlMgr->createDownload( downloadUrl ); + iRoHandlerDMgrEventHandler = q_check_ptr(new QRoHandlerDMgrEventHandler(*this, *iDownload)); + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } + CleanupClosePushL( roapTrigger ); - if ( result ) - { - DRMDEBUG2( - RoHdlrDMgrWrDebugLiterals::KFormatDoDlHdlRoapTrigL(), - &RoHdlrDMgrWrDebugLiterals::KStrDlCreated() ); - iDownloadSuccess = EFalse; - iConnectionError = EFalse; + + DRMDEBUG2( + RoHdlrDMgrWrDebugLiterals::KFormatDoDlHdlRoapTrigL(), + &RoHdlrDMgrWrDebugLiterals::KStrDlCreated() ); + iDownloadSuccess = EFalse; + iConnectionError = EFalse; - SetDefaultAccessPointL(); - User::LeaveIfError( download.SetFileHandleAttribute( roapTrigger ) ); - User::LeaveIfError( download.SetBoolAttribute( - EDlAttrNoContentTypeCheck, ETrue ) ); - User::LeaveIfError( download.Start() ); - - // wait until download is finished - iState = aNextState; - TRequestStatus* status( &iStatus ); - *status = KRequestPending; - SetActive(); - } + SetDefaultAccessPointL(); + + try + { + RBuf fileName; + fileName.Create(KMaxFileName); + CleanupClosePushL(fileName); + roapTrigger.Name(fileName); + const QVariant& roapTriggerValue( QString((QChar*) fileName.Ptr(), fileName.Length()) ); + CleanupStack::PopAndDestroy(&fileName); + iDownload->setAttribute(FileName,roapTriggerValue); + const QVariant& val(ETrue); + iDownload->setAttribute(ContentType, val); + iDownload->start(); + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } + + // wait until download is finished + iState = aNextState; + TRequestStatus* status( &iStatus ); + *status = KRequestPending; + SetActive(); + CleanupStack::PopAndDestroy( &roapTrigger ); - CleanupStack::Pop( &download ); // Left open for DoSaveRoapTrigger } // --------------------------------------------------------------------------- // CRoHandlerDMgrWrapper::DoSaveRoapTriggerL @@ -350,15 +360,23 @@ RoHdlrDMgrWrDebugLiterals::KFormatDoDlHdlRoapTrigL(), &RoHdlrDMgrWrDebugLiterals::KStrDlFinished() ); - // Fetch download created in DoDownloadRoapTriggerL - RHttpDownload* download = iDlMgr.FindDownload( *iTriggerUrl, KNullDesC8() ); + try + { + // Fetch download created in DoDownloadRoapTriggerL + QString downloadUrl((QChar*)iTriggerUrl->Des().Ptr(),iTriggerUrl->Length()); + //uncomment + iDownload = NULL; //iDlMgr->findDownload( downloadUrl ); + } + catch(const std::exception& exception) + { + qt_symbian_exception2LeaveL(exception); + } + // Delete trigger URL so that it is possible to check // whether or not meteringResponse has PrUrl. delete iTriggerUrl; iTriggerUrl = NULL; - // Put download for proper cleanup. - TCleanupItem item( DeleteHttpDowload, download ); - CleanupStack::PushL( item ); + RFile roapTrigger; if ( !iDownloadSuccess ) @@ -401,8 +419,7 @@ // And let ROAP handle it... CleanupStack::PopAndDestroy( &readBuf ); CleanupStack::PopAndDestroy( &roapTrigger ); - CleanupStack::PopAndDestroy( download ); - + iFs.Delete( *iFileName ); delete iFileName; iFileName=NULL; @@ -453,7 +470,8 @@ if ( iIapId ) { - iDlMgr.SetIntAttribute( EDlMgrIap, iIapId ); + QVariant iapId((unsigned long long)iIapId); + iDlMgr->setAttribute(DefaultDestinationPath, iapId); } } @@ -478,48 +496,41 @@ // CRoHandlerDMgrWrapper::HandleDMgrEventL // --------------------------------------------------------------------------- // -void CRoHandlerDMgrWrapper::HandleDMgrEventL( RHttpDownload& aDownload, - THttpDownloadEvent aEvent ) +void CRoHandlerDMgrWrapper::HandleDownloadEventL( WRT::DownloadEvent* aEvent ) { - _LIT8( KDRMHelperMimeTypeROAPTrigger, "application/vnd.oma.drm.roap-trigger+xml" ); + QString KDRMHelperMimeTypeROAPTrigger("application/vnd.oma.drm.roap-trigger+xml" ); DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethHandleDMgrEventL() ); DRMDEBUG3( RoHdlrDMgrWrDebugLiterals::KFormatMembValInt(), - &RoHdlrDMgrWrDebugLiterals::KMiDownLoadState(), aEvent.iDownloadState ); - DRMDEBUG3( RoHdlrDMgrWrDebugLiterals::KFormatMembValInt(), - &RoHdlrDMgrWrDebugLiterals::KMiProgressState(), aEvent.iProgressState ); - - if ( aEvent.iProgressState == EHttpContentTypeReceived ) + &RoHdlrDMgrWrDebugLiterals::KMiState(), aEvent->type() ); + + if ( aEvent->type() == DownloadEvent::HeadersReceived ) { DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), &RoHdlrDMgrWrDebugLiterals::KStrEHttpContentTypeReceived() ); // check received mimetype - RBuf8 contentType; - contentType.CleanupClosePushL(); - contentType.CreateL( KMaxContentTypeLength ); - User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrContentType, - contentType ) ); - if ( !contentType.FindF( KDRMHelperMimeTypeROAPTrigger ) ) + QString contentType = iDownload->attribute( ContentType).toString(); + if ( contentType.contains( KDRMHelperMimeTypeROAPTrigger ) == EFalse ) { // ROAP trigger found, continue download - User::LeaveIfError( aDownload.Start() ); + iDownload->start(); } else { // wrong MIME type?, stop download iDownloadSuccess = EFalse; - User::LeaveIfError( aDownload.Delete() ); + iDownload->cancel(); } CleanupStack::PopAndDestroy( &contentType ); } - if ( aEvent.iDownloadState == EHttpDlCreated ) + if ( aEvent->type() == DownloadEvent::Created ) { DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlCreated() ); } else - if ( aEvent.iProgressState == EHttpProgDisconnected ) + if ( aEvent->type() == DownloadEvent::NetworkLoss ) { DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), &RoHdlrDMgrWrDebugLiterals::KStrEHttpProgDisconnected() ); @@ -530,49 +541,47 @@ TRequestStatus* status( &iStatus ); User::RequestComplete( status, KErrCancel ); } - else - if ( aEvent.iDownloadState == EHttpDlInprogress ) - { - DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), - &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlInprogress() ); - } - else - if ( aEvent.iDownloadState == EHttpDlCompleted ) - { - // store success - DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), - &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlCompleted() ); - iDownloadSuccess = ETrue; + else + if ( aEvent->type() == DownloadEvent::InProgress ) + { + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), + &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlInprogress() ); + } + else + if ( aEvent->type() == DownloadEvent::Completed ) + { + // store success + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), + &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlCompleted() ); + iDownloadSuccess = ETrue; - // finished - TRequestStatus* status( &iStatus ); - User::RequestComplete( status, KErrNone ); - } - else - if ( aEvent.iDownloadState == EHttpDlFailed ) - { - TInt32 err; + // finished + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, KErrNone ); + } + else + if ( aEvent->type() == DownloadEvent::Failed ) + { + TInt32 err; - DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), - &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlFailed() ); - // store failure - iDownloadSuccess = EFalse; - User::LeaveIfError( aDownload.GetIntAttribute( - EDlAttrErrorId, err ) ); - DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatEDlAttrErrorId(), err ); + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), + &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlFailed() ); + // store failure + iDownloadSuccess = EFalse; + err = iDownload->attribute(LastError ).toInt(); + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatEDlAttrErrorId(), err ); - if ( err == EConnectionFailed || err - == ETransactionFailed ) - { - DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), - &RoHdlrDMgrWrDebugLiterals::KStrEConnectionFailed() ); - iConnectionError = ETrue; - } + if ( err == ConnectionFailed || err == TransactionFailed ) + { + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), + &RoHdlrDMgrWrDebugLiterals::KStrEConnectionFailed() ); + iConnectionError = ETrue; + } - // finished - TRequestStatus* status( &iStatus ); - User::RequestComplete( status, KErrCancel ); - } + // finished + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, KErrCancel ); + } } @@ -751,3 +760,4 @@ } return KErrNone; } + diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmromtm/group/RoMtmUi.mmp --- a/omadrm/drmplugins/drmromtm/group/RoMtmUi.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmromtm/group/RoMtmUi.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -28,6 +28,7 @@ SOURCEPATH ../ui/src SOURCE RoMtmUi.cpp +SOURCE drmmsgwatcherobserver.cpp USERINCLUDE ../inc USERINCLUDE ../ui/inc diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmromtm/ui/inc/RoMtmUi.h --- a/omadrm/drmplugins/drmromtm/ui/inc/RoMtmUi.h Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmromtm/ui/inc/RoMtmUi.h Thu Jul 22 16:35:50 2010 +0100 @@ -207,12 +207,12 @@ CMsvOperation* CompletedOperationL( TRequestStatus& aObserverStatus ); TBool ShowQueryL( TDesC16& aFile ); TInt CheckTriggerTypeL( TDesC16& aFile ); + private: TMessageType iType; - CDocumentHandler* iDocHandler; RFs iFs; CEikProcess* iHostProcess; - CAknLaunchAppService* iOpenService; + }; #endif // RIGHTSOBJECTMTMUI_H diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmromtm/ui/inc/drmmsgwatcherobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmromtm/ui/inc/drmmsgwatcherobserver.h Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2010 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: +* Msv operation for drm view closing +* +*/ + + +#ifndef C_DRMMSGWATCHEROBSERVER_H +#define C_DRMMSGWATCHEROBSERVER_H + + + +#include // CMsvOperation +#include // MAknServerAppExitObserver +#include // app service +#include // Document handler + +class CDocumentHandler; + +// CLASS DECLARATION + +/** +* CDrmMsgWatcherObserver +* Simple operation class which watches a service (drm), +* completing when that thread closes. +* +* The passed CMsvSession is not used (merely required to base-construct +* a CMsvOperation). +*/ +NONSHARABLE_CLASS( CDrmMsgWatcherObserver ) : public CMsvOperation, public MAknServerAppExitObserver + { + public: + + static CDrmMsgWatcherObserver* NewL( + CMsvSession& aMsvSession, + TInt aPriority, + TRequestStatus& aObserverRequestStatus, + TUid aMtm, + CAiwGenericParamList* aParamList ); + + + static CDrmMsgWatcherObserver* NewL( + CMsvSession& aMsvSession, + TInt aPriority, + TRequestStatus& aObserverRequestStatus, + TUid aMtm, + const TDesC& aFileName, + TDataType& aDataType ); + + /** + * C++ constructor + */ + CDrmMsgWatcherObserver( + CMsvSession& aMsvSession, + TInt aPriority, + TRequestStatus& aObserverRequestStatus, + TUid aMtm ); + + /** + * Destructor. + */ + ~CDrmMsgWatcherObserver(); + + private: // From MApaServerAppExitObserver + void HandleServerAppExit( TInt aReason ); + + protected: + + + /** + * From CMsvOperation + */ + virtual const TDesC8& ProgressL(); + + /** + * From CMsvOperation + */ + virtual const TDesC8& FinalProgress(); + + /** + * From CActive + */ + virtual void RunL(); + + /** + * From CActive + */ + virtual void DoCancel(); + + /** + * + */ + void Start(); + + private: + void ConstructL( CAiwGenericParamList* aParamList ); + void ConstructL( const TDesC& aFileName, TDataType& aDataType ); + + /** + * Completes observer with the completion code + * @param aCode: Completion code + */ + void CompleteObserver( TInt aCode ); + + + protected:// Data + HBufC8* iProgress; + + private: + CAknLaunchAppService* iService; + CDocumentHandler* iDocHandler; + + }; + +#endif // C_DRMMSGWATCHEROBSERVER_H + +// End of file diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp --- a/omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -50,6 +50,8 @@ #include //StringLoader #include //rconeresloader #include // test +#include "drmmsgwatcherobserver.h" + // EXTERNAL DATA STRUCTURES // EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -230,8 +232,6 @@ CRightsObjectMtmUi::CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ) : CBaseMtmUi( aBaseMtm , aRegisteredMtmDll ) { - iOpenService = NULL; - iDocHandler = NULL; iHostProcess = NULL; iType = ERo; } @@ -272,9 +272,6 @@ TRAP(err,WriteL(_L8("~CRightsObjectMtmUi"))); #endif iFs.Close(); - - delete iOpenService; - delete iDocHandler; } @@ -568,15 +565,11 @@ BaseMtm().LoadMessageL(); CRichText& body = BaseMtm().Body(); TPtrC ptr16( body.Read(0) ); - const TUid KUidDRMUI = { 0x101f85c7 }; + //const TUid KUidDRMUI = { 0x101f85c7 }; + CDrmMsgWatcherObserver* operation = NULL; if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition ) { - -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler")); -#endif - _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" ); TDataType type = TDataType( KRoapTriggerMimeType ); HBufC* filename = NULL; @@ -593,60 +586,33 @@ return CompletedOperationL( aStatus ); } -#ifdef _DRM_TESTING - WriteL(ptr,ptr.Length()); -#endif - if (iDocHandler) - { - delete iDocHandler; - iDocHandler = NULL; - } -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler-NewL")); -#endif - iDocHandler = CDocumentHandler::NewL(); -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler-SetExitObserver")); -#endif - iDocHandler->SetExitObserver(this); -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler-OpenFileEmbeddedL")); -#endif - iDocHandler->OpenFileEmbeddedL(ptr,type); - CleanupStack::PopAndDestroy(filename); -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler-End")); -#endif + operation = CDrmMsgWatcherObserver::NewL( + Session(), + CActive::EPriorityStandard, + aStatus, + Type(), + ptr, + type ); } else { - if ( iOpenService ) - { - delete iOpenService; - iOpenService = NULL; - } -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-CAknOpenFileService::NewL")); -#endif CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); TAiwVariant variantObject( ptr16 ); TAiwGenericParam param( EGenericParamFile, variantObject ); paramList->AppendL( param ); - TRAPD( err, iOpenService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ) ); - if (err != KErrNone) - { - // just return to Inbox - } + operation = CDrmMsgWatcherObserver::NewL( + Session(), + CActive::EPriorityStandard, + aStatus, + Type(), + paramList ); CleanupStack::PopAndDestroy( paramList ); // paramList } -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-End")); -#endif - return CompletedOperationL( aStatus ); + return operation; } diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmromtm/ui/src/drmmsgwatcherobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmromtm/ui/src/drmmsgwatcherobserver.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,244 @@ +/* +* Copyright (c) 2010 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: +* Msv operation for drm viewing +* +*/ + + + +#include "drmmsgwatcherobserver.h" + + +// CONSTANTS +const TInt KiProgressBufferSize = 1; + + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------- +// CDrmMsgWatcherObserver::NewL +// --------------------------------------------------------- +// +CDrmMsgWatcherObserver* CDrmMsgWatcherObserver::NewL( + CMsvSession& aMsvSession, + TInt aPriority, + TRequestStatus& aObserverRequestStatus, + TUid aMtm, + CAiwGenericParamList* aParamList) + { + CDrmMsgWatcherObserver* self = + new(ELeave) CDrmMsgWatcherObserver( + aMsvSession, + aPriority, + aObserverRequestStatus, + aMtm); + CleanupStack::PushL(self); + self->ConstructL( aParamList ); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// CDrmMsgWatcherObserver::NewL +// --------------------------------------------------------- +// +CDrmMsgWatcherObserver* CDrmMsgWatcherObserver::NewL( + CMsvSession& aMsvSession, + TInt aPriority, + TRequestStatus& aObserverRequestStatus, + TUid aMtm, + const TDesC& aFileName, + TDataType& aDataType ) + { + CDrmMsgWatcherObserver* self = + new(ELeave) CDrmMsgWatcherObserver( + aMsvSession, + aPriority, + aObserverRequestStatus, + aMtm); + CleanupStack::PushL(self); + self->ConstructL( aFileName, aDataType ); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------- +// CDrmMsgWatcherObserver::ConstructL +// --------------------------------------------------------- +// +void CDrmMsgWatcherObserver::ConstructL( CAiwGenericParamList* aParamList ) + { + const TUid KUidDRMUI = { 0x101f85c7 }; + iService = CAknLaunchAppService::NewL( KUidDRMUI, this, aParamList ); + iObserverRequestStatus = KRequestPending; + Start(); + } + +// --------------------------------------------------------- +// CDrmMsgWatcherObserver::ConstructL +// --------------------------------------------------------- +// +void CDrmMsgWatcherObserver::ConstructL( const TDesC& aFileName, TDataType& aDataType ) + { + iDocHandler = CDocumentHandler::NewL(); + + iDocHandler->SetExitObserver(this); + + iDocHandler->OpenFileEmbeddedL(aFileName, aDataType); + + iObserverRequestStatus = KRequestPending; + Start(); + } + +// --------------------------------------------------------- +// CDrmMsgWatcherObserver::CDrmMsgWatcherObserver +// --------------------------------------------------------- +// +CDrmMsgWatcherObserver::CDrmMsgWatcherObserver + ( + CMsvSession& aMsvSession, + TInt aPriority, + TRequestStatus& aObserverRequestStatus, + TUid aMtm + ) + : + CMsvOperation( + aMsvSession, + aPriority, + aObserverRequestStatus ) + { + iMtm = aMtm; + } + +// --------------------------------------------------------- +// CDrmMsgWatcherObserver::~CDrmMsgWatcherObserver +// --------------------------------------------------------- +// +CDrmMsgWatcherObserver::~CDrmMsgWatcherObserver() + { + Cancel(); + if( iService ) + { + delete iService; + iService = NULL; + } + if( iDocHandler ) + { + delete iDocHandler; + iDocHandler = NULL; + } + delete iProgress; + } + +// ----------------------------------------------------------------------------- +// CDrmMsgWatcherObserver::DoCancel +// From CActive +// ----------------------------------------------------------------------------- +// +void CDrmMsgWatcherObserver::DoCancel() + { + if ( iStatus == KRequestPending ) + { + TRequestStatus* pstat = &iStatus; + User::RequestComplete( pstat, KErrCancel ); + } + CompleteObserver( KErrCancel ); + } + + +// ----------------------------------------------------------------------------- +// CMsgEditorServerWatchingOperation::ProgressL +// From CMsvOperation +// ----------------------------------------------------------------------------- +// +const TDesC8& CDrmMsgWatcherObserver::ProgressL() + { + if ( !iProgress ) + { + iProgress = HBufC8::NewL( KiProgressBufferSize ); + } + return *iProgress; + } + + +// ----------------------------------------------------------------------------- +// CMsgEditorServerWatchingOperation::FinalProgress +// From CMsvOperation +// ----------------------------------------------------------------------------- +// +const TDesC8& CDrmMsgWatcherObserver::FinalProgress() + { + return *iProgress; + } + + +// ----------------------------------------------------------------------------- +// CDrmMsgWatcherObserver::RunL +// From CActive +// ----------------------------------------------------------------------------- +// +void CDrmMsgWatcherObserver::RunL() + { + CompleteObserver( iStatus.Int( ) ); + } + + +// ----------------------------------------------------------------------------- +// CDrmMsgWatcherObserver::Start +// +// ----------------------------------------------------------------------------- +// +void CDrmMsgWatcherObserver::Start() + { + CActiveScheduler::Add( this ); + iStatus = KRequestPending; + SetActive(); + } + + +// ----------------------------------------------------------------------------- +// CDrmMsgWatcherObserver::CompleteObserver +// Completes observer with the completion code +// ----------------------------------------------------------------------------- +// +void CDrmMsgWatcherObserver::CompleteObserver( TInt aCode ) + { + TRequestStatus* status = &iObserverRequestStatus; + + if( ( *status ) == KRequestPending ) + { + User::RequestComplete( status, aCode ); + } + } + + + +// --------------------------------------------------------- +// CDrmMsgWatcherObserver::HandleServerAppExit +// --------------------------------------------------------- +// +void CDrmMsgWatcherObserver::HandleServerAppExit( TInt aReason ) + { + TInt exitMode = aReason; + if ( iStatus == KRequestPending ) + { + TRequestStatus* pstat = &iStatus; + User::RequestComplete( pstat, exitMode ); + } + MAknServerAppExitObserver::HandleServerAppExit( aReason ); + } + +// End of file diff -r abec8b1bb37c -r 442486f870da omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp --- a/omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -560,8 +560,8 @@ { MAknsSkinInstance* skins = AknsUtils::SkinInstance(); TAknsItemID id; - CFbsBitmap* bitmap; - CFbsBitmap* bitmapMask; + //CFbsBitmap* bitmap; + //CFbsBitmap* bitmapMask; CBitmapArray* array = NULL; TParse tp; tp.Set( KRoMtmUiDataBitmapFile, &KDC_APP_BITMAP_DIR, NULL ); diff -r abec8b1bb37c -r 442486f870da omadrm/group/bld.inf --- a/omadrm/group/bld.inf Wed Jun 16 17:39:50 2010 +0100 +++ b/omadrm/group/bld.inf Thu Jul 22 16:35:50 2010 +0100 @@ -109,17 +109,9 @@ // Recognizer ../drmplugins/drmrecognizer/group/RecDRM.mmp -// Ro Handler (only used if OMA DRM 1.0 Full is enabled) -#ifdef __DRM_FULL -../drmplugins/drmrohandler/group/crohandler.mmp -#endif - // DRMFilter ../drmplugins/drmfilter/group/HTTPFilterDRM.mmp -// DRMHelper -../drmhelper/group/Drmhelper.mmp - #ifdef SBSV2 PRJ_EXTENSIONS diff -r abec8b1bb37c -r 442486f870da omadrm/omadrm.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/omadrm.pro Thu Jul 22 16:35:50 2010 +0100 @@ -0,0 +1,24 @@ +# +# Copyright (c) 2010 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: qt changes for OMADRM +# + +TEMPLATE = subdirs + +CONFIG += ordered +DEFINES += __DRM_FULL + +contains(DEFINES, __DRM_FULL): SUBDIRS += drmplugins/drmrohandler/group/rohandler.pro +SUBDIRS += drmhelper/group/drmhelper.pro + diff -r abec8b1bb37c -r 442486f870da wmdrm/camese/cameseutility/group/CameseUtility.mmp --- a/wmdrm/camese/cameseutility/group/CameseUtility.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/camese/cameseutility/group/CameseUtility.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -33,7 +33,7 @@ USERINCLUDE ../../inc MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom + LIBRARY euser.lib LIBRARY flogger.lib diff -r abec8b1bb37c -r 442486f870da wmdrm/camese/httpfiltercamese/Src/httpfiltercamesedrmheader.cpp --- a/wmdrm/camese/httpfiltercamese/Src/httpfiltercamesedrmheader.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/camese/httpfiltercamese/Src/httpfiltercamesedrmheader.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -31,7 +31,7 @@ // Filter position: DRM Header needs to be positioned below the client. const TInt KCameseDrmHeaderFilterPosition = MHTTPFilter::EClient - 10; -const TUid KCRUidMusicShopSettings = {0x10207BF5}; // copied from MusicWapCenRepKeys.h - Album Download +const TUid KCRUidMusicShopSettings = {0x101FFB51}; // copied from MusicWapCenRepKeys.h - Album Download const TUint32 KSupportOmaDownloadDescriptor = 0x00000004; // copied from MusicWapCenRepKeys.h - Album Download const TUint32 KMusicServiceFeatureFlagSupport = 0x00000012; // referred from 5.0 MusicWapCenRepKeys.h - Album Download diff -r abec8b1bb37c -r 442486f870da wmdrm/camese/wmdrmdla/group/wmdrmdla.mmp --- a/wmdrm/camese/wmdrmdla/group/wmdrmdla.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/camese/wmdrmdla/group/wmdrmdla.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -43,7 +43,7 @@ USERINCLUDE ../../../inc MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom + LIBRARY euser.lib LIBRARY efsrv.lib diff -r abec8b1bb37c -r 442486f870da wmdrm/camese/wmdrmdla/inc/wmdrmdlahandler.h --- a/wmdrm/camese/wmdrmdla/inc/wmdrmdlahandler.h Wed Jun 16 17:39:50 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -/* -* Copyright (c) 2008 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: Interface class for WMDRM DLA functionality -* -*/ - - -#ifndef C_WMDRMDLAHANDLER_H -#define C_WMDRMDLAHANDLER_H - -#include -#include - -class CWmDrmDlaHandlerImpl; - -/** - * WMDRM DLA Interface - * - * @lib wmdrmdla.lib - * @since S60 v9.1 - */ -NONSHARABLE_CLASS( CWmDrmDlaHandler ) : public CBase - { - -public: - - IMPORT_C static CWmDrmDlaHandler* NewL(); - IMPORT_C static CWmDrmDlaHandler* NewLC(); - - /** - * Destructor. - */ - virtual ~CWmDrmDlaHandler(); - - /** - * Checks if license acquisition for file is silent - * - * @param aFile wmdrm file - * @return ETrue if license acquisition is silent - * @leave KErrNotFound if there is no handler for the file - */ - IMPORT_C TBool SilentL( const RFile& aFile ); - - /** - * Acquire license based on the file handle - * - * @param aFile wmdrm file - * @param aContentUrl contains content URL on return. Can be NULL. - * If it's not NULL, it must be freed by caller. - * @param aHtmlData contains HTML data returned by license server on - * return. Can be NULL. - * If it's not NULL, it must be freed by caller. - * @leave KErrNotFound if there is no handler for the file - */ - IMPORT_C void AcquireLicenseL( const RFile& aFile, HBufC*& aContentUrl, - HBufC*& aHtmlData ); - - /** - * Acquire license based on the file handle, asynchronous version - * - * @param aFile wmdrm file - * @param aContentUrl contains content URL on completion. Can be NULL. - * If it's not NULL, it must be freed by caller. - * @param aHtmlData contains HTML data returned by license server on - * completion. Can be NULL. - * If it's not NULL, it must be freed by caller. - * @param aStatus Request status. On completion contains the error code. - */ - IMPORT_C void AcquireLicense( const RFile& aFile, HBufC*& aContentUrl, - HBufC*& aHtmlData, TRequestStatus& aStatus ); - - /** - * Acquire license based on the DRM Header - * - * @param aDrmHeader DRM Header - * @param aErrorUrl URL where error code is sent. Can be NULL. - * @param aContentUrl contains content URL on return. Can be NULL. - * If it's not NULL, it must be freed by caller. - * @param aHtmlData contains HTML data returned by license server on - * return. Can be NULL. - * If it's not NULL, it must be freed by caller. - * @leave KErrNotFound if there is no handler for the file - */ - IMPORT_C void AcquireLicenseFromDrmHeaderL( const TDesC8& aDrmHeader, - HBufC* aErrorUrl, - HBufC*& aContentUrl, - HBufC*& aHtmlData ); - - /** - * Acquire license based on the DRM Header, asynchronous version - * - * @param aDrmHeader DRM Header - * @param aErrorUrl URL where error code is sent. Can be NULL. - * @param aContentUrl contains content URL on completion. Can be NULL. - * If it's not NULL, it must be freed by caller. - * @param aHtmlData contains HTML data returned by license server on - * completion. Can be NULL. - * If it's not NULL, it must be freed by caller. - * @param aStatus Request status. On completion contains the error code. - */ - IMPORT_C void AcquireLicenseFromDrmHeader( const TDesC8& aDrmHeader, - HBufC* aErrorUrl, - HBufC*& aContentUrl, - HBufC*& aHtmlData, - TRequestStatus& aStatus ); - - /** - * Cancels ongoing license acquisition - * - */ - IMPORT_C void CancelLicenseAcquisition(); - - /** - * Handles metering certificate OTA - * - * @param aCertificate metering certificate - */ - IMPORT_C void ProcessMeteringCertificateL( const TDesC8& aCertificate ); - - /** - * Handles metering certificate OTA, asynchronous version - * - * @param aCertificate metering certificate - * @param aStatus Request status. On completion contains the error code. - */ - IMPORT_C void ProcessMeteringCertificate( const TDesC8& aCertificate, - TRequestStatus& aStatus ); - - /** - * Cancels ongoing metering - * - */ - IMPORT_C void CancelMetering(); - - /** - * Sets the IAP to be used in the HTTP transactions - * - * @param aIapId Internet Access Point id - */ - IMPORT_C void SetIapId( TInt aIapId ); - -protected: - -private: - - CWmDrmDlaHandler(); - - void ConstructL(); - -private: // data - - /** - * Implementation class - * Own. - */ - CWmDrmDlaHandlerImpl* iImpl; - - }; - -#endif // C_WMDRMDLAHANDLER_H diff -r abec8b1bb37c -r 442486f870da wmdrm/camese/wmdrmdla/inc/wmdrmdlahttpfwpluginresolver.h --- a/wmdrm/camese/wmdrmdla/inc/wmdrmdlahttpfwpluginresolver.h Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/camese/wmdrmdla/inc/wmdrmdlahttpfwpluginresolver.h Thu Jul 22 16:35:50 2010 +0100 @@ -20,7 +20,7 @@ #define WMDRMDLAHTTPFWPLUGINRESOLVER_H #include -#include +#include class CWmDrmDlaPluginContainer; class CAknIconArray; diff -r abec8b1bb37c -r 442486f870da wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp --- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -107,6 +107,10 @@ // CWmDrmDlaBrowserContainer::~CWmDrmDlaBrowserContainer() { + if(iBrCtlInterface != NULL) + { + TRAP_IGNORE( iBrCtlInterface->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase )); + } delete iBrCtlInterface; } diff -r abec8b1bb37c -r 442486f870da wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp --- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -155,6 +155,8 @@ } else { + iContainer->BrCtlInterface()->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + + (TInt)TBrCtlDefs::ECommandIdBase ); AppUi()->HandleCommandL( aCommand ); } } diff -r abec8b1bb37c -r 442486f870da wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp --- a/wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -162,6 +162,8 @@ HandleDownloadComplete( KErrCancel ); } } + // Close the HTTP session in use + iHttpSession.Close(); CleanupConnection(); DeleteUsernamePassword(); @@ -565,6 +567,9 @@ GetConnectionInfoL( info ); iIapNumber = info.iIapId; + // Close old session: + iHttpSession.Close(); + // Open session iHttpSession.OpenL(); RStringPool pool = iHttpSession.StringPool(); @@ -730,7 +735,6 @@ iHdrFields.Reset(); iHttpTransaction.Close(); - iHttpSession.Close(); if ( !iKeepAlive ) { diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmaccess/group/wmdrmaccess.mmp --- a/wmdrm/wmdrmengine/wmdrmaccess/group/wmdrmaccess.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmaccess/group/wmdrmaccess.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -30,7 +30,7 @@ SOURCE wmdrmaccess.cpp MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom + USERINCLUDE ../inc diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmaccess/src/wmdrmaccess.cpp --- a/wmdrm/wmdrmengine/wmdrmaccess/src/wmdrmaccess.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmaccess/src/wmdrmaccess.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -17,7 +17,7 @@ */ #include -#include +#include #include #include diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmagent/group/wmdrmagent.mmp --- a/wmdrm/wmdrmengine/wmdrmagent/group/wmdrmagent.mmp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmagent/group/wmdrmagent.mmp Thu Jul 22 16:35:50 2010 +0100 @@ -31,10 +31,6 @@ // Generic MW include paths MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/caf -SYSTEMINCLUDE /epoc32/include/Ecom - USERINCLUDE ../inc USERINCLUDE ../../../inc USERINCLUDE ../../asf/inc diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmotaaccess/bwins/wmdrmotaaccessu.def --- a/wmdrm/wmdrmengine/wmdrmotaaccess/bwins/wmdrmotaaccessu.def Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/bwins/wmdrmotaaccessu.def Thu Jul 22 16:35:50 2010 +0100 @@ -6,4 +6,5 @@ ?GetLicenseChallengeL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAPAVHBufC8@@AAVTRequestStatus@@@Z @ 5 NONAME ; void CWmDrmOtaAccess::GetLicenseChallengeL(class TDesC8 const &, class HBufC8 * &, class TRequestStatus &) ?HandleLicenseResponseL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAVTRequestStatus@@@Z @ 6 NONAME ; void CWmDrmOtaAccess::HandleLicenseResponseL(class TDesC8 const &, class TRequestStatus &) ?GetLicenseChallengeL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAPAVHBufC8@@@Z @ 7 NONAME ; void CWmDrmOtaAccess::GetLicenseChallengeL(class TDesC8 const &, class HBufC8 * &) + ?CancelAllAsync@CWmDrmOtaAccess@@QAEXXZ @ 8 NONAME ; void CWmDrmOtaAccess::CancelAllAsync(void) diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmotaaccess/eabi/wmdrmotaaccessu.def --- a/wmdrm/wmdrmengine/wmdrmotaaccess/eabi/wmdrmotaaccessu.def Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/eabi/wmdrmotaaccessu.def Thu Jul 22 16:35:50 2010 +0100 @@ -8,4 +8,5 @@ _ZN15CWmDrmOtaAccess20GetLicenseChallengeLERK6TDesC8RP6HBufC8R14TRequestStatus @ 7 NONAME _ZN15CWmDrmOtaAccess22HandleLicenseResponseLERK6TDesC8 @ 8 NONAME _ZN15CWmDrmOtaAccess22HandleLicenseResponseLERK6TDesC8R14TRequestStatus @ 9 NONAME + _ZN15CWmDrmOtaAccess14CancelAllAsyncEv @ 10 NONAME diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmotaaccess/src/wmdrmotaaccess.cpp --- a/wmdrm/wmdrmengine/wmdrmotaaccess/src/wmdrmotaaccess.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/src/wmdrmotaaccess.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -121,6 +121,7 @@ iWmDrmOtaAccessEcomInterface->HandleLicenseResponseL( aResponse ); } + // --------------------------------------------------------------------------- // CWmDrmOtaAccess::HandleLicenseResponseL // --------------------------------------------------------------------------- @@ -137,7 +138,19 @@ aStatus ); } - +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::CancelAllAsync +// --------------------------------------------------------------------------- +EXPORT_C void CWmDrmOtaAccess::CancelAllAsync() + { + // Ecom interface not available + if( !iWmDrmOtaAccessEcomInterface ) + { + return; + } + + iWmDrmOtaAccessEcomInterface->CancelAllAsync(); + } // End of file diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmserver/client/BWINS/wmdrmclientU.DEF --- a/wmdrm/wmdrmengine/wmdrmserver/client/BWINS/wmdrmclientU.DEF Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmserver/client/BWINS/wmdrmclientU.DEF Thu Jul 22 16:35:50 2010 +0100 @@ -24,4 +24,5 @@ ?DeleteRights@RWmDrmClient@@QAEHXZ @ 23 NONAME ; int RWmDrmClient::DeleteRights(void) ?StoreState@RWmDrmClient@@QAEHAAW4TWmDrmStoreState@@@Z @ 24 NONAME ; int RWmDrmClient::StoreState(enum TWmDrmStoreState &) ?GetTime@RWmDrmClient@@QAEHAAVTTime@@AAH@Z @ 25 NONAME ; int RWmDrmClient::GetTime(class TTime &, int &) + ?CommitData@RWmDrmClient@@QAEHXZ @ 26 NONAME ; int RWmDrmClient::CommitData(void) diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmserver/client/EABI/wmdrmclientU.DEF --- a/wmdrm/wmdrmengine/wmdrmserver/client/EABI/wmdrmclientU.DEF Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmserver/client/EABI/wmdrmclientU.DEF Thu Jul 22 16:35:50 2010 +0100 @@ -24,4 +24,5 @@ _ZN12RWmDrmClient12DeleteRightsEv @ 23 NONAME _ZN12RWmDrmClient10StoreStateER16TWmDrmStoreState @ 24 NONAME _ZN12RWmDrmClient7GetTimeER5TTimeRi @ 25 NONAME + _ZN12RWmDrmClient10CommitDataEv @ 26 NONAME diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmserver/client/src/wmdrmclient.cpp --- a/wmdrm/wmdrmengine/wmdrmserver/client/src/wmdrmclient.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmserver/client/src/wmdrmclient.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -542,4 +542,17 @@ return r; }; +//--------------------------------------------------------------------------- +// RWmDrmClient::CommitData +//--------------------------------------------------------------------------- +// +EXPORT_C TInt RWmDrmClient::CommitData() + { + TInt r = KErrNone; + LOGFNR( "RWmDrmClient::CommitData", r ); + r = SendReceive( ECommitData ); + return r; + }; + + diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmserver/server/inc/clock.h --- a/wmdrm/wmdrmengine/wmdrmserver/server/inc/clock.h Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmserver/server/inc/clock.h Thu Jul 22 16:35:50 2010 +0100 @@ -35,7 +35,7 @@ public: static const TInt KClockInterval = 15 * 60 * 1000000; - static CClock* CClock::NewL( CWmDrmServer* aServer ); + static CClock* NewL( CWmDrmServer* aServer ); ~CClock(); CClock( CWmDrmServer* aServer ); diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmclientserver.h --- a/wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmclientserver.h Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmclientserver.h Thu Jul 22 16:35:50 2010 +0100 @@ -47,7 +47,8 @@ ESetTimeAsValid, EDeleteRights, EStoreState, - EGetTime + EGetTime, + ECommitData }; #endif // __WMDRMCLIENTSERVER_H diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmdb.h --- a/wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmdb.h Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmdb.h Thu Jul 22 16:35:50 2010 +0100 @@ -109,6 +109,12 @@ TInt DataBaseSize( TBool aConfiguredDrive ); + // Checks how many SQL statements are prepared (buffered) currently and if either the maximum + // amount of buffered statements is exceeded or an enforced commit is needed, COMMITs the + // statements. The method also starts a new BEGIN statement after the commit operation to + // start a new buffering round of SQL statements. This method also controls a timer for + // triggering enforced commit after a predefined idle period without any prepared SQL statements. + void CheckDatabaseCommitL( TBool aEnforcedCommit ); protected: // from base class CActive void RunL(); @@ -131,12 +137,7 @@ void ConvertOldLicenseStoreL(); - // Checks how many SQL statements are prepared (buffered) currently and if either the maximum - // amount of buffered statements is exceeded or an enforced commit is needed, COMMITs the - // statements. The method also starts a new BEGIN statement after the commit operation to - // start a new buffering round of SQL statements. This method also controls a timer for - // triggering enforced commit after a predefined idle period without any prepared SQL statements. - void CheckDatabaseCommitL( TBool aEnforcedCommit ); + void Activate(); private: // data diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmsession.h --- a/wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmsession.h Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmserver/server/inc/wmdrmsession.h Thu Jul 22 16:35:50 2010 +0100 @@ -224,6 +224,13 @@ */ void GetTimeL( const RMessage2& aMessage ); + + /* Commits the database + * + * @param aMessage IPC message (not used) + */ + void CommitDataL( const RMessage2& aMessage ); + private: /* Desctructor. */ diff -r abec8b1bb37c -r 442486f870da wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmsession.cpp --- a/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmsession.cpp Wed Jun 16 17:39:50 2010 +0100 +++ b/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmsession.cpp Thu Jul 22 16:35:50 2010 +0100 @@ -686,6 +686,21 @@ aMessage.WriteL(1, validityPckg); } + +//--------------------------------------------------------------------------- +// CWmDrmSession::CommitDataL +//--------------------------------------------------------------------------- +// +void CWmDrmSession::CommitDataL( const RMessage2& aMessage ) + { + + LOGFN( "CWmDrmSession::CommitDataL" ); + + // Force a commit on the database + Server().Db()->CheckDatabaseCommitL( ETrue ); + } + + //--------------------------------------------------------------------------- // CWmDrmSession::ServiceL @@ -787,7 +802,10 @@ break; case EGetTime: TRAP( trap, GetTimeL( aMessage ) ); - break; + break; + case ECommitData: + TRAP( trap, CommitDataL( aMessage ) ); + break; default: r = KErrArgument; break;