# HG changeset patch # User Pat Downey # Date 1283340076 -3600 # Node ID 1481bf457703c57fcf02a7f1ff7353967f053965 # Parent 1221b68b8a5f3878c3b0b81e46d7599f320db37e Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035 diff -r 1221b68b8a5f -r 1481bf457703 commondrm/commondrm.pro --- a/commondrm/commondrm.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -# -# 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 1221b68b8a5f -r 1481bf457703 commondrm/drmbrowserlauncher/bwinscw/DRMBrowserLauncheru.def --- a/commondrm/drmbrowserlauncher/bwinscw/DRMBrowserLauncheru.def Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -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 1221b68b8a5f -r 1481bf457703 commondrm/drmbrowserlauncher/drmbrowserlauncher.pro --- a/commondrm/drmbrowserlauncher/drmbrowserlauncher.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -# -# 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 1221b68b8a5f -r 1481bf457703 commondrm/drmbrowserlauncher/eabi/DRMBrowserLauncheru.def --- a/commondrm/drmbrowserlauncher/eabi/DRMBrowserLauncheru.def Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _ZN3DRM19CDrmBrowserLauncher10LaunchUrlLER7TDesC16 @ 1 NONAME - _ZN3DRM19CDrmBrowserLauncher4NewLEv @ 2 NONAME - _ZN3DRM19CDrmBrowserLauncher5NewLCEv @ 3 NONAME - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmbrowserlauncher/src/drmbrowserlauncher.cpp --- a/commondrm/drmbrowserlauncher/src/drmbrowserlauncher.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/data/DRMEncryptor.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/data/DRMEncryptor.rss Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,466 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/data/DRMEncryptor_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/data/DRMEncryptor_caption.rss Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,25 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/data/DRMEncryptor_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/data/DRMEncryptor_reg.rss Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,43 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/group/DRMEncryptor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/group/DRMEncryptor.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,107 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/group/DRMEncryptor.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/group/DRMEncryptor.pkg Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,39 @@ +; +; 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/group/icon.bmp Binary file commondrm/drmencryptor/group/icon.bmp has changed diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/group/icon_mask_soft.bmp Binary file commondrm/drmencryptor/group/icon_mask_soft.bmp has changed diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/group/qgn_menu_DRMEncryptor.bmp Binary file commondrm/drmencryptor/group/qgn_menu_DRMEncryptor.bmp has changed diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_cxt.bmp Binary file commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_cxt.bmp has changed diff -r 1221b68b8a5f -r 1481bf457703 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_mask_soft.bmp Binary file commondrm/drmencryptor/group/qgn_menu_DRMEncryptor_mask_soft.bmp has changed diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/DRMEncryptor.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/DRMEncryptor.hrh Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,56 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/DRMEncryptor.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/DRMEncryptor.rh Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,42 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/DRMEncryptorApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/DRMEncryptorApp.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,58 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/DRMEncryptorAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/DRMEncryptorAppUi.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,79 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/DRMEncryptorContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/DRMEncryptorContainer.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,78 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/DRMEncryptorDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/DRMEncryptorDocument.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,66 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/DRMEncryptorImage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/DRMEncryptorImage.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,74 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/DRMPlayServerTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/DRMPlayServerTest.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,57 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/inc/Performance.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/inc/Performance.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,27 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DRMEncryptorApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DRMEncryptorApp.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,66 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DRMEncryptorAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DRMEncryptorAppUi.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,257 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DRMEncryptorContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DRMEncryptorContainer.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,444 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DRMEncryptorDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DRMEncryptorDocument.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,60 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DRMEncryptorImage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DRMEncryptorImage.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,112 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DRMPlayServerTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DRMPlayServerTest.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,85 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,239 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DrmEncryptor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DrmEncryptor.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,577 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/DrmKeyStorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/DrmKeyStorage.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,334 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmencryptor/src/Performance.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmencryptor/src/Performance.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,861 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmqtencryptor/drmencryptor.h --- a/commondrm/drmqtencryptor/drmencryptor.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +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. -* -*/ - -#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 deleteOmaDrmDB(); - 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 *iDeleteOMADRMDBAct; - 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 1221b68b8a5f -r 1481bf457703 commondrm/drmqtencryptor/drmencryptor.ui --- a/commondrm/drmqtencryptor/drmencryptor.ui Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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. -* -*/ - - - - mainWindow - - - - 0 - 0 - 310 - 498 - - - - DRMEncryptor - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmqtencryptor/drmencyptor.cpp --- a/commondrm/drmqtencryptor/drmencyptor.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,795 +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. -* -*/ - -#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.")); - - iDeleteOMADRMDBAct = new QAction(tr("&Delete OMADRM DB"), this); - iDeleteOMADRMDBAct->setStatusTip(tr("Delete OMADRM Database rights.")); - - menuBar()->addAction(iSetDRMClockAct); - menuBar()->addAction(iGetDRMClockAct); - menuBar()->addAction(iEncryptAct); - menuBar()->addAction(iDeleteWMDRMDBAct); - menuBar()->addAction(iDeleteOMADRMDBAct); - 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(iDeleteOMADRMDBAct, SIGNAL(triggered()), this, SLOT(deleteOmaDrmDB())); - 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::deleteOmaDrmDB() - { - RDRMRightsClient client; - User::LeaveIfError(client.Connect()); - client.DeleteAll(); - client.Close(); - } - - - -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 1221b68b8a5f -r 1481bf457703 commondrm/drmqtencryptor/main.cpp --- a/commondrm/drmqtencryptor/main.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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. -* -*/ - -#include -#include "drmencryptor.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - DRMEncryptor w; - w.showMaximized(); - return a.exec(); -} diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmqtencryptor/qt_drmencryptor.pro --- a/commondrm/drmqtencryptor/qt_drmencryptor.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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 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 -ldrmserverinterfaces diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmrightsmanagerui/group/DRMRightsManager.mmp --- a/commondrm/drmrightsmanagerui/group/DRMRightsManager.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmrightsmanagerui/group/DRMRightsManager.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -59,6 +59,7 @@ 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 1221b68b8a5f -r 1481bf457703 commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsContainer.h --- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsContainer.h Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsContainer.h Wed Sep 01 12:21:16 2010 +0100 @@ -33,8 +33,6 @@ #include #include -#include "DRMRightsMgrDetailsContainer.h" - // FORWARD DECLARATIONS class CDRMRightsConstraints; diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmrightsmanagerui/loc/DRMRightsManager.loc --- a/commondrm/drmrightsmanagerui/loc/DRMRightsManager.loc Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmrightsmanagerui/loc/DRMRightsManager.loc Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003 - 2008 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -22,7 +22,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_view_det "Licence details" +#define qtn_drm_mgr_view_det "License details" //d:Command in options menu. //l:list_single_pane_t1_cp2 @@ -44,42 +44,42 @@ //w: //r:3.0 // -#define qtn_drm_mgr_restore "Restore licences" +#define qtn_drm_mgr_restore "Restore licenses" //d:Caption and short caption. "Activ." stands for "Activation" //l:cell_app_pane_t1 //w: //r:3.0 // -#define qtn_drm_mgr "Licences" +#define qtn_drm_mgr "Licenses" //d:Title pane text in main view //l:title_pane_t2/opt9 //w: //r:3.0 // -#define qtn_drm_mgr_title_pane "Licences" +#define qtn_drm_mgr_title_pane "Licenses" //d:Error message //l:popup_note_window //w: //r:3.0 // -#define qtn_drm_mgr_query_restart "Unable to access licences. Phone will restart. Continue?" +#define qtn_drm_mgr_query_restart "Unable to access licenses. Phone will restart. Continue?" //d:Error message //l:popup_note_window //w: //r:3.0 // -#define qtn_drm_mgr_note_backup "Unable to access licences. Licence list should be restored." +#define qtn_drm_mgr_note_backup "Unable to access licenses. License list should be restored." //d:Empty text in listbox //l:main_list_empty_pane //w: //r:3.0 // -#define qtn_drm_mgr_no_files "no licences" +#define qtn_drm_mgr_no_files "no licenses" //d:Text to be used when related Media Object is not found in device //d:%N is a progressive number @@ -103,14 +103,14 @@ //w: //r:3.0 // -#define qtn_drm_mgr_det_valid "Licence is valid" +#define qtn_drm_mgr_det_valid "License is valid" //d:Possible second line for first entry of Details View listbox //l:list_double_pane_t2_cp2 //w: //r:3.0 // -#define qtn_drm_mgr_det_exp "Licence expired" +#define qtn_drm_mgr_det_exp "License expired" //d:First line of 'Content in phone' entry in Details View listbox. //d:It says if related Media Object is in device or not. If Media object is in device and not in a private @@ -575,7 +575,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_auto_del_romo "If you delete licence, %U will also be deleted. Continue?" +#define qtn_drm_mgr_auto_del_romo "If you delete license, %U will also be deleted. Continue?" //d:Confirmation query text used when deleting a Right Object //d:%U name of the file @@ -583,7 +583,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_del_single_ro "If you delete licence, file %U cannot be used. Continue?" +#define qtn_drm_mgr_del_single_ro "If you delete license, file %U cannot be used. Continue?" //d:Confirmation query text proposed to ask if also related file should be deleted //d:%U name of the file @@ -599,7 +599,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_wait_del_one_ro "Deleting licence for %U" +#define qtn_drm_mgr_wait_del_one_ro "Deleting license for %U" //d:Text during deletion //d:%U name of the file @@ -607,7 +607,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_wait_del_roco "Deleting %U and licence" +#define qtn_drm_mgr_wait_del_roco "Deleting %U and license" //d:Notification after deletion //d:%U name of the file @@ -615,7 +615,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_deleted_one_ro "Licence for %U deleted" +#define qtn_drm_mgr_deleted_one_ro "License for %U deleted" //d:Notification after deletion //d:%U name of the file @@ -623,7 +623,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_deleted_roco "Licence and %U deleted" +#define qtn_drm_mgr_deleted_roco "License and %U deleted" //d:Confirmation query text //d:%U name of the file @@ -639,7 +639,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_note_ro_removed "Unable to access licence" +#define qtn_drm_mgr_note_ro_removed "Unable to access license" // NEW STRINGS @@ -649,14 +649,14 @@ //w: //r:3.0 // -#define qtn_drm_mgr_list_valid_keys "Valid licences" +#define qtn_drm_mgr_list_valid_keys "Valid licenses" //d:Second item data text of Main View //l:list_single_large_graphic_pane_t1_cp2 //w: //r:3.0 // -#define qtn_drm_mgr_list_invalid_keys "Invalid licences" +#define qtn_drm_mgr_list_invalid_keys "Invalid licenses" //d:Third item data text of Main View //l:list_single_large_graphic_pane_t1_cp2 @@ -670,7 +670,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_del_group_ro_descr "After deleting the licence, several files may not be used" +#define qtn_drm_mgr_del_group_ro_descr "After deleting the license, several files may not be used" //d:Title of the list query //l:heading_pane_t1 @@ -691,14 +691,14 @@ //w: //r:3.0 // -#define qtn_drm_mgr_delete_group_ro "Delete licence to the files" +#define qtn_drm_mgr_delete_group_ro "Delete license to the files" //d:Notification after deletion //l:popup_note_window //w: //r:3.0 // -#define qtn_drm_mgr_deleted_ro "Licence deleted" +#define qtn_drm_mgr_deleted_ro "License deleted" //d:Data query prompt text When renaming an item //l:popup_query_data_window @@ -713,21 +713,21 @@ //w: //r:3.0 // -#define qtn_drm_mgr_title_valid_keys "Valid licences" +#define qtn_drm_mgr_title_valid_keys "Valid licenses" //d:Title pane text for Invalid keys View //l:title_pane_t2/opt9 //w: //r:3.0 // -#define qtn_drm_mgr_title_invalid_keys "Invalid licences" +#define qtn_drm_mgr_title_invalid_keys "Invalid licenses" //d:Title pane text for Keys not in use View //l:title_pane_t2/opt9 //w: //r:3.0 // -#define qtn_drm_mgr_title_keys_not_used "Licences not in use" +#define qtn_drm_mgr_title_keys_not_used "Licenses not in use" //d:Empty text in listbox //l:main_list_empty_pane @@ -744,7 +744,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_name_group_key "Group licence %N" +#define qtn_drm_mgr_name_group_key "Group license %N" //d:Menu item used in Group view to see the details of a Media Object. //l:list_single_pane_t1_cp2 @@ -786,7 +786,7 @@ //w: //r:3.0 // -#define qtn_drm_det_ro_number "Licence %0N/%1N" +#define qtn_drm_det_ro_number "License %0N/%1N" //d:Possible second line for first entry (qtn_drm_mgr_det_stat) of Details View //d:listbox, when the activation key is missing. @@ -794,7 +794,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_det_invalid "Licence is invalid" +#define qtn_drm_mgr_det_invalid "License is invalid" //d:Possible second line for first entry (qtn_drm_det_ro_number) of Details //d:View listbox, when the activation key is not yet valid. @@ -802,7 +802,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_det_not_valid_yet "Licence not valid yet" +#define qtn_drm_mgr_det_not_valid_yet "License not valid yet" //d:Command in options menu, used to rename a Group key. //l:list_single_pane_t1_cp2 @@ -838,7 +838,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_info_unable_delete "Licence lists are updated. Unable to delete during updating." +#define qtn_drm_mgr_info_unable_delete "License lists are updated. Unable to delete during updating." //d:Info popup for an activation key with future rights. %U is the date when //d:the activation key will start to be valid @@ -846,7 +846,7 @@ //w: //r:3.0 // -#define qtn_drm_mgr_info_popup_future "Licence is valid from %U" +#define qtn_drm_mgr_info_popup_future "License is valid from %U" //d:Possible first line for fourth entry of Details View listbox //d:Second line is qtn_drm_mgr_det_inter or qtn_drm_mgr_det_inter_two, meaning @@ -862,7 +862,7 @@ //l:popup_note_window //r:3.0 // -#define qtn_drm_mgr_query_enable_keys "Restore licences and enable on this phone?" +#define qtn_drm_mgr_query_enable_keys "Restore licenses and enable on this phone?" //d:Progress dialog text //d:Label for UDT progress note until HTTP connection has been estabilished @@ -883,7 +883,7 @@ //l:popup_note_wait_window //r:3.0 // -#define qtn_drm_mgr_prgr_restoring_keys "Restoring licences" +#define qtn_drm_mgr_prgr_restoring_keys "Restoring licenses" //d:Text for password editor in multiline query @@ -919,7 +919,7 @@ //l:popup_note_window //r:3.0 // -#define qtn_drm_mgr_info_no_backup_ros "No licences to restore" +#define qtn_drm_mgr_info_no_backup_ros "No licenses to restore" //d:Information note layout //d:Server unavailable @@ -933,7 +933,7 @@ //w: //r:3.1 // -#define qtn_drm_mgr_options_get_new_key "Get new licence" +#define qtn_drm_mgr_options_get_new_key "Get new license" //d:Confirmation query text //d:Shown when user has selected option Get new key, but valid, unlimited rights exist @@ -941,7 +941,7 @@ //w: //r:3.1 // -#define qtn_drm_mgr_query_unlimited_ro "Licence is valid for unlimited time. Get still new licence?" +#define qtn_drm_mgr_query_unlimited_ro "License is valid for unlimited time. Get still new license?" //d:First line of an entry of Details View listbox, for an individual constraint. //d:Second line is qtn_drm_det_sim_allowed or qtn_drm_det_sim_not_allowed. @@ -1023,7 +1023,7 @@ //w: //r:9.1 // -#define qtn_drm_details_valid "Licence is valid" +#define qtn_drm_details_valid "License is valid" //d:Possible second line for first entry of Details View listbox //l:list_double_pane_t2_cp2 @@ -1037,7 +1037,7 @@ //w: //r:9.1 // -#define qtn_drm_details_no_licence_available "No licence available" +#define qtn_drm_details_no_licence_available "No license available" //d:First line of third entry of Details View listbox //d:It reports if it is possible to send Media Object or not. @@ -1260,4 +1260,4 @@ //w: //r:9.1 // -#define qtn_drm_mgr_det_ex_unlimited "Unlimited" +#define qtn_drm_mgr_det_ex_unlimited "Unlimited" \ No newline at end of file diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1096,7 +1096,7 @@ if ( i == 0 ) { // No need to check if the parent UID is a duplicate - parentUidList.AppendL ( permissionList[i]->iParentUID ); + parentUidList.Append( permissionList[i]->iParentUID ); } else { @@ -1132,7 +1132,7 @@ for ( k = 0; k < permissionTempList.Count(); k++ ) { // Store the pointer to the main list of permissions - permissionList.AppendL ( permissionTempList[k] ); + permissionList.Append( permissionTempList[k] ); } // Close the temporary pointer array so that the referenced diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -841,10 +841,8 @@ TInt aIntYrs, TInt aIntMon, TInt aIntDay, TInt aIntHrs, TInt aIntMin, TInt aIntSec ) { - // Only the two most meaningful data will be showed - TInt numOfData = 0; - - CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 2 ); + + CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 1 ); CleanupStack::PushL( strings ); if ( aIntYrs > 0 ) @@ -855,10 +853,8 @@ R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR, R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO, strings ); - numOfData++; } - - if ( aIntMon > 0 ) + else if ( aIntMon > 0 ) { // Second type not provided because 11 is the maximum AddSinglePartOfTimeL( aIntMon, @@ -867,11 +863,8 @@ R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR, R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO, strings ); - numOfData++; } - - // Only if years or months were missing - if ( aIntDay > 0 && numOfData < 2 ) + else if ( aIntDay > 0 ) { AddSinglePartOfTimeL( aIntDay, R_QTN_DRM_NBR_OF_DAYS_ONE, @@ -879,10 +872,8 @@ R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR, R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO, strings ); - numOfData++; } - - if ( aIntHrs > 0 && numOfData < 2 ) + else if ( aIntHrs > 0 ) { AddSinglePartOfTimeL( aIntHrs, R_QTN_DRM_NBR_OF_HOURS_ONE, @@ -890,10 +881,8 @@ R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR, R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO, strings ); - numOfData++; } - - if ( aIntMin > 0 && numOfData < 2 ) + else if ( aIntMin > 0 ) { AddSinglePartOfTimeL( aIntMin, R_QTN_DRM_NBR_OF_MINS_ONE, @@ -901,11 +890,9 @@ R_QTN_DRM_NBR_OF_MINS_TWO_FOUR, R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO, strings ); - numOfData++; } - // If interval is 0, then it shows "0 seconds" anyway - if ( ( aIntSec > 0 && numOfData < 2 ) || numOfData == 0 ) + else { AddSinglePartOfTimeL( aIntSec, R_QTN_DRM_NBR_OF_SECS_ONE, @@ -913,21 +900,10 @@ R_QTN_DRM_NBR_OF_SECS_TWO_FOUR, R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO, strings ); - numOfData++; } - HBufC* stringHolder; - if ( numOfData == 1 ) - { - stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER, + HBufC* stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER, strings->MdcaPoint(0), iEikonEnv ); - } - else - { - stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER_TWO, - *strings, iEikonEnv ); - } - CleanupStack::PopAndDestroy( strings ); return stringHolder; diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/data/102750CC.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/data/102750CC.rss Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,46 @@ +/* +* 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: ECOM plugin resource file for DRMSettingsPlugin. +* +*/ + +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x102750CC; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10207236; // UID for CGSPluginInterface + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x102750CD; + version_no = 1; + display_name = "DRM Settings Plugin"; + default_data = "0x1020743A"; + opaque_data = "2";//Order number + } + }; + } + }; + } + + +// End of File + diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/data/drmsettingspluginrsc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/data/drmsettingspluginrsc.rss Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,533 @@ +/* +* 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: Resource file for DRMSettinsPlugin +* +*/ + + + +// RESOURCE IDENTIFIER +NAME DRMS // 4 letter ID + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "drmsettingsplugin.hrh" +#include "drmsettingsplugin.rh" + + +// CONSTANTS + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE + { + } + + +RESOURCE TBUF + { + buf="DRMS"; + } + +//---------------------------------------------------- +// +// EIK_APP_INFO +// It contains application information. +// +//---------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + } + + + +//---------------------------------------------------- +// r_drm_settings_view_caption +// +// Caption for DRM Settings plugin +//---------------------------------------------------- +// +RESOURCE TBUF r_drm_settings_view_caption + { + buf = qtn_set_protected_content; + } + + +//---------------------------------------------------- +// +// r_drm_settings_view_title +// Title of DRM Settings view +// +//---------------------------------------------------- +// +RESOURCE TITLE_PANE r_drm_settings_view_title + { + txt = qtn_set_protected_content; + } + + +//---------------------------------------------------- +// +// r_drm_softkeys_options_back_change +// Text association with MSK ( CHANGE ) +// +//---------------------------------------------------- +// +RESOURCE CBA r_drm_softkeys_options_back_change + { + buttons = + { + CBA_BUTTON + { + id=EAknSoftkeyOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id=EAknSoftkeyBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id=EDRMSettingsCmdAppChangeMSK; + txt = qtn_msk_change; + } + }; + } + + + + +//---------------------------------------------------- +// +// r_drm_settings_view +// DRM Settings view. +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_drm_settings_view + { + menubar = r_drm_settings_menubar_change_exit; + cba = r_drm_softkeys_options_back_change; + } + + +// ----------------------------------------------------------------------------- +// +// r_drm_settings_menubar_change_exit +// Menu with 'change' and 'exit' items. +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_drm_settings_menubar_change_exit + { + titles = + { + MENU_TITLE + { + menu_pane = r_drm_settings_menu_item_exit; + }, + MENU_TITLE + { + menu_pane = r_drm_settings_menu_item_change; + } + }; + } + + + // ----------------------------------------------------------------------------- + // + // r_drm_settings_menu_item_exit + // Options menu items 'Help' and 'Exit'. Used instead of plain 'Exit' when help + // is wanted to be shown in UI. + // + // ----------------------------------------------------------------------------- + // + RESOURCE MENU_PANE r_drm_settings_menu_item_exit + { + items = + { + MENU_ITEM + { + command = EAknCmdHelp; + txt = qtn_options_help; + }, + MENU_ITEM + { + command = EAknCmdExit; + txt = qtn_options_exit; + } + }; + } + + +// ----------------------------------------------------------------------------- +// +// r_drm_settings_menu_item_change +// Change item. +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_drm_settings_menu_item_change + { + items = + { + MENU_ITEM + { + command = EDRMSettingsCmdAppChange; + txt = qtn_set_options_change; + flags = EEikMenuItemAction; + } + }; + } + + +//---------------------------------------------------- +// +// r_drm_settings_lbx +// DRM Settings view's listbox. +// +//---------------------------------------------------- +// +RESOURCE DRM_SETTINGS_FEATURE_ARRAY r_drm_settings_lbx + { + items = + { +#ifdef __DRM_OMA2 +#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION + DRM_SETTINGS_FEATURE + { + txt = " \t"qtn_set_automatic_activation"\t\t"; + item = EDRMSettingsIdAutomaticActivation; + }, +#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION + +#ifdef RD_DRM_METERING + DRM_SETTINGS_FEATURE + { + txt = " \t"qtn_drm_set_usage_reporting"\t\t"; + item = EDRMSettingsIdUsageReporting; + }, +#endif // RD_DRM_METERING + + DRM_SETTINGS_FEATURE + { + txt = " \t"qtn_set_transaction_tracking"\t\t"; + item = EDRMSettingsIdTransactionTracking; + }, +#endif // __DRM_OMA2 + + DRM_SETTINGS_FEATURE + { + txt = " \t"qtn_drm_set_license_deletion"\t\t"; + item = EDRMSettingsIdWMDRMLicenseDeletion; + } + }; + } + +//---------------------------------------------------- +// +// r_drm_settings_lbx_no_oma2 +// DRM Settings view's listbox when OMA DRM version +// 2 is configured not to be supported. +// +//---------------------------------------------------- +// +RESOURCE DRM_SETTINGS_FEATURE_ARRAY r_drm_settings_lbx_no_oma2 + { + items = + { + DRM_SETTINGS_FEATURE + { + txt = " \t"qtn_drm_set_license_deletion"\t\t"; + item = EDRMSettingsIdWMDRMLicenseDeletion; + } + }; + } + + + +//---------------------------------------------------- +// +// r_drm_settings_setting_listbox +// Common listbox editor resource for setting pages. +// +//---------------------------------------------------- +// +RESOURCE LISTBOX r_drm_settings_setting_listbox + { + flags = EEikListBoxMultipleSelection; + } + + +//---------------------------------------------------- +// +// r_ttracking_setting_page +// Transaction tracking setting page. +// +//---------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_ttracking_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + label = qtn_drm_set_popup_trans_track; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + type = EAknSetListBox; + editor_resource_id = r_drm_settings_setting_listbox; + } + + +//---------------------------------------------------- +// +// r_ttracking_setting_page_lbx +// Transaction tracking setting page's listbox. +// +//---------------------------------------------------- +// +RESOURCE ARRAY r_ttracking_setting_page_lbx + { + items = + { + LBUF + { + txt = qtn_set_transact_tracking_on; + }, + LBUF + { + txt = qtn_set_transact_tracking_off; + } + }; + } + + +//---------------------------------------------------- +// r_drm_settings_ttracking_on +// +// DRM Settings text for Transaction tracking "On" +//---------------------------------------------------- +// +RESOURCE TBUF r_drm_settings_ttracking_on + { + buf = qtn_set_transact_tracking_on; + } + + +//---------------------------------------------------- +// r_drm_settings_ttracking_off +// +// DRM Settings text for Transaction tracking "Off" +//---------------------------------------------------- +// +RESOURCE TBUF r_drm_settings_ttracking_off + { + buf = qtn_set_transact_tracking_off; + } + + +//---------------------------------------------------- +// +// r_autom_activ_setting_page +// Automatic activation setting page. +// +//---------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_autom_activ_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + label = qtn_drm_set_popup_autom_activat; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + type = EAknSetListBox; + editor_resource_id = r_drm_settings_setting_listbox; + } + + +//---------------------------------------------------- +// +// r_autom_activ_setting_page_lbx +// Automatic activation setting page's listbox. +// +//---------------------------------------------------- +// +RESOURCE ARRAY r_autom_activ_setting_page_lbx + { + items = + { + LBUF + { + txt = qtn_set_automat_act_allowed; + }, + LBUF + { + txt = qtn_set_automat_act_not_allowed; + } + }; + } + + +//---------------------------------------------------- +// r_drm_settings_autom_activ_on +// +// DRM Settings text for Automatic activation "Allowed" +//---------------------------------------------------- +// +RESOURCE TBUF r_drm_settings_autom_activ_on + { + buf = qtn_set_automat_act_allowed; + } + + +//---------------------------------------------------- +// r_drm_settings_autom_activ_off +// +// DRM Settings text for Automatic activation "Not allowed" +//---------------------------------------------------- +// +RESOURCE TBUF r_drm_settings_autom_activ_off + { + buf = qtn_set_automat_act_not_allowed; + } + +// --------------------------------------------------------- +// +// r_drm_settings_metering_checkbox_page +// Used in checkbox list. +// +// --------------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_drm_settings_metering_checkbox_page + { + number = EAknSettingPageNoOrdinalDisplayed; + label = qtn_drm_set_popup_usage_report; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; + type = EAknSetListBox; + editor_resource_id = r_drm_settings_metering_checkbox_list; + invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL; + } + +// --------------------------------------------------------- +// +// r_drm_settings_metering_checkbox_list +// Used in checkbox list. +// +// --------------------------------------------------------- +// +RESOURCE AVKON_MULTISELECTION_LIST r_drm_settings_metering_checkbox_list + { + } + +//------------------------------------------------------------------------------ +// +// r_usage_reporting_list_title +// Title text for usage reporting listbox +// +//------------------------------------------------------------------------------ +// +RESOURCE TBUF r_usage_reporting_list_title + { + buf=qtn_drm_set_popup_usage_report; + } + + +//------------------------------------------------------------------------------ +// +// r_usage_reporting_list_empty +// Empty text for usage reporting listbox +// +//------------------------------------------------------------------------------ +// +RESOURCE TBUF r_usage_reporting_list_empty + { + buf=qtn_drm_set_pane_no_providers; + } + + +//------------------------------------------------------------------------------ +// +// r_drm_set_several_services +// 'Several' value for 'Allow usage reporting for' field +// +//------------------------------------------------------------------------------ +// +RESOURCE TBUF r_drm_set_several_services + { + buf=qtn_drm_set_several_services; + } + + +//------------------------------------------------------------------------------ +// +// r_drm_set_usage_report_none +// 'None' value for 'Allow usage reporting for' field +// +//------------------------------------------------------------------------------ +// +RESOURCE TBUF r_drm_set_usage_report_none + { + buf=qtn_drm_set_usage_report_none; + } + + +//------------------------------------------------------------------------------ +// +// r_drm_confirmation_query_metering +// Confirmation query dialog. +// +//------------------------------------------------------------------------------ +// +RESOURCE DIALOG r_drm_confirmation_query_metering + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = " "; + }; + } + }; + } + +//------------------------------------------------------------------------------ +// +// r_drm_conf_query_metering +// Confirmation query text. +// +//------------------------------------------------------------------------------ +// +RESOURCE TBUF r_drm_conf_query_metering + { + buf=qtn_drm_conf_query_metering; + } + +//End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/group/drmsettingsplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/group/drmsettingsplugin.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,84 @@ +/* +* 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: Project specification file. +* +*/ + + +#include // For RESOURCE_FILES_DIR +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET drmsettingsplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x102750CC +VENDORID VID_DEFAULT + + +SOURCEPATH ../src +SOURCE drmsettingspluginimplementationtable.cpp +SOURCE drmsettingsplugin.cpp +SOURCE drmsettingsplugincontainer.cpp +SOURCE drmsettingsmodel.cpp +SOURCE drmsettingsusagecheckbox.cpp +SOURCE drmsettingsusagelist.cpp + +//User include paths +USERINCLUDE ../inc +USERINCLUDE ../data // For *.rh +USERINCLUDE ../../../inc // ADo level inc dir +USERINCLUDE ../../../omadrm/drmengine/roapstorage/inc + +//System include paths +// Default system include paths for middleware layer modules. +// App layer include path needed for help launcher +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data + +START RESOURCE 102750CC.rss +TARGET drmsettingsplugin.rsc +END + +START RESOURCE drmsettingspluginrsc.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + + +LIBRARY aknskins.lib // for enhanced skinning +LIBRARY aknskinsrv.lib // for enhanced skinning +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY centralrepository.lib +LIBRARY commonengine.lib // For RConeResourceLoader +LIBRARY cone.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY euser.lib +LIBRARY featmgr.lib // Feature manager +LIBRARY flogger.lib // For GSLogger +LIBRARY gsecomplugin.lib +LIBRARY gsframework.lib // For base classes +LIBRARY gslistbox.lib // For CGSListBoxItemTextArray +LIBRARY hlplch.lib // for "Help" options menu +LIBRARY drmserverinterfaces.lib // Roap storage +LIBRARY charconv.lib + +SMPSAFE +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/inc/drmsettingsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsmodel.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,169 @@ +/* +* 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: DRMSettinsPlugin model. +* +*/ + +#ifndef DRMSETTINGSMODEL_H +#define DRMSETTINGSMODEL_H + +// INCLUDES +#include +#include +#include "RoapStorageClient.h" + +// FORWARD DECLARATIONS +class CDRMRIContext; + +// CONSTANTS +const TInt KDRMTransactionTrackingDisabled = 0; +const TInt KDRMTransactionTrackingEnabled = 1; + +const TInt KDRMAutomaticActivationNotAllowed = 0; +const TInt KDRMAutomaticActivationAllowed = 1; + + +// CLASS DEFINITIONS + +/** +* CDRMSettingsModel is the model class of DRMSettingsPlugin. +* It provides functions to get and set setting values. +*/ +class CDRMSettingsModel : public CBase + { + + public: // Constructor and destructor + /** + * Two-phased constructor + */ + static CDRMSettingsModel* NewL(); + + /** + * Destructor + */ + ~CDRMSettingsModel(); + + public: // New + + /** + * Get transaction tracking state + * @return KDRMTransactionTrackingDisabled + * KDRMTransactionTrackingEnabled + */ + TInt TransactionTrackingStateL(); + + /** + * Set transaction tracking state + * @param aValue updated value + */ + void SetTransactionTrackingStateL( TInt aValue ); + + /** + * Get automatic activation state + * @return KDRMAutomaticActivationNotAllowed + * KDRMAutomaticActivationAllowed + */ + TInt AutomaticActivationStateL(); + + /** + * Set automatic activation state + * @param aValue updated value + */ + void SetAutomaticActivationStateL( TInt aValue ); + + /** + * Get usage reporting state + * @return count of services for which reporting is allowed + */ + TInt UsageReportingCount(); + + /** + * Get RI alias + * + * @param aIndex : Index of the RI context + * + * @return RI alias name or RI url if no alias available + */ + HBufC* GetSingleRIAliasL( TInt aIndex ); + + /** + * Get the first RI alias, where metering is allowed + * @return RI alias name or RI url if no alias available + */ + HBufC* GetFirstAllowedMeteringRIAliasL(); + + /** + * Get number of RI contexts + * @return number of RIContexts + */ + TInt GetRiContextCount(); + + /** + * Get metering status of RI Context + * + * @param aIndex : Index of the RI context + * + * @return Status of metering + */ + TBool IsMeteringAllowed( TInt aIndex ); + + /** + * Find out if metering is allowed for all RI Contexts + * + * @return Status of metering + */ + TBool IsMeteringAllowedForAll(); + + /** + * Sets the value for metering to be enabled or disabled + * + * @param aIndex : Index of the RI context + * @param aIsAllowed : ETrue if set to allowed, EFalse if not allowed + */ + void SetMeteringStatus( TInt aIndex, TBool aIsAllowed ); + + /** + * Save the changes done to RI Contexs + */ + void SaveMeteringChanges(); + + private: // Private constructors + + /** + * Default C++ contructor + */ + CDRMSettingsModel(); + + /** + * Symbian OS default constructor + * @return void + */ + void ConstructL(); + + private: // Data + + // DRM Settings Central Repository. + CRepository* iDRMSettingsRepository; + + // Roap storage client + Roap::RRoapStorageClient* iRoapStorageClient; + + // List of service providers with which device has been registered + RPointerArray iRIContextList; + + }; + +#endif // DRMSETTINGSMODEL_H + +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/inc/drmsettingsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsplugin.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,193 @@ +/* +* 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: View for DRMSettingsPlugin. +* +*/ + + +#ifndef DRMSETTINGSPLUGIN_H +#define DRMSETTINGSPLUGIN_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#include "drmsettingsplugincontainer.h" + +//CONSTANTS +const TUid KDRMSettingsPluginUid = { 0x1020750CC }; + +// Listbox item indexes of the transcaction tracking setting items +const TInt KDRMTTItemIndexDisabled = 1; +const TInt KDRMTTItemIndexEnabled = 0; + +// Listbox item indexes of the automatic activation setting items +const TInt KDRMAAItemIndexDisabled = 1; +const TInt KDRMAAItemIndexEnabled = 0; + +// FORWARD DECLARATIONS +class CAknViewAppUi; +class CDRMSettingsPluginContainer; +class CDRMSettingsModel; + +// CLASS DECLARATION + +/** +* CDRMSettingsPlugin view class +* +* View class for DRM Settings plugin +*/ +class CDRMSettingsPlugin : public CGSBaseView + { + + public: // Constructors and destructor + + /** + * Symbian OS two-phased constructor + * @return connection view. + */ + static CDRMSettingsPlugin* NewL( TAny* aInitParams ); + + /** + * Destructor. + */ + ~CDRMSettingsPlugin(); + + private: + /** + * Symbian OS default constructor. + * + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CDRMSettingsPlugin(); + + public: // from CAknView + + /** + * Returns view id. + * @return An unsigned integer (view id). + */ + TUid Id() const; + + public: // from MEikCommandObserver + + /** + * Handles commands. + * @param aCommand Command to be handled. + * + */ + void HandleCommandL( TInt aCommand ); + + public: //new + + /** + * Updates listbox's item's value. + * @param aItemId An item which is updated. + * + */ + void UpdateListBoxL( TInt aItemId ); + + public: // From CGSPluginInterface + + /** + * @see CGSPluginInterface header file. + */ + void GetCaptionL( TDes& aCaption ) const; + + /** + * @see CGSPluginInterface header file. + */ + TInt PluginProviderCategory() const; + + /** + * @see CGSPluginInterface header file. + */ + TBool Visible() const; + + private: // from CGSBaseView + // + void NewContainerL(); + // + void HandleListBoxSelectionL(); + + private: // new + + /** + * Update transaction tracking setting + */ + void UpdateTransactionTrackingSettingL( TBool aShowSettingPage ); + + /** + * Update automatic activation setting + */ + void UpdateAutomaticActivationSettingL( TBool aShowSettingPage ); + + /** + * Update usage reporting setting + */ + void UpdateUsageReportingSettingL(); + + /** + * Delete WMDRM license store + */ + void DoWMDRMLicenseDeletionL(); + + /** + * Display setting page + * @param aTTState Current state. This will be updated. + * @return ETrue if value is updated. + * EFalse if value is not updated. + */ + TBool ShowTransactionTrackingSettingPageL( TInt& aTTState ); + + /** + * Display setting page + * @param aAAState Current state. This will be updated. + * @return ETrue if value is updated. + * EFalse if value is not updated. + */ + TBool ShowAutomaticActivationSettingPageL( TInt& aAAState ); + + /** + * Get DRMSettingsPlugin's ccontainer. + */ + CDRMSettingsPluginContainer* Container(); + + protected: // From MEikMenuObserver + + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + private: // data + //resource loader + RConeResourceLoader iResourceLoader; + + TBool iWmdrmSupported; + + // Oma drm 2 run-time support + TBool iOmadrm2Supported; + + }; + +#endif //DRMSETTINGSPLUGIN_H + +// End of File + diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/inc/drmsettingsplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsplugin.hrh Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,46 @@ +/* +* 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: Contains common definitions for menu id:s +* +*/ + + +#ifndef DRMSETTINGSPLUGIN_HRH +#define DRMSETTINGSPLUGIN_HRH + + +enum TSettingId + { + EDRMSettingsIdAutomaticActivation, + EDRMSettingsIdUsageReporting, + EDRMSettingsIdTransactionTracking, + EDRMSettingsIdWMDRMLicenseDeletion + }; + +enum TMenuCmd + { + EDRMSettingsCmdAppChange = 1, + EDRMSettingsCmdAppChangeMSK + }; + +enum TListBoxItemVisibility + { + EDRMSettingsListBoxItemTypeIsAlwaysVisible = 0, + EDRMSettingsListBoxItemTypeIsDynamic + }; + +#endif // DRMSETTINGSPLUGIN_HRH + +//End of File + diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/inc/drmsettingsplugin.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsplugin.rh Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains common declarations for resources. +* The file can be included only in resource file. +* +*/ + +#ifndef DRMSETTINGSPLUGIN_RH +#define DRMSETTINGSPLUGIN_RH + + +// Global definitions + + +// --------------------------------------------------------- +// drm_settings_feature_array +// Defines a structure to contain information about items +// to be able to included in the listbox. +// --------------------------------------------------------- +// +STRUCT DRM_SETTINGS_FEATURE_ARRAY + { + STRUCT items[]; + } + +// --------------------------------------------------------- +// drm_settings_feature +// Defines a structure that contains information about +// a single listbox item. +// --------------------------------------------------------- +// +STRUCT DRM_SETTINGS_FEATURE + { + LTEXT txt = ""; + WORD item = -1; + BYTE type = EDRMSettingsListBoxItemTypeIsAlwaysVisible; + } + +#endif // DRMSETTINGSPLUGIN_RH +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/inc/drmsettingsplugincontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsplugincontainer.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,114 @@ +/* +* 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: Container for DRMSettinsPlugin view. +* +*/ + + +#ifndef DRMSETTINGSPLUGINCONTAINER_H +#define DRMSETTINGSPLUGINCONTAINER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CGSListBoxItemTextArray; +class CDRMSettingsModel; + +// CLASS DECLARATION + +/** +* CDRMSettingsPluginContainer container class +* @since Series 60_3.1 +* +* Container class for DRM Settings view +*/ +class CDRMSettingsPluginContainer : public CGSBaseContainer + { + + public: // Constructors and destructor + + /** + * Symbian OS constructor. + * @param aRect Listbox's rect. + */ + void ConstructL( const TRect& aRect ); + + CDRMSettingsPluginContainer( TBool aWmdrmSupported, + TBool aOmadrmSupported ); + + /** + * Destructor. + */ + ~CDRMSettingsPluginContainer(); + + public: // new + + /** + * Updates listbox's item's value. + * @param aFeatureId An item which is updated. + */ + void UpdateListBoxL( TInt aFeatureId ); + + /** + * Retrieves the currently selected listbox feature id + * @return feature id. + */ + TInt CurrentFeatureId() const; + + /** + * @return Model for the plugin. + */ + CDRMSettingsModel* Model(); + + protected: // from CGSBaseContainer + + /** + * See base class. + */ + void ConstructListBoxL( TInt aResLbxId ); + + private: // new + + void CreateListBoxItemsL(); + void MakeTransactionTrackingItemL(); + void MakeAutomaticActivationItemL(); + void MakeUsageReportingItemL(); + void MakeWMDRMLicenseDeletionItemL(); + + private: + + /** + * Required for help. + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + + private: // data + + // GS listbox item array + CGSListBoxItemTextArray* iListboxItemArray; + + // Model for DRMSettingsPlugin. + CDRMSettingsModel* iModel; + + TBool iWmdrmSupported; + + // Oma drm 2 is configured to be supported. + TBool iOmadrm2Supported; + + }; + +#endif //DRMSETTINGSPLUGINCONTAINER_H + +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/inc/drmsettingsusagecheckbox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsusagecheckbox.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,84 @@ +/* +* 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: CheckBox class for Usage Reporting settings +* +*/ + + +#ifndef C_DRMSETTINGSUSAGECHECKBOX_H +#define C_DRMSETTINGSUSAGECHECKBOX_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CDRMSettingUsageList; +class CDRMSettingsModel; +class CAknInfoPopupNoteController; +class CDRMSettingsPlugin; + +/** + * CDrmSettingUsageCheckBox class + */ +NONSHARABLE_CLASS( CDrmSettingUsageCheckBox ) : public CAknCheckBoxSettingPage + { + + public: // New functions + + /** + * C++ default constructor. + */ + CDrmSettingUsageCheckBox( TInt aResourceId, + CDRMSettingUsageList* aList, + CDRMSettingsModel* aModel, + CDRMSettingsPlugin* aPlugin ); + + /** + * Destructor. + */ + virtual ~CDrmSettingUsageCheckBox(); + + private: // From CAknSettingPage + + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + void DynamicInitL(); + + TBool OkToExitL(TBool aAccept); + + void AcceptSettingL(); + + private: // New functions + + void ShowInfoPopupL(); + + private: // Data + + // Not owned + CDRMSettingUsageList* iList; + + // Not owned + CDRMSettingsModel* iModel; + + // Owned + CAknInfoPopupNoteController* iPopupController; + + // Pointer to CDrmSettingsPlugin instance + CDRMSettingsPlugin* iDrmSettingsPlugin; + + }; + +#endif // C_DRMSETTINGSUSAGECHECKBOX_H diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/inc/drmsettingsusagelist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsusagelist.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,70 @@ +/* +* 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: List class for Usage Reporting checkbox +* +*/ + + +#ifndef C_DRMSETTINGSUSAGELIST_H +#define C_DRMSETTINGSUSAGELIST_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CDRMSettingsModel; + +/** + * CDRMSettingUsageList class + */ +NONSHARABLE_CLASS( CDRMSettingUsageList ) : public CSelectionItemList + { + + public: // New functions + + /** + * Two-phased constructor. + */ + static CDRMSettingUsageList* NewL( CDRMSettingsModel* aModel ); + + /** + * Destructor. + */ + virtual ~CDRMSettingUsageList(); + + /** + * Updates contexts + */ + void UpdateContexts(); + + private: + + /** + * Default constructor. + */ + CDRMSettingUsageList( CDRMSettingsModel* aModel ); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + private: // Data + + // Not owned + CDRMSettingsModel* iModel; + + }; + +#endif // C_DRMSETTINGSUSAGELIST_H \ No newline at end of file diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/src/drmsettingsmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/src/drmsettingsmodel.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,315 @@ +/* +* 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: Model for DRMSettinsPlugin. +* +*/ + + +// INCLUDE FILES +#include +#include +#include + +#include "drmsettingsmodel.h" +#include "drmsettingsplugininternalcrkeys.h" +#include "DRMRIContext.h" + +// CONSTANTS +#ifdef _DEBUG +// debug panic +_LIT( KDRMSettingsDebugPanicMessage, "DrmSettingsDebugPanic" ); +const TInt KDRMSettingsDebugPanicCode( 1 ); +#endif + +// ================= MEMBER FUNCTIONS ======================= + + +// ---------------------------------------------------------------------------- +// CDRMSettingsModel::NewL +// +// EPOC two-phased constructor +// ---------------------------------------------------------------------------- +// +CDRMSettingsModel* CDRMSettingsModel::NewL() + { + CDRMSettingsModel* self = new( ELeave ) CDRMSettingsModel; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CDRMSettingsModel::CDRMSettingsModel +// +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------------------------- +// +CDRMSettingsModel::CDRMSettingsModel() + { + } + + +// ---------------------------------------------------------------------------- +// CDRMSettingsModel::ConstructL +// +// EPOC default constructor can leave. +// ---------------------------------------------------------------------------- +// +void CDRMSettingsModel::ConstructL() + { + // create an instance of Central Repository + iDRMSettingsRepository = CRepository::NewL( KCRUidDRMSettings ); + +#ifdef RD_DRM_METERING + + // Create an instance of roap storage client + iRoapStorageClient = new (ELeave) Roap::RRoapStorageClient; + + // Connect to server + User::LeaveIfError( iRoapStorageClient->Connect() ); + + // Fill the list + iRoapStorageClient->GetAllRIContextsL( iRIContextList ); + +#endif // RD_DRM_METERING + + } + + +// ---------------------------------------------------------------------------- +// CDRMSettingsModel::~CDRMSettingsModel +// +// Destructor +// ---------------------------------------------------------------------------- +// +CDRMSettingsModel::~CDRMSettingsModel() + { + if ( iDRMSettingsRepository ) + { + delete iDRMSettingsRepository; + } + if ( iRoapStorageClient ) + { + iRoapStorageClient->Close(); + delete iRoapStorageClient; + } + + iRIContextList.ResetAndDestroy(); + iRIContextList.Close(); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::SetTransactionTrackingStateL() +// +// Set transaction tracking state +// --------------------------------------------------------------------------- +// +void CDRMSettingsModel::SetTransactionTrackingStateL( TInt aValue ) + { + User::LeaveIfError( iDRMSettingsRepository-> + Set( KDRMSettingsTransactionTracking, + aValue ) ); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::TransactionTrackingStateL() +// +// Get transaction tracking state +// --------------------------------------------------------------------------- +// +TInt CDRMSettingsModel::TransactionTrackingStateL() + { + TInt value( KErrNone ); + + User::LeaveIfError( iDRMSettingsRepository->Get( + KDRMSettingsTransactionTracking, + value ) ); + + return value; + } + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::SetAutomaticActivationStateL() +// +// Set automatic activation state +// --------------------------------------------------------------------------- +// +void CDRMSettingsModel::SetAutomaticActivationStateL( TInt aValue ) + { + User::LeaveIfError( iDRMSettingsRepository-> + Set( KDRMSettingsSilentRightsAcquisition, + aValue ) ); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::AutomaticActivationStateL() +// +// Get automatic activation state +// --------------------------------------------------------------------------- +// +TInt CDRMSettingsModel::AutomaticActivationStateL() + { + TInt value( KErrNone ); + + User::LeaveIfError( iDRMSettingsRepository->Get( + KDRMSettingsSilentRightsAcquisition, + value ) ); + + return value; + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::UsageReportingCount() +// +// Get usage reporting state. Return count of allowed services. +// --------------------------------------------------------------------------- +// +TInt CDRMSettingsModel::UsageReportingCount() + { + TInt count( 0 ); + + for ( TInt i( 0 ); i < iRIContextList.Count(); i++ ) + { + if ( iRIContextList[i]->IsMeteringAllowed() ) + { + count++; + } + } + + return count; + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::GetSingleRIAliasL() +// --------------------------------------------------------------------------- +// +HBufC* CDRMSettingsModel::GetSingleRIAliasL( TInt aIndex ) + { + __ASSERT_DEBUG( aIndex >= 0 || + aIndex < iRIContextList.Count(), + User::Panic( KDRMSettingsDebugPanicMessage, + KDRMSettingsDebugPanicCode ) ); + + HBufC* alias( NULL ); + + if ( &iRIContextList[aIndex]->RIAlias() ) + { + alias = + CnvUtfConverter::ConvertToUnicodeFromUtf8L( + iRIContextList[aIndex]->RIAlias() ); + } + else + { + alias = + CnvUtfConverter::ConvertToUnicodeFromUtf8L( + iRIContextList[aIndex]->RightsIssuerURL() ); + } + + return alias; + } + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::GetFirstAllowedMeteringRIAliasL() +// --------------------------------------------------------------------------- +// +HBufC* CDRMSettingsModel::GetFirstAllowedMeteringRIAliasL() + { + for ( TInt i( 0 ); i < iRIContextList.Count(); i++ ) + { + if( IsMeteringAllowed( i ) ) + { + return GetSingleRIAliasL( i ); + } + } + return NULL; + } + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::GetRiContextCount() +// --------------------------------------------------------------------------- +// +TInt CDRMSettingsModel::GetRiContextCount() + { + return iRIContextList.Count(); + } + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::IsMeteringAllowed() +// --------------------------------------------------------------------------- +// +TBool CDRMSettingsModel::IsMeteringAllowed( TInt aIndex ) + { + __ASSERT_DEBUG( aIndex >= 0 || + aIndex < iRIContextList.Count(), + User::Panic( KDRMSettingsDebugPanicMessage, + KDRMSettingsDebugPanicCode ) ); + + return iRIContextList[aIndex]->IsMeteringAllowed(); + } + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::IsMeteringAllowedForAll() +// --------------------------------------------------------------------------- +// +TBool CDRMSettingsModel::IsMeteringAllowedForAll() + { + TBool isAllowed( ETrue ); + + for ( TInt i( 0 ); i < iRIContextList.Count() && isAllowed; i++ ) + { + if( !IsMeteringAllowed( i ) ) + { + isAllowed = EFalse; + } + } + + return isAllowed; + } + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::SetMeteringStatus() +// --------------------------------------------------------------------------- +// +void CDRMSettingsModel::SetMeteringStatus( TInt aIndex, TBool aIsAllowed ) + { + __ASSERT_DEBUG( aIndex >= 0 || + aIndex < iRIContextList.Count(), + User::Panic( KDRMSettingsDebugPanicMessage, + KDRMSettingsDebugPanicCode ) ); + + iRIContextList[aIndex]->SetMeteringStatus( aIsAllowed ); + } + +// --------------------------------------------------------------------------- +// CDRMSettingsModel::SaveMeteringChanges() +// --------------------------------------------------------------------------- +// +void CDRMSettingsModel::SaveMeteringChanges() + { + for ( TInt i( 0 ); i < iRIContextList.Count(); i++ ) + { + TRAP_IGNORE( + iRoapStorageClient->UpdateRIContextL( *iRIContextList[i] ) ); + } + } + +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/src/drmsettingsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/src/drmsettingsplugin.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,750 @@ +/* +* 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: View for DRMSettinsPlugin +* +*/ + + +// INCLUDE FILES +#include +#include // For HlpLauncher +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "drmsettingsplugin.h" +#include "drmsettingsplugincontainer.h" +#include "drmsettingsplugin.hrh" +#include "drmsettingsmodel.h" +#include "drmsettingsusagecheckbox.h" +#include "drmsettingsusagelist.h" +#include "wmdrmpkclientwrapper.h" + +// CONSTANTS +_LIT( KDRMSettingsPluginResourceFileName, "z:drmsettingspluginrsc.rsc" ); + + +// ============================= LOCAL FUNCTIONS ============================== + +// ========================= MEMBER FUNCTIONS ================================ + +// ---------------------------------------------------------------------------- +// CDRMSettingsPlugin::CDRMSettingsPlugin() +// +// Constructor +// ---------------------------------------------------------------------------- +// +CDRMSettingsPlugin::CDRMSettingsPlugin() + : iResourceLoader( *iCoeEnv ) + { + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::NewL() +// +// Symbian OS default constructor +// --------------------------------------------------------------------------- +CDRMSettingsPlugin* CDRMSettingsPlugin::NewL( TAny* /*aInitParams*/ ) + { + CDRMSettingsPlugin* self = new( ELeave ) CDRMSettingsPlugin; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::ConstructL() +// +// Symbian OS two-phased constructor +// --------------------------------------------------------------------------- +void CDRMSettingsPlugin::ConstructL() + { + FeatureManager::InitializeLibL(); + + if ( FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) ) + { + iWmdrmSupported = ETrue; + } + + if ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) + { + iOmadrm2Supported = ETrue; + } + else + { + iOmadrm2Supported = EFalse; + } + + // Find the resource file + TParse parse; + parse.Set( KDRMSettingsPluginResourceFileName, + &KDC_RESOURCE_FILES_DIR, + NULL ); + TFileName fileName( parse.FullName() ); + + // Get language of resource file + BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); + + // Open resource file + iResourceLoader.OpenL( fileName ); + + BaseConstructL( R_DRM_SETTINGS_VIEW ); + + } + + +// ---------------------------------------------------------------------------- +// CDRMSettingsPlugin::~CDRMSettingsPlugin +// +// Destructor +// ---------------------------------------------------------------------------- +CDRMSettingsPlugin::~CDRMSettingsPlugin() + { + FeatureManager::UnInitializeLib(); + iResourceLoader.Close(); + } + + +// --------------------------------------------------------------------------- +// TUid CDRMSettingsPlugin::Id() +// +// Returns view's ID. +// --------------------------------------------------------------------------- +TUid CDRMSettingsPlugin::Id() const + { + return KDRMSettingsPluginUid; + } + + +// ========================= From CGSPluginInterface ================== + +// ---------------------------------------------------------------------------- +// CDRMSettingsPlugin::GetCaption +// +// Return application/view caption. +// ---------------------------------------------------------------------------- +// +void CDRMSettingsPlugin::GetCaptionL( TDes& aCaption ) const + { + // the resource file is already opened. + HBufC* result( StringLoader::LoadL( R_DRM_SETTINGS_VIEW_CAPTION ) ); + aCaption.Copy( *result ); + delete result; + } + + +// ---------------------------------------------------------------------------- +// CDRMSettingsPlugin::PluginProviderCategory +// +// A means to identify the location of this plug-in in the framework. +// ---------------------------------------------------------------------------- +// +TInt CDRMSettingsPlugin::PluginProviderCategory() const + { + //To identify internal plug-ins. + return KGSPluginProviderInternal; + } + + +// ---------------------------------------------------------------------------- +// CDRMSettingsPlugin::Visible +// +// Provides the visibility status of self to framework. +// ---------------------------------------------------------------------------- +// +TBool CDRMSettingsPlugin::Visible() const + { + TBool visible( EFalse ); + + // The plugin is visible if __DRM_OMA2 or __WINDOWS_MEDIA_DRM are enabled. + if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) || + FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) ) + { + visible = ETrue; + } + + return visible; + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::HandleCommandL(TInt aCommand) +// +// Handles commands directed to this class. +// --------------------------------------------------------------------------- +void CDRMSettingsPlugin::HandleCommandL( TInt aCommand ) + { + switch ( aCommand ) + { + case EDRMSettingsCmdAppChangeMSK: + { + const TInt currentFeatureId( Container()->CurrentFeatureId() ); + + switch ( currentFeatureId ) + { +#ifdef __DRM_OMA2 + case EDRMSettingsIdTransactionTracking: + if ( iOmadrm2Supported ) + { + UpdateTransactionTrackingSettingL( EFalse ); + } + break; + +#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION + case EDRMSettingsIdAutomaticActivation: + if ( iOmadrm2Supported ) + { + UpdateAutomaticActivationSettingL( EFalse ); + } + break; +#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION + +#ifdef RD_DRM_METERING + case EDRMSettingsIdUsageReporting: + if ( iOmadrm2Supported ) + { + UpdateUsageReportingSettingL(); + } + break; +#endif // RD_DRM_METERING +#endif // __DRM_OMA2 + + case EDRMSettingsIdWMDRMLicenseDeletion: + + if ( iWmdrmSupported ) + { + DoWMDRMLicenseDeletionL(); + } + + break; + + default: + + break; + } + + break; + } + case EDRMSettingsCmdAppChange: + { + const TInt currentFeatureId( Container()->CurrentFeatureId() ); + + switch ( currentFeatureId ) + { +#ifdef __DRM_OMA2 + case EDRMSettingsIdTransactionTracking: + if ( iOmadrm2Supported ) + { + UpdateTransactionTrackingSettingL( ETrue ); + } + break; +#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION + case EDRMSettingsIdAutomaticActivation: + if ( iOmadrm2Supported ) + { + UpdateAutomaticActivationSettingL( ETrue ); + } + break; +#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION + +#ifdef RD_DRM_METERING + case EDRMSettingsIdUsageReporting: + if ( iOmadrm2Supported ) + { + UpdateUsageReportingSettingL(); + } + break; +#endif // RD_DRM_METERING +#endif // __DRM_OMA2 + + case EDRMSettingsIdWMDRMLicenseDeletion: + + if ( iWmdrmSupported ) + { + DoWMDRMLicenseDeletionL(); + } + + break; + + default: + + break; + } + break; + } + case EAknSoftkeyBack: + + iAppUi->ActivateLocalViewL( KGSSecurityPluginUid ); + + break; + + case EAknCmdHelp: + { + + if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) + { + HlpLauncher::LaunchHelpApplicationL( + iEikonEnv->WsSession(), + iAppUi->AppHelpContextL() ); + } + + break; + + } + default: + + iAppUi->HandleCommandL( aCommand ); + + break; + } + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::UpdateListBoxL +// +// Updates listbox items. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPlugin::UpdateListBoxL( TInt aItemId ) + { + Container()->UpdateListBoxL( aItemId ); + } + + +// ---------------------------------------------------------------------------- +// CDRMSettingsPlugin::Container +// +// Return handle to container class. +// ---------------------------------------------------------------------------- +// +CDRMSettingsPluginContainer* CDRMSettingsPlugin::Container() + { + return static_cast( iContainer ); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::NewContainerL() +// +// Creates new iContainer. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPlugin::NewContainerL() + { + iContainer = new( ELeave ) CDRMSettingsPluginContainer( iWmdrmSupported, + iOmadrm2Supported ); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::HandleListBoxSelectionL() +// +// Handles events raised through a rocker key. Checks the run-time support of +// Oma Drm 2 when needed. +// --------------------------------------------------------------------------- +void CDRMSettingsPlugin::HandleListBoxSelectionL() + { + const TInt currentFeatureId( Container()->CurrentFeatureId() ); + + switch ( currentFeatureId ) + { +#ifdef __DRM_OMA2 + case EDRMSettingsIdTransactionTracking: + if ( iOmadrm2Supported ) + { + UpdateTransactionTrackingSettingL( EFalse ); + } + break; +#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION + case EDRMSettingsIdAutomaticActivation: + if ( iOmadrm2Supported ) + { + UpdateAutomaticActivationSettingL( EFalse ); + } + break; +#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION + +#ifdef RD_DRM_METERING + case EDRMSettingsIdUsageReporting: + if ( iOmadrm2Supported ) + { + UpdateUsageReportingSettingL(); + } + break; +#endif // RD_DRM_METERING +#endif // __DRM_OMA2 + + case EDRMSettingsIdWMDRMLicenseDeletion: + + if ( iWmdrmSupported ) + { + DoWMDRMLicenseDeletionL(); + } + + break; + + default: + + break; + } + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::UpdateTransactionTrackingSettingL +// +// Display Transaction tracking setting page. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPlugin::UpdateTransactionTrackingSettingL( TBool aShowSettingPage ) + { + if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) ) + { + TInt currentValue( Container()->Model()->TransactionTrackingStateL() ); + TBool isValueUpdated( EFalse ); + + if ( aShowSettingPage ) + { + isValueUpdated = ShowTransactionTrackingSettingPageL( currentValue ); + } + else + { + switch ( currentValue ) + { + case KDRMTransactionTrackingDisabled: + + currentValue = KDRMTransactionTrackingEnabled; + + break; + + case KDRMTransactionTrackingEnabled: + + currentValue = KDRMTransactionTrackingDisabled; + + break; + + default: + + break; + } + isValueUpdated = ETrue; + } + // If value is updated, store it to model: + if ( isValueUpdated ) + { + Container()->Model()->SetTransactionTrackingStateL( currentValue ); + UpdateListBoxL( EDRMSettingsIdTransactionTracking ); + } + } + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::ShowTransactionTrackingSettingPageL() +// +// Display transaction tracking setting page. Selected listbox item index +// must be mapped to transaction tracking state because index value is +// different from state value. +// --------------------------------------------------------------------------- +// +TBool CDRMSettingsPlugin::ShowTransactionTrackingSettingPageL( + TInt& aTTState ) + { + // in case DRM Phase 2 is not supported, return EFalse. + TBool isValueUpdated( EFalse ); + TInt selectedTTItemIndex( 0 ); + TInt originalTTState( aTTState ); + + // Set selected listbox item to current transaction tracking state: + switch ( aTTState ) + { + case KDRMTransactionTrackingDisabled: + + selectedTTItemIndex = KDRMTTItemIndexDisabled; + + break; + + case KDRMTransactionTrackingEnabled: + + selectedTTItemIndex = KDRMTTItemIndexEnabled; + + break; + } + + CDesCArrayFlat* items( + iCoeEnv->ReadDesC16ArrayResourceL( R_TTRACKING_SETTING_PAGE_LBX ) ); + CleanupStack::PushL( items ); + CAknRadioButtonSettingPage* dlg( + new (ELeave) CAknRadioButtonSettingPage( R_TTRACKING_SETTING_PAGE, + selectedTTItemIndex, + items ) ); + + dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); + CleanupStack::PopAndDestroy( items ); + + // Map selected listbox item to correct state: + switch ( selectedTTItemIndex ) + { + case KDRMTTItemIndexDisabled: + + aTTState = KDRMTransactionTrackingDisabled; + + break; + + case KDRMTTItemIndexEnabled: + + aTTState = KDRMTransactionTrackingEnabled; + + break; + } + + // Check is value updated: + if( aTTState != originalTTState ) + { + isValueUpdated = ETrue; + } + + return isValueUpdated; + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::UpdateAutomaticActivationSettingL +// +// Display Automatic activation setting page. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPlugin::UpdateAutomaticActivationSettingL( TBool aShowSettingPage ) + { + if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) ) + { + TInt currentValue( Container()->Model()->AutomaticActivationStateL() ); + TBool isValueUpdated( EFalse ); + + if ( aShowSettingPage ) + { + isValueUpdated = ShowAutomaticActivationSettingPageL( currentValue ); + } + else + { + switch ( currentValue ) + { + case KDRMAutomaticActivationNotAllowed: + + currentValue = KDRMAutomaticActivationAllowed; + + break; + + case KDRMAutomaticActivationAllowed: + + currentValue = KDRMAutomaticActivationNotAllowed; + + break; + + default: + + break; + } + isValueUpdated = ETrue; + } + // If value is updated, store it to model: + if ( isValueUpdated ) + { + Container()->Model()->SetAutomaticActivationStateL( currentValue ); + UpdateListBoxL( EDRMSettingsIdAutomaticActivation ); + } + } + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::ShowAutomaticActivationSettingPageL() +// +// Display Automatic activation setting page. Selected listbox item index +// must be mapped to automatic activation state because index value is +// different from state value. +// --------------------------------------------------------------------------- +// +TBool CDRMSettingsPlugin::ShowAutomaticActivationSettingPageL( + TInt& aAAState ) + { + // in case DRM Phase 2 is not supported, return EFalse. + TBool isValueUpdated( EFalse ); + TInt selectedAAItemIndex( 0 ); + TInt originalAAState( aAAState ); + + // Set selected listbox item to current state: + switch ( aAAState ) + { + case KDRMAutomaticActivationNotAllowed: + + selectedAAItemIndex = KDRMAAItemIndexDisabled; + + break; + + case KDRMAutomaticActivationAllowed: + + selectedAAItemIndex = KDRMAAItemIndexEnabled; + + break; + } + + CDesCArrayFlat* items( + iCoeEnv->ReadDesC16ArrayResourceL( R_AUTOM_ACTIV_SETTING_PAGE_LBX ) ); + CleanupStack::PushL( items ); + CAknRadioButtonSettingPage* dlg( + new (ELeave) CAknRadioButtonSettingPage( R_AUTOM_ACTIV_SETTING_PAGE, + selectedAAItemIndex, + items ) ); + + dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); + CleanupStack::PopAndDestroy( items ); + + // Map selected listbox item to correct state: + switch ( selectedAAItemIndex ) + { + case KDRMAAItemIndexDisabled: + + aAAState = KDRMAutomaticActivationNotAllowed; + + break; + + case KDRMAAItemIndexEnabled: + + aAAState = KDRMAutomaticActivationAllowed; + + break; + + } + + // Check is value updated: + if( aAAState != originalAAState ) + { + isValueUpdated = ETrue; + } + + return isValueUpdated; + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::UpdateUsageReportingSettingL +// +// Display Usage Reporting setting page. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPlugin::UpdateUsageReportingSettingL() + { + TBool isValueUpdated( EFalse ); + + if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) ) + { + CDRMSettingsModel* model( this->Container()->Model() ); + + CDRMSettingUsageList* usageList( CDRMSettingUsageList::NewL( model ) ); + CleanupStack::PushL( usageList ); + + CDrmSettingUsageCheckBox* usageCheckBox( + new (ELeave) CDrmSettingUsageCheckBox( + R_DRM_SETTINGS_METERING_CHECKBOX_PAGE, + usageList, + model, + this ) ); + + isValueUpdated = + usageCheckBox->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ); + + CleanupStack::PopAndDestroy( usageList ); + } + + if ( isValueUpdated ) + { + UpdateListBoxL( EDRMSettingsIdUsageReporting ); + } + } + +// --------------------------------------------------------------------------- +// CDRMSettingsPlugin::DoWMDRMLicenseDeletionL +// +// Display WMDRM license deletion setting page. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPlugin::DoWMDRMLicenseDeletionL() + { + if ( iWmdrmSupported ) + { + TInt r = KErrNone; + RLibrary library; + r = library.Load( KWmdrmPkClientWrapperName ); + if( !r ) + { + CleanupClosePushL( library ); + CWmDrmPkClientWrapper* wrapper = + (CWmDrmPkClientWrapper*)library.Lookup( KWmdrmPkClientNewL )(); + CleanupStack::PushL( wrapper ); + User::LeaveIfError( wrapper->Connect() ); + wrapper->DeleteRights(); + wrapper->Close(); + CleanupStack::PopAndDestroy( 2, &library ); + } + } + } + +// ---------------------------------------------------------------------------- +// CDRMSettingsPlugin::DynInitMenuPaneL() +// +// Display the dynamic menu +// ---------------------------------------------------------------------------- +void CDRMSettingsPlugin::DynInitMenuPaneL( + TInt aResourceId, + CEikMenuPane* aMenuPane ) + { + // show or hide the 'help' menu item when supported + if( aResourceId == R_DRM_SETTINGS_MENU_ITEM_EXIT ) + { + User::LeaveIfNull( aMenuPane ); + + if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) ) + { + if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) + { + aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); + } + else + { + aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); + } + } + else + { + aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); + } + } + } + + + +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/src/drmsettingsplugincontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/src/drmsettingsplugincontainer.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,360 @@ +/* +* 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: Container for DRMSettinsPlugin +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include + +#include "drmsettingsplugincontainer.h" +#include "drmsettingsplugin.hrh" +#include "drmsettingsmodel.h" + +const TUid KUidRightsManager = { 0x101F85C7 }; + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::ConstructL() +// +// Symbian OS two phased constructor +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::ConstructL( const TRect& aRect ) + { + iListBox = new( ELeave ) CAknSettingStyleListBox; + iModel = CDRMSettingsModel::NewL(); + + if( iOmadrm2Supported ) + { + BaseConstructL( aRect, R_DRM_SETTINGS_VIEW_TITLE, + R_DRM_SETTINGS_LBX ); + } + else + { + BaseConstructL( aRect, R_DRM_SETTINGS_VIEW_TITLE, + R_DRM_SETTINGS_LBX_NO_OMA2 ); + } + } + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::CDRMSettingsPluginContainer() +// +// Constructor +// --------------------------------------------------------------------------- +// +CDRMSettingsPluginContainer::CDRMSettingsPluginContainer( + TBool aWmdrmSupported, + TBool aOmadrm2Supported ) : iWmdrmSupported( aWmdrmSupported ), + iOmadrm2Supported( aOmadrm2Supported ) + { + } + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::~CDRMSettingsPluginContainer() +// +// Destructor +// --------------------------------------------------------------------------- +// +CDRMSettingsPluginContainer::~CDRMSettingsPluginContainer() + { + if ( iModel ) + { + delete iModel; + } + // delete listbox item array + if ( iListboxItemArray ) + { + delete iListboxItemArray; + } + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::ConstructListBoxL() +// +// Construct the listbox from resource array. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::ConstructListBoxL( TInt aResLbxId ) + { + iListBox->ConstructL( this, EAknListBoxSelectionList /* | + EAknListBoxItemSpecificMenuDisabled */ ); + iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, + *iListBox, + *iCoeEnv ); + iListBox->Model()->SetItemTextArray( iListboxItemArray ); + iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + CreateListBoxItemsL(); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::CreateListBoxItemsL() +// +// Create listbox items. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::CreateListBoxItemsL() + { +#ifdef __DRM_OMA2 + if( iOmadrm2Supported ) + { + MakeTransactionTrackingItemL(); + +#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION + MakeAutomaticActivationItemL(); +#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION + +#ifdef RD_DRM_METERING + MakeUsageReportingItemL(); +#endif // RD_DRM_METERING + } +#endif // __DRM_OMA2 + + + MakeWMDRMLicenseDeletionItemL(); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::UpdateListBoxL() +// +// Update listbox item. +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::UpdateListBoxL( TInt aFeatureId ) + { + switch( aFeatureId ) + { +#ifdef __DRM_OMA2 + case EDRMSettingsIdTransactionTracking: + if( iOmadrm2Supported ) + { + MakeTransactionTrackingItemL(); + } + break; + +#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION + case EDRMSettingsIdAutomaticActivation: + if( iOmadrm2Supported ) + { + MakeAutomaticActivationItemL(); + } + break; +#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION + +#ifdef RD_DRM_METERING + case EDRMSettingsIdUsageReporting: + if( iOmadrm2Supported ) + { + MakeUsageReportingItemL(); + } + break; +#endif // RD_DRM_METERING +#endif // __DRM_OMA2 + + case EDRMSettingsIdWMDRMLicenseDeletion: + + MakeWMDRMLicenseDeletionItemL(); + + break; + + default: + break; + } + + iListBox->HandleItemAdditionL(); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::MakeTransactionTrackingItemL() +// +// Create Transaction tracking list item +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::MakeTransactionTrackingItemL() + { + HBufC* dynamicText( NULL ); + TInt trxTrState( iModel->TransactionTrackingStateL() ); + + switch ( trxTrState ) + { + case KDRMTransactionTrackingEnabled: + dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_TTRACKING_ON ); + break; + default: + dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_TTRACKING_OFF ); + break; + } + + TPtr ptrBuffer ( dynamicText->Des() ); + + + // Finally, set the dynamic text + iListboxItemArray->SetDynamicTextL( EDRMSettingsIdTransactionTracking, ptrBuffer ); + + CleanupStack::PopAndDestroy( dynamicText ); + + // And add to listbox + iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdTransactionTracking, + CGSListBoxItemTextArray::EVisible ); + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::MakeAutomaticActivationItemL() +// +// Create Automatic activation list item +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::MakeAutomaticActivationItemL() + { + TInt automActivState( iModel->AutomaticActivationStateL() ); + + HBufC* dynamicText( NULL ); + + switch ( automActivState ) + { + case KDRMTransactionTrackingEnabled: + dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_AUTOM_ACTIV_ON ); + break; + default: + dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_AUTOM_ACTIV_OFF ); + break; + } + + TPtr ptrBuffer ( dynamicText->Des() ); + + // Finally, set the dynamic text + iListboxItemArray->SetDynamicTextL( EDRMSettingsIdAutomaticActivation, + ptrBuffer ); + + CleanupStack::PopAndDestroy( dynamicText ); + + // And add to listbox + iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdAutomaticActivation, + CGSListBoxItemTextArray::EVisible ); + } + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::MakeUsageReportingItemL() +// +// Create Usage reporting list item +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::MakeUsageReportingItemL() + { + TInt count( iModel->UsageReportingCount() ); + + HBufC* dynamicText( NULL ); + + switch ( count ) + { + case 0: + dynamicText = StringLoader::LoadL( R_DRM_SET_USAGE_REPORT_NONE ); + break; + case 1: + dynamicText = iModel->GetFirstAllowedMeteringRIAliasL(); + break; + default: + dynamicText = StringLoader::LoadL( R_DRM_SET_SEVERAL_SERVICES ); + break; + } + CleanupStack::PushL( dynamicText ); + + TPtr ptrBuffer ( dynamicText->Des() ); + + // Finally, set the dynamic text + iListboxItemArray->SetDynamicTextL( EDRMSettingsIdUsageReporting, + ptrBuffer ); + + CleanupStack::PopAndDestroy( dynamicText ); + + // And add to listbox + iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdUsageReporting, + CGSListBoxItemTextArray::EVisible ); + } + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::MakeWMDRMLicenseDeletionItemL() +// +// Create WMDRM license deletion list item +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::MakeWMDRMLicenseDeletionItemL() + { + if ( iWmdrmSupported ) + { + // Add to listbox + iListboxItemArray-> + SetItemVisibilityL( EDRMSettingsIdWMDRMLicenseDeletion, + CGSListBoxItemTextArray::EVisible ); + } + else + { + // Add to listbox + iListboxItemArray-> + SetItemVisibilityL( EDRMSettingsIdWMDRMLicenseDeletion, + CGSListBoxItemTextArray::EInvisible ); + + } + } + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::GetHelpContext() const +// +// Gets Help +// --------------------------------------------------------------------------- +// +void CDRMSettingsPluginContainer::GetHelpContext( + TCoeHelpContext& aContext ) const + { + aContext.iMajor = KUidRightsManager; + aContext.iContext = KSET_HLP_PROTECTED_CONTENT; + } + + +// --------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::CurrentFeatureId() +// +// Return the feature id of selected listitem +// --------------------------------------------------------------------------- +// +TInt CDRMSettingsPluginContainer::CurrentFeatureId( ) const + { + return iListboxItemArray->CurrentFeature(); + } + + +// ----------------------------------------------------------------------------- +// CDRMSettingsPluginContainer::Model() +// +// +// ----------------------------------------------------------------------------- +// +CDRMSettingsModel* CDRMSettingsPluginContainer::Model() + { + return iModel; + } + +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/src/drmsettingspluginimplementationtable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/src/drmsettingspluginimplementationtable.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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: ECOM proxy table for DRMSettinsPlugin +* +*/ + + +// INCLUDES +#include +#include + +#include "drmsettingsplugin.h" + + +// CONSTANTS +const TImplementationProxy KDRMSettingsPluginImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x102750CD, CDRMSettingsPlugin::NewL ) + }; + + +// --------------------------------------------------------------------------- +// ImplementationGroupProxy +// +// Gate/factory function +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = sizeof( KDRMSettingsPluginImplementationTable ) + / sizeof( TImplementationProxy ); + return KDRMSettingsPluginImplementationTable; + } + + + +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/src/drmsettingsusagecheckbox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/src/drmsettingsusagecheckbox.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,158 @@ +/* +* 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: CheckBox class for Usage Reporting settings +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "drmsettingsusagecheckbox.h" +#include "drmsettingsusagelist.h" +#include "drmsettingsmodel.h" +#include "drmsettingsplugin.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// CDrmSettingUsageCheckBox::CDrmSettingUsageCheckBox +// Default constructor. +// ----------------------------------------------------------------------------- +// +CDrmSettingUsageCheckBox::CDrmSettingUsageCheckBox( + TInt aResourceId, + CDRMSettingUsageList* aList, + CDRMSettingsModel* aModel, + CDRMSettingsPlugin* aPlugin ) : CAknCheckBoxSettingPage( aResourceId, aList ), + iList( aList ), + iModel( aModel ), + iDrmSettingsPlugin( aPlugin ) + { + } + +// ---------------------------------------------------------------------------- +// CDrmSettingUsageCheckBox::~CDrmSettingUsageCheckBox +// +// Destructor +// ---------------------------------------------------------------------------- +// +CDrmSettingUsageCheckBox::~CDrmSettingUsageCheckBox() + { + delete iPopupController; + } + +// ----------------------------------------------------------------------------- +// CDrmSettingUsageCheckBox::OfferKeyEventL +// ----------------------------------------------------------------------------- +// +TKeyResponse CDrmSettingUsageCheckBox::OfferKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + TKeyResponse response( EKeyWasNotConsumed ); + if ( aKeyEvent.iCode != EKeyApplicationF ) + { + response = this->ListBoxControl()->OfferKeyEventL( aKeyEvent, aType ); + } + + if ( aType == EEventKeyUp ) + { + ShowInfoPopupL(); + } + + if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyEscape ) ) + { + iDrmSettingsPlugin->HandleCommandL( EEikCmdExit ); + } + + return response; + } + +// ----------------------------------------------------------------------------- +// CDrmSettingUsageCheckBox::DynamicInitL +// ----------------------------------------------------------------------------- +// +void CDrmSettingUsageCheckBox::DynamicInitL() + { + HBufC* emptyText( StringLoader::LoadLC( R_USAGE_REPORTING_LIST_EMPTY, + iEikonEnv ) ); + this->ListBoxControl()->View()->SetListEmptyTextL( *emptyText ); + CleanupStack::PopAndDestroy( emptyText ); + } + +// ----------------------------------------------------------------------------- +// CDrmSettingUsageCheckBox::OkToExitL +// ----------------------------------------------------------------------------- +// +TBool CDrmSettingUsageCheckBox::OkToExitL( TBool aAccept ) + { + TBool exit( ETrue ); + + if ( aAccept ) + { + iList->UpdateContexts(); + + if ( !iModel->IsMeteringAllowedForAll() ) + { + HBufC* query( StringLoader::LoadLC( R_DRM_CONF_QUERY_METERING, + iEikonEnv ) ); + + CAknQueryDialog* queryDialog( CAknQueryDialog::NewL() ); + + TBool retVal( queryDialog->ExecuteLD( R_DRM_CONFIRMATION_QUERY_METERING, + *query ) ); + CleanupStack::PopAndDestroy( query ); + + if ( !retVal ) + { + exit = EFalse; + } + } + } + + return exit; + } + +// ----------------------------------------------------------------------------- +// CDrmSettingUsageCheckBox::AcceptSettingL +// ----------------------------------------------------------------------------- +// +void CDrmSettingUsageCheckBox::AcceptSettingL() + { + iModel->SaveMeteringChanges(); + } + +// ----------------------------------------------------------------------------- +// CDrmSettingUsageCheckBox::ShowInfoPopupL +// ----------------------------------------------------------------------------- +// +void CDrmSettingUsageCheckBox::ShowInfoPopupL() + { + if ( !iPopupController ) + { + iPopupController = CAknInfoPopupNoteController::NewL(); + } + TInt index( this->ListBoxControl()->View()->CurrentItemIndex() ); + if ( index != -1 ) + { + iPopupController->SetTextL( iList->At(index)->ItemText() ); + iPopupController->ShowInfoPopupNote(); + } + } + +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmsettingsplugin/src/drmsettingsusagelist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmsettingsplugin/src/drmsettingsusagelist.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,97 @@ +/* +* 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: List class for Usage Reporting checkbox +* +*/ + + +// INCLUDE FILES +#include "drmsettingsusagelist.h" +#include "drmsettingsmodel.h" + +// CONSTANTS +const TInt KDRMSettingsListGranularity( 5 ); + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------------------------- +// CDRMSettingUsageList::NewL +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CDRMSettingUsageList* CDRMSettingUsageList::NewL( + CDRMSettingsModel* aModel ) + { + CDRMSettingUsageList* self( + new( ELeave ) CDRMSettingUsageList( aModel ) ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CDRMSettingUsageList::CDRMSettingUsageList +// Default constructor. +// ---------------------------------------------------------------------------- +// +CDRMSettingUsageList::CDRMSettingUsageList( CDRMSettingsModel* aModel ) + : CSelectionItemList( KDRMSettingsListGranularity ), iModel( aModel ) + { + } + +// ---------------------------------------------------------------------------- +// CDRMSettingUsageList::ConstructL +// ---------------------------------------------------------------------------- +// +void CDRMSettingUsageList::ConstructL() + { + for ( TInt i( 0 ); i < iModel->GetRiContextCount(); i++ ) + { + HBufC* alias( iModel->GetSingleRIAliasL( i ) ); + CleanupStack::PushL( alias ); + TBool isAllowed( iModel->IsMeteringAllowed( i ) ); + CSelectableItem* selItem( new (ELeave) CSelectableItem( *alias, + isAllowed ) ); + selItem->ConstructL(); + this->AppendL( selItem ); + CleanupStack::PopAndDestroy( alias ); + } + } + +// ---------------------------------------------------------------------------- +// CDRMSettingUsageList::~CDRMSettingUsageList +// +// Destructor +// ---------------------------------------------------------------------------- +// +CDRMSettingUsageList::~CDRMSettingUsageList() + { + this->ResetAndDestroy(); + } + +// ---------------------------------------------------------------------------- +// CDRMSettingUsageList::UpdateContexts +// ---------------------------------------------------------------------------- +// +void CDRMSettingUsageList::UpdateContexts() + { + for ( TInt i( 0 ); i < iModel->GetRiContextCount(); i++ ) + { + CSelectableItem* selItem( this->At( i ) ); + iModel->SetMeteringStatus( i, selItem->SelectionStatus() ); + } + } + +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuidialogs/bwinscw/drmuidialogsu.def --- a/commondrm/drmui/drmuidialogs/bwinscw/drmuidialogsu.def Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuidialogs/eabi/drmuidialogsu.def --- a/commondrm/drmui/drmuidialogs/eabi/drmuidialogsu.def Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _ZN13CDrmUIDialogs4NewLEv @ 1 NONAME - _ZN13CDrmUIDialogs5NewLCEv @ 2 NONAME - _ZN13CDrmUIDialogs9ShowNoteLEiRK7TDesC16i @ 3 NONAME - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuidialogs/group/bld.inf --- a/commondrm/drmui/drmuidialogs/group/bld.inf Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuidialogs/group/drmuidialogs.mmp --- a/commondrm/drmui/drmuidialogs/group/drmuidialogs.mmp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuidialogs/inc/drmuidialogs.h --- a/commondrm/drmui/drmuidialogs/inc/drmuidialogs.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuidialogs/rom/drmuidialogs.iby --- a/commondrm/drmui/drmuidialogs/rom/drmuidialogs.iby Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuidialogs/src/drmuidialogs.cpp --- a/commondrm/drmui/drmuidialogs/src/drmuidialogs.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/DRMUINotifications.rss --- a/commondrm/drmui/drmuinotifications/DRMUINotifications.rss Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -// ============================================================================ -// * 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/drmuinotifications.pro --- a/commondrm/drmui/drmuinotifications/drmuinotifications.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/inc/drmuidialogplugin.h --- a/commondrm/drmui/drmuinotifications/inc/drmuidialogplugin.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/inc/drmuidialogpluginkeys.h --- a/commondrm/drmui/drmuinotifications/inc/drmuidialogpluginkeys.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/inc/drmuidialogsbuilder.h --- a/commondrm/drmui/drmuinotifications/inc/drmuidialogsbuilder.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/Registeringprog.docml --- a/commondrm/drmui/drmuinotifications/resource/Registeringprog.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/accountupdatequery.docml --- a/commondrm/drmui/drmuinotifications/resource/accountupdatequery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/acquiringlicenceprog.docml --- a/commondrm/drmui/drmuinotifications/resource/acquiringlicenceprog.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/copyobjectsquery.docml --- a/commondrm/drmui/drmuinotifications/resource/copyobjectsquery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/deletedrmfilequery.docml --- a/commondrm/drmui/drmuinotifications/resource/deletedrmfilequery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/deregisteredconf.docml --- a/commondrm/drmui/drmuinotifications/resource/deregisteredconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/deregisteringprog.docml --- a/commondrm/drmui/drmuinotifications/resource/deregisteringprog.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/drmuinotifications.qrc --- a/commondrm/drmui/drmuinotifications/resource/drmuinotifications.qrc Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ - - - - 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/filedeletedconf.docml --- a/commondrm/drmui/drmuinotifications/resource/filedeletedconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/forwardprotectedconf.docml --- a/commondrm/drmui/drmuinotifications/resource/forwardprotectedconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/getnewlicencequery.docml --- a/commondrm/drmui/drmuinotifications/resource/getnewlicencequery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/infoexpiredornoronote.docml --- a/commondrm/drmui/drmuinotifications/resource/infoexpiredornoronote.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/invalidornoapnote.docml --- a/commondrm/drmui/drmuinotifications/resource/invalidornoapnote.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/licenceexpiredconf.docml --- a/commondrm/drmui/drmuinotifications/resource/licenceexpiredconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/moveobjectsquery.docml --- a/commondrm/drmui/drmuinotifications/resource/moveobjectsquery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/noconnectiondefinednote.docml --- a/commondrm/drmui/drmuinotifications/resource/noconnectiondefinednote.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/nocountquery.docml --- a/commondrm/drmui/drmuinotifications/resource/nocountquery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/norightsobjectquery.docml --- a/commondrm/drmui/drmuinotifications/resource/norightsobjectquery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/notrecognizedconf.docml --- a/commondrm/drmui/drmuinotifications/resource/notrecognizedconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/nousagequery.docml --- a/commondrm/drmui/drmuinotifications/resource/nousagequery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/objectlockedconf.docml --- a/commondrm/drmui/drmuinotifications/resource/objectlockedconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/openingfailpermnote.docml --- a/commondrm/drmui/drmuinotifications/resource/openingfailpermnote.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/registeredconf.docml --- a/commondrm/drmui/drmuinotifications/resource/registeredconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/registerfailureconf.docml --- a/commondrm/drmui/drmuinotifications/resource/registerfailureconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/retryforlicencequery.docml --- a/commondrm/drmui/drmuinotifications/resource/retryforlicencequery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/rightsobjectexpiredquery.docml --- a/commondrm/drmui/drmuinotifications/resource/rightsobjectexpiredquery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/rightsobjectsrecievednote.docml --- a/commondrm/drmui/drmuinotifications/resource/rightsobjectsrecievednote.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/simnotallowedquery.docml --- a/commondrm/drmui/drmuinotifications/resource/simnotallowedquery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/unabletocopyconf.docml --- a/commondrm/drmui/drmuinotifications/resource/unabletocopyconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/unabletoderegisterconf.docml --- a/commondrm/drmui/drmuinotifications/resource/unabletoderegisterconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/unabletomoveconf.docml --- a/commondrm/drmui/drmuinotifications/resource/unabletomoveconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/unabletosendconf.docml --- a/commondrm/drmui/drmuinotifications/resource/unabletosendconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/unabletosendquery.docml --- a/commondrm/drmui/drmuinotifications/resource/unabletosendquery.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/unsupportedconf.docml --- a/commondrm/drmui/drmuinotifications/resource/unsupportedconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/updatedconf.docml --- a/commondrm/drmui/drmuinotifications/resource/updatedconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/updatefailureconf.docml --- a/commondrm/drmui/drmuinotifications/resource/updatefailureconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/updatingprog.docml --- a/commondrm/drmui/drmuinotifications/resource/updatingprog.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/viewrestrictionconf.docml --- a/commondrm/drmui/drmuinotifications/resource/viewrestrictionconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/waitingforlicenceconf.docml --- a/commondrm/drmui/drmuinotifications/resource/waitingforlicenceconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/resource/waitingforrightsobjconf.docml --- a/commondrm/drmui/drmuinotifications/resource/waitingforrightsobjconf.docml Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/rom/drmuinotifications.iby --- a/commondrm/drmui/drmuinotifications/rom/drmuinotifications.iby Tue Aug 31 15:29:38 2010 +0300 +++ /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: 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/src/drmuidialogplugin.cpp --- a/commondrm/drmui/drmuinotifications/src/drmuidialogplugin.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* - * 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/drmuinotifications/src/drmuidialogsbuilder.cpp --- a/commondrm/drmui/drmuinotifications/src/drmuidialogsbuilder.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,439 +0,0 @@ -/* - * 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 1221b68b8a5f -r 1481bf457703 commondrm/drmui/group/bld.inf --- a/commondrm/drmui/group/bld.inf Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/bwinscw/drmutilitycommonu.def --- a/commondrm/drmutility/bwinscw/drmutilitycommonu.def Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/bwinscw/drmutilitycommonu.def Wed Sep 01 12:21:16 2010 +0100 @@ -1,23 +1,24 @@ EXPORTS - ?DisplayNoteL@CDrmUtilityUI@DRM@@QAEXAAVTDesC16@@HABV3@H@Z @ 1 NONAME ; void DRM::CDrmUtilityUI::DisplayNoteL(class TDesC16 &, int, class TDesC16 const &, int) - ?DisplayNoteL@CDrmUtilityUI@DRM@@QAEXH@Z @ 2 NONAME ; void DRM::CDrmUtilityUI::DisplayNoteL(int) - ?DisplayNoteL@CDrmUtilityUI@DRM@@QAEXHABVTDesC16@@@Z @ 3 NONAME ; void DRM::CDrmUtilityUI::DisplayNoteL(int, class TDesC16 const &) - ?DisplayNoteL@CDrmUtilityUI@DRM@@QAEXHH@Z @ 4 NONAME ; void DRM::CDrmUtilityUI::DisplayNoteL(int, int) - ?DisplayPopupWindowsForPreviewL@CDrmUtilityUI@DRM@@QAEHAAVCData@ContentAccess@@HH@Z @ 5 NONAME ; int DRM::CDrmUtilityUI::DisplayPopupWindowsForPreviewL(class ContentAccess::CData &, int, int) - ?DisplayQueryL@CDrmUtilityUI@DRM@@QAEHAAVTDesC16@@H@Z @ 6 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryL(class TDesC16 &, int) - ?DisplayQueryL@CDrmUtilityUI@DRM@@QAEHHABVTDesC16@@@Z @ 7 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryL(int, class TDesC16 const &) + ?DisplayNoteL@CDrmUtilityUI@DRM@@QAEXHABVTDesC16@@@Z @ 1 NONAME ; void DRM::CDrmUtilityUI::DisplayNoteL(int, class TDesC16 const &) + ?DisplayQueryL@CDrmUtilityUI@DRM@@QAEHAAVTDesC16@@H@Z @ 2 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryL(class TDesC16 &, int) + ?SetAutomatedQueryL@CDrmUtilityUI@DRM@@QAEHPAVCDRMConstraint@@@Z @ 3 NONAME ; int DRM::CDrmUtilityUI::SetAutomatedQueryL(class CDRMConstraint *) + ?NewL@CDrmUtilityUI@DRM@@SAPAV12@PAVCCoeEnv@@@Z @ 4 NONAME ; class DRM::CDrmUtilityUI * DRM::CDrmUtilityUI::NewL(class CCoeEnv *) + ?DisplayQueryL@CDrmUtilityUI@DRM@@QAEHHH@Z @ 5 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryL(int, int) + ?DisplayNoteL@CDrmUtilityUI@DRM@@QAEXAAVTDesC16@@HABV3@H@Z @ 6 NONAME ; void DRM::CDrmUtilityUI::DisplayNoteL(class TDesC16 &, int, class TDesC16 const &, int) + ?NewL@CDrmUtilityWMDrm@DRM@@SAPAV12@PAVCCoeEnv@@@Z @ 7 NONAME ; class DRM::CDrmUtilityWMDrm * DRM::CDrmUtilityWMDrm::NewL(class CCoeEnv *) ?DisplayQueryL@CDrmUtilityUI@DRM@@QAEHHABVTDesC16@@HHH@Z @ 8 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryL(int, class TDesC16 const &, int, int, int) - ?DisplayQueryL@CDrmUtilityUI@DRM@@QAEHHH@Z @ 9 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryL(int, int) - ?DisplayQueryWithIdL@CDrmUtilityUI@DRM@@QAEHHH@Z @ 10 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryWithIdL(int, int) - ?DisplayQueryWithIdValueL@CDrmUtilityUI@DRM@@QAEHHHABVTDesC16@@@Z @ 11 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryWithIdValueL(int, int, class TDesC16 const &) - ?GetOmaRightsStatusL@CDrmUtilityCommon@DRM@@QAE?AW4TDrmRightsInfo@2@AAPAVHBufC8@@W4TIntent@ContentAccess@@PAVCDRMConstraint@@@Z @ 12 NONAME ; enum DRM::TDrmRightsInfo DRM::CDrmUtilityCommon::GetOmaRightsStatusL(class HBufC8 * &, enum ContentAccess::TIntent, class CDRMConstraint *) - ?GetWrapper@CDrmUtilityWMDrm@DRM@@QAEPAVMDrmUtilityWMDrmWrapper@2@XZ @ 13 NONAME ; class DRM::MDrmUtilityWMDrmWrapper * DRM::CDrmUtilityWMDrm::GetWrapper(void) - ?NewL@CDrmUtilityCommon@DRM@@SAPAV12@XZ @ 14 NONAME ; class DRM::CDrmUtilityCommon * DRM::CDrmUtilityCommon::NewL(void) - ?NewL@CDrmUtilityUI@DRM@@SAPAV12@PAVCCoeEnv@@@Z @ 15 NONAME ; class DRM::CDrmUtilityUI * DRM::CDrmUtilityUI::NewL(class CCoeEnv *) - ?NewL@CDrmUtilityWMDrm@DRM@@SAPAV12@PAVCCoeEnv@@@Z @ 16 NONAME ; class DRM::CDrmUtilityWMDrm * DRM::CDrmUtilityWMDrm::NewL(class CCoeEnv *) - ?NewLC@CDrmUtilityCommon@DRM@@SAPAV12@XZ @ 17 NONAME ; class DRM::CDrmUtilityCommon * DRM::CDrmUtilityCommon::NewLC(void) - ?NewLC@CDrmUtilityUI@DRM@@SAPAV12@PAVCCoeEnv@@@Z @ 18 NONAME ; class DRM::CDrmUtilityUI * DRM::CDrmUtilityUI::NewLC(class CCoeEnv *) - ?NewLC@CDrmUtilityWMDrm@DRM@@SAPAV12@PAVCCoeEnv@@@Z @ 19 NONAME ; class DRM::CDrmUtilityWMDrm * DRM::CDrmUtilityWMDrm::NewLC(class CCoeEnv *) - ?SetAutomatedQueryL@CDrmUtilityUI@DRM@@QAEHPAVCDRMConstraint@@@Z @ 20 NONAME ; int DRM::CDrmUtilityUI::SetAutomatedQueryL(class CDRMConstraint *) - ?ShowFutureRightsNoteL@CDrmUtilityUI@DRM@@QAEXPAVCDRMConstraint@@@Z @ 21 NONAME ; void DRM::CDrmUtilityUI::ShowFutureRightsNoteL(class CDRMConstraint *) + ?NewLC@CDrmUtilityWMDrm@DRM@@SAPAV12@PAVCCoeEnv@@@Z @ 9 NONAME ; class DRM::CDrmUtilityWMDrm * DRM::CDrmUtilityWMDrm::NewLC(class CCoeEnv *) + ?DisplayQueryWithIdValueL@CDrmUtilityUI@DRM@@QAEHHHABVTDesC16@@@Z @ 10 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryWithIdValueL(int, int, class TDesC16 const &) + ?ShowFutureRightsNoteL@CDrmUtilityUI@DRM@@QAEXPAVCDRMConstraint@@@Z @ 11 NONAME ; void DRM::CDrmUtilityUI::ShowFutureRightsNoteL(class CDRMConstraint *) + ?NewL@CDrmUtilityCommon@DRM@@SAPAV12@XZ @ 12 NONAME ; class DRM::CDrmUtilityCommon * DRM::CDrmUtilityCommon::NewL(void) + ?NewLC@CDrmUtilityCommon@DRM@@SAPAV12@XZ @ 13 NONAME ; class DRM::CDrmUtilityCommon * DRM::CDrmUtilityCommon::NewLC(void) + ?DisplayPopupWindowsForPreviewL@CDrmUtilityUI@DRM@@QAEHAAVCData@ContentAccess@@HH@Z @ 14 NONAME ; int DRM::CDrmUtilityUI::DisplayPopupWindowsForPreviewL(class ContentAccess::CData &, int, int) + ?GetOmaRightsStatusL@CDrmUtilityCommon@DRM@@QAE?AW4TDrmRightsInfo@2@AAPAVHBufC8@@W4TIntent@ContentAccess@@PAVCDRMConstraint@@@Z @ 15 NONAME ; enum DRM::TDrmRightsInfo DRM::CDrmUtilityCommon::GetOmaRightsStatusL(class HBufC8 * &, enum ContentAccess::TIntent, class CDRMConstraint *) + ?DisplayQueryWithIdL@CDrmUtilityUI@DRM@@QAEHHH@Z @ 16 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryWithIdL(int, int) + ?DisplayNoteL@CDrmUtilityUI@DRM@@QAEXH@Z @ 17 NONAME ; void DRM::CDrmUtilityUI::DisplayNoteL(int) + ?DisplayMessageQueryL@CDrmUtilityUI@DRM@@QAEHHHABVTDesC16@@@Z @ 18 NONAME ; int DRM::CDrmUtilityUI::DisplayMessageQueryL(int, int, class TDesC16 const &) + ?DisplayNoteL@CDrmUtilityUI@DRM@@QAEXHH@Z @ 19 NONAME ; void DRM::CDrmUtilityUI::DisplayNoteL(int, int) + ?NewLC@CDrmUtilityUI@DRM@@SAPAV12@PAVCCoeEnv@@@Z @ 20 NONAME ; class DRM::CDrmUtilityUI * DRM::CDrmUtilityUI::NewLC(class CCoeEnv *) + ?DisplayQueryL@CDrmUtilityUI@DRM@@QAEHHABVTDesC16@@@Z @ 21 NONAME ; int DRM::CDrmUtilityUI::DisplayQueryL(int, class TDesC16 const &) + ?GetWrapper@CDrmUtilityWMDrm@DRM@@QAEPAVMDrmUtilityWMDrmWrapper@2@XZ @ 22 NONAME ; class DRM::MDrmUtilityWMDrmWrapper * DRM::CDrmUtilityWMDrm::GetWrapper(void) diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/data/drmutility.rss --- a/commondrm/drmutility/data/drmutility.rss Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/data/drmutility.rss Wed Sep 01 12:21:16 2010 +0100 @@ -21,11 +21,15 @@ // INCLUDES #include -#include +#include #include -#include +#include +#include +#include #include -#include +#include +#include +#include #include @@ -597,4 +601,56 @@ #endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO +// ----------------------------------------------------------------------------- +// r_drmutility_sync_with_pc +// Text displayed if WMDRM Direct License Acquisition is supported to +// notify user that license needs to be aquired with PC sync. +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_drmutility_sync_with_pc + { + buf = qtn_drm_sync_with_pc; + } + +// ----------------------------------------------------------------------------- +// r_drmutility_sync_with_pc_header +// Header displayed if WMDRM Direct License Acquisition is supported to +// notify user that license needs to be aquired with PC sync. +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_drmutility_head_no_license + { + buf = qtn_drm_msg_qry_head_no_license; + } + +//------------------------------------------------------------------------------ +// +// r_drmutility_sync_dialog +// Shows the user a dialog that license needs to be synced with pc +// +//------------------------------------------------------------------------------ +// +RESOURCE DIALOG r_drmutility_sync_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + + } // End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/eabi/DrmUtilityDmgrWrapperu.def --- a/commondrm/drmutility/eabi/DrmUtilityDmgrWrapperu.def Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/eabi/DrmUtilityDmgrWrapperu.def Wed Sep 01 12:21:16 2010 +0100 @@ -1,3 +1,5 @@ -EXPORTS +EXPORTS _Z16GateFunctionDMgrv @ 1 NONAME + _ZTI22CDrmUtilityDmgrWrapper @ 2 NONAME ; ## + _ZTV22CDrmUtilityDmgrWrapper @ 3 NONAME ; ## diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/eabi/drmutilitycommonu.def --- a/commondrm/drmutility/eabi/drmutilitycommonu.def Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/eabi/drmutilitycommonu.def Wed Sep 01 12:21:16 2010 +0100 @@ -9,15 +9,16 @@ _ZN3DRM13CDrmUtilityUI13DisplayQueryLEii @ 8 NONAME _ZN3DRM13CDrmUtilityUI18SetAutomatedQueryLEP14CDRMConstraint @ 9 NONAME _ZN3DRM13CDrmUtilityUI19DisplayQueryWithIdLEii @ 10 NONAME - _ZN3DRM13CDrmUtilityUI21ShowFutureRightsNoteLEP14CDRMConstraint @ 11 NONAME - _ZN3DRM13CDrmUtilityUI24DisplayQueryWithIdValueLEiiRK7TDesC16 @ 12 NONAME - _ZN3DRM13CDrmUtilityUI30DisplayPopupWindowsForPreviewLERN13ContentAccess5CDataEii @ 13 NONAME - _ZN3DRM13CDrmUtilityUI4NewLEP7CCoeEnv @ 14 NONAME - _ZN3DRM13CDrmUtilityUI5NewLCEP7CCoeEnv @ 15 NONAME - _ZN3DRM16CDrmUtilityWMDrm10GetWrapperEv @ 16 NONAME - _ZN3DRM16CDrmUtilityWMDrm4NewLEP7CCoeEnv @ 17 NONAME - _ZN3DRM16CDrmUtilityWMDrm5NewLCEP7CCoeEnv @ 18 NONAME - _ZN3DRM17CDrmUtilityCommon19GetOmaRightsStatusLERP6HBufC8N13ContentAccess7TIntentEP14CDRMConstraint @ 19 NONAME - _ZN3DRM17CDrmUtilityCommon4NewLEv @ 20 NONAME - _ZN3DRM17CDrmUtilityCommon5NewLCEv @ 21 NONAME + _ZN3DRM13CDrmUtilityUI20DisplayMessageQueryLEiiRK7TDesC16 @ 11 NONAME + _ZN3DRM13CDrmUtilityUI21ShowFutureRightsNoteLEP14CDRMConstraint @ 12 NONAME + _ZN3DRM13CDrmUtilityUI24DisplayQueryWithIdValueLEiiRK7TDesC16 @ 13 NONAME + _ZN3DRM13CDrmUtilityUI30DisplayPopupWindowsForPreviewLERN13ContentAccess5CDataEii @ 14 NONAME + _ZN3DRM13CDrmUtilityUI4NewLEP7CCoeEnv @ 15 NONAME + _ZN3DRM13CDrmUtilityUI5NewLCEP7CCoeEnv @ 16 NONAME + _ZN3DRM16CDrmUtilityWMDrm10GetWrapperEv @ 17 NONAME + _ZN3DRM16CDrmUtilityWMDrm4NewLEP7CCoeEnv @ 18 NONAME + _ZN3DRM16CDrmUtilityWMDrm5NewLCEP7CCoeEnv @ 19 NONAME + _ZN3DRM17CDrmUtilityCommon19GetOmaRightsStatusLERP6HBufC8N13ContentAccess7TIntentEP14CDRMConstraint @ 20 NONAME + _ZN3DRM17CDrmUtilityCommon4NewLEv @ 21 NONAME + _ZN3DRM17CDrmUtilityCommon5NewLCEv @ 22 NONAME diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/DRMUiHandlingImpl.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/group/DRMUiHandlingImpl.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,82 @@ +/* +* 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(ARMCC) +deffile ../eabi/ +#elif defined( WINSCW ) +deffile ../bwinscw/ +#elif defined( WINS ) +deffile ../bwins/ +#else +deffile ../bmarm/ +#endif + +SMPSAFE diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/DrmUtilityDmgrWrapper.mmp --- a/commondrm/drmutility/group/DrmUtilityDmgrWrapper.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/group/DrmUtilityDmgrWrapper.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -28,7 +28,6 @@ #ifdef __DRM SOURCE ../src/DrmUtilityDmgrWrapper.cpp -SOURCE ../src/drmutilityconnection.cpp #endif START RESOURCE ../data/DrmUtilityDmgrWrapper.rss @@ -40,14 +39,13 @@ USERINCLUDE ../inc USERINCLUDE ../../../omadrm/drmengine/roap/inc USERINCLUDE ../../../inc // ADo level inc dir -USERINCLUDE ../traces // OST definitions + // Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE +APP_LAYER_SYSTEMINCLUDE LIBRARY euser.lib -LIBRARY cmmanager.lib // RCmManager CCmApplicationSettingsUi -LIBRARY esock.lib // RConnection, RSocketServ -LIBRARY extendedconnpref.lib netmeta.lib // TExtendedConnPref +LIBRARY centralrepository.lib +LIBRARY cmmanager.lib LIBRARY downloadmgr.lib LIBRARY roaphandler.lib LIBRARY efsrv.lib diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/bld.inf --- a/commondrm/drmutility/group/bld.inf Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/group/bld.inf Wed Sep 01 12:21:16 2010 +0100 @@ -33,6 +33,8 @@ #if (defined __WINDOWS_MEDIA_DRM) drmutilitywmdrmwrapper.mmp #endif // __WINDOWS_MEDIA_DRM +DrmUtilityDmgrWrapper.mmp +DRMUiHandlingImpl.mmp DRMAutomatedUsageImpl.mmp DrmRightsInfoImpl.mmp diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/drmutilitycommon.mmp --- a/commondrm/drmutility/group/drmutilitycommon.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/group/drmutilitycommon.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -42,7 +42,6 @@ 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 @@ -62,7 +61,6 @@ LIBRARY aknnotify.lib LIBRARY drmrights.lib // Permission, Constraint LIBRARY drmserverinterfaces.lib // DrmClockClient, DrmRightsClient -LIBRARY drmuidialogs.lib DOCUMENT bld.inf diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/drmutilitywmdrmwrapper.mmp --- a/commondrm/drmutility/group/drmutilitywmdrmwrapper.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/group/drmutilitywmdrmwrapper.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -37,6 +37,12 @@ // Default system include paths for application layer modules. APP_LAYER_SYSTEMINCLUDE +START RESOURCE ../data/drmutility.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + LIBRARY aknnotify.lib LIBRARY apparc.lib // for launching rights mgr ui embedded LIBRARY euser.lib @@ -52,6 +58,7 @@ LIBRARY servicehandler.lib LIBRARY drmserverinterfaces.lib // DrmClockClient LIBRARY drmrights.lib +LIBRARY featdiscovery.lib DOCUMENT bld.inf diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/qt/drmuihandlingimpl.pri --- a/commondrm/drmutility/group/qt/drmuihandlingimpl.pri Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ - -# -# 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 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/qt/drmuihandlingimpl.pro --- a/commondrm/drmutility/group/qt/drmuihandlingimpl.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ - -# -# 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 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/qt/drmutilitydmgrwrapper.pri --- a/commondrm/drmutility/group/qt/drmutilitydmgrwrapper.pri Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ - -# -# 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 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/group/qt/drmutilitydmgrwrapper.pro --- a/commondrm/drmutility/group/qt/drmutilitydmgrwrapper.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ - -# -# 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 - -IncludeBlock = \ - "$${LITERAL_HASH}include " \ - "$${LITERAL_HASH}include " - -MMP_RULES += IncludeBlock - - -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 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/inc/DrmUiHandlingImpl.h --- a/commondrm/drmutility/inc/DrmUiHandlingImpl.h Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/inc/DrmUiHandlingImpl.h Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -32,6 +32,7 @@ //*** forward declarations go here: class CCoeEnv; class CDRMConstraint; +class CSchemeHandler; namespace ContentAccess { @@ -777,6 +778,16 @@ TBool SilentRightsAllowedL(); /** + * Check if browser AP has been defined + */ + TBool BrowserAPDefinedL(); + + /** + * Returns the number of access points on phone + */ + TInt APCountL(); + + /** * Handles exit from service * from MAknServerAppExitObserver */ @@ -855,6 +866,9 @@ // Wait for the notes and queries CActiveSchedulerWait iWait; + // Schemehandler for url handling + CSchemeHandler* iSchemeHandler; + // Operation Queue: CDrmUiHandlingData* iFirst; CDrmUiHandlingData* iLast; diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/inc/DrmUtilityGlobalNoteWrapper.h --- a/commondrm/drmutility/inc/DrmUtilityGlobalNoteWrapper.h Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/inc/DrmUtilityGlobalNoteWrapper.h Wed Sep 01 12:21:16 2010 +0100 @@ -23,6 +23,7 @@ // INCLUDES #include #include +#include namespace DRM { @@ -102,6 +103,16 @@ TInt aValuePos = -1 ); /** + * Asynchronous wrapper for showing global message query. + * @param aMessageResourceId resource id of string to be displayed + * @param aHeaderResourceId resource id of header to be displayed in the query + * @param aString string that replaces %U in resource string + */ + void ShowMessageQueryL(TInt aMessageResourceId, + TInt aHeaderResourceId, + const TDesC& aString); + + /** * Synchronous wrapper for showing global preview list query. * @param aTextResourceId resource id of preview structure to be * displayed @@ -147,6 +158,13 @@ // Resource id of buttons in confirmation query TInt iButtonsId; + + // AVKON Global message query, used in method ShowMessageQueryL, activated asynchronously so needs to be owned + CAknGlobalMsgQuery* iGlobalMsgQuery; + // Message buffer for the global message query, contains dialog text with replaced string + TBuf iFinalMessageBuffer; + // Message buffer for the global message query header text + TBuf iHeaderBuffer; }; } diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/inc/drmutilityconnection.h --- a/commondrm/drmutility/inc/drmutilityconnection.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -/* -* 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 DRMUTILITYCONNECTION_H -#define DRMUTILITYCONNECTION_H - -#include // CActive -#include // RConnection, RSocketServ - -namespace DRM -{ - - /** - * Utility class for DRMutility dmgr wrapper related common functions - * - * @since S60 v9.2 - */ - - -// CLASS DECLARATION -// Class for handling internal connectivity logic -NONSHARABLE_CLASS( CDrmUtilityConnection ): public CActive - { -public: // Constructors and destructor. - - /** - * - */ - static CDrmUtilityConnection * NewL( const TBool aAllowQueries ); - - /** - * - */ - static CDrmUtilityConnection * NewLC( const TBool aAllowQueries ); - - /** - * Destructor - */ - ~CDrmUtilityConnection(); - -public: // new methods - - /** - * - */ - void ConnectL( TRequestStatus* aStatus ); - - /** - * - */ - void Close(); - - /** - * - */ - TBool HasMoreConnectionAttempts(); - - /** - * - */ - TBool IsConnected( TUint32& aIap ); - - /** - * Check if default connection has been defined - * @see RCmManager::ReadDefConnL - */ - static TBool HasDefaultConnectionL(); - - /** - * Check if system has access points defined - */ - static TBool HasAccessPointsL(); - - - -private: //enumerations - enum TConnectionType - { - EAttachExisting, //0 - EUsingDefault, //1 - EUsingPurposeOperator, // 2 - EUsingPurposeInternet, // 3 - EUsingQuery, // 4 - EFail // 5 - }; - - enum TState - { - EInit, // 0 - EConnecting, // 1 - EConnected, // 2 - EConnectFailed // 3 - }; - -private: // Constructors and destructor. - - /** - * Default constructor (for preventing inheritance) - */ - CDrmUtilityConnection( TBool aAllowQueries ); - - /** - * Second phase constructor - */ - void ConstructL(); - -private: // from CActive - - virtual void DoCancel(); - - virtual void RunL(); - - virtual TInt RunError( TInt aError ); - -private: // new methods - - /** - * - */ - void DoClose(); - - /** - * - */ - void Done(); - - /** - * - */ - void InitL(); - - /** - * - */ - void AttachExistingConnectionL(); - - /** - * - */ - void ConnectUsingDefaultL(); - - /** - * - */ - void ConnectUsingSnapPurposeL( const TUint32 aPurpose ); - - /** - * - */ - void ConnectUsingQueryL(); - - /** - * - */ - void UpdateIapIdL(); - - /** - * - */ - void CompleteSelf( TInt aError ); - - /** - * - */ - void CompleteParent( TInt aError ); - -private: // data - - RSocketServ iSocketServ; - RConnection iConnection; - TState iState; - TConnectionType iType; - TRequestStatus* iParentStatus; - const TBool iAllowQueries; - TUint32 iIapId; - }; -} -#endif /* DRMUTILITYCONNECTION_H */ diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/inc/drmutilityui.h --- a/commondrm/drmutility/inc/drmutilityui.h Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/inc/drmutilityui.h Wed Sep 01 12:21:16 2010 +0100 @@ -24,6 +24,8 @@ #include #include +#include "DrmUtilityGlobalNoteWrapper.h" + //*** forward declarations go here: class CDRMConstraint; class CCoeEnv; @@ -123,8 +125,18 @@ ContentAccess::CData& aContent, TInt aPreviewType, TInt aMediaType ); + + /* + * Utility method for showing an AVKON Message Query dialog, with buttons R_AVKON_SOFTKEYS_OK_EMPTY__OK. + * + * @param aMessage Resource ID for the dialog message. + * @param aHeader Resource ID for the dialog header. + * @param aString Replacement string for dialog message content. Replaces aMessage resources strings %U mark. + * @return Returns button code TInt from the dialog. + */ - + IMPORT_C TInt DisplayMessageQueryL( TInt aMessage, TInt aHeader, const TDesC& aString ); + protected: private: @@ -174,6 +186,8 @@ RPointerArray iNoteList; CMediatorEventProvider* iEventProvider; + + CDrmUtilityGlobalNoteWrapper* iNoteWrapper; }; } diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/inc/drmutilitywmdrmwrapper.h --- a/commondrm/drmutility/inc/drmutilitywmdrmwrapper.h Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/inc/drmutilitywmdrmwrapper.h Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-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" @@ -187,9 +187,7 @@ // Show the appropriate notes void ShowNoRightsNoteL( ContentAccess::CData& aContent, - TUint32 aReason, - TInt aOperationId, - DRM::MDrmHandleErrorObserver* aObserver ); + TUint32 aReason ); //*** DLA: @@ -215,6 +213,7 @@ RLibrary iDlaWrapperDll; CWmDrmDlaWrapper* iDlaWrapper; + TBool iWmDrmDlaSupportOn; }; } diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/inc/qdrmutilitydmgreventhandler.h --- a/commondrm/drmutility/inc/qdrmutilitydmgreventhandler.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/loc/DRMUtility.loc --- a/commondrm/drmutility/loc/DRMUtility.loc Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/loc/DRMUtility.loc Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -74,7 +74,7 @@ //w: //r: 3.0 // -#define qtn_drm_query_waiting_for_ro "Waiting for licence. Try again later." +#define qtn_drm_query_waiting_for_ro "Waiting for license. Try again later." //d: Text in confirmation query that is displayed when user tries to render MO that is missing RO. //d: The waiting time of RO to arrive has passed, and there is no possibility to get new RO (no rights @@ -83,7 +83,7 @@ //w: //r: 3.0 // -#define qtn_drm_query_ro_late "Licence not yet received. Expected time of delivery elapsed." +#define qtn_drm_query_ro_late "License not yet received. Expected time of delivery elapsed." //d: Text in confirmation query that is displayed when user tries to render MO that is missing RO. //d: The waiting time of RO to arrive has passed, and there is possibility to get new RO (rights issuer url exists). @@ -91,7 +91,7 @@ //w: //r: 3.0 // -#define qtn_drm_query_ro_late_activate "Licence not yet received. Expected time of delivery elapsed. Get new licence?" +#define qtn_drm_query_ro_late_activate "License not yet received. Expected time of delivery elapsed. Get new license?" //d: Text in confirmation query when user is asked about updating account. //d: Device is already connected to network, but must upgrade the domain key before rendering, @@ -138,7 +138,7 @@ //w: //r: // -#define qtn_drm_query_valid_rights_until "Licence for selected item valid until %U. Continue?" +#define qtn_drm_query_valid_rights_until "License for selected item valid until %U. Continue?" //d: Text in confirmation query //l: popup_note_window @@ -160,3 +160,10 @@ //r: 9.1 // #define qtn_drm_msg_qry_head_no_license "No license" + +//d: Text in message query to notify user that the DRM license needs to be acquired with PC sync. +//l: popup_note_window +//w: +//r: 9.2 +// +#define qtn_drm_query_expired_connect_pc "You must have valid license to play %U. Please sync your phone with your PC to update license." diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/src/DrmUiHandlingImpl.cpp --- a/commondrm/drmutility/src/DrmUiHandlingImpl.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/src/DrmUiHandlingImpl.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -17,6 +17,13 @@ // INCLUDE FILES +// connection +#include +#include +#include +#include +#include +#include // publish & subscribe #include @@ -29,6 +36,11 @@ #include #include +// browser +#ifdef __SERIES60_NATIVE_BROWSER +#include +#endif + // caf #include #include @@ -45,6 +57,9 @@ // character conversions #include +// handling urls +#include + // resources #include #include @@ -59,14 +74,6 @@ #include #include #include -#include - -//connectivity logic -#include // RCmConnectionMethod -#include // RCmDestination -#include // RCmManager - - #ifdef _DEBUG #include @@ -89,7 +96,6 @@ #include "DRMDomainContext.h" #include "DrmUtilityInternalcrkeys.h" // Cenrep extension for OmaBased -#include "drmuidialogids.h" // CONSTANTS const TInt KCommandHandleErrorFile( 1 ); @@ -102,6 +108,14 @@ const TInt KCommandHandleUrlData( 8 ); const TInt KCommandAvailableUrlsFile( 9 ); const TInt KCommandAvailableUrlsData( 10 ); +// browser +#ifndef __SERIES60_NATIVE_BROWSER +const TUid KCRUidBrowser = + {0x10008D39}; +const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; +const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; +const TUint32 KBrowserNGDefaultSnapId = 0x00000053; +#endif _LIT( KEncryptedRightsIssuerMatchString, "flk*" ); @@ -122,8 +136,6 @@ const TInt KresOmaBasedBuf( 512 ); const TInt KNameBuf( 256 ); -const TInt KNoValue = -1; - #ifdef _DEBUG // debug panic _LIT( KDRMUtilityDebugPanicMessage, "DrmUiHandlingDebugPanic" ); @@ -132,67 +144,6 @@ // ============================= LOCAL FUNCTIONS =============================== // ----------------------------------------------------------------------------- -// HasDefaultConnectionL -// Finds default IAP id -// @return Etrue: valid AP found -// EFalse: valid AP not found -// @leave system wide error codes -// ----------------------------------------------------------------------------- -// -LOCAL_C TBool HasDefaultConnectionL() - { - TBool hasDefault(EFalse); - TCmDefConnValue defConn; - RCmManager cmManager; - cmManager.OpenLC(); - cmManager.ReadDefConnL(defConn); - if (defConn.iType == ECmDefConnConnectionMethod) - { - cmManager.GetConnectionMethodInfoIntL(defConn.iId, - CMManager::ECmIapId); - hasDefault = ETrue; - } - else if (defConn.iType == ECmDefConnDestination) - { - RCmDestination dest(cmManager.DestinationL(defConn.iId)); - CleanupClosePushL(dest); - - if (dest.ConnectionMethodCount() <= 0) - { - User::Leave(KErrNotFound); - } - - RCmConnectionMethod cMeth(dest.ConnectionMethodL(0)); - CleanupClosePushL(cMeth); - - cMeth.GetIntAttributeL(CMManager::ECmIapId); - CleanupStack::PopAndDestroy(&cMeth); - CleanupStack::PopAndDestroy(&dest); - hasDefault = ETrue; - } - CleanupStack::PopAndDestroy(&cmManager); - return hasDefault; - } - -// ----------------------------------------------------------------------------- -// HasAccessPointsL -// ----------------------------------------------------------------------------- -// -LOCAL_C TBool HasAccessPointsL() - { - TInt apCount(0); - RCmManager cmManager; - CleanupClosePushL(cmManager); - cmManager.OpenL(); - RArray aps; - CleanupClosePushL(aps); - cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue); - apCount = aps.Count(); - CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager - return apCount > 0; - } - -// ----------------------------------------------------------------------------- // MapToCallError // ----------------------------------------------------------------------------- // @@ -207,16 +158,30 @@ } // ----------------------------------------------------------------------------- -// HasDefConn +// IapIdOfDefaultSnapL +// for trapping purposes only // ----------------------------------------------------------------------------- // -inline TBool HasDefConn() +LOCAL_C TUint32 IapIdOfDefaultSnapL( + RCmManager& aCmManager, + const TUint32 aDefaultSnap ) { - TBool found( EFalse ); - - TRAP_IGNORE( found = HasDefaultConnectionL() ); - - return found; + RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); + CleanupClosePushL( dest ); + TUint32 iapIdOfDest( 0 ); + + if ( dest.ConnectionMethodCount() <= 0 ) + { + User::Leave( KErrNotFound ); + } + + RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); + CleanupClosePushL( cMeth ); + + iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); + CleanupStack::PopAndDestroy( &cMeth ); + CleanupStack::PopAndDestroy( &dest ); + return iapIdOfDest; } // --------------------------------------------------------- @@ -437,6 +402,8 @@ delete iDrmUtilityUi; + delete iSchemeHandler; + delete iWrapperLoader; delete iOmaBasedAgentName; @@ -1836,8 +1803,8 @@ TBool onlyMeteringRejection( reason == DRM::EURejectionMetering ); if ( onlyMeteringRejection ) { - // Qt dialog not implemented yet - iDrmUtilityUi->DisplayNoteL( EConfUnableToOpen ); + iDrmUtilityUi->DisplayQueryWithIdL( R_DRM_QUERY_METERING_DISABLED, + R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); CleanupStack::PopAndDestroy( contentId ); return; @@ -2968,8 +2935,9 @@ if ( RejectReason( aReason ) == DRM::EURejectionMetering ) { // Show that only reason for error was rejected metering. - // Qt dialog not implemented yet - iDrmUtilityUi->DisplayNoteL( EConfUnableToOpen ); + iDrmUtilityUi->DisplayQueryWithIdL( + R_DRM_QUERY_METERING_DISABLED, + R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); } else { @@ -3490,7 +3458,7 @@ HBufC* etaBuf( NULL ); TBool isRegistered( EFalse ); TBool isJoined( EFalse ); - TInt ret( ECancelled ); + TInt ret( 0 ); TInt err( KErrNone ); TInt eta( 0 ); TFileName fileName; @@ -3516,13 +3484,16 @@ // rights should have come already if ( aRightsUrl ) { - ret = iDrmUtilityUi->DisplayQueryL( EQueryGetNewLicence, KNoValue ); + ret = iDrmUtilityUi->DisplayQueryWithIdL( + R_DRMUTILITY_RIGHTS_SHOULD_HAVE_COME, + R_DRMUTILITY_CONFIRMATION_QUERY ); } else { // no rights issuer - // Qt dialog not implemented yet - iDrmUtilityUi->DisplayNoteL( EConfLicenceNotReceived ); + iDrmUtilityUi->DisplayQueryWithIdL( + R_DRMUTILITY_RIGHTS_SHOULD_HAVE_COME_NO_RI, + R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); } } else if ( !eta || err || eta == -1 ) @@ -3536,13 +3507,17 @@ if ( aRightsUrl && isRegistered && !isJoined ) // Domain ro case { - ret = iDrmUtilityUi->DisplayQueryL( EQueryAccountUpdate, KNoValue ); + ret = iDrmUtilityUi->DisplayQueryWithIdL( + R_DRMUTILITY_ACTIVATE_ACCOUNT, + R_DRMUTILITY_CONFIRMATION_QUERY ); } else if ( aRightsUrl ) // Device ro case { if ( aReason & EConstraintIndividual ) { - ret = iDrmUtilityUi->DisplayQueryL( EQueryFileLockedForSim, KNoValue ); + ret = iDrmUtilityUi->DisplayQueryWithIdL( + R_DRMUTILITY_INVALID_SIM, + R_DRMUTILITY_CONFIRMATION_QUERY ); } else { @@ -3550,20 +3525,19 @@ User::LeaveIfError( aContent.GetStringAttribute( EFileName, fileName ) ); - // Qt dialog not implemented yet - ret = iDrmUtilityUi->DisplayQueryL( EQueryFileWithNoRightsObj, fileName ); + ret = iDrmUtilityUi->DisplayQueryL( + R_DRM_QUERY_EXPIRED_OR_NO_RO, fileName ); } } else // no rights issuer { if ( aReason & EConstraintIndividual ) { - // Qt dialog not implemented yet - iDrmUtilityUi->DisplayNoteL( EConfFileLockedForSim ); + iDrmUtilityUi->DisplayNoteL( R_DRM_INFO_SIM_NOT_ALLOWED ); } else { - iDrmUtilityUi->DisplayNoteL( EConfLicenceExpired ); + iDrmUtilityUi->DisplayNoteL( R_DRM_INFO_EXPIRED_OR_NO_RO ); } } } @@ -3573,25 +3547,31 @@ if ( eta != KErrCAPendingRights ) { // rights expected to arrive in eta seconds - iDrmUtilityUi->DisplayNoteL( EConfWaitingForLicence ); + iDrmUtilityUi->DisplayQueryWithIdL( + R_DRMUTILITY_WAITING_FOR_RIGHTS, + R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); } else { // rights should have come if ( aRightsUrl ) { - ret = iDrmUtilityUi->DisplayQueryL( EQueryGetNewLicence, KNoValue ); + ret = iDrmUtilityUi->DisplayQueryWithIdL( + R_DRMUTILITY_RIGHTS_SHOULD_HAVE_COME, + R_DRMUTILITY_CONFIRMATION_QUERY ); } else { // no rights issuer - // Qt dialog not implemented yet - iDrmUtilityUi->DisplayNoteL( EConfLicenceNotReceived ); + iDrmUtilityUi->DisplayQueryWithIdL( + R_DRMUTILITY_RIGHTS_SHOULD_HAVE_COME_NO_RI, + R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ); } } } } - if ( ret == EOk ) + + if ( ret == EAknSoftkeyYes || ret == EAknSoftkeyOk ) { rightsRenewalWanted = ETrue; } @@ -4070,11 +4050,25 @@ ptrc.Set( *newUrl ); } - CDrmBrowserLauncher* browserLauncher = CDrmBrowserLauncher::NewLC(); - - browserLauncher->LaunchUrlL(ptrc); - - CleanupStack::PopAndDestroy(); // browserLauncher + 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; // delete newUrl if needed if ( newUrl ) @@ -4093,38 +4087,39 @@ const TBool aShowNotes ) { TInt r( KErrCancel ); - TInt buttonCode( EOk ); + TInt buttonCode( EAknSoftkeyYes ); HBufC8* url( NULL ); if ( !SilentRightsAllowedL() ) { - buttonCode = ECancelled; + buttonCode = EAknSoftkeyNo; if ( aShowNotes ) { - // Qt dialog not implemented yet - buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryConnectToActivate, KNoValue ); + buttonCode = iDrmUtilityUi->DisplayQueryWithIdL( + R_DRM_QRY_CONNECT_TO_ACTIVATE, + R_DRMUTILITY_CONFIRMATION_QUERY ); } } - else if ( !(HasDefConn()) ) + else if ( !BrowserAPDefinedL() ) { - buttonCode = ECancelled; + buttonCode = EAknSoftkeyNo; if ( aShowNotes ) { - // Qt dialog not implemented yet - buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryConnectToActivate, KNoValue ); + buttonCode = iDrmUtilityUi->DisplayQueryWithIdL( + R_DRM_QRY_CONNECT_TO_ACTIVATE, + R_DRMUTILITY_CONFIRMATION_QUERY ); } } - if ( buttonCode == EOk ) + if ( buttonCode == EAknSoftkeyYes || buttonCode == EAknSoftkeyOk ) { - TBool APs( HasAccessPointsL() ); + TInt APs( APCountL() ); if ( !APs ) { // No AP defined if ( aShowNotes ) { - // Qt dialog not implemented yet - iDrmUtilityUi->DisplayNoteL( EConfNoAccessPoint ); + iDrmUtilityUi->DisplayNoteL( R_DRM_WARN_NO_CONN_DEFINED ); } r = KErrCANoRights; } @@ -4158,8 +4153,8 @@ // Connection failed with selected AP if ( aShowNotes ) { - // Qt dialog not implemented yet - iDrmUtilityUi->DisplayNoteL( EConfConnectionFailed ); + iDrmUtilityUi->DisplayNoteL( + R_DRM_WARN_INVALID_OR_NO_AP ); } r = KErrCANoRights; } @@ -4176,10 +4171,13 @@ if ( errorUrl ) { // ask user whether error url should be opened - // Qt dialog not implemented yet - buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryOpenErrorUrl, KNoValue ); - - if ( buttonCode == EOk ) + buttonCode + = iDrmUtilityUi->DisplayQueryWithIdL( + R_DRM_QUERY_OPEN_ERROR_URL, + R_DRMUTILITY_CONFIRMATION_QUERY ); + + if ( buttonCode == EAknSoftkeyYes + || buttonCode == EAknSoftkeyOk ) { // Launch browser LaunchBrowserL( errorUrl ); @@ -4187,8 +4185,8 @@ } else { - // Qt dialog not implemented yet - iDrmUtilityUi->DisplayNoteL( EConfUnableToUnlock ); + iDrmUtilityUi->DisplayNoteL( + R_DRM_ERR_OPENING_FAIL_PERM ); } CleanupStack::PopAndDestroy( errorUrl ); } @@ -4215,16 +4213,84 @@ } // ----------------------------------------------------------------------------- +// CDrmUiHandlingImpl::BrowserAPDefinedL +// ----------------------------------------------------------------------------- +// +TBool DRM::CDrmUiHandlingImpl::BrowserAPDefinedL() + { + const TInt KDestinationSelectionMode( 2 ); + TInt err( KErrNone ); + TInt ap( 0 ); + TInt alwaysAsk( 0 ); + TInt defaultSnap( 0 ); + + CRepository* repository( CRepository::NewL( KCRUidBrowser ) ); + repository->Get( KBrowserDefaultAccessPoint, ap ); + repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); + repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); + delete repository; + if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) + { + alwaysAsk = ETrue; + } + else + { + RCmManager cmManager; + CleanupClosePushL( cmManager ); + cmManager.OpenL(); + if ( !alwaysAsk ) + { + TRAP( err, cmManager.GetConnectionMethodInfoIntL( + ap, CMManager::ECmIapId ) ); + } + else if ( alwaysAsk == KDestinationSelectionMode ) + { + TRAP( err, IapIdOfDefaultSnapL( cmManager, defaultSnap ) ); + } + CleanupStack::PopAndDestroy( &cmManager ); + if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) + { + return ETrue; + } + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CDrmUiHandlingImpl::APCountL +// ----------------------------------------------------------------------------- +// +TInt DRM::CDrmUiHandlingImpl::APCountL() + { + TInt apCount( 0 ); + RCmManager cmManager; + CleanupClosePushL( cmManager ); + cmManager.OpenL(); + RArray aps; + CleanupClosePushL( aps ); + cmManager.ConnectionMethodL( aps, EFalse, EFalse, ETrue ); + apCount = aps.Count(); + CleanupStack::PopAndDestroy( 2, &cmManager ); //aps, cmManager + return apCount; + } + +// ----------------------------------------------------------------------------- // CDrmUiHandlingImpl::HandleServerAppExit // ----------------------------------------------------------------------------- // void DRM::CDrmUiHandlingImpl::HandleServerAppExit( TInt aReason ) { - if ( aReason == EAknCmdExit) + if ( aReason == EAknCmdExit && !iSchemeHandler ) { CAknEnv::RunAppShutter(); } + if ( iSchemeHandler ) + { + delete iSchemeHandler; + iSchemeHandler = NULL; + } + if ( iWait.IsStarted() ) { iWait.AsyncStop(); diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp --- a/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,65 +1,68 @@ /* - * 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: Dynamically loadable wrapper for Download manager - * - */ +* Copyright (c) 2007-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: Dynamically loadable wrapper for Download manager +* +*/ + #include #include #include #include #include #include + +#ifdef __SERIES60_NATIVE_BROWSER +#include +#endif + #ifdef RD_MULTIPLE_DRIVE #include #endif + #include #include -#include // tconnectioninfo -#include // TConnectionInfoV2 -#include // rconnection rsocket -#include // avkon classes -#include - #include #include #include -#include -#include -#include - -// including files related to qt changes -#include -#include -#include -#include -#include - +#include "RoapEng.h" #include "RoapSyncWrapper.h" #include "RoapDef.h" + #include "DrmUtilityDmgrWrapper.h" #include "DrmUtilityDmgrWrapperLogger.h" -#include "drmutilityconnection.h" -#include "buffercontainers.h" //CnameContainer etc. -#include "cleanupresetanddestroy.h" -#include "buffercontainers.h" -#include "qdrmutilitydmgreventhandler.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "DrmUtilityDmgrWrapperTraces.h" +// DEBUG macros +#ifdef _DEBUG +#define DRMDEBUGLIT( a, b ) \ +_LIT( a , b ) +#define DRMDEBUG( a ) \ +RDebug::Print( a ) +#define DRMDEBUG2( a, b ) \ +RDebug::Print( a, b ) +#else +#define DRMDEBUGLIT( a, b ) +#define DRMDEBUG( a ) +#define DRMDEBUG2( a, b ) +#endif + +// CONSTANTS +#ifndef __SERIES60_NATIVE_BROWSER +const TUid KCRUidBrowser = {0x10008D39}; +const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; +const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; #endif #ifndef RD_MULTIPLE_DRIVE @@ -69,129 +72,52 @@ _LIT( KRomDriveFormatter, "%c:" ); _LIT( KKDrmUtilityTriggerFilePathFormatter, "%c:\\" ); #endif + _LIT( KCDrmUtilityDmgrWrapperResFileName,"DrmUtilityDmgrWrapper.rsc" ); -const TInt KProgressInfoFinalValue(200); -const TInt KProgressInfoIncrementSmall(5); -const TInt KProgressInfoIncrementMedium(10); -const TInt KProgressInfoIncrementLarge(30); - -using namespace WRT; +const TInt KProgressInfoFinalValue( 200 ); +const TInt KProgressInfoIncrementSmall( 5 ); +const TInt KProgressInfoIncrementMedium( 10 ); +const TInt KProgressInfoIncrementLarge( 30 ); // ======== LOCAL FUNCTIONS ======== // --------------------------------------------------------------------------- -// ClearIfNotRoapTemporaryError +// DeleteHttpDowload // --------------------------------------------------------------------------- // -void ClearIfNotRoapTemporaryError(TInt aError, HBufC8*& aBuffer) +LOCAL_C void DeleteHttpDowload( TAny* aDownload ) { - // ROAP ERROR CODES - switch (aError) - { - case KErrRoapGeneral: - case KErrRoapServer: - case KErrRoapDomainFull: - case KErrRoapNotRegistered: - break; - default: - delete aBuffer; - aBuffer = NULL; - break; - } + reinterpret_cast< RHttpDownload* >( aDownload )->Delete(); } - // --------------------------------------------------------------------------- -// Calls the appropriate member function of the object during object cleanup +// IapIdOfDefaultSnapL +// for trapping purposes only // --------------------------------------------------------------------------- // -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; - }; +LOCAL_C TUint32 IapIdOfDefaultSnapL( + RCmManager& aCmManager, + const TUint32 aDefaultSnap ) + { + RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); + CleanupClosePushL( dest ); + TUint32 iapIdOfDest( 0 ); + if ( dest.ConnectionMethodCount() <= 0 ) + { + User::Leave( KErrNotFound ); + } -// --------------------------------------------------------------------------- -// UpdateBufferL -// --------------------------------------------------------------------------- -// -template -LOCAL_C void UpdateBufferL(bufType*& aTargetBuf, const descType& aSourceBuf) - { - if (aTargetBuf) - { - delete aTargetBuf; - aTargetBuf = NULL; - } - if (aSourceBuf.Length()) - { - aTargetBuf = aSourceBuf.AllocL(); - } + RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); + CleanupClosePushL( cMeth ); + + iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); + CleanupStack::PopAndDestroy( &cMeth ); + CleanupStack::PopAndDestroy( &dest ); + return iapIdOfDest; } + // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- @@ -199,10 +125,8 @@ // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::CDrmUtilityDmgrWrapper() : - CActive(CActive::EPriorityStandard), - iUseCoeEnv(EFalse), iIapId(0), iState(EInit) + iUseCoeEnv( EFalse ) { - CActiveScheduler::Add(this); } // --------------------------------------------------------------------------- @@ -213,24 +137,14 @@ { CLOG_WRITE( "DMgrWrapper::ConstructL" ); const TInt KDrmUtilityDmgrWrapperUid = 0x102830FE; - iConnection = DRM::CDrmUtilityConnection::NewL(ETrue); - - try - { - QString drmUtilityDmgrWrapperUid(QString::number(KDrmUtilityDmgrWrapperUid)); - iDlMgr = q_check_ptr(new DownloadManager(drmUtilityDmgrWrapperUid)); - } - catch(const std::exception& exception) - { - qt_symbian_exception2LeaveL(exception); - } + iDlMgr.ConnectL( TUid::Uid(KDrmUtilityDmgrWrapperUid), *this, EFalse ); iProgressInfo = NULL; iProgressNoteDialog = NULL; iDialogDismissed = ETrue; - User::LeaveIfError(iFs.Connect()); - User::LeaveIfError(iFs.ShareProtected()); } + + // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::NewL // --------------------------------------------------------------------------- @@ -238,11 +152,12 @@ CDrmUtilityDmgrWrapper* CDrmUtilityDmgrWrapper::NewL() { CLOG_WRITE( "DMgrWrapper::NewL" ); - CDrmUtilityDmgrWrapper* self(CDrmUtilityDmgrWrapper::NewLC()); - CleanupStack::Pop(self); + CDrmUtilityDmgrWrapper* self( CDrmUtilityDmgrWrapper::NewLC() ); + CleanupStack::Pop( self ); return self; } + // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::NewLC // --------------------------------------------------------------------------- @@ -250,12 +165,13 @@ CDrmUtilityDmgrWrapper* CDrmUtilityDmgrWrapper::NewLC() { CLOG_WRITE( "DMgrWrapper::NewLC" ); - CDrmUtilityDmgrWrapper* self(new (ELeave) CDrmUtilityDmgrWrapper()); - CleanupStack::PushL(self); + CDrmUtilityDmgrWrapper* self( new( ELeave ) CDrmUtilityDmgrWrapper() ); + CleanupStack::PushL( self ); self->ConstructL(); return self; } + // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::~CDrmUtilityDmgrWrapper // --------------------------------------------------------------------------- @@ -263,31 +179,44 @@ CDrmUtilityDmgrWrapper::~CDrmUtilityDmgrWrapper() { CLOG_WRITE( "DMgrWrapper destructor" ); - Cancel(); - if (iProgressNoteDialog) - { - // deletes the dialog - TRAPD( err, iProgressNoteDialog->ProcessFinishedL() ); - if (err) - { - delete iProgressNoteDialog; - } - iProgressNoteDialog = NULL; - } + if ( iProgressNoteDialog ) + { + // deletes the dialog + TRAPD( err, iProgressNoteDialog->ProcessFinishedL() ); + if ( err ) + { + delete iProgressNoteDialog; + } + iProgressNoteDialog = NULL; + } delete iErrorUrl; + delete iPostResponseUrl; + +#ifdef _DEBUG - delete iPostResponseUrl; - delete iConnection; + if ( iDlMgr.Handle() ) + { + iDlMgr.Close(); + } + +#else + + iDlMgr.Close(); + +#endif + } - delete iTriggerUrl; - delete iTriggerBuf; - delete iFileName; - delete iRoapEng; - iDownload->cancel(); - delete iDlMgr; - delete iDrmUtilityDmgrEventHandler; - - iFs.Close(); + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) + { + CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" ); + iUseCoeEnv = EFalse; + DoDownloadAndHandleRoapTriggerL( aUrl ); + HandlePostResponseUrlL(); } @@ -295,453 +224,447 @@ // CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL // --------------------------------------------------------------------------- // -void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL(const HBufC8* aUrl) - { - CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" ); - iUseCoeEnv = EFalse; - if (iState != EInit || iWait.IsStarted()) - { - User::Leave(KErrNotReady); - } - - UpdateBufferL (iTriggerUrl, *aUrl); - CompleteToState(EInit, KErrNone); - iWait.Start(); - } - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL -// --------------------------------------------------------------------------- -// void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL( - const HBufC8* aUrl, CCoeEnv& aCoeEnv) + const HBufC8* aUrl, CCoeEnv& aCoeEnv ) { CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" ); iCoeEnv = &aCoeEnv; iUseCoeEnv = ETrue; - if (iState != EInit || iWait.IsStarted()) + DoDownloadAndHandleRoapTriggerL( aUrl ); + HandlePostResponseUrlL(); + } + + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::HandlePostResponseUrlL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::HandlePostResponseUrlL() + { + if ( iPostResponseUrl ) { - User::Leave(KErrNotReady); + DoDownloadAndHandleRoapTriggerL( iPostResponseUrl ); + // prevent infinite post response fetches. + delete iPostResponseUrl; + iPostResponseUrl = NULL; + + // Ensure progress note gets deleted. + // It remains open if prUrl initialted ROAP operation has PrUrl + // (unsupported chained metering report) + RemoveProgressNoteL(); + } + } + + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::DoDownloadAndHandleRoapTriggerL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::DoDownloadAndHandleRoapTriggerL( + const HBufC8* aUrl ) + { + RFs fs; + RFile roapTrigger; + HBufC8* triggerBuf( NULL ); + TBool result( EFalse ); + TFileName triggerFileName; + + CLOG_WRITE( "DMgrWrapper::DoDownloadAndHandleRoapTriggerL" ); + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + User::LeaveIfError( fs.ShareProtected() ); + +#ifndef RD_MULTIPLE_DRIVE + + User::LeaveIfError( roapTrigger.Temp( + fs, KDrmUtilityTriggerFilePath, triggerFileName, EFileWrite ) ); + +#else //RD_MULTIPLE_DRIVE + + TInt driveNumber( -1 ); + TChar driveLetter; + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, driveNumber ); + fs.DriveToChar( driveNumber, driveLetter ); + + TFileName utilityTriggerFilePath; + + utilityTriggerFilePath.Format( KKDrmUtilityTriggerFilePathFormatter, + (TUint)driveLetter ); + + User::LeaveIfError( roapTrigger.Temp( + fs, utilityTriggerFilePath, triggerFileName, EFileWrite ) ); + +#endif + + + TPtrC8 KNullPtr8( NULL, 0 ); + RHttpDownload* downloadPtr( iDlMgr.FindDownload( *aUrl, KNullPtr8 ) ); + if ( downloadPtr ) + { + // Stale download found. + // Remove it, and re-create a new download. + downloadPtr->Delete(); + downloadPtr = NULL; + } + + // create and start download + RHttpDownload& download = iDlMgr.CreateDownloadL( *aUrl, result ); + // Put download for proper cleanup. + TCleanupItem item( DeleteHttpDowload, &download ); + CleanupStack::PushL( item ); + + CleanupClosePushL( roapTrigger ); + + if ( !iPostResponseUrl ) + { + // No post response retieval. Note must be created. + ShowProgressNoteL(); } - UpdateBufferL (iTriggerUrl, *aUrl); - CompleteToState(EInit, KErrNone); - iWait.Start(); + if ( result ) + { + const TInt KReadBufSize( 512 ); + TInt triggerFileSize( 0 ); + + CLOG_WRITE( + "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download created" ); + 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 + iWait.Start(); + + // Check success of download + CLOG_WRITE( + "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download finished" ); + + CleanupStack::Pop( &roapTrigger ); + roapTrigger.Close(); + if ( !iDownloadSuccess ) + { + RemoveProgressNoteL(); + if ( iConnectionError ) + { + User::Leave( KErrCouldNotConnect ); + } + else + { + User::Leave( KErrGeneral ); + } + } + User::LeaveIfError( roapTrigger.Open( fs, + triggerFileName, + EFileShareReadersOrWriters ) ); + CleanupClosePushL( roapTrigger ); + + // Get filehandle of ROAP trigger + // Read file to buffer + User::LeaveIfError( roapTrigger.Size( triggerFileSize ) ); + triggerBuf = HBufC8::NewLC( triggerFileSize ); + + RBuf8 readBuf; + readBuf.CleanupClosePushL(); + readBuf.CreateL( KReadBufSize ); + + User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) ); + triggerBuf->Des().Copy( readBuf ); + while ( readBuf.Length() == KReadBufSize ) + { + User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) ); + triggerBuf->Des().Append( readBuf ); + } + + CleanupStack::PopAndDestroy( &readBuf ); + + if ( iUseCoeEnv && iProgressInfo ) + { + iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); + } + + // And let ROAP handle it... + CRoapSyncWrapper* roapWrapper( CRoapSyncWrapper::NewL() ); + CleanupStack::PushL( roapWrapper ); + TRAPD( err, roapWrapper->HandleTriggerL( *triggerBuf ) ); + if ( err ) + { + TInt errorType( 0 ); + TRAPD( err2, + iErrorUrl = roapWrapper->GetErrorUrlL( err, errorType ) ); + if ( err2 ) + { + RemoveProgressNoteL(); + delete iErrorUrl; + iErrorUrl = NULL; + User::Leave( err2 ); + } + else if ( errorType != KErrRoapTemporary ) + { + RemoveProgressNoteL(); + delete iErrorUrl; + iErrorUrl = NULL; + User::Leave( err ); + } + else + { + RemoveProgressNoteL(); + User::Leave( err ); + } + } + if ( iPostResponseUrl ) + { + delete iPostResponseUrl; + iPostResponseUrl = NULL; + } + iPostResponseUrl = roapWrapper->GetPostResponseUrlL(); + CleanupStack::PopAndDestroy( 2, triggerBuf ); + + if ( iUseCoeEnv && iProgressInfo && !iPostResponseUrl ) + { + // No PrUrl found. Progess is complete. + iProgressInfo->SetAndDraw( KProgressInfoFinalValue ); + } + } + + // Trick to keep note open long enough during prUrl retrieval + if ( !iPostResponseUrl ) + { + RemoveProgressNoteL(); + } + else + { + if ( iUseCoeEnv && iProgressInfo ) + { + iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); + } + } + + CleanupStack::PopAndDestroy( &roapTrigger ); + CleanupStack::PopAndDestroy( &download ); + + fs.Delete( triggerFileName ); + CleanupStack::PopAndDestroy( &fs ); } + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::SetDefaultAccessPointL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::SetDefaultAccessPointL() + { + const TInt KDestinationSelectionMode( 2 ); + CRepository* repository( NULL ); + TInt ap( 0 ); + TInt alwaysAsk( 0 ); + TUint32 iapd32( 0 ); + TInt defaultSnap( 0 ); + TInt err( KErrNone ); + + CLOG_WRITE( "DMgrWrapper::SetDefaultAccessPointL" ); + DRMDEBUGLIT( KDuiBrApFormat, + "CDrmUtilityDmgrWrapper::SetDefaultAccessPointL %d" ); + DRMDEBUGLIT( KDuiBrApFormat2, " KBrowserDefaultAccessPoint = %d" ); + DRMDEBUGLIT( KDuiBrApFormat3, " KBrowserAccessPointSelectionMode = %d" ); + DRMDEBUGLIT( KDuiBrApFormat4, " KBrowserNGDefaultSnapId = %d" ); + + repository = CRepository::NewL( KCRUidBrowser ); + CleanupStack::PushL( repository ); + repository->Get( KBrowserDefaultAccessPoint, ap ); + repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); + repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); + DRMDEBUG2( KDuiBrApFormat(), __LINE__ ); + DRMDEBUG2( KDuiBrApFormat2(), ap ); + DRMDEBUG2( KDuiBrApFormat3(), alwaysAsk ); + DRMDEBUG2( KDuiBrApFormat4(), defaultSnap ); + + if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) + { + alwaysAsk = ETrue; + } + else + { + RCmManager cmManager; + cmManager.OpenLC(); + if ( !alwaysAsk ) + { + TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL( + ap, CMManager::ECmIapId ) ); + } + else if ( alwaysAsk == KDestinationSelectionMode ) + { + TRAP( err, iapd32 = + IapIdOfDefaultSnapL( cmManager, defaultSnap ) ); + } + CleanupStack::PopAndDestroy( &cmManager ); + } + if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) + { + err = iDlMgr.SetIntAttribute( EDlMgrIap, iapd32 ); + } + CleanupStack::PopAndDestroy( repository ); + } + + // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::GetErrorUrlL // --------------------------------------------------------------------------- // HBufC8* CDrmUtilityDmgrWrapper::GetErrorUrlL() { - if (iErrorUrl) + if( iErrorUrl ) { return iErrorUrl->AllocL(); } return NULL; } -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::DoConnectL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::DoConnectL(TDownloadState aNextState) - { - iConnection->ConnectL(&iStatus); - if (iUseCoeEnv && iProgressInfo) - { - iProgressInfo->SetAndDraw(0); - } - iState = aNextState; - SetActive(); - } -///// -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::DoDownloadRoapTriggerL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::DoDownloadRoapTriggerL(TDownloadState aNextState) - { - // Fetch name of opend connection to be used as part of DMGR - // initialisation - TUint32 iapId(0); - if (iConnection->IsConnected(iapId)) - { - const QVariant qIapId( static_cast(iapId) ); - iDlMgr->setAttribute( WRT::ClientName, qIapId ); - } - RFile roapTrigger; - CleanupClosePushL(roapTrigger); - DRM::CFileNameContainer* triggerFileName(NULL); - - // If no Trigger URL then nothing to download. So finish transaction - if (!iTriggerUrl || iTriggerUrl->Length() <= 0) - { - if (iUseCoeEnv && iProgressInfo) - { - // No PrUrl found. Progess is complete. - iProgressInfo->SetAndDraw(KProgressInfoFinalValue); - } - CompleteToState(EComplete, KErrNone); - return; - } - - TPtrC8 KNullPtr8(NULL, 0); - 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. - download->cancel(); - download = NULL; - if (iFileName) - { - iFs.Delete(*iFileName); - } - } - triggerFileName=DRM::CFileNameContainer::NewLC(); - -#ifndef RD_MULTIPLE_DRIVE - - User::LeaveIfError( roapTrigger.Temp( - iFs, KDrmUtilityTriggerFilePath, triggerFileName->iBuffer, EFileWrite ) ); - -#else //RD_MULTIPLE_DRIVE - TInt driveNumber(-1); - TChar driveLetter; - DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRam, driveNumber); - iFs.DriveToChar(driveNumber, driveLetter); - - DRM::CFileNameContainer* - utilityTriggerFilePath(DRM::CFileNameContainer::NewLC()); - - utilityTriggerFilePath->iBuffer.Format( - KKDrmUtilityTriggerFilePathFormatter, (TUint) driveLetter); - - User::LeaveIfError(roapTrigger.Temp(iFs, utilityTriggerFilePath->iBuffer, - triggerFileName->iBuffer, EFileWrite)); - CleanupStack::PopAndDestroy( utilityTriggerFilePath ); - utilityTriggerFilePath=NULL; - -#endif - UpdateBufferL (iFileName, triggerFileName->iBuffer); - CleanupStack::PopAndDestroy( triggerFileName ); - triggerFileName=NULL; - // create and start download - 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; - - try - { - RBuf fileName; - User::LeaveIfError(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); - } -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::DoSaveRoapTriggerL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::DoSaveRoapTriggerL(TDownloadState aNextState) - { - // Check success of download - - // Fetch download created in DoDownloadRoapTriggerL - 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; - - RFile roapTrigger; - - if (!iDownloadSuccess) - { - RemoveProgressNoteL(); - if (iConnectionError) - { - User::Leave(KErrCouldNotConnect); - } - else - { - User::Leave(KErrGeneral); - } - } - User::LeaveIfError(roapTrigger.Open(iFs, *iFileName, - EFileShareReadersOrWriters)); - CleanupClosePushL(roapTrigger); - // Get filehandle of ROAP trigger - const TInt KReadBufSize = 512; - - RBuf8 readBuf; - readBuf.CleanupClosePushL(); - readBuf.CreateL(KReadBufSize); - - // Read file to buffer - TInt triggerFileSize(0); - User::LeaveIfError(roapTrigger.Size(triggerFileSize)); - if (iTriggerBuf) - { - delete iTriggerBuf; - iTriggerBuf = NULL; - } - iTriggerBuf = HBufC8::NewL(triggerFileSize); - User::LeaveIfError(roapTrigger.Read(readBuf, KReadBufSize)); - iTriggerBuf->Des().Copy(readBuf); - while (readBuf.Length() == KReadBufSize) - { - User::LeaveIfError(roapTrigger.Read(readBuf, KReadBufSize)); - iTriggerBuf->Des().Append(readBuf); - } - - // And let ROAP handle it... - CleanupStack::PopAndDestroy(&readBuf); - CleanupStack::PopAndDestroy(&roapTrigger); - - iFs.Delete(*iFileName); - delete iFileName; - iFileName = NULL; - if (iUseCoeEnv && iProgressInfo) - { - iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium); - } - - CompleteToState(aNextState, KErrNone); - } - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::DoHandleRoapTriggerL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::DoHandleRoapTriggerL(TDownloadState aNextState) - { - Roap::TTriggerType triggerType; - Roap::TRiContextStatus contextStatus; - Roap::TDomainOperation domainOperation; - - RPointerArray contentIds; - CleanupResetAndDestroyPushL( contentIds ); - - iRoapEng = Roap::CRoapEng::NewL(); - - iRoapEng->SetTriggerL(*iTriggerBuf, NULL, triggerType, contextStatus, - domainOperation, contentIds); - - CleanupStack::PopAndDestroy(&contentIds); - - iRoapEng->AcceptL(this, &iStatus); - iState = aNextState; - SetActive(); - } - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::CompleteToState -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::CompleteToState( - CDrmUtilityDmgrWrapper::TDownloadState aNextState, TInt aError) - { - iState = aNextState; - TRequestStatus* ownStatus(&iStatus); - User::RequestComplete(ownStatus, aError); - SetActive(); - } - -// MHttpDownloadMgrObserver methods // --------------------------------------------------------------------------- // From class MHttpDownloadMgrObserver // // CDrmUtilityDmgrWrapper::HandleDMgrEventL // --------------------------------------------------------------------------- // -void CDrmUtilityDmgrWrapper::HandleDownloadEventL( WRT::DownloadEvent* aEvent ) +void CDrmUtilityDmgrWrapper::HandleDMgrEventL( + RHttpDownload& aDownload, + THttpDownloadEvent aEvent ) { - QString KDrmUtilityMimeTypeROAPTrigger("application/vnd.oma.drm.roap-trigger+xml"); - - try - { - if (aEvent->type() == DownloadEvent::HeadersReceived) + _LIT8( KDrmUtilityMimeTypeROAPTrigger, + "application/vnd.oma.drm.roap-trigger+xml" ); + + CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL" ); + CLOG_WRITE_FORMAT( "iDownLoadState = %d", aEvent.iDownloadState ); + CLOG_WRITE_FORMAT( "iProgressState = %d", aEvent.iProgressState ); + + if ( aEvent.iProgressState == EHttpContentTypeReceived ) { // check received mimetype - QString contentType = iDownload->attribute(ContentType).toString(); - if (!contentType.contains(KDrmUtilityMimeTypeROAPTrigger)) + RBuf8 contentType; + contentType.CleanupClosePushL(); + contentType.CreateL( KMaxContentTypeLength ); + User::LeaveIfError( + aDownload.GetStringAttribute( EDlAttrContentType, contentType ) ); + if ( !contentType.FindF( KDrmUtilityMimeTypeROAPTrigger ) ) { // ROAP trigger found, continue download - iDownload->start(); + User::LeaveIfError( aDownload.Start() ); } else { // wrong MIME type, so stop download iDownloadSuccess = EFalse; - iDownload->cancel(); + User::LeaveIfError( aDownload.Delete() ); + } + CleanupStack::PopAndDestroy( &contentType ); + } + + if ( aEvent.iDownloadState == EHttpDlCreated ) + { + CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCreated" ); + if ( iUseCoeEnv ) + { + iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); } } - } - catch(const std::exception& exception) - { - qt_symbian_exception2LeaveL(exception); - } - - if (aEvent->type() == DownloadEvent::Created) + else if ( aEvent.iProgressState == EHttpProgDisconnected ) { - CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: Created" ); - if (iUseCoeEnv && iProgressInfo) - { - iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium); - } - } - else if (aEvent->type() == DownloadEvent::NetworkLoss) - { - CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: NetworkLoss" ); - + CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpProgDisconnected" ); // store failure iDownloadSuccess = EFalse; iConnectionError = ETrue; // finished + iWait.AsyncStop(); } - else if (aEvent->type() == DownloadEvent::InProgress) + else if ( aEvent.iDownloadState == EHttpDlInprogress ) { - CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: InProgress" ); - if (iUseCoeEnv) + CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlInprogress" ); + if ( iUseCoeEnv ) { - iProgressInfo->IncrementAndDraw(KProgressInfoIncrementSmall); + iProgressInfo->IncrementAndDraw( KProgressInfoIncrementSmall ); } } - else if (aEvent->type() == DownloadEvent::Completed) + else if ( aEvent.iDownloadState == EHttpDlCompleted ) { // store success - CLOG_WRITE( "DMgrWrapper::ProcessDownloadEventL: Completed" ); + CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCompleted" ); iDownloadSuccess = ETrue; - iConnectionError = EFalse; - if (iUseCoeEnv) + if ( iUseCoeEnv ) { - iProgressInfo->IncrementAndDraw(KProgressInfoIncrementLarge); + iProgressInfo->IncrementAndDraw( KProgressInfoIncrementLarge ); } // finished - TRequestStatus* status(&iStatus); - User::RequestComplete(status, KErrNone); + iWait.AsyncStop(); } - else if (aEvent->type() == DownloadEvent::Failed) + else if ( aEvent.iDownloadState == EHttpDlFailed ) { - 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); - } + 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; + } + + // finished + iWait.AsyncStop(); } } + // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::ShowProgressNoteL // --------------------------------------------------------------------------- // void CDrmUtilityDmgrWrapper::ShowProgressNoteL() { - DRM::CFileNameContainer* resFileName(NULL); + TFileName resFileName; CLOG_WRITE( "DMgrWrapper::ShowProgressNoteL" ); - if (iUseCoeEnv) + if ( iUseCoeEnv ) { // Initialize the progress note dialog, it's values, // and execute it - resFileName=DRM::CFileNameContainer::NewLC(); #ifndef RD_MULTIPLE_DRIVE - resFileName->iBuffer.Copy( KDriveZ ); + resFileName.Copy( KDriveZ ); #else //RD_MULTIPLE_DRIVE - TInt driveNumber(-1); - TChar driveLetter; - DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRom, driveNumber); - iCoeEnv->FsSession().DriveToChar(driveNumber, driveLetter); + TInt driveNumber( -1 ); + TChar driveLetter; + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); - resFileName->iBuffer.Format(KRomDriveFormatter, (TUint) driveLetter); + iCoeEnv->FsSession().DriveToChar( driveNumber, driveLetter ); + + resFileName.Format( KRomDriveFormatter, (TUint)driveLetter ); #endif - resFileName->iBuffer.Append(KDC_RESOURCE_FILES_DIR); - resFileName->iBuffer.Append(KCDrmUtilityDmgrWrapperResFileName); - RConeResourceLoader loader(*iCoeEnv); - loader.OpenL(resFileName->iBuffer); - CleanupStack::PopAndDestroy( resFileName ); - resFileName=NULL; + resFileName.Append( KDC_RESOURCE_FILES_DIR ); + resFileName.Append( KCDrmUtilityDmgrWrapperResFileName ); + RConeResourceLoader loader( *iCoeEnv ); + loader.OpenL( resFileName ); iProgressNoteDialog = new (ELeave) CAknProgressDialog( - reinterpret_cast (&iProgressNoteDialog)); - iProgressNoteDialog->PrepareLC(R_SILENT_PROGRESS_NOTE); - iProgressNoteDialog->SetCallback(this); + reinterpret_cast< CEikDialog** >( &iProgressNoteDialog ) ); + iProgressNoteDialog->PrepareLC( R_SILENT_PROGRESS_NOTE ); + iProgressNoteDialog->SetCallback( this ); iProgressInfo = iProgressNoteDialog->GetProgressInfoL(); - iProgressInfo->SetFinalValue(KProgressInfoFinalValue); + iProgressInfo->SetFinalValue( KProgressInfoFinalValue ); iDialogDismissed = EFalse; iProgressNoteDialog->RunLD(); @@ -750,6 +673,7 @@ } + // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::RemoveProgressNoteL // --------------------------------------------------------------------------- @@ -757,7 +681,7 @@ void CDrmUtilityDmgrWrapper::RemoveProgressNoteL() { - if (iUseCoeEnv) + if ( iUseCoeEnv ) { if (iProgressNoteDialog && !iDialogDismissed) { @@ -765,22 +689,22 @@ TRAPD(err, iProgressNoteDialog->ProcessFinishedL()); if (err != KErrNone) { - iProgressNoteDialog->SetCallback(NULL); delete iProgressNoteDialog; - iDialogDismissed = ETrue; } iProgressNoteDialog = NULL; } } + } + // --------------------------------------------------------------------------- // From class MAknProgressDialogCallback // // CDrmUtilityDmgrWrapper::DialogDismissedL // --------------------------------------------------------------------------- // -void CDrmUtilityDmgrWrapper::DialogDismissedL(TInt aButtonId ) +void CDrmUtilityDmgrWrapper::DialogDismissedL( TInt /*aButtonId*/ ) { iDialogDismissed = ETrue; @@ -788,194 +712,14 @@ iProgressNoteDialog = NULL; iProgressInfo = NULL; - if (IsActive() && aButtonId == EAknSoftkeyCancel) - { - if ((iState == EGetMeteringTrigger || iState == EGetPrUrlTrigger)) - { - Cancel(); - } - else - { - TRequestStatus* status(&iStatus); - User::RequestComplete(status, KErrCancel); - } - } - //For avoiding active object deadlock - iDlMgr->removeAll(); - - } - -// RoapObserver methods - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::PostResponseUrlL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::PostResponseUrlL(const TDesC8& aPostResponseUrl) - { - UpdateBufferL (iTriggerUrl, aPostResponseUrl); - - if (iUseCoeEnv && iProgressInfo) - { - iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium); - } - } - -// Trivial RoapObserver methods -TBool CDrmUtilityDmgrWrapper::ConnectionConfL() - { - return ETrue; - } - -TBool CDrmUtilityDmgrWrapper::ContactRiConfL() - { - return ETrue; - } - -TBool CDrmUtilityDmgrWrapper::TransIdConfL() - { - return EFalse; - } - -void CDrmUtilityDmgrWrapper::RightsObjectDetailsL(const RPointerArray< - CDRMRights>& /*aRightsList*/) - { - // do nothing - } - -void CDrmUtilityDmgrWrapper::ContentDownloadInfoL(TPath& /*aTempFolder*/, - TFileName& /*aContentName*/, TInt& aMaxSize) - { - aMaxSize = -1; - } - -void CDrmUtilityDmgrWrapper::ContentDetailsL(const TDesC& /*aPath*/, - const TDesC8& /*aType*/, const TUid& /*aAppUid*/) - { - } - -void CDrmUtilityDmgrWrapper::RoapProgressInfoL(const TInt /*aProgressInfo*/) - { - // do nothing - } - -void CDrmUtilityDmgrWrapper::ErrorUrlL(const TDesC8& aErrorUrl) - { - UpdateBufferL (iErrorUrl, aErrorUrl); - } - -// CActive methods - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::DoCancel -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::DoCancel() - { - delete iRoapEng; - iRoapEng = NULL; - iConnection->Close(); - if (iWait.IsStarted()) - { - iWait.AsyncStop(); - } - } - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::RunL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::RunL() - { - TInt error(iStatus.Int()); - - ClearIfNotRoapTemporaryError(error, iErrorUrl); - User::LeaveIfError(error); - switch (iState) - { - case EInit: - { - if (!iProgressNoteDialog) - { - ShowProgressNoteL(); - } - DoConnectL(EGetMeteringTrigger); - } - break; - case EGetMeteringTrigger: - { - DoDownloadRoapTriggerL(ESaveMeteringTrigger); - } - break; - case ESaveMeteringTrigger: - { - DoSaveRoapTriggerL(EMeteringReportSubmit); - } - break; - - case EMeteringReportSubmit: - { - DoHandleRoapTriggerL(EGetPrUrlTrigger); - } - break; - case EGetPrUrlTrigger: - { - delete iRoapEng; - iRoapEng = NULL; - DoDownloadRoapTriggerL(ESavePrUrlTrigger); - } - break; - case ESavePrUrlTrigger: - { - DoSaveRoapTriggerL(EPrRoapRequest); - } - break; - case EPrRoapRequest: - { - DoHandleRoapTriggerL(EComplete); - } - break; - case EComplete: - { - RemoveProgressNoteL(); - delete iRoapEng; - iRoapEng = NULL; - iWait.AsyncStop(); - } - break; - - default: - User::Leave(KErrNotSupported); - } - } - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::RunError -// --------------------------------------------------------------------------- -// -TInt CDrmUtilityDmgrWrapper::RunError(TInt /* aError */) - { - delete iRoapEng; - iRoapEng = NULL; - iConnection->Close(); - if (iWait.IsStarted()) + if( iWait.IsStarted() ) { iWait.AsyncStop(); } - if (iUseCoeEnv) - { - if (iProgressNoteDialog && !iDialogDismissed) - { - iProgressNoteDialog->SetCallback(NULL); - delete iProgressNoteDialog; - iDialogDismissed = ETrue; - } - iProgressNoteDialog = NULL; - } - return KErrNone; } + // ======== GLOBAL FUNCTIONS ======== //------------------------------------------------------------------------------ @@ -986,7 +730,7 @@ { CDrmUtilityDmgrWrapper* launcher = NULL; TRAPD( err, launcher = CDrmUtilityDmgrWrapper::NewL() ); - if (err != KErrNone) + if( err != KErrNone ) { return NULL; } diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/src/DrmUtilityGlobalNoteWrapper.cpp --- a/commondrm/drmutility/src/DrmUtilityGlobalNoteWrapper.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/src/DrmUtilityGlobalNoteWrapper.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include // EAknSoftkeyNo #include @@ -89,6 +90,7 @@ DRM::CDrmUtilityGlobalNoteWrapper::~CDrmUtilityGlobalNoteWrapper() { Cancel(); // Cancel active object + delete iGlobalMsgQuery; } // ----------------------------------------------------------------------------- @@ -182,6 +184,32 @@ } // ----------------------------------------------------------------------------- +// CDrmUtilityGlobalNoteWrapper::ShowNoteL +// ----------------------------------------------------------------------------- +// +void DRM::CDrmUtilityGlobalNoteWrapper::ShowMessageQueryL( + TInt aMessageResourceId, + TInt aHeaderResourceId, + const TDesC& aString) + { + TBuf messageBuffer( + iResourceReader->ReadResourceString( aMessageResourceId ) ); + + StringLoader::Format( iFinalMessageBuffer, messageBuffer, -1, aString ); + + iHeaderBuffer = iResourceReader->ReadResourceString( aHeaderResourceId ); + + CAknGlobalMsgQuery* iGlobalMsgQuery = CAknGlobalMsgQuery::NewL(); + + iStatus = KRequestPending; + iGlobalMsgQuery->ShowMsgQueryL(iStatus, iFinalMessageBuffer, + R_AVKON_SOFTKEYS_OK_EMPTY, iHeaderBuffer, KNullDesC); + + SetActive(); + iWait.Start(); + } + +// ----------------------------------------------------------------------------- // CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL // ----------------------------------------------------------------------------- // @@ -305,6 +333,10 @@ void DRM::CDrmUtilityGlobalNoteWrapper::RunL() { iWait.AsyncStop(); + if(iGlobalMsgQuery) + { + iGlobalMsgQuery->CancelMsgQuery(); + } } // ----------------------------------------------------------------------------- diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/src/drmutilityconnection.cpp --- a/commondrm/drmutility/src/drmutilityconnection.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,562 +0,0 @@ -/* - * 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: Connection manager for DRM - * - */ - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include // CCmApplicationSettingsUi -#include -#include // IAP, COMMDB_ID -#include "drmutilityconnection.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "drmutilityconnectionTraces.h" -#endif - -// ================= MEMBER FUNCTIONS ======================= - - -// ----------------------------------------------------------------------------- -// HasDefaultConnectionL -// Finds default IAP id -// @return Etrue: valid AP found -// EFalse: valid AP not found -// @leave system wide error codes -// ----------------------------------------------------------------------------- -// -TBool DRM::CDrmUtilityConnection::HasDefaultConnectionL() - { - TBool hasDefault(EFalse); - TCmDefConnValue defConn; - RCmManager cmManager; - cmManager.OpenLC(); - cmManager.ReadDefConnL(defConn); - if (defConn.iType == ECmDefConnConnectionMethod) - { - cmManager.GetConnectionMethodInfoIntL(defConn.iId, - CMManager::ECmIapId); - hasDefault = ETrue; - } - else if (defConn.iType == ECmDefConnDestination) - { - RCmDestination dest(cmManager.DestinationL(defConn.iId)); - CleanupClosePushL(dest); - - if (dest.ConnectionMethodCount() <= 0) - { - User::Leave(KErrNotFound); - } - - RCmConnectionMethod cMeth(dest.ConnectionMethodL(0)); - CleanupClosePushL(cMeth); - - cMeth.GetIntAttributeL(CMManager::ECmIapId); - CleanupStack::PopAndDestroy(&cMeth); - CleanupStack::PopAndDestroy(&dest); - hasDefault = ETrue; - } - CleanupStack::PopAndDestroy(&cmManager); - return hasDefault; - } - -// ----------------------------------------------------------------------------- -// CDrmUtilityConnection::HasAccessPointsL -// ----------------------------------------------------------------------------- -// -TBool DRM::CDrmUtilityConnection::HasAccessPointsL() - { - TInt apCount(0); - RCmManager cmManager; - CleanupClosePushL(cmManager); - cmManager.OpenL(); - RArray aps; - CleanupClosePushL(aps); - cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue); - apCount = aps.Count(); - CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager - return apCount > 0; - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::NewLC -// --------------------------------------------------------------------------- -// -DRM::CDrmUtilityConnection* DRM::CDrmUtilityConnection::NewLC( - const TBool aAllowQueries) - { - CDrmUtilityConnection* conn = new (ELeave) CDrmUtilityConnection( - aAllowQueries); - CleanupStack::PushL(conn); - conn->ConstructL(); - return conn; - } -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::NewL -// --------------------------------------------------------------------------- -// -DRM::CDrmUtilityConnection* DRM::CDrmUtilityConnection::NewL( - const TBool aAllowQueries) - { - CDrmUtilityConnection* conn = CDrmUtilityConnection::NewLC(aAllowQueries); - CleanupStack::Pop(conn); - return conn; - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::~CDrmUtilityConnection -// --------------------------------------------------------------------------- -// -DRM::CDrmUtilityConnection::~CDrmUtilityConnection() - { - Cancel(); - iConnection.Close(); - iSocketServ.Close(); - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::ConnectL -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::ConnectL(TRequestStatus* aStatus) - { - TInt error(KErrGeneral); - iStatus = KRequestPending; - - if (iState == EInit) - { - - // Make this part atomic by pushing closes on the stack. - error = iSocketServ.Connect(); - if (!error) - { - error = iConnection.Open(iSocketServ); - } - } - - if (iState == EConnected) - { - error=iConnection.Stop(); - //error=iConnection.Stop(RConnection::EStopAuthoritative); //just in case still does not work - // if autoriative stop does not work then must do something following follow - // TNifProgressBuf iJalla; - // loop iConnection.ProgressNotification(iJalla,iStatus,KConnProgressDefault); SetActive - // at RunL if (iJalla.iStage < KConnectionDown) - // reactiveteWaitClose(); - //iConnection.ProgressNotification(iJalla,iStatus,(KConnectionDown); (should loop till state KConnectionDown seen) - iConnection.Close(); - iState = EInit; - error = KErrNone; - error = iConnection.Open(iSocketServ); - } - - iParentStatus = aStatus; - *iParentStatus = KRequestPending; - - CompleteSelf(error); - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::HasMoreConnectionAttempts -// --------------------------------------------------------------------------- -// -TBool DRM::CDrmUtilityConnection::HasMoreConnectionAttempts() - { - TBool ret(EFalse); - switch (iType) - { - case EUsingPurposeInternet: - if (iAllowQueries) - { - ret = ETrue; - } - else - { - ret = EFalse; - } - break; - case EUsingQuery: - case EFail: - ret = EFalse; - break; - default: - ret = ETrue; - } - return ret; - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::IsConnected -// --------------------------------------------------------------------------- -// -TBool DRM::CDrmUtilityConnection::IsConnected(TUint32& aIap) - { - TBool ret(EFalse); - - if (iState == EConnected) - { - aIap = iIapId; - ret = ETrue; - } - return ret; - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::Close -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::Close() - { - //LOGLIT( "CDrmUtilityConnection::Close" ) - - Cancel(); - iConnection.Close(); - iSocketServ.Close(); - iState = EInit; - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection:CDrmUtilityConnection: -// --------------------------------------------------------------------------- -// -DRM::CDrmUtilityConnection::CDrmUtilityConnection(const TBool aAllowQueries) : - CActive(CActive::EPriorityStandard), iState(EInit), - iType(EAttachExisting), iAllowQueries(aAllowQueries) - { - CActiveScheduler::Add(this); - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::ConstructL -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::ConstructL() - { - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::DoCancel -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::DoCancel() - { - iConnection.Close(); - iSocketServ.Close(); - CompleteParent(KErrCancel); - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::RunL -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::RunL() - { - TInt error(iStatus.Int()); - if (iState == EInit) - { - User::LeaveIfError(error); // Handle errors in RunError(). - if (iType == EAttachExisting) - { - AttachExistingConnectionL(); - } - else - { - iState = EConnecting; - error = KErrNotFound; - CompleteSelf(error); - } - } - else if (iState == EConnecting) - { - if (!error) - { - iState = EConnected; - CompleteSelf(error); - } - else if (error != KErrNotFound) - { - User::LeaveIfError(error); - } - else - { - switch (iType) - { - case EAttachExisting: - iType = EUsingDefault; - ConnectUsingDefaultL(); - break; - case EUsingDefault: - iType = EUsingPurposeOperator; - ConnectUsingSnapPurposeL(CMManager::ESnapPurposeOperator); - break; - case EUsingPurposeOperator: - iType = EUsingPurposeInternet; - ConnectUsingSnapPurposeL(CMManager::ESnapPurposeInternet); - break; - case EUsingPurposeInternet: - iType = EUsingQuery; - if (iAllowQueries) - { - ConnectUsingQueryL(); - break; - } - case EUsingQuery: - iType = EFail; - case EFail: - default: - User::Leave(KErrCouldNotConnect); - break; - } - } - } - else if (iState == EConnected) - { - UpdateIapIdL(); - CompleteParent(iStatus.Int()); - } - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::RunError -// --------------------------------------------------------------------------- -// -TInt DRM::CDrmUtilityConnection::RunError(TInt aError) - { - //LOGLIT( "CDrmUtilityConnection::RunError" ) - - iConnection.Close(); - iSocketServ.Close(); - - CompleteParent(aError); - iState = EInit; - return KErrNone; - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::AttachExistingConnectionL -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::AttachExistingConnectionL() - { - TConnectionInfoBuf connInfo; - TUint count(0); - TInt error(KErrNotFound); - iStatus = KRequestPending; - - User::LeaveIfError(iConnection.EnumerateConnections(count)); - if (count) - { - // Select AP with largest index. (Latest created) - User::LeaveIfError(iConnection.GetConnectionInfo(count, connInfo)); - User::LeaveIfError(iConnection.Attach(connInfo, - RConnection::EAttachTypeNormal)); - iState = EConnected; - error = KErrNone; - } - else - { - iState = EConnecting; - } - CompleteSelf(error); - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::ConnectUsingDefaultL -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::ConnectUsingDefaultL() - { - // Create overrides - TConnPrefList prefList; - TExtendedConnPref prefs; - - if (!iAllowQueries) - { - prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); - } - else - { - prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnDisableQueries); - } - - //Fetch default connection - TBool hasDefault(ETrue); - TCmDefConnValue defConn; - RCmManager cmManager; - cmManager.OpenLC(); - cmManager.ReadDefConnL(defConn); - if (defConn.iType == ECmDefConnConnectionMethod) - { - prefs.SetIapId(defConn.iId); - } - else if (defConn.iType == ECmDefConnDestination) - { - prefs.SetSnapId(defConn.iId); - } - else - { - hasDefault = EFalse; - } - // End of fetch default connection - CleanupStack::PopAndDestroy(&cmManager); - if (hasDefault) - { - prefList.AppendL(&prefs); - - // Start an Outgoing Connection with overrides - iState = EConnecting; - iConnection.Start(prefList, iStatus); - SetActive(); - } - else - { - // No default found --> next iteration needed - CompleteSelf(KErrNotFound); - } - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::ConnectUsingSnapOperatorL -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::ConnectUsingSnapPurposeL( - const TUint32 aPurpose) - { - // Create overrides - TConnPrefList prefList; - TExtendedConnPref prefs; - prefs.SetSnapPurpose(static_cast (aPurpose)); - if (aPurpose != CMManager::ESnapPurposeUnknown) - { - if (!iAllowQueries) - { - prefs.SetNoteBehaviour( - TExtendedConnPref::ENoteBehaviourConnSilent); - } - else - { - prefs.SetNoteBehaviour( - TExtendedConnPref::ENoteBehaviourConnDisableQueries); - } - } - else - { - prefs.SetConnSelectionDialog(ETrue); - prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); - prefs.SetForcedRoaming(EFalse); - prefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerUnknown); - } - prefList.AppendL(&prefs); - iState = EConnecting; - - // Start an Outgoing Connection with overrides - iConnection.Start(prefList, iStatus); - SetActive(); - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::ConnectUsingQueryL -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::ConnectUsingQueryL() - { - // Create overrides - TConnPrefList prefList; - TExtendedConnPref prefs; - - CCmApplicationSettingsUi* ui(CCmApplicationSettingsUi::NewLC()); - TCmSettingSelection selectedConn; - - TBool selected(ui->RunApplicationSettingsL(selectedConn)); - CleanupStack::PopAndDestroy(ui); - ui=NULL; - if (selected) - { - if (selectedConn.iResult == CMManager::EConnectionMethod) - { - prefs.SetIapId(selectedConn.iId); - } - else if (selectedConn.iResult == CMManager::EDestination) - { - prefs.SetSnapId(selectedConn.iId); - } - else if (selectedConn.iResult != CMManager::EDefaultConnection) - { - selected=EFalse; - } - } - if (selected) - { - if (selectedConn.iResult != CMManager::EDefaultConnection) - { - prefList.AppendL(&prefs); - // For ensuring possibly stale connections get disconnected first; - iConnection.Close(); - iConnection.Open(iSocketServ); - - iConnection.Start(prefList, iStatus); - } - else - { - iConnection.Start(iStatus); - } - SetActive(); - } - else - { - CompleteSelf(KErrCancel); - } - } -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::CompleteSelf -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::CompleteSelf(TInt aError) - { - TRequestStatus* status(&iStatus); - User::RequestComplete(status, aError); - SetActive(); - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::CompleteParent -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::CompleteParent(TInt aError) - { - if (iParentStatus) - { - User::RequestComplete(iParentStatus, aError); - iParentStatus = NULL; - } - } - -// --------------------------------------------------------------------------- -// DRM::CDrmUtilityConnection::UpdateIapId -// --------------------------------------------------------------------------- -// -void DRM::CDrmUtilityConnection::UpdateIapIdL() - { - TBuf<16> query; - - query.Format(_L("%s\\%s"), IAP, COMMDB_ID); - User::LeaveIfError(iConnection.GetIntSetting(query, iIapId)); - - } diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/src/drmutilityui.cpp --- a/commondrm/drmutility/src/drmutilityui.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/src/drmutilityui.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -32,6 +32,7 @@ #include #include #include +#include // secondary display support #include @@ -58,9 +59,6 @@ #include "DrmUtilityGlobalNoteWrapper.h" #include "DrmUtilityInfoNoteWrapper.h" -#include "drmuidialogids.h" -#include "drmuidialogs.h" - // CONSTANTS #ifndef RD_MULTIPLE_DRIVE _LIT( KDriveZ, "z:" ); @@ -77,7 +75,6 @@ const TInt KDRMUtilityMaxTimeFormatLen( 30 ); const TInt KDRMUtilityMaxTimeLen( 30 ); const TInt KDRMUtilityNoteMaxSize ( 256 ); -const TInt KNoValue = -1; #ifdef _DEBUG // debug panic @@ -235,6 +232,8 @@ iNoteList.Close(); FeatureManager::UnInitializeLib(); + delete iNoteWrapper; + } // ----------------------------------------------------------------------------- @@ -317,12 +316,38 @@ TInt aTextResourceId, TInt aValue ) { - TInt resultCode( ECancelled ); + 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 ); - CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); - resultCode = drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, aValue ); - CleanupStack::PopAndDestroy( drmUiDialog ); - return resultCode; + 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; } // ----------------------------------------------------------------------------- @@ -333,12 +358,39 @@ TInt aTextResourceId, const TDesC& aString ) { - TInt resultCode( ECancelled ); + 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 ); - CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); - resultCode = drmUiDialog->ShowNoteL( aTextResourceId, aString, KNoValue ); - CleanupStack::PopAndDestroy( drmUiDialog ); - return resultCode; + 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; } // ----------------------------------------------------------------------------- @@ -436,7 +488,7 @@ __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, KDRMUtilityDebugPanicCode ) ); - TInt buttonCode( EOk ); + TInt buttonCode( 1 ); if ( aConstraint->iActiveConstraints & EConstraintEndTime ) { @@ -457,14 +509,13 @@ } endTime.FormatL( endDate, dateFormat ); - - // Qt dialog not implmented yet. - buttonCode = DisplayQueryL( EQueryLicenceValidUntil, endDate ); + buttonCode = DisplayQueryL(R_DRM_QUERY_SET_AUTOMATED, endDate ); } else if ( aConstraint->iActiveConstraints & EConstraintInterval ) { - // Qt dialog not implemented yet. - buttonCode = DisplayQueryL( EQueryValidForLimitedTime, KNoValue ); + buttonCode = DisplayQueryWithIdL( R_DRM_QUERY_SET_AUTO_INTERVAL, + R_DRMUTILITY_CONFIRMATION_QUERY ); + } return buttonCode; } @@ -508,8 +559,7 @@ startDateBuf.Append( startTimeBuf ); // display note with start date - // Qt dialog not implemented yet - DisplayNoteL( EConfUnableToUse, startDateBuf ); + DisplayNoteL( R_DRMUTILITY_USAGE_RIGHTS_IN_FUTURE, startDateBuf ); } // ----------------------------------------------------------------------------- @@ -518,9 +568,20 @@ // EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( TInt aTextResourceId ) { - CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); - drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, KNoValue ); - CleanupStack::PopAndDestroy( drmUiDialog ); + if ( iCoeEnv ) + { + HBufC* msgText( StringLoader::LoadLC( aTextResourceId, iCoeEnv ) ); + DisplayNoteL( *msgText, aTextResourceId ); + CleanupStack::PopAndDestroy( msgText ); + } + + else + { + TBuf buffer( + iUtilityStringResourceReader->ReadResourceString( aTextResourceId ) ); + + DisplayNoteL( buffer, aTextResourceId ); + } } // ----------------------------------------------------------------------------- @@ -531,9 +592,26 @@ TInt aTextResourceId, const TDesC& aString ) { - CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); - drmUiDialog->ShowNoteL( aTextResourceId, aString, KNoValue ); - CleanupStack::PopAndDestroy( drmUiDialog ); + 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 ); + } } // ----------------------------------------------------------------------------- @@ -544,9 +622,26 @@ TInt aTextResourceId, TInt aValue ) { - CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); - drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, aValue ); - CleanupStack::PopAndDestroy( drmUiDialog ); + 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 ); + } } // ----------------------------------------------------------------------------- @@ -677,6 +772,39 @@ #endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO +EXPORT_C TInt DRM::CDrmUtilityUI::DisplayMessageQueryL( TInt aMessage, TInt aHeader, const TDesC& aString) + { + TInt buttonCode = 0; + if ( iCoeEnv ) + { + CAknMessageQueryDialog* messageQuery = new (ELeave) CAknMessageQueryDialog(); + messageQuery->PrepareLC(R_DRMUTILITY_SYNC_DIALOG); + + HBufC* headerStringholder ( StringLoader::LoadLC( aHeader, iCoeEnv ) ); + + messageQuery->QueryHeading()->SetTextL(*headerStringholder); + CleanupStack::PopAndDestroy(); // headerStringholder + + HBufC* messageStringholder ( StringLoader::LoadLC( aMessage, aString, iCoeEnv ) ); + + messageQuery->SetMessageTextL(*messageStringholder); + CleanupStack::PopAndDestroy(); // messageStringholder + + buttonCode = messageQuery->RunLD(); + } + else + { + if(!iNoteWrapper) + { + iNoteWrapper = DRM::CDrmUtilityGlobalNoteWrapper::NewL( iUtilityStringResourceReader ); + } + + iNoteWrapper->ShowMessageQueryL(aMessage, aHeader, aString); + } + return buttonCode; + } + + // ----------------------------------------------------------------------------- // CDrmUtilityUI::CreateNoteForResourceL // ----------------------------------------------------------------------------- diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp --- a/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -31,12 +31,18 @@ #include // access point utils - +#include #include #include #include #include #include +#ifdef __SERIES60_NATIVE_BROWSER +#include +#endif + +#include +#include #include // for WMDRM file details view #include @@ -55,12 +61,19 @@ #include "drmutilitywmdrmutilities.h" #include "wmdrmdlawrapper.h" -#include "drmuidialogids.h" + +using namespace DRM; // CONSTANTS const TInt KMaxUrlLength( 1024 ); const TInt KMaxUrlSanityLength( 102400 ); +#ifndef __SERIES60_NATIVE_BROWSER +const TUid KCRUidBrowser = {0x10008D39}; +const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; +const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; +#endif + #ifdef _DEBUG // debug panic _LIT( KWmDrmWrapperDebugPanicMessage, "WmDrmWrapperDebugPanic" ); @@ -77,7 +90,8 @@ // DRM::CDrmUtilityWMDrmWrapper::CDrmUtilityWMDrmWrapper() : iCoeEnv( NULL ), - iDrmUtilityUi( NULL ) + iDrmUtilityUi( NULL ), + iWmDrmDlaSupportOn ( ETrue ) { } @@ -89,6 +103,8 @@ void DRM::CDrmUtilityWMDrmWrapper::ConstructL() { User::LeaveIfError( iFs.Connect() ); + TUid u = TUid::Uid( KFeatureIdFfWmdrmDlaSupport ); + TRAPD(err, iWmDrmDlaSupportOn = CFeatureDiscovery::IsFeatureSupportedL( u )); } // ----------------------------------------------------------------------------- @@ -260,7 +276,7 @@ if ( !value ) { - ShowNoRightsNoteL( aContent, reason, aOperationId, aObserver ); + ShowNoRightsNoteL( aContent, reason ); User::LeaveIfError( aContent.GetAttribute( ContentAccess::ECanPlay, value ) ); if ( value ) { @@ -484,7 +500,7 @@ { case DRM::EUHCheckRightsActionDefault: { - ShowNoRightsNoteL( aContent, aReason, aOperationId, aObserver ); + ShowNoRightsNoteL( aContent, aReason ); } break; @@ -542,15 +558,12 @@ // void DRM::CDrmUtilityWMDrmWrapper::ShowNoRightsNoteL( ContentAccess::CData& aContent, - TUint32 /*aReason*/, - TInt aOperationId, - DRM::MDrmHandleErrorObserver* aObserver ) + TUint32 /*aReason*/ ) { - TInt value; TRAPD( err, LoadDlaWrapperL() ); if ( !err ) { - TInt ret( EOk ); + TInt ret( EAknSoftkeyYes ); RFile file; GetRFileFromCDataL( aContent, file ); CleanupClosePushL( file ); @@ -564,21 +577,18 @@ } TFileName fileName; User::LeaveIfError( aContent.GetStringAttribute( DRM::EDrmFileName, fileName ) ); - // Qt dialog not implemented yet - ret = iDrmUtilityUi->DisplayQueryL( EQueryFileWithNoRightsObj, fileName ); + if(iWmDrmDlaSupportOn) + { + ret = iDrmUtilityUi->DisplayQueryL( R_DRM_QUERY_EXPIRED_OR_NO_RO, fileName ); + } + else + { + ret = iDrmUtilityUi->DisplayMessageQueryL( R_DRMUTILITY_SYNC_WITH_PC, R_DRMUTILITY_HEAD_NO_LICENSE, fileName); + } } - - if ( !err && ret == EOk ) + if ( !err && ( ret == EAknSoftkeyYes || ret == EAknSoftkeyOk ) && iWmDrmDlaSupportOn) { TRAP_IGNORE( DlaLicenseAcquisitionL( file ) ); - - // Ask the rights from CAF, same call for both ECanPlay and ECanView - aContent.GetAttribute( ContentAccess::ECanPlay, value ); - // call given HandleErrorObserver - if( value > 0 ) - { - aObserver->RightsAvailable( aOperationId, KErrNone ); - } } CleanupStack::PopAndDestroy( &file ); } @@ -588,7 +598,7 @@ { iDrmUtilityUi = DRM::CDrmUtilityUI::NewL( iCoeEnv ); } - iDrmUtilityUi->DisplayNoteL( EConfLicenceExpired ); + iDrmUtilityUi->DisplayNoteL( R_DRM_INFO_EXPIRED_OR_NO_RO ); } } @@ -767,18 +777,31 @@ void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL( RFile& aFile ) { - TInt iapId( 0 ); - HBufC* contentUrl( NULL ); - HBufC* htmlData( NULL ); - LoadDlaWrapperL(); - TRAPD( err, iapId = DefaultAccessPointL() ); - if ( !err ) + if( iWmDrmDlaSupportOn ) { - iDlaWrapper->SetIapId( iapId ); + TInt iapId( 0 ); + HBufC* contentUrl( NULL ); + HBufC* htmlData( NULL ); + LoadDlaWrapperL(); + TRAPD( err, iapId = DefaultAccessPointL() ); + if ( !err ) + { + iDlaWrapper->SetIapId( iapId ); + } + iDlaWrapper->AcquireLicenseL( aFile, contentUrl, htmlData ); + delete contentUrl; + delete htmlData; } - iDlaWrapper->AcquireLicenseL( aFile, contentUrl, htmlData ); - delete contentUrl; - delete htmlData; + else + { + if ( !iDrmUtilityUi ) + { + iDrmUtilityUi = DRM::CDrmUtilityUI::NewL( iCoeEnv ); + } + TFileName aFileName; + TInt err = aFile.Name(aFileName); + iDrmUtilityUi->DisplayNoteL( R_DRMUTILITY_SYNC_WITH_PC , aFileName); + } } // ----------------------------------------------------------------------------- @@ -801,38 +824,56 @@ // TInt DRM::CDrmUtilityWMDrmWrapper::DefaultAccessPointL() { - //Fetch default connection + const TInt KDestinationSelectionMode( 2 ); + CRepository* repository( NULL ); + TInt ap( 0 ); + TInt alwaysAsk( 0 ); TUint32 iapd32( 0 ); - TCmDefConnValue defConn; - RCmManager cmManager; - cmManager.OpenLC(); - cmManager.ReadDefConnL(defConn); - if (defConn.iType == ECmDefConnConnectionMethod) - { - iapd32=defConn.iId; - } - else if (defConn.iType == ECmDefConnDestination) + TInt defaultSnap( 0 ); + + repository = CRepository::NewL( KCRUidBrowser ); + CleanupStack::PushL( repository ); + repository->Get( KBrowserDefaultAccessPoint, ap ); + repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); + repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); + CleanupStack::PopAndDestroy( repository ); + + if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) { - RCmDestination dest( cmManager.DestinationL( defConn.iId ) ); - CleanupClosePushL( dest ); - - if ( dest.ConnectionMethodCount() <= 0 ) - { - User::Leave( KErrNotFound ); - } - - RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); - CleanupClosePushL( cMeth ); - - iapd32 = cMeth.GetIntAttributeL( CMManager::ECmIapId ); - CleanupStack::PopAndDestroy( 2, &dest ); //cMeth, dest + alwaysAsk = ETrue; } else { + RCmManager cmManager; + cmManager.OpenLC(); + if ( !alwaysAsk ) + { + iapd32 = + cmManager.GetConnectionMethodInfoIntL( ap, + CMManager::ECmIapId ); + } + else if ( alwaysAsk == KDestinationSelectionMode ) + { + RCmDestination dest( cmManager.DestinationL( defaultSnap ) ); + CleanupClosePushL( dest ); + + if ( dest.ConnectionMethodCount() <= 0 ) + { + User::Leave( KErrNotFound ); + } + + RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); + CleanupClosePushL( cMeth ); + + iapd32 = cMeth.GetIntAttributeL( CMManager::ECmIapId ); + CleanupStack::PopAndDestroy( 2, &dest ); //cMeth, dest + } + CleanupStack::PopAndDestroy( &cmManager ); + } + if ( alwaysAsk && alwaysAsk != KDestinationSelectionMode ) + { User::Leave( KErrAccessDenied ); } - CleanupStack::PopAndDestroy(&cmManager); - // End of fetch default connection return iapd32; } diff -r 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/src/qdrmutilitydmgreventhandler.cpp --- a/commondrm/drmutility/src/qdrmutilitydmgreventhandler.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ - -#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 1221b68b8a5f -r 1481bf457703 commondrm/drmutility/traces/OstTraceDefinitions.h --- a/commondrm/drmutility/traces/OstTraceDefinitions.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -#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 -#endif diff -r 1221b68b8a5f -r 1481bf457703 commondrm/group/bld.inf --- a/commondrm/group/bld.inf Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/group/bld.inf Wed Sep 01 12:21:16 2010 +0100 @@ -39,20 +39,24 @@ ../rom/DRMEncryptorResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( drmencryptorresources.iby ) ../rom/DRMRightsManagerUI.iby CORE_MW_LAYER_IBY_EXPORT_PATH( drmrightsmanagerui.iby ) ../rom/DRMRightsManagerUIResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( drmrightsmanageruiresources.iby ) +../rom/drmsettingsplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH( drmsettingsplugin.iby ) +../rom/drmsettingspluginresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( drmsettingspluginresources.iby ) ../rom/drmutility.iby CORE_MW_LAYER_IBY_EXPORT_PATH( drmutility.iby ) ../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 + +// DRMSettingsPlugin +../drmsettingsplugin/group/drmsettingsplugin.mmp + // DRMRightsManagerUi ../drmrightsmanagerui/group/DRMRightsManager.mmp -// drmui -#include "../drmui/group/bld.inf" - // drmutility #include "../drmutility/group/bld.inf" @@ -73,6 +77,19 @@ 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 1221b68b8a5f -r 1481bf457703 commondrm/rom/DRMEncryptor.iby --- a/commondrm/rom/DRMEncryptor.iby Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/rom/DRMEncryptor.iby Wed Sep 01 12:21:16 2010 +0100 @@ -23,7 +23,15 @@ #ifndef _IMAGE_TYPE_PRD S60_APP_EXE(DRMENCRYPTOR) -data = ZPRIVATE\10003a3f\import\APPS\drmencryptor_reg.rsc PRIVATE\10003a3f\import\apps\drmencryptor_reg.rsc + + +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,DRMEncryptor) + + +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 1221b68b8a5f -r 1481bf457703 commondrm/rom/DRMRightsManagerUI.iby --- a/commondrm/rom/DRMRightsManagerUI.iby Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/rom/DRMRightsManagerUI.iby Wed Sep 01 12:21:16 2010 +0100 @@ -21,7 +21,7 @@ // DRM Rights Manager Application -#ifdef __DRM_FULL +#if ( (defined __DRM_FULL) || (defined __WINDOWS_MEDIA_DRM) ) S60_APP_EXE(DRMRightsManager) S60_APP_BITMAP(DRMRightsManager) @@ -30,7 +30,7 @@ data=\epoc32\data\z\private\10003a3f\apps\DRMRightsManager_reg.rsc \private\10003a3f\import\apps\DRMRightsManager_reg.rsc data=ZSYSTEM\install\DRMRightsManager_stub.SIS \system\install\DRMRightsManager_stub.SIS -#endif // __DRM_FULL +#endif // __DRM_FULL || __WINDOWS_MEDIA_DRM #endif // __DRMRIGHTSMANAGERUI_IBY__ diff -r 1221b68b8a5f -r 1481bf457703 commondrm/rom/DRMRightsManagerUIResources.iby --- a/commondrm/rom/DRMRightsManagerUIResources.iby Tue Aug 31 15:29:38 2010 +0300 +++ b/commondrm/rom/DRMRightsManagerUIResources.iby Wed Sep 01 12:21:16 2010 +0100 @@ -20,11 +20,11 @@ #define __DRMRIGHTSMANAGERUIRESOURCES_IBY__ -#ifdef __DRM_FULL +#if ( (defined __DRM_FULL) || (defined __WINDOWS_MEDIA_DRM) ) S60_APP_RESOURCE(DRMRightsManager) -#endif // __DRM_FULL +#endif // __DRM_FULL || __WINDOWS_MEDIA_DRM #endif // __DRMRIGHTSMANAGERUIRESOURCES_IBY__ diff -r 1221b68b8a5f -r 1481bf457703 commondrm/rom/drmbrowserlauncher.iby --- a/commondrm/rom/drmbrowserlauncher.iby Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 commondrm/rom/drmsettingsplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/rom/drmsettingsplugin.iby Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006-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: DRMSettingsPlugin ROM resources +* +*/ + +#ifndef DRMSETTINGSPLUGIN_IBY +#define DRMSETTINGSPLUGIN_IBY + +ECOM_PLUGIN( drmsettingsplugin.dll, 102750CC.rsc ) +//data=DATAZ_\BITMAP_DIR\drmsettingsplugin.mif BITMAP_DIR\drmsettingsplugin.mif + +data=ZSYSTEM\install\commondrm_stub.SIS \system\install\commondrm_stub.SIS +#endif // DRMSETTINGSPLUGIN_IBY +// End of File diff -r 1221b68b8a5f -r 1481bf457703 commondrm/rom/drmsettingspluginresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/rom/drmsettingspluginresources.iby Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DRMSettingsPlugin ROM resources. +* +*/ + +#ifndef DRMSETTINGSPLUGINRESOURCES_IBY +#define DRMSETTINGSPLUGINRESOURCES_IBY + +data=DATAZ_\RESOURCE_FILES_DIR\drmsettingspluginrsc.rsc RESOURCE_FILES_DIR\drmsettingspluginrsc.rsc + +#endif // DRMSETTINGSPLUGINRESOURCES_IBY +// End of File diff -r 1221b68b8a5f -r 1481bf457703 drm.pro --- a/drm.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -# -# 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 1221b68b8a5f -r 1481bf457703 drm_plat/camese_framework_api/camese_framework_api.metaxml --- a/drm_plat/camese_framework_api/camese_framework_api.metaxml Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_plat/camese_framework_api/camese_framework_api.metaxml Wed Sep 01 12:21:16 2010 +0100 @@ -1,16 +1,14 @@ - - - camese framework api - WMDRM DLA framework plugin interfaces -WMDRM DLA Client API - c++ - WMDRM - - - - - - yes - no - + + +camese framework api +WMDRM DLA framework plugin interfaces +c++ +WMDRM + + + + +yes +no + diff -r 1221b68b8a5f -r 1481bf457703 drm_plat/camese_framework_api/group/bld.inf --- a/drm_plat/camese_framework_api/group/bld.inf Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_plat/camese_framework_api/group/bld.inf Wed Sep 01 12:21:16 2010 +0100 @@ -29,4 +29,3 @@ ../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 1221b68b8a5f -r 1481bf457703 drm_plat/camese_framework_api/inc/wmdrmdlahandler.h --- a/drm_plat/camese_framework_api/inc/wmdrmdlahandler.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 drm_plat/drm_common_api/tsrc/data/mmc/DRM/content.dcf diff -r 1221b68b8a5f -r 1481bf457703 drm_plat/drm_rights_api/tsrc/data/c/content.dcf diff -r 1221b68b8a5f -r 1481bf457703 drm_plat/wmdrm_access_api/inc/wmdrmaccessecominterface.inl --- a/drm_plat/wmdrm_access_api/inc/wmdrmaccessecominterface.inl Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_plat/wmdrm_access_api/inc/wmdrmaccessecominterface.inl Wed Sep 01 12:21:16 2010 +0100 @@ -15,7 +15,7 @@ * wmdrmaccessecominterface.inl * */ -#include // for interface +#include // for interface // --------------------------------------------------------------------------- // CWmDrmAccessEcomInterface::NewL diff -r 1221b68b8a5f -r 1481bf457703 drm_pub/drm_helper_api/inc/Drmhelper.h --- a/drm_pub/drm_helper_api/inc/Drmhelper.h Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_pub/drm_helper_api/inc/Drmhelper.h Wed Sep 01 12:21:16 2010 +0100 @@ -63,6 +63,7 @@ class CAknGlobalNote; class CAknWaitDialog; class CDRMHelperInfoNoteWrapper; +class CSchemeHandler; class CMediatorEventProvider; // CLASS DECLARATION @@ -1574,6 +1575,8 @@ // Used to queue up global notes RPointerArray iNoteList; + CSchemeHandler* iSchemeHandler; + TBool iReturnCancel; // Used to send cancel events to cover ui diff -r 1221b68b8a5f -r 1481bf457703 drm_pub/drm_helper_api/loc/DRMCommon.loc --- a/drm_pub/drm_helper_api/loc/DRMCommon.loc Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_pub/drm_helper_api/loc/DRMCommon.loc Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005 - 2008 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" @@ -52,7 +52,7 @@ //w: //r: // -#define qtn_drm_gen_rights_exp "Licence expired for some of the selected objects" +#define qtn_drm_gen_rights_exp "License expired for some of the selected objects" //d: Text in information note //l: popup_note_window @@ -66,7 +66,7 @@ //w: //r: // -#define qtn_drm_mgr_det_exp "Licence expired" +#define qtn_drm_mgr_det_exp "License expired" //d: Text in message query //d: %N is number of deleted objects @@ -152,14 +152,14 @@ //w: //r: // -#define qtn_drm_cnt_or_dt_exp_multi "Licence will expire for some of the selected objects" +#define qtn_drm_cnt_or_dt_exp_multi "License will expire for some of the selected objects" //d: Text in confirmation query //l: popup_note_window //w: //r: // -#define qtn_drm_sd_rights_exp "Licence expired. Get new licence to unlock file?" +#define qtn_drm_sd_rights_exp "License expired. Get new license to unlock file?" //d: Text in confirmation query //d: %U is name of the media object @@ -182,7 +182,7 @@ //w: //r: // -#define qtn_drm_query_valid_rights_until "Licence for selected item valid until %U. Continue?" +#define qtn_drm_query_valid_rights_until "License for selected item valid until %U. Continue?" //d: Text in confirmation query when content with inactive interval rights is set as automated content. //d: %U is calculated expiration date of rights object, if rights are activated @@ -198,7 +198,7 @@ //w: //r: // -#define qtn_drm_note_cd_ro_expired "Licence for %U expired" +#define qtn_drm_note_cd_ro_expired "License for %U expired" //d: Text in confirmation note when superdistributable automated content has expired. //d: %U is name of the content @@ -206,7 +206,7 @@ //w: //r: // -#define qtn_drm_note_sd_ro_expired "Licence for %U expired. Get new licence to unlock file?" +#define qtn_drm_note_sd_ro_expired "License for %U expired. Get new license to unlock file?" //d: Text in information note when usage rights are not yet valid. //d: %U is start date of rights object @@ -214,14 +214,14 @@ //w: //r: 2.6 // -#define qtn_drm_note_ro_valid_on_future "Licence valid from %U" +#define qtn_drm_note_ro_valid_on_future "License valid from %U" //d:Possible second line for first entry of Details View listbox //l:list_double_pane_t2_cp2 //w: //r:3.0 // -#define qtn_drm_mgr_det_valid "Licence is valid" +#define qtn_drm_mgr_det_valid "License is valid" //d: Text in information note shown when removing device from account failed. //l: popup_note_window @@ -250,7 +250,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_act_key_received "Licence received" +#define qtn_drm_info_act_key_received "License received" //d: Text in information note shown when getting rights object has failed. //d: Reason is permanent device or server error and there is no possibility to retry. @@ -258,7 +258,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_getting_key_failed "Unable to get licence" +#define qtn_drm_info_getting_key_failed "Unable to get license" //d: Text in confirmation note shown when device has been succesfully removed from account. //l: popup_note_window @@ -339,7 +339,7 @@ //w: //r: 3.0 // -#define qtn_drm_get_key_failed_retry "Licence not received. Try again?" +#define qtn_drm_get_key_failed_retry "License not received. Try again?" //d: Text in wait note shown while device is acquiring RO and possibly completing registration //d: protocol with Rights Issuer. @@ -426,7 +426,7 @@ //w: //r: 3.0 // -#define qtn_drm_query_waiting_for_ro "Waiting for licence. Try again later." +#define qtn_drm_query_waiting_for_ro "Waiting for license. Try again later." //d: Text in confirmation query that is displayed when user tries to render MO that is missing RO. //d: The waiting time of RO to arrive has passed, and there is no possibility to get new RO (no rights @@ -435,7 +435,7 @@ //w: //r: 3.0 // -#define qtn_drm_query_ro_late "Licence not yet received. Expected time of delivery elapsed." +#define qtn_drm_query_ro_late "License not yet received. Expected time of delivery elapsed." //d: Text in confirmation query that is displayed when user tries to render MO that is missing RO. //d: The waiting time of RO to arrive has passed, and there is possibility to get new RO (rights issuer url exists). @@ -443,7 +443,7 @@ //w: //r: 3.0 // -#define qtn_drm_query_ro_late_activate "Licence not yet received. Expected time of delivery elapsed. Get new licence?" +#define qtn_drm_query_ro_late_activate "License not yet received. Expected time of delivery elapsed. Get new license?" //d: Text in confirmation note that is displayed when device registration is complete. //l: popup_note_window @@ -483,7 +483,7 @@ //w: //r: 3.0 // -#define qtn_drm_cal_tone_exp_activate "Licence for calendar alert tone %U expired. Get new licence to unlock file?" +#define qtn_drm_cal_tone_exp_activate "License for calendar alert tone %U expired. Get new license to unlock file?" //d: Text in information note that that is displayed when rights for calendar alert tone have expired. //d: Note is shown when Idle is activated. This info note is shown fore combined delivery object @@ -493,7 +493,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_calendar_tone_exp "Licence for calendar alert tone %U expired" +#define qtn_drm_info_calendar_tone_exp "License for calendar alert tone %U expired" //d: Text in confirmation query that is displayed when rights for clock alarm tone have expired. //d: Query is shown when Idle is activated. Activation query is shown only for superdistributable @@ -503,7 +503,7 @@ //w: //r: 3.0 // -#define qtn_drm_clock_alrm_exp_activate "Licence for clock alarm tone %U expired. Get new licence to unlock file?" +#define qtn_drm_clock_alrm_exp_activate "License for clock alarm tone %U expired. Get new license to unlock file?" //d: Text in information note that that is displayed when rights for clock alarm tone have expired. //d: Note is shown when Idle is activated. This info note is shown fore combined delivery object @@ -513,7 +513,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_clock_alarm_exp "Licence for clock alarm tone %U expired" +#define qtn_drm_info_clock_alarm_exp "License for clock alarm tone %U expired" //d: Text in confirmation query that is displayed when rights for e-mail alert tone have expired. //d: Query is shown when Idle is activated. Activation query is shown only for superdistributable @@ -523,7 +523,7 @@ //w: //r: 3.0 // -#define qtn_drm_email_tone_exp_activate "Licence for e-mail alert tone %U expired. Get new licence to unlock file?" +#define qtn_drm_email_tone_exp_activate "License for e-mail alert tone %U expired. Get new license to unlock file?" //d: Text in information note that that is displayed when rights for e-mail alert tone have expired. //d: Note is shown when Idle is activated. This info note is shown fore combined delivery object @@ -533,7 +533,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_email_tone_exp "Licence for e-mail alert tone %U expired" +#define qtn_drm_info_email_tone_exp "License for e-mail alert tone %U expired" //d: Text in confirmation query that is displayed when rights for instant message alert tone have expired. //d: Query is shown when Idle is activated. Activation query is shown only for superdistributable @@ -543,7 +543,7 @@ //w: //r: 3.0 // -#define qtn_drm_im_tone_exp_activate "Licence for IM alert tone %U expired. Activate?" +#define qtn_drm_im_tone_exp_activate "License for IM alert tone %U expired. Activate?" //d: Text in information note that that is displayed when rights for instant message alert tone have expired. //d: Note is shown when Idle is activated. This info note is shown fore combined delivery object @@ -553,7 +553,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_im_alert_tone_exp "Licence for IM alert tone %U expired" +#define qtn_drm_info_im_alert_tone_exp "License for IM alert tone %U expired" //d: Text in confirmation query that is displayed when rights for message alert tone have expired. //d: Query is shown when Idle is activated. Activation query is shown only for superdistributable @@ -563,7 +563,7 @@ //w: //r: 3.0 // -#define qtn_drm_msg_tone_exp_activate "Licence for message alert tone %U expired. Get new licence to unlock file?" +#define qtn_drm_msg_tone_exp_activate "License for message alert tone %U expired. Get new license to unlock file?" //d: Text in information note that that is displayed when rights for message alert tone have expired. //d: Note is shown when Idle is activated. This info note is shown fore combined delivery object @@ -573,7 +573,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_msg_tone_exp "Licence for message alert tone %U expired" +#define qtn_drm_info_msg_tone_exp "License for message alert tone %U expired" //d: Text in confirmation query that is displayed when rights for ringing tone have expired. //d: Query is shown when Idle is activated. Activation query is shown only for superdistributable @@ -583,7 +583,7 @@ //w: //r: 3.0 // -#define qtn_drm_ring_tone_exp_activate "Licence for ringing tone %U expired. Get new licence to unlock file?" +#define qtn_drm_ring_tone_exp_activate "License for ringing tone %U expired. Get new license to unlock file?" //d: Text in information note that that is displayed when rights for ringing tone have expired. //d: Note is shown when Idle is activated. This info note is shown fore combined delivery object @@ -593,7 +593,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_ring_tone_exp "Licence for ringing tone %U expired" +#define qtn_drm_info_ring_tone_exp "License for ringing tone %U expired" //d: Text in confirmation query that is displayed when rights for screensaver have expired. //d: Query is shown when Idle is activated. Activation query is shown only for superdistributable @@ -603,7 +603,7 @@ //w: //r: 3.0 // -#define qtn_drm_screensave_exp_activate "Licence for power saver %U expired. Get new licence to unlock file?" +#define qtn_drm_screensave_exp_activate "License for power saver %U expired. Get new license to unlock file?" //d: Text in information note that that is displayed when rights for screensaver have expired. //d: Note is shown when Idle is activated. This info note is shown fore combined delivery object @@ -623,7 +623,7 @@ //w: //r: 3.0 // -#define qtn_drm_wallpaper_exp_activate "Licence for wallpaper %U expired. Get new licence to unlock file?" +#define qtn_drm_wallpaper_exp_activate "License for wallpaper %U expired. Get new license to unlock file?" //d: Text in information note that that is displayed when rights for wallpaper have expired. //d: Note is shown when Idle is activated. This info note is shown fore combined delivery object @@ -633,7 +633,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_wallpaper_exp "Licence for wallpaper %U expired" +#define qtn_drm_info_wallpaper_exp "License for wallpaper %U expired" //d: Text in confirmation query that is displayed when rights for theme have expired. //d: Query is shown when Idle is activated. Activation query is shown only for superdistributable @@ -643,7 +643,7 @@ //w: //r: 3.0 // -#define qtn_drm_theme_exp_activate "Licence for theme %U expired. Get new licence to unlock file?" +#define qtn_drm_theme_exp_activate "License for theme %U expired. Get new license to unlock file?" //d: Text in information note that that is displayed when rights for theme have expired. //d: Note is shown when Idle is activated. This info note is shown for combined delivery object @@ -653,7 +653,7 @@ //w: //r: 3.0 // -#define qtn_drm_info_theme_exp "Licence for theme %U expired" +#define qtn_drm_info_theme_exp "License for theme %U expired" //d: Text in information note shown when updating account has failed //d: (device was trying to join to new account). @@ -706,14 +706,14 @@ //w: //r: 3.0 // -#define qtn_drm_roap_title "Licence download" +#define qtn_drm_roap_title "License download" //d: Text in information note //l: popup_note_window //w: //r: // -#define qtn_drm_info_ro_expired "Licence expired" +#define qtn_drm_info_ro_expired "License expired" //d: Text in confirmation query shown when content cannot be rendered because of wrong SIM card in device //l: popup_note_window @@ -885,7 +885,7 @@ //l: None //r: 3.2 // -#define qtn_drm_msq_query_registration "Registration with content provider is needed. After registration, licences for protected files can be downloaded automatically." +#define qtn_drm_msq_query_registration "Registration with content provider is needed. After registration, licenses for protected files can be downloaded automatically." //Link text for more info //d: String which contains the description for more info -link diff -r 1221b68b8a5f -r 1481bf457703 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 Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/BCDRMCAFCAPS_exe/group/BCDRMCAFCAPS_exe.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -32,8 +32,12 @@ /* Remove comments and replace 0x00000000 with correct secure id */ // SECUREID 0x00000000 -MW_LAYER_SYSTEMINCLUDE - +#if defined(__S60_) + MW_LAYER_SYSTEMINCLUDE +#else // __S60_ not defined + SYSTEMINCLUDE /epoc32/include + SYSTEMINCLUDE /epoc32/include/internal +#endif // __S60_ /* Source files */ SOURCEPATH ../src diff -r 1221b68b8a5f -r 1481bf457703 drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/data/content.dcf diff -r 1221b68b8a5f -r 1481bf457703 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 Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/group/DRM_CAF.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -33,8 +33,12 @@ USERINCLUDE ../inc -MW_LAYER_SYSTEMINCLUDE - +#if defined(__S60_) + MW_LAYER_SYSTEMINCLUDE +#else // __S60_ not defined + SYSTEMINCLUDE /epoc32/include + SYSTEMINCLUDE /epoc32/include/internal +#endif // __S60_ SOURCEPATH ../src @@ -50,6 +54,10 @@ LANG SC + +SYSTEMINCLUDE /epoc32/include/libc +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/caf LIBRARY apparc.lib LIBRARY avkon.lib diff -r 1221b68b8a5f -r 1481bf457703 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 Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/group/DRM_CAF_nrm.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -36,9 +36,12 @@ USERINCLUDE ../inc - -MW_LAYER_SYSTEMINCLUDE - +#if defined(__S60_) + MW_LAYER_SYSTEMINCLUDE +#else // __S60_ not defined + SYSTEMINCLUDE /epoc32/include + SYSTEMINCLUDE /epoc32/include/internal +#endif // __S60_ SOURCEPATH ../src diff -r 1221b68b8a5f -r 1481bf457703 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 Tue Aug 31 15:29:38 2010 +0300 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/inc/DRM_CAF.h Wed Sep 01 12:21:16 2010 +0100 @@ -38,7 +38,8 @@ #include #include #include -#include +#include +//#include #include #include diff -r 1221b68b8a5f -r 1481bf457703 inc/DrmUtilityDmgrWrapper.h --- a/inc/DrmUtilityDmgrWrapper.h Tue Aug 31 15:29:38 2010 +0300 +++ b/inc/DrmUtilityDmgrWrapper.h Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -19,28 +19,9 @@ #ifndef CDRMUTILITYDMGRWRAPPER_H #define CDRMUTILITYDMGRWRAPPER_H -#include // RFs -#include // Roap::MRoapObserver -#include // MAknProgressDialogCallback CAknProgressDialog - -// download apis -#include -#include -#include - -namespace Roap - { - class CRoapEng; - } - -namespace DRM - { - class CDrmUtilityConnection; - } -class CDRMRights; -class CEikProgressInfo; -class DrmUtilityEventHandler; -class QDrmUtilityDmgrEventHandler; +#include +#include +#include /** * Environment gate function @@ -69,25 +50,12 @@ * @lib DrmUtilityDmgrWrapper * @since S60 v5.0 */ -class CDrmUtilityDmgrWrapper : - public CActive, - public Roap::MRoapObserver, +class CDrmUtilityDmgrWrapper : CBase, + public MHttpDownloadMgrObserver, public MDrmUtilityDmgrWrapper, public MProgressDialogCallback { -private: - enum TDownloadState - { - EInit, - EGetMeteringTrigger, - ESaveMeteringTrigger, - EMeteringReportSubmit, - EGetPrUrlTrigger, - ESavePrUrlTrigger, - EPrRoapRequest, - EComplete - }; public: static CDrmUtilityDmgrWrapper* NewL(); @@ -108,131 +76,17 @@ HBufC8* GetErrorUrlL(); -// From Roap::MRoapObserver - /** - * ConnectionConfL - * @return ETrue: the network can be establish - * EFalse: the ROAP transaction is canceled - * - * @leave System wide error code */ - TBool ConnectionConfL(); - /** - * ContactRiConfL - * @return ETrue: the user consent is achieved - * EFalse: the user consent is not achieved - * - * @leave System wide error code */ - TBool ContactRiConfL(); - - /** - * TransIdConfL - * @return ETrue: the user consent is achieved - * EFalse: the user consent is not achieved - * - * @leave System wide error code */ - - TBool TransIdConfL(); - - /** - * RightsObjectDetailsL - * - * The function is called after successful completion of RO acquisition - * protocol. The passes information about stored rights objects to the - * observer. - * - * @since 3.0 - * @param aRightsList: A list of pointers to rights objects. - * Contents of aRightsList are owend by ROAP engine - * - * @leave System wide error code */ - void RightsObjectDetailsL( const RPointerArray& aRightsList ); - - /** - * ContentDownloadInfoL - * - * The function is called when the ROAP engine notices that it is about to - * receive a multipart content as a ROAP response. The method must return via - * out-parameter the path to a temp folder where the content is saved during - * download. The name that is used as filename when saving the content to - * the appropriate palce and the maximum size of the content (a safety upper limit) - * must also be provided via out-parameters. - * - * @since 3.0 - * @param aTempFolder: (out-param) The path of the temp folder, or KNullDesC - * @param aContentName: (out-param) The name of the content, or KNullDesC (defaut name is used) - * @param aMaxSize: (out-param) The maximum size of the content, or -1 if not known - * - * @leave System wide error code */ - - void ContentDownloadInfoL( TPath& aTempFolder, - TFileName& aContentName, - TInt& aMaxSize ); + // from base class MHttpDownloadMgrObserver /** - * ContentDetailsL - * - * The function is called when the ROAP engine has received a DCF content (together - * with a ROAP response) The ROAP engine saves the DCF to the appropriate location - * and gives out the information about the saved DCF file by calling this method - * - * @since 3.0 - * @param aPath: The path andf the filename of the saved DCF file - * @param aType: The plain MIME type of the saved DCF file - * @param aAppUid: The handler app UID of the saved DCF file - * - * @leave System wide error code */ - - void ContentDetailsL( const TDesC& aPath, - const TDesC8& aType, - const TUid& aAppUid ); - - /** - * RoapProgressInfoL - * - * The function provides progress information about ROAP processing to the - * observer - * - * @since 3.0 - * @param aProgressInfo: An integer value representing the state of - * ROAP processing, counting in bytes + * From MHttpDownloadMgrObserver. + * Handle download manager events * - * @leave System wide error code */ - - void RoapProgressInfoL( const TInt aProgressInfo ); - - /** - * ErrorUrlL - * - * The function is called in ROAP error case and it provides an error URL - * for the caller. The calling entity should send an HTTP GET request to - * the URL which should then return an HTML page. - * - * @since 3.0 - * @param aErrorUrl: The error URL - * - * - * @leave System wide error code */ - - void ErrorUrlL( const TDesC8& aErrorUrl ); - - /** - * PostResponseUrlL - * - * The function is called if handled ROAP metering report response - * contains PostResponseURL extension. The calling entity should send - * an HTTP GET request to the URL, which should return ROAP trigger, - * download descriptor or multipart message containing both - * download descriptor and ROAP trigger. - * - * @since 3.2 - * @param aPostResponseUrl: The URL to be fetched - * after handling ROAP metering response - * with PostResponseURL extension. - * - * - * @leave System wide error code */ - void PostResponseUrlL( const TDesC8& aPostResponseUrl ); + * @param aDownload the download + * @param aEvent the event + */ + void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); public: // Call back methods of MAknProgressDialogCallback @@ -243,22 +97,9 @@ * @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 - virtual void DoCancel(); - virtual void RunL(); - - virtual TInt RunError( TInt aError ); private: /** @@ -271,37 +112,25 @@ /** * Set the browser default access point to be used */ + void SetDefaultAccessPointL(); + void DoDownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); void ShowProgressNoteL( ); void RemoveProgressNoteL( ); - void DoConnectL( TDownloadState aNextState ); - - void DoDownloadRoapTriggerL( TDownloadState aNextState ); - - void DoSaveRoapTriggerL( TDownloadState aNextState ); + void HandlePostResponseUrlL(); - void DoHandleRoapTriggerL( TDownloadState aNextState ); - - void CompleteToState( TDownloadState aNextState, TInt aError ); - - void ProcessDownloadEventL( WRT::Download& aDownload, WRT::DownloadEvent& aEvent ); private: // data /** * Download manager session */ - WRT::DownloadManager* iDlMgr; + RHttpDownloadMgr iDlMgr; /** - * Download instance needs to be stored for handling signal slot mechanism - */ - WRT::Download* iDownload; - - /** * Used to make downloads synchronous */ CActiveSchedulerWait iWait; @@ -312,16 +141,6 @@ TBool iDownloadSuccess; TBool iConnectionError; - /** - * trigger URL - */ - HBufC8* iTriggerUrl; - - /** - * trigger buffer - */ - HBufC8* iTriggerBuf; - TBool iDialogDismissed; /** @@ -352,22 +171,6 @@ */ HBufC8* iPostResponseUrl; - /** - * IAP (from ROAP or from UI) - */ - TUint32 iIapId; - - TDownloadState iState; - - Roap::CRoapEng* iRoapEng; - - RFs iFs; - - HBufC* iFileName; - - DRM::CDrmUtilityConnection* iConnection; - - QDrmUtilityDmgrEventHandler* iDrmUtilityDmgrEventHandler; }; #endif // CDRMUTILITYDMGRWRAPPER_H diff -r 1221b68b8a5f -r 1481bf457703 inc/buffercontainers.h --- a/inc/buffercontainers.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* 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: CBase derived container classes for easening -* dynamic memory allocation of TBuf type variables -* (TName etc.) -*/ -#ifndef BUFFERCONTAINERS_H -#define BUFFERCONTAINERS_H - -#include -namespace DRM -{ -template -NONSHARABLE_CLASS( CBufferContainer ): public CBase - { - // Note, this class is not intendend to be part of any API - public: - inline static CBufferContainer* NewL(); - inline static CBufferContainer* NewLC(); - - inline virtual ~CBufferContainer(); - private: - inline CBufferContainer(); - - //data - public: - // Contained TBuf member - T iBuffer; - }; - -//Containers for some TBuf based types defined at e32cmn.h -typedef CBufferContainer CNameContainer; -typedef CBufferContainer CFullNameContainer; -typedef CBufferContainer CExitCategoryNameContainer; -typedef CBufferContainer CFileNameContainer; -typedef CBufferContainer CPathContainer; -typedef CBufferContainer CVersionNameContainer; -typedef CBufferContainer CUidNameContainer; -} - -#include "buffercontainers.inl" -#endif // BUFFERCONTAINERS_H diff -r 1221b68b8a5f -r 1481bf457703 inc/buffercontainers.inl --- a/inc/buffercontainers.inl Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* 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 BUFFERCONTAINERS_INL -#define BUFFERCONTAINERS_INL - -// --------------------------------------------------------------------------- -// DRM::CBufferContainer::NewL -// --------------------------------------------------------------------------- -// -template -inline DRM::CBufferContainer* DRM::CBufferContainer::NewL() -{ - CBufferContainer* self( CBufferContainer::NewLC() ); - CleanupStack::Pop( self ); - return self; -} - -// --------------------------------------------------------------------------- -// DRM::CBufferContainer::NewLC -// --------------------------------------------------------------------------- -// -template -inline DRM::CBufferContainer* DRM::CBufferContainer::NewLC() -{ - CBufferContainer* self( new (ELeave) CBufferContainer() ); - CleanupStack::PushL( self ); - return self; -} - -// --------------------------------------------------------------------------- -// DRM::CBufferContainer::CBufferContainer -// --------------------------------------------------------------------------- -// -template -inline DRM::CBufferContainer::CBufferContainer() -{} - -// --------------------------------------------------------------------------- -// DRM::CBufferContainer::~CBufferContainer -// --------------------------------------------------------------------------- -// -template -inline DRM::CBufferContainer::~CBufferContainer() -{} - - -#endif // BUFFERCONTAINERS_INL diff -r 1221b68b8a5f -r 1481bf457703 inc/drmbrowserlauncher.h --- a/inc/drmbrowserlauncher.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +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: 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 1221b68b8a5f -r 1481bf457703 inc/drmuidialogids.h --- a/inc/drmuidialogids.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 layers.sysdef.xml --- a/layers.sysdef.xml Tue Aug 31 15:29:38 2010 +0300 +++ b/layers.sysdef.xml Wed Sep 01 12:21:16 2010 +0100 @@ -1,17 +1,14 @@ - ]> - + - - - diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -29,6 +29,7 @@ #include #include #include +#include #include "Oma2Agent.h" #include "Oma2AgentAttributes.h" #include "Oma1Dcf.h" @@ -81,9 +82,6 @@ DRM::EDrmAllowVideoMacroVision | DRM::EDrmAllowAudioUsb | DRM::EDrmAllowAudioHdmiHdcpRequired | - DRM::EDrmAllowAudioHdmi | - DRM::EDrmAllowVideoHDMI | - DRM::EDrmAllowVideoHdmiHdcpRequested | DRM::EDrmAllowVideoHdmiHdcpRequired; // ============================= LOCAL FUNCTIONS =============================== @@ -1023,14 +1021,26 @@ } break; case ERightsIssuerUrl: -#ifndef __DRM_FULL - err = KErrNotSupported; -#else - if (aDcfFile.iRightsIssuerURL != NULL) + TRAP(ret, FeatureManager::InitializeLibL()); + + if (!ret && FeatureManager::FeatureSupported(KFeatureIdFfOmadrm1FullSupport)) { - TRAP(err, b = CnvUtfConverter::ConvertToUnicodeFromUtf8L(*aDcfFile.iRightsIssuerURL)); + if (aDcfFile.iRightsIssuerURL != NULL) + { + TRAP(err, b = CnvUtfConverter::ConvertToUnicodeFromUtf8L( + *aDcfFile.iRightsIssuerURL)); + } } -#endif + else + { + err = KErrNotSupported; + } + + if (!ret) + { + FeatureManager::UnInitializeLib(); + } + break; case ETransactionTrackingId: if (dcf2 != NULL && dcf2->iTransactionTracking) diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -25,7 +25,9 @@ #include #include -#include + +#include + #include "Oma2AgentContent.h" #include "Oma2AgentAttributes.h" @@ -543,6 +545,7 @@ // ----------------------------------------------------------------------------- // COma2AgentContent::NotifyStatusChange +// // ----------------------------------------------------------------------------- // void COma2AgentContent::NotifyStatusChange( @@ -603,8 +606,7 @@ TRequestStatus *ptr = &aStatus; TInt r; HBufC* b = NULL; - - r = KErrNotSupported; + CSchemeHandler* handler = NULL; r = iDcf->OpenPart(aUniqueId); if (r == KErrNone && iDcf->iRightsIssuerURL != NULL) @@ -613,17 +615,16 @@ *iDcf->iRightsIssuerURL)); if (b != NULL) { - DRM::CDrmBrowserLauncher* browserLauncher = DRM::CDrmBrowserLauncher::NewLC(); - - browserLauncher->LaunchUrlL(*b); - - CleanupStack::PopAndDestroy(); // browserLauncher - + TRAP(r, handler = CSchemeHandler::NewL(*b)); + if (handler != NULL) + { + TRAP(r, handler->HandleUrlStandaloneL()); + delete handler; + } delete b; } } - - User::RequestComplete(ptr, r); + User::RequestComplete(ptr, r); } // ----------------------------------------------------------------------------- diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -32,6 +32,7 @@ #include #include #include +#include #include "Oma2AgentManager.h" #include "Oma2AgentAttributes.h" @@ -130,7 +131,9 @@ } iOmaBasedMimeType = NULL; } - + + FeatureManager::InitializeLibL(); + } // ----------------------------------------------------------------------------- @@ -200,6 +203,8 @@ delete iWatchedId; delete iOmaBasedMimeType; + + FeatureManager::UnInitializeLib(); } // ----------------------------------------------------------------------------- @@ -723,11 +728,11 @@ TInt err = KErrNone; CDcfCommon* dcf = NULL; -#ifdef __DRM_OMA2 +#ifdef __DRM_OMA2 if ( !aFileName.Right(4).CompareF( KOma2DcfExtension ) || - !aFileName.Right(4).CompareF( KOma2DcfExtensionAudio ) || - !aFileName.Right(4).CompareF( KOma2DcfExtensionVideo ) || - COma2Dcf::IsValidDcf(aBuffer) ) + !aFileName.Right(4).CompareF( KOma2DcfExtensionAudio ) || + !aFileName.Right(4).CompareF( KOma2DcfExtensionVideo ) || + COma2Dcf::IsValidDcf(aBuffer) ) { aFileMimeType.Copy(KOma2DcfContentType); aContentMimeType.Copy(KCafMimeType); @@ -795,7 +800,11 @@ { aOutputBuffer.Copy(_L8("FL CD SD")); #ifdef __DRM_OMA2 - aOutputBuffer.Append(_L8(" OMADRM2")); + if( FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) + { + aOutputBuffer.Append(_L8(" OMADRM2")); + } #endif } break; diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/dcf/src/Oma2Dcf.cpp --- a/omadrm/drmengine/dcf/src/Oma2Dcf.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/dcf/src/Oma2Dcf.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 - 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include "Oma2Agent.h" @@ -291,11 +292,24 @@ const TDesC8& aDcfFragment ) { TBool r( EFalse ); + TInt err( KErrNone ); if ( aDcfFragment.Length() >= KBrandingSize && aDcfFragment.Left( KBrandingSize ).Compare( KOma2DcfBranding ) == 0 ) { - r = ETrue; + + TRAP( err, FeatureManager::InitializeLibL() ); + + if ( !err && FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) + { + r = ETrue; + } + + if ( !err ) + { + FeatureManager::UnInitializeLib(); + } + } return r; } diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/dcfrepository/server/src/DcfRepSrv.cpp --- a/omadrm/drmengine/dcfrepository/server/src/DcfRepSrv.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/dcfrepository/server/src/DcfRepSrv.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -726,7 +726,6 @@ { aType = ENoDcf; } - } break; case EStateSetTtid: diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/dm/src/DRMMessageParser.cpp --- a/omadrm/drmengine/dm/src/DRMMessageParser.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/dm/src/DRMMessageParser.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef RD_MULTIPLE_DRIVE #include @@ -223,6 +224,9 @@ Reset(); User::Free( const_cast< TUint8* >( iInputBuffer.Ptr() ) ); + + FeatureManager::UnInitializeLib(); + } // ----------------------------------------------------------------------------- @@ -331,6 +335,9 @@ // void CDRMMessageParser::ConstructL() { + + FeatureManager::InitializeLibL(); + // Make some extra room for crazy b64decode(). iInputBuffer.Set( reinterpret_cast< TUint8* >( User::AllocL( KInputBufferSize + 2 ) ), @@ -486,9 +493,12 @@ SetBit( EReadingHeaderPart ); res.Set( NULL, 0 ); -#ifndef __DRM_FULL - User::Leave(KErrNotSupported); -#endif + + if ( !( FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm1FullSupport ) ) ) + { + User::Leave(KErrNotSupported); + } } else { diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/drmbackup/inc/DRMBackup.h --- a/omadrm/drmengine/drmbackup/inc/DRMBackup.h Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/drmbackup/inc/DRMBackup.h Wed Sep 01 12:21:16 2010 +0100 @@ -22,7 +22,7 @@ // INCLUDES #include // CBase -#include +#include // CONSTANTS diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/drmbackup/src/DRMBackupObserver.cpp --- a/omadrm/drmengine/drmbackup/src/DRMBackupObserver.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/drmbackup/src/DRMBackupObserver.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -21,7 +21,7 @@ #include #include #include -#include //for KUidBackupRestoreStatus +#include //for KUidBackupRestoreStatus #include "DRMBackupObserver.h" #include "DRMRightsServer.h" /* diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DRMCommon.mmp --- a/omadrm/drmengine/group/DRMCommon.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DRMCommon.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -37,7 +37,8 @@ // 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 @@ -55,6 +56,7 @@ LIBRARY euser.lib efsrv.lib charconv.lib LIBRARY apmime.lib bafl.lib estor.lib InetProtUtil.lib LIBRARY caf.lib +LIBRARY featmgr.lib #ifdef RD_MULTIPLE_DRIVE LIBRARY platformenv.lib diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DRM_BAT.mmp --- a/omadrm/drmengine/group/DRM_BAT.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DRM_BAT.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -38,7 +38,9 @@ // 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 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DrmCrypto.mmp --- a/omadrm/drmengine/group/DrmCrypto.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DrmCrypto.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -31,6 +31,8 @@ // 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 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DrmDcf.mmp --- a/omadrm/drmengine/group/DrmDcf.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DrmDcf.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -49,7 +49,7 @@ LIBRARY euser.lib XmlFramework.lib hash.lib LIBRARY estor.lib efsrv.lib apmime.lib InetProtUtil.lib bnf.lib LIBRARY cryptography.lib random.lib bafl.lib charconv.lib -LIBRARY centralrepository.lib +LIBRARY centralrepository.lib featmgr.lib #if defined(ARMCC) deffile ../eabi/ diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DrmKeyStorage.mmp --- a/omadrm/drmengine/group/DrmKeyStorage.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DrmKeyStorage.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -30,7 +30,8 @@ // 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 @@ -46,6 +47,7 @@ LIBRARY random.lib LIBRARY hash.lib LIBRARY flogger.lib +LIBRARY featmgr.lib #if defined(ARMCC) deffile ../eabi/ diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DrmParsers.mmp --- a/omadrm/drmengine/group/DrmParsers.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DrmParsers.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -40,7 +40,9 @@ // 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 @@ -55,6 +57,7 @@ LIBRARY drmdcf.lib euser.lib XmlFramework.lib hash.lib LIBRARY estor.lib efsrv.lib apmime.lib InetProtUtil.lib bnf.lib LIBRARY cryptography.lib bafl.lib charconv.lib drmkeystorage.lib +LIBRARY featmgr.lib #ifdef RD_MULTIPLE_DRIVE LIBRARY platformenv.lib diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DrmRights.mmp --- a/omadrm/drmengine/group/DrmRights.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DrmRights.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -38,7 +38,9 @@ // 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 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DrmServerInterfaces.mmp --- a/omadrm/drmengine/group/DrmServerInterfaces.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DrmServerInterfaces.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -42,6 +42,9 @@ // 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 @@ -73,6 +76,7 @@ LIBRARY euser.lib XmlFramework.lib hash.lib LIBRARY estor.lib efsrv.lib apmime.lib InetProtUtil.lib bnf.lib LIBRARY cryptography.lib random.lib bafl.lib charconv.lib +LIBRARY featmgr.lib #if defined(ARMCC) deffile ../eabi/ diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/DrmStdKeyStorage.mmp --- a/omadrm/drmengine/group/DrmStdKeyStorage.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/DrmStdKeyStorage.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -30,6 +30,8 @@ // 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 @@ -47,6 +49,7 @@ LIBRARY etel.lib LIBRARY etelmm.lib LIBRARY flogger.lib +LIBRARY featmgr.lib #ifdef RD_MULTIPLE_DRIVE LIBRARY platformenv.lib diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/OmaDrmAgent.mmp --- a/omadrm/drmengine/group/OmaDrmAgent.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/OmaDrmAgent.mmp Wed Sep 01 12:21:16 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 @@ -77,6 +77,6 @@ LIBRARY ws32.lib LIBRARY sysutil.lib LIBRARY centralrepository.lib -LIBRARY drmbrowserlauncher.lib +LIBRARY featmgr.lib SMPSAFE diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/ROAPHandler.mmp --- a/omadrm/drmengine/group/ROAPHandler.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/ROAPHandler.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -39,6 +39,8 @@ // Default system include paths for middleware layer modules. APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/libc +SYSTEMINCLUDE /epoc32/include/ecom SOURCEPATH ../roap/src @@ -111,9 +113,9 @@ LIBRARY DcfRep.lib LIBRARY caf.lib // Embedding domain ROs LIBRARY cafutils.lib // Embedding domain ROs -LIBRARY centralrepository.lib // CRepository +LIBRARY centralrepository.lib // Browser default AP LIBRARY cmmanager.lib -LIBRARY extendedconnpref.lib netmeta.lib // TExtendedConnPref +LIBRARY featmgr.lib LIBRARY SysUtil.lib LIBRARY HttpFilterCommon.lib diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/group/RightsServer.mmp --- a/omadrm/drmengine/group/RightsServer.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/group/RightsServer.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -27,7 +27,8 @@ // 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 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp --- a/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef RD_MULTIPLE_DRIVE #include @@ -210,10 +211,17 @@ User::LeaveIfError(iFs.Connect()); iFileMan = CFileMan::NewL(iFs); -#ifdef __DRM_OMA2 - TRAP_IGNORE( SelectDefaultRootL() ); // Allow startup anyway. + FeatureManager::InitializeLibL(); + +#ifdef __DRM_OMA2 + if ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) + { + TRAP_IGNORE( SelectDefaultRootL() ); + } #endif - + + FeatureManager::UnInitializeLib(); + iDeviceSpecificKey.Copy(KDefaultKey); LOG(_L("CDrmStdKeyStorage::ConstructL <-")); @@ -576,9 +584,7 @@ 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 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/legacy/src/DRMCommon.cpp --- a/omadrm/drmengine/legacy/src/DRMCommon.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/legacy/src/DRMCommon.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -1821,7 +1822,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void DRMCommon::ConstructL() { - } + FeatureManager::InitializeLibL(); + } // ----------------------------------------------------------------------------- // DRMCommon::NewL @@ -1840,6 +1842,7 @@ // Destructor EXPORT_C DRMCommon::~DRMCommon() { + FeatureManager::UnInitializeLib(); } // ----------------------------------------------------------------------------- @@ -2261,7 +2264,15 @@ DRMCommon::ESeparateDelivery | DRMCommon::ESuperDistribution; #ifdef __DRM_OMA2 - aOMALevel = EOMA_2_0; + if ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) + { + aOMALevel = EOMA_2_0; + } + else + { + aOMALevel = EOMA_1_0; + } + #else aOMALevel = EOMA_1_0; #endif diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/legacy/src/drmcommon.rss --- a/omadrm/drmengine/legacy/src/drmcommon.rss Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/legacy/src/drmcommon.rss Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005 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" diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/notifier/inc/DRMMessageStorage.h --- a/omadrm/drmengine/notifier/inc/DRMMessageStorage.h Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/notifier/inc/DRMMessageStorage.h Wed Sep 01 12:21:16 2010 +0100 @@ -78,7 +78,7 @@ * @param : aMessage - Message related to the reques * @return None */ - TInt AddSession( CDRMNotifierSession* aSession ); + void AddSession( CDRMNotifierSession* aSession ); /** * UpdateMessage diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/notifier/src/DRMMessageStorage.cpp --- a/omadrm/drmengine/notifier/src/DRMMessageStorage.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/notifier/src/DRMMessageStorage.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -94,9 +94,9 @@ // CDRMMessageStorage::AddSession // ----------------------------------------------------------------------------- // -TInt CDRMMessageStorage::AddSession( CDRMNotifierSession* aSession ) +void CDRMMessageStorage::AddSession( CDRMNotifierSession* aSession ) { - return iSessions.Append( aSession ); + iSessions.Append( aSession ); }; // ----------------------------------------------------------------------------- @@ -218,9 +218,7 @@ } else { - CleanupStack::PushL( message ); - iMessages.AppendL ( message ); - CleanupStack::Pop( message ); + iMessages.Append( message ); CleanupStack::Pop(); // message->iData; CleanupStack::Pop(); // eventBuf CleanupStack::Pop(); // message diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/notifier/src/DRMNotifierSession.cpp --- a/omadrm/drmengine/notifier/src/DRMNotifierSession.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/notifier/src/DRMNotifierSession.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -142,7 +142,7 @@ if( !iIsListening || iMessageQueue.Count() ) { - iMessageQueue.AppendL ( aMessage ); + iMessageQueue.Append( aMessage ); return ETrue; } NotifyL( aMessage, EFalse ); @@ -274,9 +274,8 @@ if( !iIsInStorage ) { - - User::LeaveIfError( iStorage->AddSession( this ) ); - iIsInStorage = ETrue; + iIsInStorage = ETrue; + iStorage->AddSession( this ); } // Check if there are any notifications in queue if so process first one @@ -355,7 +354,7 @@ content->iContentID = NULL; content->iEventType = eventType; - iContentIDList.AppendL ( content ); + iContentIDList.Append( content ); aMessage.Complete( KErrNone ); } @@ -423,7 +422,7 @@ content->iContentID = contentID; content->iEventType = eventType; - iContentIDList.AppendL ( content ); + iContentIDList.Append( content ); CleanupStack::Pop(); aMessage.Complete( KErrNone ); diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/ro/src/DrmRightsParser.cpp --- a/omadrm/drmengine/ro/src/DrmRightsParser.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/ro/src/DrmRightsParser.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1113,7 +1113,7 @@ GetAttributeValueL( aAttributes, KIdAttribute ); iRights->iCurrentAsset->iIdRef = GetAttributeValueL( aAttributes, KIdRefAttribute ); - iRights->iAssets.AppendL ( iRights->iCurrentAsset ); + iRights->iAssets.Append( iRights->iCurrentAsset ); break; case EPermissionAssetState: iRights->iCurrentAsset = CParsedAsset::NewL(); @@ -1126,7 +1126,8 @@ break; case EPermissionState: iRights->iCurrentPermission = CParsedPermission::NewL(); - iRights->iPermissions.AppendL ( iRights->iCurrentPermission ); + iRights->iPermissions.Append( + iRights->iCurrentPermission ); iRights->iCurrentPermission->iOnExpiredUrl = GetAttributeValueL( aAttributes, KOnExpiredUrlAttribute ); break; diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/roap/inc/RoapConnection.h --- a/omadrm/drmengine/roap/inc/RoapConnection.h Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/roap/inc/RoapConnection.h Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -23,6 +23,7 @@ #include #include +#include namespace Roap { @@ -85,6 +86,7 @@ RConnection iConnection; TState iState; TRequestStatus* iParentStatus; + TCommDbConnPref iConnPref; }; } diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/roap/src/RoapConnection.cpp --- a/omadrm/drmengine/roap/src/RoapConnection.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/roap/src/RoapConnection.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -22,16 +22,54 @@ #include #include #include -#include +#include #include -#include // IAP, COMMDB_ID #include +#ifdef __SERIES60_NATIVE_BROWSER +#include +#endif #include "RoapConnection.h" #include "RoapDef.h" #include "RoapLog.h" +#ifndef __SERIES60_NATIVE_BROWSER + const TUid KCRUidBrowser = {0x10008D39}; + const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; + const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; + const TUint32 KBrowserNGDefaultSnapId = 0x00000053; +#endif + + +// ================= LOCAL FUNCTIONS ========================================= +// --------------------------------------------------------------------------- +// IapIdOfDefaultSnapL +// for trapping purposes only +// --------------------------------------------------------------------------- +// +LOCAL_C TUint32 IapIdOfDefaultSnapL( + RCmManager& aCmManager, + const TUint32 aDefaultSnap ) + { + RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); + CleanupClosePushL( dest ); + TUint32 iapIdOfDest( 0 ); + + if ( dest.ConnectionMethodCount() <= 0 ) + { + User::Leave( KErrNotFound ); + } + + RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); + CleanupClosePushL( cMeth ); + + iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); + CleanupStack::PopAndDestroy( &cMeth ); + CleanupStack::PopAndDestroy( &dest ); + return iapIdOfDest; + } + // ================= MEMBER FUNCTIONS ======================= // --------------------------------------------------------------------------- @@ -66,6 +104,8 @@ ( TUint32 aIap, TRequestStatus* aStatus ) { LOGLIT( "CRoapConnection::ConnectL" ) + const TInt KAlwaysAskSelectionMode( 1 ); + const TInt KDestinationSelectionMode( 2 ); if ( iState == EInit ) { @@ -80,9 +120,11 @@ CleanupClosePushL( iConnection ); TConnectionInfoBuf connInfo; - TUint count(0); + TInt ap = 0; + TInt alwaysAsk = 0; + TUint count; User::LeaveIfError( iConnection.EnumerateConnections( count ) ); - TUint i(0); + TUint i; if ( count ) { // Select from existing connections. Try to make AP match. @@ -110,44 +152,71 @@ else { // No existing connections, create new one. - // Create overrides - TConnPrefList prefList; - TExtendedConnPref prefs; - - prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); +#ifdef __WINS__ + // WINS connection creation does not work if preferences are given. + // Defaults are to be used always. + iConnection.Start( iStatus ); +#else + // Note: the TCommDbConnPref must NOT be stack variable. + // It must persist until completion of RConnection::Start(). + iConnPref.SetDirection( ECommDbConnectionDirectionOutgoing ); + //iConnPref.SetDialogPreference( ECommDbDialogPrefWarn ) + iConnPref.SetBearerSet( ECommDbBearerCSD | ECommDbBearerWcdma ); + // New connection is always created with user-selected AP + // so 0 is used instead of aIap. - //Fetch default connection - TBool hasDefault(ETrue); - TCmDefConnValue defConn; - RCmManager cmManager; - cmManager.OpenLC(); - cmManager.ReadDefConnL(defConn); - if (defConn.iType == ECmDefConnConnectionMethod) + TInt defaultSnap( 0 ); + CRepository* repository( NULL ); + repository = CRepository::NewL( KCRUidBrowser ); + CleanupStack::PushL( repository ); + + repository->Get( KBrowserDefaultAccessPoint, ap); + repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); + repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); + CleanupStack::PopAndDestroy( repository ); + repository = NULL; + + TUint32 iapd32 = 0; + TInt err = KErrNone; + + if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) { - prefs.SetIapId(defConn.iId); - } - else if (defConn.iType == ECmDefConnDestination) - { - prefs.SetSnapId(defConn.iId); + alwaysAsk = KAlwaysAskSelectionMode; } else { - hasDefault = EFalse; + RCmManager cmManager; + cmManager.OpenLC(); + if ( !alwaysAsk ) + { + TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL( + ap, CMManager::ECmIapId ) ); + } + else if ( alwaysAsk == KDestinationSelectionMode ) + { + TRAP( err, iapd32 = IapIdOfDefaultSnapL( + cmManager, defaultSnap ) ); + } + CleanupStack::PopAndDestroy( &cmManager ); } - // End of fetch default connection - if (hasDefault) + + if ( err || alwaysAsk == KAlwaysAskSelectionMode ) { - prefList.AppendL(&prefs); - - // Start an Outgoing Connection with overrides - iConnection.Start(prefList, iStatus); + // Always ask + LOGLIT( "SetDialogPreference( ECommDbDialogPrefPrompt )" ) + iConnPref.SetDialogPreference( ECommDbDialogPrefPrompt ); + iapd32 = 0; } else { - // No default found --> trying with query - iConnection.Start(iStatus); + // User defined + LOGLIT( "SetDialogPreference( ECommDbDialogPrefDoNotPrompt )" ) + iConnPref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt ); } - CleanupStack::PopAndDestroy(&cmManager); + + iConnPref.SetIapId( iapd32 ); + iConnection.Start( iConnPref, iStatus ); +#endif iState = EConnecting; SetActive(); // The only path with a real async request. } diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/roap/src/RoapEng.cpp --- a/omadrm/drmengine/roap/src/RoapEng.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/roap/src/RoapEng.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -80,7 +80,6 @@ #include "DcfEntry.h" #include "Base64.h" #include "drmsettingsplugininternalcrkeys.h" -#include "buffercontainers.h" #define STUB_C_CLASS_IN_NAMESPACE( n, c ) namespace n { class c: public CBase { private: c(); public: virtual ~c(); }; } n::c::c() {} n::c::~c() {} @@ -2163,7 +2162,7 @@ #ifndef __WINS__ TInt numPhone = 0; TUint32 caps = 0; - DRM::CNameContainer* tsyName(NULL); + TName tsyName; RMobilePhone phone; RTelServer etelServer; RTelServer::TPhoneInfo phoneInfo; @@ -2174,20 +2173,18 @@ CleanupClosePushL( etelServer ); User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); - User::LeaveIfError( etelServer.EnumeratePhones( numPhone ) ); + User::LeaveIfError( etelServer.EnumeratePhones( numPhone) ); - tsyName = DRM::CNameContainer::NewLC(); for (TInt i(0); i < numPhone; i++) { User::LeaveIfError( etelServer.GetPhoneInfo( i, phoneInfo ) ); - User::LeaveIfError( etelServer.GetTsyName( i,tsyName->iBuffer ) ); + User::LeaveIfError( etelServer.GetTsyName( i,tsyName ) ); - if ( !tsyName->iBuffer.CompareF( KMmTsyModuleName ) ) + if ( tsyName.CompareF( KMmTsyModuleName ) == 0) { break; } } - CleanupStack::PopAndDestroy( tsyName ); User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) ); CleanupClosePushL( phone ); @@ -2366,7 +2363,7 @@ TPair pair; pair.iCid = aContentIDs[i]; pair.iTtid = aTransIDs[i]; - array.AppendL( pair ); + array.Append( pair ); } iDcfRep->SetTtid( array, status ); diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/roap/src/RoapEngBase.cpp --- a/omadrm/drmengine/roap/src/RoapEngBase.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/roap/src/RoapEngBase.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -17,6 +17,7 @@ // INCLUDE FILES +#include #include #include // #include // from S60 @@ -50,6 +51,8 @@ iReturnedROs.ResetAndDestroy(); delete iDomainRightsResp; delete iRiAlias; + + FeatureManager::UnInitializeLib(); } // --------------------------------------------------------- @@ -78,6 +81,8 @@ iImplicitJoinDomain = EFalse; iReRegistered = EFalse; iRiAlias = NULL; + + FeatureManager::InitializeLibL(); } @@ -94,10 +99,12 @@ { LOGLIT( "CRoapEngBase::SetTriggerL" ) -#ifndef __DRM_OMA2 - User::Leave(KErrNotSupported); -#endif - + if ( !( FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) ) + { + User::Leave(KErrNotSupported); + } + __ASSERT_ALWAYS( iState == EInit || iState == EReady, \ User::Invariant() ); TBool registered = EFalse; diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/roap/src/RoapHttpHandler.cpp --- a/omadrm/drmengine/roap/src/RoapHttpHandler.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/roap/src/RoapHttpHandler.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-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" @@ -21,20 +21,16 @@ #include #include +#include "RoapHttpHandler.h" +#include "RoapObserver.h" +#include "RoapDef.h" +#include "RoapLog.h" + //#include //#include //#include #include -#include "RoapHttpHandler.h" -#include "RoapConnection.h" -#include "RoapResponse.h" -#include "RoapObserver.h" -#include "RoapDef.h" -#include "RoapLog.h" - -#include "buffercontainers.h" - using namespace Roap; @@ -43,8 +39,12 @@ // The time out value in HTTP, 30 sec LOCAL_D const TInt KRoapTimeoutValue = 60000000; -_LIT8( KTestUserName, "" ); -_LIT8( KTestPassword, "" ); +_LIT8( KTestUserName, "iopvf" ); +_LIT8( KTestPassword, "r72005" ); +/* +_LIT8( KTestUserName, "moria" ); +_LIT8( KTestPassword, "mellon" ); +*/ // ================= MEMBER FUNCTIONS ======================= @@ -564,7 +564,6 @@ { LOG( _L("HTTP event ERedirectRequiresConfirmation received") ); iTransaction.SubmitL(); - break; } default: @@ -642,13 +641,13 @@ if ( iResponse->iDataType == TDataType( KMultipartRelatedType ) ) { - DRM::CPathContainer* tempPath( DRM::CPathContainer::NewLC() ); - DRM::CFileNameContainer* fileName( DRM::CFileNameContainer::NewLC() ); + TPath tempPath; + TFileName fileName; TInt maxSize( 0 ); if ( iObserver ) { - iObserver->ContentDownloadInfoL( tempPath->iBuffer, fileName->iBuffer, maxSize ); + iObserver->ContentDownloadInfoL( tempPath, fileName, maxSize ); } boundaryStr = srtPool.StringF( HttpFilterCommonStringsExt::EBoundary, @@ -667,10 +666,8 @@ LOG( _L("Error: multipart boundary missing") ); User::Leave( KErrRoapGeneral ); } - iResponse->SetDcfPathL( tempPath->iBuffer ); - iResponse->SetContentNameL( fileName->iBuffer ); - CleanupStack::PopAndDestroy( fileName ); - CleanupStack::PopAndDestroy( tempPath ); + iResponse->SetDcfPathL( tempPath ); + iResponse->SetContentNameL( fileName ); iReportBytes = ETrue; if ( iObserver ) diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/roap/src/RoapSigner.cpp --- a/omadrm/drmengine/roap/src/RoapSigner.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/roap/src/RoapSigner.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -185,9 +185,7 @@ ptr.Copy( aResponse.Left( startPoint ) ); ptr.Append( aResponse.Right( aResponse.Length() - endPoint ) ); - CleanupStack::PushL( tempMessage ); - iResponses.AppendL ( tempMessage ); - CleanupStack::Pop( tempMessage ); + iResponses.Append( tempMessage ); iHash->Reset(); for ( i = 0; i < iResponses.Count(); i++ ) { @@ -292,9 +290,7 @@ CleanupStack::PopAndDestroy( s ); CleanupStack::PopAndDestroy( signature ); - CleanupStack::PushL( r ); - iRequests.AppendL ( r->Des().AllocL() ); - CleanupStack::Pop( r ); + iRequests.Append( r->Des().AllocL() ); return r; } diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/server/inc/DRMRightsServer.h --- a/omadrm/drmengine/server/inc/DRMRightsServer.h Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/server/inc/DRMRightsServer.h Wed Sep 01 12:21:16 2010 +0100 @@ -22,7 +22,7 @@ // INCLUDES #include #include -#include +#include #include "drmcommonclientserver.h" #include "DRMReplayCache.h" #include "drmmeteringdb.h" diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/server/src/DRMRightsClient.cpp --- a/omadrm/drmengine/server/src/DRMRightsClient.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/server/src/DRMRightsClient.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -19,6 +19,7 @@ // INCLUDE FILES #include #include +#include #include "DRMRightsClient.h" #include "DRMEngineClientServer.h" #include "DrmPermission.h" @@ -157,11 +158,23 @@ } #ifdef __DRM_FULL - // startup code, if it starts it starts if not it will be tried again. - RDRMHelper helper; - TInt ignore = helper.Connect(); // Start HelperServer - helper.Close(); -#endif + + TRAP( ret, FeatureManager::InitializeLibL() ); + + if ( !ret && FeatureManager::FeatureSupported( KFeatureIdFfOmadrm1FullSupport ) ) + { + // startup code, if it starts it starts if not it will be tried again. + RDRMHelper helper; + TInt ignore = helper.Connect(); // Start HelperServer + helper.Close(); + } + + if ( !ret ) + { + FeatureManager::UnInitializeLib(); + } + +#endif DRMLOG2( _L( "RDRMRightsClient::Connect(): Result: %d" ), ret ); @@ -841,9 +854,7 @@ Mem::Copy( &roSize, ptr.Ptr()+offset, sizeof(TInt) ); offset += sizeof (TInt); ro = ptr.Mid(offset, roSize).AllocL(); - CleanupStack::PushL( ro ); - aRoList.AppendL (ro); - CleanupStack::Pop( ro ); + aRoList.Append(ro); offset += roSize; } CleanupStack::PopAndDestroy(); diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmengine/server/src/drmrightsdb.cpp --- a/omadrm/drmengine/server/src/drmrightsdb.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmengine/server/src/drmrightsdb.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -22,6 +22,7 @@ #include // Type definitions #include // MD5 Algorithm // #include // Disk space checking +#include // Feature Manager #include #include #include @@ -70,8 +71,10 @@ // LOCAL CONSTANTS AND MACROS #ifdef RD_MULTIPLE_DRIVE // Backup Directory +#ifdef __DRM_OMA2 _LIT( KBackupDir, "%c:\\private\\101F51F2\\backup\\" ); #endif +#endif _LIT(KJavaExtension, ".jar"); @@ -90,16 +93,8 @@ _LIT(KCorruptionFlagFile, "invalid"); #ifdef __DRM_OMA2 -const TInt KMaxUDTDataSize = 256; -const TInt KDeviceDataSize = 256; const TInt KDeviceDataBlock = 128; -#else -const TInt KMaxUDTDataSize = 0; -const TInt KDeviceDataSize = 0; -const TInt KDeviceDataBlock = 0; #endif -const TInt KUdtDataPos = 4 + KDeviceDataSize; - const TInt KEncryptionKeySize = 16; const TInt KMaxEncryptionSize = 8192; @@ -112,8 +107,10 @@ // MODULE DATA STRUCTURES // LOCAL FUNCTION PROTOTYPES +#ifdef __DRM_OMA2 LOCAL_C void CleanupData( TAny* aPtr ); LOCAL_C void WriteIntToBlock( TInt aValue, TDes8& aBlock, TInt aOffset ); +#endif LOCAL_C void DeleteObject( TAny* aObject ); // FORWARD DECLARATIONS @@ -125,6 +122,7 @@ // Used to catch errors and delete the file if it's needed // ----------------------------------------------------------------------------- // +#ifdef __DRM_OMA2 LOCAL_C void CleanupData( TAny* aPtr ) { CDRMRightsDB* rdb = reinterpret_cast( aPtr ); @@ -140,7 +138,7 @@ aBlock[aOffset + 2] = (aValue & 0x0000ff00) >> 8; aBlock[aOffset + 3] = (aValue & 0x000000ff); } - +#endif // ---------------------------------------------------------------------------- // DeleteObject // Deletes the file by TFileName presented by aHandle @@ -207,6 +205,9 @@ } InitializeDatabaseL(); + + FeatureManager::InitializeLibL(); + }; // ----------------------------------------------------------------------------- @@ -272,6 +273,8 @@ } iMemStream.Close(); + + FeatureManager::UnInitializeLib(); DRMLOG( _L( "RDB Closing." ) ); }; @@ -1155,6 +1158,16 @@ HBufC8* CDRMRightsDB::GetUdtDataLC() { #ifdef __DRM_OMA2 + + if ( ! ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) ) + { + User::Leave( KErrNotSupported ); + } + + const TInt KMaxUDTDataSize( 256 ); + const TInt KDeviceDataSize( 256 ); + const TInt KUdtDataPos = 4 + KDeviceDataSize; + HBufC8* udtData = HBufC8::NewMaxLC( KMaxUDTDataSize ); TFileName backupFile; RFile input; @@ -1210,6 +1223,12 @@ #endif // __DRM_OMA2 { #ifdef __DRM_OMA2 + + if ( ! ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) ) + { + User::Leave( KErrNotSupported ); + } + TFileName backupFile; RFile input; HBufC8* keyData = NULL; @@ -1445,7 +1464,10 @@ stream.WriteInt32L( fileSize ); #ifdef __DRM_OMA2 - AddUDTDataL( stream ); + if ( FeatureManager::FeatureSupported ( KFeatureIdFfOmadrm2Support ) ) + { + AddUDTDataL( stream ); + } #endif encIV.SetLength(KEncryptionKeySize); @@ -1692,13 +1714,20 @@ // void CDRMRightsDB::RestoreContentFromFileL( RFile& aBackupFile, const TDesC8& aEncryptionKey, - const TInt aMode ) + const TInt aMode ) { + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreContentFromFileL\n\r")); TInt8 continueMarker = 1; TBuf8<16> key; TBuf8<16> encryptionKey; TInt permissions = 0; + + // Default values when OMA2 DRM is not supported + TInt maxUDTDataSize( 0 ); + TInt deviceDataSize( 0 ); + TInt udtDataPos( 4 + deviceDataSize ); + CDRMPermission* permission = CDRMPermission::NewLC(); CDRMCommonData *commonData = NULL; CDRMPointerArray *permissionArray = CDRMPointerArray::NewLC(); @@ -1709,11 +1738,19 @@ TInt size = 0; TInt dataLeft = 0; TPtr8 keyData(NULL,0,0); - + +#ifdef __DRM_OMA2 + if ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) + { + maxUDTDataSize = 256; + deviceDataSize = 256; + udtDataPos = 4 + deviceDataSize; + } +#endif + // maintain knowledge about stateful rights not being restored TBool stateful = EFalse; - DRMLOG( _L( "CDRMRightsDB::RestoreContentFromFileL ->" ) ); // Indicate that the DB is updated @@ -1761,7 +1798,7 @@ // Check that the decryption works, if it doesn't then the // key is faulty User::LeaveIfError( aBackupFile.Size( readPos ) ); - if( readPos < KUdtDataPos+KMaxUDTDataSize+(KEncryptionKeySize*2) ) + if( readPos < udtDataPos+maxUDTDataSize+(KEncryptionKeySize*2) ) { // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreContentFromFileL : corrupt\n\r")); User::Leave(KErrCorrupt); @@ -1790,7 +1827,7 @@ //----------------------------------------------------------------------- // Duplicate file handle - readPos = KUdtDataPos+KMaxUDTDataSize; + readPos = udtDataPos+maxUDTDataSize; User::LeaveIfError( fileHandle.Seek( ESeekStart, readPos ) ); iMemStream.Close(); @@ -1887,7 +1924,6 @@ } } - // Encrypt the key if( keyExists ) { @@ -1953,9 +1989,6 @@ User::Leave( KErrGeneral ); } - - - if( insertPerm == -1 ) // Add everything no checks needed { for( TInt count = 0; count < permissions; count++ ) @@ -2012,7 +2045,6 @@ } - for( TInt count = 0; count < permissions; count++ ) { if( dataLeft < 4 ) @@ -2109,6 +2141,7 @@ { User::Leave( KErrPermissionDenied ); } + }; @@ -2262,6 +2295,13 @@ #endif // __DRM_OMA2 { #ifdef __DRM_OMA2 + + if ( ! ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) ) + { + User::Leave( KErrNotSupported ); + } + + const TInt KMaxUDTDataSize( 256 ); TBuf8 serialNumber; TBuf8 buffer; TUint8* ptr = const_cast(buffer.Ptr()); @@ -2432,6 +2472,12 @@ void CDRMRightsDB::CreateDummyUDTFileL() { #ifdef __DRM_OMA2 + + if ( ! ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) ) + { + User::Leave( KErrNotSupported ); + } + TFileName backupFile; RFile input; TInt fileSize = 4 + 256 + 256; @@ -2461,6 +2507,12 @@ void CDRMRightsDB::CleanUdtData() { #ifdef __DRM_OMA2 + + if ( ! ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) ) + { + return; + } + TFileName backupFile; #ifndef RD_MULTIPLE_DRIVE diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmhelper/group/Drmhelper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmhelper/group/Drmhelper.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,112 @@ +/* +* 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(ARMCC) +deffile ../EABI/ +#elif defined( WINSCW ) +deffile ../BWINSCW/ +#elif defined( WINS ) +deffile ../bwins/ +#else +deffile ../bmarm/ +#endif + +SMPSAFE diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmhelper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmhelper/group/bld.inf Wed Sep 01 12:21:16 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: Project definition for DRMHelper +* +*/ + + + +PRJ_PLATFORMS +DEFAULT -ARMI + +PRJ_MMPFILES + +DRMHelper.mmp + +// End of File + diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmhelper/group/drmhelper.pro --- a/omadrm/drmhelper/group/drmhelper.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ - -# -# 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 1221b68b8a5f -r 1481bf457703 omadrm/drmhelper/src/drmhelper.cpp --- a/omadrm/drmhelper/src/drmhelper.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmhelper/src/drmhelper.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -25,6 +25,7 @@ #include "DcfCommon.h" #include "DRMHelperDownloadManager.h" +#include #include #include #include @@ -59,12 +60,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 @@ -82,15 +83,25 @@ #include "DRMRIContext.h" #include "DRMDomainContext.h" +#include +#include +#include +#include + // publish & subrscibe #include #include - -//connectivity logic -#include // RCmConnectionMethod -#include // RCmDestination -#include // RCmManager +#ifdef __SERIES60_NATIVE_BROWSER +#include +#endif + +#ifndef __SERIES60_NATIVE_BROWSER +const TUid KCRUidBrowser = {0x10008D39}; +const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; +const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; +#endif + // EXTERNAL DATA STRUCTURES @@ -158,65 +169,32 @@ }; // ============================= LOCAL FUNCTIONS =============================== -// ----------------------------------------------------------------------------- -// HasDefaultConnectionL -// Finds default IAP id -// @return Etrue: valid AP found -// EFalse: valid AP not found -// @leave system wide error codes + +// ----------------------------------------------------------------------------- +// IapIdOfDefaultSnapL +// for trapping purposes only // ----------------------------------------------------------------------------- // -LOCAL_C TBool HasDefaultConnectionL() - { - TBool hasDefault(EFalse); - TCmDefConnValue defConn; - RCmManager cmManager; - cmManager.OpenLC(); - cmManager.ReadDefConnL(defConn); - if (defConn.iType == ECmDefConnConnectionMethod) - { - cmManager.GetConnectionMethodInfoIntL(defConn.iId, - CMManager::ECmIapId); - hasDefault = ETrue; - } - else if (defConn.iType == ECmDefConnDestination) - { - RCmDestination dest(cmManager.DestinationL(defConn.iId)); - CleanupClosePushL(dest); - - if (dest.ConnectionMethodCount() <= 0) - { - User::Leave(KErrNotFound); - } - - RCmConnectionMethod cMeth(dest.ConnectionMethodL(0)); - CleanupClosePushL(cMeth); - - cMeth.GetIntAttributeL(CMManager::ECmIapId); - CleanupStack::PopAndDestroy(&cMeth); - CleanupStack::PopAndDestroy(&dest); - hasDefault = ETrue; - } - CleanupStack::PopAndDestroy(&cmManager); - return hasDefault; - } - -// ----------------------------------------------------------------------------- -// HasAccessPointsL -// ----------------------------------------------------------------------------- -// -LOCAL_C TBool HasAccessPointsL() - { - TInt apCount(0); - RCmManager cmManager; - CleanupClosePushL(cmManager); - cmManager.OpenL(); - RArray aps; - CleanupClosePushL(aps); - cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue); - apCount = aps.Count(); - CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager - return apCount > 0; +LOCAL_C TUint32 IapIdOfDefaultSnapL( + RCmManager& aCmManager, + const TUint32 aDefaultSnap ) + { + RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); + CleanupClosePushL( dest ); + TUint32 iapIdOfDest( 0 ); + + if ( dest.ConnectionMethodCount() <= 0 ) + { + User::Leave( KErrNotFound ); + } + + RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); + CleanupClosePushL( cMeth ); + + iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); + CleanupStack::PopAndDestroy( &cMeth ); + CleanupStack::PopAndDestroy( &dest ); + return iapIdOfDest; } // ----------------------------------------------------------------------------- @@ -862,6 +840,7 @@ FeatureManager::UnInitializeLib(); + delete iSchemeHandler; delete iEventProvider; } @@ -2360,7 +2339,13 @@ if ( buttonCode == EAknSoftkeyYes ) { // check if there are any APs defined - TBool APs( HasAccessPointsL() ); + RCmManager cmManager; + cmManager.OpenLC(); + RArray aps; + CleanupClosePushL( aps ); + cmManager.ConnectionMethodL( aps, EFalse, EFalse, ETrue ); + TUint32 APs( aps.Count() ); + CleanupStack::PopAndDestroy( 2, &cmManager ); //aps, cmManager if ( !APs ) { // No AP defined @@ -2445,17 +2430,43 @@ } -// ----------------------------------------------------------------------------- -// CDRMHelper::CheckRightsPercentL -// Note: obsolete function name kept only -// to avoid SC break on Helper selection logic -// ----------------------------------------------------------------------------- -// TBool CDRMHelper::BrowserAPDefinedL() { - TBool apFound( EFalse ); - TRAP_IGNORE( apFound = HasDefaultConnectionL() ); - return apFound; + const TInt KDestinationSelectionMode( 2 ); + TInt err( KErrNone ); + TInt ap( 0 ); + TInt alwaysAsk( 0 ); + TInt defaultSnap( 0 ); + + CRepository* repository( CRepository::NewL( KCRUidBrowser ) ); + repository->Get( KBrowserDefaultAccessPoint, ap ); + repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); + repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); + delete repository; + if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) + { + alwaysAsk = ETrue; + } + else + { + RCmManager cmManager; + cmManager.OpenLC(); + if ( !alwaysAsk ) + { + TRAP( err, cmManager.GetConnectionMethodInfoIntL( + ap, CMManager::ECmIapId ) ); + } + else if ( alwaysAsk == KDestinationSelectionMode ) + { + TRAP( err, IapIdOfDefaultSnapL( cmManager, defaultSnap ) ); + } + CleanupStack::PopAndDestroy( &cmManager ); + if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) + { + return ETrue; + } + } + return EFalse; } @@ -3616,9 +3627,9 @@ { ptr[index++] = ( unsigned char ) (*aUrl)[i]; } - + ptr[index] = ( unsigned char ) KMarker()[0]; - + CleanupStack::PopAndDestroy( localIDBuf ); } @@ -5548,14 +5559,25 @@ i = 0; } - // convert given URL to QUrl format - DRM::CDrmBrowserLauncher* browserLauncher = DRM::CDrmBrowserLauncher::NewLC(); - - browserLauncher->LaunchUrlL(ptr); - - CleanupStack::PopAndDestroy(); // browserLauncher - - + 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; + // delete newUrl if needed if ( newUrl ) { @@ -5585,7 +5607,7 @@ CAknLaunchAppService* launchAppService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ); - + CleanupStack::PushL( launchAppService ); iWait.Start(); @@ -7011,21 +7033,27 @@ EXPORT_C TInt CDRMHelper::SupportedDRMMethods2( TInt& aDRMMethod, TDRMHelperOMALevel& aOMALevel) { -#ifndef __DRM_FULL - aDRMMethod = CDRMHelper::EForwardLock; -#else - aDRMMethod = - CDRMHelper::EForwardLock | - CDRMHelper::ECombinedDelivery | - CDRMHelper::ESeparateDelivery | - CDRMHelper::ESuperDistribution; + if ( !( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm1FullSupport ) ) ) + { + aDRMMethod = CDRMHelper::EForwardLock; + } + else + { + aDRMMethod = + CDRMHelper::EForwardLock | + CDRMHelper::ECombinedDelivery | + CDRMHelper::ESeparateDelivery | + CDRMHelper::ESuperDistribution; + aOMALevel = EOMA_1_0; + } + #ifdef __DRM_OMA2 - aOMALevel = EOMA_2_0; -#else - aOmaLevel = EOMA_1_0; + if ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) + { + aOMALevel = EOMA_2_0; + } #endif // __DRM_OMA2 -#endif // __DRM_FULL return KErrNone; } @@ -7036,11 +7064,17 @@ // void CDRMHelper::HandleServerAppExit( TInt aReason ) { - if ( aReason == EAknCmdExit ) + if ( aReason == EAknCmdExit && !iSchemeHandler ) { CAknEnv::RunAppShutter(); } + if ( iSchemeHandler ) + { + delete iSchemeHandler; + iSchemeHandler = NULL; + } + if ( iWait.IsStarted() ) { iWait.AsyncStop(); diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp --- a/omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -26,6 +26,7 @@ // 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 1221b68b8a5f -r 1481bf457703 omadrm/drmlicensemanager/group/DRMLicenseManager.mmp --- a/omadrm/drmlicensemanager/group/DRMLicenseManager.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmlicensemanager/group/DRMLicenseManager.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -26,6 +26,7 @@ // 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 1221b68b8a5f -r 1481bf457703 omadrm/drmlicensemanager/group/drm_lm_bat.mmp --- a/omadrm/drmlicensemanager/group/drm_lm_bat.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmlicensemanager/group/drm_lm_bat.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -23,6 +23,7 @@ // 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmfilter/group/HTTPFilterDRM.mmp --- a/omadrm/drmplugins/drmfilter/group/HTTPFilterDRM.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmfilter/group/HTTPFilterDRM.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -35,7 +35,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE - +SYSTEMINCLUDE /epoc32/include/ecom SOURCEPATH ../data @@ -46,6 +46,7 @@ END LIBRARY euser.lib ecom.lib http.lib bafl.lib estlib.lib efsrv.lib estor.lib cone.lib commonui.lib caf.lib +LIBRARY featmgr.lib #ifndef __DRM_NO_BB MACRO BLOCK_BY_BLOCK diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp --- a/omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -217,7 +217,7 @@ //------------------------------------------------------------------------ // CHTTPFilterDRM::MHFRunL -// See MHTTPFilterBase::MHFRunL +// See MHTTPFilterBase::MHFRunL //------------------------------------------------------------------------ // void CHTTPFilterDRM::MHFRunL( RHTTPTransaction aTransaction, @@ -320,7 +320,7 @@ case KErrCANoRights: case KErrCorrupt: { - error = NW_STAT_FAILURE; //Unable to perform operation + error = NW_STAT_FAILURE; //Unable to perform operation } break; case KErrArgument: @@ -461,10 +461,10 @@ // CHTTPFilterDRM::CheckHeadersL // Check HTTP headers and extract MIME type //------------------------------------------------------------------------ -// +// void CHTTPFilterDRM::CheckHeadersL( const RHTTPTransaction& aTrans ) { - // read the header data and check the MIME type here + // read the header data and check the MIME type here // check the status and body RHTTPResponse response = aTrans.Response(); TInt status = response.StatusCode(); @@ -512,17 +512,14 @@ drmData = CHTTPFilterDRMDataSupplier::NewL( aTrans.Id(), response.Body(), const_cast ( this ) ); /** Support for Hutchinson's content protection scheme, CFM - * + * */ drmData->SetProcessedContentType( EStandardDRMContent ); /** * */ - CleanupStack::PushL( drmData ); - iDataSups.AppendL ( drmData ); - CleanupStack::Pop( drmData ); + iDataSups.Append( drmData ); response.SetBody( *drmData ); - // change the mime type to "application/vnd.oma.drm.content" headers.RemoveField( fieldNameStr ); @@ -569,9 +566,7 @@ = CHTTPFilterDRMDataSupplier::NewL( aTrans.Id(), response.Body(), const_cast ( this ) ); - CleanupStack::PushL( drmData ); - iDataSups.AppendL ( drmData ); - CleanupStack::Pop( drmData ); + iDataSups.Append( drmData ); } } @@ -635,7 +630,7 @@ // Do not encrypt JAD files: if ( headers.GetField( fieldNameStr, 0, fieldVal ) == KErrNone ) { - // If it is a JAD always ignore any of the above: + // If it is a JAD always ignore any of the above: const TBuf8 JADStringBuf( KJADString ); RStringF JADValue = strP.OpenFStringL( JADStringBuf ); CleanupClosePushL( JADValue ); @@ -667,13 +662,10 @@ User::Leave( KErrUnknown ); } - CleanupStack::PushL( drmData ); - iDataSups.AppendL ( drmData ); - CleanupStack::Pop( drmData ); - + iDataSups.Append( drmData ); response.SetBody( *drmData ); - /// + /// RStringF DRMValue1 = strP.OpenFStringL( DRMStringBuf1 ); CleanupClosePushL( DRMValue1 ); diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmfilter/src/HTTPFilterDRMDataSupplier.cpp --- a/omadrm/drmplugins/drmfilter/src/HTTPFilterDRMDataSupplier.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmfilter/src/HTTPFilterDRMDataSupplier.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,10 @@ //------------------------------------------------------------------------ +#ifdef __DRM_FULL const TInt KMinContentSizeToGetTheURI = 520; +#endif + const TInt KDefaultSize( 2048 ); const TInt KWholeDataPart( -1 ); @@ -110,6 +114,8 @@ Attach( iMemBuf ); iDRMMessageParser->InitializeMessageParserL( *this ); + + FeatureManager::InitializeLibL(); } @@ -131,6 +137,9 @@ iDRMOma1DcfCreator = COma1DcfCreator::NewL(); Attach( iMemBuf ); + + FeatureManager::InitializeLibL(); + } // ----------------------------------------------------------------------------- @@ -183,6 +192,9 @@ delete iDRMOma1DcfCreator; iDRMOma1DcfCreator = NULL; } + + FeatureManager::UnInitializeLib(); + } // ----------------------------------------------------------------------------- @@ -456,6 +468,13 @@ #ifdef __DRM_FULL void CHTTPFilterDRMDataSupplier::SetEstimatedArrivalTime( TInt aXOmaHeaderVal ) { + + if ( !( FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm1FullSupport ) ) ) + { + return; + } + // get the data part ContentAccess::CManager* manager = NULL; ContentAccess::TAgent agent; diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrecognizer/group/RecDRM.mmp --- a/omadrm/drmplugins/drmrecognizer/group/RecDRM.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmrecognizer/group/RecDRM.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -32,7 +32,7 @@ // Default system include paths for middleware layer modules. MW_LAYER_SYSTEMINCLUDE - +systeminclude /epoc32/include/ecom source RecDRM.cpp @@ -47,5 +47,6 @@ library EUSER.LIB library APMIME.LIB +library featmgr.lib SMPSAFE diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrecognizer/src/101F51F4.RSS --- a/omadrm/drmplugins/drmrecognizer/src/101F51F4.RSS Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmrecognizer/src/101F51F4.RSS Wed Sep 01 12:21:16 2010 +0100 @@ -16,7 +16,7 @@ */ -#include +#include RESOURCE REGISTRY_INFO r_registry { dll_uid = 0x101F51F4; diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrecognizer/src/RecDRM.cpp --- a/omadrm/drmplugins/drmrecognizer/src/RecDRM.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmrecognizer/src/RecDRM.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -21,6 +21,7 @@ #include #include #include +#include #include "RecDRM.h" @@ -39,6 +40,8 @@ const TInt KMaxBufferLength=256; const TInt KDCFHeaderLength=3; + +#ifdef DRM_OMA2_ENABLED const TInt KLengthBoxSize = 4; const TInt KLengthBoxType = 4; const TInt KLengthBoxSize64 = 8; @@ -50,6 +53,7 @@ _LIT8(KRoapTriggerElement, "roap-trigger:roapTrigger"); // before OMA spec CR, ROAP Trigger namespace prefix was roap-trigger _LIT8(KRoapTriggerElement2, "roap:roapTrigger"); _LIT8(KRoapTriggerType, "application/vnd.oma.drm.roap-trigger+xml"); +#endif const TImplementationProxy ImplementationTable[] = { @@ -89,12 +93,14 @@ CApaDRMRecognizer::~CApaDRMRecognizer() { + FeatureManager::UnInitializeLib(); } CApaDataRecognizerType* CApaDRMRecognizer::CreateRecognizerL() { - return new (ELeave) CApaDRMRecognizer (); + FeatureManager::InitializeLibL(); + return new (ELeave) CApaDRMRecognizer (); } @@ -131,22 +137,25 @@ #endif #ifdef DRM_OMA2_ENABLED - // Recognize ROAP Trigger - if ( RecognizeRoapTrigger( aBuffer ) ) - { - return; - } - - // Recognize DCFv2 - if ( RecognizeODF( aBuffer ) ) - { - return; - } -#endif - // Recognize DCFv1 - TUint8 version = aBuffer[0]; - TUint8 contentTypeLen = aBuffer[1]; - TUint8 contentURILen = aBuffer[2]; + if( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) + { + // Recognize ROAP Trigger + if ( RecognizeRoapTrigger( aBuffer ) ) + { + return; + } + + // Recognize DCFv2 + if ( RecognizeODF( aBuffer ) ) + { + return; + } + } +#endif + // Recognize DCFv1 + TUint8 version = aBuffer[0]; + TUint8 contentTypeLen = aBuffer[1]; + TUint8 contentURILen = aBuffer[2]; if ( contentTypeLen < KMinContentTypeLen || contentURILen == 0 ) { @@ -177,6 +186,12 @@ #ifdef DRM_OMA2_ENABLED TBool CApaDRMRecognizer::RecognizeRoapTrigger( const TDesC8& aBuffer ) { + if( ! ( FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) ) + { + return EFalse; + } + if ( aBuffer.FindF( KRoapTriggerElement() ) != KErrNotFound || aBuffer.FindF( KRoapTriggerElement2() ) != KErrNotFound ) { @@ -189,54 +204,61 @@ TBool CApaDRMRecognizer::RecognizeODF( const TDesC8& aBuffer ) { - if ( aBuffer.Size() < 24 ) return EFalse; - TPtrC8 ftypPrefix = aBuffer.Mid( 4, KFTypPrefix().Length() ); - if ( KFTypPrefix().CompareF( ftypPrefix ) == KErrNone ) - { - TPtrC8 odfPrefix = aBuffer.Mid( 8, KODFPrefix().Length() ); - if ( KODFPrefix().CompareF( odfPrefix ) == KErrNone ) + + if( ! ( FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) ) { - TBuf8<4> buffer; - TUint32 size; - TPtr8 ptr(NULL, 0); - TUint32 offset(20); - - // ODRM box header - buffer.Zero(); - buffer.Copy( aBuffer.Mid( offset, 4 )); - size = ReadUint32FromBlock( buffer, 0 ); - offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags; - - if (size == 1) - { - offset += KLengthBoxSize64; - } - if ( aBuffer.Size() < offset+4 ) return EFalse; - - // Discrete headers box header - buffer.Zero(); - buffer.Copy( aBuffer.Mid( offset, 4 )); - size = ReadUint32FromBlock( buffer, 0 ); - offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags; - if ( size == 1 ) - { - offset += KLengthBoxSize64; - } - if ( aBuffer.Size() < offset+1 ) return EFalse; - - // Content type - buffer.Zero(); - buffer.Copy( aBuffer.Mid( offset, 1 )); - if ( aBuffer.Size() < offset + 1 + buffer[0] ) return EFalse; - TPtrC8 mimeType = aBuffer.Mid( offset+1, buffer[0] ); - - iConfidence = ECertain; - iDataType=TDataType( mimeType ); - return ETrue; + return EFalse; } - - } - return EFalse; + + if ( aBuffer.Size() < 24 ) return EFalse; + TPtrC8 ftypPrefix = aBuffer.Mid( 4, KFTypPrefix().Length() ); + if ( KFTypPrefix().CompareF( ftypPrefix ) == KErrNone ) + { + TPtrC8 odfPrefix = aBuffer.Mid( 8, KODFPrefix().Length() ); + if ( KODFPrefix().CompareF( odfPrefix ) == KErrNone ) + { + TBuf8<4> buffer; + TUint32 size; + TPtr8 ptr(NULL, 0); + TUint32 offset(20); + + // ODRM box header + buffer.Zero(); + buffer.Copy( aBuffer.Mid( offset, 4 )); + size = ReadUint32FromBlock( buffer, 0 ); + offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags; + + if (size == 1) + { + offset += KLengthBoxSize64; + } + if ( aBuffer.Size() < offset+4 ) return EFalse; + + // Discrete headers box header + buffer.Zero(); + buffer.Copy( aBuffer.Mid( offset, 4 )); + size = ReadUint32FromBlock( buffer, 0 ); + offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags; + if ( size == 1 ) + { + offset += KLengthBoxSize64; + } + if ( aBuffer.Size() < offset+1 ) return EFalse; + + // Content type + buffer.Zero(); + buffer.Copy( aBuffer.Mid( offset, 1 )); + if ( aBuffer.Size() < offset + 1 + buffer[0] ) return EFalse; + TPtrC8 mimeType = aBuffer.Mid( offset+1, buffer[0] ); + + iConfidence = ECertain; + iDataType=TDataType( mimeType ); + return ETrue; + } + + } + return EFalse; } #endif diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/group/bld.inf Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,33 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/group/crohandler.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/group/crohandler.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,84 @@ +/* +* 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 +LIBRARY featmgr.lib // Feature Manager + +#ifdef RD_MULTIPLE_DRIVE +LIBRARY platformenv.lib +#endif + +SMPSAFE diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/group/rohandler.pri --- a/omadrm/drmplugins/drmrohandler/group/rohandler.pri Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -# -# 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/group/rohandler.pro --- a/omadrm/drmplugins/drmrohandler/group/rohandler.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -# -# 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/inc/CRoHandler.h --- a/omadrm/drmplugins/drmrohandler/inc/CRoHandler.h Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmrohandler/inc/CRoHandler.h Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -239,8 +239,9 @@ // initialised at instantiation DRM::CWbxmlRoapTriggerParser* iWbxmlTriggerParser; HBufC8* iParsedXmlTrigger; - TBool iPutRightsToInbox; // whether received RO is put into Inbox as an + TBool iPutRightsToInbox; // whether received RO is put into Inbox as an // entry or not. Initialized at instantiation. + TBool iFeatureManagerFound; // Feature Manager is succesfully initialized }; diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/inc/RoHandlerStringResourceReader.h --- a/omadrm/drmplugins/drmrohandler/inc/RoHandlerStringResourceReader.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/inc/StringResourceReader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/inc/StringResourceReader.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,71 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/inc/qrohandlerdmgreventhandler.h --- a/omadrm/drmplugins/drmrohandler/inc/qrohandlerdmgreventhandler.h Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h --- a/omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h Wed Sep 01 12:21:16 2010 +0100 @@ -19,23 +19,25 @@ #ifndef ROHANDLERDMGRWRAPPER_H #define ROHANDLERDMGRWRAPPER_H -#include -#include - -#include -#include - -#include -#include -#include +namespace Roap + { + class MRoapObserver; + } class CDRMRights; -class QRoHandlerDMgrEventHandler; + +class MHttpDownloadMgrObserver; class MRoHandlerDMgrWrapper { + public: virtual void HandleRoapTriggerL( const TDesC8& aTrigger ) = 0; + + virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0; + + virtual void DownloadAndHandleRoapTriggerFromPrUrlL( const HBufC8* aUrl ) = 0; + }; /** @@ -44,6 +46,7 @@ */ class CRoHandlerDMgrWrapper: public CActive, // Now active + public MHttpDownloadMgrObserver, public Roap::MRoapObserver, public MRoHandlerDMgrWrapper { @@ -75,6 +78,23 @@ */ void HandleRoapTriggerL( const TDesC8& aTrigger ); + void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); + + void DownloadAndHandleRoapTriggerFromPrUrlL( const HBufC8* aUrl ); + + +// 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 @@ -201,13 +221,6 @@ * @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(); @@ -243,9 +256,8 @@ /** * Download manager session */ - WRT::DownloadManager* iDlMgr; + RHttpDownloadMgr iDlMgr; - WRT::Download* iDownload; /** * Used to make downloads synchronous */ @@ -275,9 +287,6 @@ RFs iFs; HBufC* iFileName; - - QRoHandlerDMgrEventHandler* iRoHandlerDMgrEventHandler; - }; #endif // ROHANDLERDMGRWRAPPER_H diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp --- a/omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -30,6 +30,7 @@ #include // link against centralrepository.lib #include #include +#include #ifdef RD_MULTIPLE_DRIVE #include @@ -38,14 +39,16 @@ #include // TUriParser16 #include // KDC_MTM_RESOURCE_DIR #include // UriUtils and so on +#include // for R_PUSHMISC_UNK_SENDER #include // for R_QTN_DRM_MGR_INB_TITLE #include // Disk space checking +#include // Feature Manager #include "CRoHandler.h" #include "RoMtmCli.h" // for CRightsObjectMtmClient #include "RoapSyncWrapper.h" -#include "RoHandlerStringResourceReader.h" +#include "StringResourceReader.h" #include "rohandlerdmgrwrapper.h" #include "rohandlerinternalcrkeys.h" @@ -98,6 +101,7 @@ _LIT( KRoHandlerTriggerFilePath, "c:\\system\\data\\" ); #endif +_LIT( KPushMtmRes, "PushMtmUi.rsc" ); _LIT( KRoHandlerResourceFile, "RoHandler.rsc" ); _LIT8( KRoapTriggerElement, "roapTrigger" ); @@ -112,8 +116,6 @@ _LIT( KRoAcquisitionPrefix, "ROA:" ); _LIT( KTriggerPrefix, "TRI:" ); -_LIT( KEmpty, " " ); - // MODULE DATA STRUCTURES // Helper class for deleting file with given filename on cleanupstack @@ -397,7 +399,7 @@ ) : CPushHandlerBase(), iFirstTime( ETrue ), iPushMsg( NULL ), iMsvId( NULL ), - iPutRightsToInbox( ETrue ) + iPutRightsToInbox( ETrue ), iFeatureManagerFound( EFalse ) { } @@ -427,7 +429,14 @@ CRepository* repository( NULL ); TInt err( KErrNone ); + TInt ret( KErrNone ); + TRAP( ret, FeatureManager::InitializeLibL() ); + if ( !ret ) + { + iFeatureManagerFound = ETrue; + } + User::LeaveIfError( iFs.Connect() ); // create drm @@ -509,7 +518,12 @@ // session must be deleted last (and constructed first) delete iSession; - + + if ( iFeatureManagerFound ) + { + FeatureManager::UnInitializeLib(); + } + #ifdef _DRM_TESTING TRAP( r, WriteL( _L8( "~CRoHandler-End" ) ) ); #endif @@ -656,26 +670,36 @@ { case EOma1Ro: { - HandleRightsMessageL(); + if ( iFeatureManagerFound && FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm1FullSupport ) ) + { + HandleRightsMessageL(); + } break; } #ifdef __DRM_OMA2 case EOma2RoapTrigger: case EOma2RoapTriggerRoAcquisition: - { - HandleRoapTriggerL(); - break; - } + if ( iFeatureManagerFound && FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) + { + HandleRoapTriggerL(); + } + break; case EOma2RoapTriggerMetering: - { - HandleMeteringTriggerSilentlyL(); + if ( iFeatureManagerFound && FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) + { + HandleMeteringTriggerSilentlyL(); + } break; - } case EOma2RoapPdu: - { - HandleRoapPduL(); + if ( iFeatureManagerFound && FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) + { + HandleRoapPduL(); + } break; - } #endif default: { @@ -779,7 +803,7 @@ ptrToMz.Append( KMarker ); ptrToMz.Append( uri16 ); //add uri16 ptrToMz.Append( KMarker ); - + CleanupStack::PopAndDestroy( number ); CleanupStack::PopAndDestroy( buffer ); CleanupStack::PushL( messageContent ); @@ -1186,10 +1210,10 @@ TRAP( r, WriteL( _L8( "ReadFromResourceLC-fs.Connect" ) ) ); #endif CleanupClosePushL( fs ); - CRoHandlerStringResourceReader* reader( - new ( ELeave ) CRoHandlerStringResourceReader( fs, aFile ) ); + CStringResourceReader* reader( + new ( ELeave ) CStringResourceReader( fs, aFile ) ); #ifdef _DRM_TESTING - TRAP( r, WriteL( _L8( "ReadFromResourceLC-CRoHandlerStringResourceReader" ) ) ); + TRAP( r, WriteL( _L8( "ReadFromResourceLC-CStringResourceReader" ) ) ); #endif CleanupStack::PushL( reader ); aBuf = reader->AllocReadResourceL( aIndex ); @@ -1218,7 +1242,28 @@ // First line in Inbox: TMsvEntry::iDetails. if ( !flag || srvAddress.Length() == 0 ) { - result = KEmpty().AllocL(); + // Read from resource. + +#ifndef RD_MULTIPLE_DRIVE + + TFileName resourceFile( KDriveZ ); + +#else //RD_MULTIPLE_DRIVE + + _LIT( KDriveRoot, "%c:" ); + TInt driveNumber( -1 ); + TChar driveLetter; + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); + iFs.DriveToChar( driveNumber, driveLetter ); + + TFileName resourceFile; + resourceFile.Format( KDriveRoot, (TUint )driveLetter ); + +#endif + + resourceFile.Append( KDC_MTM_RESOURCE_DIR ); + resourceFile.Append( KPushMtmRes ); + ReadFromResourceLC( resourceFile, R_PUSHMISC_UNK_SENDER, result ); } else { @@ -1378,22 +1423,30 @@ switch( iMsgType ) { case EOma1Ro: - { - HandleRightsMessageL(); + { + if ( iFeatureManagerFound && FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm1FullSupport ) ) + { + HandleRightsMessageL(); + } break; } #ifdef __DRM_OMA2 case EOma2RoapTrigger: case EOma2RoapTriggerRoAcquisition: - { - HandleRoapTriggerL(); + if ( iFeatureManagerFound && FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) + { + HandleRoapTriggerL(); + } break; - } case EOma2RoapPdu: - { - HandleRoapPduL(); + if ( iFeatureManagerFound && FeatureManager::FeatureSupported( + KFeatureIdFfOmadrm2Support ) ) + { + HandleRoapPduL(); + } break; - } #endif default: { diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/src/RoHandlerStringResourceReader.cpp --- a/omadrm/drmplugins/drmrohandler/src/RoHandlerStringResourceReader.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* -* 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/src/StringResourceReader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmplugins/drmrohandler/src/StringResourceReader.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,253 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/src/qrohandlerdmgreventhandler.cpp --- a/omadrm/drmplugins/drmrohandler/src/qrohandlerdmgreventhandler.cpp Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ - -#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 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp --- a/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 - 2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008 - 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" @@ -21,6 +21,10 @@ #include #include +#ifdef __SERIES60_NATIVE_BROWSER +#include +#endif + #include #include #include @@ -32,6 +36,8 @@ #include +#include + #include // tconnectioninfo #include // rconnection rsocket #include @@ -39,15 +45,7 @@ #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 ) @@ -95,6 +93,9 @@ _LIT( KMethConstructL, "ConstructL" ); _LIT( KMethNewL, "NewL" ); _LIT( KMethNewLC, "NewLC" ); + _LIT( KMethDownloadAndHandleRoapTriggerL, "DownloadAndHandleRoapTriggerL" ); + _LIT( KMethDownloadAndHandleRoapTriggerFromPrUrlL, + "DownloadAndHandleRoapTriggerFromPrUrlL" ); _LIT( KMethDoDownloadAndHandleRoapTriggerL, "DoDownloadAndHandleRoapTriggerL" ); _LIT( KFormatDoDlHdlRoapTrigL, "DoDownloadAndHandleRoapTriggerL: %S" ); @@ -102,6 +103,7 @@ _LIT( KStrDlFinished, "download finished" ); _LIT( KMethSetDefaultAccessPointL, "SetDefaultAccessPointL" ); + _LIT( KMiIapId, "iIapId" ); _LIT( KMethHandleDMgrEventL, "HandleDMgrEventL" ); _LIT( KFormatMethHandleDMgrEventL, "HandleDMgrEventL %S" ); @@ -114,7 +116,8 @@ _LIT( KStrEConnectionFailed, "EConnectionFailed" ); _LIT( KFormatEDlAttrErrorId, "EDlAttrErrorId = %d" ); - _LIT( KMiState, "iState" ); + _LIT( KMiDownLoadState, "iDownLoadState" ); + _LIT( KMiProgressState, "iProgressState" ); } @@ -132,12 +135,41 @@ //#define LOG2( a, b ) #endif +#ifndef __SERIES60_NATIVE_BROWSER +const TUid KCRUidBrowser = + {0x10008D39}; +const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; +const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; +const TUint32 KBrowserNGDefaultSnapId = 0x00000053; +#endif + // CONSTANTS #ifndef RD_MULTIPLE_DRIVE _LIT( KHelperTriggerFilePath, "d:\\" ); #endif -using namespace WRT; +// ============================== LOCAL FUNCTIONS ============================== + +// --------------------------------------------------------------------------- +// DoResetAndDestroy +// Does RPointerArray< typename >->ResetAndDestroy() for the given array aPtr. +// --------------------------------------------------------------------------- +// +template< typename elemType > +LOCAL_C void DoResetAndDestroy( TAny* aPtr ) + { + ( reinterpret_cast< RPointerArray< elemType >* >( aPtr ) )-> + ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// DeleteHttpDowload +// --------------------------------------------------------------------------- +// +LOCAL_C void DeleteHttpDowload( TAny* aDownload ) + { + reinterpret_cast< RHttpDownload* >( aDownload )->Delete(); + } // --------------------------------------------------------------------------- // UpdateBufferL @@ -157,6 +189,34 @@ } } +// --------------------------------------------------------------------------- +// IapIdOfDefaultSnapL +// for trapping purposes only +// --------------------------------------------------------------------------- +// +LOCAL_C TUint32 IapIdOfDefaultSnapL( + RCmManager& aCmManager, + const TUint32 aDefaultSnap ) + { + RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); + CleanupClosePushL( dest ); + TUint32 iapIdOfDest( 0 ); + + if ( dest.ConnectionMethodCount() <= 0 ) + { + User::Leave( KErrNotFound ); + } + + RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); + CleanupClosePushL( cMeth ); + + iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); + CleanupStack::PopAndDestroy( &cMeth ); + CleanupStack::PopAndDestroy( &dest ); + return iapIdOfDest; + } + + // ============================= MEMBER FUNCTIONS ============================== // --------------------------------------------------------------------------- @@ -179,15 +239,7 @@ DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethConstructL() ); // Get UID from process const TInt KRoHandlerDMgrWrapperUid = 0x101F7B92; - try - { - QString roHandlerDmgrWrapperUid(QString::number(KRoHandlerDMgrWrapperUid)); - iDlMgr = q_check_ptr(new DownloadManager(roHandlerDmgrWrapperUid)); - } - catch(const std::exception& exception) - { - qt_symbian_exception2LeaveL(exception); - } + iDlMgr.ConnectL( TUid::Uid( KRoHandlerDMgrWrapperUid ), *this, EFalse ); User::LeaveIfError( iFs.Connect() ); User::LeaveIfError( iFs.ShareProtected() ); @@ -232,15 +284,24 @@ delete iFileName; delete iRoapEng; - delete iDlMgr; - delete iRoHandlerDMgrEventHandler; - +#ifdef _DEBUG + + if ( iDlMgr.Handle() ) + { + iDlMgr.Close(); + } + +#else + + iDlMgr.Close(); + +#endif + iFs.Close(); - } // --------------------------------------------------------------------------- -// CRoHandlerDMgrWrapper::HandleRoapTriggerL +// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL // --------------------------------------------------------------------------- // void CRoHandlerDMgrWrapper::HandleRoapTriggerL( const TDesC8& aTrigger ) @@ -256,13 +317,50 @@ } // --------------------------------------------------------------------------- +// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL +// --------------------------------------------------------------------------- +// +void CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) + { + DRMDEBUGMETHOD( + RoHdlrDMgrWrDebugLiterals::KMethDownloadAndHandleRoapTriggerL() ); + if ( iState != EInit || iWait.IsStarted() ) + { + User::Leave( KErrNotReady ); + } + + UpdateBufferL< HBufC8, TDesC8 >( iTriggerUrl, *aUrl ); + Continue( EGetMeteringTrigger, KErrNone ); + iWait.Start(); + } + +// --------------------------------------------------------------------------- +// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerFromPrUrlL +// --------------------------------------------------------------------------- +// +void CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerFromPrUrlL( + const HBufC8* aUrl ) + { + DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethDownloadAndHandleRoapTriggerFromPrUrlL() ); + if ( iState != EInit || iWait.IsStarted() ) + { + User::Leave( KErrNotReady ); + } + + UpdateBufferL< HBufC8, TDesC8 >( iTriggerUrl, *aUrl ); + Continue( EGetPrUrlTrigger, KErrNone ); + iWait.Start(); + } + +// --------------------------------------------------------------------------- // CRoHandlerDMgrWrapper::DoDownloadRoapTriggerL // --------------------------------------------------------------------------- // void CRoHandlerDMgrWrapper::DoDownloadRoapTriggerL( TMeterState aNextState ) { RFile roapTrigger; - DRM::CFileNameContainer* triggerFileName(NULL); + TBool result( EFalse ); + TFileName triggerFileName; DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethDoDownloadAndHandleRoapTriggerL() ); // If no Trigger URL then nothing to download. So finish transaction @@ -272,11 +370,10 @@ return; } - triggerFileName=DRM::CFileNameContainer::NewLC(); #ifndef RD_MULTIPLE_DRIVE User::LeaveIfError( roapTrigger.Temp( - iFs, KHelperTriggerFilePath, triggerFileName->iBuffer, EFileWrite ) ); + iFs, KHelperTriggerFilePath, triggerFileName, EFileWrite ) ); #else //RD_MULTIPLE_DRIVE _LIT( KDrive, "%c:\\" ); @@ -285,69 +382,46 @@ DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - DRM::CFileNameContainer* - helperTriggerFilePath( DRM::CFileNameContainer::NewLC() ); - - helperTriggerFilePath->iBuffer.Format( KDrive, ( TUint )driveLetter ); + TFileName helperTriggerFilePath; - User::LeaveIfError( roapTrigger.Temp( iFs, helperTriggerFilePath->iBuffer, - triggerFileName->iBuffer, EFileWrite ) ); - CleanupStack::PopAndDestroy( helperTriggerFilePath ); - helperTriggerFilePath=NULL; + helperTriggerFilePath.Format( KDrive, ( TUint )driveLetter ); + + User::LeaveIfError( roapTrigger.Temp( iFs, helperTriggerFilePath, + triggerFileName, EFileWrite ) ); #endif - UpdateBufferL< HBufC, TFileName >( iFileName, triggerFileName->iBuffer ); - CleanupStack::PopAndDestroy( triggerFileName ); - triggerFileName=NULL; + UpdateBufferL< HBufC, TFileName >( iFileName, triggerFileName ); - 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); - } - + // create and start download + RHttpDownload& download = iDlMgr.CreateDownloadL( *iTriggerUrl, result ); + // Put download for proper cleanup. + TCleanupItem item( DeleteHttpDowload, &download ); + CleanupStack::PushL( item ); + CleanupClosePushL( roapTrigger ); - - DRMDEBUG2( - RoHdlrDMgrWrDebugLiterals::KFormatDoDlHdlRoapTrigL(), - &RoHdlrDMgrWrDebugLiterals::KStrDlCreated() ); - iDownloadSuccess = EFalse; - iConnectionError = EFalse; + if ( result ) + { + DRMDEBUG2( + RoHdlrDMgrWrDebugLiterals::KFormatDoDlHdlRoapTrigL(), + &RoHdlrDMgrWrDebugLiterals::KStrDlCreated() ); + iDownloadSuccess = EFalse; + iConnectionError = EFalse; - SetDefaultAccessPointL(); - - try - { - RBuf fileName; - User::LeaveIfError(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(); - + 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(); + } CleanupStack::PopAndDestroy( &roapTrigger ); + CleanupStack::Pop( &download ); // Left open for DoSaveRoapTrigger } // --------------------------------------------------------------------------- // CRoHandlerDMgrWrapper::DoSaveRoapTriggerL @@ -360,23 +434,15 @@ RoHdlrDMgrWrDebugLiterals::KFormatDoDlHdlRoapTrigL(), &RoHdlrDMgrWrDebugLiterals::KStrDlFinished() ); - 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); - } - + // Fetch download created in DoDownloadRoapTriggerL + RHttpDownload* download = iDlMgr.FindDownload( *iTriggerUrl, KNullDesC8() ); // 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 ) @@ -419,7 +485,8 @@ // And let ROAP handle it... CleanupStack::PopAndDestroy( &readBuf ); CleanupStack::PopAndDestroy( &roapTrigger ); - + CleanupStack::PopAndDestroy( download ); + iFs.Delete( *iFileName ); delete iFileName; iFileName=NULL; @@ -437,7 +504,9 @@ Roap::TDomainOperation domainOperation; RPointerArray< HBufC8 > contentIds; - CleanupResetAndDestroyPushL( contentIds ); + + TCleanupItem cleanup( DoResetAndDestroy< HBufC8 >, &contentIds ); + CleanupStack::PushL( cleanup ); iRoapEng = Roap::CRoapEng::NewL(); @@ -466,12 +535,55 @@ // void CRoHandlerDMgrWrapper::SetDefaultAccessPointL() { + const TInt KDestinationSelectionMode( 2 ); + CRepository* repository( NULL ); + TInt ap( 0 ); + TInt alwaysAsk( 0 ); + TUint32 iapd32( 0 ); + TInt defaultSnap( 0 ); + TInt err( KErrNone ); + DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethSetDefaultAccessPointL() ); - if ( iIapId ) + if ( !iIapId ) { - QVariant iapId((unsigned long long)iIapId); - iDlMgr->setAttribute(DefaultDestinationPath, iapId); + repository = CRepository::NewL( KCRUidBrowser ); + CleanupStack::PushL( repository ); + repository->Get( KBrowserDefaultAccessPoint, ap ); + repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); + repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); + if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) + { + alwaysAsk = ETrue; + } + else + { + RCmManager cmManager; + cmManager.OpenLC(); + if ( !alwaysAsk ) + { + TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL( + ap, CMManager::ECmIapId ) ); + } + else if ( alwaysAsk == KDestinationSelectionMode ) + { + TRAP( err, iapd32 = IapIdOfDefaultSnapL( + cmManager, defaultSnap ) ); + } + CleanupStack::PopAndDestroy( &cmManager ); + } + if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) + { + iIapId = iapd32; + DRMDEBUG3( RoHdlrDMgrWrDebugLiterals::KFormatMembValInt(), + &RoHdlrDMgrWrDebugLiterals::KMiIapId(), iIapId ); + err = iDlMgr.SetIntAttribute( EDlMgrIap, iapd32 ); + } + CleanupStack::PopAndDestroy( repository ); + } + else + { + err = iDlMgr.SetIntAttribute( EDlMgrIap, iIapId ); } } @@ -496,41 +608,48 @@ // CRoHandlerDMgrWrapper::HandleDMgrEventL // --------------------------------------------------------------------------- // -void CRoHandlerDMgrWrapper::HandleDownloadEventL( WRT::DownloadEvent* aEvent ) +void CRoHandlerDMgrWrapper::HandleDMgrEventL( RHttpDownload& aDownload, + THttpDownloadEvent aEvent ) { - QString KDRMHelperMimeTypeROAPTrigger("application/vnd.oma.drm.roap-trigger+xml" ); + _LIT8( KDRMHelperMimeTypeROAPTrigger, "application/vnd.oma.drm.roap-trigger+xml" ); DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethHandleDMgrEventL() ); DRMDEBUG3( RoHdlrDMgrWrDebugLiterals::KFormatMembValInt(), - &RoHdlrDMgrWrDebugLiterals::KMiState(), aEvent->type() ); - - if ( aEvent->type() == DownloadEvent::HeadersReceived ) + &RoHdlrDMgrWrDebugLiterals::KMiDownLoadState(), aEvent.iDownloadState ); + DRMDEBUG3( RoHdlrDMgrWrDebugLiterals::KFormatMembValInt(), + &RoHdlrDMgrWrDebugLiterals::KMiProgressState(), aEvent.iProgressState ); + + if ( aEvent.iProgressState == EHttpContentTypeReceived ) { DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), &RoHdlrDMgrWrDebugLiterals::KStrEHttpContentTypeReceived() ); // check received mimetype - QString contentType = iDownload->attribute( ContentType).toString(); - if ( contentType.contains( KDRMHelperMimeTypeROAPTrigger ) == EFalse ) + RBuf8 contentType; + contentType.CleanupClosePushL(); + contentType.CreateL( KMaxContentTypeLength ); + User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrContentType, + contentType ) ); + if ( !contentType.FindF( KDRMHelperMimeTypeROAPTrigger ) ) { // ROAP trigger found, continue download - iDownload->start(); + User::LeaveIfError( aDownload.Start() ); } else { // wrong MIME type?, stop download iDownloadSuccess = EFalse; - iDownload->cancel(); + User::LeaveIfError( aDownload.Delete() ); } CleanupStack::PopAndDestroy( &contentType ); } - if ( aEvent->type() == DownloadEvent::Created ) + if ( aEvent.iDownloadState == EHttpDlCreated ) { DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlCreated() ); } else - if ( aEvent->type() == DownloadEvent::NetworkLoss ) + if ( aEvent.iProgressState == EHttpProgDisconnected ) { DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), &RoHdlrDMgrWrDebugLiterals::KStrEHttpProgDisconnected() ); @@ -541,47 +660,49 @@ TRequestStatus* status( &iStatus ); User::RequestComplete( status, KErrCancel ); } - 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; + else + if ( aEvent.iDownloadState == EHttpDlInprogress ) + { + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), + &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlInprogress() ); + } + else + if ( aEvent.iDownloadState == EHttpDlCompleted ) + { + // store success + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), + &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlCompleted() ); + iDownloadSuccess = ETrue; - // finished - TRequestStatus* status( &iStatus ); - User::RequestComplete( status, KErrNone ); - } - else - if ( aEvent->type() == DownloadEvent::Failed ) - { - TInt32 err; + // finished + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, KErrNone ); + } + else + if ( aEvent.iDownloadState == EHttpDlFailed ) + { + TInt32 err; - DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), - &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlFailed() ); - // store failure - iDownloadSuccess = EFalse; - err = iDownload->attribute(LastError ).toInt(); - DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatEDlAttrErrorId(), err ); + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), + &RoHdlrDMgrWrDebugLiterals::KStrEHttpDlFailed() ); + // store failure + iDownloadSuccess = EFalse; + User::LeaveIfError( aDownload.GetIntAttribute( + EDlAttrErrorId, err ) ); + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatEDlAttrErrorId(), err ); - if ( err == ConnectionFailed || err == TransactionFailed ) - { - DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), - &RoHdlrDMgrWrDebugLiterals::KStrEConnectionFailed() ); - iConnectionError = ETrue; - } + if ( err == EConnectionFailed || err + == ETransactionFailed ) + { + DRMDEBUG2( RoHdlrDMgrWrDebugLiterals::KFormatMethHandleDMgrEventL(), + &RoHdlrDMgrWrDebugLiterals::KStrEConnectionFailed() ); + iConnectionError = ETrue; + } - // finished - TRequestStatus* status( &iStatus ); - User::RequestComplete( status, KErrCancel ); - } + // finished + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, KErrCancel ); + } } @@ -760,4 +881,3 @@ } return KErrNone; } - diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmromtm/group/RoMtmDat.mmp --- a/omadrm/drmplugins/drmromtm/group/RoMtmDat.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmromtm/group/RoMtmDat.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -46,7 +46,7 @@ USERINCLUDE ../../../../inc // ADo level inc dir // Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE +APP_LAYER_SYSTEMINCLUDE LIBRARY euser.lib LIBRARY mtur.lib diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmromtm/loc/RoMtmUi.loc --- a/omadrm/drmplugins/drmromtm/loc/RoMtmUi.loc Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmromtm/loc/RoMtmUi.loc Wed Sep 01 12:21:16 2010 +0100 @@ -406,7 +406,7 @@ //w: //r:3.0 // -#define qtn_drm_query_rights_acq_msg "Connect to server to get a licence?" +#define qtn_drm_query_rights_acq_msg "Connect to server to get a license?" //d:Confirmation query text used when triggering registration to a domain //l:popup_note_window diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmromtm/uiData/inc/RoMtmCommands.hrh --- a/omadrm/drmplugins/drmromtm/uiData/inc/RoMtmCommands.hrh Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmromtm/uiData/inc/RoMtmCommands.hrh Wed Sep 01 12:21:16 2010 +0100 @@ -22,6 +22,8 @@ // INCLUDE FILES +#include + /** * The following enum constants define those Ro MTM specific commands that * are supported by the client or the UI MTM components. diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp --- a/omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -560,8 +561,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 ); @@ -571,6 +572,14 @@ id.Set( KAknsIIDQgnPropMcePushUnread ); + AknsUtils::CreateIconL( skins, id, bitmap, + bitmapMask, tp.FullName(), EMbmMuiuQgn_prop_mce_push_unread, + EMbmMuiuQgn_prop_mce_push_unread_mask ); + + array->AppendL( bitmap ); + bitmap = 0; + array->AppendL( bitmapMask ); + bitmapMask = 0; iIconArrays->AppendL( array ); CleanupStack::Pop(); //array @@ -579,6 +588,14 @@ id.Set( KAknsIIDQgnPropMcePushRead ); + AknsUtils::CreateIconL( skins, id, bitmap, + bitmapMask, tp.FullName(), EMbmMuiuQgn_prop_mce_push_read, + EMbmMuiuQgn_prop_mce_push_read_mask ); + + array->AppendL( bitmap ); + bitmap = 0; + array->AppendL( bitmapMask ); + bitmapMask = 0; iIconArrays->AppendL( array ); CleanupStack::Pop(); //array } diff -r 1221b68b8a5f -r 1481bf457703 omadrm/drmplugins/drmromtm/uiData/src/RoMtmUi.rss --- a/omadrm/drmplugins/drmromtm/uiData/src/RoMtmUi.rss Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/drmplugins/drmromtm/uiData/src/RoMtmUi.rss Wed Sep 01 12:21:16 2010 +0100 @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include "RoMtmCommands.hrh" @@ -53,6 +55,17 @@ RESOURCE TBUF80 r_roud_not_supported {buf="This action is not supported";} +RESOURCE AKN_ICON_ARRAY r_ronsm_icons + { + bmpfile = APP_BITMAP_DIR"\\Muiu.mbm"; + + icons = + { + AKN_ICON { iconId = EMbmMuiuQgn_prop_mce_push_unread; + maskId = EMbmMuiuQgn_prop_mce_push_unread_mask; } + }; + } + // ----------------------------------------------------------------------------- // // r_romtmui_trigger_confirmation_query diff -r 1221b68b8a5f -r 1481bf457703 omadrm/group/bld.inf --- a/omadrm/group/bld.inf Tue Aug 31 15:29:38 2010 +0300 +++ b/omadrm/group/bld.inf Wed Sep 01 12:21:16 2010 +0100 @@ -111,9 +111,17 @@ // 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 1221b68b8a5f -r 1481bf457703 omadrm/omadrm.pro --- a/omadrm/omadrm.pro Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -# -# 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 1221b68b8a5f -r 1481bf457703 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1221b68b8a5f -r 1481bf457703 sysdef_1_5_1.dtd --- a/sysdef_1_5_1.dtd Tue Aug 31 15:29:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/cameseutility/group/CameseUtility.mmp --- a/wmdrm/camese/cameseutility/group/CameseUtility.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/cameseutility/group/CameseUtility.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -33,7 +33,7 @@ USERINCLUDE ../../inc MW_LAYER_SYSTEMINCLUDE - +SYSTEMINCLUDE /epoc32/include/ecom LIBRARY euser.lib LIBRARY flogger.lib diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/httpfiltercamese/Src/httpfiltercamesedrmheader.cpp --- a/wmdrm/camese/httpfiltercamese/Src/httpfiltercamesedrmheader.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/httpfiltercamese/Src/httpfiltercamesedrmheader.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -21,6 +21,7 @@ #include #include #include // - Album Download +#include #include "httpfiltercamesedrmheader.h" #include "httpfiltercamesedatasupplier.h" @@ -263,10 +264,23 @@ { if ( contentTypeVal.StrF().DesC().MatchF( KDataTypeCameseDRM ) != KErrNotFound ) - { - CAMESE_LOG( "CHttpFilterCameseDrmHeader::CheckResponseHeaders Found Drm Header" ); - StartDrmHeaderCaptureL( aTrans ); - } + { + CAMESE_LOG( "CHttpFilterCameseDrmHeader::CheckResponseHeaders Found Drm Header" ); + + TUid u = TUid::Uid( KFeatureIdFfWmdrmDlaSupport ); + TBool wmDrmDlaSupportOn = ETrue; + TRAPD(err, wmDrmDlaSupportOn = CFeatureDiscovery::IsFeatureSupportedL( u )); + + if(wmDrmDlaSupportOn) + { + StartDrmHeaderCaptureL( aTrans ); + } + else if(!err) + { + aTrans.Response().SetStatusCode( KErrCompletion ); + aTrans.Fail(); + } + } } } diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/httpfiltercamese/group/httpfiltercamese.mmp --- a/wmdrm/camese/httpfiltercamese/group/httpfiltercamese.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/httpfiltercamese/group/httpfiltercamese.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -53,8 +53,9 @@ LIBRARY inetprotutil.lib LIBRARY esock.lib LIBRARY ecom.lib -LIBRARY charconv.lib -LIBRARY wmdrmdla.lib +LIBRARY charconv.lib +LIBRARY wmdrmdla.lib LIBRARY centralrepository.lib // central repository +LIBRARY featdiscovery.lib SMPSAFE diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/wmdrmdla/group/wmdrmdla.mmp --- a/wmdrm/camese/wmdrmdla/group/wmdrmdla.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/wmdrmdla/group/wmdrmdla.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -43,7 +43,7 @@ USERINCLUDE ../../../inc MW_LAYER_SYSTEMINCLUDE - +SYSTEMINCLUDE /epoc32/include/ecom LIBRARY euser.lib LIBRARY efsrv.lib diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/wmdrmdla/inc/wmdrmdlahandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wmdrm/camese/wmdrmdla/inc/wmdrmdlahandler.h Wed Sep 01 12:21:16 2010 +0100 @@ -0,0 +1,171 @@ +/* +* 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 1221b68b8a5f -r 1481bf457703 wmdrm/camese/wmdrmdla/inc/wmdrmdlahttpfwpluginresolver.h --- a/wmdrm/camese/wmdrmdla/inc/wmdrmdlahttpfwpluginresolver.h Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/wmdrmdla/inc/wmdrmdlahttpfwpluginresolver.h Wed Sep 01 12:21:16 2010 +0100 @@ -20,7 +20,7 @@ #define WMDRMDLAHTTPFWPLUGINRESOLVER_H #include -#include +#include class CWmDrmDlaPluginContainer; class CAknIconArray; diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlabrowsercontainer.h --- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlabrowsercontainer.h Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlabrowsercontainer.h Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -22,22 +22,56 @@ #include class CAknView; +class MBrCtlSpecialLoadObserver; +class CBrCtlInterface; class CWmDrmDlaBrowserContainer : public CCoeControl { public: + static CWmDrmDlaBrowserContainer* NewL( CAknView* aView, + MBrCtlSpecialLoadObserver* aObserver ); + static CWmDrmDlaBrowserContainer* NewLC( CAknView* aView, + MBrCtlSpecialLoadObserver* aObserver ); + + /** + * Destructor. + */ + virtual ~CWmDrmDlaBrowserContainer(); + + /** + * Returns pointer to the CBrCtlInterface owned by the container. + * @return A pointer to CBrCtlInterface + */ + CBrCtlInterface* BrCtlInterface(); + + public: // From CCoeControl /** * @see CCoeControl */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * @see CCoeControl + */ + TInt CountComponentControls() const; + + /** + * @see CCoeControl + */ CCoeControl* ComponentControl( TInt aIndex ) const; /** * @see CCoeControl */ + void SizeChanged(); + + /** + * @see CCoeControl + */ void FocusChanged( TDrawNow aDrawNow ); /** @@ -48,12 +82,15 @@ private: CWmDrmDlaBrowserContainer( CAknView* aView ); + void ConstructL( MBrCtlSpecialLoadObserver* aObserver ); private: // data //Not owned CAknView* iView; + CBrCtlInterface* iBrCtlInterface; + }; #endif // C_WMDRMDLABROWSERCONTAINER_H diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlabrowserview.h --- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlabrowserview.h Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlabrowserview.h Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -20,6 +20,7 @@ #define C_WMDRMDLABROWSERVIEW_H #include +#include class CWmDrmDlaBrowserContainer; class CInternetConnectionManager; @@ -29,13 +30,14 @@ */ class MBrowserViewLicenseReceivedCallback { - public: - + public: + virtual void LicenseReceived() = 0; }; -class CWmDrmDlaBrowserView : public CAknView +class CWmDrmDlaBrowserView : public CAknView, + public MBrCtlSpecialLoadObserver { public: @@ -47,6 +49,33 @@ * Destructor. */ virtual ~CWmDrmDlaBrowserView(); + + /** + * Set the IAP that is used in network connection + * @param aIap - IAP to be used + */ + void SetIAP( TInt aIap ); + + /** + * Make a POST-request + * @param aCallback - Callback used to inform when license + * response is received + * @param aPostUrl - Post URL + * @param aPostContentType - Post content type + * @param aPostData - Post data + * @param aPostContentBoundary - Post content boundary + */ + void PostL( MBrowserViewLicenseReceivedCallback* aCallback, + const TDesC& aPostUrl, + const TDesC8& aPostContentType, + const TDesC8& aPostData, + const TDesC8& aPostContentBoundary ); + + /** + * Get the license response + * @return License response or NULL + */ + HBufC8* LicenseResponse(); public: // From CAknView @@ -58,6 +87,11 @@ /** * @see CAknView */ + void HandleCommandL( TInt aCommand ); + + /** + * @see CAknView + */ void DoActivateL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage ); @@ -69,15 +103,26 @@ /** * @see CAknView */ - void HandleClientRectChange(); - + void HandleClientRectChange(); + public: // From MBrCtlSpecialLoadObserver + void NetworkConnectionNeededL( TInt* aConnectionPtr, + TInt* aSockSvrHandle, + TBool* aNewConn, + TApBearerType* aBearerType ); + + TBool HandleRequestL( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ); + + TBool HandleDownloadL( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ); + private: CWmDrmDlaBrowserView(); void ConstructL(); - + void CreateContainerL(); void RemoveContainer(); void BrCtlHandleCommandL( TInt aCommand ); @@ -86,7 +131,7 @@ //Not Owned MBrowserViewLicenseReceivedCallback* iCallback; - + CWmDrmDlaBrowserContainer* iContainer; HBufC8* iLicenseResponse; CInternetConnectionManager* iConMgr; diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/wmdrmdlaapp/src/wmdrmdlaappservicesession.cpp --- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlaappservicesession.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlaappservicesession.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -121,6 +121,8 @@ } aMessage.ReadL( 0, iapPckg ); + BrowserView()->SetIAP( iap ); + CompleteMessage( aMessage, KErrNone ); } @@ -157,6 +159,12 @@ ptr8.Set( postContentBoundary->Des() ); aMessage.ReadL( 3, ptr8 ); + BrowserView()->PostL( this, + *postUrl, + *postContentType, + *postData, + *postContentBoundary ); + CleanupStack::PopAndDestroy( 4, postUrl ); //postContentBoundary, postData, //postContentType, postUrl @@ -179,7 +187,16 @@ { TInt err( KErrNone ); + HBufC8* licenseResponse( BrowserView()->LicenseResponse() ); + if ( licenseResponse ) + { + TInt licenseSize( licenseResponse->Size() ); + aMessage.WriteL( 0, TPckg( licenseSize ) ); + } + else + { err = KErrArgument; + } CompleteMessage( aMessage, err ); } @@ -192,8 +209,16 @@ { TInt err( KErrNone ); + HBufC8* licenseResponse( BrowserView()->LicenseResponse() ); + if ( licenseResponse ) + { + aMessage.WriteL( 0, *licenseResponse ); + } + else + { err = KErrArgument; - + } + CompleteMessage( aMessage, err ); } diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp --- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -19,12 +19,49 @@ // INCLUDE FILES #include #include +#include #include "wmdrmdlabrowserview.h" #include "wmdrmdlabrowsercontainer.h" // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- +// CWmDrmDlaBrowserContainer::ConstructL +// --------------------------------------------------------------------------- +// +void CWmDrmDlaBrowserContainer::ConstructL( + MBrCtlSpecialLoadObserver* aObserver ) + { + CreateWindowL(); + SetRect( iView->ClientRect() ); + + iBrCtlInterface = CreateBrowserControlL( + this, // parent control + iView->ClientRect(), // client rect + TBrCtlDefs::ECapabilityLoadHttpFw | + TBrCtlDefs::ECapabilityDisplayScrollBar | + TBrCtlDefs::ECapabilityUseDlMgr | + TBrCtlDefs::ECapabilityCursorNavigation, // Capabilities + TBrCtlDefs::ECommandIdBase, // command base + NULL, // Softkeys observer + NULL, // LinkResolver + aObserver, // Special load observer + NULL, // Layout Observer + NULL, // Dialog provider + NULL, // window observer + NULL // Download observer + ); + + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, + ETrue ); + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsCookiesEnabled, + ETrue ); + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded, + ETrue ); + ActivateL(); + } + +// --------------------------------------------------------------------------- // CWmDrmDlaBrowserContainer::CWmDrmDlaBrowserContainer // --------------------------------------------------------------------------- // @@ -34,6 +71,84 @@ } // --------------------------------------------------------------------------- +// CWmDrmDlaBrowserContainer::NewL +// --------------------------------------------------------------------------- +// +CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewL( + CAknView* aView, + MBrCtlSpecialLoadObserver* aObserver ) + { + CWmDrmDlaBrowserContainer* self + = CWmDrmDlaBrowserContainer::NewLC( aView, aObserver ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserContainer::NewLC +// --------------------------------------------------------------------------- +// +CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewLC( + CAknView* aView, + MBrCtlSpecialLoadObserver* aObserver ) + { + CWmDrmDlaBrowserContainer* self + = new( ELeave ) CWmDrmDlaBrowserContainer( aView ); + CleanupStack::PushL( self ); + self->ConstructL( aObserver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserContainer::~CWmDrmDlaBrowserContainer +// --------------------------------------------------------------------------- +// +CWmDrmDlaBrowserContainer::~CWmDrmDlaBrowserContainer() + { + if(iBrCtlInterface != NULL) + { + TRAP_IGNORE( iBrCtlInterface->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase )); + } + delete iBrCtlInterface; + } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserContainer::BrCtlInterface +// --------------------------------------------------------------------------- +// +CBrCtlInterface* CWmDrmDlaBrowserContainer::BrCtlInterface() + { + return iBrCtlInterface; + } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserContainer::CountComponentControls +// --------------------------------------------------------------------------- +// +TInt CWmDrmDlaBrowserContainer::CountComponentControls() const + { + if ( iBrCtlInterface ) + { + return 1; + } + return 0; + } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserContainer::SizeChanged +// --------------------------------------------------------------------------- +// +void CWmDrmDlaBrowserContainer::SizeChanged() + { + if ( iBrCtlInterface ) + { + iBrCtlInterface->SetRect( Rect() ); + } + } + +// --------------------------------------------------------------------------- // CWmDrmDlaBrowserContainer::ComponentControl // --------------------------------------------------------------------------- // @@ -42,18 +157,37 @@ { switch ( aIndex ) { + case 0: + return iBrCtlInterface; + default: return NULL; } } // --------------------------------------------------------------------------- +// CWmDrmDlaBrowserContainer::OfferKeyEventL +// --------------------------------------------------------------------------- +// +TKeyResponse CWmDrmDlaBrowserContainer::OfferKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + if ( iBrCtlInterface ) + { + return iBrCtlInterface->OfferKeyEventL( aKeyEvent, aType ); + } + return EKeyWasNotConsumed; + } + +// --------------------------------------------------------------------------- // CWmDrmDlaBrowserContainer::FocusChanged // --------------------------------------------------------------------------- // void CWmDrmDlaBrowserContainer::FocusChanged( TDrawNow aDrawNow ) { + iBrCtlInterface->SetFocus( IsFocused() ); CCoeControl::FocusChanged( aDrawNow ); } @@ -64,6 +198,10 @@ void CWmDrmDlaBrowserContainer::HandleResourceChange( TInt aType ) { + if ( iBrCtlInterface ) + { + iBrCtlInterface->HandleResourceChange( aType ); + } CCoeControl::HandleResourceChange( aType ); if ( aType == KEikDynamicLayoutVariantSwitch ) { diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp --- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -22,13 +22,15 @@ #include #include #include -#include +#include +#include #include #include "wmdrmdlabrowserview.h" #include "wmdrmdlabrowsercontainer.h" #include "wmdrmdlaappconstants.h" // CONTANTS +_LIT( KDataTypeLicenseResponse, "application/vnd.ms-wmdrm.lic-resp" ); // ======== LOCAL FUNCTIONS ======== @@ -89,6 +91,46 @@ } // --------------------------------------------------------------------------- +// CWmDrmDlaBrowserView::SetIAP +// --------------------------------------------------------------------------- +// + +void CWmDrmDlaBrowserView::SetIAP( TInt aIap ) + { + iIap = aIap; + } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserView::PostL +// --------------------------------------------------------------------------- +// +void CWmDrmDlaBrowserView::PostL( + MBrowserViewLicenseReceivedCallback* aCallback, + const TDesC& aPostUrl, + const TDesC8& aPostContentType, + const TDesC8& aPostData, + const TDesC8& aPostContentBoundary ) + { + iCallback = aCallback; + iContainer->BrCtlInterface()->PostUrlL( aPostUrl, + aPostContentType, + aPostData, + &aPostContentBoundary, + (TAny*)iContainer ); + iContainer->BrCtlInterface()->SetFocus( ETrue, EDrawNow ); + } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserView::LicenseResponse +// --------------------------------------------------------------------------- +// + +HBufC8* CWmDrmDlaBrowserView::LicenseResponse() + { + return iLicenseResponse; + } + +// --------------------------------------------------------------------------- // CWmDrmDlaBrowserView::Id // --------------------------------------------------------------------------- // @@ -98,6 +140,28 @@ } // --------------------------------------------------------------------------- +// CWmDrmDlaBrowserView::HandleCommandL +// --------------------------------------------------------------------------- +// +void CWmDrmDlaBrowserView::HandleCommandL( + TInt aCommand ) + { + if ( aCommand >= TBrCtlDefs::ECommandIdBase + + TBrCtlDefs::ECommandIdWMLBase && + aCommand <= TBrCtlDefs::ECommandIdBase + + TBrCtlDefs::ECommandIdRange ) + { + BrCtlHandleCommandL( aCommand ); + } + else + { + iContainer->BrCtlInterface()->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + + (TInt)TBrCtlDefs::ECommandIdBase ); + AppUi()->HandleCommandL( aCommand ); + } + } + +// --------------------------------------------------------------------------- // CWmDrmDlaBrowserView::DoActivateL // --------------------------------------------------------------------------- // @@ -139,6 +203,8 @@ void CWmDrmDlaBrowserView::CreateContainerL() { RemoveContainer(); + iContainer = CWmDrmDlaBrowserContainer::NewL( this, this ); + iContainer->SetMopParent( this ); } // --------------------------------------------------------------------------- @@ -154,3 +220,105 @@ iContainer = NULL; } } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserView::BrCtlHandleCommandL +// --------------------------------------------------------------------------- +// +void CWmDrmDlaBrowserView::BrCtlHandleCommandL( TInt aCommand ) + { + iContainer->BrCtlInterface()->HandleCommandL( aCommand ); + } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserView::NetworkConnectionNeededL +// --------------------------------------------------------------------------- +// +void CWmDrmDlaBrowserView::NetworkConnectionNeededL( + TInt* aConnectionPtr, + TInt* aSockSvrHandle, + TBool* aNewConn, + TApBearerType* aBearerType ) + { + TInt ret( 0 ); + // If not connected, try to start a new connection + if ( !iConMgr->Connected() ) + { + iConMgr->SetRequestedAP( iIap ); + ret = iConMgr->StartConnectionL( ETrue ); + } + + // If connected, return needed info to framework + if ( !ret ) + { + *aConnectionPtr = reinterpret_cast(&iConMgr->Connection() ); + *aSockSvrHandle = iConMgr->SocketServer().Handle(); + *aNewConn = EFalse; + *aBearerType = EApBearerTypeAllBearers; + } + else + { + User::Leave( KErrCancel ); + } + } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserView::HandleRequestL +// --------------------------------------------------------------------------- +// +TBool CWmDrmDlaBrowserView::HandleRequestL( + RArray* /*aTypeArray*/, + CDesCArrayFlat* /*aDesArray*/ ) + { + return EFalse; + } + +// --------------------------------------------------------------------------- +// CWmDrmDlaBrowserView::HandleDownloadL +// --------------------------------------------------------------------------- +// +TBool CWmDrmDlaBrowserView::HandleDownloadL( + RArray* aTypeArray, + CDesCArrayFlat* aDesArray ) + { + //Check that content type and local file name exists + //There must be both, because download manager downloads POST-content + //in advance calling this function + TInt contentTypeIndex( aTypeArray->Find( EParamReceivedContentType ) ); + TInt fileNameIndex( aTypeArray->Find( EParamLocalFileName ) ); + if ( contentTypeIndex != KErrNotFound && + fileNameIndex != KErrNotFound && + contentTypeIndex < aDesArray->Count() && + fileNameIndex < aDesArray->Count() ) + { + //Check that the downloaded content is license response + TPtrC16 dataTypePtr( (*aDesArray)[contentTypeIndex] ); + if ( dataTypePtr.CompareF( KDataTypeLicenseResponse ) == 0 ) + { + //Get the path to the license response, + //read the response, delete the file and + //make a license received - callback + TPtrC16 filePathPtr( (*aDesArray)[fileNameIndex] ); + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFile file; + TInt size( 0 ); + User::LeaveIfError( file.Open( fs, filePathPtr, EFileRead ) ); + CleanupClosePushL( file ); + User::LeaveIfError( file.Size( size ) ); + delete iLicenseResponse; + iLicenseResponse = NULL; + iLicenseResponse = HBufC8::NewL( size ); + TPtr8 licensePtr( iLicenseResponse->Des() ); + User::LeaveIfError( file.Read( 0, licensePtr, size ) ); + CleanupStack::PopAndDestroy( &file ); + User::LeaveIfError( fs.Delete( filePathPtr ) ); + CleanupStack::PopAndDestroy( &fs ); + iCallback->LicenseReceived(); + return ETrue; + } + } + return EFalse; + } + diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/wmdrmengine/wmdrmaccess/group/wmdrmaccess.mmp --- a/wmdrm/wmdrmengine/wmdrmaccess/group/wmdrmaccess.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/wmdrmengine/wmdrmaccess/group/wmdrmaccess.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -30,7 +30,7 @@ SOURCE wmdrmaccess.cpp MW_LAYER_SYSTEMINCLUDE - +SYSTEMINCLUDE /epoc32/include/ecom USERINCLUDE ../inc diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/wmdrmengine/wmdrmaccess/src/wmdrmaccess.cpp --- a/wmdrm/wmdrmengine/wmdrmaccess/src/wmdrmaccess.cpp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/wmdrmengine/wmdrmaccess/src/wmdrmaccess.cpp Wed Sep 01 12:21:16 2010 +0100 @@ -17,7 +17,7 @@ */ #include -#include +#include #include #include diff -r 1221b68b8a5f -r 1481bf457703 wmdrm/wmdrmengine/wmdrmagent/group/wmdrmagent.mmp --- a/wmdrm/wmdrmengine/wmdrmagent/group/wmdrmagent.mmp Tue Aug 31 15:29:38 2010 +0300 +++ b/wmdrm/wmdrmengine/wmdrmagent/group/wmdrmagent.mmp Wed Sep 01 12:21:16 2010 +0100 @@ -31,6 +31,10 @@ // 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