# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1261032367 -7200 # Node ID 254040eb3b7d5b86160fb885fda2a0304b3bf039 Revision: 200947 Kit: 200951 diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005-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: Build information file for project DefaultApplicationSettings +* +*/ + + +#include + +#include "../services_db/group/bld.inf" +#include "../server/group/bld.inf" +#include "../service/group/bld.inf" +#include "../gsplugin/group/bld.inf" + +PRJ_EXPORTS + +../rom/DefaultApplicationSettings.iby CORE_APP_LAYER_IBY_EXPORT_PATH(defaultapplicationsettings.iby) +../rom/DefaultApplicationSettingsResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(defaultapplicationsettingsresources.iby) + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/data/10281BA0.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/data/10281BA0.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2005-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: ECOM Interface definition for project General Settings Plugin +* +*/ + + +#include + +/** +* How to use the resource definition: +* +* IMPLEMENTATION_INFO +* { +* implementation_uid = ; +* version_no = 1; +* display_name = ""; +* default_data = ""; +* opaque_data = ""; +* } +* +* For example plugins wishing to use Apps Plugin as a parent use +* KGSAppsPluginUid (defined in GSFWViewUIDs.h): +* +* default_data = "0x10207239"; + +// Use this UID if plugin belongs to Main view: +const TUid KGSMainViewUid = { 0x1020723B }; + + +// No item is selected in the container's listbox +const TUid KGSNoneSelected = { 0x00000000 }; + +// UIDs used by the sub-view plugins: + +// Use this UID if plugin belongs to General view: +const TUid KGSGenPluginUid = { 0x10207237 }; + +// Use this UID if plugin belongs to Telephony view: +const TUid KGSTelPluginUid = { 0x1020723D }; + +// Use this UID if plugin belongs to Connection view: +const TUid KGSConPluginUid = { 0x10207250 }; + +// Use this UID if plugin belongs to Applications view: +const TUid KGSAppsPluginUid = { 0x10207239 }; + +// Use this UID if plugin belongs to Personalisation view: +const TUid KGSPrslnPluginUid = { 0x10207252 }; + +// Use this UID if plugin belongs to Security view: +const TUid KGSSecurityPluginUid = { 0x1020743A }; + +// Use this UID if plugin belongs to Standby view: +const TUid KGSStandbyPluginUid = { 0x1020743F }; + +* +* Note that position of the plugin is supported only for internally provided +* plugins. Others, such as 3rd party plugins, are sorted according to their +* name and plugin provider category. +* +* Plugin position must follow the postition defined in UI specification. +* Position starts from 0. Use -1 if position is not to be used in sorting. +* +*/ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10281BA0; // Plugin dll UID + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10207236; // UID for CGSPluginInterface - do not change. + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10281BA1; // Plugin UID + version_no = 1; + display_name = "DefaultAppSettings Plugin"; + default_data = "0x10207239"; + opaque_data = "0"; // Order number. We are the first + } + }; + } + }; + } + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/data/gsdasplugin_rsc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/data/gsdasplugin_rsc.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2005-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: Resource file for project General Settings Plugin +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// RESOURCE IDENTIFIER +NAME DAGS +RESOURCE RSS_SIGNATURE { } +RESOURCE TBUF { buf=""; } + +// RESOURCE DEFINITIONS + +//---------------------------------------------------- +// +// r_gs_menubar_change_exit +// Options menu with 'Exit' item. +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_gs_menubar_change_exit + { + titles = + { + MENU_TITLE + { + menu_pane = r_gs_menu_item_exit; + } + }; + } + +//---------------------------------------------------- +// +// r_gs_menu_item_exit +// Options menu item 'Exit'. +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_gs_menu_item_exit + { + items = + { + MENU_ITEM + { + command = EAknCmdExit; + txt = qtn_options_exit; + } + }; + } + +//---------------------------------------------------- +// +// r_gs_example_view_title +// Packet data view's title. +// +//---------------------------------------------------- +// +RESOURCE TBUF r_gs_defaultapp_caption + { + buf = qtn_da_gsp_caption; + } + +//---------------------------------------------------- +// +// r_gs_defaultapp_view +// Default App plugin view. +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_gs_defaultapp_view + { + menubar = r_gs_menubar_change_exit; + cba = R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT; + } + +//End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/group/GSDasPluginIcons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/group/GSDasPluginIcons.mk Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,71 @@ +# +# 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"" +# 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: Icons makefile for project Default Application settings +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# : Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +HEADERDIR=\epoc32\include +ICONTARGETFILENAME=$(TARGETDIR)\gsdasplugin.mif +HEADERFILENAME=$(HEADERDIR)\gsdasplugin.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# : Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,8 qgn_prop_cp_dev_def.svg + + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2005-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: Build information file for project General Settings Plugin +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// export loc file +../loc/gs_das.loc APP_LAYER_LOC_EXPORT_PATH( gs_das.loc ) + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv + OPTION TARGETFILE gsdasplugin.mif + OPTION HEADERFILE gsdasplugin.mbg + OPTION SOURCES -c8,8 qgn_prop_cp_dev_def +END + + +PRJ_MMPFILES +gsdasplugin.mmp + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/group/gsdasplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/group/gsdasplugin.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2005-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: Project definition file for project General Settings Plugin +* +*/ + + +#include +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET gsdasplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x10281BA0 +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE gs_das_implementationtable.cpp +SOURCE gs_das.cpp +SOURCE gs_das_emptycontainer.cpp + +USERINCLUDE ../inc +USERINCLUDE ../data + +// Default system include paths for middleware layer modules. +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../data +//ECOM resource definition +START RESOURCE 10281BA0.rss +TARGET gsdasplugin.rsc +END // ECOM resource definition + +//Default App GS plugin resources +START RESOURCE gsdasplugin_rsc.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END // Default App GS plugin resources + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY egul.lib +LIBRARY aknskins.lib +LIBRARY efsrv.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY commonengine.lib//For RConeResourceLoader +LIBRARY gsframework.lib +LIBRARY gsecomplugin.lib +LIBRARY defaultappclient.lib + +LIBRARY apparc.lib +LIBRARY apgrfx.lib + +// End of File + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/inc/gs_das.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/inc/gs_das.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2005-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: Implements a (minimal) GS Plugin +* +*/ + + + +#ifndef GS_DAS_H +#define GS_DAS_H + +// Includes +#include +#include +#include +#include + +#include +#include "gs_das_emptycontainer.h" +// Classes referenced +class CDefaultAppClient; + +// Constants +/** This is the name of the plugin's resource file */ +_LIT( KDefaultAppGSPluginResourceFileName, "z:gsdasplugin_rsc.rsc" ); + +/** This is the plugin's UID */ +const TUid KDefaultAppGSPluginUid = { 0x10281BA1 }; + +// CLASS DECLARATION + +/** + * This class implements a GS plugin. + * + * This class inplements a GS plugin that acts as a client for the Default App Server, so that it can be + * accessed from the GS application. + * + * @since S60 5.0 + */ +class CDefaultAppGSPlugin : public CGSPluginInterface, public MAknServerAppExitObserver + { + +public: // Constructors and destructor + + /** + * Symbian OS two-phased constructor + * @return + */ + + static CDefaultAppGSPlugin* NewL( TAny* aInitParams ); + + /** + * Destructor. + */ + ~CDefaultAppGSPlugin(); + +public: // From CAknView + + /** + * From CAknView + * Returns the UID of the Plugin (see base class) + * + * @since S60 5.0 + */ + TUid Id() const; + + /** + * From CAknView + * Activates the plugin (see base class) + * + * @since S60 5.0 + * @param aPrevViewId see base class + * @param aCustomMessageId see base class + * @param aCustomMessage see base class + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * From CAknView + * Deactivates the Plugin (see base class) + * + * @since S60 5.0 + */ + void DoDeactivate(); + + /** + * From CAknView + * Handles a menu command (see base class) + * + * @since S60 5.0 + * @param aCommand the command to handle + */ + void HandleCommandL( TInt aCommand ); + +public: // From CGSPluginInterface + + /** + * From CGSPluginInterface + * Returns the Plugin Caption (see base class) + * + * @since S60 5.0 + * @param aCaption placeholder for the caption + */ + void GetCaptionL( TDes& aCaption ) const; + + /** + * From CGSPluginInterface + * Returns the plugin's icon (see CGSPluginInterface header file) + * + * @since S60 5.0 + * @param aIconType icon type + */ + CGulIcon* CreateIconL( const TUid aIconType ); + +private: // From MAknServerAppExitObserver + + /** + * From MAknServerAppExitObserver + * Handles server exits + * + * @since S60 5.0 + * @param aReason for the server exit + */ + void HandleServerAppExit ( TInt aReason ); + +private: + + /** + * C++ default constructor. + */ + CDefaultAppGSPlugin(); + + /** + * Symbian OS default constructor. + */ + void ConstructL(); + +private: // Data + + /** + * The Resource Loader + */ + RConeResourceLoader iResources; // Resouce loader. + + /** + * The id of the previous View, to be activated when user pushes Back + */ + TVwsViewId iPrevViewId; + + /** + * Pointer to the Default App Client API class + * Own. + */ + CDefaultAppClient* iClient; + + /** + * Empty Container, used to avoid screen flickering + * Own. + */ + CCEmptyContainer* iEmptyContainer; + }; + +#endif // GS_DAS_H +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/inc/gs_das_emptycontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/inc/gs_das_emptycontainer.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2005-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: Implements a empty container for gsplugin +* +*/ + + +#ifndef CEMPTYCONTAINER_H +#define CEMPTYCONTAINER_H + +// INCLUDES +#include +#include +#include + +// CLASS DECLARATION + +/** + * CCEmptyContainer + * + */ +class CCEmptyContainer : public CCoeControl + { +public: + // Constructors and destructor + + /** + * Destructor. + */ + ~CCEmptyContainer(); + + /** + * Two-phased constructor. + */ + static CCEmptyContainer* NewL ( const TRect& aRect, const CCoeControl* aParent ); + + /** + * Two-phased constructor. + */ + static CCEmptyContainer* NewLC ( const TRect& aRect, const CCoeControl* aParent ); + +public: + // from base class CCoeControl + TInt CountComponentControls() const; + + CCoeControl* ComponentControl( TInt aIndex ) const; + +private: + + /** + * Constructor for performing 1st stage construction + */ + CCEmptyContainer(); + + /** + * EPOC default constructor for performing 2nd stage construction + */ + void ConstructL ( const TRect& aRect, const CCoeControl* aParent ); + + }; + +#endif // CEMPTYCONTAINER_H diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/loc/gs_das.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/loc/gs_das.loc Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2005-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: Localization strings for project General Settings Plugin +* +*/ + + +// d:Text of a list item in General Settings application +// d:Item opens the Default Applications settings +// l:list_single_large_graphic_pane_t1 +// r:5.0 +// +#define qtn_da_gsp_caption "Default Applications" + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/src/gs_das.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/src/gs_das.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,255 @@ +/* +* Copyright (c) 2005-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: Implements a (minimal) GS Plugin +* +*/ + + +// Includes +#include +#include +#include + +#include // Plugin's own UI resources +#include + +#include "gs_das.h" + +#include + + +// Constants + +#ifdef __SCALABLE_ICONS + // svg file + _LIT( KGSDasPluginIconFileName, "\\resource\\apps\\GSDasPlugin.mif"); +#else + // bitmap + _LIT( KGSDasPluginIconFileName, "\\resource\\apps\\GSDasPlugin.mbm"); +#endif // __SCALABLE_ICONS + + +// ========================= MEMBER FUNCTIONS ================================ + + +// --------------------------------------------------------------------------- +// CDefaultAppGSPlugin::CDefaultAppGSPlugin() +// Constructor +// +// --------------------------------------------------------------------------- +// +CDefaultAppGSPlugin::CDefaultAppGSPlugin( ) + : iResources( *iCoeEnv ), iClient(NULL) + { + + } + +// --------------------------------------------------------------------------- +// CDefaultAppGSPlugin::~CDefaultAppGSPlugin() +// Destructor +// +// --------------------------------------------------------------------------- +// +CDefaultAppGSPlugin::~CDefaultAppGSPlugin() + { + iResources.Close(); + if(iClient) + delete iClient; + if( iEmptyContainer ) + { + AppUi()->RemoveFromViewStack( *this, iEmptyContainer ); + delete iEmptyContainer; + }; + } + +// --------------------------------------------------------------------------- +// CDefaultAppGSPlugin::ConstructL() +// Symbian OS two-phased constructor +// +// --------------------------------------------------------------------------- +// +void CDefaultAppGSPlugin::ConstructL() + { + // Find the resource file: + TParse parse; + parse.Set( KDefaultAppGSPluginResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); + TFileName fileName( parse.FullName() ); + + // Get language of resource file: + BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), fileName ); + + // Open resource file: + iResources.OpenL( fileName ); + + //We can call this after opening the resource file ... + BaseConstructL( R_GS_DEFAULTAPP_VIEW ); + } + +// --------------------------------------------------------------------------- +// CDefaultAppGSPlugin::NewL() +// Static constructor +// +// --------------------------------------------------------------------------- +// +CDefaultAppGSPlugin* CDefaultAppGSPlugin::NewL( TAny* /*aInitParams*/ ) + { + CDefaultAppGSPlugin* self = new( ELeave ) CDefaultAppGSPlugin( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ========================= From CAknView ================== + + +// --------------------------------------------------------------------------- +// From class CAknView. +// Returns the UID of the plugin (see base class) +// --------------------------------------------------------------------------- +// +TUid CDefaultAppGSPlugin::Id() const + { + return KDefaultAppGSPluginUid; + } + + +// --------------------------------------------------------------------------- +// From class CAknView. +// Activates the plugin (see base class) +// See das_servmimeapps.h for possible values of the flags (useful for R&D) +// -0x00010000 : +// --------------------------------------------------------------------------- +// +void CDefaultAppGSPlugin::DoActivateL( const TVwsViewId& aPrevViewId, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { + iPrevViewId = aPrevViewId; + + TInt flags(0); //See das_servmimeapps.h for possible values of the flags (useful for R&D) + + if( !iClient ) + { + iClient=CDefaultAppClient::NewL(this); + } + + iClient->ChangeDefaultsL( flags ); + + //construct an empty control, so we avoid the screen flickering + if( !iEmptyContainer ) + { + iEmptyContainer = CCEmptyContainer::NewL( ClientRect(),NULL ); + iEmptyContainer->SetMopParent(this); + AppUi()->AddToStackL(*this, iEmptyContainer); + }; + } + + +// --------------------------------------------------------------------------- +// From class CAknView. +// Deactivates the Plugin (see base class) +// --------------------------------------------------------------------------- +// +void CDefaultAppGSPlugin::DoDeactivate() + { + if(iEmptyContainer) + { + AppUi()->RemoveFromViewStack(*this, iEmptyContainer); + delete iEmptyContainer; + iEmptyContainer=NULL; + }; + } + + +// --------------------------------------------------------------------------- +// From class CAknView. +// Handles a menu command (see base class) +// --------------------------------------------------------------------------- +// +void CDefaultAppGSPlugin::HandleCommandL( TInt aCommand ) + { + switch ( aCommand ) + { + case EAknSoftkeyBack: + AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid ); + break; + case EAknCmdExit: + case EEikCmdExit: + AppUi()->RunAppShutter(); + break; + default: + AppUi()->HandleCommandL( aCommand ); //also handles EAknCmdExit + break; + } + } +// ========================= From CGSPluginInterface ================== + + + +// --------------------------------------------------------------------------- +// From class CGSPluginInterface. +// Returns the Plugin Caption (see base class) +// --------------------------------------------------------------------------- +// +void CDefaultAppGSPlugin::GetCaptionL( TDes& aCaption ) const + { + HBufC* result = StringLoader::LoadL( R_GS_DEFAULTAPP_CAPTION ); + aCaption.Copy( *result ); + delete result; + } + +// --------------------------------------------------------------------------- +// From class CGSPluginInterface. +// Return the icon, if has one. +// --------------------------------------------------------------------------- +// +CGulIcon* CDefaultAppGSPlugin::CreateIconL( const TUid aIconType ) + { + //EMbm + CGulIcon* icon; + + if( aIconType == KGSIconTypeLbxItem ) + { + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropCpDevDef, + KGSDasPluginIconFileName, + EMbmGsdaspluginQgn_prop_cp_dev_def, + EMbmGsdaspluginQgn_prop_cp_dev_def_mask ); + } + else + { + icon = CGSPluginInterface::CreateIconL( aIconType ); + }; + + return icon; + } + +// ========================= From MAknServerAppExitObserver ================== + +// --------------------------------------------------------------------------- +// From class MAknServerAppExitObserver. +// Handles server exits +// --------------------------------------------------------------------------- +// +void CDefaultAppGSPlugin::HandleServerAppExit( TInt aReason) + { + delete iClient; + iClient=NULL; + TRAP_IGNORE(HandleCommandL(aReason));//do not care why it leaved + } + +// End of file diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/src/gs_das_emptycontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/src/gs_das_emptycontainer.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2005-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: Implements a (minimal) GS Plugin +* +*/ + + +#include "gs_das_emptycontainer.h" + +CCEmptyContainer::CCEmptyContainer() + { + // No implementation required + } + +CCEmptyContainer::~CCEmptyContainer() + { + } + +CCEmptyContainer* CCEmptyContainer::NewLC ( const TRect& aRect, + const CCoeControl* aParent ) + { + CCEmptyContainer* self = new (ELeave) CCEmptyContainer(); + CleanupStack::PushL ( self ); + self->ConstructL( aRect, aParent ); + return self; + } + +CCEmptyContainer* CCEmptyContainer::NewL ( const TRect& aRect, + const CCoeControl* aParent ) + { + CCEmptyContainer* self = CCEmptyContainer::NewLC ( aRect, aParent ); + CleanupStack::Pop(); // self; + return self; + } + +void CCEmptyContainer::ConstructL( const TRect& aRect,const CCoeControl* aParent ) + { + if ( aParent == NULL ) + { + CreateWindowL(); + } + else + { + SetContainerWindowL( *aParent ); + } + SetRect( aRect ); + ActivateL(); + } + +TInt CCEmptyContainer::CountComponentControls() const + { + return 0; + } + +CCoeControl* CCEmptyContainer::ComponentControl ( TInt aIndex ) const + { + switch( aIndex ) + { + + } + return NULL; + } diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/gsplugin/src/gs_das_implementationtable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/gsplugin/src/gs_das_implementationtable.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2005-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: Implementation table +* +*/ + + +// System includes +#include +#include + +// User includes +#include "gs_das.h" +#include + +// Constants +const TImplementationProxy KDASGSPluginImplementationTable[] = + { + // Uid for plugin implementation: + IMPLEMENTATION_PROXY_ENTRY( 0x10281BA1, CDefaultAppGSPlugin::NewL ) + }; + + +// --------------------------------------------------------------------------- +// ImplementationGroupProxy +// Gate/factory function +// +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + TInt error; + if( !CDefaultAppClient::ServiceAvailable(error) ) + { + //there was an error, service not found. + aTableCount=0; + } + else //service was found + aTableCount = sizeof( KDASGSPluginImplementationTable ) + / sizeof( TImplementationProxy ); + + return KDASGSPluginImplementationTable; + } + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/rom/DefaultApplicationSettings.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/rom/DefaultApplicationSettings.iby Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2005-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: Image description file for project DefaultApplicationSettings +* +*/ + + + +#ifndef DEFAULTAPPLICATIONSETTINGS_IBY +#define DEFAULTAPPLICATIONSETTINGS_IBY + +#include + +#ifdef RD_DEFAULT_APPLICATION_SETTINGS + +S60_APP_EXE(DefaultAppServer) +S60_APP_AIF_RSC(DefaultAppServer) + +//services_db +file=ABI_DIR\BUILD_DIR\servicesdb.dll SHARED_LIB_DIR\servicesdb.dll + +//client lib +file=ABI_DIR\BUILD_DIR\defaultappclient.dll SHARED_LIB_DIR\defaultappclient.dll + +//gs plugin +ECOM_PLUGIN( gsdasplugin.dll, 10281BA0.rsc ) +data=DATAZ_\BITMAP_DIR\GSDasPlugin.mif BITMAP_DIR\GSDasPlugin.mif + +#endif // RD_DEFAULT_APPLICATION_SETTINGS + +#endif // DEFAULTAPPLICATIONSETTINGS_IBY + +// End of File \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/rom/DefaultApplicationSettingsResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/rom/DefaultApplicationSettingsResources.iby Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2005-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: Image description file for project DefaultApplicationSettings +* +*/ + + + +#ifndef DEFAULTAPPLICATIONSETTINGSRESOURCES_IBY +#define DEFAULTAPPLICATIONSETTINGSRESOURCES_IBY + +#include + +#ifdef RD_DEFAULT_APPLICATION_SETTINGS + +//server +data=DATAZ_\APP_RESOURCE_DIR\defaultappserver.rsc APP_RESOURCE_DIR\defaultappserver.rsc + +//gs plugin +data=DATAZ_\RESOURCE_FILES_DIR\gsdasplugin_rsc.rsc RESOURCE_FILES_DIR\gsdasplugin_rsc.rsc + +#endif // RD_DEFAULT_APPLICATION_SETTINGS + +#endif // DEFAULTAPPLICATIONSETTINGSRESOURCES_IBY + +// End of File \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/data/defaultappserver.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/data/defaultappserver.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,460 @@ +/* +* Copyright (c) 2005-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: Resource definitions for project DefaultApp Server +* +*/ + + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include //localisable app info +#include + +#include +#include "das_gsentries.rh" +#include "das.hrh" +#include +#include + +NAME DFAP +RESOURCE RSS_SIGNATURE { } +RESOURCE TBUF { buf=""; } + + + +// --------------------------------------------------------- +// Define default menu and CBA key. +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar=r_das_menubar; + cba = r_das_softkeys_options_back__change;//R_AVKON_SOFTKEYS_OPTIONS_BACK; + } + +// --------------------------------------------------------- +// r_das_menubar +// Menubar for Default App Server +// --------------------------------------------------------- +// +RESOURCE MENU_BAR r_das_menubar + { + titles= + { + MENU_TITLE + { + menu_pane = r_das_menu; + } + }; + } + +// --------------------------------------------------------------------------- +// r_das_menu +// Menu for Options +// --------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_das_menu + { + items= + { + MENU_ITEM + { + flags = EEikMenuItemAction; + command = EAknCmdOpen; + txt = qtn_options_change; + }, + MENU_ITEM + { + command = EAknCmdFindPopupActivated; + txt = qtn_options_find; + }, + MENU_ITEM + { + command = EDasCmdAdvanced; + txt = qtn_options_advanced; + }, + MENU_ITEM + { + cascade = r_das_menu_original_settings; + txt = qtn_da_options_reset; + }, + MENU_ITEM + { + command = EAknCmdHelp; + txt = qtn_options_help; + }, + MENU_ITEM + { + command = EAknCmdExit; + txt = qtn_options_exit; + } + }; + } + +// --------------------------------------------------------------------------- +// r_das_menu_factory_settings +// Sub-menu for Factory settings +// This contains one item, but additional items will be added to it +// --------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_das_menu_original_settings + { + items = + { + MENU_ITEM + { + command = EDasCmdResetSelected; + txt = qtn_da_options_reset_selected; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = EDasCmdResetAll; + txt = qtn_da_options_reset_all; + } + }; + } + +// --------------------------------------------------------------------------- +// r_das_servicesmimes_listbox +// Listbox for the Services & MIMEs +// --------------------------------------------------------------------------- +// +RESOURCE LISTBOX r_das_servicesmimes_listbox + { + flags = EAknListBoxSelectionList; + } + +// --------------------------------------------------------------------------- +// r_da_title_app +// Application title +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_da_title_app + { + buf = qtn_da_title_app; + } + +// --------------------------------------------------------------------------- +// r_da_title_main +// Main view title +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_da_title_main + { + buf = qtn_da_title_main; + } + +// --------------------------------------------------------------------------- +// r_da_title_popup_adv +// Advanced settings +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_da_title_advanced + { + buf = qtn_da_title_advanced; + } + + + + +// resources for the simplified view + + +// --------------------------------------------------------------------------- +// r_da_tasks +// This is the list of tasks. For each task, there are 3 items: +// -the task name (this will be shown in the list) +// -the MIME label (the selected default application for the task will be set as default for Open and this MIME) +// -a list of Services & MIMEs that belong to the task: all applications that can handle at least one Service & MIME +// from the list, may become defaults for the task (however, only for the Services & MIMEs the application supports). +// --------------------------------------------------------------------------- +// +RESOURCE DAS_GS_TASKS r_da_tasks + { + tasks= + { + DAS_GS_TASK_ENTRY + { + task_name = qtn_da_main_browse; + //USE_TASK_TITLE + task_title = qtn_da_title_popup_browse; + + mime_label = "application/x-web-browse"; + service_mimes = + { + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "text/html"; } + }; + }, //browse web task + DAS_GS_TASK_ENTRY + { + task_name = qtn_da_main_play_music; + // + task_title = qtn_da_title_popup_music; + + mime_label = "application/x-audio-play"; + service_mimes = + { + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/mp3"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/mpeg"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-mp3"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/mpegurl"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-mpegurl"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/3gpp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/3gpp2"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/mp4"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/aac"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/basic"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/amr"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/amr-wb"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/awb"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-amr"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-epoc-wve"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-sibo-wve"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/wav"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-wav"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-au"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/au"; }, + // SERIES 60 MIDI + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-midi"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/midi"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/sp-midi"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-beatnik-rmf"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-rmf"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/rmf"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/mobile-xmf"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/vnd.nokia.mobile-xmf"; }, + //qcelp + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/qcelp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/vnd.qcelp"; }, + //wma + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-ms-wma"; } + //real audio (probably with system priority in the system) + /* + * Real Audio is commented out because leaving it here would be confusing for users: + * If Real Audio is uncommented below, both Music Player and RealPlayer will be listed + * as handling music. However, the Music Player can not handle the Real Audio MIMEs + * (it can handle most of the MIMEs above this comment). The RealPlayer can only handle + * the RealAudio MIMEs (commented here). So there is no overlapping between the 2 players. + * This would mean that whatever the client choses as the default player between these 2, + * they will still continue to play media as before. E.g. all mp3s, WMAs, AACs will be + * played with the MediaPlayer even if RealPlayer is chosed as default audio player. + * + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/vnd.rn-realaudio"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-pn-realaudio-plugin"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "audio/x-pn-realaudio"; } + */ + }; + }, //play music task + DAS_GS_TASK_ENTRY + { + task_name = qtn_da_main_play_videos; + //USE_TASK_TITLE + task_title = qtn_da_title_popup_video; + + mime_label = "application/x-video-play"; + service_mimes = + { + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "video/3gpp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "video/3gpp2"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "video/mpeg4"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "video/mp4"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "application/sdp"; }, + //following MIMEs are probably system priority in the platform player + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "video/vnd.rn-realvideo"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "application/vnd.rn-realmedia"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "application/x-pn-realmedia"; } + }; + }, //play videos task + DAS_GS_TASK_ENTRY + { + task_name = qtn_da_main_view_images; + //USE_TASK_TITLE + task_title = qtn_da_title_popup_image; + + mime_label = "application/x-image-view"; + service_mimes = + { + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/jpeg"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/jpg"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/jp2"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/tiff"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-wmf"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/ico"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/gif"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/bmp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-bmp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-bitmap"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-xbitmap"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-win-bitmap"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-windows-bmp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/ms-bmp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-ms-bmp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/vnd.wap.wbmp"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/png"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-epoc-mbm"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/vnd.nokia.ota-bitmap"; }, + DAS_SERVICE_MIME + { service_uid = 0x10208DCA; mime = "image/x-ota-bitmap"; } + }; + } //view images task + }; //tasks + } + + +// --------------------------------------------------------------------------- +// r_defaultappserver_localisable_app_info +// Localisable app info +// --------------------------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_defaultappserver_localisable_app_info + { + short_caption = qtn_da_title_app; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_da_title_app; + }; + } + +RESOURCE CBA r_das_softkeys_options_back__change + { + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;}, + CBA_BUTTON {id=EAknCmdOpen; txt=qtn_msk_change;} + }; + } + +RESOURCE DIALOG r_das_dlg + { + flags = EAknDialogSelectionList | EEikDialogFlagNotifyEsc; + + buttons = r_das_softkeys_options_back__change; + items = + { + DLG_LINE + { + type = EAknCtDoubleListBox; + + id = ESelectionListControl; + control = LISTBOX + { + flags = EAknListBoxSelectionList; + }; + }, + DLG_LINE + { + itemflags = EEikDlgItemNonFocusing; + id = EFindControl; + type = EAknCtSelectionListPopupFind; + } + }; + } + +// --------------------------------------------------------------------------- +// r_da_services_mime +// This resource stores localized strings for the supported services, identified +// by their Uid and generic name. +// This resource is defined in the services_db.rh file +// --------------------------------------------------------------------------- +// +RESOURCE DAS_SERVICES r_da_service_mime + { + services = + { + DAS_SERVICE_ENTRY + { + service_uid = 0x10208DCA; //KOpenServiceUid + service_name = "Open"; + service_localized_name = qtn_da_service_open; + } + }; + } + + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/data/defaultappserver_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/data/defaultappserver_reg.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2005-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: Registration resource file for Default App Server +* +*/ + + + +// INCLUDES + +#include +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x10281B9C //server app UID + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// APP_REGISTRATION_INFO +// Registration resource for Default App Server +// +// ----------------------------------------------------------------------------- +// +RESOURCE APP_REGISTRATION_INFO + { + app_file = "defaultappserver"; + embeddability = KAppEmbeddable; + hidden = KAppIsHidden; + newfile=KAppDoesNotSupportNewFile; + localisable_resource_file = APP_RESOURCE_DIR"\\defaultappserver"; + localisable_resource_id = R_DEFAULTAPPSERVER_LOCALISABLE_APP_INFO; + service_list = + { + SERVICE_INFO { uid = 0x10281B9D; } + }; + } +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2005-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: Build information file for project Default App Server +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// export loc file +../loc/defaultappserver.loc APP_LAYER_LOC_EXPORT_PATH( defaultappserver.loc ) +../loc/services_db.loc APP_LAYER_LOC_EXPORT_PATH( services_db.loc ) + +PRJ_MMPFILES +das_server.mmp + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/group/das_server.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/group/das_server.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2005-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: Project definition file for project Default App Server +* +*/ + + + +#include +#include + +TARGET defaultappserver.exe +TARGETTYPE EXE +UID 0 0x10281B9C + +CAPABILITY WriteDeviceData SwEvent +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE das.cpp //entry point +SOURCE das_app.cpp //Application class +SOURCE das_doc.cpp //Document class +SOURCE das_appui.cpp //AppUi class +SOURCE das_srvmime_dlg.cpp //dlg class: services & MIMEs +SOURCE das_view.cpp //standard view class, rather empty +SOURCE das_server.cpp //server class +SOURCE das_service.cpp //service class +SOURCE das_servmimeapps.cpp //engine class + +USERINCLUDE ../inc + +// Default system include paths for middleware layer modules. +APP_LAYER_SYSTEMINCLUDE + +START RESOURCE ../data/defaultappserver.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END // RESOURCE + +START RESOURCE ../data/defaultappserver_reg.rss +DEPENDS defaultappserver.rsg +TARGETPATH /private/10003a3f/apps +END + + + + +LIBRARY euser.lib +LIBRARY apparc.lib //is this needed?? +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY eikdlg.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY commonengine.lib //StringLoader +LIBRARY serviceregistry.lib + +LIBRARY aknskins.lib +LIBRARY egul.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknicon.lib +LIBRARY hlplch.lib // for "Help" options menu +LIBRARY featmgr.lib + +LIBRARY servicesdb.lib diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das.hlp.hrh Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2005-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: Help IDs for project Default App Server +* +*/ + + +#ifndef DAS_HLP_HRH +#define DAS_HLP_HRH + + +_LIT(KDA_HLP_MAIN,"DA_HLP_MAIN"); //GS client, simplified view +_LIT(KDA_HLP_ADVANCED,"DA_HLP_ADVANCED"); //GS client, advanced view +_LIT(KDA_HLP_APPLICATION,"DA_HLP_APPLICATION"); //other client + +#endif // DAS_HLP_HRH + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das.hrh Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005-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: Resource headers for project Default App Server +* +*/ + + +#ifndef DAS_HRH +#define DAS_HRH + +// DefaultApp enumerate command codes +enum TDefaultAppCommands + { + EDasCmdAdvanced=100, + EDasCmdResetAll, + EDasCmdResetSelected + }; + +#endif // DAS_HRH diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_app.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_app.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2005-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: This class implements the application. +* +*/ + + + +#ifndef C_DEFAULTAPPAPPLICATION_H +#define C_DEFAULTAPPAPPLICATION_H + +#include + +class CDefaultAppDocument; +class CDefaultAppServer; + +/** UID for the application; this should correspond to the uid defined in the mmp file */ +const TUid KUidDefaultAppServer = { 0x10281B9C }; + +/** + * This class implements the application. + * + * @since Series 60 v5.0 + */ +class CDefaultAppApplication : public CAknApplication + { +private: // Functions from base classes + + /** + * From CApaApplication. + * Returns application's UID (KUidDefaultAppServer). + * + * @since S60 v5.0 + * @return The value of KUidDefaultAppServer. + */ + TUid AppDllUid() const; + + /** + * From CApaApplication. + * Creates CDefaultAppDocument document object. + * + * @since S60 v5.0 + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * From CApaApplication. + * Creates a new server object (CDefaultAppServer). + * + * @since S60 v5.0 + * @param aAppServer pointer to the newly created server object + */ + void NewAppServerL(CApaAppServer*& aAppServer); + +public: + /** + * C++ default constructor. + */ + CDefaultAppApplication(void); + +public: //data + /** + * Pointer to the documet class + * Not owned. + */ + CDefaultAppDocument* iDocument; //not owned + + /** + * Pointer to the server class + * Not owned. + */ + CDefaultAppServer* iServer; //not owned + }; + +#endif // C_DEFAULTAPPAPPLICATION_H + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_appui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_appui.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2005-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: This class implements the AppUi +* +*/ + + + +#ifndef C_DEFAULTAPPAPPUI_H +#define C_DEFAULTAPPAPPUI_H + + +#include +#include + +class CDefaultAppSrvMimeDlg; +class CDefaultAppView; +class CDefaultAppServMimeApps; + + + +/** + * This class implements the AppUi. + * + * @since Series 60 v5.0 + */ +class CDefaultAppAppUi : public CAknAppUi + { +public: + + /** + * Destructor. + */ + virtual ~CDefaultAppAppUi(); + + /** + * C++ default constructor. + */ + CDefaultAppAppUi(); + + /** + * Symbian OS default constructor. + */ + void ConstructL(); + + /** + * This function completes the construction of the AppUi. This function is called after the client + * has connected to this server instance, and all the necessary data for this construction step is + * available. + * + * @since S60 v5.0 + * @param aClientUid The Uid of the client + * @param aServiceFlags various flags that may alter what data is displayed to the user + */ + void ConstructSrvMimeDlgL(TUid aClientUid, TInt aServiceFlags); + + /* + * This functino is used to record the exist of the dialog; + */ + void SetDialogExist( TBool aExist ); + +public: // from CAknAppUi + + /** + * From CAknAppUi. + * Handles commands from the menu (see base class) + * + * @since S60 v5.0 + * @param aCommand the command being handled + */ + void HandleCommandL(TInt aCommand); + + /** + * From CAknAppUi. + * Handles layout changes (e.g. from portrait to landscape) + * + * @since S60 v5.0 + * @param aType The type of resources that have changed + */ + void HandleResourceChangeL(TInt aType); + + /** + * Handles Window Server events (we are interested in catching the end key event + * and exiting the application + * + * @since S60 v5.0 + * @param aEvent The event that occurred + * @param aDestination The control associated with the event + */ + void HandleWsEventL(const TWsEvent & aEvent, CCoeControl * aDestination); + + +private: + + /** + * Imports and displays the icon of the client application. + * + * @since S60 v5.0 + */ + void SetClientIconL(TUid aClietAppUid); + +public: + + /** + * Pointer to the View + * Own. + */ + CDefaultAppView *iView; + + /** + * Pointer to the dialog + * Own. + */ + CDefaultAppSrvMimeDlg *iDlg; + + /** + * Pointer to the "engine". The engine is a place where application data is retrieved and stored. + * Own. + */ + CDefaultAppServMimeApps *iServMimeApps; + + /** + * variable used to remember the list selection position when reloading the dialog + * for the simplified view + * Own. + */ + TInt iSelectedItemSimple; + + /** + * variable used to remember the list selection position when reloading the dialog + * for the advanced view + * Own. + */ + TInt iSelectedItemAdvanced; + + /** + * variable used to remember dialog type (simple/advanced) when reloading the dialog + * Own. + */ + TBool iReloadDlgAdvanced; + + /** + * variable used to specify if the dialog is reloaded + * Own. + */ + TBool iReloadDlg; + + /** + * specifies if the dialog is dismissed or reloaded + * Own. + */ + TBool iExitBack; + + TUid iClientUid; + +private: + // This is used to record the exist of the dialogue. + TBool iDialogExist; + }; +#endif // C_DEFAULTAPPAPPUI_H + +//end of file diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_doc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_doc.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2005-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: This class implements the application document. +* +*/ + + + +#ifndef C_DEFAULTAPPDOC_H +#define C_DEFAULTAPPDOC_H + +#include + +class CDefaultAppAppUi; + +/** + * This class implements the application document. + * + * @since Series 60 v5.0 + */ +class CDefaultAppDocument : public CAknDocument + { +public: + + /** + * Symbian OS two-phased constructor + * @return + */ + static CDefaultAppDocument* NewL(CEikApplication& aApp); + + /** + * Symbian OS two-phased constructor + * @return + */ + static CDefaultAppDocument* NewLC(CEikApplication& aApp); + +// from base class CAknDocument + /** + * From CAknDocument. + * Function to create the AppUi. + * + * @since S60 v5.0 + * @return the created AppUi instance + */ + CEikAppUi* CreateAppUiL(); + +private: + + /** + * C++ default constructor. + */ + CDefaultAppDocument(CEikApplication& aApp); +public: + /** + * Pointer to the AppUi + * Not owned + */ + CDefaultAppAppUi* iDefaultAppUi; //not owned + }; + +#endif // C_DEFAULTAPPDOC_H + +// End of File \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_gsentries.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_gsentries.rh Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2005-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: Resource headers for project das_server +* +*/ + + +#ifndef DAS_GSENTRIES_RH +#define DAS_GSENTRIES_RH + +// --------------------------------------------------------------------------- +// New structure to describe a Service & MIME pair +// --------------------------------------------------------------------------- +// +STRUCT DAS_SERVICE_MIME + { + LONG service_uid; + LTEXT8 mime; + } + +// --------------------------------------------------------------------------- +// New structure to describe a Task. +// A Task has a name, a MIME label and a list of associated Service & MIMEs pairs. +// --------------------------------------------------------------------------- +// +STRUCT DAS_GS_TASK_ENTRY + { + LTEXT task_name; + + //task title + LTEXT task_title; + + // The main service and MIME give the default application for the task. + // The default application for the task is registered as default for the main MIME and Service + // The default application for the task does not necessarily have to support the main MIME and Service + // () + LTEXT8 mime_label; + + //other pairs that + STRUCT service_mimes[]; //Type is DAS_SERVICE_MIME + } + +// --------------------------------------------------------------------------- +// New structure to describe a list of Tasks +// --------------------------------------------------------------------------- +// +STRUCT DAS_GS_TASKS + { + STRUCT tasks[]; //Type is DAS_GS_TASK_ENTRY + } + +#endif // DAS_GSENTRIES_RH diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_server.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_server.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2005-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: The Default Application server class +* +*/ + + + +#ifndef C_DEFAULTAPPSERVER_H +#define C_DEFAULTAPPSERVER_H + +#include + +class CDefaultAppApplication; + +/** + * This is the main implemetation of DefaultApp server. + * + * @since Series 60 v5.0 + */ +class CDefaultAppServer: public CAknAppServer + { +public: // Constructors and destructor + + /** + * Symbian OS two-phased constructor + * @return + */ + static CDefaultAppServer* NewL(CDefaultAppApplication *aApp); + +// from base class CAknAppServer + + /** + * From CAknAppServer + * Creates a service for the specified service Uid + * + * @since S60 v5.0 + * @param aServiceType the service type Uid + * @return the created service + */ + CApaAppServiceBase* CreateServiceL(TUid aServiceType) const; + +private: + + /** + * C++ default constructor. + */ + CDefaultAppServer(CDefaultAppApplication *aApp); + +public: + /** + * pointer to the application. After the client connects, the server side needs to announce the AppUi class, to + * continue the construction + * Not owned. + */ + CDefaultAppApplication* iApp; //Not owned + }; + +#endif // C_DEFAULTAPPSERVER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_service.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_service.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2005-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: The Default App Service implementation (server-side) +* +*/ + + + +#ifndef C_DEFAULTAPPSERVICE_H +#define C_DEFAULTAPPSERVICE_H + +#include + +class CDefaultAppServer; + +/** + * This class implements the Default Application server-side service. + * + * @since Series 60 v5.0 + */ +class CDefaultAppService : public CAknAppServiceBase + { +public: + enum TIpcMessageIds + { + ESetDefaultAll = RApaAppServiceBase::KServiceCmdBase + }; + + /** + * Symbian OS two-phased constructor + * @return + */ + static CDefaultAppService* NewL(const CDefaultAppServer* aServer); + + /** + * Destructor. + */ + virtual ~CDefaultAppService(); + +public: // from base class CAknAppServiceBase + + /** + * From CAknAppServiceBase. + * function called when a new message is received + * + * @since S60 v5.0 + * @param aMessage the received service message + */ + void ServiceL(const RMessage2& aMessage); + + /** + * From CAknAppServiceBase. + * function called to check client credentials. Used to retrieve client app UID + * + * @since S60 v5.0 + * @param aMsg the message being received + */ + CPolicyServer::TCustomResult SecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing); + +private: //construction + + /** + * C++ constructor. + */ + CDefaultAppService(const CDefaultAppServer* aServer); + + /** + * Sets default for all the Service & MIME pairs supported by the client + * + * @since S60 v5.0 + * @param aMessage the received service message + */ + void HandleSetDefaultAllL(const RMessage2& aMessage); + + /** + * Function where most of the processing happens. + * We use it so that the service request from the client returns immediately + * + * @since S60 v5.0 + * @param aInstance a pointer to the calling CDefaultAppService instance + */ + static TInt IdleWorker(TAny *aInstance); + +public: + /** + * The Uid of the client application + */ + TUid iClientUid; + + /** + * Service flags requested by the client + */ + TInt iServiceFlags; + + /** + * pointer to the server + * Not owned. + */ + const CDefaultAppServer* iDefaultAppServer; //not owned + + /** + * Active Object where most of the processing happens. We use it so that the service + * call returns immediately. + * Owned. + */ + CIdle *iIdle; + }; + +#endif // C_DEFAULTAPPSERVICE_H + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_servmimeapps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_servmimeapps.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,533 @@ +/* +* Copyright (c) 2005-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: Keeps info about Services, MIMEs and Applications +* +*/ + + + +#ifndef C_DEFAULTAPPSERVMIMEAPPS_H +#define C_DEFAULTAPPSERVMIMEAPPS_H + +class CApaMaskedBitmap; +class CDefaultAppServMimeApps; +class CServicesDB; +class RApaLsSession; + +/** The UID of the General Settings Application */ +const TUid KUidGS = { 0x100058EC }; //we define this here because we use it in several places + +/** + * Helper class: stores an Application name, its UID and some other info (how many + * service&MIMEs pair it supports, is it platform application or not) + * This helper class is used to sort the list of Applications that support a Service&MIME pair + * + * @since S60 v5.0 + */ +class CAppHelper : public CBase + { +public: + /** flags used with the app helper. */ + enum + { + EFlagPlatformApp =0x0001, + EFlagNameNotOwned =0x0002 + }; +public: + + /** + * Destructor. + */ + ~CAppHelper(); + + /** + * Symbian OS two-phased constructor + * @return + */ + static CAppHelper* NewLC(const TDesC& aName, const TInt aUid); + + /** + * Symbian OS two-phased constructor + * @return + */ + static CAppHelper* NewLC(const CAppHelper& aApp); + + /** + * This function is used for ordering an array of CAppHelper objects + * + * @since S60 v5.0 + * @param a1 CAppHelper object + * @param a2 CAppHelper object + */ + static TInt OrderApplications(const CAppHelper& a1, const CAppHelper& a2); +private: + + /** + * C++ constructor + */ + CAppHelper(const TInt aUid, const TInt aScore, const TInt aFlags=0); +public: + + /** + * the App name + * Owned or Not Owned, depending on flags (iFlag&EFlagNameNotOwned). + */ + HBufC* iName; + + /** + * the UID of the application + */ + TInt iUid; + + /** + * the application score (how many Services & MIMEs it supports) + */ + TInt iScore; + + /** + * Object flags + */ + TInt iFlags; + }; + +/** + * Helper class: stores a Service & Mime Pair + * + * This class stores data specific to a Service & MIME pair: + * -the Service + MIME string + * -the Service Uid + * -the MIME + * -a list of applications (CAppHelper) that support this Service & MIME pair + * -the list index and Uid of the default application for this Service & MIME pair + * + * @since S60 v5.0 + */ +class CServiceMime : public CBase + { + friend class CDefaultAppServMimeApps; +public: + + /** + * C++ constructor + */ + CServiceMime(); + + /** + * Destructor. + */ + ~CServiceMime(); + + /** + * This function is used for ordering an array of CServiceMime objects + * + * @since S60 v5.0 + * @param a1 CServiceMime object + * @param a2 CServiceMime object + */ + static TInt OrderServiceMimes(const CServiceMime& a1, const CServiceMime& a2); + +private: + /** + * String that contains the localized Service + MIME name + * Owned. + */ + HBufC *iServiceMime; + + /** + * The Uid of the service + */ + TUid iServiceUid; + + /** + * the MIME string + * Owned. + */ + HBufC8 *iMime; + + /** + * list of applications that support this Service & MIME pair + * Owned (members of the array). + */ + RPointerArray iApplications; + + /** + * the UID of the default application for this Service & MIME + */ + TUid iDefaultAppUid; + + /** + * the list index for the default application + * this has the following special values: + * -1 : the default is (yet) unknown + * -2 : there is a single app in the list, its priority is System + * (this means: do not add other apps unless they have system priority) + * -3 : there are more than one applications in the list, ALL have the System priority + * (this also means: do not add other apps unless they have system priority) + */ + TInt iDefaultApp; + + /** + * indicates if the Service & MIME pair instance is used by a task or not + */ + TBool iUsedByTasks; + }; + + +/** + * Helper class: stores a Task + * + * This class stores data specific to a Task: + * -the task caption/title (list layout and title layout) + * -the lists of Service (UIDs) & MIMEs associated with this task + * -the MIME label + * -a list of Services & MIMEs objects (and their associated application list) that correspond to the list + * of Services & MIMEs associated with the task + * -a list of applications (CAppHelper) that are associated with this task + * -the UID and list index of the default application for the task, in the list(s) above. + * + * How this works: + * The Service & MIME pairs associated with the task are those pairs for which changing the default application for the + * task will have an impact: the new default becomes the default application for all these pairs, if applicable. + * The list of candidate default applications is build from the Service & MIME pairs associated with the task: any + * application that can handle at least one pair, is added to the list. The score corresponds to the number of pairs an + * application is able to handle (the better the score, the more suitable the application is for the task). + * When a new application is made default, it is also made default for Open + the MIME label. This way we can retrieve + * the default application for the task, to display it to the user. + * The list of Services & MIME objects are instances of CServiceMime that correspond to the list of Services & MIMEs that + * are associated with the task (the associated Services & MIMEs is a "theoretical" list, while the CServiceMime list + * is a list of Services & MIMEs that were found in the system. The Services & MIMEs in this object list is a subset of + * the associated Services & MIMEs. The reunion of all Applications lists associated with each CServiceMime object in the + * list is going to be same as the list of Applications that are associated with the Task. + * When a new default application is selected for the task, this new default is saved in 2 ways: + * -the new default application is made default for the Open service and the MIME label. This way, we can retrieve next + * time the default application for the task. There is no danger to launch this default for opening the MIME label, since + * no application is supposed to support the MIME label. + * -the new default application is made default for all the Services & MIMEs associated with the task: for each instance + * of CServiceMime in the list, the default is looked in the application list of the object: if it is found (which means + * that the new default application supports that Service & MIME), then the new task default is made default for the + * current Service & MIME too. + * + * @since S60 v5.0 + */ +class CMediaTask : public CBase + { + friend class CDefaultAppServMimeApps; +public: + + /** + * Symbian OS two-phased constructor + * @return + */ + static CMediaTask* NewLC( TResourceReader& aReader ); + + /** + * Destructor. + */ + ~CMediaTask(); +private: + + /** + * C++ constructor + */ + CMediaTask(); + + /** + * Symbian constructor + */ + void ConstructL( TResourceReader& aReader ); +private: + /** + * Task caption, list layout + * Owned. + */ + HBufC *iTaskList; + + /** + * Task caption, title layout + * Owned. + */ + HBufC *iTaskTitle; + + /** + * List of MIMEs associated with the task + * Owned (members of the array). + */ + RPointerArray iMimes; + + /** + * List of services associated with the task (1 to 1 correspondence with iMimes, they form pairs together) + */ + RArray iServicesUids; + + /** + * the MIME label + * Owned. + */ + HBufC8 *iMimeLabel; + + /** + * the list of real/discovered CServiceMime associated with the task + * Not Owned (members of the array). + */ + RPointerArray iSMs; //not owned + + /** + * Application captions for the applications associated with the task + * Owned (members of the array). + * Application names NOT owned (names are owned by CServiceMime objects) + */ + RPointerArray iApplications; + + /** + * The UID of the default application for the task + */ + TUid iDefaultAppUid; //the Uid for the default application + + /** + * the index (in the application list) of the default application for the task + */ + TInt iDefaultApp; //index + + }; + + +/** + * Engine class for the application + * + * This class stores a list of Services and MIMEs and it may store a list of Tasks. All data handling operations + * are implemented in this class. + * There are 2 types of clients for the Default App Server: + * 1. General Settings Application (using a plugin). For this type of client we have to display first a list of tasks, + * and if the user switches to the advanced view, we have to display a list of all Services & MIMEs in the system + * for which the user can change the default application. + * 2. Normal applications may also be clients for the Default APp Server. For normal applications, only a list of Services + * and MIMEs for which the cliet application is a default candidate is displayed. The task list is not constructed. + * When the class is instantiated, it looks in the system (AppArc) and it builds all the data structures it needs. After + * that, it can populate various lists for displaying them to the user, and can also change the default application, as + * instructed by the user (AppUi calls the functions). + * + * @since S60 v5.0 + */ +class CDefaultAppServMimeApps : public CBase + { +public: + /** flags used with the Set Default service. They influence what data is stored in the data structures. */ + enum + { + EFlagNoObserver=1, + //R&D values + EFlagShowAllServicesAndMimes = 0x00010000, + EFlagGsClient = 0x00020000, + }; + + /** + * Symbian OS two-phased constructor + * @return + */ + static CDefaultAppServMimeApps* NewL(const TUid& aAppUid, TInt aServiceFlags); + + /** + * Symbian OS two-phased constructor + * @return + */ + static CDefaultAppServMimeApps* NewLC(const TUid& aAppUid, TInt aServiceFlags); + + /** + * Destructor. + */ + virtual ~CDefaultAppServMimeApps(); + + /** + * This function fills with entries a data structure used by a List Box to display Services & MIMEs or Tasks + * + * @since S60 v5.0 + * @param aServicesAndMimes the container for the list entries + */ + void GetServicesAndMimesListL(CDesCArray& aServicesAndMimesArray); + + /** + * This function fills a Popup-list data structure with applications specific to the selected Service & MIME or Task + * + * @since S60 v5.0 + * @param aIndex the index of the selected Service & MIME pair or Task + * @param aApplicationsArray the container for the list entries + * @param aTitle a container for the title of the list (also filled by the function) + */ + void GetApplicationsListL(TInt aIndex, CDesCArray& aApplicationsArray, HBufC*& aTitle); + + /** + * This function sets a new default, for a Service & MIME pair or for a Task. + * The function also updates the list of Services & MIMEs (or Tasks), to display the new default application + * + * @since S60 v5.0 + * @param aServiceAndMimeIndex the index of the selected Service or Mime (or Task) + * @param aDefaultAppIndex the index of the new default application + * @param aServicesAndMimesArray the container for the list entries (to be updated) + */ + void UpdateDefaultL(TInt aServiceAndMimeIndex, TInt aDefaultAppIndex, CDesCArray *aServicesAndMimesArray); + + /** + * This function resets (removes) the defaults associated with a certain task, + * or it can remove all the defaults + * + * @since S60 v5.0 + * @param aCathegory specifies the task index for which the function should reset + * the default, or -1 if all defaults should be reset + * @return 0 or error code (KErrArgument -> aCathegory has an invalid value) + */ + TInt RestoreFactorySettingsL(TInt aCathegory); + +private: //construction + + /** + * C++ constructor + */ + CDefaultAppServMimeApps(); + + /** + * This function builds the info database behind this class. + * For all available services in the resources it creats the corresponding + * Services & MIMEs (or Tasks) instances. + * + * @since S60 v5.0 + * @param aAppUid the Uid of the client application + * @param aServiceFlags different service flags requested by the client + */ + void ConstructL(TUid aAppUid, TInt aServiceFlags); + + /** + * This function builds part the info database behind this class. + * It creates the Services & MIMEs (or Tasks) instances for the given service + * + * @since S60 v5.0 + * @param aServiceUid the Uid of the current service + * @param aServiceIndex the index of the current service + * @param aServiceFlags different service flags requested by the client + * @param aServicesDb pointer to an instance that holds localized service names + */ + void AddMIMEsForServiceL(TUid aServiceUid, TInt aServiceIndex, TInt aServiceFlags, CServicesDB* aServicesDb); + + /** + * This function sorts the Services & MIMEs and their applications. + * It also sorts the Serivces & MIMEs associated with tasks + * + * @since S60 v5.0 + */ + void BeautifyAndSortServMimeApps(void); + + /** + * This function reads from the resource file the list of tasks (and associated data). + * This function is used during construction + * + * @since S60 v5.0 + * @param aResourceId the resource id corresponding to the tasks resource + */ + void GetTaskListL( TInt aResourceId ); + + /** + * This function adds a new Application to a list of an Service & Mime object. + * + * @since S60 v5.0 + * @param aServMime the Service & Mime object + * @param aAppUid the uid of the inserted application + * @param aPrio the priority of the inserted application for the Service & MIME of the host object + * @param aLs pointer to a RApaLsSession object (so we do not need to create a new connection) + */ + void InsertApplicationL(CServiceMime& aServMime, const TUid& aAppUid, const TDataTypePriority& aPrio, const RApaLsSession *aLs); + + /** + * This function takes a task and a Service & MIME object. It checks all the applications that support the given + * Service & MIME object (from its list). If an application is not in the task's application list, this function adds + * it there, with a score of 1. If the application is already in the list, then its score is incremented. + * The Service & MIME object is also marked as being used by a task. + * + * @since S60 v5.0 + * @param aTask the selected task + * @param aServMime the selected Service & MIME object + */ + void PopulateTaskWithApplicationsL(CMediaTask& aTask, CServiceMime* aServMime); + + /** + * This function creates a string that will become en element of a list box. To create the string, the function + * concatenates several sub-strings. + * + * @since S60 v5.0 + * @param aServMime the selected Service & MIME object + * @param aInsertDefaultApp if TRUE, creates an object that also contains the name of the default application for the + * Service & MIME pair + * @return the created string + */ + HBufC* GetServiceAndMimeStringLC(CServiceMime& aServMime, TBool aInsertDefaultApp) const; + + /** + * This function creates a string that will become en element of a list box. To create the string, the function + * concatenates several sub-strings. + * + * @since S60 v5.0 + * @param aMediaTask the selected Task object + * @param aInsertDefaultApp if TRUE, creates an object that also contains the name of the default application for the + * Service & MIME pair + * @return the created string + */ + HBufC* GetMediaTaskStringLC(CMediaTask& aMediaTask, TBool aInsertDefaultApp) const; + +private: //data + + /** + * The list of Services & MIMEs + * Owned (members of the array). + */ + RPointerArray iServMimes; + + /** + * The list of Tasks + * Owned (members of the array). + */ + RPointerArray iTasks; + + /** + * The list of Services & MIMEs that are used by tasks (but otherwise would have been deleted, since they are not + * displayed to the user, because there is no more than one default candidate for each Service & MIME in this list) + * Owned (members of the array). + */ + RPointerArray iTaskServMimes; //ServMimes with a single application, used in tasks + +public: + + /** + * the list of elements, ar required by the dialog + */ + CDesCArraySeg iList; + + /** + * the UID of the client application + */ + TUid iAppUid; + + /** + * TRUE if the current view is the GS simplified view (if this var is TRUE, it also implies that GS is our client) + */ + TBool iSimplifiedView; + + /** + * if TRUE, the client application does not observe our exit. In this case do not display "Exit" in the menu, since + * the client application will not exit when the server exits. + */ + TBool iFlagNoObserver; + }; + + +#endif // C_DEFAULTAPPSRVMIMEVIEW_H + +// end of file \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_srvmime_dlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_srvmime_dlg.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2005-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: The Service & MIME list dlg +* +*/ + + +#ifndef C_DEFAULTAPPSRVMIMEDLG_H +#define C_DEFAULTAPPSRVMIMEDLG_H + + +#include // CDesCArray +#include // CCoeControl +#include // MEikListBoxObserver + + +#include +#include + +// FORWARD DECLARATIONS +class CAknDoubleStyleListBox; +class CDefaultAppAppUi; +//class CDefaultAppServMimeApps; + +/** + * This is the Dialog class of the application + * + * This dialog displays a double list box and it can also display a pop-up list on top of it. + * The elements of the lists are created by the engine (CDefaultAppServMimeApps class) + * + * @since S60 v5.0 + */ +class CDefaultAppSrvMimeDlg : public CAknSelectionListDialog, + public MListBoxItemChangeObserver + { +public: + + /** + * Symbian OS two-phased constructor + * @return + */ + static CDefaultAppSrvMimeDlg* NewL(CDefaultAppAppUi* aAppUi); + + /** + * Destructor. + */ + virtual ~CDefaultAppSrvMimeDlg(); + +public: //from CAknSelectionListDialog + + /** + * From CAknSelectionListDialog. + * This function is called when buttons/softkeys are pressed, to check if the dlg should exit. + * We always return EFalse, since this is a modeless & nonwaiting dialog. + * + * @since S60 v5.0 + * @param aButtonId the list box for which the event happened + */ + virtual TBool OkToExitL(TInt aButtonId); + + /** + * From CAknSelectionListDialog. + * This function is called when a command is issued by the user. + * + * @since S60 v5.0 + * @param aCommandId the list box for which the event happened + */ + virtual void ProcessCommandL(TInt aCommand); + + /** + * From CAknSelectionListDialog. + * This function is called during the construction of the dialog. + * We build the list of elements here. + * + * @since S60 v5.0 + */ + virtual void PreLayoutDynInitL(); + + +public: //from CAknDialog + + /** + * From CAknDialog. + * This function is called to complete the menu construction. + * + * @since S60 v5.0 + * @param aResourceId the resource id + * @param aMenuPane the menu class instance + */ + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + +public: //from CCoeControl + + /** + * From CCoeControl. + * This function is called to get the help context + * + * @since S60 v5.0 + * @param aContext recipient for the help context + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; + + /** + * From CCoeControl. + * Called by the framework when the view size is changed + * + * @since S60 v5.0 + */ + virtual void SizeChanged(); + + /** + * From CCoeControl. + * Called by the framework to process the key event + * + * @since S60 v5.0 + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); + + +public: //own functions + + /** + * Enables marquee for the list elements. + * + * @since S60 v5.0 + */ + void EnableMarqueeL(); + + + /** + * Part of the popup menu construction process: + * gets 2 icons, the selected (ticked) and empty icon + * + * @since S60 v5.0 + * @return an array with the 2 icons + */ + CArrayPtr* GetPopupListIconsL() const; + + /** + * Creates a pop-up list for a selected item of the list-box. + * + * @since S60 v5.0 + * @param aSelectedIndex the selected element (used to get the content of the pop-up list) + */ + void OpenMenuForSelectedServiceAndMimeL(TInt aSelectedIndex); +public: + //from MListBoxItemChangeObserver + void ListBoxItemsChanged(CEikListBox* aListBox); + +private: //construction + + /** + * C++ default constructor. + */ + CDefaultAppSrvMimeDlg(CDefaultAppAppUi* aAppUi, TInt *aSelected); + +private: //data + /** + * Pointer to the AppUi + * Not Owned. + */ + CDefaultAppAppUi* iDefaultAppUi; + + /** + * The index of the selected element in the list. This is pointer to AppUI's index + * Not owned. + */ + TInt *iSelected; + + /** + * Flag allowing to exit the dialog + */ + TBool iOkToExit; + + /** + * Pointer refer to CAknPopupList + */ + CAknPopupList* iPopupList; + }; + + +#endif // C_DEFAULTAPPSRVMIMEDLG_H + +// end of file + + \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/inc/das_view.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/inc/das_view.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2005-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: Standard View +* +*/ + + +#ifndef C_DEFAULTAPPVIEW_H +#define C_DEFAULTAPPVIEW_H + +#include // CCoeControl + + +// FORWARD DECLARATIONS +class CDefaultAppAppUi; + + +class CDefaultAppView : public CCoeControl + { + public: // New methods + + /** + * NewL. + * Two-phased constructor. + * Create a CDefaultAppView object, which will draw itself to aRect. + * @param aRect The rectangle this view will be drawn to. + * @return a pointer to the created instance of CDefaultAppView. + */ + static CDefaultAppView* NewL( const TRect& aRect ); + + /** + * NewLC. + * Two-phased constructor. + * Create a CDefaultAppView object, which will draw itself + * to aRect. + * @param aRect Rectangle this view will be drawn to. + * @return A pointer to the created instance of CDefaultAppView. + */ + static CDefaultAppView* NewLC( const TRect& aRect ); + + /** + * CDefaultAppView + * Virtual Destructor. + */ + virtual ~CDefaultAppView(); + + public: // Functions from base classes + + /** + * From CCoeControl, Draw + * Draw this CDefaultAppView to the screen. + * @param aRect the rectangle of this view that needs updating + */ + void Draw( const TRect& aRect ) const; + + /** + * From CoeControl, SizeChanged. + * Called by framework when the view size is changed. + */ + virtual void SizeChanged(); + + private: // Constructors + + /** + * ConstructL + * @param aRect The rectangle this view will be drawn to. + */ + void ConstructL(const TRect& aRect); + + /** + * C++ default constructor. + */ + CDefaultAppView(); + + }; + +#endif // C_DEFAULTAPPVIEW_H + +// end of file + + \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/loc/defaultappserver.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/loc/defaultappserver.loc Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2005-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: Localization strings for project Default App Server +* +*/ + + +/************* All views *********************/ + +// d:Menu string (cascade), resets settings defaults to original/factory values +// l:list_single_pane_t1_cp2/opt3 +// r:5.0 +// +#define qtn_da_options_reset "Original settings" + +// d:Sub-menu string, resets selected item to original/factory value +// l:list_single_popup_submenu_pane_t1 +// r:5.0 +// +#define qtn_da_options_reset_selected "For selected item" + +// d:Sub-menu string, resets all defaults to original/factory values +// l:list_single_popup_submenu_pane_t1 +// r:5.0 +// +#define qtn_da_options_reset_all "For all items" + + +/************* Simplified view *********************/ + +// d:The title for this view +// d:It describes a list of applications that are launched by default when the user performs a task that is +// d:defined in general terms by the list items (see these items next). Examples of such tasks are: +// d:"Play Music", "Play Videos", "View Images", "Browse web". +// l:title_pane_t2/opt9 +// r:5.0 +// +#define qtn_da_title_main "Default Applications" + +// d:Item in a list of tasks +// d:It describes a task (in general terms) that will be performed by a selected application. +// l:list_double_pane_t1_cp2 +// r:5.0 +// +#define qtn_da_main_view_images "View images" + +// d:Same string as before, as a title for a pop-up menu list +// d:It describes a task (in general terms) that will be performed by a selected application. +// l:heading_pane_t1 +// r:5.0 +// +#define qtn_da_title_popup_image "View images" + +// d:Item in a list of tasks +// d:It describes a task (in general terms) that will be performed by a selected application. +// l:list_double_pane_t1_cp2 +// r:5.0 +// +#define qtn_da_main_play_videos "Play videos" + +// d:Same string as before, as a title for a pop-up menu list +// d:It describes a task (in general terms) that will be performed by a selected application. +// l:heading_pane_t1 +// r:5.0 +// +#define qtn_da_title_popup_video "Play videos" + +// d:Item in a list of tasks +// d:It describes a task (in general terms) that will be performed by a selected application. +// l:list_double_pane_t1_cp2 +// r:5.0 +// +#define qtn_da_main_play_music "Play music" + +// d:Same string as before, as a title for a pop-up menu list +// d:It describes a task (in general terms) that will be performed by a selected application. +// l:heading_pane_t1 +// r:5.0 +// +#define qtn_da_title_popup_music "Play music" + +// d:Item in a list of tasks +// d:It describes a task (in general terms) that will be performed by a selected application. +// l:list_double_pane_t1_cp2 +// r:5.0 +// +#define qtn_da_main_browse "Browse web" + +// d:Same string as before, as a title for a pop-up menu list +// d:It describes a task (in general terms) that will be performed by a selected application. +// l:heading_pane_t1 +// r:5.0 +// +#define qtn_da_title_popup_browse "Browse web" + + +/************* Advanced view *********************/ + +// d:The title for this view +// d:It describes a list of applications that are launched by default when the user performs a task +// d:that is defined quite clear (in engineering terms :-). The task is defined by the Service performed +// d:on a file that has a certain MIME. Examples of such tasks are: +// d:"Open audio/mp3", "Print image/jpeg", "Open application/html", "Edit application/text". +// d:The service name (Open, Print, Edit in the above examples) is localized, the MIME is not. +// l:title_pane_t2/opt9 +// r:5.0 +// +#define qtn_da_title_advanced "Advanced settings" + + + + +/************* Application specific settings view *********************/ +// NOTE: This view is very similar with the "Advanced view", just the title is changed + +// d:The title for this view (the view is very similar with the "Advanced view", the only difference is that +// d:in this view, the list is filtered so only the task specific to the client application are displayed). +// d:The view describes a list of applications that are launched by default when the user performs a task +// d:that is defined quite clear (in engineering terms :-). The task is defined by the Service performed +// d:on a file that has a certain MIME. Examples of such tasks are: +// d:"Open audio/mp3", "Print image/jpeg", "Open application/html", "Edit application/text". +// d:The service name (Open, Print, Edit in the above examples) is localized, the MIME is not. + +// l:title_pane_t2/opt9 +// r:5.0 +// +#define qtn_da_title_app "Default Applications" + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/loc/services_db.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/loc/services_db.loc Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2005-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: Localization strings for project Services DB +* +*/ + + + +/************* Service + MIMEs *********************/ + +/* Examples of MIMEs: + -audio/mpeg + -video/3gpp + -image/jpeg + */ + + + +// d:This is the name of a Service (it should be short) +// d:The parameter is a MIME (non-localizable text). String is scrollable. +// d:This is the default service, it opens a file with an application +// l:None +// r:5.0 +// +#define qtn_da_service_open "Open %U" + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2005-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: Executable module to start the process and load the DefaultAppServer. +* +*/ + + +#include +#include "das_app.h" +#include + +// --------------------------------------------------------------------------- +// NewApplication() +// constructs CDefaultAppApplication +// Returns: CApaDocument*: created application object +// +// --------------------------------------------------------------------------- +LOCAL_C CApaApplication* NewApplication() + { + return new CDefaultAppApplication; + } + +// --------------------------------------------------------------------------- +// E32Main() +// +// --------------------------------------------------------------------------- +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das_app.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das_app.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005-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: This is the main application implementation of default app server. +* +*/ + + +#include "das_app.h" +#include "das_doc.h" +#include "das_server.h" + +// --------------------------------------------------------------------------- +// Return the UID for the CSoundApplication application +// --------------------------------------------------------------------------- +// +TUid CDefaultAppApplication::AppDllUid() const + { + return KUidDefaultAppServer; + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CDefaultAppApplication::CDefaultAppApplication(void) : iDocument(NULL), iServer(NULL) + {} + +// --------------------------------------------------------------------------- +// Create an CDefaultAppDocument document, and return a pointer to it +// --------------------------------------------------------------------------- +// +CApaDocument* CDefaultAppApplication::CreateDocumentL() + { + iDocument = CDefaultAppDocument::NewL(*this); + return (static_cast(iDocument)); + } + +// --------------------------------------------------------------------------- +// Simple function to return a server object +// --------------------------------------------------------------------------- +// +void CDefaultAppApplication::NewAppServerL(CApaAppServer*& aAppServer) + { + aAppServer = iServer = CDefaultAppServer::NewL(this); + } + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das_appui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das_appui.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2005-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: This is the app ui implementation of default application server. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include "das_appui.h" +#include "das_view.h" +#include "das_srvmime_dlg.h" +#include "das_servmimeapps.h" +#include "das.hrh" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CDefaultAppAppUi::~CDefaultAppAppUi() + { + if(iView) + delete iView; + if(iServMimeApps) + delete iServMimeApps; + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CDefaultAppAppUi::CDefaultAppAppUi() : iView(NULL), iDlg(NULL), iExitBack(EFalse) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// Symbian constructor +// --------------------------------------------------------------------------- +// +void CDefaultAppAppUi::ConstructL() +{ + BaseConstructL(EAknEnableSkin|EAknEnableMSK|EAknSingleClickCompatible); + // Create view object + iView = CDefaultAppView::NewL( ClientRect() ); +} + +// --------------------------------------------------------------------------- +// Continues the construction, after the client connects to the server and some data is known +// (client UID and service flags) +// --------------------------------------------------------------------------- +// +void CDefaultAppAppUi::ConstructSrvMimeDlgL(TUid aClientUid, TInt aServiceFlags) +{ + SetClientIconL(aClientUid); + iClientUid = aClientUid; + iSelectedItemSimple=-1; + iSelectedItemAdvanced=-1; + iReloadDlgAdvanced=(aClientUid==KUidGS?EFalse:ETrue); + iReloadDlg=ETrue; + do + { + if(!iServMimeApps) + iServMimeApps=CDefaultAppServMimeApps::NewL(aClientUid, aServiceFlags); + + if(iReloadDlgAdvanced) + { + //some settings for the advanced view + iServMimeApps->iSimplifiedView=EFalse; + } + else + { + //some settings for the simple view + iServMimeApps->iSimplifiedView=ETrue; + }; + iServMimeApps->GetServicesAndMimesListL(iServMimeApps->iList); + + iDlg=CDefaultAppSrvMimeDlg::NewL(this); + SetDialogExist( ETrue ); + iDlg->SetMopParent(this); + iDlg->ExecuteLD(R_DAS_DLG); + iDlg=NULL; + } + while(iReloadDlg); + + + //exit the server + if(iExitBack) + { + //if we exit by "Back" button, notify the client app, so that it does not exit. + CEikAppServer* server = iEikonEnv->AppServer(); //if we do not do this, the client exits when backkey is pressed + if ( server ) + { + server->NotifyServerExit( EAknSoftkeyBack ); + } + }; + //exit this application + RunAppShutter(); +} + +// --------------------------------------------------------------------------- +// From class CAknAppUi. +// handle menu command +// --------------------------------------------------------------------------- +// +void CDefaultAppAppUi::HandleCommandL(TInt aCommand) + { + switch (aCommand) + { + case EAknSoftkeyExit: + __ASSERT_ALWAYS(0,User::Leave(KErrGeneral)); + break; + case EEikCmdExit: + + Exit(); + break; + //no need for default. We may also have other commands that we do not handle here. + } + } + + +// --------------------------------------------------------------------------- +// imports and displays the icon of the client application. +// --------------------------------------------------------------------------- +// +void CDefaultAppAppUi::SetClientIconL(TUid aClietAppUid) + { + CEikStatusPane *statusPane=StatusPane(); + TUid contextPaneUid=TUid::Uid(EEikStatusPaneUidContext); + if(statusPane && statusPane->PaneCapabilities(contextPaneUid).IsPresent()) + { + CAknContextPane *contextPane=(CAknContextPane*)(statusPane->ControlL(contextPaneUid)); //we don't get the ownership + MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); //we don't get the ownership + + CFbsBitmap* iconBmp = NULL; + CFbsBitmap* iconBmpMask = NULL; + + AknsUtils::CreateAppIconLC(skinInstance,aClietAppUid,EAknsAppIconTypeContext, + iconBmp,iconBmpMask); + CleanupStack::Pop(2);//the 2 icons + + contextPane->SetPicture(iconBmp,iconBmpMask);// ownership transfer for the 2 pictures + } + } + +// --------------------------------------------------------------------------- +// Handles layout changes (e.g. from portrait to landscape) +// --------------------------------------------------------------------------- +// +void CDefaultAppAppUi::HandleResourceChangeL(TInt aType) + { + CAknAppUi::HandleResourceChangeL( aType ); + + if(iView) + iView->HandleResourceChange(aType); + if( iDlg && iDialogExist ) + iDlg->HandleResourceChange(aType); + + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + if( iView ) + iView->SetRect(ClientRect()); + if( iDlg && iDialogExist ) + iDlg->SetRect(ClientRect()); + } + } + +// --------------------------------------------------------------------------- +// Handles Window Server events (we are interested in catching the end key event +// and exiting the application +// --------------------------------------------------------------------------- +// +void CDefaultAppAppUi::HandleWsEventL(const TWsEvent & aEvent, CCoeControl * aDestination) + { + CAknAppUi::HandleWsEventL(aEvent,aDestination); + } + +// --------------------------------------------------------------------------- +// This functino is used to record the exist of the dialog; +// and exiting the application +// --------------------------------------------------------------------------- +// +void CDefaultAppAppUi::SetDialogExist( TBool aExist ) + { + iDialogExist = aExist; + } diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das_doc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das_doc.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,65 @@ +/* +* 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: Implementation of the document class +* +*/ + + + +#include "das_doc.h" +#include "das_appui.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Symbian 2-phased constructor +// --------------------------------------------------------------------------- +// +CDefaultAppDocument* CDefaultAppDocument::NewL(CEikApplication& aApp) + { + CDefaultAppDocument* self = NewLC(aApp); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Symbian 2-phased constructor +// --------------------------------------------------------------------------- +// +CDefaultAppDocument* CDefaultAppDocument::NewLC(CEikApplication& aApp) + { + CDefaultAppDocument* self = new (ELeave) CDefaultAppDocument(aApp); + CleanupStack::PushL(self); + return self; + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CDefaultAppDocument::CDefaultAppDocument(CEikApplication& aApp) : CAknDocument(aApp), iDefaultAppUi(NULL) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// Instantiates CDefaultAppAppUi +// --------------------------------------------------------------------------- +// +CEikAppUi* CDefaultAppDocument::CreateAppUiL() + { + iAppUi = iDefaultAppUi = new (ELeave) CDefaultAppAppUi; + return (static_cast(iAppUi)); + } + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das_server.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das_server.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2005-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: Implementation of the server class +* +*/ + + + +#include //for RDebug + +#include "das_server.h" +#include "das_service.h" +#include "das_app.h" + +const TUid KDefaultAppServiceUid = { 0x10281B9D }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Symbian 2-phased constructor +// --------------------------------------------------------------------------- +// +CDefaultAppServer* CDefaultAppServer::NewL(CDefaultAppApplication* aApp) + { + CDefaultAppServer* self = new (ELeave) CDefaultAppServer(aApp); + return self; + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CDefaultAppServer::CDefaultAppServer(CDefaultAppApplication* aApp) : iApp(aApp) + { + } + +// --------------------------------------------------------------------------- +// From class CAknAppServer. +// Creates a service for the specified service Uid +// --------------------------------------------------------------------------- +// +CApaAppServiceBase* CDefaultAppServer::CreateServiceL(TUid aServiceType) const + { + RDebug::Print(_L("CDefaultAppServer::CreateServiceL")); + if (aServiceType == KDefaultAppServiceUid) + return CDefaultAppService::NewL(this); + else + return CAknAppServer::CreateServiceL(aServiceType); + } + + +// End of File diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das_service.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das_service.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2005-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: Implementation of the DefaultApp service +* +*/ + + +//#include //for RDebug +#include "das_server.h" +#include "das_service.h" +#include "das_app.h" +#include "das_doc.h" +#include "das_appui.h" +#include "das_servmimeapps.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CDefaultAppService::CDefaultAppService(const CDefaultAppServer* aServer) : iDefaultAppServer(aServer) + { + iClientUid=TUid::Uid(0); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CDefaultAppService::~CDefaultAppService() + { + delete iIdle; + } +// --------------------------------------------------------------------------- +// Symbian 2-phased constructor +// --------------------------------------------------------------------------- +// +CDefaultAppService* CDefaultAppService::NewL(const CDefaultAppServer* aServer) + { + CDefaultAppService* self = new (ELeave) CDefaultAppService(aServer); + return self; + } + +// --------------------------------------------------------------------------- +// From class CAknAppServiceBase. +// function called when a new message is received +// --------------------------------------------------------------------------- +// +void CDefaultAppService::ServiceL(const RMessage2& aMessage) + { + switch (aMessage.Function()) + { + case ESetDefaultAll : + HandleSetDefaultAllL(aMessage); + break; + default: + CAknAppServiceBase::ServiceL(aMessage); + } + } + +// --------------------------------------------------------------------------- +// From class CAknAppServiceBase. +// function called to check client credentials. Used to retrieve client app UID +// --------------------------------------------------------------------------- +// +CPolicyServer::TCustomResult CDefaultAppService::SecurityCheckL(const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/) + { + iClientUid=aMsg.SecureId(); + return CPolicyServer::EPass; + } + +// --------------------------------------------------------------------------- +// Sets default for all the Service & MIME pairs supported by the client +// --------------------------------------------------------------------------- +// +void CDefaultAppService::HandleSetDefaultAllL(const RMessage2& aMessage) + { + //Get flags + //TInt serviceFlags=aMessage.Int0(); + iServiceFlags=aMessage.Int0(); + aMessage.Complete(KErrNone); + + if(!iIdle) + { + iIdle=CIdle::NewL(CActive::EPriorityStandard); + TCallBack cb(&IdleWorker,this); + iIdle->Start(cb); + }; + } + +// --------------------------------------------------------------------------- +// Function where most of the processing happens. +// We use it so that the service request from the client returns immediately +// --------------------------------------------------------------------------- +// +TInt CDefaultAppService::IdleWorker(TAny *aInstance) + { + CDefaultAppService *service=(CDefaultAppService*)aInstance; + //construct the view + if ( service->iDefaultAppServer && + service->iDefaultAppServer->iApp && + service->iDefaultAppServer->iApp->iDocument && + service->iDefaultAppServer->iApp->iDocument->iDefaultAppUi) + { + service->iDefaultAppServer->iApp->iDocument->iDefaultAppUi->ConstructSrvMimeDlgL(service->iClientUid,service->iServiceFlags); + }; + return 0; //no more work to do + } + + + + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das_servmimeapps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das_servmimeapps.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,1073 @@ +/* +* Copyright (c) 2005-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: Keeps info about Services, MIMEs and Applications +* +*/ + + +// System includes +#include // STATIC_CAST +#include // R_DAS_SERVICESMIMES_LISTBOX +#include // StringLoader +#include //TResourceRead +#include //CEikonEnv +#include +#include // CApaMaskedBitmap + +#include + +#include "das_servmimeapps.h" +#include "das_app.h" // KUidDefaultAppServer +#include + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include // KDataTypePrioritySystem +#endif + +const TInt KStringMargin = 10; //10 is a sufficiently large margin + +// ======== MEMBER FUNCTIONS ======== CAppHelper + +// --------------------------------------------------------------------------- +// Symbian 2-phased constructor +// --------------------------------------------------------------------------- +// +CAppHelper* CAppHelper::NewLC(const TDesC& aName, const TInt aUid) + { + CAppHelper* self = new (ELeave) CAppHelper(aUid,0); + CleanupStack::PushL(self); + //construct iName, copy it + self->iName = HBufC::NewL(aName.Size()); + TPtr* ptr=new (ELeave) TPtr(self->iName->Des()); + ptr->Copy(aName); + delete ptr; + + return self; + } + +// --------------------------------------------------------------------------- +// Symbian 2-phased constructor +// --------------------------------------------------------------------------- +// +CAppHelper* CAppHelper::NewLC(const CAppHelper& aApp) + { + CAppHelper* self = new (ELeave) CAppHelper(aApp.iUid,1,aApp.iFlags); + CleanupStack::PushL(self); + //construct iName, get pointer and flag it + self->iName = aApp.iName; + self->iFlags |= EFlagNameNotOwned; + return self; + } + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CAppHelper::CAppHelper(const TInt aUid, const TInt aScore, const TInt aFlags): + iName(NULL), iUid(aUid), iScore(aScore), iFlags(aFlags) + { + //no implementation needed + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CAppHelper::~CAppHelper(void) + { + if(!( iFlags&EFlagNameNotOwned )) + delete iName; + iName = NULL; + } +// --------------------------------------------------------------------------- +// This function is used to order Applications +// --------------------------------------------------------------------------- +// +TInt CAppHelper::OrderApplications(const CAppHelper& a1, const CAppHelper& a2) + { + //if a1 *a2.iName) return 1; + //if we are here, strings were equal + return 0; + } + + +// ======== MEMBER FUNCTIONS ======== CServiceMime + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CServiceMime::CServiceMime() : iServiceMime(NULL), iMime(NULL) + { + iDefaultAppUid=TUid::Uid(0); + iDefaultApp=-1;//currently we do not know the default index + iUsedByTasks=EFalse; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CServiceMime::~CServiceMime() + { + if (iServiceMime) delete iServiceMime; + if (iMime) delete iMime; + for (TInt i=0 ; i*a2.iMime)return 1; + //if we are here, MIMEs are the same + if(*a1.iServiceMime<*a2.iServiceMime)return -1; + if(*a1.iServiceMime>*a2.iServiceMime)return 1; + //if we are here, strings were equal + return 0; + } + +// ======== MEMBER FUNCTIONS ======== CMediaTask + +// --------------------------------------------------------------------------- +// Symbian 2-phased constructor +// --------------------------------------------------------------------------- +// +CMediaTask* CMediaTask::NewLC( TResourceReader& aReader ) + { + CMediaTask* self = new (ELeave) CMediaTask(); + CleanupStack::PushL(self); + self->ConstructL(aReader); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMediaTask::~CMediaTask() + { + + if(iTaskList)delete iTaskList; + if(iTaskTitle)delete iTaskTitle; + + if(iMimeLabel)delete iMimeLabel; + + iMimes.ResetAndDestroy(); + iServicesUids.Close(); + + iSMs.Close();//elements not owned + + iApplications.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CMediaTask::CMediaTask() : iMimeLabel(NULL), iDefaultApp(-1) + { + } + +// --------------------------------------------------------------------------- +// The construction means reading the task details from the resource file +// --------------------------------------------------------------------------- +// +void CMediaTask::ConstructL( TResourceReader& aReader ) + { + TInt i,count; + //read the task name + iTaskList = aReader.ReadHBufCL(); + if( !iTaskList )User::Leave(KErrArgument); + + //read the task title + iTaskTitle = aReader.ReadHBufCL(); + if( !iTaskTitle )User::Leave(KErrArgument); + + //read the mime label + iMimeLabel = aReader.ReadHBufC8L(); + if( !iMimeLabel )User::Leave(KErrArgument); + + //read the service mimes entries + count = aReader.ReadInt16(); + for (i=0; iConstructL(aAppUid, aServiceFlags); + return self; + } + +// --------------------------------------------------------------------------- +// This function builds the data structures for the dialog: +// It reads the considered services from the resource files, then it builds the +// task list and the associated list of Services& MIMEs and applications. +// --------------------------------------------------------------------------- +// +void CDefaultAppServMimeApps::ConstructL(TUid aAppUid, TInt aServiceFlags) + { + //set the client app uid + /* Uncomment this for testing the General Settings (Control Pannel) specific view from another application (R&D purpose) + * + TBool flagGsClient = aServiceFlags & EFlagGsClient; + if(flagGsClient)aAppUid=KUidGS; //we mimic the GS Client. + */ + iAppUid = aAppUid; + + //for all the available services, launch the AddMIMEsForServiceL function + TResourceReader reader; + CEikonEnv::Static()->CreateResourceReaderLC( reader, R_DA_SERVICE_MIME ); + CServicesDB* sdb = CServicesDB::NewLC(&reader); + TInt i; + TUid uid; + for(i=0; iCount(); i++) + { + uid = sdb->ServiceUidL(i); + AddMIMEsForServiceL(uid,i,aServiceFlags,sdb); + }; + CleanupStack::PopAndDestroy(sdb); + CleanupStack::PopAndDestroy( ); // reader + //change MIMEs & sort + BeautifyAndSortServMimeApps(); + } + +// --------------------------------------------------------------------------- +// this is by far the most complicated function in the entire subsystem +// some more comments are needed, but after this function will be split in 2 +// --------------------------------------------------------------------------- +// +void CDefaultAppServMimeApps::AddMIMEsForServiceL(TUid aServiceUid, TInt aServiceIndex, TInt aServiceFlags, CServicesDB* aServicesDb) + { + CServiceMime *sm = NULL; + TUid uid; + + RApaLsSession ls; + TApaAppInfo info; + CApaAppServiceInfoArray* serv=NULL; + CServiceRegistry *sr=NULL; + TInt i,j,k; + TInt it,jt;//indexes for iterating inside tasks + TInt lowerMarker, upperMarker; + //flags + TBool flagShowAll = EFalse; + /* + * Uncomment the line below to show all the Services & MIMEs in views, and not only those for which default app can be changed. + * This can be used for R&D, to see all the MIMEs&Services in the system. + flagShowAll = aServiceFlags & EFlagShowAllServicesAndMimes; + */ + iFlagNoObserver = aServiceFlags & EFlagNoObserver; + + //check who is connecting, so that we can set the view + if(iAppUid == KUidGS) + { + iSimplifiedView=ETrue; //at least in the beginning. + //For this function, this is also a flag that says if we have GS as client or not + GetTaskListL(R_DA_TASKS); + } + else iSimplifiedView=EFalse; + + //connect + User::LeaveIfError( ls.Connect() ); + CleanupClosePushL( ls ); + + //Get all the apps and MIMEs for the current service + ls.GetAppInfo(info,iAppUid); + serv=ls.GetServiceImplementationsLC(aServiceUid); + lowerMarker = upperMarker = iServMimes.Count(); + //create entries for the MIMEs supported by the client application + for (i=0; iArray().Count(); i++) + { + uid=serv->Array()[i].Uid(); + if( iSimplifiedView || uid == iAppUid) //this means that for app clients, we first skip all the other applications + { + //if iSimplifiedView is true, then we have GS as a client + for(j=0; jArray()[i].DataTypes().Count(); j++) + { + TBool createSM=ETrue; + if(iSimplifiedView) + { + //check if we already have an entry for this service & MIME + for(k=lowerMarker; kiMime->Des() == serv->Array()[i].DataTypes()[j].iDataType.Des8()) + { + //we found it! + sm=iServMimes[k]; + createSM=EFalse; + break;//we found the sm, no need to search for it any more + } + //if we don't find it, we will create an entry ... + } + + if(createSM) + { + //we have to create sm, we did not found it previously (or we were not looking for it) + sm=new (ELeave) CServiceMime; + CleanupStack::PushL(sm); + sm->iMime = HBufC8::NewL(serv->Array()[i].DataTypes()[j].iDataType.Des8().Size()); + *(sm->iMime) = serv->Array()[i].DataTypes()[j].iDataType.Des8(); + //transform the MIME from audio/mpeg to audio mpeg + HBufC *transformedMime=HBufC::NewLC(serv->Array()[i].DataTypes()[j].iDataType.Des().Size()); + TPtr *ptr=new (ELeave) TPtr(transformedMime->Des()); + CleanupStack::PushL(ptr); + ptr->Copy(serv->Array()[i].DataTypes()[j].iDataType.Des()); + TInt location=ptr->Locate('/'); + if(location>0)ptr->Replace(location,1,_L(" ")); + //transforming done + //sm->iServiceMime = aServicesDb->ServiceStringLC(aServiceIndex, serv->Array()[i].DataTypes()[j].iDataType.Des()); + sm->iServiceMime = aServicesDb->ServiceStringLC(aServiceIndex, transformedMime->Des()); + CleanupStack::Pop(sm->iServiceMime); + CleanupStack::PopAndDestroy(ptr); + CleanupStack::PopAndDestroy(transformedMime); + //StringLoader::LoadL( R_DA_SERVICE_OPEN, serv->Array()[i].DataTypes()[j].iDataType.Des()); + sm->iServiceUid=aServiceUid; + } + + //insert the client application + InsertApplicationL(*sm, uid, serv->Array()[i].DataTypes()[j].iPriority, &ls); + + //get the Uid of the default application for this service and MIME + ls.AppForDataType(serv->Array()[i].DataTypes()[j].iDataType,sm->iDefaultAppUid); + + if(createSM) + { + //sm was created this iteration, ad it. + iServMimes.AppendL(sm);//takes ownership of sm + upperMarker++; + CleanupStack::Pop(sm); + + } + }//for + /* + * If a service that has no MIME will be considered, some code must be added (probably in this place) + */ + }//if ( + + } + __ASSERT_DEBUG(upperMarker == iServMimes.Count(), User::Panic( _L("upperMarker bad value"), 1)); + + if(sr) + { + //we do not need it any more + delete sr; + sr=NULL; + } + if(lowerMarker == upperMarker) + { + //current app does not support any MIME for the current service, clean and get out of here + CleanupStack::PopAndDestroy(serv); + CleanupStack::PopAndDestroy(); // closes RApaLsSession + return; + } + + if(!iSimplifiedView) + { + //if we are here, we have MIMEs for the current service + //iterate once more and add applications for MIMEs already in the list + for (i=0; iArray().Count(); i++) + { + uid=serv->Array()[i].Uid(); + if( uid == iAppUid) continue; //we don't add our client application once more in the list (it is already there) + for(j=0; jArray()[i].DataTypes().Count(); j++) + for(k=lowerMarker; kiMime->Des() == serv->Array()[i].DataTypes()[j].iDataType.Des8()) + { + InsertApplicationL(*(iServMimes[k]), serv->Array()[i].Uid(), serv->Array()[i].DataTypes()[j].iPriority, &ls); + }//if same MIME + } + } + + //before deleting some of the entries ... + if(iSimplifiedView) + { + //check the service & MIMEs against the task list... + //first, check the service against task services + for(it=0; itiServicesUids.Count(); jt++) + if(aServiceUid.iUid == iTasks[it]->iServicesUids[jt]) + { + //lets check if the MIME matches too... + for(k=lowerMarker; kiMime == *iTasks[it]->iMimes[jt]) + { + //this entry matches an entry in the task list + //add the applications to the list + PopulateTaskWithApplicationsL(*iTasks[it],iServMimes[k]); + //link the sm, if it has more than 1 application + break;//sm found, no need to search for it further + } + } + } + + + + //iterate from the newly added entries and set the index + for(k=lowerMarker; kiApplications.Count() <2 && !flagShowAll) + { + //this entry has a single element (that should not be shown) + //we either delete it, or move it + if(iServMimes[k]->iUsedByTasks) + { + //the sm is used by tasks, we move it + iTaskServMimes.AppendL(iServMimes[k]);//takes ownership of sm + } + else + { + //the sm is not used by tasks, we delete it. + delete iServMimes[k]; + } + + //we remove the entry from the iServMimes (so that it is not shown) + iServMimes.Remove(k); + k--; + upperMarker--; + smSetOrRemoved=ETrue; + } + + //set the index + if(!smSetOrRemoved) + { + for(i=0 ; i< iServMimes[k]->iApplications.Count() ; i++) + { + if(iServMimes[k]->iApplications[i]->iUid == iServMimes[k]->iDefaultAppUid.iUid) + iServMimes[k]->iDefaultApp=i; + } + } + }; + + if(iSimplifiedView) + for(it=0; itiDefaultAppUid.iUid == 0 && iTasks[it]->iApplications.Count()>0) + { + //there is no uid, look for the platform App and make it the default + for(jt=0; jtiApplications.Count(); jt++) + if(iTasks[it]->iApplications[jt]->iFlags & CAppHelper::EFlagPlatformApp) + { + iTasks[it]->iDefaultAppUid.iUid = iTasks[it]->iApplications[jt]->iUid; + iTasks[it]->iDefaultApp=jt; + break;//app found, no need to search for it any longer + }; + + //if no app found, mark the first one as default + if(iTasks[it]->iDefaultAppUid.iUid == 0) + { + iTasks[it]->iDefaultAppUid.iUid = iTasks[it]->iApplications[0]->iUid; + iTasks[it]->iDefaultApp = 0;//the index + }; + } + else + for(jt=0; jtiApplications.Count(); jt++) + if(iTasks[it]->iApplications[jt]->iUid == iTasks[it]->iDefaultAppUid.iUid) + { + iTasks[it]->iDefaultApp=jt; + break;//app found, no need to search for it any longer + } + + //done, destroy serv + CleanupStack::PopAndDestroy(serv); + CleanupStack::PopAndDestroy( ); // closes RApaLsSession + } + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CDefaultAppServMimeApps::CDefaultAppServMimeApps(): iList(4) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CDefaultAppServMimeApps::~CDefaultAppServMimeApps() + { + iServMimes.ResetAndDestroy(); + iTasks.ResetAndDestroy(); + iTaskServMimes.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// This function sorts the Services & MIMEs and their applications. +// It also sorts the Serivces & MIMEs associated with tasks +// --------------------------------------------------------------------------- +// +void CDefaultAppServMimeApps::BeautifyAndSortServMimeApps(void) + { + //first, go through the Services & MIMEs localized names and sort them + TLinearOrder order(&CServiceMime::OrderServiceMimes); + iServMimes.Sort(order); + + //go through applications and sort them + TInt i,j; + for(i=0; i order2(&CAppHelper::OrderApplications); + iServMimes[i]->iApplications.Sort(order2); + //get our app index + for(j=0; jiApplications.Count(); j++) + if(iServMimes[i]->iApplications[j]->iUid == iServMimes[i]->iDefaultAppUid.iUid) + iServMimes[i]->iDefaultApp = j; + }; + //if we have tasks, we sort their apps too + for(i=0; i order2(&CAppHelper::OrderApplications); + iTasks[i]->iApplications.Sort(order2); + //get our app index + for(j=0; jiApplications.Count(); j++) + if(iTasks[i]->iApplications[j]->iUid == iTasks[i]->iDefaultAppUid.iUid) + iTasks[i]->iDefaultApp = j; + }; + } + + +// --------------------------------------------------------------------------- +// This function reads from the resource file the list of tasks (and associated data). +// This function is used during construction +// --------------------------------------------------------------------------- +// +void CDefaultAppServMimeApps::GetTaskListL( TInt aResourceId ) + { + TResourceReader reader; + TInt i; + CServiceRegistry* sr=CServiceRegistry::NewL(); + CleanupStack::PushL(sr); + + // Read tasks + + CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId ); + + TInt count = reader.ReadInt16(); + for ( i = 0; i < count; i++ ) + { + CMediaTask* task=CMediaTask::NewLC(reader); + // Read the default application for this task ... + sr->GetDefault(KOpenServiceUid, *task->iMimeLabel, task->iDefaultAppUid); + + //add the task to the list + iTasks.Append(task); + CleanupStack::Pop(task); + } + + CleanupStack::PopAndDestroy(); // reader + CleanupStack::PopAndDestroy(sr); + } + +// --------------------------------------------------------------------------- +// This function adds a new Application to a list of an Service & Mime object. +// --------------------------------------------------------------------------- +// +void CDefaultAppServMimeApps::InsertApplicationL(CServiceMime& aServMime, const TUid& aAppUid, const TDataTypePriority& aPrio, const RApaLsSession *aLs) + { + TBool addIt = ETrue; + + if(aPrio == KDataTypePrioritySystem) + { + // the application to be inserted has system priority + if(aServMime.iDefaultApp == -1) + { + //we have non-system applications in the list + //delete them ... + aServMime.iApplications.ResetAndDestroy(); + + //... and make the default -2 ... (it means single app with system priority) + aServMime.iDefaultApp = -2; + //... and add our application (after exiting from the "if") + } + else + { + //do not delete the applications, but just add our application + //...and make the default -3 (it means multiple apps with system priority) + aServMime.iDefaultApp = -3; + //... and add our application (after exiting from the "if") + } + } + else + { + // the application to be inserted does NOT have system priority + if(aServMime.iDefaultApp < -1) + { + // there are only System apps in the list, do not add ours + addIt = EFalse; + } + // else there are normal applications in the list, insert ours, as well + } + //add the application to the list + if(addIt) + { + TApaAppInfo info; + aLs->GetAppInfo(info,aAppUid); + //find the best name for the application + CAppHelper *app = NULL; + if(info.iCaption.Size() != 0) + { + //this is for now, the preferred name + app = CAppHelper::NewLC(info.iCaption, aAppUid.iUid); + } + else + { + //fall-back name + app = CAppHelper::NewLC(info.iShortCaption, aAppUid.iUid); + }; + //is the app platform application?? + if (info.iFullName.Left(1) == _L("Z") || + info.iFullName.Left(1) == _L("z")) + app->iFlags |= CAppHelper::EFlagPlatformApp; + //append the name + aServMime.iApplications.AppendL(app); + CleanupStack::Pop(app); + } + } + +// --------------------------------------------------------------------------- +// This function takes a task and a Service & MIME object. It checks all the applications that support the given +// Service & MIME object (from its list). If an application is not in the task's application list, this function adds +// it there, with a score of 1. If the application is already in the list, then its score is incremented. +// The Service & MIME object is also marked as being used by a task. +// --------------------------------------------------------------------------- +// +void CDefaultAppServMimeApps::PopulateTaskWithApplicationsL(CMediaTask& aTask,CServiceMime* aServMime) + { + TInt i,j; + TBool found; + //add the applications to the list + for(i=0; iiApplications.Count(); i++) + { + found=EFalse; + for(j=0; jiApplications[i]->iUid == aTask.iApplications[j]->iUid) + { + //we found this application... + found=ETrue; + //... increase its score + aTask.iApplications[j]->iScore++; + //... and get to the next application + break; //application found, no need to search for it any more + } + //if the application was not found, we have to add it! + if(!found) + { + CAppHelper *app = CAppHelper::NewLC(*aServMime->iApplications[i]); + aTask.iApplications.AppendL(app); + CleanupStack::Pop(app); + } + } + //mark the sm + aServMime->iUsedByTasks=ETrue; + //link the sm + aTask.iSMs.Append(aServMime); + } + +// --------------------------------------------------------------------------- +// This function fills with entries a data structure used by a List Box to display Services & MIMEs or Tasks +// --------------------------------------------------------------------------- +// +void CDefaultAppServMimeApps::GetServicesAndMimesListL(CDesCArray& aServicesAndMimesArray) + { + TInt i; + aServicesAndMimesArray.Reset(); + if(iSimplifiedView) + { + for ( i=0 ; i *apps=NULL; + + //get the proper list + if(iSimplifiedView) + apps = &(iTasks[aIndex]->iApplications); + else + apps = &(iServMimes[aIndex]->iApplications); + + for ( i=0 ; iCount() ; i++ ) + { + len=(*apps)[i]->iName->Size() + KStringMargin ; + if(len>bufLen) + { + newString=string->ReAllocL(len); + if(newString != string) + { + CleanupStack::Pop(string);//already destroyed + string=newString; + CleanupStack::PushL(string); + } + bufLen=len; + newString=NULL; + } + //copy the application into the string buffer + TPtr ptr=string->Des(); + TBool isDefault=EFalse; + + if( iSimplifiedView && iTasks[aIndex]->iDefaultApp==i) isDefault=ETrue; + if( !iSimplifiedView && iServMimes[aIndex]->iDefaultApp==i) isDefault=ETrue; + + if( isDefault ) ptr.Copy(KStringAppsDefault); + else ptr.Copy(KStringAppsNonDefault); + ptr.Append(*(*apps)[i]->iName); + + aApplicationsArray.AppendL (ptr); + } + + CleanupStack::PopAndDestroy(string); //data in ptr is out of scope + + //get the title now + if ( iSimplifiedView ) + aTitle = GetMediaTaskStringLC(*iTasks[aIndex], EFalse); + else + aTitle = GetServiceAndMimeStringLC(*iServMimes[aIndex], EFalse); + CleanupStack::Pop(aTitle); + } + +// --------------------------------------------------------------------------- +// This function sets a new default, for a Service & MIME pair or for a Task. +// The function also updates the list of Services & MIMEs (or Tasks), to display the new default application +// --------------------------------------------------------------------------- +// +void CDefaultAppServMimeApps::UpdateDefaultL(TInt aServiceAndMimeIndex, TInt aDefaultAppIndex, CDesCArray *aServicesAndMimesArray) + { + //check for correct parameters + if (aServiceAndMimeIndex <0 || aDefaultAppIndex <0) User::Leave(KErrArgument); + if(iSimplifiedView) + { + if( aServiceAndMimeIndex >= iTasks.Count() || + aDefaultAppIndex >= iTasks[aServiceAndMimeIndex]->iApplications.Count()) + User::Leave(KErrArgument); + } + else + { + if( aServiceAndMimeIndex >= iServMimes.Count() || + aDefaultAppIndex >= iServMimes[aServiceAndMimeIndex]->iApplications.Count()) + User::Leave(KErrArgument); + } + + //if we are here, parameters are within their range + TBool doUpdate=ETrue; + TUid defaultAppUid; + CServiceRegistry *sr=CServiceRegistry::NewL(); + CleanupStack::PushL(sr); + + //update the default in the Service Registry + if(iSimplifiedView) + { + TInt i,j; + TUid serviceUid; + //set the default for the generic MIME (and our server application) + TDataType dt(*iTasks[aServiceAndMimeIndex]->iMimeLabel); + defaultAppUid=TUid::Uid(iTasks[aServiceAndMimeIndex]->iApplications[aDefaultAppIndex]->iUid); + if(sr->SetDefault(KOpenServiceUid, dt,defaultAppUid)) + { + //if we are here, SetDefault returned an error. + //so we do not update the default... + doUpdate=EFalse; + } + //set the selected default for all the Services & MIME that it supports + if(doUpdate) + { + for(i=0; iiSMs.Count(); i++) + for(j=0; jiSMs[i]->iApplications.Count(); j++) + if(defaultAppUid.iUid == iTasks[aServiceAndMimeIndex]->iSMs[i]->iApplications[j]->iUid ) + { + //the selected application supports this Service & MIME pair. + //make the app default for the pair. + dt=*iTasks[aServiceAndMimeIndex]->iSMs[i]->iMime; + serviceUid=iTasks[aServiceAndMimeIndex]->iSMs[i]->iServiceUid; + sr->SetDefault(serviceUid, dt,defaultAppUid); + //update the sm so that it reflects the new default + iTasks[aServiceAndMimeIndex]->iSMs[i]->iDefaultAppUid=defaultAppUid; + iTasks[aServiceAndMimeIndex]->iSMs[i]->iDefaultApp=j; + break; //application found in sm's list, do not need to search for it any more + } + //update the default entries + iTasks[aServiceAndMimeIndex]->iDefaultApp=aDefaultAppIndex; + iTasks[aServiceAndMimeIndex]->iDefaultAppUid=defaultAppUid; + } + + } + else + { + TDataType dt(*iServMimes[aServiceAndMimeIndex]->iMime); + defaultAppUid=TUid::Uid(iServMimes[aServiceAndMimeIndex]->iApplications[aDefaultAppIndex]->iUid); + if(sr->SetDefault(iServMimes[aServiceAndMimeIndex]->iServiceUid, dt,defaultAppUid)) + { + //if we are here, SetDefault returned an error. + //so we do not update the default... + doUpdate=EFalse; + } + //update the default entries + if(doUpdate) + { + iServMimes[aServiceAndMimeIndex]->iDefaultApp=aDefaultAppIndex; + iServMimes[aServiceAndMimeIndex]->iDefaultAppUid=defaultAppUid; + } + } + CleanupStack::PopAndDestroy(sr); + + //check if setting the default failed + if(!doUpdate) + { + //### if updating the default failed, here would be the place to put an error note to the user + return; // or leave + }; + + //update the item in the list + if (aServicesAndMimesArray) + { + //get the string + TDesC* string; + if(iSimplifiedView) + string = GetMediaTaskStringLC(*iTasks[aServiceAndMimeIndex], ETrue); + else + string = GetServiceAndMimeStringLC(*iServMimes[aServiceAndMimeIndex], ETrue); + aServicesAndMimesArray->Delete(aServiceAndMimeIndex); + aServicesAndMimesArray->InsertL(aServiceAndMimeIndex,*string); + CleanupStack::PopAndDestroy(string); + } + } + +// --------------------------------------------------------------------------- +// This function creates a string that will become en element of a list box. To create the string, the function +// concatenates several sub-strings. +// --------------------------------------------------------------------------- +// +HBufC* CDefaultAppServMimeApps::GetServiceAndMimeStringLC(CServiceMime& aServMime, TBool aInsertDefaultApp) const + { + HBufC *string=NULL; + TPtr *ptr=NULL; + TInt len; + _LIT(KTab,"\t"); + + if(aInsertDefaultApp && aServMime.iDefaultApp >= 0) //it may be that we do not have a default ... + len=aServMime.iApplications[aServMime.iDefaultApp]->iName->Size(); + else + len=0; + len+= aServMime.iServiceMime->Size(); + len+= KStringMargin ; + + string=HBufC::NewLC(len); + + //build the string, add the tabs before and after + ptr=new (ELeave) TPtr(string->Des()); + CleanupStack::PushL(ptr); + + ptr->Copy(*aServMime.iServiceMime); + + if(aInsertDefaultApp) + { + ptr->Insert(0,KTab); + ptr->Append(KTab); + + //add default app + if(aServMime.iDefaultApp >= 0) //it may be that we do not have a default ... + ptr->Append(*aServMime.iApplications[aServMime.iDefaultApp]->iName); + } + + CleanupStack::PopAndDestroy(ptr); + + return string; //pass ownership, string also on the stack + + } + +// --------------------------------------------------------------------------- +// This function creates a string that will become en element of a list box. To create the string, the function +// concatenates several sub-strings. +// --------------------------------------------------------------------------- +// +HBufC* CDefaultAppServMimeApps::GetMediaTaskStringLC(CMediaTask& aMediaTask, TBool aInsertDefaultApp) const + { + TPtr *ptr=NULL; + TInt len = KStringMargin; + _LIT(KTab,"\t"); + HBufC *taskName=NULL; //not owned, not deleted at the end of function + + //compute the string length + if(aInsertDefaultApp) + { + //we insert the task list name + taskName = aMediaTask.iTaskList; + //we also insert the length od the default app (if we have it) + if(aMediaTask.iDefaultApp >= 0)//it may be that we do not have a default ... + len += aMediaTask.iApplications[aMediaTask.iDefaultApp]->iName->Size(); + } + else + { + //we should insert the task title, if we have it + taskName = aMediaTask.iTaskTitle; + //taskName = aMediaTask.iTaskList; + }; + len += taskName->Size(); + + //allocate the string + HBufC *string=HBufC::NewLC(len); + + //add the title + ptr=new (ELeave) TPtr(string->Des()); + CleanupStack::PushL(ptr); + ptr->Copy(*taskName); + + //add other stuff + if(aInsertDefaultApp) + { + ptr->Insert(0,KTab); + ptr->Append(KTab); + //add default app + if(aMediaTask.iDefaultApp >= 0) //it may be that we do not have a default ... + ptr->Append(*aMediaTask.iApplications[aMediaTask.iDefaultApp]->iName); + } + + CleanupStack::PopAndDestroy(ptr); + + return string; //pass ownership, string also on the stack + } + +// --------------------------------------------------------------------------- +// This function resets (removes) the defaults associated with a certain task, +// or it can remove all the defaults +// --------------------------------------------------------------------------- +// +TInt CDefaultAppServMimeApps::RestoreFactorySettingsL(TInt aCathegory) + { + TInt i, j; + CServiceRegistry *sr=NULL; + + if(aCathegory == -1) + { + sr=CServiceRegistry::NewL(); + + if ( iSimplifiedView ) + { + for(i=0; iiMimes.Count(); j++) + { + sr->RemoveEntry(TUid::Uid(iTasks[i]->iServicesUids[j]), TDataType(*iTasks[i]->iMimes[j])); + } + //remove the entry that identifies the default app for the task + sr->RemoveEntry(KOpenServiceUid, TDataType(*iTasks[i]->iMimeLabel)); + } + } + else + { + //we reset the defaults for all the services & MIME + for(i=0; iRemoveEntry(iServMimes[i]->iServiceUid, TDataType(*iServMimes[i]->iMime)); + //remove the entry that identifies the default app for the task + for(i=0; iRemoveEntry(KOpenServiceUid, TDataType(*iTasks[i]->iMimeLabel)); + } + } + else if(iSimplifiedView && aCathegory >= 0 && aCathegory < iTasks.Count()) + { + //we are in simplified view, restore defaults for a single task + sr=CServiceRegistry::NewL(); + for(i=0; iiMimes.Count(); i++) + sr->RemoveEntry(TUid::Uid(iTasks[aCathegory]->iServicesUids[i]), TDataType(*iTasks[aCathegory]->iMimes[i])); + //remove the entry that identifies the default app for the task + sr->RemoveEntry(KOpenServiceUid, TDataType(*iTasks[aCathegory]->iMimeLabel)); + } + else if(!iSimplifiedView && aCathegory >= 0 && aCathegory < iServMimes.Count()) + { + //we are in the advanced view, restore defaults for a single Service & MIME pair + sr=CServiceRegistry::NewL(); + sr->RemoveEntry(iServMimes[aCathegory]->iServiceUid, TDataType(*iServMimes[aCathegory]->iMime)); + } + else return -1; //wrong aCathegory range + + if(sr) delete sr; + return 0; + } diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das_srvmime_dlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das_srvmime_dlg.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,530 @@ +/* +* Copyright (c) 2005-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: Implementation of the Services & MIME view class +* +*/ + + + +// System includes +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "das_srvmime_dlg.h" +#include "das_servmimeapps.h" +#include "das_appui.h" +#include "das_app.h" +#include "das.hrh" +#include "das.hlp.hrh" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Symbian 2-phased constructor +// --------------------------------------------------------------------------- +// +CDefaultAppSrvMimeDlg* CDefaultAppSrvMimeDlg::NewL(CDefaultAppAppUi* aAppUi) + { + //we first need to create a CDefaultAppServMimeApps instance + TInt *selected; + if(aAppUi->iReloadDlgAdvanced) + { + //some settings for the advanced view + selected=&(aAppUi->iSelectedItemAdvanced); + } + else + { + //some settings for the simple view + selected=&(aAppUi->iSelectedItemSimple); + }; + + //create the dialog instance (ownership of servMimeApps is passed to the dialog + CDefaultAppSrvMimeDlg *dialog=new(ELeave)CDefaultAppSrvMimeDlg(aAppUi, selected); + CleanupStack::PushL(dialog); + dialog->ConstructL(R_DAS_MENUBAR); + CleanupStack::Pop(dialog); + return dialog; + } + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CDefaultAppSrvMimeDlg::CDefaultAppSrvMimeDlg(CDefaultAppAppUi* aAppUi, TInt *aSelected) : + CAknSelectionListDialog(*aSelected, &aAppUi->iServMimeApps->iList, NULL), + iDefaultAppUi(aAppUi), iSelected(aSelected), iOkToExit(EFalse) + { + //no implementation necessary + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CDefaultAppSrvMimeDlg::~CDefaultAppSrvMimeDlg() + { + if ( iDefaultAppUi ) + { + iDefaultAppUi->SetDialogExist( EFalse ); + } + + if ( iPopupList ) + { + iPopupList->CancelPopup(); + iPopupList = NULL; + } + } + + +// --------------------------------------------------------------------------- +// From class From CAknSelectionListDialog +// This function is called when buttons/softkeys are pressed, to check if the dlg should exit. +// We make the checkings and return the result. +// --------------------------------------------------------------------------- +// +TBool CDefaultAppSrvMimeDlg::OkToExitL(TInt aButtonId) + { + CAknSelectionListDialog::OkToExitL(aButtonId); + if ( aButtonId == EAknSoftkeyOptions && iPopupList ) + { + iPopupList->CancelPopup(); + iPopupList = NULL; + } + if(aButtonId == EAknSoftkeyBack || aButtonId == EAknCmdOpen || aButtonId == EAknSoftkeyOk) + { + ProcessCommandL(aButtonId); + }; + if(aButtonId==EAknCmdEnd || aButtonId==EAknSoftkeyCancel) + { + iOkToExit=ETrue; + iDefaultAppUi->iReloadDlg=EFalse; + } + return iOkToExit; + } + +// --------------------------------------------------------------------------- +// From class From CAknSelectionListDialog +// This function is called when a command is issued by the user. +// --------------------------------------------------------------------------- +// +void CDefaultAppSrvMimeDlg::ProcessCommandL(TInt aCommand) + { + CAknSelectionListDialog::ProcessCommandL(aCommand); //this hides the menu and takes care of find + iEnterKeyPressed=EFalse; + + + *iSelected = ListBox()->CurrentItemIndex(); + if (FindBox() && *iSelected != -1) + *iSelected = STATIC_CAST(CAknFilteredTextListBoxModel*,ListBox()->Model())->Filter()->FilteredItemIndex(*iSelected); + // ATTENTION: If *iSelected is -1 it means that the list is empty! + + + switch(aCommand) + { + case EDasCmdAdvanced: + //SwitchViewL(); + + //make the dialog reload + iDefaultAppUi->iReloadDlgAdvanced=ETrue; + iOkToExit=ETrue; + //force our exit + TryExitL(0); + + break; + case EAknCmdHelp: + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), iDefaultAppUi->AppHelpContextL()); + break; + case EDasCmdResetAll: + case EDasCmdResetSelected: + if(aCommand==EDasCmdResetSelected) + { + if(*iSelected!=-1) + iDefaultAppUi->iServMimeApps->RestoreFactorySettingsL(*iSelected); + } + else + iDefaultAppUi->iServMimeApps->RestoreFactorySettingsL(-1); + + //common code: + //reload the dialog + if(!iDefaultAppUi->iServMimeApps->iSimplifiedView) + iDefaultAppUi->iReloadDlgAdvanced=ETrue; + iOkToExit=ETrue; + //delete the iServMimeApps so that it will be reloaded next time + delete iDefaultAppUi->iServMimeApps; + iDefaultAppUi->iServMimeApps=NULL; + //force our exit + TryExitL(0); + break; + case EAknCmdExit: + //exit the server + iOkToExit=ETrue; + iDefaultAppUi->iReloadDlg=EFalse; + //force our exit + TryExitL(0); + break; + case EAknSoftkeyBack: + //we have 2 cases here: + //if we are in the advanced view, we switch back to the simple view. + //if we are in the simple view, then we exit the server + if(iDefaultAppUi->iServMimeApps->iAppUid == KUidGS && !iDefaultAppUi->iServMimeApps->iSimplifiedView) + { + //switch back to simple view + //make the dialog reload + iDefaultAppUi->iReloadDlgAdvanced=EFalse; + iOkToExit=ETrue; + // no need to force our exit, we are comming from a TryExitL() + } + else + { + //exit the server + iOkToExit=ETrue; + iDefaultAppUi->iReloadDlg=EFalse; + //tell AppUi that the exit is due a "Back" command + iDefaultAppUi->iExitBack=ETrue; + } + break; + case EAknCmdOpen: + case EAknSoftkeyOk: + //we have the index of the selected item in *iSelected + OpenMenuForSelectedServiceAndMimeL(*iSelected); + break; + } + } + +// --------------------------------------------------------------------------- +// From class From CAknSelectionListDialog +// Called during the construction of the dialog. We build the list of elements here. +// --------------------------------------------------------------------------- +// +void CDefaultAppSrvMimeDlg::PreLayoutDynInitL() + { + CAknSelectionListDialog::PreLayoutDynInitL(); + + CEikSettingsListBox* listbox=(CEikSettingsListBox*)ListBox(); + // Ownership retained by us + listbox->CreateScrollBarFrameL( ETrue ); + listbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto ); + listbox->UpdateScrollBarsL(); + + //enable marquee + EnableMarqueeL(); + + //restore the selected item + if(*iSelected >= 0) + { + listbox->SetCurrentItemIndex(*iSelected); + }; + + //change the title + CEikStatusPane *statusPane=iDefaultAppUi->StatusPane(); + if(statusPane && statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent()) + { + CAknTitlePane *titlePane=(CAknTitlePane*)(statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle))); + HBufC* titleString; + //load the correct title string + if(iDefaultAppUi->iReloadDlgAdvanced) + { + if(iDefaultAppUi->iClientUid == KUidGS) + //User activated advanced view in Control Panel + titleString=StringLoader::LoadLC(R_DA_TITLE_ADVANCED); + else //Client is some application other than Control Panel; load app specific view. + titleString=StringLoader::LoadLC(R_DA_TITLE_APP); + } + else //Simple view in Control Panel + titleString=StringLoader::LoadLC(R_DA_TITLE_MAIN); + titlePane->SetTextL(*titleString); + CleanupStack::PopAndDestroy(titleString); + }; + + ListBox()->AddItemChangeObserverL( this ); + } + +// --------------------------------------------------------------------------- +// From class CAknDialog. +// Called when the menu is initialized. +// --------------------------------------------------------------------------- +// +void CDefaultAppSrvMimeDlg::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + if (aResourceId != R_DAS_MENU) return; + __ASSERT_ALWAYS(iDefaultAppUi->iServMimeApps,User::Leave(KErrGeneral)); + + // for !iSimplifiedView dim the EDasCmdAdvanced + if(!iDefaultAppUi->iServMimeApps->iSimplifiedView) + aMenuPane->SetItemDimmed(EDasCmdAdvanced, ETrue); + + // if the Client is not observing when we are exiting, then dim the Exit + if(iDefaultAppUi->iServMimeApps->iFlagNoObserver) + aMenuPane->SetItemDimmed(EAknCmdExit, ETrue); + + // Help should be displayed only if the feature is supported + // according to Feature Manager + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); + } + //if the findbox already exists, dim the find menu item. + if ( FindBox()->IsVisible() ) + { + aMenuPane->SetItemDimmed(EAknCmdFindPopupActivated, ETrue); + } + + CTextListBoxModel* modelSm = ( ( CEikSettingsListBox* )ListBox() )->Model(); // not taking ownership + TInt itemCount = modelSm->NumberOfItems(); + //if the listbox is empty, dim the change menu item. + if (itemCount == 0) + { + aMenuPane->SetItemDimmed(EAknCmdOpen, ETrue); + } + + } + +// --------------------------------------------------------------------------- +// From class CCoeControl. +// Called to get the help context. +// --------------------------------------------------------------------------- +// +void CDefaultAppSrvMimeDlg::GetHelpContext(TCoeHelpContext& aContext) const + { + aContext.iMajor = KUidDefaultAppServer; + + //check if we have proper values + if(!iDefaultAppUi->iServMimeApps) + aContext.iContext = KDA_HLP_MAIN; + else + { + //check for GS client + if (iDefaultAppUi->iServMimeApps->iAppUid == KUidGS) + { + //the client is GS. Check for simplified or advanced view + if (iDefaultAppUi->iServMimeApps->iSimplifiedView) + aContext.iContext = KDA_HLP_MAIN; + else + aContext.iContext = KDA_HLP_ADVANCED; + } + else + { + //this is not GS client + aContext.iContext = KDA_HLP_APPLICATION; + }; + }; + } + +// --------------------------------------------------------------------------- +// From class CCoeControl. +// Called to get the help context. +// --------------------------------------------------------------------------- +// +void CDefaultAppSrvMimeDlg::SizeChanged() + { + CAknSelectionListDialog::SizeChanged(); + } + + +// --------------------------------------------------------------------------- +// Enables marquee for the list elements. +// --------------------------------------------------------------------------- +// +void CDefaultAppSrvMimeDlg::EnableMarqueeL() + { + CFormattedCellListBoxData *tmp=((CEikSettingsListBox*)(ListBox()))->ItemDrawer()->FormattedCellData(); + + tmp->SetMarqueeParams(KMaxTInt, 6, 2000000, 10000); // Magic: loop forever + tmp->EnableMarqueeL(ETrue); + } + + +// --------------------------------------------------------------------------- +// Loads icons from a file and sets them in the drawer for iSavedGamesList +// --------------------------------------------------------------------------- +// +CArrayPtr* CDefaultAppSrvMimeDlg::GetPopupListIconsL() const + { + // CGulIcon class packages two bitmaps: icon image and its mask + // CAknIconArray inherits from CArrayPtrFlat + CArrayPtr* iconList = new (ELeave) + CAknIconArray(2); + CleanupStack::PushL(iconList); + + TFileName iconFile( AknIconUtils::AvkonIconFileName() ); + MAknsSkinInstance* skinInstance; + CFbsBitmap* newIconBmp = NULL; + CFbsBitmap* newIconBmpMask = NULL; + CGulIcon* newIcon = NULL; + + skinInstance = AknsUtils::SkinInstance(); + + //creating blank icon + AknsUtils::CreateIconLC(skinInstance,KAknsIIDQgnPropEmpty, + newIconBmp,newIconBmpMask,iconFile, + EMbmAvkonQgn_prop_empty, + EMbmAvkonQgn_prop_empty_mask); + + newIcon = CGulIcon::NewL(newIconBmp,newIconBmpMask); + + CleanupStack::Pop(2);//newIconBmp & newIconBmpMask + CleanupStack::PushL(newIcon); + iconList->AppendL(newIcon); + + CleanupStack::Pop(newIcon); + + //creating TICK mark icon + AknsUtils::CreateIconLC(skinInstance,KAknsIIDQgnPropSubCurrent, + newIconBmp,newIconBmpMask,iconFile, + EMbmAvkonQgn_prop_sub_current, + EMbmAvkonQgn_prop_sub_current_mask); + + newIcon = CGulIcon::NewL(newIconBmp,newIconBmpMask); + + CleanupStack::Pop(2);//newIconBmp & newIconBmpMask + CleanupStack::PushL(newIcon); + iconList->AppendL(newIcon); + + CleanupStack::Pop(newIcon); + + CleanupStack::Pop(iconList); + + newIconBmp = NULL; + newIconBmpMask = NULL; + newIcon = NULL; + + return iconList; + } + + +// --------------------------------------------------------------------------- +// Pops-up a menu list with the Applications for the selected Service & MIME item +// --------------------------------------------------------------------------- +// +void CDefaultAppSrvMimeDlg::OpenMenuForSelectedServiceAndMimeL(TInt aSelectedIndex) + { + if(!iDefaultAppUi->iServMimeApps)User::Leave(KErrNotFound); + if(aSelectedIndex<0)return; //there is no selected item (list is empty) + + CAknSingleGraphicPopupMenuStyleListBox *selectedServiceAndMime = new (ELeave) CAknSingleGraphicPopupMenuStyleListBox; + CleanupStack::PushL(selectedServiceAndMime); + + if ( iPopupList != NULL ) + { + iPopupList->CancelPopup(); + iPopupList = NULL; + } + + iPopupList = CAknPopupList::NewL(selectedServiceAndMime, R_AVKON_SOFTKEYS_OK_CANCEL); + selectedServiceAndMime->ConstructL(iPopupList,EAknListBoxMenuList); + selectedServiceAndMime->CreateScrollBarFrameL (ETrue); + selectedServiceAndMime->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, + CEikScrollBarFrame::EAuto ); + + //construct icons + CArrayPtr* icons=GetPopupListIconsL(); + selectedServiceAndMime->ItemDrawer()->ColumnData()->SetIconArray(icons); // passing ownership of icons + + + //populate the applications list + CTextListBoxModel* modelApps = selectedServiceAndMime->Model(); // not taking ownership + modelApps->SetOwnershipType (ELbmOwnsItemArray); + CDesCArray* applications = STATIC_CAST(CDesCArray*, modelApps->ItemTextArray()); + HBufC* listTitle=NULL; + iDefaultAppUi->iServMimeApps->GetApplicationsListL(aSelectedIndex, *applications, listTitle); + + + //set the title of the list + CleanupStack::PushL(listTitle); + iPopupList->SetTitleL(*listTitle); + CleanupStack::PopAndDestroy(listTitle); + // + TInt popupOk = iPopupList->ExecuteLD(); + iPopupList = NULL; + + if(popupOk) + { + TInt selected = selectedServiceAndMime->CurrentItemIndex(); + + //update the default in the array & list + //get the list array first + CTextListBoxModel* modelSm = ((CEikSettingsListBox*)ListBox())->Model(); // not taking ownership + //modelSm->SetOwnershipType (ELbmOwnsItemArray); + CDesCArray* servicesAndMimesArray = STATIC_CAST(CDesCArray*, modelSm->ItemTextArray()); + //do the update + iDefaultAppUi->iServMimeApps->UpdateDefaultL(aSelectedIndex,selected,servicesAndMimesArray); + //redraw the list + DrawNow(); + } + CleanupStack::PopAndDestroy(selectedServiceAndMime); + } + +// --------------------------------------------------------------------------- +// OfferKeyEventL from ccoecontrol +// --------------------------------------------------------------------------- +// +TKeyResponse CDefaultAppSrvMimeDlg::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType) + { + if ( aKeyEvent.iCode == EKeyBackspace ) + { + if ( FindBox()->TextLength() >0 ) + { + return FindBox()->OfferKeyEventL( aKeyEvent, aType ); + } + } + return CAknSelectionListDialog::OfferKeyEventL( aKeyEvent ,aType ); + } + +// ----------------------------------------------------------------------------- +// CDefaultAppSrvMimeDlg::ListBoxItemsChanged (from MListBoxItemChangeObserver) +// +// ----------------------------------------------------------------------------- +// +void CDefaultAppSrvMimeDlg::ListBoxItemsChanged( CEikListBox* aListBox ) + { + if ( aListBox ) + { + CEikButtonGroupContainer& cba = ButtonGroupContainer(); + CTextListBoxModel* modelSm = ((CEikSettingsListBox*)aListBox)->Model(); // not taking ownership + TInt itemCount = modelSm->NumberOfItems(); + if (itemCount == 0) + { + cba.MakeCommandVisible(EAknCmdOpen, EFalse); + } + else + { + cba.MakeCommandVisible(EAknCmdOpen, ETrue); + } + } + } + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/server/src/das_view.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/server/src/das_view.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2005-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: Implementation of the view class +* +*/ + + + +// System includes + +#include "das_view.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CDefaultAppView::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CDefaultAppView* CDefaultAppView::NewL( const TRect& aRect ) + { + CDefaultAppView* self = CDefaultAppView::NewLC( aRect ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CDefaultAppView::NewLC() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CDefaultAppView* CDefaultAppView::NewLC( const TRect& aRect ) + { + CDefaultAppView* self = new ( ELeave ) CDefaultAppView; + CleanupStack::PushL( self ); + self->ConstructL( aRect ); + return self; + } + +// ----------------------------------------------------------------------------- +// CDefaultAppView::ConstructL() +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CDefaultAppView::ConstructL( const TRect& aRect ) + { + // Create a window for this application view + CreateWindowL(); + + // Set the windows size + SetRect( aRect ); + + // Activate the window, which makes it ready to be drawn + ActivateL(); + } + +// ----------------------------------------------------------------------------- +// CDefaultAppView::CDefaultAppView() +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CDefaultAppView::CDefaultAppView() + { + // No implementation required + } + + +// ----------------------------------------------------------------------------- +// CDefaultAppView::~CDefaultAppView() +// Destructor. +// ----------------------------------------------------------------------------- +// +CDefaultAppView::~CDefaultAppView() + { + // No implementation required + } + + +// ----------------------------------------------------------------------------- +// CDefaultAppView::Draw() +// Draws the display. +// ----------------------------------------------------------------------------- +// +void CDefaultAppView::Draw( const TRect& /*aRect*/ ) const + { + // Get the standard graphics context + CWindowGc& gc = SystemGc(); + + // Gets the control's extent + TRect drawRect( Rect()); + + + } + +// ----------------------------------------------------------------------------- +// CDefaultAppView::SizeChanged() +// Called by framework when the view size is changed. +// ----------------------------------------------------------------------------- +// +void CDefaultAppView::SizeChanged() + { + DrawNow(); + } diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/service/BWINS/defaultappclientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/service/BWINS/defaultappclientU.DEF Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,8 @@ +EXPORTS + ??1CDefaultAppClient@@UAE@XZ @ 1 NONAME ; CDefaultAppClient::~CDefaultAppClient(void) + ?ChangeDefaultsL@CDefaultAppClient@@QAEXH@Z @ 2 NONAME ; void CDefaultAppClient::ChangeDefaultsL(int) + ?NewL@CDefaultAppClient@@SAPAV1@PAVMAknServerAppExitObserver@@@Z @ 3 NONAME ; class CDefaultAppClient * CDefaultAppClient::NewL(class MAknServerAppExitObserver *) + ?NewLC@CDefaultAppClient@@SAPAV1@PAVMAknServerAppExitObserver@@@Z @ 4 NONAME ; class CDefaultAppClient * CDefaultAppClient::NewLC(class MAknServerAppExitObserver *) + ?PairsToDisplayL@CDefaultAppClient@@QAEHXZ @ 5 NONAME ; int CDefaultAppClient::PairsToDisplayL(void) + ?ServiceAvailable@CDefaultAppClient@@SAHAAH@Z @ 6 NONAME ; int CDefaultAppClient::ServiceAvailable(int &) + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/service/EABI/defaultappclientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/service/EABI/defaultappclientU.DEF Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,14 @@ +EXPORTS + _ZN17CDefaultAppClient15ChangeDefaultsLEi @ 1 NONAME + _ZN17CDefaultAppClient15PairsToDisplayLEv @ 2 NONAME + _ZN17CDefaultAppClient16ServiceAvailableERi @ 3 NONAME + _ZN17CDefaultAppClient4NewLEP25MAknServerAppExitObserver @ 4 NONAME + _ZN17CDefaultAppClient5NewLCEP25MAknServerAppExitObserver @ 5 NONAME + _ZN17CDefaultAppClientD0Ev @ 6 NONAME + _ZN17CDefaultAppClientD1Ev @ 7 NONAME + _ZN17CDefaultAppClientD2Ev @ 8 NONAME + _ZTI17CDefaultAppClient @ 9 NONAME ; ## + _ZTI18RDefaultAppService @ 10 NONAME ; ## + _ZTV17CDefaultAppClient @ 11 NONAME ; ## + _ZTV18RDefaultAppService @ 12 NONAME ; ## + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/service/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/service/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005-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: Build information file for project DefaultAppServer - Service +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +das_service.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/service/group/das_service.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/service/group/das_service.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2005-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: Project definition file for project DefaultAppServer - Service +* +*/ + + + +#include +#include + +TARGET defaultappclient.dll +TARGETTYPE DLL +UID 0x1000008d 0x10281B9E + +CAPABILITY CAP_GENERAL_DLL DRM +VENDORID VID_DEFAULT + +// Define directories for the .def-files of WINSCW build. +// IMPORTANT NOTICE: The lines in the example that end with a backslash +// must have one space after the backslash. +#if defined(ARMCC) +deffile ../EABI/ +#elif defined( WINSCW ) +deffile ../BWINS/ +#endif + +SOURCEPATH ../src +SOURCE das_service.cpp +SOURCE das_client.cpp + +USERINCLUDE ../inc + +// Default system include paths for middleware layer modules. +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY apgrfx.lib +LIBRARY avkon.lib +LIBRARY eikcore.lib +LIBRARY apparc.lib + +//EXPORTUNFROZEN diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/service/inc/das_service.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/service/inc/das_service.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2005-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: This class defines the service used to change the default app. +* +*/ + + + +#ifndef R_DEFAULTAPPSERVICE_H +#define R_DEFAULTAPPSERVICE_H + +#include + +/** + * Definition for the default app service + * + * This class defines the client side of the default app service. + * + * @lib defaultappclient.dll + * @since S60 v5.0 + */ +class RDefaultAppService : public RAknAppServiceBase + { + +private: + + /** messages used */ + enum TIpcMessageIds + { + ESetDefaultAll = RApaAppServiceBase::KServiceCmdBase + }; +public: + + /** + * Sends SetDefault message to the server + * + * @since S60 v5.0 + * @param aFlags service class (value is transparent for this class/function) + * @return 0 for success, negative value on failure + */ + TInt SetDefault( TInt aFlags ); + +private: // From RApaAppServiceBase + + /** + * From RApaAppServiceBase. + * Returns the uid of the service + * + * @since S60 v5.0 + * @return the Uid of the provided service (Default App Service) + */ + TUid ServiceUid() const; + }; + + +#endif // R_DEFAULTAPPSERVICE_H + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/service/src/das_client.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/service/src/das_client.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2005-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: This class implemets the Default App Client API +* +*/ + + +#include +#include + + +#include +#include "das_service.h" + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include // new file introduced by xSymbian +#endif + +const TUid KDefaultAppServiceUid = { 0x10281B9D }; + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CDefaultAppClient::NewL() +// +// +// --------------------------------------------------------------------------- +// +EXPORT_C CDefaultAppClient* CDefaultAppClient::NewL( MAknServerAppExitObserver* aObserver ) + { + CDefaultAppClient* self = CDefaultAppClient::NewLC( aObserver ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CDefaultAppClient::NewLC() +// +// +// --------------------------------------------------------------------------- +// +EXPORT_C CDefaultAppClient* CDefaultAppClient::NewLC( MAknServerAppExitObserver* aObserver ) + { + CDefaultAppClient* self = new ( ELeave ) CDefaultAppClient; + CleanupStack::PushL( self ); + self->ConstructL( aObserver ); + return self; + } + +// --------------------------------------------------------------------------- +// CDefaultAppClient::CDefaultAppClient() +// Default constructor +// +// --------------------------------------------------------------------------- +// +CDefaultAppClient::CDefaultAppClient() + { + iServerAppUid.iUid = 0; + } + +// --------------------------------------------------------------------------- +// CDefaultAppClient::ConstructL() +// +// +// --------------------------------------------------------------------------- +// +void CDefaultAppClient::ConstructL( MAknServerAppExitObserver* aObserver ) + { + iObserver=aObserver; + iService = new (ELeave) RDefaultAppService; + } + +// --------------------------------------------------------------------------- +// CDefaultAppClient::~CDefaultAppClient +// +// +// --------------------------------------------------------------------------- +// +EXPORT_C CDefaultAppClient::~CDefaultAppClient() + { + if(iMonitor) + { + iMonitor->Cancel(); + delete iMonitor; + }; + if(iService) + { + iService->Close(); + delete iService; + }; + + + + // iObserver is not owned + } + + +// --------------------------------------------------------------------------- +// Function to check if a server is present in the system. If the +// server is present, the subsequent functions should not fail due +// to server unavailability. +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CDefaultAppClient::ServiceAvailable(TInt& aErrorCode) + { + TRAP(aErrorCode,GetServiceParamsL(NULL)); + if(aErrorCode != KErrNone) return EFalse; + return ETrue; + } + +// --------------------------------------------------------------------------- +// Function to check the number of Service & MIME pairs the server would display if the +// ChangeDefaultsL() would be called. The purpose of this function +// is to allow the client application not to display an entry for starting the server, in the +// Options menu, in case the Server's list of Service & MIME pairs is empty. +// +// Please note that the function may return a higher number than the actual number +// of pairs, because it does not check for MIMEs with System priority (that would not be +// displayed). +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CDefaultAppClient::PairsToDisplayL() + { + RApaLsSession ls; + TInt i,j; + TInt pairs=0; + + //Get own UID + TUid clientAppUid = User::Identity(); + + //connect + User::LeaveIfError(ls.Connect()); + + //we are connected, so some initialization + CleanupClosePushL( ls ); + User::LeaveIfError(ls.GetAllApps()); + + //get all services & MIMEs supported by our application + CApaAppServiceInfoArray* servicesAndDataTypes=ls.GetAppServicesLC(clientAppUid); + + for(i=0; iArray().Count(); i++ ) + { + const TApaAppServiceInfo currentServiceInfo = servicesAndDataTypes->Array()[i]; + for ( j = 0 ; j < currentServiceInfo.DataTypes().Count() ; j++ ) + { + //check if there are more than one applications supporting this Service & MIME pair + CApaAppServiceInfoArray* apps=ls.GetServiceImplementationsLC(currentServiceInfo.Uid(),currentServiceInfo.DataTypes()[j].iDataType); + + if(apps->Array().Count()>1) + { + //more that one app handles this Service & MIME + pairs++; + }; + + CleanupStack::PopAndDestroy(apps); + }; + }; + + //clean + CleanupStack::PopAndDestroy(servicesAndDataTypes); + CleanupStack::PopAndDestroy(); // closes RApaLsSession + + return pairs; + } + +// --------------------------------------------------------------------------- +// This function launches the server, as a chained application. The client application will not be +// available to the user until the server does not exit. +// When the server exits, the client application gains control again. The observer (if specified +// during instantiation (NewL) is notified that the server has exited. +// --------------------------------------------------------------------------- +// +EXPORT_C void CDefaultAppClient::ChangeDefaultsL( TInt aFlags ) + { + if(iServerAppUid.iUid == 0) + GetServiceParamsL( &iServerAppUid ); + + iService->ConnectChainedAppL(iServerAppUid); + + if(iObserver) + iMonitor = CApaServerAppExitMonitor::NewL(*iService, *iObserver, CActive::EPriorityStandard); + else + aFlags|=EFlagNoObserver; + + iService->SetDefault(aFlags); + } + + + +// --------------------------------------------------------------------------- +// This function finds out the uid of the Default Application Server +// (the application registered to handle the DefaultApp service) +// --------------------------------------------------------------------------- +// +void CDefaultAppClient::GetServiceParamsL( TUid *aServerAppUid) + { + CApaAppServiceInfoArray* services = NULL; + RApaLsSession ls; + TInt count = 0; //number of services found so far. + + User::LeaveIfError(ls.Connect()); + CleanupClosePushL( ls ); + + User::LeaveIfError(ls.GetServerApps( KDefaultAppServiceUid )); + + services = ls.GetServiceImplementationsLC( KDefaultAppServiceUid ); + + if( services ) + { + count = services->Array().Count(); + // get the server's Uid + if( aServerAppUid ) + aServerAppUid->iUid = services->Array()[0].Uid().iUid; + }; + CleanupStack::PopAndDestroy( 2 ); // destroys services + closes RApaLsSession + + if ( count == 0) User::Leave(KErrNotFound); + if ( count > 1) User::Leave(KErrNotSupported); + + // if we are here, it means that we have a single server handling the defaults + } + + + + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/service/src/das_service.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/service/src/das_service.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2005-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: This class defines the service used to change the default app. +* +*/ + + +#include "das_service.h" + + +// ======== MEMBER FUNCTIONS ======== + + +const TUid KDefaultAppServiceUid = { 0x10281B9D }; + +// --------------------------------------------------------------------------- +// Sends SetDefault message to the server +// --------------------------------------------------------------------------- +// +TInt RDefaultAppService::SetDefault( TInt aFlags ) + { + return SendReceive( ESetDefaultAll, TIpcArgs( aFlags ) ); + } + +// --------------------------------------------------------------------------- +// From class RApaAppServiceBase. +// Returns the uid of the service +// --------------------------------------------------------------------------- +// +TUid RDefaultAppService::ServiceUid() const + { + return KDefaultAppServiceUid; + } diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/services_db/BWINS/servicesdbU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/services_db/BWINS/servicesdbU.DEF Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,11 @@ +EXPORTS + ??1CServicesDB@@UAE@XZ @ 1 NONAME ; CServicesDB::~CServicesDB(void) + ?Count@CServicesDB@@QBEHXZ @ 2 NONAME ; int CServicesDB::Count(void) const + ?NewL@CServicesDB@@SAPAV1@PAVTResourceReader@@@Z @ 3 NONAME ; class CServicesDB * CServicesDB::NewL(class TResourceReader *) + ?NewLC@CServicesDB@@SAPAV1@PAVTResourceReader@@@Z @ 4 NONAME ; class CServicesDB * CServicesDB::NewLC(class TResourceReader *) + ?ServiceNameLC@CServicesDB@@QBEPAVHBufC16@@H@Z @ 5 NONAME ; class HBufC16 * CServicesDB::ServiceNameLC(int) const + ?ServiceNameLC@CServicesDB@@QBEPAVHBufC16@@VTUid@@@Z @ 6 NONAME ; class HBufC16 * CServicesDB::ServiceNameLC(class TUid) const + ?ServiceStringLC@CServicesDB@@QBEPAVHBufC16@@HABVTDes16@@@Z @ 7 NONAME ; class HBufC16 * CServicesDB::ServiceStringLC(int, class TDes16 const &) const + ?ServiceStringLC@CServicesDB@@QBEPAVHBufC16@@VTUid@@ABVTDes16@@@Z @ 8 NONAME ; class HBufC16 * CServicesDB::ServiceStringLC(class TUid, class TDes16 const &) const + ?ServiceUidL@CServicesDB@@QBE?AVTUid@@H@Z @ 9 NONAME ; class TUid CServicesDB::ServiceUidL(int) const + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/services_db/Eabi/servicesdbU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/services_db/Eabi/servicesdbU.DEF Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,15 @@ +EXPORTS + _ZN11CServicesDB4NewLEP15TResourceReader @ 1 NONAME + _ZN11CServicesDB5NewLCEP15TResourceReader @ 2 NONAME + _ZN11CServicesDBD0Ev @ 3 NONAME + _ZN11CServicesDBD1Ev @ 4 NONAME + _ZN11CServicesDBD2Ev @ 5 NONAME + _ZNK11CServicesDB11ServiceUidLEi @ 6 NONAME + _ZNK11CServicesDB13ServiceNameLCE4TUid @ 7 NONAME + _ZNK11CServicesDB13ServiceNameLCEi @ 8 NONAME + _ZNK11CServicesDB15ServiceStringLCE4TUidRK6TDes16 @ 9 NONAME + _ZNK11CServicesDB15ServiceStringLCEiRK6TDes16 @ 10 NONAME + _ZNK11CServicesDB5CountEv @ 11 NONAME + _ZTI11CServicesDB @ 12 NONAME DATA 12 ; ## + _ZTV11CServicesDB @ 13 NONAME DATA 20 ; ## + diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/services_db/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/services_db/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2005-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: Build information file for project Service DB +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +services_db.mmp + +PRJ_TESTMMPFILES + + +PRJ_TESTEXPORTS diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/services_db/group/services_db.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/services_db/group/services_db.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2005-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: Project definition file for Services DB +* +*/ + + + +#include +#include + +TARGET servicesdb.dll +TARGETTYPE DLL +UID 0x1000008d 0x10281B9F + +CAPABILITY CAP_GENERAL_DLL DRM +VENDORID VID_DEFAULT + +// Define directories for the .def-files of WINSCW build. +// IMPORTANT NOTICE: The lines in the example that end with a backslash +// must have one space after the backslash. +#if defined(ARMCC) +deffile ../Eabi/ +#elif defined( WINSCW ) +deffile ../BWINS/ +#endif + + +SOURCEPATH ../src +SOURCE services_db.cpp + +USERINCLUDE ../inc + +// Default system include paths for middleware layer modules. +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY commonengine.lib +LIBRARY bafl.lib //TResourceReader + +//EXPORTUNFROZEN diff -r 000000000000 -r 254040eb3b7d defaultapplicationsettings/services_db/src/services_db.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defaultapplicationsettings/services_db/src/services_db.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,230 @@ +/* +* Copyright (c) 2005-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: Implements the Services DB API +* +*/ + + +#include +#include +#include + +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CServicesDB::NewLC() +// +// +// --------------------------------------------------------------------------- +// +EXPORT_C CServicesDB* CServicesDB::NewLC( TResourceReader* aResReader ) + { + CServicesDB* self = new (ELeave) CServicesDB(); + CleanupStack::PushL(self); + self->ConstructL(aResReader); + return self; + } + +// --------------------------------------------------------------------------- +// CServicesDB::NewL() +// +// +// --------------------------------------------------------------------------- +// +EXPORT_C CServicesDB* CServicesDB::NewL( TResourceReader* aResReader ) + { + CServicesDB* self = CServicesDB::NewLC(aResReader); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// CServicesDB::CServicesDB() +// +// +// --------------------------------------------------------------------------- +// +CServicesDB::CServicesDB() + { + //no implementation necessary + } + +// --------------------------------------------------------------------------- +// CServicesDB::~CServicesDB() +// +// +// --------------------------------------------------------------------------- +// +EXPORT_C CServicesDB::~CServicesDB() + { + iServiceUids.Close(); + iServiceNames.ResetAndDestroy(); + iServiceLoc.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// The class is constructed by reading the data from the specified resource id into memory +// --------------------------------------------------------------------------- +// +void CServicesDB::ConstructL( TResourceReader* aResReader ) + { + TInt i; + TInt count = aResReader->ReadInt16(); + for ( i = 0; i < count; i++ ) + { + //read the service uid + TInt uid=aResReader->ReadInt32(); + if(uid == 0)User::Leave(KErrArgument); + //read the service name + HBufC* service=aResReader->ReadHBufCL(); + if(!service)User::Leave(KErrArgument); + //read the localized string + HBufC* serviceLoc=aResReader->ReadHBufCL(); + if(!serviceLoc)User::Leave(KErrArgument); + + //append things + iServiceUids.Append(uid); + iServiceNames.Append(service);//takes ownership + iServiceLoc.Append(serviceLoc);//takes ownership + } + //done + } + +// --------------------------------------------------------------------------- +// Returns the number of available services +// (the number of services read from the resource during construction) +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CServicesDB::Count() const + { + return iServiceUids.Count(); + } + +// --------------------------------------------------------------------------- +// Function to return the Uid of a service (by index). +// --------------------------------------------------------------------------- +// +EXPORT_C TUid CServicesDB::ServiceUidL(TInt aIndex) const + { + if(aIndex<0 || aIndex>=iServiceUids.Count()) + User::Leave(KErrArgument); + return TUid::Uid(iServiceUids[aIndex]); + } + + +// --------------------------------------------------------------------------- +// Function to return the localized name associated with a service. If the returned +// strings accepts a parameter, this can be specified as aParam +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC* CServicesDB::ServiceStringLC(TInt aIndex, const TDes& aParam) const + { + TInt size=aParam.Size(); + HBufC *string=NULL; + + //check parameters + if(aIndex<0 || aIndex>=iServiceUids.Count()) + User::Leave(KErrArgument); + + //get the size of the new string + size+=iServiceLoc[aIndex]->Size(); + //allocate the string + string = HBufC::NewLC(size); + //create string content + TPtr ptr=string->Des(); + if(aParam.Size()) + { + //we have something in aParam + //ptr.Format(*iServiceLoc[aIndex],&aParam); + StringLoader::Format(ptr,*iServiceLoc[aIndex],-1,aParam); + } + else + { + //nothing in aParam, just copy the localized string to string + ptr.Copy(*iServiceLoc[aIndex]); + } + //done, return + return string; //string is on the stack, too + } + +// --------------------------------------------------------------------------- +// Function to return the localized name associated with a service. If the returned +// strings accepts a parameter, this can be specified as aParam +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC* CServicesDB::ServiceStringLC(TUid aServiceUid, const TDes& aParam) const + { + HBufC* string=NULL; + TInt i; + + //look for the service UIDs + for(i=0; i=iServiceUids.Count()) + User::Leave(KErrArgument); + + //get the size of the new string + size=iServiceNames[aIndex]->Size(); + //allocate the string + string = HBufC::NewLC(size); + //create string content + TPtr ptr=string->Des(); + ptr.Copy(*iServiceNames[aIndex]); + return string; + } + +// --------------------------------------------------------------------------- +// Function to return the generic name of a service. +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC* CServicesDB::ServiceNameLC(TUid aServiceUid) const + { + HBufC* string=NULL; + TInt i; + + //loc for the service UIDs + for(i=0; i + + Default App Client API + API for launching the Default App Server and allow the user to change the default app for Services & MIMEs + c++ + DefaultApplicationSettings + + + + + + + + + no + no + + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,27 @@ +/* +* 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: File that exports the files belonging to +: Default App Client API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/das_client.h APP_LAYER_PLATFORM_EXPORT_PATH(das_client.h) diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/inc/das_client.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/inc/das_client.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2005-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: Client interface to ask for setting the default application +* +*/ + + + +#ifndef C_DEFAULTAPPCLIENT_H +#define C_DEFAULTAPPCLIENT_H + +#include +#include +#include + +class RDefaultAppService; + + +/** + * Client API for setting the default application. + * + * This class defines the API that applications should use to trigger the launch of the + * Default Application Server, that asks the user to select default applications for those + * Service & MIME pairs for which the client application is a candidate. + * + * A client application should first instantiate the service, using eithe NewL() or NewLC() + * The client application can check first if the sercive is available in the system (by using + * the ServiceAvailable() function. The client application may also check if there is + * anything to display (if there is any Service & MIME that the client application supports for + * which there is at least another application supporting the pair). If there is no such pair, + * then launching the server would display an empty list). This checking is performed using the + * PairsToDisplayL() function. + * + * After the above checkings are done, the client application can ask the server to change + * defaults by calling the ChangeDefaultsL() function. + * + * + * @lib defaultappclient.dll + * @since S60 v5.0 + */ +class CDefaultAppClient : public CBase + { + +public: + + /** flags used to modify the service behaviour */ + enum TFlags + { + EFlagNoObserver=1, + EFlagReserved1=2, + EFlagReserved2=4 + }; + + /** + * Symbian OS two-phased constructor + * @return + */ + IMPORT_C static CDefaultAppClient* NewL(MAknServerAppExitObserver* aObserver); + + /** + * Symbian OS two-phased constructor + * @return + */ + IMPORT_C static CDefaultAppClient* NewLC(MAknServerAppExitObserver* aObserver); + + /** + * Destructor. + */ + IMPORT_C virtual ~CDefaultAppClient(); + + /** + * Function to check if a server is present in the system. If the + * server is present, the subsequent functions should not fail due + * to server unavailability. + * + * @since S60 v5.0 + * @return ETrue or EFalse, depending service/server availability + */ + IMPORT_C static TBool ServiceAvailable( TInt& aErrorCode ); + + /** + * Function to check the number of Service & MIME pairs the server would display if the + * ChangeDefaultsL() would be called. The purpose of this function + * is to allow the client application not to display an entry for starting the server, in the + * Options menu, in case the Server's list of Service & MIME pairs is empty. + * + * Please note that the function may return a higher number than the actual number + * of pairs, because it does not check for MIMEs with System priority (that would not be + * displayed). + * + * @since S60 v5.0 + * @return the number of Service & MIME pairs the server would display + */ + IMPORT_C TInt PairsToDisplayL(); + + /** + * This function launches the server, as a chained application. The client application will not be + * available to the user until the server does not exit. + * When the server exits, the client application gains control again. The observer (if specified + * during instantiation (NewL) is notified that the server has exited. + * + * @since S60 v5.0 + * @param aFlags service flags + */ + IMPORT_C void ChangeDefaultsL( TInt aFlags = 0 ); + + +private: + + /** + * C++ default constructor. + */ + CDefaultAppClient(); + + /** + * Symbian constructor. + */ + void ConstructL( MAknServerAppExitObserver* aObserver ); + + /** + * This function finds out the uid of the Default Application Server + * (the application registered to handle the DefaultApp service) + * + * @since S60 v5.0 + * @param aServerAppUid If parameter is non-NULL, it returns the Uid of the server there + */ + static void GetServiceParamsL( TUid* aServerAppUid); + +private: // data + + /** + * The UID of the server application (we discover the server) + */ + TUid iServerAppUid; + + /** + * Pointer to the service class. + * Own. + */ + RDefaultAppService *iService; + + /** + * Pointer to the Observer to call after the operation initiated by + * ChangeDefaultsAsyncL() has finished. + * Not Owned. + */ + MAknServerAppExitObserver* iObserver; + + /** + * Monitor object that calls the iObserver when the server has exited. + * Owned. + */ + CApaServerAppExitMonitor* iMonitor; + + }; + +#endif // C_DEFAULTAPPCLIENT_H diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/bwins/DasClientApiTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/bwins/DasClientApiTestU.DEF Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/eabi/DasClientApiTestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/eabi/DasClientApiTestU.def Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.bat Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,22 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +copy C:\TestFramework\testframework_DasClientApiTest.ini C:\TestFramework\TestFramework.ini +md e:\bctest +md e:\bctest\Results + +ATSINTERFACE.EXE -testmodule testcombiner -config C:\TestFramework\uiDasClientApiTest.cfg +copy c:\Logs\TestFramework\TestReport.txt e:\bctest\results\DAS_TEST.txt \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.iby Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002-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"" +* 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: Personalisation application localised resource IBY +* +*/ + + +/* +----------------------------------------------------------------------------- + + DESCRIPTION + + stiftestframework_DasClientApiTest.iby file specifies needed test components for + ROM image + +----------------------------------------------------------------------------- +*/ + +#ifndef DasClientApiTest__IBY +#define DasClientApiTest__IBY + +file=ABI_DIR\BUILD_DIR\DasClientApiTest.DLL SHARED_LIB_DIR\DasClientApiTest.DLL + +data=\epoc32\data\z\system\data\testframework_DasClientApiTest.ini testframework\testframework_DasClientApiTest.ini + +data=\epoc32\data\z\system\data\tcDasClientApiTest.cfg testframework\tcDasClientApiTest.cfg + +data=\epoc32\data\z\system\data\ui_DasClientApiTest.cfg testframework\ui_DasClientApiTest.cfg + +#endif // DasClientApiTest__IBY \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,61 @@ +/* +* 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: Project specification file of DasClientApiTest +* +*/ + + +#include +#include + +TARGET DasClientApiTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB + +DEFFILE DasClientApiTest.def + +//START RESOURCE ../data/DasClientApiTest_reg.rss +// TARGETPATH /private/10003a3f/apps +//END + +#ifdef SBSV2 +USERINCLUDE ../inc + + MW_LAYER_SYSTEMINCLUDE + +#else // SBSV2 not defined +USERINCLUDE ../inc +APP_LAYER_SYSTEMINCLUDE + + +SOURCEPATH ../src +#endif // SBSV2 + +SOURCE DasClientApiTest.cpp +SOURCE DasClientApiTestblocks.cpp + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY defaultappclient.lib//default application client +LIBRARY avkon.lib//MAknServerAppExitObserver +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eiksrv.lib + +LANG SC + +// End of File diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.pkg Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,67 @@ +; +; 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: Installation file for STIF +; +; +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\DasClientApiTest.dll" - "!:\Sys\Bin\DasClientApiTest.dll" + +"\Epoc32\winscw\c\testframework\testframework_DasClientApiTest.ini"-"!:\TestFramework\testframework_DasClientApiTest.ini" +"\Epoc32\winscw\c\testframework\tcDasClientApiTest.cfg"-"!:\TestFramework\tcDasClientApiTest.cfg" +"\Epoc32\winscw\c\testframework\ui_DasClientApiTest.cfg"-"!:\TestFramework\ui_DasClientApiTest.cfg" +"\epoc32\winscw\c\DasClientApiTest.bat"-"!:\DASTest.bat" +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,68 @@ +/* +* 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: Build information file for project DasClientApiTest +* +*/ + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +#ifdef SBSV2 + PRJ_TESTEXPORTS + DasClientApiTest.iby /epoc32/rom/include/DasClientApiTest.iby + + ../init/testframework_DasClientApiTest.ini /epoc32/data/z/system/data/testframework.ini + + ../conf/ui_DasClientApiTest.cfg /epoc32/winscw/c/TestFramework/ui_DasClientApiTest.cfg + + ../conf/tcDasClientApiTest.cfg /epoc32/wins/c/TestFramework/tcDasClientApiTest.cfg + +#else // SBSV2 not defined + PRJ_TESTEXPORTS + + ../init/testframework_DasClientApiTest.ini /epoc32/wins/c/TestFramework/testframework.ini + ../init/testframework_DasClientApiTest.ini /epoc32/winscw/c/TestFramework/testframework.ini + + ../conf/ui_DasClientApiTest.cfg /epoc32/wins/c/TestFramework/ui_DasClientApiTest.cfg + ../conf/ui_DasClientApiTest.cfg /epoc32/data/z/system/data/ui_DasClientApiTest.cfg + + ../conf/tcDasClientApiTest.cfg /epoc32/winscw/c/TestFramework/tcDasClientApiTest.cfg + ../conf/tcDasClientApiTest.cfg /epoc32/data/z/system/data/tcDasClientApiTest.cfg + +#endif // SBSV2 + +DasClientApiTest.iby /epoc32/rom/include/DasClientApiTest.iby +../init/testframework_DasClientApiTest.ini /epoc32/data/z/system/data/testframework.ini +../init/testframework_DasClientApiTest.ini /epoc32/winscw/c/testframework/testframework_DasClientApiTest.ini +../conf/ui_DasClientApiTest.cfg /epoc32/winscw/c/TestFramework/ui_DasClientApiTest.cfg +../conf/tcDasClientApiTest.cfg /epoc32/wins/c/TestFramework/tcDasClientApiTest.cfg + +PRJ_EXPORTS + +DasClientApiTest.bat /epoc32/winscw/c/DasClientApiTest.bat + +//testframework_DasClientApiTest.ini /epoc32/winscw/c/testframework/testframework_DasClientApiTest.ini +//tcDasClientApiTest.cfg /epoc32/winscw/c/testframework/tcDasClientApiTest.cfg +//ui_DasClientApiTest.cfg /epoc32/winscw/c/testframework/ui_DasClientApiTest.cfg + +PRJ_TESTMMPFILES +DasClientApiTest.mmp + +PRJ_MMPFILES + +// End of File diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/inc/CClientLauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/inc/CClientLauncher.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,76 @@ +/* +* 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: CCClientLauncher declaration. +* +*/ + +#ifndef CCLIENTLAUNCHER_H +#define CCLIENTLAUNCHER_H + +// INCLUDES +#include +#include +#include +#include + +// CLASS DECLARATION + +/** + * CCClientLauncher + * + */ +class CCClientLauncher : public CAknAppUi,public MAknServerAppExitObserver + { +public: + // Constructors and destructor + + /** + * Destructor. + */ + ~CCClientLauncher(); + + /** + * Two-phased constructor. + */ + static CCClientLauncher* NewL(); + + /** + * Two-phased constructor. + */ + static CCClientLauncher* NewLC(); + +public: + //function from CAknAppUi + void ProcessCommandL (TInt aCommand); + +private: + //function from MAknServerAppExitObserver + //handle the exit of the server. + void HandleServerAppExit(TInt aReason); + +private: + + /** + * Constructor for performing 1st stage construction + */ + CCClientLauncher(); + + /** + * EPOC default constructor for performing 2nd stage construction + */ + void ConstructL(); + + }; + +#endif // CCLIENTLAUNCHER_H diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/inc/DasClientApiTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/inc/DasClientApiTest.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2005-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: Implementation of class CDasClientApiTest +* +*/ + + +#ifndef C_DASCLIENTAPITEST_H +#define C_DASCLIENTAPITEST_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +// +#include +// MACROS +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 +// User MACROS +#define KErrGeneral -2 +#define KFirstOption 1 +#define KSecondtOption 2 + +//define client flags +#define KFlagNoObserver 1 +#define KFlagReserved1 2 +#define KFlagReserved2 4 +// Logging path +_LIT( KDasClientApiTestLogPath, "\\logs\\testframework\\DasClientApiTest\\" ); +// Log file +_LIT( KDasClientApiTestLogFile, "DasClientApiTest.txt" ); +_LIT( KDasClientApiTestLogFileWithTitle, "DasClientApiTest_[%S].txt" ); + +// +/** +* CDasClientApiTest test class for STIF Test Framework TestScripter. +* @since S60 5.0 +*/ + +NONSHARABLE_CLASS(CDasClientApiTest) : public CScriptBase/*,public MAknServerAppExitObserver*/ + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CDasClientApiTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CDasClientApiTest(); + +/*private: + //function from MAknServerAppExitObserver. is used to handle the exit of the server. + + void HandleServerAppExit(TInt aReason);*/ + +public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since S60 5.0 + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + +private: + + /** + * C++ default constructor. + */ + CDasClientApiTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since S60 5.0 + */ + void Delete(); + + /** + * Test method. + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt InitialClientL(const TInt aOption ); + + virtual TInt CallClientNewLL( CStifItemParser& aItem ); + + virtual TInt CallClientNewLCL( CStifItemParser& aItem ); + + virtual TInt CallServiceAvailableL( CStifItemParser& aItem ); + +// virtual TInt CallPairsToDisplayLL( CStifItemParser& aItem ); + + virtual TInt CallChangeDefaultsLL( CStifItemParser& aItem ); + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + /** + * Turn off ScreenSaver + * @since S60 5.0 + * @return Symbian OS error code. + */ + void TurnOffScreenSaver(); + + /** + * Restore ScreenSaver + * @since S60 5.0 + * @return Symbian OS error code. + */ + void RestoreScreenSaver(); + + + /** + * In this method NewLC is called. + * @since ?Series60_version + * @param aResReader Resource reader to get information from Resource file + * @return Symbian OS error code. + */ + void CallNewlcL( MAknServerAppExitObserver* aObserver ); + + +private: // Data + + /** + * ScreenSaver Property + */ + TInt iOldScreenSaverProperty; + + /** + * ?description_of_pointer_member + * Not own. + */ + //?type* ?member_name; + CDefaultAppClient* iClient; + + // + CCClientLauncher* iLauncher; + + }; + +#endif // C_DASCLIENTAPITEST_H + +// End of File diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/src/DasClientApiTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/src/DasClientApiTest.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2005-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: Implementation of class CDasClientApiTest +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "DasClientApiTest.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CDasClientApiTest::CDasClientApiTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CDasClientApiTest::CDasClientApiTest( CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CDasClientApiTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CDasClientApiTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KDasClientApiTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KDasClientApiTestLogFile); + } + + iLog = CStifLogger::NewL( KDasClientApiTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + + TurnOffScreenSaver(); + } + +// ----------------------------------------------------------------------------- +// CDasClientApiTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CDasClientApiTest* CDasClientApiTest::NewL( CTestModuleIf& aTestModuleIf ) + { + CDasClientApiTest* self = new( ELeave ) CDasClientApiTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CDasClientApiTest::~CDasClientApiTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// CDasClientApiTest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void CDasClientApiTest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L( "DasClientApiTest.dll" ); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion( moduleVersion, moduleName, + newVersionOfMethod ); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + return ( CScriptBase* ) CDasClientApiTest::NewL( aTestModuleIf ); + } + +// ----------------------------------------------------------------------------- +// Turn off ScreenSaver +// ----------------------------------------------------------------------------- +// +void CDasClientApiTest::TurnOffScreenSaver() + { + //TInt Get(TUid aCategory, TUint aKey, TInt &aValue); + TInt err1 = RProperty::Get( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + iOldScreenSaverProperty ); + TInt err2 = RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + KScreenSaverAllowScreenSaver ); + RDebug::Printf( "screensaver property=%d err1=%d err2=%d\n", + iOldScreenSaverProperty, err1, err2 ); + } + +// ----------------------------------------------------------------------------- +// Restore ScreenSaver +// ----------------------------------------------------------------------------- +// +void CDasClientApiTest::RestoreScreenSaver() + { + RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + iOldScreenSaverProperty ); + User::ResetInactivityTime(); + } + + +// End of File + + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/src/DasClientApiTestblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/src/DasClientApiTestblocks.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,250 @@ +/* +/* +* 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: This cpp file has the functions to test Das Client API. +* +*/ + + +// [INCLUDE FILES] +#include +#include +#include +#include "DasClientApiTest.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CDasClientApiTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CDasClientApiTest::Delete() + { + if( iLauncher ) + { + delete iLauncher; + iLauncher = NULL; + } + + if( iClient ) + { + delete iClient; + iClient = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CDasClientApiTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CDasClientApiTest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "CallClientNewLL", CDasClientApiTest::CallClientNewLL ), + ENTRY( "CallClientNewLCL", CDasClientApiTest::CallClientNewLCL ), + ENTRY( "CallServiceAvailableL", CDasClientApiTest::CallServiceAvailableL ), + ENTRY( "CallChangeDefaultsLL", CDasClientApiTest::CallChangeDefaultsLL ), + // [test cases entries] + + }; + + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CDasClientApiTest::CallNewlcL +// This function is used because we can not TRAP CServicesDB::NewLC +// ----------------------------------------------------------------------------- +// +void CDasClientApiTest::CallNewlcL( MAknServerAppExitObserver* aObserver ) +{ + iClient = CDefaultAppClient::NewLC( aObserver ); + CleanupStack::Pop( iClient ); +} + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::InitialClientL +// This function is used to create CDefaultAppClient object. This function is used +// to call CDefaultAppClient::NewL and CDefaultAppClient::NewLC functions. +// ----------------------------------------------------------------------------- +// +TInt CDasClientApiTest::InitialClientL( TInt aOption ) + { + //launcher of the client; + if( aOption == KFirstOption ) + { + TRAPD( error, iClient = CDefaultAppClient::NewL( NULL ) ); + if( KErrNone != error ) + { + iLog->Log( _L( "=>CDefaultAppClient::NewL leaves" ) ); + return error; + } + } + else + { + TRAPD( error1, CallNewlcL( NULL ) ); + if( KErrNone != error1 ) + { + iLog->Log( _L( "=>CDefaultAppClient::NewLC leaves" ) ); + return error1; + } + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CallClientNewLL +// Is used to test CDefaultAppClient::NewL +// ----------------------------------------------------------------------------- +TInt CDasClientApiTest::CallClientNewLL( CStifItemParser& /*aItem*/ ) + { + TInt result; + + TRAPD( error, result = InitialClientL( KFirstOption ) ); + if( KErrNone != error ) + { + iLog->Log( _L( "CDefaultAppClient object not created with NewL." ) ); + return error; + } + else + { + if( KErrNone != result ) + { + iLog->Log( _L( "CDefaultAppClient object not created with NewL." ) ); + return result; + } + else + { + iLog->Log( _L( "CDefaultAppClient object created with NewL." ) ); + } + }; + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CallClientNewLCL +// Is used to test CDefaultAppClient::NewLC +// ----------------------------------------------------------------------------- +TInt CDasClientApiTest::CallClientNewLCL( CStifItemParser& /*aItem*/ ) + { + TInt result; + TRAPD( error, result = InitialClientL( KSecondtOption ) ); + if( KErrNone != error ) + { + return error; + } + else + { + if( KErrNone != result ) + { + return result; + } + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CallServiceAvailableL +// Is used to test CDefaultAppClient::ServiceAvailableL +// ----------------------------------------------------------------------------- +TInt CDasClientApiTest::CallServiceAvailableL( CStifItemParser& /*aItem*/ ) + { + //Initial the iClient + TInt result; + TRAPD( error, result = InitialClientL( KFirstOption ) ); + if( KErrNone != error ) + { + return error; + } + else + { + if( KErrNone != result ) + { + return result; + } + }; + //call the function + + TInt errcode; + TBool returnvalue; + TRAPD( callerror, returnvalue = CDefaultAppClient::ServiceAvailable( errcode ) ); + if( KErrNone != callerror ) + { + iLog->Log(_L( "Call function ServiceAvailable failed.The function leaves,the leace code is %d"), callerror ); + return callerror; + } + else + { + if( returnvalue != KErrNone ) + { + iLog->Log( _L( "The function returned sucessfully,But the service is not available. The error code is %d" ), errcode ); + return errcode; + } + else + { + iLog->Log( _L( "The function ServiceAvailable called success, and the service is available! " ) ); + } + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CallChangeDefaultsLL +// Is used to test CDefaultAppClient::ChangeDefaultsL +// ----------------------------------------------------------------------------- +TInt CDasClientApiTest::CallChangeDefaultsLL( CStifItemParser& /*aItem*/ ) + { + // + TInt result; + TRAPD( error, result = InitialClientL( KFirstOption ) ); + if(KErrNone != error) + { + iLog->Log( _L( "Initial the iClient failed,the failed code is %d" ), error ); + return error; + } + else + { + if( KErrNone != result ) + { + return result; + } + }; + TRAPD( errorCall, iClient->ChangeDefaultsL() ); + if( errorCall != KErrNone ) + { + iLog->Log( _L( "Function ChangeDefaultsL is called failed. The failed code is %d" ), errorCall ); + return errorCall; + } + else + { + iLog->Log( _L( "The Function is called successfully." ) ); + } + return KErrNone; + } + +// +// [End of File] diff -r 000000000000 -r 254040eb3b7d devmngt_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,23 @@ +/* +* 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: Includes all the Domain API specific bld.inf files, which +* export files. +* +*/ + + + +#include "../default_app_client_api/group/bld.inf" +#include "../services_db_api/group/bld.inf" + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,28 @@ +/* +* 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: File that exports the files belonging to +: Services DB API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/services_db.rh APP_LAYER_PLATFORM_EXPORT_PATH(services_db.rh) +../inc/services_db.h APP_LAYER_PLATFORM_EXPORT_PATH(services_db.h) diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/inc/services_db.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/inc/services_db.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2005-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: Implementation of class CServicesDB +* +*/ + + + +#ifndef SERVICES_DB_H +#define SERVICES_DB_H + +#include +#include + +class TResourceReader; + +/** + * API for retrieving various localized strings associated with services. + * + * This class receives a resource ID during construction (resource type is DAS_SERVICES) + * and retrieves various info defined in this resource. + * + * @lib defaultappclient.dll + * @since S60 v5.0 + */ +class CServicesDB : public CBase + { + +public: + /** + * Symbian OS two-phased constructor + * @return + */ + IMPORT_C static CServicesDB* NewL( TResourceReader* aResReader ); + + /** + * Symbian OS two-phased constructor + * @return + */ + IMPORT_C static CServicesDB* NewLC( TResourceReader* aResReader ); + + /** + * Destructor. + */ + IMPORT_C ~CServicesDB(); + +public: + + /** + * Returns the number of available services + * (the number of services read from the resource during construction) + * + * @since S60 v5.0 + * @return number of available services/elements + */ + IMPORT_C TInt Count() const; + + /** + * Function to return the Uid of a service (by index). + * + * @since S60 v5.0 + * @return the uid of the service (it leaves if aIndex is not a valid index) + */ + IMPORT_C TUid ServiceUidL(TInt aIndex) const; + + /** + * Function to return the localized name associated with a service. If the returned + * strings accepts a parameter, this can be specified as aParam + * + * @since S60 v5.0 + * @param aIndex the index of the service + * @param aParam parameter for the localized string + * @return the localized name (it leaves if aIndex is not a valid index) + */ + IMPORT_C HBufC* ServiceStringLC(TInt aIndex, const TDes& aParam) const; + + /** + * Function to return the localized name associated with a service. If the returned + * strings accepts a parameter, this can be specified as aParam + * + * @since S60 v5.0 + * @param aServiceUid the Uid of the service + * @param aParam parameter for the localized string + * @return the localized name (NULL, if the service is not found) + */ + IMPORT_C HBufC* ServiceStringLC(TUid aServiceUid, const TDes& aParam) const; + + /** + * Function to return the generic name of a service. + * + * @since S60 v5.0 + * @param aIndex the index of the service + * @return the generic name of the service (it leaves if aIndex is not a valid index) + */ + IMPORT_C HBufC* ServiceNameLC(TInt aIndex) const; + + /** + * Function to return the generic name of a service. + * + * @since S60 v5.0 + * @param aServiceUid the Uid of the service + * @return the generic name of the service (NULL, if the service is not found) + */ + IMPORT_C HBufC* ServiceNameLC(TUid aServiceUid) const; + +private: + + /** + * C++ default constructor. + */ + CServicesDB(); + + /** + * Symbian constructor. + */ + void ConstructL( TResourceReader* aResReader ); + +private: + /** + * array of service Uids + */ + RArray iServiceUids; + + /** + * array of service names + */ + RPointerArray iServiceNames; + + /** + * array of service localized names + */ + RPointerArray iServiceLoc; + }; + +#endif // SERVICES_DB_H diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/inc/services_db.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/inc/services_db.rh Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2005-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: Resource headers for project Services DB +* +*/ + + +#ifndef SERVICES_DB_RH +#define SERVICES_DB_RH + + +// --------------------------------------------------------------------------- +// This structure defines a service entry: it holds the service uid, +// service generic name, and service localized string +// --------------------------------------------------------------------------- +// +STRUCT DAS_SERVICE_ENTRY + { + LONG service_uid; + LTEXT service_name; + LTEXT service_localized_name; + } + +// --------------------------------------------------------------------------- +// This structure defines a list of service entries +// --------------------------------------------------------------------------- +// +STRUCT DAS_SERVICES + { + STRUCT services[]; //Type is DAS_SERVICE_ENTRY + } + +#endif // SERVICES_DB_RH diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/services_db_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/services_db_api.metaxml Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,18 @@ + + + Services DB API + API for retrieving information about services: UID, generic name (in engineering English), localized name. + c++ + DefaultApplicationSettings + + + + + + + + + no + no + + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/Bmarm/ServicesDbApiTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/Bmarm/ServicesDbApiTestU.DEF Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/Bwins/ServicesDbApiTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/Bwins/ServicesDbApiTestU.DEF Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/EABI/ServicesDbApiTestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/EABI/ServicesDbApiTestU.def Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/conf/ui_ServicesDbApiTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/conf/ui_ServicesDbApiTest.cfg Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,304 @@ +################################################################################### +# +# This cfg file has tests for Services DB API +# The resource file - ServicesDbApiTest.rss defined to test this api has the following services. +# The tests listed below are based on this resource file services +# +# RESOURCE DAS_SERVICES r_da_service_mime +# { +# services = +# { +# DAS_SERVICE_ENTRY +# { +# service_uid = 0x101; // NOT A REAL UID - 257 +# service_name = "Open"; +# service_localized_name = "Open Localized"; +# }, +# DAS_SERVICE_ENTRY +# { +# service_uid = 0x102; // NOT A REAL UID - 258 +# service_name = "Upload"; +# service_localized_name = "Upload Localized"; +# }, +# DAS_SERVICE_ENTRY +# { +# service_uid = 0x103; // NOT A REAL UID - 259 +# service_name = "Print"; +# service_localized_name = "Print Localized %U"; +# } +# }; +# +################################################################################### + + +[Define] +KFirstServiceIndex 0 +KSecondServiceIndex 1 +KThirdServiceIndex 2 +KNotAServiceInResourceIndex 10 +KFirstServiceUid 257 +KSecondServiceUid 258 +KThirdServiceUid 259 +KNotAServiceInResourceUid 260 +KErrGeneral -2 +KErrArgument -6 +[Enddefine] + + +# This test case is for NewL +# 1 +[Test] +title Initialize Services DB +create ServicesDbApiTest foobar +foobar InitializeSeviceDB +delete foobar +[Endtest] + +# This test case is for NewLC +# 2 +[Test] +title Initialize on stack +create ServicesDbApiTest foobar +foobar InitializeonStackSeviceDB +delete foobar +[Endtest] + +# Testing Count function +# 3 +[Test] +title CountSeviceDB +create ServicesDbApiTest foobar +foobar CountSeviceDB +delete foobar +[Endtest] + +###################################################################### +# Testing ServiceUidL function with different INDEX parameters +###################################################################### +# 4 +[Test] +title Test ServiceUidL - No parameter +create ServicesDbApiTest foobar +allownextresult KErrGeneral +foobar ServiceUidLSeviceDB +delete foobar +[Endtest] + +#5 +[Test] +title Test ServiceUidL 0 INDEX +create ServicesDbApiTest foobar +foobar ServiceUidLSeviceDB KFirstServiceIndex +delete foobar +[Endtest] + +#6 +[Test] +title Test ServiceUidL 1 INDEX +create ServicesDbApiTest foobar +foobar ServiceUidLSeviceDB KSecondServiceIndex +delete foobar +[Endtest] + +#7 +[Test] +title Test ServiceUidL 2 INDEX +create ServicesDbApiTest foobar +foobar ServiceUidLSeviceDB KThirdServiceIndex +delete foobar +[Endtest] + +#8 +[Test] +title Test ServiceUidL Wrong INDEX +create ServicesDbApiTest foobar +allownextresult KErrArgument +foobar ServiceUidLSeviceDB KNotAServiceInResourceIndex +delete foobar +[Endtest] + +#--------------------------------------------------------------------# + +###################################################################### +# Testing ServiceStringLC function with different INDEX parameters +###################################################################### +#9 +[Test] +title Test ServiceStringLC with No Index +create ServicesDbApiTest foobar +allownextresult KErrGeneral +foobar ServiceStringLCSeviceDB +delete foobar +[Endtest] + +#10 +[Test] +title Test ServiceStringLC with 0 Index +create ServicesDbApiTest foobar +foobar ServiceStringLCSeviceDB KFirstServiceIndex +delete foobar +[Endtest] + +#11 +[Test] +title Test ServiceStringLC with 1 Index +create ServicesDbApiTest foobar +foobar ServiceStringLCSeviceDB KSecondServiceIndex +delete foobar +[Endtest] + +#12 +[Test] +title Test ServiceStringLC with 2 Index +create ServicesDbApiTest foobar +foobar ServiceStringLCSeviceDB KThirdServiceIndex +delete foobar +[Endtest] + +#13 +[Test] +title Test ServiceStringLC with wrong Index +create ServicesDbApiTest foobar +allownextresult KErrArgument +foobar ServiceStringLCSeviceDB KNotAServiceInResourceIndex +delete foobar +[Endtest] + +#--------------------------------------------------------------------# + +###################################################################### +# Testing ServiceStringLC function with different UID as parameters +###################################################################### +#14 +[Test] +title Test ServiceStringLC with No UID +create ServicesDbApiTest foobar +allownextresult KErrGeneral +foobar ServiceStringLCUIDSeviceDB +delete foobar +[Endtest] + +#15 +[Test] +title Test ServiceStringLC with 257 UID (0x101) +create ServicesDbApiTest foobar +foobar ServiceStringLCUIDSeviceDB KFirstServiceUid +delete foobar +[Endtest] + +#16 +[Test] +title Test ServiceStringLC with 258 UID (0x102) +create ServicesDbApiTest foobar +foobar ServiceStringLCUIDSeviceDB KSecondServiceUid +delete foobar +[Endtest] + +#17 +[Test] +title Test ServiceStringLC with 258 UID (0x103) +create ServicesDbApiTest foobar +foobar ServiceStringLCUIDSeviceDB KThirdServiceUid +delete foobar +[Endtest] + +#18 +[Test] +title Test ServiceStringLC with Wrong UID +create ServicesDbApiTest foobar +foobar ServiceStringLCUIDSeviceDB KNotAServiceInResourceUid +delete foobar +[Endtest] + +#--------------------------------------------------------------------# + +###################################################################### +# Testing ServiceNameLC function with different INDEX as parameters +###################################################################### +#19 +[Test] +title test ServiceNameLC with No parameter +allownextresult KErrGeneral +create ServicesDbApiTest foobar +foobar ServiceNameLCSeviceDB +delete foobar +[Endtest] + +#20 +[Test] +title test ServiceNameLC with 0 index +create ServicesDbApiTest foobar +foobar ServiceNameLCSeviceDB KFirstServiceIndex +delete foobar +[Endtest] + +#21 +[Test] +title test ServiceNameLC with 1 index +create ServicesDbApiTest foobar +foobar ServiceNameLCSeviceDB KSecondServiceIndex +delete foobar +[Endtest] + +#22 +[Test] +title test ServiceNameLC with 2 index +create ServicesDbApiTest foobar +foobar ServiceNameLCSeviceDB KThirdServiceIndex +delete foobar +[Endtest] + +#23 +[Test] +title test ServiceNameLC with incorrect index +create ServicesDbApiTest foobar +allownextresult KErrArgument +foobar ServiceNameLCSeviceDB KNotAServiceInResourceIndex +delete foobar +[Endtest] + +#--------------------------------------------------------------------# + +###################################################################### +# Testing ServiceNameLC function with different UID as parameters +###################################################################### +#24 +[Test] +title test ServiceNameLC with No Parameter +allownextresult KErrGeneral +create ServicesDbApiTest foobar +foobar ServiceNameLCuidSeviceDB +delete foobar +[Endtest] + +#25 +[Test] +title test ServiceNameLC with 257 UID (0x101) +create ServicesDbApiTest foobar +foobar ServiceNameLCuidSeviceDB KFirstServiceUid +delete foobar +[Endtest] + +#26 +[Test] +title test ServiceNameLC with 258 UID (0x102) +create ServicesDbApiTest foobar +foobar ServiceNameLCuidSeviceDB KSecondServiceUid +delete foobar +[Endtest] + +#27 +[Test] +title test ServiceNameLC with 259 UID (0x103) +create ServicesDbApiTest foobar +foobar ServiceNameLCuidSeviceDB KThirdServiceUid +delete foobar +[Endtest] + +#28 +[Test] +title test ServiceNameLC with 260 UID +create ServicesDbApiTest foobar +foobar ServiceNameLCuidSeviceDB KNotAServiceInResourceUid +delete foobar +[Endtest] diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/data/ServicesDbApiTest.rsc Binary file devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/data/ServicesDbApiTest.rsc has changed diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.iby Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2002-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"" +* 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: Personalisation application localised resource IBY +* +*/ + + +#ifndef SERVICESDBAPITEST_IBY +#define SERVICESDBAPITEST_IBY + + +file=ABI_DIR/BUILD_DIR/ServicesDbApiTest.dll SHARED_LIB_DIR/ServicesDbApiTest.dll +data=DATAZ_/RESOURCE_FILES_DIR/ServicesDbApiTest.rsc RESOURCE_FILES_DIR/ServicesDbApiTest.rsc + +#endif // SERVICESDBAPITEST_IBY \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,84 @@ +/* +* 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: Project specification file of ServicesDbApiTest +* +*/ + + +#include +#include + +TARGET ServicesDbApiTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB + +VENDORID VID_DEFAULT + + +//TARGETPATH ?target_path +DEFFILE ServicesDbApiTest.def + + +APP_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc + +SOURCEPATH ../src + +SOURCE ServicesDbApiTest.cpp +SOURCE ServicesDbApiTestBlocks.cpp + +START RESOURCE ServicesDbApiTest.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +END // RESOURCE + + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY eikcore.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY servicesdb.lib +LIBRARY commonengine.lib + +LANG SC + +epocallowdlldata +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.pkg Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,66 @@ +; +; 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: Installation file for STIF +; +; +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + + +; Condition blocks +; None + +; Options list +; None + +; Install files +"/epoc32/release/armv5/urel/ServicesDbApiTest.dll" - "c:/Sys/Bin/ServicesDbApiTest.dll" +"/epoc32/data/z/resource/ServicesDbApiTest.rsc" - "c:/resource/ServicesDbApiTest.rsc" +;.cfg & .ini files +"..\init\TestFramework_SDB.ini" - "!:\TestFramework\TestFramework_SDB.ini" +"..\conf\ui_ServicesDbApiTest.cfg" - "!:\TestFramework\ui_ServicesDbApiTest.cfg" +;"proeng_c.bat" - "!:\proeng.bat" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest_DoxyFile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest_DoxyFile.txt Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,222 @@ +# Doxyfile 1.4.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = ServicesDbApiTest +PROJECT_NUMBER = +OUTPUT_DIRECTORY = P:\ServicesDbApiTest\ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = YES +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = P:\ServicesDbApiTest\ +FILE_PATTERNS = *.h \ + *.rh \ + *.hrh +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = NO +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = YES +RTF_OUTPUT = Doc +COMPACT_RTF = YES +RTF_HYPERLINKS = YES +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = NONSHARABLE_CLASS +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest_nrm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest_nrm.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,84 @@ +/* +* 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: Project specification file of ServicesDbApiTest +* +*/ + + +#include +#include + +TARGET ServicesDbApiTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB + +VENDORID VID_DEFAULT + + +//TARGETPATH ?target_path +DEFFILE ServicesDbApiTest.def + + +APP_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc + +SOURCEPATH ../src + +SOURCE ServicesDbApiTest.cpp +SOURCE ServicesDbApiTestBlocks.cpp + +START RESOURCE ServicesDbApiTest.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +END // RESOURCE + + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY eikcore.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY servicesdb.lib +LIBRARY commonengine.lib + +LANG SC + +epocallowdlldata +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,62 @@ +/* +* 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: Build information file for project ServicesDbApiTest +* +*/ + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ +//IBY file + + +PRJ_TESTMMPFILES +ServicesDbApiTest.mmp + +PRJ_MMPFILES +ServicesDbApiTest_nrm.mmp + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/proeng_c.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/proeng_c.bat Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,23 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0"" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Copy file batch +rem + +copy C:\TestFramework\testframework_ProEngWrapAPI.ini C:\TestFramework\TestFramework.ini +md e:\BCTest +md e:\BCTest\Results + +ATSINTERFACE.EXE -testmodule testscripter -config C:\TestFramework\ProEngWrapAPI.cfg +copy c:\Logs\TestFramework\TestReport.txt e:\BCTest\results\SP_ProEngWrapAPI.txt + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/proeng_z.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/proeng_z.bat Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,25 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0"" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Copy file batch +rem + +copy z:\TestFramework\testframework_ProEngWrapAPI.ini C:\TestFramework\TestFramework.ini +md e:\BCTest +md e:\BCTest\Results + +ATSINTERFACE.EXE -testmodule testscripter -config C:\TestFramework\ProEngWrapAPI.cfg +copy c:\Logs\TestFramework\TestReport.txt e:\BCTest\results\SP_ProEngWrapAPI.txt + + + diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/inc/ServicesDbApiTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/inc/ServicesDbApiTest.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,264 @@ +/* +* 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: Implementation of class CServicesDbApiTest +* +*/ + + + +#ifndef SERVICESDBAPITEST_H +#define SERVICESDBAPITEST_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +// MACROS +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( KServicesDbApiTestLogPath, "\\logs\\testframework\\ServicesDbApiTest\\" ); +// Log file +_LIT( KServicesDbApiTestLogFile, "ServicesDbApiTest.txt" ); +_LIT( KServicesDbApiTestLogFileWithTitle, "ServicesDbApiTest_[%S].txt" ); + +_LIT(KEmptyString,""); + +// FORWARD DECLARATIONS +class CServicesDbApiTest; + + +//Constants +const TInt KNoOfServices = 3; // This is the number of services listed in resource file. +const TInt KFirstOption = 0; +const TInt KSecondOption = 1; +const TInt KFirstServiceIndex = 0; +const TInt KSecondServiceIndex = 1; +const TInt KThirdServiceIndex=2; +const TInt KFirstServiceUid = 257; +const TInt KSecondServiceUid = 258; +const TInt KThirdServiceUid = 259; +const TInt KBufSize = 128; + +// CLASS DECLARATION + +/** +* CServicesDbApiTest test class for STIF Test Framework TestScripter. +* This class is written to test Services DB API. +* +* @lib ServicesDbApiTest.lib +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CServicesDbApiTest) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CServicesDbApiTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CServicesDbApiTest(); + + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + + private: + + /** + * C++ default constructor. + */ + CServicesDbApiTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //[TestMethods] + + /** + * Creates CServicesDB object + * @since ?Series60_version + * @param aOption Option to create CServicesDB object using NewL or NewLC + * @return Symbian OS error code. + */ + TInt CreateSeviceDBL(TInt aOption); + + /** + * In this method NewLC is called. + * @since ?Series60_version + * @param aResReader Resource reader to get information from Resource file + * @return Symbian OS error code. + */ + void CallNewlcL( TResourceReader aResReader ); + + /** + * This method is used to test CServicesDB::NewL + * @since ?Series60_version + * @param No parameters required + * @return Symbian OS error code. + */ + TInt InitializeSeviceDB( ); + + /** + * This method is used to test CServicesDB::NewLC + * @since ?Series60_version + * @param No parameters required + * @return Symbian OS error code. + */ + TInt InitializeonStackSeviceDB( ); + + /** + * This method is used to test CServicesDB::Count + * @since ?Series60_version + * @param No parameters required + * @return Symbian OS error code. + */ + TInt CountSeviceDB(); + + /** + * This method is used to test CServicesDB::ServiceUidL + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt ServiceUidLSeviceDB( CStifItemParser& aItem ); + + /** + * This method is used to test CServicesDB::ServiceStringLC + * with Index as parameter. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt ServiceStringLCSeviceDB( CStifItemParser& aItem ); + + /** + * This method is used to test CServicesDB::ServiceStringLC + * with UID as parameter + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt ServiceStringLCuidSeviceDB( CStifItemParser& aItem ); + + /** + * This method is used to test CServicesDB::ServiceNameLC + * with Index as parameter + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt ServiceNameLCSeviceDB( CStifItemParser& aItem ); + + /** + * This method is used to test CServicesDB::ServiceNameLC + * with UID as parameter + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt ServiceNameLCuidSeviceDB( CStifItemParser& aItem ); + + /** + * This is method encapsulates ServiceStringLC. + * This method can be TRAPD and used to help in testing ServiceStringLC + * @since ?Series60_version + * @param aIndex the index of the service + * @param aParam parameter for the localized string + * @return Symbian OS error code. + */ + TInt CallServiceStringLCSeviceDBL(TInt aIndex,const TDes& aParam ); + + /** + * This is method encapsulates ServiceStringLC. + * This method can be TRAPD and used to help in testing ServiceStringLC + * @since ?Series60_version + * @param aServiceUid the Uid of the service + * @param aParam parameter for the localized string + * @return Symbian OS error code. + */ + TInt CallServiceStringLCuidSeviceDBL( TUid aServiceUid, const TDes& aParam); + + /** + * This is method encapsulates ServiceNameLC. + * This method can be TRAPD and used to help in testing ServiceNameLC + * @since ?Series60_version + * @param aIndex the index of the service + * @return Symbian OS error code. + */ + TInt CallServiceNameLCSeviceDBL(TInt aIndex); + + /** + * This is method encapsulates ServiceNameLC. + * This method can be TRAPD and used to help in testing ServiceNameLC + * @since ?Series60_version + * @param aServiceUid the Uid of the service + * @return Symbian OS error code. + */ + TInt CallServiceNameLCuidSeviceDBL( TUid aServiceUid ); + + + private: // Data + + // This is the pointer to object of the class being tested + // Through this pointer all the Exported methods are tested. + CServicesDB *iServicesDB; + + + }; + +#endif // SERVICESDBAPITEST_H + +// End of File diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/init/TestFramework_SDB.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/init/TestFramework_SDB.ini Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,200 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT, HTML or XML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\ui_ServicesDbApiTest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTest.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,155 @@ +/* +* 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: Implementation of class CServicesDbApiTest +* +*/ + + + +// INCLUDE FILES +#include +#include "ServicesDbApiTest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CServicesDbApiTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CServicesDbApiTest::CServicesDbApiTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CServicesDbApiTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KServicesDbApiTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KServicesDbApiTestLogFile); + } + + iLog = CStifLogger::NewL( KServicesDbApiTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + + } + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CServicesDbApiTest* CServicesDbApiTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CServicesDbApiTest* self = new (ELeave) CServicesDbApiTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CServicesDbApiTest::~CServicesDbApiTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + delete iServicesDB; + + } + +//----------------------------------------------------------------------------- +// CServicesDbApiTest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void CServicesDbApiTest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("ServicesDbApiTest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CServicesDbApiTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTest.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTest.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,62 @@ +/* +* 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: Resource definitions for project ServicesDbApiTest +* +*/ +// --------------------------------------------------------------------------- +// r_da_services_mime +// This resource stores localized strings for the supported services, identified +// by their Uid and generic name. +// This resource is defined in the services_db.rh file +// --------------------------------------------------------------------------- +// +#include +#include +//#include +//#include +//#include +#include +//#include +//#include +//#include +#include +// RESOURCE IDENTIFIER +NAME SDBT // 4 letter ID +RESOURCE RSS_SIGNATURE { } +RESOURCE TBUF { buf=""; } + +RESOURCE DAS_SERVICES r_da_service_mime + { + services = + { + DAS_SERVICE_ENTRY + { + service_uid = 0x101; // NOT A REAL UID + service_name = "Open"; + service_localized_name = "Open Localized"; + }, + DAS_SERVICE_ENTRY + { + service_uid = 0x102; // NOT A REAL UID + service_name = "Upload"; + service_localized_name = "Upload Localized"; + }, + DAS_SERVICE_ENTRY + { + service_uid = 0x103; // NOT A REAL UID + service_name = "Print"; + service_localized_name = "Print Localized %U"; + } + }; + } diff -r 000000000000 -r 254040eb3b7d devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTestBlocks.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,590 @@ +/* +* 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: This cpp file has the functions to test Services DB API. +* +*/ + + + +// [INCLUDE FILES] +#include +#include +#include +#include "ServicesDbApiTest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CServicesDbApiTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + ENTRY( "InitializeSeviceDB", CServicesDbApiTest::InitializeSeviceDB ), + ENTRY( "InitializeonStackSeviceDB", CServicesDbApiTest::InitializeonStackSeviceDB ), + ENTRY( "CountSeviceDB", CServicesDbApiTest::CountSeviceDB), + ENTRY( "ServiceUidLSeviceDB", CServicesDbApiTest::ServiceUidLSeviceDB), + ENTRY( "ServiceStringLCSeviceDB", CServicesDbApiTest::ServiceStringLCSeviceDB), + ENTRY( "ServiceStringLCUIDSeviceDB", CServicesDbApiTest::ServiceStringLCuidSeviceDB), + ENTRY( "ServiceNameLCSeviceDB", CServicesDbApiTest::ServiceNameLCSeviceDB), + ENTRY( "ServiceNameLCuidSeviceDB", CServicesDbApiTest::ServiceNameLCuidSeviceDB), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CreateSeviceDBL +// This function is used to create CServicesDB object. This function is used +// to call CServicesDB::NewL and CServicesDB::NewLC functions. +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::CreateSeviceDBL( TInt aOption ) +{ + + // Get CCoeEnv instance + CEikonEnv* eikEnv = CEikonEnv::Static(); + // Initialize loader + //open our resource file + RConeResourceLoader resources(*eikEnv); + + TParse parse; + parse.Set(_L("c:ServicesDbApiTest.rsc"), &KDC_RESOURCE_FILES_DIR, NULL ); + + TFileName fileName( parse.FullName() ); + iLog->Log(_L("Opened Resource file named :: ")); iLog->Log(fileName); + + TRAPD( error, resources.OpenL(fileName) ); //Open resource file + if ( KErrNone != error ) + { + iLog->Log(_L("Error in opening resource file. ERROR = %d "),error); //return( error ); + //Check on Z drive if not found on C drive + parse.Set(_L("z:ServicesDbApiTest.rsc"), &KDC_RESOURCE_FILES_DIR, NULL ); + TFileName fileName1( parse.FullName() ); + iLog->Log(_L("Opening Resource file named :: ")); iLog->Log(fileName1); + + TRAPD( error1 , resources.OpenL(fileName1) ); + if ( KErrNone != error1 ) + { + iLog->Log(_L("Error in opening resource file. ERROR = %d "),error1); + return( error1 ); + } + } + + TResourceReader reader; + eikEnv->CreateResourceReaderLC( reader, R_DA_SERVICE_MIME ); + + if ( KFirstOption == aOption ) + { + TRAPD( errorinNewL, iServicesDB=CServicesDB::NewL(&reader) ); + if ( KErrNone != errorinNewL ) + { + iLog->Log(_L("=>CServicesDB::NewL leaves")); + } + CleanupStack::PopAndDestroy(); //reader's resource + resources.Close(); + return ( errorinNewL ); + } + else + { + TRAPD( errorinNewLC, CallNewlcL(reader) ); + if( KErrNone != errorinNewLC ) + { + iLog->Log(_L("=>CServicesDB::NewLC leaves")); + } + CleanupStack::PopAndDestroy(); + resources.Close(); + return ( errorinNewLC ); + } +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CallNewlcL +// This function is used because we can not TRAP CServicesDB::NewLC +// ----------------------------------------------------------------------------- +// +void CServicesDbApiTest::CallNewlcL( TResourceReader aResReader ) +{ + iServicesDB = CServicesDB::NewLC( &aResReader ); + CleanupStack::Pop(); +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::InitializeSeviceDB +// Is used to test CServicesDB::NewL +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::InitializeSeviceDB( ) +{ + TInt result; + TRAPD( error , result = CreateSeviceDBL( KFirstOption ) ); + if ( KErrNone != error ) + { iLog->Log(_L("Services DB object not created with NewL.")); return ( error ); } + else + { + if ( KErrNone != result ) + { + iLog->Log(_L("Services DB object not created with NewL.")); return ( result ); + } + else + { + iLog->Log(_L("Services DB object created with NewL.")); + } + } + return ( result ); +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::InitializeonStackSeviceDB +// Is used to test CServicesDB::NewLC +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::InitializeonStackSeviceDB( ) +{ + TInt result; + TRAPD( error, result = CreateSeviceDBL( KSecondOption ) ); + if ( KErrNone != error ) + { iLog->Log(_L("Services DB object not created with NewLC.")); return ( error ); } + else + { + if ( KErrNone != result ) + { + iLog->Log(_L("Services DB object not created with NewLC.")); return ( result ); + } + else + { + iLog->Log(_L("Services DB object created with NewLC.")); + } + } + return ( result ); +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CountSeviceDB +// Testing - IMPORT_C TInt Count() const; +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::CountSeviceDB() +{ + TInt result = InitializeSeviceDB(); + if ( KErrNone != result ) + { + return ( result ); + } + TInt nrServices=iServicesDB->Count(); + iLog->Log(_L("Number of Services listed in resource file = %d"),nrServices); + if ( KNoOfServices != nrServices ) + { + iLog->Log(_L("The number of services returned by CServicesDB::COUNT is incorrect")); + return ( KErrGeneral ); + } + return ( KErrNone ); +} + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::ServiceUidLSeviceDB +// Testing - IMPORT_C TUid ServiceUidL(TInt aIndex) const; +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::ServiceUidLSeviceDB( CStifItemParser& aItem ) +{ + TInt result = InitializeSeviceDB(); + if ( KErrNone != result ) + { + return ( result ); + } + TUid serviceUid; + TInt index; + + if( aItem.GetNextInt(index) != KErrNone ) + { + iLog->Log(_L("NO Index number provided, index is required parameter for testing ServiceUid ")); + return ( KErrGeneral ); + } + + TRAPD( error, serviceUid = iServicesDB->ServiceUidL(index) ); + if ( KErrNone != error ) + { + iLog->Log(_L("Incorrect Index. There is no service matching the Index Number.")); + iLog->Log(_L("=> ServiceUidL leaves when index is incorrect.")); + return (error); + } + + iLog->Log(_L("UID of the Service[%d]=%d"),index,serviceUid.iUid); + + switch (index) + { + case KFirstServiceIndex: if (serviceUid.iUid == 0x101) + { iLog->Log(_L("Service UID is correct")); } + else + { iLog->Log(_L("Service UID is incorrect")); return ( KErrGeneral ); } + break; + case KSecondServiceIndex: if (serviceUid.iUid == 0x102) + { iLog->Log(_L("Service UID is correct")); } + else + { iLog->Log(_L("Service UID is incorrect")); return ( KErrGeneral ); } + break; + case KThirdServiceIndex: if (serviceUid.iUid == 0x103) + { iLog->Log(_L("Service UID is correct")); } + else + { iLog->Log(_L("Service UID is incorrect")); return ( KErrGeneral ); } + break; + default : break; + }; + + return ( KErrNone ); +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::ServiceStringLCSeviceDB +// Testing - IMPORT_C HBufC* ServiceStringLC(TInt aIndex, const TDes& aParam) const; +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::ServiceStringLCSeviceDB( CStifItemParser& aItem ) +{ + TInt result = InitializeSeviceDB(); + if ( KErrNone != result ) + { + return ( result ); + } + TInt index; + TBuf format(KEmptyString); + + if( aItem.GetNextInt(index) != KErrNone ) + { + iLog->Log(_L("NO Index number provided, index is required parameter for testing ServiceUid ")); + return ( KErrGeneral ); + } + TInt res; + TRAPD( error, res = CallServiceStringLCSeviceDBL(index,format )); + if ( KErrNone != error ) + { + iLog->Log(_L("Incorrect Index. There is no service matching the Index Number.")); + iLog->Log(_L("=> ServiceStringLC leaves when index is incorrect.")); + return (error); + } + + return ( res ); +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CallServiceStringLCSeviceDBL +// This function is used because we can not trap ServiceStringLC +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::CallServiceStringLCSeviceDBL(TInt aIndex,const TDes& aParam ) +{ + HBufC *string; + string=iServicesDB->ServiceStringLC(aIndex,aParam); + iLog->Log(_L("LOCALIZED name of the Service[%d] = "),aIndex); + iLog->Log(*string); + + switch (aIndex) + { + case KFirstServiceIndex: if(!(string->Des().Compare(_L("Open Localized")))) + { iLog->Log(_L("LOCALIZED name is correct")); } + else + { iLog->Log(_L("LOCALIZED name is incorrect")); + CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } + break; + case KSecondServiceIndex: if(!(string->Des().Compare(_L("Upload Localized")))) + { iLog->Log(_L("LOCALIZED name is correct")); } + else + { iLog->Log(_L("LOCALIZED name is incorrect")); + CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } + break; + case KThirdServiceIndex: if(!(string->Des().Compare(_L("Print Localized %U")))) + { iLog->Log(_L("LOCALIZED name is correct")); } + else + { iLog->Log(_L("LOCALIZED name is incorrect")); + CleanupStack::PopAndDestroy(string);return ( KErrGeneral ); } + break; + default : break; + }; + + CleanupStack::PopAndDestroy(string); + return ( KErrNone ); + +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::ServiceStringLCuidSeviceDB +// Testing - IMPORT_C HBufC* ServiceStringLC(TUid aServiceUid, const TDes& aParam) const; +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::ServiceStringLCuidSeviceDB( CStifItemParser& aItem ) +{ + TInt result = InitializeSeviceDB(); + if ( KErrNone != result ) + { + return ( result ); + } + TBuf format(KEmptyString); + TInt uid; + + if( aItem.GetNextInt(uid) != KErrNone ) + { + iLog->Log(_L("NO UID number provided, UID is required parameter for testing ServiceStringLC ")); + return ( KErrGeneral ); + } + TUid serviceUID= TUid::Uid(uid); + iLog->Log(_L("serviceUID = %d"),serviceUID.iUid); + TInt res ; + TRAPD(error, res = CallServiceStringLCuidSeviceDBL(serviceUID,format)); + if ( KErrNone != error ) + { + iLog->Log(_L("=> ServiceStringLC leaves. Error code = %d"),error); + return (error); + } + return ( res ); + +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::CallServiceStringLCuidSeviceDBL +// This function is used because we can not trap ServiceStringLC +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::CallServiceStringLCuidSeviceDBL( TUid aServiceUid, const TDes& aParam ) +{ + HBufC *string; + string=iServicesDB->ServiceStringLC(aServiceUid,aParam); + if ( NULL != string ) + { + iLog->Log(_L("LOCALIZED name of the Service with UID(%d) = "),aServiceUid.iUid); + iLog->Log(*string); + } + else + { + iLog->Log(_L("No matching service found, Service UID provided is incorrect")); + } + + switch (aServiceUid.iUid) + { + case KFirstServiceUid: if(!(string->Des().Compare(_L("Open Localized")))) + { iLog->Log(_L("LOCALIZED name is correct")); } + else + { iLog->Log(_L("LOCALIZED name is incorrect")); + CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } + break; + case KSecondServiceUid: if(!(string->Des().Compare(_L("Upload Localized")))) + { iLog->Log(_L("LOCALIZED name is correct")); } + else + { iLog->Log(_L("LOCALIZED name is incorrect")); + CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } + break; + case KThirdServiceUid: if(!(string->Des().Compare(_L("Print Localized %U")))) + { iLog->Log(_L("LOCALIZED name is correct")); } + else + { iLog->Log(_L("LOCALIZED name is incorrect")); + CleanupStack::PopAndDestroy(string);return ( KErrGeneral ); } + break; + default : break; + }; + + CleanupStack::PopAndDestroy(string); + return ( KErrNone ); +} + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::ServiceNameLCSeviceDB +// Testing - IMPORT_C HBufC* ServiceNameLC(TInt aIndex) const; +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::ServiceNameLCSeviceDB( CStifItemParser& aItem ) +{ + TInt result = InitializeSeviceDB(); + if ( KErrNone != result ) + { + return ( result ); + } + TInt index; + TBuf format(KEmptyString); + + if( aItem.GetNextInt(index) != KErrNone ) + { + iLog->Log(_L("NO Index number provided, index is required parameter for testing ServiceNameLC ")); + return ( KErrGeneral ); + } + iLog->Log(_L("checked till here")); + iLog->Log(_L("index = %d"),index); + + TRAPD(error,TInt res = CallServiceNameLCSeviceDBL(index)); + if ( KErrNone != error ) + { + iLog->Log(_L("Incorrect Index. There is no service matching the Index Number.")); + iLog->Log(_L("=> ServiceNameLC leaves when index is incorrect.")); + return (error); + } + return ( KErrNone ); + +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::ServiceNameLCSeviceDB +// This function is used because we can not trap ServiceNameLC +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::CallServiceNameLCSeviceDBL(TInt aIndex) +{ + HBufC *string; + string=iServicesDB->ServiceNameLC(aIndex); + iLog->Log(_L("GENERIC name of the Service[%d] = "),aIndex); + iLog->Log(*string); + + switch (aIndex) + { + case KFirstServiceIndex: if(!(string->Des().Compare(_L("Open")))) + { iLog->Log(_L("GENERIC name is correct")); } + else + { iLog->Log(_L("GENERIC name is incorrect")); + CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } + break; + case KSecondServiceIndex: if(!(string->Des().Compare(_L("Upload")))) + { iLog->Log(_L("GENERIC name is correct")); } + else + { iLog->Log(_L("GENERIC name is incorrect")); + CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } + break; + case KThirdServiceIndex: if(!(string->Des().Compare(_L("Print")))) + { iLog->Log(_L("GENERIC name is correct")); } + else + { iLog->Log(_L("GENERIC name is incorrect")); + CleanupStack::PopAndDestroy(string);return ( KErrGeneral ); } + break; + default : break; + }; + + CleanupStack::PopAndDestroy(string); + return ( KErrNone ); + +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::ServiceNameLCuidSeviceDB +// Testing - IMPORT_C HBufC* ServiceNameLC(TUid aServiceUid) const; +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::ServiceNameLCuidSeviceDB( CStifItemParser& aItem ) +{ + + TInt result = InitializeSeviceDB(); + if ( KErrNone != result ) + { + return ( result ); + } + TBuf format(KEmptyString); + TInt uid; + + if( aItem.GetNextInt(uid) != KErrNone ) + { + iLog->Log(_L("NO UID number provided, UID is required parameter for testing ServiceStringLC ")); + return ( KErrGeneral ); + } + iLog->Log(_L("checked till here")); + + TUid serviceUID= TUid::Uid(uid); + iLog->Log(_L("serviceUID = %d"),serviceUID.iUid); + + TRAPD(error,TInt res = CallServiceNameLCuidSeviceDBL(serviceUID)); + if ( KErrNone != error ) + { + iLog->Log(_L("=> ServiceNameLC leaves."),error); + return (error); + } + return ( KErrNone ); +} + + +// ----------------------------------------------------------------------------- +// CServicesDbApiTest::ServiceNameLCuidSeviceDB +// This function is used because we can not trap ServiceNameLC +// ----------------------------------------------------------------------------- +// +TInt CServicesDbApiTest::CallServiceNameLCuidSeviceDBL( TUid aServiceUid ) +{ + HBufC *string; + string=iServicesDB->ServiceNameLC(aServiceUid); + if ( NULL != string ) + { + iLog->Log(_L("GENERIC name of the Service with UID(%d) = "),aServiceUid.iUid); + iLog->Log(*string); + } + else + { + iLog->Log(_L("No matching service found, Service UID provided is incorrect")); + } + + switch (aServiceUid.iUid) + { + case KFirstServiceUid: if(!(string->Des().Compare(_L("Open")))) + { iLog->Log(_L("GENERIC name is correct")); } + else + { iLog->Log(_L("GENERIC name is incorrect")); + CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } + break; + case KSecondServiceUid: if(!(string->Des().Compare(_L("Upload")))) + { iLog->Log(_L("GENERIC name is correct")); } + else + { iLog->Log(_L("GENERIC name is incorrect")); + CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } + break; + case KThirdServiceUid: if(!(string->Des().Compare(_L("Print")))) + { iLog->Log(_L("GENERIC name is correct")); } + else + { iLog->Log(_L("GENERIC name is incorrect")); + CleanupStack::PopAndDestroy(string);return ( KErrGeneral ); } + break; + default : break; + }; + + CleanupStack::PopAndDestroy(string); + return ( KErrNone ); +} + + +// [End of File] - Do not remove diff -r 000000000000 -r 254040eb3b7d devmngt_pub/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devmngt_pub/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,22 @@ +/* +* 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: Includes all the SDK API specific bld.inf files, which +* export files. +* +*/ + + + + + diff -r 000000000000 -r 254040eb3b7d group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,34 @@ +/* +* 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: Build information file for project settingsuis +* +*/ + + +// mw layer +// Device management ADO + +//Components: + +//devmngt_plat +#include "../devmngt_plat/group/bld.inf" + +//devmngt_pub +#include "../devmngt_pub/group/bld.inf" + +#include "../defaultapplicationsettings/group/bld.inf" + +//systemswuis +#include "../systemswuis/group/bld.inf" + diff -r 000000000000 -r 254040eb3b7d layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,22 @@ + + + +]> + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 254040eb3b7d package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 254040eb3b7d sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 254040eb3b7d systemswuis/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,19 @@ +/* +* 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: Build information file for project systemswuis +* +*/ + + +#include "../touchscreencalib/group/bld.inf" diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/PubSub/touchscprivatepskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/PubSub/touchscprivatepskeys.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,46 @@ +/* +* 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: Private Publish&Subscribe definitions of the +* Security UIs subsystem +* +*/ + + +#ifndef TOUCHSCPRIVATEPSKEYS_H +#define TOUCHSCPRIVATEPSKEYS_H + +// INCLUDES + +//CONSTANTS + +// ============================================================================= +// Touch Screen Calibration API +// ============================================================================= + +/** +* Touchscreen calibration P&S UID +*/ +const TUid KPSUidTouchScreenCalibration = { 0x102828BC }; + +/** +* Wait a touchscreen calibration +*/ +const TUint32 KPSTouchScreenCalibration = 0x00000000; +enum TPSTouchScreenCalibration + { + ETouchScreenCalibrationWait, + ETouchScreenCalibrationOk + }; + +#endif//TOUCHSCPRIVATEPSKEYS_H diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/aif/TouchScreenCalibaif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/aif/TouchScreenCalibaif.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,31 @@ +/* +* 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: RSS for creating the aif file for TouchScreenCalib. +* +*/ + + +// INCLUDES +#include + +RESOURCE AIF_DATA +{ + app_uid = 0x102828BC; + hidden = KAppIsHidden; + num_icons = 0; + embeddability = KAppNotEmbeddable; + newfile = KAppDoesNotSupportNewFile; +} + +// End of file diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/data/TouchScreenCalib.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/data/TouchScreenCalib.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,55 @@ +/* +* 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: +* This file contains all the resources for the module. +* +*/ + + +// RESOURCE IDENTIFIER +NAME TSCA // 4 letter ID + +// INCLUDES +#include +#include +#include +#include "touchscreencalib.loc" + +// CONSTANTS +// -none + +// MACROS +// -none + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="touch_screen_calib"; } + +RESOURCE EIK_APP_INFO + { + status_pane = r_status_pane; + } + +RESOURCE STATUS_PANE_APP_MODEL r_status_pane + { + layout= R_AVKON_STATUS_PANE_LAYOUT_EMPTY; + } + +RESOURCE TBUF r_qtn_touch_screen_cali_instr_can { buf = qtn_touch_screen_cali_instr_can; } +RESOURCE TBUF r_qtn_touch_screen_cali_instr_res { buf = qtn_touch_screen_cali_instr_res; } +RESOURCE TBUF r_qtn_touch_screen_cali_instr_gen { buf = qtn_touch_screen_cali_instr_gen; } +RESOURCE TBUF r_qtn_touch_screen_cali_cancel { buf = qtn_touch_screen_cali_cancel; } +RESOURCE TBUF r_qtn_touch_screen_cali_done { buf = qtn_touch_screen_cali_done; } diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/data/TouchScreenCalib_anim.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/data/TouchScreenCalib_anim.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,70 @@ +/* +* 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: It contains resources for Touch Screen Calibration tap target +* animation +* +*/ + + +// RESOURCE IDENTIFIER +NAME TSAN + +// INCLUDES +#include +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +STRUCT ANIM_DURATION + { + WORD time; + } + +RESOURCE ANIM_DURATION r_anim_duration + { + time = 0; //milliseconds + } + +RESOURCE BMPANIM_DATA r_shutdown_anim + { + frameinterval = 200; + + playmode = EAknBitmapAnimationPlayModeCycle; + + bmpfile = "z:\\resource\\apps\\touchscreencalib.mbm"; + + frames = r_target_frames; + } + +RESOURCE ARRAY r_target_frames + { + items = + { + BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_1; + maskid = EMbmTouchscreencalibQgn_graf_screencalib_1_mask; }, + BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_2; + maskid = EMbmTouchscreencalibQgn_graf_screencalib_2_mask; }, + BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_3; + maskid = EMbmTouchscreencalibQgn_graf_screencalib_3_mask; }, + BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_4; + maskid = EMbmTouchscreencalibQgn_graf_screencalib_4_mask; }, + BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_5; + maskid = EMbmTouchscreencalibQgn_graf_screencalib_5_mask; } + }; + } + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/data/TouchScreenCalib_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/data/TouchScreenCalib_reg.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,27 @@ +/* +* 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: RSS for creating the registration file for TouchScreenCalib. +* +*/ + + +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x102828BC // application UID +RESOURCE APP_REGISTRATION_INFO + { + app_file="TouchScreenCalib"; // filename of application binary (minus extension) + hidden = KAppIsHidden; + } diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/group/TouchScreenCalib.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/group/TouchScreenCalib.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,82 @@ +/* +* 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: +* This is project specification file for the TouchScreenCalib. +* +*/ + + +#include +#include + +TARGET touchscreencalib.exe +TARGETTYPE exe +UID 0x0 0x102828BC +EPOCSTACKSIZE 0x5000 + +VENDORID VID_DEFAULT +CAPABILITY CAP_APPLICATION + +SOURCEPATH ../src + +SOURCE TouchScreenCalibApplication.cpp +SOURCE TouchScreenCalibAppUi.cpp +SOURCE TouchScreenCalibDocument.cpp +SOURCE TouchScreenCalibView.cpp +SOURCE TouchScreenCalibPubSubObserver.cpp +SOURCE TouchScreenCalibSubscriber.cpp + +START RESOURCE ../data/TouchScreenCalib.rss +TARGETPATH APP_RESOURCE_DIR +HEADER +LANGUAGE_IDS +END // RESOURCE + +START RESOURCE ../data/TouchScreenCalib_anim.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +END // RESOURCE + +START RESOURCE ../data/TouchScreenCalib_reg.rss +HEADER +TARGETPATH /private/10003a3f/apps +END + +USERINCLUDE . ../inc ../data +USERINCLUDE ../../inc +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY avkon.lib +LIBRARY eikdlg.lib +LIBRARY eikcore.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY commonengine.lib //use of SharedData +LIBRARY ws32.lib +LIBRARY aknnotify.lib //AknGlobalNote +LIBRARY apgrfx.lib // +LIBRARY egul.lib //DrawUtils +LIBRARY bafl.lib +LIBRARY aknskins.lib //for skin background +LIBRARY cdlengine.lib //for scalable ui +LIBRARY gdi.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknicon.lib +LIBRARY centralrepository.lib +LIBRARY starterclient.lib //use of Starter to remove splash screen +LIBRARY touchfeedback.lib + diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,48 @@ +/* +* 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: This file provides the information required for building the +* whole of a TouchScreenCalib. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../loc/touchscreencalib.loc APP_LAYER_LOC_EXPORT_PATH(touchscreencalib.loc) +../rom/TouchScreenCalib.iby CORE_APP_LAYER_IBY_EXPORT_PATH(touchscreencalib.iby) +../rom/TouchScreenCalib_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(touchscreencalib_variant.iby) +../rom/TouchScreenCalibResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(touchscreencalibresources.iby) +../PubSub/touchscprivatepskeys.h |../../inc/touchscprivatepskeys.h + +PRJ_MMPFILES + +TouchScreenCalib.mmp +../tscstartupextensionplugin/group/tscstartupextensionplugin.mmp +../tsccustcmds/group/tsccustcmds.mmp + +PRJ_EXTENSIONS + +START EXTENSION s60/mifconv +OPTION TARGETFILE touchscreencalib.mif +OPTION HEADERFILE touchscreencalib.mbg +OPTION SOURCES -c16,8 Qgn_graf_screencalib \ + -c16,8 Qgn_graf_screencalib_1 \ + -c16,8 Qgn_graf_screencalib_2 \ + -c16,8 Qgn_graf_screencalib_3 \ + -c16,8 Qgn_graf_screencalib_4 \ + -c16,8 Qgn_graf_screencalib_5 +END diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/group/touchscreencalib_icons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/group/touchscreencalib_icons.mk Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,75 @@ +# +# 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: Icons makefile for project touchscreencalib +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# : Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +HEADERDIR=\epoc32\include +ICONTARGETFILENAME=$(TARGETDIR)\touchscreencalib.mif +HEADERFILENAME=$(HEADERDIR)\touchscreencalib.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# : Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c16,8 Qgn_graf_screencalib \ + /c16,8 Qgn_graf_screencalib_1 \ + /c16,8 Qgn_graf_screencalib_2 \ + /c16,8 Qgn_graf_screencalib_3 \ + /c16,8 Qgn_graf_screencalib_4 \ + /c16,8 Qgn_graf_screencalib_5 + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/inc/MTouchScreenCalibPropertyResponder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/inc/MTouchScreenCalibPropertyResponder.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,32 @@ +/* +* 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: Interface of Touch screen calibration property change obsever +* +*/ + + +#ifndef MTOUCHSCREENCALIBPROPERTYRESPONDER_H +#define MTOUCHSCREENCALIBPROPERTYRESPONDER_H + +// INCLUDES +#include + +class MTouchScreenCalibPropertyResponder + { +public: + virtual void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ) = 0; + }; +#endif //MTOUCHSCREENCALIBPROPERTYRESPONDER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/inc/TouchScreenCalibAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/inc/TouchScreenCalibAppUi.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,202 @@ +/* +* 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: AppUi class of the application. +* +*/ + + +#ifndef TOUCHSCREENCALIBAPPUI_H +#define TOUCHSCREENCALIBAPPUI_H + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +// CONSTANTS +const TInt KConvertGetCase = 0; +const TInt KConvertSaveCase = 1; + +const TInt KUnknownOrientation = 0; +const TInt KPortraitOrientation = 1; +const TInt KLandscapeOrientation = 2; + +// FORWARD DECLARATIONS +class TTouchScreenCalibLayout + { +public: + TAknLayoutRect iAnimImageLayout1; + TAknLayoutRect iAnimImageLayout2; + TAknLayoutRect iAnimImageLayout3; + TAknLayoutRect iAnimImageLayout4; + }; + +class CTouchScreenCalibView; +class CTouchScreenCalibPubSubObserver; +/** +* 'AppUi' class. +* +*/ +class CTouchScreenCalibAppUi : public CAknAppUi, CCoeControl +{ + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CTouchScreenCalibAppUi(); + + /** + * Destructor. + */ + ~CTouchScreenCalibAppUi(); + + // from CCoeAppUiBase + void PrepareToExit(); + + /** + * Handles key events + * @param TKeyEvent key event + * @param TEventCode event code + * @since S60 3.2 + */ + void HandleKeyL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * Handles pointer events + * @param TPoint co-ordinates + * @since S60 3.2 + */ + void HandlePointerL( TPoint aPos ); + + /** + * Check current point number + * @since S60 3.2 + * @return TInt, point number + */ + TInt GetCalibrationStep(); + + /** + * Get rect of current tap animation or image + * @since S60 3.2 + * @param TInt, point number + * @return TRect, animation or image rect. + */ + TRect GetAnimImageRect(TInt aPointNumber = 0); + + /** + * From CAknAppUi, called when screen layout changes + */ + void HandleScreenDeviceChangedL(); + + /** + * Check if first boot is going on + * @since S60 3.2 + * @return. ETrue if first boot, otherwise EFalse + */ + TBool FirstBoot(); + + protected: + /* + * Handles changes to the application when it + * switches to or from the foreground. + */ + virtual void HandleForegroundEventL(TBool aForeground); + + private: + /** + * EPOC default constructor. + */ + void ConstructL(); + + /** + * Update display + * @since S60 3.2 + */ + void UpdateL(); + + /** + * Checks layout orientation + * @since S60 3.2 + * @return TBool. ETrue if orientation same in driver native level and window level + */ + TBool IsCorrectOrientation(TRect aRect); + + /** + * Convert calibration or tapped points to different layout orientation + * @since S60 3.2 + * @param Points + * @param Convert case. + * @return Calibration points. KConvertGetCase or KConvertSaveCase. + */ + TDigitizerCalibration ConvertToCorrectOrientation(TDigitizerCalibration aPoints, + TInt aConvertCase); + /** + * Get calibration points + * @since S60 3.2 + * @return Calibration points + */ + TDigitizerCalibration CalibrationPoints(); + + /** + * Change to next calibration point + * @since S60 3.2 + */ + void NextCalibrationStepL(); + + /** + * Saves calibration + * @since S60 3.2 + */ + void SaveCalibration(); + + /** + * Restart calibration at first point + * @since S60 3.2 + */ + void ResetCalibrationStepsL(); + + /** + * Sets tap points to 0 values + * @since S60 3.2 + */ + void ResetTapPoints(); + + TDigitizerCalibration ChangeOrientation(TDigitizerCalibration aSourcePoints, + TPoint aDestReso); + + + void SetOrientation(); + + private: //Data + CTouchScreenCalibView* iTouchScreenCalibView; //owns + CTouchScreenCalibPubSubObserver* iTouchScreenCalibPubSubObserver; //owns + TDigitizerCalibration iCalibrationPoints; + TDigitizerCalibration iTapPoints; + TInt iCurrentCalibrationStep; + TBool iExitting; + TTouchScreenCalibLayout iTouchScreenCalibLayout; + TBool iCalibrationDone; + TInt iNativeOrientation; + TBool iCalibrationCancel; +}; + +#endif // TOUCHSCREENCALIBAPPUI_H + +// End of file diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/inc/TouchScreenCalibApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/inc/TouchScreenCalibApplication.h Thu Dec 17 08:46:07 2009 +0200 @@ -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: Application class of the module. +* +*/ + + + +#ifndef TOUCHSCREENCALIBAPPLICATION_H +#define TOUCHSCREENCALIBAPPLICATION_H + +// SYSTEM INCLUDES +#include + +// CONSTANTS +const TUid KUidTouchScreenCalib = { 0x102828BC }; + +// CLASS DECLARATION + +/** +* CTouchScreenCalibApp application class. +*/ +class CTouchScreenCalibApplication : public CAknApplication + { + private: // from CApaApplication + /** + * Create CTouchScreenCalibDocument document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * Return KUidTouchScreenCalib. + */ + TUid AppDllUid() const; + }; + +#endif // TOUCHSCREENCALIBAPPLICATION_H + +// End of file + diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/inc/TouchScreenCalibDefines.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/inc/TouchScreenCalibDefines.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,44 @@ +/* +* 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: Includes some common defines used in the TouchScreenCalib application +* +*/ + + +#ifndef TOUCHSCREENCALIBDEFINES_H +#define TOUCHSCREENCALIBDEFINES_H + +//CONSTANTS +_LIT( KTouchScreenCalibAppName, "TouchScreenCalib" ); + +// MACROS + +#define PANIC(aPanic) User::Panic( KTouchScreenCalibAppName, aPanic ) + +#define TRACE_ADDPREFIX(aText) (TPtrC((const TText *)L"TouchScreenCalibApp: \"" L##aText L"\"")) + +#ifdef _DEBUG +#define TRACES(aMsg) RDebug::Print( TRACE_ADDPREFIX(aMsg) ) +#define TRACES1(aFormat,aP1) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1) ) +#define TRACES2(aFormat,aP1,aP2) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2) ) +#define TRACES3(aFormat,aP1,aP2,aP3) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2),(aP3) ) +#else +#define TRACES(aMsg) +#define TRACES1(aFormat,aP1) +#define TRACES2(aFormat,aP1,aP2) +#define TRACES3(aFormat,aP1,aP2,aP3) +#endif +#endif // TOUCHSCREENCALIBDEFINES_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/inc/TouchScreenCalibDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/inc/TouchScreenCalibDocument.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,80 @@ +/* +* 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: Document class of the module. +* +*/ + + + +#ifndef TOUCHSCREENCALIBDOCUMENT_H +#define TOUCHSCREENCALIBDOCUMENT_H + +// SYSTEM INCLUDES +#include + +// FORWARD DECLARATIONS +class CEikAppUi; + +// CLASS DECLARATION + +/** +* CTouchScreenCalibDocument application class. +*/ +class CTouchScreenCalibDocument : public CAknDocument +{ + public: + + /** + * C++ default constructor. + */ + CTouchScreenCalibDocument(CEikApplication& aApp): CAknDocument(aApp) { } + + /** + * Two-phased constructor. + */ + static CTouchScreenCalibDocument* NewL(CEikApplication& aApp); + + /** + * Destructor. + */ + virtual ~CTouchScreenCalibDocument(); + + private: + /** + * EPOC default constructor. + */ + void ConstructL(); + + /** + * This method makes an application hidden so that it is not visible + * for example in Applications list and FastSwap window. + * @param CApaWindowGroupName* aWgName + * @return void + */ + void UpdateTaskNameL( CApaWindowGroupName* aWgName ); + + private:// from CEikDocument + + /** + * Create CTouchScreenCalibAppUi object. + */ + CEikAppUi* CreateAppUiL(); + + private:// data + +}; + +#endif + +//End of file diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/inc/TouchScreenCalibPubSubObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/inc/TouchScreenCalibPubSubObserver.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,75 @@ +/* +* 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: +* This class the handles the received indications from the Public and +* Subscribe. +* +*/ + + +#ifndef TOUCHSCREENCALIBPUBSUBOBSERVER_H +#define TOUCHSCREENCALIBPUBSUBOBSERVER_H + +// INCLUDES +#include +#include "MTouchScreenCalibPropertyResponder.h" +#include "TouchScreenCalibAppUi.h" + +// CLASS DECLARATION +class CTouchScreenCalibAppUi; +class CTouchScreenCalibSubscriber; + +class CTouchScreenCalibPubSubObserver : public CBase, public MTouchScreenCalibPropertyResponder + { + public: // Constructors and destructor + + /** + * C++ constructor. + */ + CTouchScreenCalibPubSubObserver( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ); + + /** + * Two-phased constructor. + */ + static CTouchScreenCalibPubSubObserver* NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ); + + /** + * Destructor. + */ + ~CTouchScreenCalibPubSubObserver(); + + private: + + /** + * By default EPOC constructor is private. + */ + void ConstructL(); + + CTouchScreenCalibPubSubObserver(); + + protected: // From MTouchScreenCalibPropertyResponder + + void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ); + + private: // Data + //reference to application class + CTouchScreenCalibAppUi* iTouchScreenCalibAppUi; //uses + RProperty iProperty; + CTouchScreenCalibSubscriber* iGlobalSWStateSubscriber; + CTouchScreenCalibSubscriber* iTsyCallState; + }; + +#endif // TOUCHSCREENCALIBPUBSUBOBSERVER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/inc/TouchScreenCalibSubscriber.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/inc/TouchScreenCalibSubscriber.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,91 @@ +/* +* 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: TouchScreenCalibSubscriber (Publish & Subscribe). +* +*/ + + +#ifndef TOUCHSCREENCALIBSUBSCRIBER_H +#define TOUCHSCREENCALIBSUBSCRIBER_H + +// INCLUDES +#include +#include +#include "MTouchScreenCalibPropertyResponder.h" + +// CLASS DECLARATION +/** +* CTouchScreenCalibSubscriber +* +* @lib +* @since 3.2 +*/ + +class CTouchScreenCalibSubscriber : public CActive +{ +public: + /** + * Two-phased constructor. + */ + static CTouchScreenCalibSubscriber* NewL( MTouchScreenCalibPropertyResponder& aTouchScreenCalibPropertyResponder, + const TUid& aCategory, + TUint aKey ); + + /** + * Destructor. + */ + ~CTouchScreenCalibSubscriber(); + + void Subscribe(); + +private: + CTouchScreenCalibSubscriber( MTouchScreenCalibPropertyResponder& aTouchScreenCalibPropertyResponder, + const TUid& aCategory, TUint + aKey ); + void ConstructL(); + +public: // from CActive + /** + * @param none + * @return none + */ + void RunL(); + + /** + * @param aError the error returned + * @return error + */ + TInt RunError( TInt aError ); + + /** + * @param none + * @return none + */ + void DoCancel(); + +private: // Methods not implemented + CTouchScreenCalibSubscriber( const CTouchScreenCalibSubscriber& ); // Copy constructor + CTouchScreenCalibSubscriber& operator=( const CTouchScreenCalibSubscriber& );// Assigment operator + +private: + + MTouchScreenCalibPropertyResponder& iTouchScreenCalibPropertyResponder; + RProperty iProperty; + TUid iCategory; + TUint iKey; +}; + +#endif // TOUCHSCREENCALIBSUBSCRIBER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/inc/TouchScreenCalibView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/inc/TouchScreenCalibView.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,215 @@ +/* +* 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: +* This class is the container class of the CTouchScreenCalibView. +* Is used to show tap target animation. +* +*/ + + + +#ifndef TOUCHSCREENCALIBVIEW_H +#define TOUCHSCREENCALIBVIEW_H + +// SYSTEM INCLUDES +#include +#include + +#include +// USER INCLUDES +#include "TouchScreenCalibAppUi.h" + +// CONSTANTS + +// FORWARD DECLARATIONS +class TCalibAnimImageRect + { +public: + TRect iAnimImageRect1; + TRect iAnimImageRect2; + TRect iAnimImageRect3; + TRect iAnimImageRect4; + }; + +class CTouchScreenCalibAppUi; +class CAknBitmapAnimation; + +// CLASS DECLARATION + +/** +* This class takes care of showing welcome animatio to the user. +*/ +class CTouchScreenCalibView : public CCoeControl , public MCoeControlObserver + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CTouchScreenCalibView( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ); + + /** + * Two-phased constructor. + */ + static CTouchScreenCalibView* NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ); + + /** + * Destructor + */ + ~CTouchScreenCalibView(); + + /** + * This handles the key events in this control. + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /** + * Update UI + */ + void UpdateL( TAknLayoutText aTextLayout ); + + /** + * Prepare to draw background for ending phase + */ + void DrawEndingBackground(); + + /** + * Prepare to draw background for notes + */ + void EndTargetAnimation(); + + /** + * This makes the animation module to stop showing animation. + */ + void EndAnimation(); + + /** + * + */ + void SetTextL(TAknLayoutText aTextLayout); + + /** + * + */ + void SetWinPriority(TInt aPriority); + + private: + + /** + * By default EPOC constructor is private. + */ + void ConstructL(); + + CTouchScreenCalibView(); + + /** + * Is called when size is changed. + */ + void SizeChanged(); + + /** + * Returns the count of the components in the container. + */ + TInt CountComponentControls() const; + + /** + * Returns the component specified by aIndex parameter. + */ + CCoeControl* ComponentControl(TInt aIndex) const; + + /** + * Handles the event of the control. + */ + void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); + + /** + * Handles key events. + * @param aKeyEvent Event to be handled + * @param aType Type of the key event + * @return TKeyResponse + */ + virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + /** + * Handles pointer events + */ + virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + /** + * Checks tapped point's validity + * @param TPoint co-ordinates + * @since S60 3.2 + */ + TBool Validate(TPoint aPos); + + /** + * Draw white background + * @since S60 3.2 + */ + void DrawBackground() const; + + /** + * Draw texts + * @since S60 3.2 + */ + void DrawText() const; + + /** + * Draw inactive tap points + * @since S60 3.2 + */ + void ShowImage( TRect aRect ) const; + + private: // Functions from base classes + + /** + * From CCoeControl + */ + void Draw( const TRect& aRect ) const; + + protected: // Data + + //Used for showing animation + CAknBitmapAnimation *iAnim; //owns + + CFbsBitmap *iBitmap; + CFbsBitmap *iBitmapMask; + + CTouchScreenCalibAppUi* iTouchScreenCalibAppUi; //uses + + //used for telling when the animation is showing + TBool iAnimationShowing; + + //used for telling if animation is cancelled by user. + TBool iAnimationCancelled; + + const CFont* iFont; // not owned + + CArrayPtr* iText; + + + TCalibAnimImageRect iAnimImageRect; + + TPoint iTextTopLeft; + TSize iTextSize; + TInt iTextBaselineOffset; + TRgb iTextColor; + CGraphicsContext::TTextAlign iTextAlignment; + TBool iCalibrationCompleted; + MTouchFeedback* iTouchFeedback; + }; + +#endif // TOUCHSCREENCALIBVIEW_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/loc/touchscreencalib.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/loc/touchscreencalib.loc Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,59 @@ +/* +* 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: Localization strings for TouchScreenCalib +* +*/ + + +// LOCALISATION STRINGS + +//d:Asks user to tap center of the target with stylus. +//l:main_touch_calib_pane_t1 +//w: +//r:3.2 +// +#define qtn_touch_screen_cali_instr_gen "Touch screen calibration step %N of 4: Use stylus to tap center of target." + +//d:Used to tell user that pressing Send key cancels calibration and exits application. +//d:This is used when TouchScreenCalib application is started from General Settings by user. +//l:main_touch_calib_pane_t2 +//w: +//r:3.2 +// +#define qtn_touch_screen_cali_instr_can "To cancel press Send key." + +//d:Used to tell user that pressing Send key resets calibration and calibration +//d:begins again from point 1. This is used when TouchScreenCalib application is +//d:started when the phone is starter for the first time. +//l:main_touch_calib_pane_t2 +//w: +//r:3.2 +// +#define qtn_touch_screen_cali_instr_res "To start again from point 1 press Send key." + +//d:This Information Note is displayed if user cancels calibration with Send key press. +//l:popup_note_window/opt2 +//w: +//r:5.0 +// +#define qtn_touch_screen_cali_cancel "Calibration cancelled." + +//d:This Confirmation Note is dipslayed when calibration is done succesfully. +//l:popup_note_window/opt2 +//w: +//r:3.2 +// +#define qtn_touch_screen_cali_done "Calibration successful!" + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/rom/TouchScreenCalib.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/rom/TouchScreenCalib.iby Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,32 @@ +/* +* 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: +* This class is a part of the standard application framework. +* The application gets instantiated starting from this class. +* Provides a factory method for instantiating the document object. +* +*/ +#ifndef __TOUCHSCREENCALIB_IBY__ +#define __TOUCHSCREENCALIB_IBY__ + +#if defined (__PEN_SUPPORT) && defined(__PEN_SUPPORT_CALIBRATION) +S60_APP_EXE(TouchScreenCalib) +S60_APP_AIF_RSC(TouchScreenCalib) +#endif +#if ( defined FF_TOUCHSCREENCALIB_IN_STARTUP && defined __PEN_SUPPORT && defined __PEN_SUPPORT_CALIBRATION ) +ECOM_PLUGIN( tscstartupextensionplugin.dll, tscstartupextensionplugin.rsc ) +file=ABI_DIR\BUILD_DIR\tsccustcmds.dll SHARED_LIB_DIR\tsccustcmds.dll +#endif //FF_TOUCHSCREENCALIB_IN_STARTUP + +#endif diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/rom/TouchScreenCalibResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/rom/TouchScreenCalibResources.iby Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,28 @@ +/* +* 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: +* This class is a part of the standard application framework. +* The application gets instantiated starting from this class. +* Provides a factory method for instantiating the document object. +* +*/ + +#ifndef __TOUCHSCREENCALIB_RESOURCES_IBY__ +#define __TOUCHSCREENCALIB_RESOURCES_IBY__ + +#if defined (RD_SCALABLE_UI_V2) && defined(__PEN_SUPPORT) && defined(__PEN_SUPPORT_CALIBRATION) +S60_APP_RESOURCE(TouchScreenCalib) +#endif + +#endif \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/rom/TouchScreenCalib_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/rom/TouchScreenCalib_variant.iby Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* This class is a part of the standard application framework. +* The application gets instantiated starting from this class. +* Provides a factory method for instantiating the document object. +* +*/ + +#ifndef __TOUCHSCREENCALIB_VARIANT_IBY__ +#define __TOUCHSCREENCALIB_VARIANT_IBY__ + +#if defined (RD_SCALABLE_UI_V2) && defined(__PEN_SUPPORT) && defined(__PEN_SUPPORT_CALIBRATION) +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,TouchScreenCalib) +S60_APP_RESOURCE(TouchScreenCalib_anim) +#endif + +#endif \ No newline at end of file diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/src/TouchScreenCalibAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/src/TouchScreenCalibAppUi.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,722 @@ +/* +* 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: AppUi class of the application. +* +*/ + + +// SYSTEM INCLUDES +#include +#include +#include +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION +#include "touchscprivatepskeys.h" +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION +#include +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION +#include +#include +#include +#include +#include //used for RemoveSplashScreen + +// USER INCLUDES +#include "TouchScreenCalibApplication.h" +#include "TouchScreenCalibAppUi.h" +#include "TouchScreenCalibDefines.h" +#include "TouchScreenCalibDocument.h" +#include "TouchScreenCalibView.h" +#include "TouchScreenCalibPubSubObserver.h" + +// CONSTANTS + +_LIT_SECURITY_POLICY_C1(KReadDeviceDataPolicy, ECapabilityReadDeviceData); +_LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData); + +// ================= MEMBER FUNCTIONS ======================= +// +// ---------------------------------------------------- +// CTouchScreenCalibAppUi::CTouchScreenCalibAppUi() +// ---------------------------------------------------- +CTouchScreenCalibAppUi::CTouchScreenCalibAppUi(): + iTouchScreenCalibPubSubObserver( NULL ), + iCurrentCalibrationStep( 0 ), + iExitting( EFalse ), + iCalibrationDone( EFalse ), + iCalibrationCancel( EFalse ) + { + TRACES("CTouchScreenCalibAppUi::CTouchScreenCalibAppUi"); + iNativeOrientation = KUnknownOrientation; + } + +// ---------------------------------------------------- +// CTouchScreenCalibAppUi::ConstructL() +// ---------------------------------------------------- +void CTouchScreenCalibAppUi::ConstructL() + { + TRACES("CTouchScreenCalibAppUi::ConstructL()"); + TInt flags = EStandardApp|EAknEnableSkin; + + BaseConstructL(flags); + +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Define(KPSUidTouchScreenCalibration, +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Define(KPSUidStartup, +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + KPSTouchScreenCalibration, + RProperty::EInt, + KReadDeviceDataPolicy, + KWriteDeviceDataPolicy ); + + // Clearing the calibration before doing the actual calibration + TDigitizerCalibrationType caltype = EFactory; + UserHal::RestoreXYInputCalibration(caltype); + ResetTapPoints(); + +// SetOrientation(); + + iCalibrationPoints = CalibrationPoints(); + + // Set TSC application to be system application + CEikonEnv& eikEnv = *CEikonEnv::Static(); + eikEnv.SetSystem( ETrue ); + + iTouchScreenCalibLayout.iAnimImageLayout1.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g1().LayoutLine()); + iTouchScreenCalibLayout.iAnimImageLayout2.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g2().LayoutLine()); + iTouchScreenCalibLayout.iAnimImageLayout3.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g3().LayoutLine()); + iTouchScreenCalibLayout.iAnimImageLayout4.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g4().LayoutLine()); + + iTouchScreenCalibView = CTouchScreenCalibView::NewL( this ); + AddToStackL( iTouchScreenCalibView ); + + iTouchScreenCalibView->SetWinPriority(0); + // Disable priority changes of window server + eikEnv.WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); + + UpdateL(); + + iTouchScreenCalibPubSubObserver = CTouchScreenCalibPubSubObserver::NewL( this ); + + if (FirstBoot()) + { + TRACES("CTouchScreenCalibAppUi::ConstructL(): First boot ongoing"); + TRACES("CTouchScreenCalibAppUi::ConstructL(): Connect to Starter"); + RStarterSession startersession; + if( startersession.Connect() == KErrNone ) + { + TRACES("CTouchScreenCalibAppUi::ConstructL(): Connected to Starter"); + startersession.EndSplashScreen(); + TRACES("CTouchScreenCalibAppUi::ConstructL(): Splash screen removed"); + startersession.Close(); + } + } + NextCalibrationStepL(); + + TRACES("CTouchScreenCalibAppUi::ConstructL(): End"); + } + +// ---------------------------------------------------- +// CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi() +// ---------------------------------------------------- +CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi() + { + TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi()"); + if (iTouchScreenCalibView) + { + TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): delete iTouchScreenCalibView"); + RemoveFromStack( iTouchScreenCalibView ); + delete iTouchScreenCalibView; + } + if (iTouchScreenCalibPubSubObserver) + { + TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): delete iTouchScreenCalibPubSubObserver"); + delete iTouchScreenCalibPubSubObserver; + } + TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): End"); + } + +// ---------------------------------------------------- +// CTouchScreenCalibAppUi::NextCalibrationStepL() +// ---------------------------------------------------- +void CTouchScreenCalibAppUi::NextCalibrationStepL() + { + TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL()"); + TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint1: %d %d",iTapPoints.iTl.iX, iTapPoints.iTl.iY); + TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint2: %d %d",iTapPoints.iTr.iX, iTapPoints.iTr.iY); + TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint3: %d %d",iTapPoints.iBr.iX, iTapPoints.iBr.iY); + TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint4: %d %d",iTapPoints.iBl.iX, iTapPoints.iBl.iY); + iCurrentCalibrationStep++; + TRACES1("CTouchScreenCalibAppUi::NextCalibrationStepL(): CurrentCalibrationStep: %d",iCurrentCalibrationStep); + + if (iCurrentCalibrationStep > 4) + { + TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Calibration succesfully completed. Save it and exit application."); + SaveCalibration(); + iCalibrationDone = ETrue; + + iTouchScreenCalibView->EndTargetAnimation(); + iTouchScreenCalibView->SetWinPriority(ECoeWinPriorityNormal); + TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Show 'Calibration Done' note"); + HBufC* noteText = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_DONE ); + CAknInformationNote* note = + new( ELeave ) CAknInformationNote( ETrue ); + note->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy( noteText ); + if ( FirstBoot() ) + { + iTouchScreenCalibView->DrawEndingBackground(); +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Set( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, ETouchScreenCalibrationOk ); +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Set( KPSUidStartup, KPSTouchScreenCalibration, ETouchScreenCalibrationOk ); +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + iTouchScreenCalibView->SetWinPriority(0); + } + else + { + PrepareToExit(); + } + } + else + { + TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Update next step."); + UpdateL(); + } + TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): End"); + } + +// ---------------------------------------------------- +// CTouchScreenCalibAppUi::SaveCalibration() +// ---------------------------------------------------- +void CTouchScreenCalibAppUi::SaveCalibration() + { + TRACES("CTouchScreenCalibAppUi::SaveCalibration()"); + + // Touch Screen driver supports only portrait orientation. If device is now in + // landscape mode, convert points to portrait. + TDigitizerCalibration tapPoints = ConvertToCorrectOrientation(iTapPoints, + KConvertSaveCase); + UserHal::SetXYInputCalibration(tapPoints); + TRACES("CTouchScreenCalibAppUi::SaveCalibration(): End"); + } + +// ---------------------------------------------------- +// CTouchScreenCalibAppUi::ResetCalibrationStepsL() +// ---------------------------------------------------- +void CTouchScreenCalibAppUi::ResetCalibrationStepsL() + { + iCurrentCalibrationStep = 0; + ResetTapPoints(); + NextCalibrationStepL(); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::HandleForegroundEventL(TBool aForeground) +// --------------------------------------------------------------------------- +void CTouchScreenCalibAppUi::HandleForegroundEventL( TBool aForeground ) + { + // call super-class first + CAknAppUi::HandleForegroundEventL( aForeground ); + TRACES1("CTouchScreenCalibAppUi::HandleForegroundEventL( %d )", aForeground); + if ( aForeground ) + { + // if we are coming to foreground + UpdateL(); + } + else + { + if (!FirstBoot()) + { + // Take old calibration in use + TDigitizerCalibrationType caltype = ESaved; + UserHal::RestoreXYInputCalibration(caltype); + PrepareToExit(); + } + } + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::HandleKeyL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/ ) +// --------------------------------------------------------------------------- +void CTouchScreenCalibAppUi::HandleKeyL( const TKeyEvent& aKeyEvent, TEventCode /*aType*/ ) + { + TRACES1("CTouchScreenCalibAppUi::HandleKeyL(): %d",aKeyEvent.iCode); + + if (aKeyEvent.iCode == EKeyYes) //Send key + { + TRACES("CTouchScreenCalibAppUi::HandleKeyL(): Send Key"); + if (FirstBoot()) // Restart calibration from step 1 + { + TRACES("CTouchScreenCalibAppUi::HandleKey(): Go to first calibration step"); + ResetCalibrationStepsL(); + } + else// Show "Calibration cancelled" Information note. + { + TRACES("CTouchScreenCalibAppUi::HandleKeyL(): Show cancel note"); + iCalibrationCancel = ETrue; + + iTouchScreenCalibView->EndAnimation(); + iTouchScreenCalibView->SetWinPriority(ECoeWinPriorityNormal); + HBufC* noteText = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_CANCEL ); + CAknInformationNote* note = + new( ELeave ) CAknInformationNote( ETrue ); + note->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy( noteText ); + + // Take old calibration in use + TDigitizerCalibrationType caltype = ESaved; + UserHal::RestoreXYInputCalibration(caltype); + PrepareToExit(); + } + } + else if ( aKeyEvent.iCode == EKeyNo || aKeyEvent.iCode == EKeyApplication0 + || ( aKeyEvent.iCode == EKeyNull && aKeyEvent.iScanCode == EStdKeyDevice7 )) + { + TRACES("CTouchScreenCalibAppUi::HandleKeyL(): End Key or App Key"); + if (!FirstBoot()) + { + // Take old calibration in use + TDigitizerCalibrationType caltype = ESaved; + UserHal::RestoreXYInputCalibration(caltype); + PrepareToExit(); + } + } + TRACES("CTouchScreenCalibAppUi::HandleKeyL(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::HandlePointerL() +// --------------------------------------------------------------------------- +void CTouchScreenCalibAppUi::HandlePointerL( TPoint aPos ) + { + TRACES("CTouchScreenCalibAppUi::HandlePointerL()"); + + switch(iCurrentCalibrationStep) + { + case 1: + TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 1"); + iTapPoints.iTl.iX = aPos.iX; + iTapPoints.iTl.iY = aPos.iY; + break; + case 2: + TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 2"); + iTapPoints.iTr.iX = aPos.iX; + iTapPoints.iTr.iY = aPos.iY; + break; + case 3: + TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 4"); + iTapPoints.iBr.iX = aPos.iX; + iTapPoints.iBr.iY = aPos.iY; + break; + case 4: + TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 3"); + iTapPoints.iBl.iX = aPos.iX; + iTapPoints.iBl.iY = aPos.iY; + break; + default: + TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case default"); + break; + } + TRACES("CTouchScreenCalibAppUi::HandlePointerL(): End: Continue calibration"); + NextCalibrationStepL(); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::PrepareToExit() +// --------------------------------------------------------------------------- +void CTouchScreenCalibAppUi::PrepareToExit() + { + TRACES("CTouchScreenCalibAppUi::PrepareToExit()"); + if (!iExitting) + { + iExitting = ETrue; + CEikAppUi::PrepareToExit(); + Exit(); + } + TRACES("CTouchScreenCalibAppUi::PrepareToExit(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::ResetTapPoints() +// --------------------------------------------------------------------------- +void CTouchScreenCalibAppUi::ResetTapPoints() + { + TRACES("CTouchScreenCalibAppUi::ResetTapPoints()"); + iTapPoints.iTl.iX = 0; + iTapPoints.iTl.iY = 0; + iTapPoints.iTr.iX = 0; + iTapPoints.iTr.iY = 0; + iTapPoints.iBr.iX = 0; + iTapPoints.iBr.iY = 0; + iTapPoints.iBl.iX = 0; + iTapPoints.iBl.iY = 0; + TRACES("CTouchScreenCalibAppUi::ResetTapPoints(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::UpdateL() +// --------------------------------------------------------------------------- +void CTouchScreenCalibAppUi::UpdateL() + { + TRACES("CTouchScreenCalibAppUi::UpdateL()"); + TRACES1("CTouchScreenCalibAppUi::UpdateL(): iCurrentCalibrationStep: %d",iCurrentCalibrationStep); + + TAknLayoutText textLayout; + textLayout.LayoutText(TRect(), AknLayoutScalable_Apps::main_touch_calib_pane_t1().LayoutLine()); + + TRACES2("CTouchScreenCalibAppUi::UpdateL(): Text rect top: X:%d Y:%d",textLayout.TextRect().iTl.iX, textLayout.TextRect().iTl.iY); + TRACES2("CTouchScreenCalibAppUi::UpdateL(): Text rect:bottom: X:%d Y:%d",textLayout.TextRect().iBr.iX, textLayout.TextRect().iBr.iY); + + iTouchScreenCalibView->UpdateL(textLayout); + + TRACES("CTouchScreenCalibAppUi::UpdateL(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::GetCalibrationStep() +// --------------------------------------------------------------------------- +TInt CTouchScreenCalibAppUi::GetCalibrationStep() + { + return iCurrentCalibrationStep; + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::GetAnimImageRect() +// --------------------------------------------------------------------------- +TRect CTouchScreenCalibAppUi::GetAnimImageRect(TInt aPointNumber) + { + TRACES1("CTouchScreenCalibAppUi::GetAnimImageRect(%d)", aPointNumber); + TRect rect; + TInt width(0); + TInt height(0); + + // If aPointNumber is 0, return current calibration point. + if (aPointNumber == 0) + { + aPointNumber = GetCalibrationStep(); + } + + switch (aPointNumber) + { + case 1: + width = iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iBr.iX - + iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iTl.iX; + height= iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iBr.iY - + iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iTl.iY; + + rect = TRect(TPoint( iCalibrationPoints.iTl.iX - (width/2), + iCalibrationPoints.iTl.iY - (height/2)), + TPoint( iCalibrationPoints.iTl.iX + (width/2), + iCalibrationPoints.iTl.iY + (height/2))); + break; + case 2: + width = iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iBr.iX - + iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iTl.iX; + height= iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iBr.iY - + iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iTl.iY; + + rect = TRect(TPoint( iCalibrationPoints.iTr.iX - (width/2), + iCalibrationPoints.iTr.iY - (height/2)), + TPoint( iCalibrationPoints.iTr.iX + (width/2), + iCalibrationPoints.iTr.iY + (height/2))); + break; + case 3: + width = iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iBr.iX - + iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iTl.iX; + height= iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iBr.iY - + iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iTl.iY; + + rect = TRect(TPoint( iCalibrationPoints.iBr.iX - (width/2), + iCalibrationPoints.iBr.iY - (height/2)), + TPoint( iCalibrationPoints.iBr.iX + (width/2), + iCalibrationPoints.iBr.iY + (height/2))); + break; + case 4: + width = iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iBr.iX - + iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iTl.iX; + height= iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iBr.iY - + iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iTl.iY; + + rect = TRect(TPoint( iCalibrationPoints.iBl.iX - (width/2), + iCalibrationPoints.iBl.iY - (height/2)), + TPoint( iCalibrationPoints.iBl.iX + (width/2), + iCalibrationPoints.iBl.iY + (height/2))); + break; + default: + break; + } + TRACES("CTouchScreenCalibAppUi::GetAnimImageRect(): End"); + return rect; + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::HandleResourceChange(...) +// --------------------------------------------------------------------------- +void CTouchScreenCalibAppUi::HandleScreenDeviceChangedL() + { + TRACES("CTouchScreenCalibAppUi::HandleResourceChange()"); + CAknAppUiBase::HandleScreenDeviceChangedL(); + + if (!iCalibrationDone && !iCalibrationCancel ) + { + TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): Restart calibration"); + iCalibrationPoints = CalibrationPoints(); + if (iTouchScreenCalibView) + { + RemoveFromStack( iTouchScreenCalibView ); + delete iTouchScreenCalibView; + iTouchScreenCalibView = NULL; + } + iTouchScreenCalibView = CTouchScreenCalibView::NewL( this ); + AddToStackL( iTouchScreenCalibView ); + ResetCalibrationStepsL(); + } + else + { + TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): Update ending background"); + iTouchScreenCalibView->DrawEndingBackground(); + } + TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::CalibrationPoints(); +// --------------------------------------------------------------------------- +TDigitizerCalibration CTouchScreenCalibAppUi::CalibrationPoints() + { + TRACES("CTouchScreenCalibAppUi::CalibrationPoints()"); + TDigitizerCalibration calibrationPoints; +#if defined(__WINS__) + // Dummy values for emulator for testing purposes + TRect rect = iAvkonAppUi->ApplicationRect(); + TRACES2("CTouchScreenCalibAppUi::CalibrationPoints(): Window resolution: (%d. %d)",rect.iBr.iX,rect.iBr.iY); + + calibrationPoints.iTl.iX = rect.iTl.iX+50; + calibrationPoints.iTl.iY = rect.iTl.iY+50; + calibrationPoints.iTr.iX = rect.iBr.iX-50; + calibrationPoints.iTr.iY = rect.iTl.iY+50; + calibrationPoints.iBr.iX = rect.iBr.iX-50; + calibrationPoints.iBr.iY = rect.iBr.iY-50; + calibrationPoints.iBl.iX = rect.iTl.iX+50; + calibrationPoints.iBl.iY = rect.iBr.iY-50; +#else + UserHal::CalibrationPoints(calibrationPoints); +#endif + + // Orientation in driver level could be different than window orientation. Convert + // points to correct orientation. + if (calibrationPoints.iBr.iX > calibrationPoints.iBr.iY ) + { + TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): Native orientation: landscape"); + iNativeOrientation = KLandscapeOrientation; + } + else + { + TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): Native orientation: portrait"); + iNativeOrientation = KPortraitOrientation; + } + calibrationPoints = ConvertToCorrectOrientation(calibrationPoints, KConvertGetCase); + + TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): End"); + return calibrationPoints; + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::ConvertToCorrectOrientation(TDigitizerCalibration aPoints); +// --------------------------------------------------------------------------- +TDigitizerCalibration CTouchScreenCalibAppUi::ConvertToCorrectOrientation(TDigitizerCalibration aPoints, + TInt aConvertCase) + { + TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation()"); + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iTl.iX,aPoints.iTl.iY); + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iTr.iX,aPoints.iTr.iY); + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iBr.iX,aPoints.iBr.iY); + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iBl.iX,aPoints.iBl.iY); + TDigitizerCalibration points; + TPoint destReso; + + TRect rect = iAvkonAppUi->ApplicationRect(); + + if (!IsCorrectOrientation(rect)) + { + TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Points are not for current layout."); + if (aConvertCase == KConvertGetCase) + { + destReso.iX = rect.iBr.iX; + destReso.iY = rect.iBr.iY; + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Destin reso: X:%d Y:%d", destReso.iX,destReso.iY); + points = ChangeOrientation(aPoints, destReso); + } + else + { + destReso.iX = rect.iBr.iY; + destReso.iY = rect.iBr.iX; + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Destin reso: X:%d Y:%d", destReso.iX,destReso.iY); + points = ChangeOrientation(aPoints, destReso); + } + } + else + { + points = aPoints; + } + + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iTl.iX,points.iTl.iY); + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iTr.iX,points.iTr.iY); + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iBr.iX,points.iBr.iY); + TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iBl.iX,points.iBl.iY); + + TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): End"); + return points; + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::IsCorrectOrientation(TRect aRect) +// --------------------------------------------------------------------------- +TBool CTouchScreenCalibAppUi::IsCorrectOrientation(TRect aRect) + { + TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation()"); + TBool ret(ETrue); + TBool nativePortrait(ETrue); + + if (iNativeOrientation == KLandscapeOrientation) + { + TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation(): Native orientation: landscape"); + nativePortrait = EFalse; + } + + TBool windowsPortrait(ETrue); + + if (aRect.iBr.iX > aRect.iBr.iY) + { + TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation(): Window orientation: landscape"); + windowsPortrait = EFalse; + } + else + { + windowsPortrait = ETrue; + } + + if (nativePortrait != windowsPortrait) + { + ret = EFalse; + } + + TRACES1("CTouchScreenCalibAppUi::IsCorrectOrientation(): End: returns %d",ret); + return ret; + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibAppUi::ChangeOrientation(TDigitizerCalibration aPoints); +// --------------------------------------------------------------------------- +TDigitizerCalibration CTouchScreenCalibAppUi::ChangeOrientation(TDigitizerCalibration aSourcePoints, + TPoint aDestReso) + { + TRACES("CTouchScreenCalibAppUi::ChangeOrientation()"); + TDigitizerCalibration destPoints; + + destPoints.iTl.iX = aSourcePoints.iTr.iY; + destPoints.iTl.iY = aDestReso.iY - aSourcePoints.iTr.iX; + destPoints.iTr.iX = aSourcePoints.iBr.iY; + destPoints.iTr.iY = aDestReso.iY - aSourcePoints.iBr.iX; + destPoints.iBr.iX = aSourcePoints.iBl.iY; + destPoints.iBr.iY = aDestReso.iY - aSourcePoints.iBl.iX; + destPoints.iBl.iX = aSourcePoints.iTl.iY; + destPoints.iBl.iY = aDestReso.iY - aSourcePoints.iTl.iX; + + + TRACES("CTouchScreenCalibAppUi::ChangeOrientation(): End"); + return destPoints; + } + +// --------------------------------------------------------- +// CTouchScreenCalibAppUi::FirstBoot() +// --------------------------------------------------------- +TBool CTouchScreenCalibAppUi::FirstBoot() + { + TRACES("CTouchScreenCalibAppUi::FirstBoot()"); + TInt value( 0 ); + + TRACES("CTouchScreenCalibAppUi::FirstBoot(): Read first boot info from Central Repository "); + CRepository* repository(NULL); + + TRAPD( err, repository = CRepository::NewL( KCRUidStartup ) ); + if ( err == KErrNone ) + { + err = repository->Get( KStartupFirstBoot, value ); + } + + delete repository; + + if (value) + { + TRACES("CTouchScreenCalibAppUi::FirstBoot(): End, return EFalse"); + return EFalse; + } + + else + { + TRACES("CTouchScreenCalibAppUi::FirstBoot(): End, return ETrue"); + return ETrue; + } + } + + +/* + * This funcntion is used to change the screen orientation to the + * same orientation with the factory given calibration data. But it + * is not used now. So just leave it here! + * */ + + +void CTouchScreenCalibAppUi::SetOrientation() + { +#ifndef __WINS__ + + TInt orientation = KUnknownOrientation; + TInt nativeOrientation = KUnknownOrientation; + TDigitizerCalibration Points; + UserHal::CalibrationPoints( Points ); + if ( Points.iBr.iX > Points.iBr.iY) + { + orientation = KLandscapeOrientation; + } + else + { + orientation = KPortraitOrientation; + } + TRect rect = iAvkonAppUi->ApplicationRect(); + if ( rect.iBr.iX > rect.iBr.iY ) + { + nativeOrientation = KLandscapeOrientation; + } + else + { + nativeOrientation = KPortraitOrientation; + } + + if (orientation != nativeOrientation ) + { + if ( orientation == KLandscapeOrientation ) + { + SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape ); + } + else + { + SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait ); + } + } +#endif + } +// End of file diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/src/TouchScreenCalibApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/src/TouchScreenCalibApplication.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* This module implements the application core i.e. application +* class and standard exported functions +* +*/ + + +// INCLUDE FILES +#include "TouchScreenCalibApplication.h" +#include "TouchScreenCalibDocument.h" + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CTouchScreenCalibApplication::AppDllUid() +// Returns application UID +// --------------------------------------------------------------------------- +TUid CTouchScreenCalibApplication::AppDllUid() const + { + return KUidTouchScreenCalib; + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibApplication::CreateDocumentL() +// Creates CTouchScreenCalibDocument object +// +// --------------------------------------------------------------------------- +CApaDocument* CTouchScreenCalibApplication::CreateDocumentL() + { + return CTouchScreenCalibDocument::NewL(*this); + } + +// ===================== OTHER EXPORTED FUNCTIONS ============================ +#include + +LOCAL_C CApaApplication* NewApplication() + { + return new CTouchScreenCalibApplication; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + +// End of file diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/src/TouchScreenCalibDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/src/TouchScreenCalibDocument.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,73 @@ +/* +* 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: Document class of the application. +* +*/ + + +// SYSTEM INCLUDES +#include + +// USER INCLUDES +#include "TouchScreenCalibDocument.h" +#include "TouchScreenCalibAppUi.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CTouchScreenCalibDocument::~CTouchScreenCalibDocument() +// --------------------------------------------------------- +CTouchScreenCalibDocument::~CTouchScreenCalibDocument() + { + } + +// --------------------------------------------------------- +// CTouchScreenCalibDocument::ConstructL() +// --------------------------------------------------------- +void CTouchScreenCalibDocument::ConstructL() + { + } + +// --------------------------------------------------------- +// CTouchScreenCalibDocument::NewL() +// --------------------------------------------------------- +CTouchScreenCalibDocument* CTouchScreenCalibDocument::NewL( + CEikApplication& aApp) // CTouchScreenCalibApp reference + { + CTouchScreenCalibDocument* self = new (ELeave) CTouchScreenCalibDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------- +// CTouchScreenCalibDocument::CreateAppUiL() +// ---------------------------------------------------- +CEikAppUi* CTouchScreenCalibDocument::CreateAppUiL() + { + return new(ELeave) CTouchScreenCalibAppUi; + } + +// ---------------------------------------------------- +// CTouchScreenCalibDocument::UpdateTaskNameL() +// Makes TouchScreenCalib-application hidden in menu shell and fastswap window +// ---------------------------------------------------- +void CTouchScreenCalibDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName ) + { + CEikDocument::UpdateTaskNameL( aWgName ); + aWgName->SetHidden( ETrue ); + } + +// End of file diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/src/TouchScreenCalibPubSubObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/src/TouchScreenCalibPubSubObserver.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,131 @@ +/* +* 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: +* This class the handles the received indications from the Public and +* Subscribe. +* +*/ + + +// SYSTEM INCLUDES +#include +#include + +// USER INCLUDES +#include "TouchScreenCalibPubSubObserver.h" +#include "TouchScreenCalibPubSubObserver.h" +#include "TouchScreenCalibSubscriber.h" +#include "TouchScreenCalibDefines.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------- +// CTouchScreenCalibPubSubObserver::CTouchScreenCalibPubSubObserver( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------- +CTouchScreenCalibPubSubObserver::CTouchScreenCalibPubSubObserver( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) : + iTouchScreenCalibAppUi( aTouchScreenCalibAppUi ) + { + } + +// ---------------------------------------------------- +// CTouchScreenCalibPubSubObserver::ConstructL() +// ---------------------------------------------------- +void CTouchScreenCalibPubSubObserver::ConstructL() + { + TRACES("CTouchScreenCalibPubSubObserver::ConstructL()"); + + iGlobalSWStateSubscriber = CTouchScreenCalibSubscriber::NewL( *this, + KPSUidStartup, + KPSGlobalSystemState ); + iGlobalSWStateSubscriber->Subscribe(); + + iTsyCallState = CTouchScreenCalibSubscriber::NewL( *this, + KPSUidCtsyCallInformation, + KCTsyCallState ); + iTsyCallState->Subscribe(); + + TRACES("CTouchScreenCalibPubSubObserver::ConstructL(): End"); + } + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibPubSubObserver::HandlePropertyChangedL() +// ---------------------------------------------------------------------------- +void CTouchScreenCalibPubSubObserver::HandlePropertyChangedL( const TUid& aCategory, TUint aKey ) + { + TRACES("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL()"); + TRACES1("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL(): aKey: %d",aKey ); + + if (aCategory == KPSUidStartup && aKey == KPSGlobalSystemState) + { + TInt eventState; + User::LeaveIfError( RProperty::Get ( KPSUidStartup, KPSGlobalSystemState, eventState ) ); + + if( eventState == ESwStateCriticalPhaseOK || + eventState == ESwStateEmergencyCallsOnly || + eventState == ESwStateNormalRfOn || + eventState == ESwStateNormalRfOff || + eventState == ESwStateNormalBTSap ) + { + TRACES("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL(): Critical startup phase ready"); + iTouchScreenCalibAppUi->PrepareToExit(); + } + } + else if (aCategory == KPSUidCtsyCallInformation && aKey == KCTsyCallState) + { + TInt eventState; + User::LeaveIfError( RProperty::Get ( KPSUidCtsyCallInformation, KCTsyCallState, eventState ) ); + + if( eventState == EPSCTsyCallStateRinging || + eventState == EPSCTsyCallStateDisconnecting) + { + TRACES("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL(): Call detected"); + iTouchScreenCalibAppUi->PrepareToExit(); + } + } + TRACES("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL(): End"); + } + +// ---------------------------------------------------- +// CTouchScreenCalibPubSubObserver* CTouchScreenCalibPubSubObserver::NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) +// ---------------------------------------------------- +CTouchScreenCalibPubSubObserver* CTouchScreenCalibPubSubObserver::NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) + { + TRACES("CTouchScreenCalibPubSubObserver::NewL()"); + CTouchScreenCalibPubSubObserver* self = new (ELeave) CTouchScreenCalibPubSubObserver( aTouchScreenCalibAppUi ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + + TRACES("CTouchScreenCalibPubSubObserver::NewL(): End"); + return self; + } + +// ---------------------------------------------------- +// CTouchScreenCalibPubSubObserver::~CTouchScreenCalibPubSubObserver() +// ---------------------------------------------------- +CTouchScreenCalibPubSubObserver::~CTouchScreenCalibPubSubObserver() + { + TRACES("CTouchScreenCalibPubSubObserver::~CTouchScreenCalibPubSubObserver()"); + + delete iGlobalSWStateSubscriber; + delete iTsyCallState; + iProperty.Close(); + + TRACES("CTouchScreenCalibPubSubObserver::~CTouchScreenCalibPubSubObserver(): End"); + } + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/src/TouchScreenCalibSubscriber.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/src/TouchScreenCalibSubscriber.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,120 @@ +/* +* 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: CTouchScreenCalibSubscriber implementation. + * +*/ + + +// INCLUDES +#include +#include "TouchScreenCalibAppUi.h" +#include "TouchScreenCalibSubscriber.h" +#include "TouchScreenCalibDefines.h" + +// CONSTANTS + +// ============================= MEMBER FUNCTIONS ============================= + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibSubscriber::NewL() +// ---------------------------------------------------------------------------- +CTouchScreenCalibSubscriber* CTouchScreenCalibSubscriber::NewL( + MTouchScreenCalibPropertyResponder& aTouchScreenCalibPropertyResponder, + const TUid& aCategory, + TUint aKey ) + { + CTouchScreenCalibSubscriber* self = new (ELeave) CTouchScreenCalibSubscriber( aTouchScreenCalibPropertyResponder, + aCategory, + aKey ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); //self + return self; + } + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibSubscriber::ConstructL() +// ---------------------------------------------------------------------------- +void CTouchScreenCalibSubscriber::ConstructL() + { + CActiveScheduler::Add( this ); + iProperty.Attach( iCategory, iKey ); + } + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibSubscriber::Subscribe() +// ---------------------------------------------------------------------------- +void CTouchScreenCalibSubscriber::Subscribe() + { + TRACES("CTouchScreenCalibSubscriber::Subscribe()"); + iProperty.Subscribe( iStatus ); + SetActive(); + TRACES("CTouchScreenCalibSubscriber::Subscribe(): End"); + } + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibSubscriber::CTouchScreenCalibSubscriber() +// ---------------------------------------------------------------------------- +CTouchScreenCalibSubscriber::CTouchScreenCalibSubscriber( MTouchScreenCalibPropertyResponder& aTouchScreenCalibPropertyResponder, + const TUid& aCategory, + TUint aKey ) : + CActive( EPriorityStandard ), + iTouchScreenCalibPropertyResponder( aTouchScreenCalibPropertyResponder ), + iCategory( aCategory), + iKey( aKey ) + { + } + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibSubscriber::RunL() +// ---------------------------------------------------------------------------- +void CTouchScreenCalibSubscriber::RunL() + { + TRACES("CTouchScreenCalibSubscriber::RunL()"); + Subscribe(); + iTouchScreenCalibPropertyResponder.HandlePropertyChangedL( iCategory, iKey ); + TRACES("CTouchScreenCalibSubscriber::RunL(): End"); + } + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibSubscriber::DoCancel() +// ---------------------------------------------------------------------------- +void CTouchScreenCalibSubscriber::DoCancel() + { + iProperty.Cancel(); + } + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibSubscriber::RunError() +// ---------------------------------------------------------------------------- +TInt CTouchScreenCalibSubscriber::RunError( TInt aError ) + { + return aError; + } + +// ---------------------------------------------------------------------------- +// CTouchScreenCalibSubscriber::~CTouchScreenCalibSubscriber() +// ---------------------------------------------------------------------------- +CTouchScreenCalibSubscriber::~CTouchScreenCalibSubscriber() + { + TRACES("CTouchScreenCalibSubscriber::~CTouchScreenCalibSubscriber()"); + Cancel(); + iProperty.Close(); + TRACES("CTouchScreenCalibSubscriber::~CTouchScreenCalibSubscriber(): End"); + } + +// End of File + + + diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/src/TouchScreenCalibView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/src/TouchScreenCalibView.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,569 @@ +/* +* 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: +* This class is the container class of the CTouchScreenCalibView. +* Is used to show tap target animation. +* +*/ + + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// USER INCLUDES +#include "TouchScreenCalibView.h" +#include "TouchScreenCalibDefines.h" +#include "TouchScreenCalibAppUi.h" + +// CONSTANTS +_LIT( KTargetAnimationResource, "z:TouchScreenCalib_anim.rsc" ); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::ConstructL() +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::ConstructL() + { + TRACES("CTouchScreenCalibView::ConstructL()"); + + CreateWindowL(); + + iAnimImageRect.iAnimImageRect1 = iTouchScreenCalibAppUi->GetAnimImageRect(1); + iAnimImageRect.iAnimImageRect2 = iTouchScreenCalibAppUi->GetAnimImageRect(2); + iAnimImageRect.iAnimImageRect3 = iTouchScreenCalibAppUi->GetAnimImageRect(3); + iAnimImageRect.iAnimImageRect4 = iTouchScreenCalibAppUi->GetAnimImageRect(4); + + // Parse filename of bitmaps + _LIT( KDirAndFile, "z:TouchScreenCalib.mif" ); + TParse* fp1 = new(ELeave) TParse(); + fp1->Set(KDirAndFile, &KDC_APP_BITMAP_DIR, NULL); + TFileName fileName( fp1->FullName() ); + TRACES1("CTouchScreenCalibImage::CreateIconL(): Image: %S", &(fp1->FullName()) ); + delete fp1; + + AknIconUtils::CreateIconL( iBitmap, + iBitmapMask, + fileName, + EMbmTouchscreencalibQgn_graf_screencalib, + EMbmTouchscreencalibQgn_graf_screencalib_mask); + + iAvkonAppUi->StatusPane()->MakeVisible(EFalse); + + TRACES("CTouchScreenCalibView::ConstructL(): Animation loading started"); + iAnim = CAknBitmapAnimation::NewL(); + iAnim->SetContainerWindowL( *this ); + iAnim->SetScaleModeForAnimationFrames(EAspectRatioPreservedAndUnusedSpaceRemoved); + TResourceReader rr; + RConeResourceLoader loader( *iCoeEnv ); + + TParse* fp = new(ELeave) TParse(); + fp->Set(KTargetAnimationResource, &KDC_APP_RESOURCE_DIR, NULL); + TRACES1("CTouchScreenCalibView::ConstructL(): Animated target resource path: %S", &fp->FullName()); + TFileName name( fp->FullName() ); + delete fp; + TInt fileError = loader.Open( name ); + if ( fileError == KErrNone ) + { + CleanupClosePushL( loader ); + iCoeEnv->CreateResourceReaderLC(rr, R_SHUTDOWN_ANIM); + TRAPD(err, iAnim->ConstructFromResourceL( rr )); + if( err == KErrNone ) + { + TResourceReader timeReader; + iCoeEnv->CreateResourceReaderLC(timeReader, R_ANIM_DURATION); + CleanupStack::PopAndDestroy(); // pop timeReader + iAnim->SetPosition(TPoint(0,0)); + iAnim->SetSize(TSize(0,0)); + TRACES("CTouchScreenCalibView::ConstructL(): animation succesfully loaded"); + } + else + { + TRACES("CTouchScreenCalibView::ConstructL(): animation loading failed"); + } + CleanupStack::PopAndDestroy(); //pop rr + TRACES("CTouchScreenCalibView::ConstructL(): animation loading ended"); + CleanupStack::PopAndDestroy(); //pop loader + } + else + { + TRACES("CTouchScreenCalibView::ConstructL(): resource file loading failed"); + } + + SetRect(iAvkonAppUi->ApplicationRect()); + ActivateL(); + + iFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont); + iText = new( ELeave ) CArrayPtrFlat( 20 ); + + TApaTask self(iCoeEnv->WsSession()); + self.SetWgId(iCoeEnv->RootWin().Identifier()); + self.BringToForeground(); + + if (iTouchScreenCalibAppUi->FirstBoot()) + { + Window().SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + 10000 ); + } + else + { + Window().SetOrdinalPosition( 0, ECoeWinPriorityHigh + 1 ); + } + iTouchFeedback = MTouchFeedback::Instance(); + + TRACES("CTouchScreenCalibView::ConstructL(): ConstructL ended"); + } + +// ----------------------------------------------------------------------------- +// CTouchScreenCalibView::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTouchScreenCalibView* CTouchScreenCalibView::NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) + { + TRACES("CTouchScreenCalibView::NewL()"); + CTouchScreenCalibView* self = new (ELeave) CTouchScreenCalibView( aTouchScreenCalibAppUi ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// CTouchScreenCalibView::CTouchScreenCalibView() +// --------------------------------------------------------- +CTouchScreenCalibView::CTouchScreenCalibView( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) : + iTouchScreenCalibAppUi( aTouchScreenCalibAppUi ), + iAnimationShowing( EFalse ), + iAnimationCancelled ( EFalse ), + iText( NULL ), + iCalibrationCompleted( EFalse ) + { + TRACES("CTouchScreenCalibView::CTouchScreenCalibView()"); + TRACES("CTouchScreenCalibView::CTouchScreenCalibView(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::UpdateL( TAknLayoutText aTextLayout ) +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::UpdateL( TAknLayoutText aTextLayout ) + { + TRACES("CTouchScreenCalibView::UpdateL()"); + + TRect rect = iTouchScreenCalibAppUi->GetAnimImageRect(); + + SetTextL(aTextLayout); + EndAnimation(); + DrawDeferred(); + + TPoint pos = TPoint(rect.iTl.iX, rect.iTl.iY); + TSize size = TSize(rect.iBr.iX-rect.iTl.iX, rect.iBr.iY-rect.iTl.iY); + iAnim->SetPosition(pos); + iAnim->SetSize(size); + + TRAPD(err, iAnim->StartAnimationL()); + if ( err != KErrNone ) + { + TRACES("CTouchScreenCalibView::UpdateL(): Starting animation failed"); + } + + TRACES("CTouchScreenCalibView::UpdateL(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::DrawEndingBackground() +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::DrawEndingBackground() + { + TRACES("CTouchScreenCalibView::DrawEndingBackground()"); + iCalibrationCompleted = ETrue; + SetRect( iAvkonAppUi->ApplicationRect() ); + EndAnimation(); + DrawNow(); + TRACES("CTouchScreenCalibView::DrawEndingBackground(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::EndTargetAnimation() +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::EndTargetAnimation() + { + TRACES("CTouchScreenCalibView::EndTargetAnimation()"); + EndAnimation(); + DrawNow(); + TRACES("CTouchScreenCalibView::EndTargetAnimation(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::~CTouchScreenCalibView() +// --------------------------------------------------------------------------- +CTouchScreenCalibView::~CTouchScreenCalibView() + { + TRACES("CTouchScreenCalibView::~CTouchScreenCalibView() begin"); + + if( iAnim ) + { + if( iAnimationShowing ) + { + iAnim->CancelAnimation(); + TRACES("CTouchScreenCalibView::~CTouchScreenCalibView() animation cancelled"); + } + } + delete iAnim; + TRACES("CTouchScreenCalibView::~CTouchScreenCalibView() iAnim deleted"); + + if ( iText ) + { + iText->ResetAndDestroy(); + delete iText; + iText = NULL; + } + + delete iBitmap; + delete iBitmapMask; + + TRACES("CTouchScreenCalibView::~CTouchScreenCalibView() end"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::ComponentControl(TInt aIndex) +// --------------------------------------------------------------------------- +CCoeControl* CTouchScreenCalibView::ComponentControl(TInt aIndex) const + { + switch ( aIndex ) + { + case 0: + { + return iAnim; + } + default: + { + return NULL; + } + } + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::CountComponentControls() +// --------------------------------------------------------------------------- +TInt CTouchScreenCalibView::CountComponentControls() const + { + return iAnim ? 1 : 0; // return nbr of controls inside this container + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::Draw(const TRect& aRect) const +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::Draw(const TRect& ) const + { + TRACES("CTouchScreenCalibView::Draw()"); + DrawBackground(); + if (!iCalibrationCompleted) + { + DrawText(); + ShowImage(iAnimImageRect.iAnimImageRect1); + ShowImage(iAnimImageRect.iAnimImageRect2); + ShowImage(iAnimImageRect.iAnimImageRect3); + ShowImage(iAnimImageRect.iAnimImageRect4); + } + TRACES("CTouchScreenCalibView::Draw(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::SizeChanged() +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::SizeChanged() + { + if( iAnim ) + { + iAnim->SetRect(Rect()); + } + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::EndAnimation() +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::EndAnimation() + { + TRACES("CTouchScreenCalibView::EndAnimation()"); + iAnim->CancelAnimation(); + TRACES("CTouchScreenCalibView::EndAnimation(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::HandleControlEventL(...) +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::HandleControlEventL( + CCoeControl* , + TCoeEvent ) + { + //pure virtual from MCoeControlObserver + TRACES("CTouchScreenCalibView::HandleControlEventL()"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::OfferKeyEventL(...) +// --------------------------------------------------------------------------- +TKeyResponse CTouchScreenCalibView::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType) + { + TRACES("CTouchScreenCalibView::OfferKeyEventL()"); + iTouchScreenCalibAppUi->HandleKeyL( aKeyEvent, aType ); + TRACES("CTouchScreenCalibView::OfferKeyEventL(): End: return EKeyWasConsumed"); + return EKeyWasConsumed; + } + +// ---------------------------------------------------- +// CTouchScreenCalibView::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) +// ---------------------------------------------------- +TKeyResponse CTouchScreenCalibView::HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TRACES("CTouchScreenCalibView::HandleKeyEventL()"); + iTouchScreenCalibAppUi->HandleKeyL( aKeyEvent, aType ); + TRACES("CTouchScreenCalibView::HandleKeyEventL(): End: return EKeyWasConsumed"); + return EKeyWasConsumed; + } + +// ---------------------------------------------------- +// CTouchScreenCalibView::HandlePointerEventL(const TPointerEvent& aPointerEvent) +// ---------------------------------------------------- +void CTouchScreenCalibView::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + TRACES("CTouchScreenCalibView::HandlePointerEventL()"); + if (aPointerEvent.iType == TPointerEvent::EButton1Up) + { + TRACES("CTouchScreenCalibView::HandlePointerEventL(): EButton1Up"); + TRACES1("CTouchScreenCalibView::HandlePointerEventL(): X = %d",aPointerEvent.iPosition.iX); + TRACES1("CTouchScreenCalibView::HandlePointerEventL(): Y = %d",aPointerEvent.iPosition.iY); + + TPoint pos; + + pos.iX = aPointerEvent.iPosition.iX; + pos.iY = aPointerEvent.iPosition.iY; + if (Validate(pos)) + { + iTouchFeedback->InstantFeedback( ETouchFeedbackBasic ); + iTouchScreenCalibAppUi->HandlePointerL( pos ); + } + } + TRACES("CTouchScreenCalibView::HandlePointerEventL(): End --------------- Waiting for next event -------------"); + } + +// ---------------------------------------------------- +// CTouchScreenCalibView::Validate(TPoint aPos) +// ---------------------------------------------------- +TBool CTouchScreenCalibView::Validate(TPoint aPos) + { + TRACES("CTouchScreenCalibView::Validate()"); + TInt retval( EFalse ); + + if ((aPos.iX > iTouchScreenCalibAppUi->GetAnimImageRect().iTl.iX) && + (aPos.iX < iTouchScreenCalibAppUi->GetAnimImageRect().iBr.iX) && + (aPos.iY > iTouchScreenCalibAppUi->GetAnimImageRect().iTl.iY) && + (aPos.iY < iTouchScreenCalibAppUi->GetAnimImageRect().iBr.iY)) + { + retval = ETrue; + } + TRACES1("CTouchScreenCalibView::Validate(): End: Return %d",retval); + return retval; + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::DrawBackground() const +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::DrawBackground() const + { + TRACES("CTouchScreenCalibView::DrawBackground()"); + CWindowGc& gc = SystemGc(); + TRect rect = iAvkonAppUi->ApplicationRect(); + gc.SetPenStyle(CGraphicsContext::ENullPen); + gc.SetBrushColor(KRgbWhite); + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + gc.DrawRect(rect); + ControlEnv()->WsSession().Flush(); // force draw of the context + TRACES("CTouchScreenCalibView::DrawBackground(): End"); + } + +// --------------------------------------------------------------------------- +// CTouchScreenCalibView::DrawText() +// --------------------------------------------------------------------------- +void CTouchScreenCalibView::DrawText() const + { + TRACES("CTouchScreenCalibView::DrawText()"); + + CWindowGc& gc = SystemGc(); + + gc.SetPenStyle(CGraphicsContext::ENullPen); + + gc.UseFont( iFont ); + + gc.SetBrushStyle(CGraphicsContext::ENullBrush); + + TPoint position( 0, 0 ); + TPoint topLeft; + position = iTextTopLeft; + + for ( TInt index = 0 ; + index < iText->Count(); + index++, position.iY += iTextBaselineOffset ) + { + HBufC* text = (*iText)[ index ]; + if ( text ) + { + topLeft = TPoint( position.iX, position.iY - iTextBaselineOffset ); + gc.SetPenColor(iTextColor); + TRACES2("CTouchScreenCalibView::DrawText(): TopLeft: %d, %d", topLeft.iX, topLeft.iY); + gc.DrawText( *text, + TRect( topLeft, iTextSize ), + iTextBaselineOffset, + iTextAlignment ); + } + } + ControlEnv()->WsSession().Flush(); // force draw of the context + gc.DiscardFont(); + TRACES("CTouchScreenCalibView::DrawText(): End"); + } + +// ----------------------------------------------------------------------------- +// CTouchScreenCalibView::SetTextL(TAknLayoutText aTextLayout) +// ----------------------------------------------------------------------------- +void CTouchScreenCalibView::SetTextL(TAknLayoutText aTextLayout) + { + TRACES("CTouchScreenCalibView::SetTextL()"); + + TInt textLineWidth; + + TRACES2("CTouchScreenCalibView::SetTextL(): Text rect top: X:%d Y:%d",aTextLayout.TextRect().iTl.iX, aTextLayout.TextRect().iTl.iY); + TRACES2("CTouchScreenCalibView::SetTextL(): Text rect:bot: X:%d Y:%d",aTextLayout.TextRect().iBr.iX, aTextLayout.TextRect().iBr.iY); + + textLineWidth = aTextLayout.TextRect().Width(); + + iTextTopLeft = TPoint(aTextLayout.TextRect().iTl.iX, aTextLayout.TextRect().iTl.iY); + + iTextBaselineOffset = iFont->HeightInPixels() * 4 / 3; + + iTextSize = TSize(textLineWidth, iTextBaselineOffset + iFont->DescentInPixels()); + + iTextColor = aTextLayout.Color(); + + iTextAlignment = CGraphicsContext::ECenter; + + HBufC* mainText1 = StringLoader::LoadLC(R_QTN_TOUCH_SCREEN_CALI_INSTR_GEN, + iTouchScreenCalibAppUi->GetCalibrationStep()); + + HBufC* mainText2; + if (iTouchScreenCalibAppUi->FirstBoot()) + { + mainText2 = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_INSTR_RES ); + } + else + { + mainText2 = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_INSTR_CAN ); + } + + TBuf<256> text; + text.Copy( mainText1->Des() ); + _LIT(KLineChange, "\n"); + text.Append(KLineChange); + text.Append(mainText2->Des()); + + TRACES1("CTouchScreenCalibView::SetTextL(): text: %S",&text); + + CArrayFix* wrappedArray = + new( ELeave ) CArrayFixFlat( 10 ); + CleanupStack::PushL( wrappedArray ); + + HBufC* dataToDestroy = + AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( + text, textLineWidth, *iFont, *wrappedArray + ); + + TInt numLines( wrappedArray->Count() ); + TRACES1("CTouchScreenCalibView::SetTextL(): Number of lines: %d",numLines ); + + if ( iText ) + { + iText->ResetAndDestroy(); + delete iText; + iText = NULL; + } + iText = new( ELeave ) CArrayPtrFlat( 20 ); + + for ( TInt i = 0 ; i < numLines ; i++ ) + { + HBufC* line = (*wrappedArray)[i].AllocLC(); + TInt lineLength = line->Length(); + TRACES1("CTouchScreenCalibView::SetTextL(): lineLength: %d",lineLength); + if(!lineLength) + { + iText->AppendL( NULL ); + CleanupStack::PopAndDestroy(line); // line + } + else + { + iText->AppendL( line ); + CleanupStack::Pop(line); // line + } + } + iText->AppendL( NULL ); + + // If the last char was newline, add one extra, since + // wrapping automatically removes it. + if ( text[ text.Length() - 1 ] == '\n' ) + { + iText->AppendL( NULL ); + } + + CleanupStack::PopAndDestroy(wrappedArray); // wrappedArray + delete dataToDestroy; + + CleanupStack::PopAndDestroy(2); //mainText1, mainText2 + TRACES("CTouchScreenCalibView::SetTextL(); End"); + } + +// ----------------------------------------------------------------------------- +// CTouchScreenCalibView::ShowImage(TRect aRect) +// ----------------------------------------------------------------------------- +void CTouchScreenCalibView::ShowImage(TRect aRect) const + { + TRACES("CTouchScreenCalibView::ShowImage()"); + CWindowGc& gc = SystemGc(); + AknIconUtils::SetSize( iBitmap, aRect.Size(), EAspectRatioPreservedAndUnusedSpaceRemoved ); + gc.SetPenStyle(CGraphicsContext::ENullPen); + gc.SetBrushColor(KRgbRed); + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + gc.DrawRect(aRect); + gc.BitBlt( TPoint(aRect.iTl.iX, aRect.iTl.iY), iBitmap ); // CWindowGc member function + ControlEnv()->WsSession().Flush(); // force draw of the context + TRACES("CTouchScreenCalibView::ShowImage(): End"); + } + +// ----------------------------------------------------------------------------- +// CTouchScreenCalibView::SetWinPriority() +// ----------------------------------------------------------------------------- +void CTouchScreenCalibView::SetWinPriority(TInt aPriority) + { + TRACES("CTouchScreenCalibView::SetWinPriority()"); + Window().SetOrdinalPosition( 0, aPriority ); + TRACES("CTouchScreenCalibView::SetWinPriority(): End"); + } + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/bwins/tsccustcmdsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/bwins/tsccustcmdsu.def Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CmdTSCStartupExtensionNewL@TSCCustCmdFactory@@SAPAVMSsmCustomCommand@@XZ @ 1 NONAME ; class MSsmCustomCommand * TSCCustCmdFactory::CmdTSCStartupExtensionNewL(void) + diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/eabi/tsccustcmdsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/eabi/tsccustcmdsu.def Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _ZN17TSCCustCmdFactory26CmdTSCStartupExtensionNewLEv @ 1 NONAME + _ZTI14CTSCSubscriber @ 2 NONAME ; ## + _ZTI18CTSCPubSubObserver @ 3 NONAME ; ## + _ZTV14CTSCSubscriber @ 4 NONAME ; ## + _ZTV18CTSCPubSubObserver @ 5 NONAME ; ## + diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/group/tsccustcmds.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/group/tsccustcmds.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,40 @@ +/* +* 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: Project definition file for project TSCCustCmd +* +*/ + +#include + +TARGET tsccustcmds.dll +TARGETTYPE DLL +UID 0x1000008D 0x10283123 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tscstartupextension.cpp +SOURCE tsccustcmdfactory.cpp +SOURCE tscsubscriber.cpp +SOURCE tscpubsubobserver.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + + +// Default system include paths for middleware layer modules. +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/inc/MTSCPropertyResponder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/inc/MTSCPropertyResponder.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,31 @@ +/* +* 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: Interface of Touch screen calibration property change obsever +* +*/ + +#ifndef MTSCPROPERTYRESPONDER_H +#define MTSCPROPERTYRESPONDER_H + +// INCLUDES +#include + +class MTSCPropertyResponder + { +public: + virtual void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ) = 0; + }; +#endif //MTSCPROPERTYRESPONDER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/inc/TSCPubSubObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/inc/TSCPubSubObserver.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,76 @@ +/* +* 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: +* This class the handles the received indications from the Public and +* Subscribe. +* +*/ + +#ifndef TSCPUBSUBOBSERVER_H +#define TSCPUBSUBOBSERVER_H + +// INCLUDES +#include +#include "MTSCPropertyResponder.h" +#include "tscstartupextension.h" + + + +// CLASS DECLARATION +class CTSCStartupExtension; +class CTSCSubscriber; + +class CTSCPubSubObserver : public CBase, public MTSCPropertyResponder + { + public: // Constructors and destructor + + /** + * C++ constructor. + */ + CTSCPubSubObserver( CTSCStartupExtension* aTSCStartupExtension ); + + /** + * Two-phased constructor. + */ + static CTSCPubSubObserver* NewL( CTSCStartupExtension* aTSCStartupExtension ); + + /** + * Destructor. + */ + ~CTSCPubSubObserver(); + + private: + + /** + * By default EPOC constructor is private. + */ + void ConstructL(); + + CTSCPubSubObserver(); + + protected: // From MTSCPropertyResponder + + void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ); + + private: // Data + //reference to application class + CTSCStartupExtension * iTSCStartupExtension; //uses + + RProperty iProperty; + CTSCSubscriber* iTSCSyncSubscriber; + }; + +#endif // TSCPUBSUBOBSERVER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/inc/tsccustcmdfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/inc/tsccustcmdfactory.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,35 @@ +/* +* 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: Custom command implementation factory. +* +*/ + +#ifndef TSCCUSTCMDFACTORY_H +#define TSCCUSTCMDFACTORY_H + +#include + +class MSsmCustomCommand; + +/** +* Creates custom command objects. +*/ +class TSCCustCmdFactory + { +public: + + IMPORT_C static MSsmCustomCommand* CmdTSCStartupExtensionNewL(); + }; + +#endif // TSCCUSTCMDFACTORY_H diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/inc/tscstartupextension.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/inc/tscstartupextension.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,64 @@ +/* +* 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: Declaration of CTSCStartupExtension class. +* +*/ + +#ifndef TSCSTARTUPEXTENSION_H +#define TSCSTARTUPEXTENSION_H + +#include +#include + +// FORWARD DECLARATIONS +class CTSCPubSubObserver; + +/** +*/ +NONSHARABLE_CLASS( CTSCStartupExtension ) + : public CBase, + public MSsmCustomCommand + { +public: + + static CTSCStartupExtension * NewL(); + virtual ~CTSCStartupExtension (); + + void CalibrationDone(); + +private: // From MSsmCustomCommand + + TInt Initialize( CSsmCustomCommandEnv* aCmdEnv ); + void Execute( const TDesC8& aParams, TRequestStatus& aStatus ); + void ExecuteCancel(); + void Release(); + void Close(); + +private: + + /** + * First phase constructor. + */ + CTSCStartupExtension (); + +private: //data + + CTSCPubSubObserver* iTSCPubSubObserver; //owns + + TRequestStatus* iStatus; + TBool iRequestSent; + + }; + +#endif // TSCSTARTUPEXTENSION_H diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/inc/tscstartupextensiondef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/inc/tscstartupextensiondef.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,45 @@ +/* +* 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: Includes some common defines used in the TSCStartupExtension +* +*/ + +#ifndef TSCSTARTUPEXTENSIONDEF_H +#define TSCSTARTUPEXTENSIONDEF_H + +#include + +//CONSTANTS +_LIT( KTouchScreenCalibAppName, "TSCStartupExtension" ); + +// MACROS + +#define PANIC(aPanic) User::Panic( KTouchScreenCalibAppName, aPanic ) + +#define TRACE_ADDPREFIX(aText) (TPtrC((const TText *)L"TSCStartupExtension: \"" L##aText L"\"")) + +#ifdef _DEBUG +#define TRACES(aMsg) RDebug::Print( TRACE_ADDPREFIX(aMsg) ) +#define TRACES1(aFormat,aP1) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1) ) +#define TRACES2(aFormat,aP1,aP2) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2) ) +#define TRACES3(aFormat,aP1,aP2,aP3) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2),(aP3) ) +#else +#define TRACES(aMsg) +#define TRACES1(aFormat,aP1) +#define TRACES2(aFormat,aP1,aP2) +#define TRACES3(aFormat,aP1,aP2,aP3) +#endif +#endif // TSCSTARTUPEXTENSIONDEF_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/inc/tscsubscriber.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/inc/tscsubscriber.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,91 @@ +/* +* 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: TSC Subscriber (Publish & Subscribe). +* +*/ + +#ifndef TSCPLUGINSUBSCRIBER_H +#define TSCPLUGINSUBSCRIBER_H + +// INCLUDES +#include +#include +#include "MTSCPropertyResponder.h" + +// CLASS DECLARATION +/** +* CTSCSubscriber +* +* @lib tscstartupextensionplugin +* @since 3.2 +*/ + +class CTSCSubscriber : public CActive +{ +public: + /** + * Two-phased constructor. + */ + static CTSCSubscriber* NewL( MTSCPropertyResponder& aTSCPropertyResponder, + const TUid& aCategory, + TUint aKey ); + + /** + * Destructor. + */ + ~CTSCSubscriber(); + + void Subscribe(); + +private: + CTSCSubscriber( MTSCPropertyResponder& aTSCPropertyResponder, + const TUid& aCategory, TUint + aKey ); + void ConstructL(); + +public: // from CActive + /** + * @param none + * @return none + */ + void RunL(); + + /** + * @param aError the error returned + * @return error + */ + TInt RunError( TInt aError ); + + /** + * @param none + * @return none + */ + void DoCancel(); + +private: // Methods not implemented + CTSCSubscriber( const CTSCSubscriber& ); // Copy constructor + CTSCSubscriber& operator=( const CTSCSubscriber& );// Assigment operator + +private: + + MTSCPropertyResponder& iTSCPropertyResponder; + RProperty iProperty; + TUid iCategory; + TUint iKey; +}; + + +#endif // TSCSUBSCRIBER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/src/tsccustcmdfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/src/tsccustcmdfactory.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,26 @@ +/* +* 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: Custom command implementation factory. +* +*/ + +#include "tsccustcmdfactory.h" +#include "tscstartupextension.h" + +// ======== MEMBER FUNCTIONS ======== + +EXPORT_C MSsmCustomCommand* TSCCustCmdFactory::CmdTSCStartupExtensionNewL() + { + return CTSCStartupExtension::NewL(); + } diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/src/tscpubsubobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/src/tscpubsubobserver.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,131 @@ +/* +* 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: +* This class the handles the received indications from the Public and +* Subscribe. +* +*/ + +// SYSTEM INCLUDES +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION +#include +#include +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION +#include +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + +// USER INCLUDES +#include "TSCPubSubObserver.h" +#include "tscsubscriber.h" +#include "tscstartupextensiondef.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------- +// CTSCPubSubObserver::CTSCPubSubObserver( CTSCStartupExtension* aTSCStartupExtension ) +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------- +CTSCPubSubObserver::CTSCPubSubObserver( CTSCStartupExtension* aTSCStartupExtension ) : + iTSCStartupExtension( aTSCStartupExtension ) + { + } + +// ---------------------------------------------------- +// CTSCPubSubObserver::ConstructL() +// ---------------------------------------------------- +void CTSCPubSubObserver::ConstructL() + { + TRACES("CTSCPubSubObserver::ConstructL()"); + + iTSCSyncSubscriber = CTSCSubscriber::NewL( *this, +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION + KPSUidTouchScreenCalibration, +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION + KPSUidStartup, +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + KPSTouchScreenCalibration ); + iTSCSyncSubscriber->Subscribe(); + + TInt touchScreenCalibrationState; +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, touchScreenCalibrationState ); +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, touchScreenCalibrationState ); +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + if ( touchScreenCalibrationState == ETouchScreenCalibrationOk ) + { + iTSCStartupExtension->CalibrationDone(); + } + + TRACES("CTSCPubSubObserver::ConstructL(): End"); + } + +// ---------------------------------------------------------------------------- +// CTSCPubSubObserver::HandlePropertyChangedL() +// ---------------------------------------------------------------------------- +void CTSCPubSubObserver::HandlePropertyChangedL( const TUid& /*aCategory*/, TUint aKey ) + { + TRACES("CTSCPubSubObserver::HandlePropertyChangedL()"); + TRACES1("CTSCPubSubObserver::HandlePropertyChangedL(): aKey: %d",aKey ); + + if (aKey == KPSTouchScreenCalibration) + { + TInt state; + +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, state ); +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, state ); +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + + if ( state == ETouchScreenCalibrationOk ) + { + iTSCStartupExtension->CalibrationDone(); + } + } + + TRACES("CTSCPubSubObserver::HandlePropertyChangedL(): End"); + } + +// ---------------------------------------------------- +// CTSCPubSubObserver::NewL( CTSCStartupExtension* aTSCStartupExtension ) +// ---------------------------------------------------- +CTSCPubSubObserver* CTSCPubSubObserver::NewL( CTSCStartupExtension* aTSCStartupExtension ) + { + TRACES("CTSCPubSubObserver::NewL()"); + CTSCPubSubObserver* self = new (ELeave) CTSCPubSubObserver( aTSCStartupExtension ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + + TRACES("CTSCPubSubObserver::NewL(): End"); + return self; + } + +// ---------------------------------------------------- +// CTSCPubSubObserver::~CTSCPubSubObserver() +// ---------------------------------------------------- +CTSCPubSubObserver::~CTSCPubSubObserver() + { + TRACES("CTSCPubSubObserver::~CTSCPubSubObserver()"); + + delete iTSCSyncSubscriber; + iProperty.Close(); + + TRACES("CTSCPubSubObserver::~CTSCPubSubObserver(): End"); + } + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/src/tscstartupextension.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/src/tscstartupextension.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,148 @@ +/* +* 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: Declaration of CTSCStartupExtension class. +* +*/ + +#include "tscstartupextension.h" +#include "tscstartupextensiondef.h" +#include "TSCPubSubObserver.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CDiskSpaceReserve::NewL +// +// --------------------------------------------------------------------------- +// +CTSCStartupExtension * CTSCStartupExtension ::NewL() + { + TRACES("CTSCStartupExtension :: NewL ()"); + CTSCStartupExtension * self = new ( ELeave ) CTSCStartupExtension ; + + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// +// --------------------------------------------------------------------------- +// +CTSCStartupExtension::~CTSCStartupExtension () + { + TRACES("CTSCStartupExtension ::~CTSCStartupExtension ()"); + + TRACES("CTSCStartupExtension ::~CTSCStartupExtension () End"); + } + + + +// --------------------------------------------------------------------------- +// First phase constructor +// +// --------------------------------------------------------------------------- +// +CTSCStartupExtension::CTSCStartupExtension() + :iRequestSent(EFalse) + { + } + +// --------------------------------------------------------------------------- +// CTSCStartupExtension::Initialize +// +// --------------------------------------------------------------------------- +// +TInt CTSCStartupExtension::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ ) + { + TRACES("CTSCStartupExtension::Initialize()"); + iTSCPubSubObserver = CTSCPubSubObserver::NewL( this ); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CTSCStartupExtension::Execute +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtension::Execute( + const TDesC8& /*aParams*/, + TRequestStatus& aStatus ) + { + TRACES("CTSCStartupExtension::ExecuteL()"); + aStatus = KRequestPending; + iStatus = &aStatus; + TRACES("CTSCStartupExtension::ExecuteL(): End"); + } + + +// --------------------------------------------------------------------------- +// CTSCStartupExtension::ExecuteCancel +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtension::ExecuteCancel() + { + // Nothing to do. + } + + +// --------------------------------------------------------------------------- +// CTSCStartupExtension::Release +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtension::Release() + { + delete this; + } + + +// --------------------------------------------------------------------------- +// CTSCStartupExtension::Close +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtension::Close() + { + TRACES("CTSCStartupExtension :: Close()"); + if (iTSCPubSubObserver) + { + delete iTSCPubSubObserver; + iTSCPubSubObserver = NULL; + } + TRACES("CTSCStartupExtension :: Close() End"); + } + +// --------------------------------------------------------------------------- +// CTSCStartupExtension::CalibrationDone +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtension::CalibrationDone() + { + TRACES("CTSCStartupExtension::CalibrationDone()"); + if (!iRequestSent) + { + TRACES("CTSCStartupExtension::CalibrationDone(): Send complete request"); + TInt errorCode = KErrNone; + User::RequestComplete( iStatus, errorCode ); + iRequestSent = ETrue; + } + TRACES("CTSCStartupExtension::CalibrationDone(): End"); + } + + diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tsccustcmds/src/tscsubscriber.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tsccustcmds/src/tscsubscriber.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,119 @@ +/* +* 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: TSC Subscriber (Publish & Subscribe). +* +*/ + +// INCLUDES +#include +#include "tscstartupextension.h" +#include "tscsubscriber.h" +#include "tscstartupextensiondef.h" + +// CONSTANTS + +// ============================= MEMBER FUNCTIONS ============================= + +// ---------------------------------------------------------------------------- +// CTSCSubscriber::NewL() +// ---------------------------------------------------------------------------- +CTSCSubscriber* CTSCSubscriber::NewL( + MTSCPropertyResponder& aTSCPropertyResponder, + const TUid& aCategory, + TUint aKey ) + { + CTSCSubscriber* self = new (ELeave) CTSCSubscriber( aTSCPropertyResponder, + aCategory, + aKey ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); //self + return self; + } + +// ---------------------------------------------------------------------------- +// CTSCSubscriber::ConstructL() +// ---------------------------------------------------------------------------- +void CTSCSubscriber::ConstructL() + { + CActiveScheduler::Add( this ); + iProperty.Attach( iCategory, iKey ); + } + +// ---------------------------------------------------------------------------- +// CTSCSubscriber::Subscribe() +// ---------------------------------------------------------------------------- +void CTSCSubscriber::Subscribe() + { + TRACES("CTSCSubscriber::Subscribe()"); + iProperty.Subscribe( iStatus ); + SetActive(); + TRACES("CTSCSubscriber::Subscribe(): End"); + } + +// ---------------------------------------------------------------------------- +// CTSCSubscriber::CTSCSubscriber() +// ---------------------------------------------------------------------------- +CTSCSubscriber::CTSCSubscriber( MTSCPropertyResponder& aTSCPropertyResponder, + const TUid& aCategory, + TUint aKey ) : + CActive( EPriorityStandard ), + iTSCPropertyResponder( aTSCPropertyResponder ), + iCategory( aCategory), + iKey( aKey ) + { + } + +// ---------------------------------------------------------------------------- +// CTSCSubscriber::RunL() +// ---------------------------------------------------------------------------- +void CTSCSubscriber::RunL() + { + TRACES("CTSCSubscriber::RunL()"); + Subscribe(); + iTSCPropertyResponder.HandlePropertyChangedL( iCategory, iKey ); + TRACES("CTSCSubscriber::RunL(): End"); + } + +// ---------------------------------------------------------------------------- +// CTSCSubscriber::DoCancel() +// ---------------------------------------------------------------------------- +void CTSCSubscriber::DoCancel() + { + iProperty.Cancel(); + } + +// ---------------------------------------------------------------------------- +// CTSCSubscriber::RunError() +// ---------------------------------------------------------------------------- +TInt CTSCSubscriber::RunError( TInt aError ) + { + return aError; + } + +// ---------------------------------------------------------------------------- +// CTSCSubscriber::~CTSCSubscriber() +// ---------------------------------------------------------------------------- +CTSCSubscriber::~CTSCSubscriber() + { + TRACES("CTSCSubscriber::~CTSCSubscriber()"); + Cancel(); + iProperty.Close(); + TRACES("CTSCSubscriber::~CTSCSubscriber(): End"); + } + +// End of File + + + diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/data/10283123.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/data/10283123.rss Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,58 @@ +/* +* 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: Registry info resource file for TSCStartupExtensionPlugIn +* ECOM plugin. +* +*/ + + + +// INCLUDES +#include "registryinfov2.rh" + +// RESOURCE DEFINITIONS +// --------------------------------------------------------- +// +// tscstartupextensionplugin_registry_info +// Registry info resource. +// +// --------------------------------------------------------- +// +RESOURCE REGISTRY_INFO tscstartupextensionplugin_registry_info + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = 0x10283123; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10205067; // UID of System startup extension plug-in API + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10283124; + version_no = 1; + display_name = "TSCStartupExtensionPlugIn"; + default_data = ""; + opaque_data = ""; + rom_only = 1; + } + }; + } + }; + } + + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/group/tscstartupextensionplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/group/tscstartupextensionplugin.mmp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,48 @@ +/* +* 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: Project definition file for project TSCStartupExtensionPlugIn +* +*/ + + +#include +#include + +TARGET tscstartupextensionplugin.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID 0x10009D8D 0x10283123 +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tscstartupextensionplugin.cpp +SOURCE implementationfactory.cpp +SOURCE tscpluginsubscriber.cpp +SOURCE tscpluginpubsubobserver.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +SYSTEMINCLUDE /epoc32/include/ecom + + +START RESOURCE ../data/10283123.rss +TARGET tscstartupextensionplugin.rsc +END + + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/inc/MTSCPlugInPropertyResponder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/MTSCPlugInPropertyResponder.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,32 @@ +/* +* 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: Interface of Touch screen calibration property change obsever +* +*/ + + +#ifndef MTSCPLUGINPROPERTYRESPONDER_H +#define MTSCPLUGINPROPERTYRESPONDER_H + +// INCLUDES +#include + +class MTSCPlugInPropertyResponder + { +public: + virtual void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ) = 0; + }; +#endif //MTSCPLUGINPROPERTYRESPONDER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/inc/TSCPlugInPubSubObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/TSCPlugInPubSubObserver.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,77 @@ +/* +* 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: +* This class the handles the received indications from the Public and +* Subscribe. +* +*/ + + +#ifndef TSCPLUGINPUBSUBOBSERVER_H +#define TSCPLUGINPUBSUBOBSERVER_H + +// INCLUDES +#include +#include "MTSCPlugInPropertyResponder.h" +#include "tscstartupextensionplugin.h" + + + +// CLASS DECLARATION +class CTSCStartupExtensionPlugIn; +class CTSCPlugInSubscriber; + +class CTSCPlugInPubSubObserver : public CBase, public MTSCPlugInPropertyResponder + { + public: // Constructors and destructor + + /** + * C++ constructor. + */ + CTSCPlugInPubSubObserver( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ); + + /** + * Two-phased constructor. + */ + static CTSCPlugInPubSubObserver* NewL( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ); + + /** + * Destructor. + */ + ~CTSCPlugInPubSubObserver(); + + private: + + /** + * By default EPOC constructor is private. + */ + void ConstructL(); + + CTSCPlugInPubSubObserver(); + + protected: // From MTSCPlugInPropertyResponder + + void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ); + + private: // Data + //reference to application class + CTSCStartupExtensionPlugIn* iTSCStartupExtensionPlugIn; //uses + + RProperty iProperty; + CTSCPlugInSubscriber* iTSCSyncSubscriber; + }; + +#endif // TSCPLUGINPUBSUBOBSERVER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscpluginsubscriber.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscpluginsubscriber.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,92 @@ +/* +* 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: TSC Subscriber (Publish & Subscribe). +* +*/ + + +#ifndef TSCPLUGINSUBSCRIBER_H +#define TSCPLUGINSUBSCRIBER_H + +// INCLUDES +#include +#include +#include "MTSCPlugInPropertyResponder.h" + +// CLASS DECLARATION +/** +* CTSCPlugInSubscriber +* +* @lib tscstartupextensionplugin +* @since 3.2 +*/ + +class CTSCPlugInSubscriber : public CActive +{ +public: + /** + * Two-phased constructor. + */ + static CTSCPlugInSubscriber* NewL( MTSCPlugInPropertyResponder& aTSCPlugInPropertyResponder, + const TUid& aCategory, + TUint aKey ); + + /** + * Destructor. + */ + ~CTSCPlugInSubscriber(); + + void Subscribe(); + +private: + CTSCPlugInSubscriber( MTSCPlugInPropertyResponder& aTSCPlugInPropertyResponder, + const TUid& aCategory, TUint + aKey ); + void ConstructL(); + +public: // from CActive + /** + * @param none + * @return none + */ + void RunL(); + + /** + * @param aError the error returned + * @return error + */ + TInt RunError( TInt aError ); + + /** + * @param none + * @return none + */ + void DoCancel(); + +private: // Methods not implemented + CTSCPlugInSubscriber( const CTSCPlugInSubscriber& ); // Copy constructor + CTSCPlugInSubscriber& operator=( const CTSCPlugInSubscriber& );// Assigment operator + +private: + + MTSCPlugInPropertyResponder& iTSCPlugInPropertyResponder; + RProperty iProperty; + TUid iCategory; + TUint iKey; +}; + + +#endif // TSCPLUGINSUBSCRIBER_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscstartupextensionplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscstartupextensionplugin.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,85 @@ +/* +* 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: Declaration of CTSCStartupExtensionPlugIn class. +* +*/ + + +#ifndef TSCSTARTUPEXTENSIONPLUGIN_H +#define TSCSTARTUPEXTENSIONPLUGIN_H + +#include + +// FORWARD DECLARATIONS +class CTSCPlugInPubSubObserver; + +/** + * System Startup Extension plug-in for executing Touch Screen Calibration + * during system startup. + * + * @lib tscstartupextensionplugin.lib + * @since S60 3.2 + */ +NONSHARABLE_CLASS( CTSCStartupExtensionPlugIn ) + : public CSystemStartupExtension + { + +public: + + static CTSCStartupExtensionPlugIn* NewL( TAny* aConstructionParameters ); + + virtual ~CTSCStartupExtensionPlugIn(); + + /** + * Execute TSC operations depending on parameters. + * + * @since S60 3.2 + * @param aStatus The request status to complete after the task has been + * finished. + */ + virtual void ExecuteL( TRequestStatus& aStatus, const TDesC& aParams ); + + /** + * Cancel pending request. + * + * @since S60 3.2 + */ + virtual void Cancel(); + + /** + * + * @since S60 3.2 + * @param none + */ + void CalibrationDone(); + +private: + + CTSCStartupExtensionPlugIn( TAny* aConstructionParameters ); + + /** + * Second phase constructor. + * + */ + void ConstructL(); + +private: //data + + CTSCPlugInPubSubObserver* iTSCPlugInPubSubObserver; //owns + + TRequestStatus* iStatus; + TBool iRequestSent; + }; + +#endif // TSCSTARTUPEXTENSIONPLUGIN_H diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscstartupextensionplugindef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscstartupextensionplugindef.h Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,46 @@ +/* +* 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: Includes some common defines used in the TSCStartupExtensionPlugIn +* +*/ + + +#ifndef TSCSTARTUPEXTENSIONPLUGINDEF_H +#define TSCSTARTUPEXTENSIONPLUGINDEF_H + +#include + +//CONSTANTS +_LIT( KTouchScreenCalibAppName, "TSCStartupExtensionPlugIn" ); + +// MACROS + +#define PANIC(aPanic) User::Panic( KTouchScreenCalibAppName, aPanic ) + +#define TRACE_ADDPREFIX(aText) (TPtrC((const TText *)L"TSCStartupExtensionPlugIn: \"" L##aText L"\"")) + +#ifdef _DEBUG +#define TRACES(aMsg) RDebug::Print( TRACE_ADDPREFIX(aMsg) ) +#define TRACES1(aFormat,aP1) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1) ) +#define TRACES2(aFormat,aP1,aP2) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2) ) +#define TRACES3(aFormat,aP1,aP2,aP3) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2),(aP3) ) +#else +#define TRACES(aMsg) +#define TRACES1(aFormat,aP1) +#define TRACES2(aFormat,aP1,aP2) +#define TRACES3(aFormat,aP1,aP2,aP3) +#endif +#endif // TSCSTARTUPEXTENSIONPLUGINDEF_H + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/src/implementationfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/src/implementationfactory.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,43 @@ +/* +* 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: TSCStartupExtensionPlugIn ECOM implementation factory. +* +*/ + + +#include "tscstartupextensionplugin.h" + +#include + +// Define the interface UIDs. +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x10283124, CTSCStartupExtensionPlugIn::NewL ) + }; + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy. +// +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginpubsubobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginpubsubobserver.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,132 @@ +/* +* 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: +* This class the handles the received indications from the Public and +* Subscribe. +* +*/ + + +// SYSTEM INCLUDES +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION +#include +#include +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION +#include +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + +// USER INCLUDES +#include "TSCPlugInPubSubObserver.h" +#include "tscpluginsubscriber.h" +#include "tscstartupextensionplugindef.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------- +// TSCPlugInPubSubObserver::TSCPlugInPubSubObserver( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------- +CTSCPlugInPubSubObserver::CTSCPlugInPubSubObserver( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) : + iTSCStartupExtensionPlugIn( aTSCStartupExtensionPlugIn ) + { + } + +// ---------------------------------------------------- +// CTSCPlugInPubSubObserver::ConstructL() +// ---------------------------------------------------- +void CTSCPlugInPubSubObserver::ConstructL() + { + TRACES("CTSCPlugInPubSubObserver::ConstructL()"); + + iTSCSyncSubscriber = CTSCPlugInSubscriber::NewL( *this, +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION + KPSUidTouchScreenCalibration, +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION + KPSUidStartup, +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + KPSTouchScreenCalibration ); + iTSCSyncSubscriber->Subscribe(); + + TInt touchScreenCalibrationState; +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, touchScreenCalibrationState ); +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, touchScreenCalibrationState ); +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + if ( touchScreenCalibrationState == ETouchScreenCalibrationOk ) + { + iTSCStartupExtensionPlugIn->CalibrationDone(); + } + + TRACES("CTSCPlugInPubSubObserver::ConstructL(): End"); + } + +// ---------------------------------------------------------------------------- +// CTSCPlugInPubSubObserver::HandlePropertyChangedL() +// ---------------------------------------------------------------------------- +void CTSCPlugInPubSubObserver::HandlePropertyChangedL( const TUid& /*aCategory*/, TUint aKey ) + { + TRACES("CTSCPlugInPubSubObserver::HandlePropertyChangedL()"); + TRACES1("CTSCPlugInPubSubObserver::HandlePropertyChangedL(): aKey: %d",aKey ); + + if (aKey == KPSTouchScreenCalibration) + { + TInt state; + +#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, state ); +#else //RD_STARTUP_ANIMATION_CUSTOMIZATION + RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, state ); +#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION + + if ( state == ETouchScreenCalibrationOk ) + { + iTSCStartupExtensionPlugIn->CalibrationDone(); + } + } + + TRACES("CTSCPlugInPubSubObserver::HandlePropertyChangedL(): End"); + } + +// ---------------------------------------------------- +// CTSCPlugInPubSubObserver::NewL( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) +// ---------------------------------------------------- +CTSCPlugInPubSubObserver* CTSCPlugInPubSubObserver::NewL( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) + { + TRACES("CTSCPlugInPubSubObserver::NewL()"); + CTSCPlugInPubSubObserver* self = new (ELeave) CTSCPlugInPubSubObserver( aTSCStartupExtensionPlugIn ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + + TRACES("CTSCPlugInPubSubObserver::NewL(): End"); + return self; + } + +// ---------------------------------------------------- +// CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver() +// ---------------------------------------------------- +CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver() + { + TRACES("CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver()"); + + delete iTSCSyncSubscriber; + iProperty.Close(); + + TRACES("CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver(): End"); + } + +// End of File diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginsubscriber.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginsubscriber.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,120 @@ +/* +* 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: CTSCPlugInSubscriber implementation. + * +*/ + + +// INCLUDES +#include +#include "tscstartupextensionplugin.h" +#include "tscpluginsubscriber.h" +#include "tscstartupextensionplugindef.h" + +// CONSTANTS + +// ============================= MEMBER FUNCTIONS ============================= + +// ---------------------------------------------------------------------------- +// CTSCPlugInSubscriber::NewL() +// ---------------------------------------------------------------------------- +CTSCPlugInSubscriber* CTSCPlugInSubscriber::NewL( + MTSCPlugInPropertyResponder& aTSCPlugInPropertyResponder, + const TUid& aCategory, + TUint aKey ) + { + CTSCPlugInSubscriber* self = new (ELeave) CTSCPlugInSubscriber( aTSCPlugInPropertyResponder, + aCategory, + aKey ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); //self + return self; + } + +// ---------------------------------------------------------------------------- +// CTSCPlugInSubscriber::ConstructL() +// ---------------------------------------------------------------------------- +void CTSCPlugInSubscriber::ConstructL() + { + CActiveScheduler::Add( this ); + iProperty.Attach( iCategory, iKey ); + } + +// ---------------------------------------------------------------------------- +// CTSCPlugInSubscriber::Subscribe() +// ---------------------------------------------------------------------------- +void CTSCPlugInSubscriber::Subscribe() + { + TRACES("CTSCPlugInSubscriber::Subscribe()"); + iProperty.Subscribe( iStatus ); + SetActive(); + TRACES("CTSCPlugInSubscriber::Subscribe(): End"); + } + +// ---------------------------------------------------------------------------- +// CTSCPlugInSubscriber::CTSCPlugInSubscriber() +// ---------------------------------------------------------------------------- +CTSCPlugInSubscriber::CTSCPlugInSubscriber( MTSCPlugInPropertyResponder& aTSCPlugInPropertyResponder, + const TUid& aCategory, + TUint aKey ) : + CActive( EPriorityStandard ), + iTSCPlugInPropertyResponder( aTSCPlugInPropertyResponder ), + iCategory( aCategory), + iKey( aKey ) + { + } + +// ---------------------------------------------------------------------------- +// CTSCPlugInSubscriber::RunL() +// ---------------------------------------------------------------------------- +void CTSCPlugInSubscriber::RunL() + { + TRACES("CTSCPlugInSubscriber::RunL()"); + Subscribe(); + iTSCPlugInPropertyResponder.HandlePropertyChangedL( iCategory, iKey ); + TRACES("CTSCPlugInSubscriber::RunL(): End"); + } + +// ---------------------------------------------------------------------------- +// CTSCPlugInSubscriber::DoCancel() +// ---------------------------------------------------------------------------- +void CTSCPlugInSubscriber::DoCancel() + { + iProperty.Cancel(); + } + +// ---------------------------------------------------------------------------- +// CTSCPlugInSubscriber::RunError() +// ---------------------------------------------------------------------------- +TInt CTSCPlugInSubscriber::RunError( TInt aError ) + { + return aError; + } + +// ---------------------------------------------------------------------------- +// CTSCPlugInSubscriber::~CTSCPlugInSubscriber() +// ---------------------------------------------------------------------------- +CTSCPlugInSubscriber::~CTSCPlugInSubscriber() + { + TRACES("CTSCPlugInSubscriber::~CTSCPlugInSubscriber()"); + Cancel(); + iProperty.Close(); + TRACES("CTSCPlugInSubscriber::~CTSCPlugInSubscriber(): End"); + } + +// End of File + + + diff -r 000000000000 -r 254040eb3b7d systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscstartupextensionplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscstartupextensionplugin.cpp Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,124 @@ +/* +* 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: Implementation of CTSCStartupExtensionPlugIn class. +* +*/ + + +#include "tscstartupextensionplugin.h" +#include "tscstartupextensionplugindef.h" +#include "TSCPlugInPubSubObserver.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// +// --------------------------------------------------------------------------- +// +CTSCStartupExtensionPlugIn* CTSCStartupExtensionPlugIn::NewL( + TAny* aConstructionParameters ) + { + CTSCStartupExtensionPlugIn* self = + new( ELeave ) CTSCStartupExtensionPlugIn( aConstructionParameters ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// +// --------------------------------------------------------------------------- +// +CTSCStartupExtensionPlugIn::~CTSCStartupExtensionPlugIn() + { + TRACES("CTSCStartupExtensionPlugIn::~CTSCStartupExtensionPlugIn()"); + if (iTSCPlugInPubSubObserver) + { + delete iTSCPlugInPubSubObserver; + } + TRACES("CTSCStartupExtensionPlugIn::~CTSCStartupExtensionPlugIn()"); + } + + +// --------------------------------------------------------------------------- +// First phase constructor +// +// --------------------------------------------------------------------------- +// +CTSCStartupExtensionPlugIn::CTSCStartupExtensionPlugIn( + TAny* aConstructionParameters ) + : CSystemStartupExtension( aConstructionParameters ), + iRequestSent(EFalse) + { + } + + +// --------------------------------------------------------------------------- +// CTSCStartupExtensionPlugIn::ConstructL +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtensionPlugIn::ConstructL() + { + TRACES("CTSCStartupExtensionPlugIn::ConstructL()"); + iTSCPlugInPubSubObserver = CTSCPlugInPubSubObserver::NewL( this ); + TRACES("CTSCStartupExtensionPlugIn::ConstructL(): End"); + } + +// --------------------------------------------------------------------------- +// CTSCStartupExtensionPlugIn::ExecuteL +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtensionPlugIn::ExecuteL( + TRequestStatus& aStatus, + const TDesC& /*aParams*/ ) + { + TRACES("CTSCStartupExtensionPlugIn::ExecuteL()"); + aStatus = KRequestPending; + iStatus = &aStatus; + TRACES("CTSCStartupExtensionPlugIn::ExecuteL(): End"); + } + +// --------------------------------------------------------------------------- +// CTSCStartupExtensionPlugIn::Cancel +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtensionPlugIn::Cancel() + { + // Nothing to do. + } + +// --------------------------------------------------------------------------- +// CTSCStartupExtensionPlugIn::CalibrationDone +// +// --------------------------------------------------------------------------- +// +void CTSCStartupExtensionPlugIn::CalibrationDone() + { + TRACES("CTSCStartupExtensionPlugIn::CalibrationDone()"); + if (!iRequestSent) + { + TRACES("CTSCStartupExtensionPlugIn::CalibrationDone(): Send complete request"); + TInt errorCode = KErrNone; + User::RequestComplete( iStatus, errorCode ); + iRequestSent = ETrue; + } + TRACES("CTSCStartupExtensionPlugIn::CalibrationDone(): End"); + } diff -r 000000000000 -r 254040eb3b7d tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/group/bld.inf Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,33 @@ +/* +* 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: Build information file +* +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +//#include "../../devmngt_plat/settings_backgroundimage_api/tsrc/group/bld.inf" +//#include "../../devmngt_plat/settings_framework_api/tsrc/group/bld.inf" +//#include "../../devmngt_plat/settings_launch_api/tsrc/group/bld.inf" +//#include "../../devmngt_plat/settings_listbox_api/tsrc/group/bld.inf" +//#include "../../devmngt_plat/filelist_api/tsrc/group/bld.inf" +//#include "../../devmngt_plat/profiles_engine_api/tsrc/group/bld.inf" + +// End of file diff -r 000000000000 -r 254040eb3b7d tsrc/group/copy_binaries_to_sys_dir.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/group/copy_binaries_to_sys_dir.mk Thu Dec 17 08:46:07 2009 +0200 @@ -0,0 +1,41 @@ +# +# 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: Icons makefile for project settingsuis +# + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + del \epoc32\RELEASE\winscw\udeb\Z\sys\bin\MT_CGSLauncher.dll /f + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : do_nothing + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : do_nothing + +FINAL : + echo COPYING + copy \epoc32\RELEASE\winscw\udeb\MT_CGSLauncher.dll \epoc32\RELEASE\winscw\udeb\Z\sys\bin /y