# HG changeset patch # User jake # Date 1280739767 -10800 # Node ID d12a7ea0f7757e186620018bc8617084b61841e1 # Parent d721605b30d0d0bebf750649d31e52252b1e98b4 Example applications for various Homescreen APIs. diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/group/bld.inf Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Carousel widget for Symbian Homescreen + * + */ + + +#include + +PRJ_PLATFORMS +ARMV5 WINSCW + +#include "../widget/group/bld.inf" +#include "../renderer/group/bld.inf" +#include "../publisher/group/bld.inf" + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/data/carouselplugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/data/carouselplugin.rss Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Registry info + * +*/ + + +// INCLUDES +#include +#include +#include "carouselpluginuids.hrh" + + +// ----------------------------------------------------------------------------- +// +// registry_info +// Registry information required for identifying the ECOM component +// +// ----------------------------------------------------------------------------- +// + +RESOURCE REGISTRY_INFO registry_info +{ + resource_format_version = RESOURCE_FORMAT_VERSION_2; + + dll_uid = AI_UID_ECOM_DLL_CONTENTPUBLISHER_CAROUSELPLUGIN; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = HS_UID_ECOM_INTERFACE_CONTENTPUBLISHER; + + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_CAROUSELPLUGIN; + version_no = 1; + display_name = "carpub"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; +} + + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/data/carouselpluginres.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/data/carouselpluginres.rss Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for carousel plug-in settings +* +*/ + + +#include +#include +#include +#include +#include + +#include + + +NAME MCPL + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="CCPL"; } + +//---------------------------------------------------- +// EIK_APP_INFO +// Contains application information. +//---------------------------------------------------- +// +RESOURCE EIK_APP_INFO +{ +} + +//---------------------------------------------------- +// R_MCS_DISABLE_OPEN_ITEM +// Dialog text: Item cannot be run because of backup +// state +//---------------------------------------------------- +// +RESOURCE TBUF r_mcs_disable_open_item +{ + buf = qtn_mcs_disable_open_item; +} + +//---------------------------------------------------- +// R_MCS_DISABLE_OPEN_ITEM_MISSING +// Dialog text: Item cannot be opened because of it is +// missing +//---------------------------------------------------- +// +RESOURCE TBUF r_mcs_disable_open_item_missing +{ + buf = qtn_mcs_disable_open_item_missing; +} + + +//---------------------------------------------------- +// R_MCS_DISABLE_OPEN_ITEM_DLG +// Contains application information. +//---------------------------------------------------- +// +RESOURCE DIALOG r_mcs_disable_open_item_dlg +{ + flags = EAknWarningNoteFlags | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control = AVKON_NOTE + { + layout = EGeneralLayout; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; +} + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/data/carouselpluginuids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/data/carouselpluginuids.hrh Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: UIDs for the Active Idle subsystem components. +* +*/ + + +#ifndef CAROUSELPLUGINUIDS_HRH +#define CAROUSELPLUGINUIDS_HRH + +/** + * Ecom dll uid for MCS plug-in. + */ +#define AI_UID_ECOM_DLL_CONTENTPUBLISHER_CAROUSELPLUGIN 0xE001CB57 + +/** + * Ecom implementation uid for MCS plug-in. + */ +#define AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_CAROUSELPLUGIN 0xE001CB58 + +/** + * Ecom implementation uid for MCS settings plug-in. + */ +#define AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN 0x20022FDD + +#endif //CAROUSELPLUGINUIDS_HRH diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/group/bld.inf Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The build information file of carousel Plugin +* +*/ + + +#include + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../loc/carouselplugin.loc MW_LAYER_LOC_EXPORT_PATH(carouselplugin.loc) + + +../rom/carouselplugin_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(carouselplugin_resources.iby) +../rom/carouselplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(carouselplugin.iby) + + + + +PRJ_EXTENSIONS + +START EXTENSION s60/mifconv +OPTION TARGETFILE carouselplugin.mif +OPTION HEADERFILE carouselplugin.mbg +OPTION SOURCES -c8,8 qgn_prop_ai_shortcut -c8,8 qgn_menu_url \ + -c8,8 qgn_menu_mce_sel_mes -c8,8 qgn_menu_mce_syncmail \ + -c8,8 qgn_menu_am -c8,8 qgn_prop_cp_conn_shortcut \ + -c8,8 qgn_prop_psln_ai_sub -c8,8 qgn_mcsplugin_log_out +END + + +PRJ_MMPFILES +carouselplugin.mmp + + +// End of File. diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/group/carouselplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/group/carouselplugin.mmp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project ProfilePlugin +* +*/ + +#include +#include + +#include "../data/carouselpluginuids.hrh" + +TARGET carouselplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D AI_UID_ECOM_DLL_CONTENTPUBLISHER_CAROUSELPLUGIN + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE carouselplugin.cpp +SOURCE carouselpluginengine.cpp +SOURCE carouselplugindata.cpp +SOURCE carouselpluginwatcher.cpp + +USERINCLUDE ../inc +USERINCLUDE ../loc +USERINCLUDE ../data + +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE carouselplugin.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +END + +START RESOURCE carouselpluginres.rss +HEADER +TARGET carouselpluginres.rsc +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END +LIBRARY euser.lib +LIBRARY mcsmenu.lib +LIBRARY mcsextendedmenu.lib +LIBRARY egul.lib +LIBRARY cone.lib +LIBRARY ecom.lib +LIBRARY aiutils.lib +LIBRARY aknskins.lib +LIBRARY aknicon.lib +LIBRARY mcsmenuutils.lib +LIBRARY hspluginsettings.lib +LIBRARY msgs.lib +LIBRARY apgrfx.lib +LIBRARY apparc.lib + + +LIBRARY bafl.lib +LIBRARY avkon.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY gslauncher.lib +LIBRARY eikdlg.lib +LIBRARY commonengine.lib +LIBRARY favouritesengine.lib +LIBRARY viewcli.lib +LIBRARY gfxtrans.lib + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/inc/carouselplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/inc/carouselplugin.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Plug-in main class +* +*/ + + +#ifndef CMCSPLUGIN_H +#define CMCSPLUGIN_H + +// System includes + +// User includes +#include +#include + +// Forward declarations +class MAiContentObserver; +class MAiContentItemIterator; +class CCarouselPluginEngine; +class CCarouselData; + + +/** + * @ingroup group_mcsplugin + * + * MCS Plug-in main class + * + * @since S60 5.2 + */ +NONSHARABLE_CLASS( CCarouselPlugin ) : public CHsContentPublisher + { +public: + // constructor and destructor + + static CCarouselPlugin* NewL(); + + ~CCarouselPlugin(); + +private: + // constructors + + /** + * C++ default constructor + */ + CCarouselPlugin(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + +public: + // from CHsContentPublisher + + /** + * @see CHsContentPublisher + */ + void Start( TStartReason aReason ); + + /** + * @see CHsContentPublisher + */ + void Stop( TStopReason aReason ); + + /** + * @see CHsContentPublisher + */ + void Resume( TResumeReason aReason ); + + /** + * @see CHsContentPublisher + */ + void Suspend( TSuspendReason aReason ); + + /** + * @see CHsContentPublisher + */ + void SubscribeL( MAiContentObserver& aObserver ); + + /** + * @see CHsContentPublisher + */ + void ConfigureL( RAiSettingsItemArray& aSettings ); + + /** + * @see CHsContentPublisher + */ + TAny* GetProperty( TProperty aProperty ); + + /** + * @see CHsContentPublisher + */ + void HandleEvent( const TDesC& aEventName, const TDesC& aParam ); + +public: + // new functions + + /** + * Publishes data + */ + void PublishL(); + +private: + // new functions + + /** + * CompareItems + */ + static TInt CompareItems( const MAiPluginSettings& aFirst, + const MAiPluginSettings& aSecond ); + + /** + * Publishes content for one menu item + */ + void PublishLItemL( MAiContentObserver& aObserver, CCarouselData& aDataItem, TInt aIndex ); + + void PublishEditorItemsL(); + + /** + * Delete content model + */ + void DeleteContentModel(); + + /** + * Determines if dirty items exists + */ + TBool PublishRequired() const; + +private: + // data + + /** Iterator for plugin content, owned */ + MAiContentItemIterator* iContent; + /** Number of data in the content model */ + TInt iDataCount; + /** Dynamic content model, owned */ + TAiContentItem* iContentModel; + /** Plugin engine, owned */ + CCarouselPluginEngine* iEngine; + /** Array of content observers, not owned */ + RPointerArray iObservers; + }; + +#endif // CMCSPLUGIN_H + +// End of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/inc/carouselplugindata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/inc/carouselplugindata.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,274 @@ +/* +* Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Plug-in data class +* +*/ + + +#ifndef CMCSPLUGINDATA_H +#define CMCSPLUGINDATA_H + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include + +class TMenuItem; +class CCarouselPluginEngine; + +/** + * @ingroup group_mcsplugin + * + * Stores the MCS Menu Items and keeps track whether + * item needs to be published or not. + * + * @since S60 v9.1 + */ +NONSHARABLE_CLASS( CCarouselData ) : public CBase + { +public: + CCarouselData(); + + ~CCarouselData(); + + /** + * SetMenuItem + * + * @param aMenuItem + */ + void SetMenuItem( TMenuItem& aMenuItem ); + + /** + * MenuItem + * + * @return TMenuItem + */ + TMenuItem& MenuItem(); + + /** + * Name of the item. + */ + TDesC& Name(); + + /** + * Set name of the item, + */ + void SetNameL( const TDesC& aName ); + + /** + * Value of the item. Used for bookmark url. + */ + TDesC& Value(); + + /* + * Set value of the item. + */ + void SetValueL( const TDesC& aValue ); + + /** + * SetDirty + * + * @param aDirty + * @return TBool + */ + void SetDirty( TBool aDirty ); + + /** + * IsDirty + * + * @return TBool + */ + TBool IsDirty() const; + +private: + /** + * iMenuItem + */ + TMenuItem iMenuItem; + + /** + * Item name, own + */ + HBufC* iName; + + /** + * Item value, own + */ + HBufC* iValue; + + /** + * iDirty + */ + TBool iDirty; + }; + +/** + * @ingroup group_mcsplugin + * + * Plug-in data class + * + * @since + */ +NONSHARABLE_CLASS( CCarouselPluginData ) : public CBase, + public HSPluginSettingsIf::MHomeScreenSettingsObserver + { + +public: + + /** + * Part of the two phased constuction + * + * @param aEngine + * @param aInstanceUid + * @return Pointer to the created CMCSPluginData object + */ + static CCarouselPluginData* NewL( CCarouselPluginEngine& aEngine, + const TDesC8& aInstanceUid ); + + /** + * Constructor + * + * @param aEngine + * @param aInstanceUid + * @return none + */ + CCarouselPluginData( CCarouselPluginEngine& aEngine, const TDesC8& aInstanceUid ); + + /** + * Destructor + * + * @param none + * @return none + */ + ~CCarouselPluginData(); + + /** + * DataItem + * + * @param aIndex + * @return TMCSData& + */ + CCarouselData& DataItemL( TInt aIndex ); + + /** + * Saves 'Undefined' menu item into settings when mailbox is deleted + * + * @param aIndex + * @param aMenuItem + */ + void SaveUndefinedItemL( const TInt& aIndex ); + + /** + * DataCount + * + * @return TInt + */ + TInt DataCount(){ return iData.Count();}; + + /** + * Gets the instance specific settings from HSPS and creates data items + */ + void UpdateDataL(); + + /** + * Removes data item from data list and saves new setting into HSPS + */ + void RemoveDataL( TInt aId ); + + // From MHomeScreenSettingsObserver + /** + * SettingsChangedL + * + * @param aEvent + * @param aPluginName + * @param aPluginUid + * @param aPluginId + */ + void SettingsChangedL( const TDesC8& aEvent, const TDesC8& aPluginName, + const TDesC8& aPluginUid, const TDesC8& aPluginId ); + +private: + + /** + * Part of the two phased construction + * + * @param void + * @return void + */ + void ConstructL(); + + /** + * GetMenuDataL + * @param aProperties + * @return TMenuItem + */ + CCarouselData* GetMenuDataL( + RPointerArray& aProperties ); + + /** + * Get bookmark data item + * @param aUid, used for bookmark uid + * @param aView, used for bookmark url + * @param aParam, used for bookmark name + * @param aData, is filled with appropriate values + */ + void GetBkmDataL( const TDesC8& aUid, const TDesC8& aView, const TDesC8& aParam, CCarouselData& aData ); + + /** + * Get folder data item + * @param aParam, is used for folder id (in MCS) + * @param aData, is filled with appropriate values + */ + void GetFolderData( const TDesC8& aParam, CCarouselData& aData ); + + /** + * Get mailbox data item + * @param aUid, uid of the mailbox in messaging application + * @param aParam, name of the mailbox + * @param aData, is filled with appropriate values + */ + void GetMailboxDataL( const TDesC8& aUid, const TDesC8& aParam, CCarouselData& aData ); + + /** + * Get MCS data item + * @param aProperties, Properties are used to filter correct item from MCS. + * @param aData, is filled with appropriate values + */ + void GetMCSDataL( + RPointerArray& aProperties, CCarouselData& aData ); + +private: // data + + // Menu items, which are defined in settings + // Own + RPointerArray iData; + + // Plugin settings. NOT OWNED! + HSPluginSettingsIf::CHomescreenSettings* iPluginSettings; + + // Reference to MCS plug-in engine + CCarouselPluginEngine& iEngine; + + // Reference to instance uid of HSPS widget + const TDesC8& iInstanceUid; + + // MCS resource handle, owned + RMenu iMenu; + + }; + +#endif // CMCSPLUGINDATA_H diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/inc/carouselpluginengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/inc/carouselpluginengine.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef CMCSPLUGINENGINE_H +#define CMCSPLUGINENGINE_H + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "carouselpluginwatcher.h" + +// Forward declarations +class CGulIcon; +class CCarouselPluginData; +class CCarouselData; +class CCarouselPlugin; + + +/** + * @ingroup group_mcsplugin + * + * MCSPluginEngine class + * + * @since S60 5.2 + */ +NONSHARABLE_CLASS( CCarouselPluginEngine ) : public CBase, + public MCarouselPluginWatcherObserver, + public MMsvSessionObserver + { +public: + // constructor and destructor + + /** + * Part of the two phased constuction + * + * @param aPlugin + * @param aInstanceUid + * @return Pointer to the created CMCSPluginEngine object + */ + static CCarouselPluginEngine* NewL( CCarouselPlugin& aPlugin, + const TDesC8& aInstanceUid ); + + /** + * Destructor + * + * @param none + * @return none + */ + ~CCarouselPluginEngine(); + +private: + // constructors + + /** + * C++ default constructor + */ + CCarouselPluginEngine( CCarouselPlugin& aPlugin, const TDesC8& aInstanceUid ); + + /* + * 2nd phase constructor + */ + void ConstructL(); + +public: + // new functions + + /** + * Gets the menu data. + * + * @param aIndex + * @return TMCSData& + */ + CCarouselData& MenuDataL( const TInt& aIndex ); + + /** Gets the menu item count + * + * @return TInt + */ + TInt MenuItemCount(); + + /** + * Finds the menu item header for given filter. + * + * @param aFilter + * @return TMenuItem + */ + TMenuItem FindMenuItemL( CMenuFilter& aFilter ); + + /** + * Retrieves the menu item object from MCS. + * + * @param aMenuItem + * @return CMenuItem* + */ + CMenuItem* FetchMenuItemL( CCarouselData& aData); + + /** + * Returns icon for given menu item and given attribute + * + * @param aMenuItem + * @param aAttr + * @return CGulIcon* + */ + CGulIcon* ItemIconL( CMenuItem* aMenuItem, const TDesC& aAttr ); + + /** + * Returns text for given menu item and given attribute + * + * @param aMenuItem + * @param aAttr + */ + TPtrC ItemTextL( CMenuItem* aMenuItem, const TDesC& aAttr ); + + /** + * Launches menu item + * + * @param aIndex + */ + void LaunchItemL( const TInt& aIndex ); + + /** + * Set backup/restore state + * + * @param aBackupRestore ETrue if backup/restore is ongoing + * @return void + */ + void SetBackupRestore( TBool aBackupRestore ); + + /** + * ShowSettingsL + */ + void ShowSettingsL(); + +private: + // from MMCSPluginWatcherObserver + + /** + * @see MMCSPluginWatcherObserver + */ + void HandleNotifyL(); + +private: + // from MMsvSessionObserver + + /** + * @see MMsvSessionObserver + */ + void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, + TAny* aArg2, TAny* aArg3 ); + +private: + // new functions + + /** + * InitL + */ + void InitL(); + + /** + * Tells the settings container to start observing + * for changes in mailbox db and changes in MCS. + */ + void StartObservingL(); + + /** + * Tells the settings container to stop observing + * for changes in mailbox db. + */ + void StopObserving(); + + /** + * ConstructMenuItemForIconL + * + * @param aPath + * @param aMenuItem + * @return TBool + */ + TBool ConstructMenuItemForIconL( + const TDesC& aPath, CMenuItem& aMenuItem ); + + /** + * Creates bookmark specific MCS menu item. + */ + CMenuItem* CreateBkmItemL( CCarouselData& aData ); + + /** + * Creates mailbox specific MCS menu item. + */ + CMenuItem* CreateMailboxItemL( CCarouselData& aData ); + + void LaunchFolderItemL( CCarouselData& aData ); + + void LaunchBookmarkItemL( CCarouselData& aData ); + + void LaunchMailboxItemL( CCarouselData& aData ); + + void LaunchMCSItemL( CCarouselData& aData ); + +private: + // data + + /** Plugin data, owned */ + CCarouselPluginData* iPluginData; + /** MCS resource handle, owned */ + RMenu iMenu; + /** MCS change notifier handle, owned */ + RMenuNotifier iNotifier; + /** MCS asynchronous operation watcher, owned */ + CCarouselPluginWatcher* iWatcher; + /** MCS change notifier watcher, owned */ + CCarouselPluginWatcher* iNotifyWatcher; + /** MCS plugin, not owned */ + CCarouselPlugin& iPlugin; + /** Reference to plugin owned instanceUid */ + const TDesC8& iInstanceUid; + /** Flag Indicating that backup/restore is in progress */ + TBool iBackupRestore; + /** Offset of resource file */ + TInt iResourceOffset; + /** Message server session, owned */ + CMsvSession* iMsvSession; + /** "Undefined" menu item, owned */ + CMenuItem* iUndefinedItem; + /** "Undefined" menu item header */ + TMenuItem iUndefinedItemHeader; + }; + +#endif // CMCSPLUGINENGINE_H + +// End of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/inc/carouselpluginwatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/inc/carouselpluginwatcher.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MCSPLUGINWATCHER_H +#define __MCSPLUGINWATCHER_H + +#include + +class CMenuOperation; +class CCarouselPluginEngine; + +/** + * @ingroup group_mcsplugin + * + * MCS Plugin Watcher Observer + * + * @since S60 9.1 + */ +class MCarouselPluginWatcherObserver + { + public: + /** + * HandleNotifyL + */ + virtual void HandleNotifyL() = 0; + }; + +/** + * @ingroup group_mcsplugin + * + * This class implements MCS menu action watcher for async calls. + * + * @since S60 9.1 + */ +class CCarouselPluginWatcher: public CActive + { + public: + + /** + * enum Type + */ + enum Type + { + EOperation, + ENotify + }; + + /** + * Two-phased constructor. + * + * @param aType + */ + static CCarouselPluginWatcher* NewL( const Type& aType ); + + /** + * Destructor. + */ + virtual ~CCarouselPluginWatcher(); + + /** + * Watch menu operation or notification. + * + * @param aOperation + */ + void Watch( CMenuOperation* aOperation = NULL ); + + /** + * WatchNotify + * + * @param aObserver + */ + void WatchNotify( MCarouselPluginWatcherObserver* aObserver ); + + /** + * StopAndWatch + * + * @param aOperation + * @param aWaitScheduler + */ + void StopAndWatch( CMenuOperation* aOperation, + CActiveSchedulerWait* aWaitScheduler ); + + /** + * GetStatus + */ + TInt GetStatus(); + + private: + + /** + * Default constructor. + * + * @param aType + */ + CCarouselPluginWatcher( const Type& aType ); + + /** + * ConstructL + */ + void ConstructL(); + + /** + * Inherited from CActive class + */ + void RunL(); + + /** + * Inherited from CActive class + */ + void DoCancel(); + + private: + + /** + * Menu operation + * Owned + */ + CMenuOperation* iOperation; + + /** + * Wait scheduler + * Not owned + */ + CActiveSchedulerWait* iWaitScheduler; + + /** + * Observer reference + * Not owned + */ + MCarouselPluginWatcherObserver* iObserver; + + /** + * iType + */ + Type iType; + }; + +#endif /*__MCSPLUGINWATCHER_H*/ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/loc/carouselplugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/loc/carouselplugin.loc Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Localization strings for project carousel Plugin +* +*/ + +// d: A dialog which is shown to user when (s)he is trying to +// d: launch shortcut item during backup state. +// l: popup_note_window +// w: +// r: tb9.2 +// +#define qtn_mcs_disable_open_item "Application cannot be opened during backup" + +// d: A dialog which is shown to user when (s)he is trying to +// d: launch shortcut item which is missing from menu. +// l: popup_note_window +// w: +// r: tb9.2 +// +#define qtn_mcs_disable_open_item_missing "Shortcut cannot be opened because item is missing. Try to insert memory card which contains the item or reinstall the application." + +//End file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/rom/carouselplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/rom/carouselplugin.iby Mon Aug 02 12:02:47 2010 +0300 @@ -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: IBY file for carousel plug-in +* +*/ + + +#ifndef CAROUSELPLUGIN_IBY +#define CAROUSELPLUGIN_IBY +#include + +data=DATAZ_\BITMAP_DIR\carouselplugin.mif BITMAP_DIR\carouselplugin.mif + +ECOM_PLUGIN(carouselplugin.dll, carouselplugin.rsc) + +#endif // CAROUSELPLUGIN_IBY + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/rom/carouselplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/rom/carouselplugin_resources.iby Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,26 @@ +/* +* 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: IBY file for Profile plug-in +* +*/ + + +#ifndef CAROUSELPLUGIN_RESOURCES_IBY +#define CAROUSELPLUGIN_RESOURCES_IBY + +#include + +data=DATAZ_\RESOURCE_FILES_DIR\carouselpluginres.rsc RESOURCE_FILES_DIR\carouselpluginres.rsc + +#endif // CAROUSELPLUGIN_RESOURCES_IBY diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/src/carouselplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/src/carouselplugin.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,502 @@ +/* +* Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MCS plugin publisher +* +*/ + +// System includes +#include +#include +#include +#include + +// User includes +#include +#include +#include +#include +#include "carouselpluginuids.hrh" +#include "carouselplugin.h" +#include "carouselplugindata.h" +#include "carouselpluginengine.h" + +// Constants +const TUint KPluginNameSeprator = '/'; + +const TInt KImplUidMCSPlugin = AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_CAROUSELPLUGIN; + +_LIT( KEventNameLaunchByIndex, "LaunchByIndex" ); +_LIT( KEventNameShowSettings, "ShowSettings" ); +_LIT( KContentItemTypeText, "text" ); +_LIT( KContentItemTypeImage, "image" ); +_LIT( KContentItemTypeData, "data" ); + +const TImplementationProxy KImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KImplUidMCSPlugin, CCarouselPlugin::NewL ) + }; + +class CPublishItem : public CBase + { +public: + ~CPublishItem(); + CPublishItem(); + + CGulIcon* icon; + HBufC* text; + TBool last; + }; + +CPublishItem::CPublishItem() + { + + } + +CPublishItem::~CPublishItem() + { + delete text; + } + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== +// ---------------------------------------------------------------------------- +// CMCSPlugin::NewL +// +// ---------------------------------------------------------------------------- +// +CCarouselPlugin* CCarouselPlugin::NewL() + { + CCarouselPlugin* self = new ( ELeave ) CCarouselPlugin; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::CMCSPlugin +// +// ---------------------------------------------------------------------------- +// +CCarouselPlugin::CCarouselPlugin() + { + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::ConstructL +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::ConstructL() + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// Deletes all data created to heap +// ---------------------------------------------------------------------------- +// +CCarouselPlugin::~CCarouselPlugin() + { + Release( iContent ); + + delete iEngine; + iObservers.Close(); + + DeleteContentModel(); + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::PublishL +// Publishes the all the items +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::PublishL() + { + TInt err( KErrNone ); + TInt observers( iObservers.Count() ); + TInt transactionId( reinterpret_cast( this ) ); + TInt menuItems ( iEngine->MenuItemCount() ); + + for ( TInt i = 0; i < observers; i++ ) + { + MAiContentObserver* observer( iObservers[ i ] ); + err = observer->StartTransaction( transactionId ); + + if ( err == KErrNotSupported ) + { + return; + } + + // Publish content to all items + for ( TInt j = 0; j < menuItems; j++ ) + { + // Index has to start from 1 ( j + 1 ) + PublishLItemL( *observer, iEngine->MenuDataL( j ), ( j + 1 ) ); + }// shortcut count + + if ( err == KErrNone ) + { + err = observer->Commit( transactionId ); + + if ( err == KErrNotSupported ) + { + return; + } + } + }//observers + + // Set all items not dirty. + for ( TInt j = 0; j < menuItems; j++ ) + { + iEngine->MenuDataL( j ).SetDirty( EFalse ); + } + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::PublishLItemL +// Publishes one item to given index +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::PublishLItemL( MAiContentObserver& aObserver, + CCarouselData& aData, TInt aIndex ) + { + if( !aData.IsDirty() ) + { + return; + } + + CMenuItem* item = iEngine->FetchMenuItemL( aData ); + CleanupStack::PushL( item ); + + if ( iContentModel[0].type == KAiContentTypeData ) + { + if(TPtrC16( ( const TText16* ) iContentModel[ 0 ].cid ) == _L("widget") ) + { + CGulIcon* icon( iEngine->ItemIconL( item, _L("icon"))); + icon->SetBitmapsOwnedExternally( ETrue ); + aObserver.Publish( *this, 0, TPckgC( icon ), aIndex - 1 ); + } + } + CleanupStack::PopAndDestroy( item ); + } + +// ---------------------------------------------------------------------------- +// PublishEditorItemsL +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::PublishEditorItemsL() + {/* + RArray items = iEngine->MenuItemsL(); + CleanupClosePushL( items ); + + TInt count( items.Count()); + for( TInt i = 0; i < count; i++ ) + { + CMenuItem* item( iEngine->FetchMenuItemL( items[i])); + CleanupStack::PushL( item ); + CGulIcon* icon( iEngine->ItemIconL( *item, _L("icon"))); + TPtrC name( iEngine->ItemTextL( *item, _L("long_name") )); + CPublishItem* pItem = new CPublishItem; + pItem->icon = icon; + pItem->text = name.AllocL(); + if( i < count - 1 ) + { + pItem->last = EFalse; + } + else + { + pItem->last = ETrue; + } + iObservers[0]->Publish( *this, 0, TPckgC( pItem), i ); + delete pItem; + CleanupStack::PopAndDestroy( item ); + } + CleanupStack::PopAndDestroy( &items ); + */ + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::Start +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::Start( TStartReason /*aReason*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::Stop +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::Stop( TStopReason /*aReason*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::Resume +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::Resume( TResumeReason aReason ) + { + if ( aReason == EForeground ) + { + iEngine->SetBackupRestore( EFalse ); + + if ( PublishRequired() ) + { + TRAP_IGNORE( PublishL() ); + } + } + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::Suspend +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::Suspend( TSuspendReason aReason ) + { + if ( aReason == EGeneralThemeChange ) + { + TInt dataCount( iEngine->MenuItemCount() ); + + for ( TInt i = 0; i < dataCount; i++ ) + { + TRAP_IGNORE( iEngine->MenuDataL( i ).SetDirty( ETrue ) ); + } + } + else if ( aReason == EBackupRestore ) + { + // Prevent item launching during backup / restore + iEngine->SetBackupRestore( ETrue ); + } + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::SubscribeL +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::SubscribeL( MAiContentObserver& aObserver ) + { + iObservers.AppendL( &aObserver ); + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::ConfigureL +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::ConfigureL( RAiSettingsItemArray& aSettings ) + { + iEngine = CCarouselPluginEngine::NewL( *this, PublisherInfo().Namespace() ); + + TLinearOrder sortMethod( CCarouselPlugin::CompareItems ); + RAiSettingsItemArray contentItemsArr; + + TInt count( aSettings.Count() ); + + for ( TInt i = 0; i < count; i++ ) + { + MAiPluginSettings* setting( aSettings[ i ] ); + + if( setting->AiPluginItemType() == EAiPluginContentItem ) + { + MAiPluginContentItem& contItem( setting->AiPluginContentItem() ); + TPtrC name( contItem.Name() ); + TPtrC type( contItem.Type() ); + + contentItemsArr.InsertInOrder( setting, sortMethod ); + } + } + + iDataCount = contentItemsArr.Count(); + + if ( iDataCount > 0 ) + { + // Create the dynamic content Model + DeleteContentModel(); + + iContentModel = new ( ELeave ) TAiContentItem[ iDataCount ]; + + for ( TInt i = 0; i < iDataCount; i++ ) + { + iContentModel[i].id = i; + + MAiPluginContentItem& contentItem( + contentItemsArr[ i ]->AiPluginContentItem() ); + + if( contentItem.Type() == KContentItemTypeText ) + { + // text + iContentModel[i].type = KAiContentTypeText; + } + if( contentItem.Type() == KContentItemTypeImage ) + { + // image + iContentModel[i].type = KAiContentTypeBitmap; + } + else if(contentItem.Type() == KContentItemTypeData ) + { + // data + iContentModel[i].type = KAiContentTypeData; + } + + TInt pos( contentItem.Name().Locate( KPluginNameSeprator ) ); + + HBufC* contentId = HBufC::NewL( contentItem.Name().Length() ); + CleanupStack::PushL( contentId ); + + TPtr ptr( contentId->Des() ); + ptr = contentItem.Name().Mid( pos + 1 ); + + TInt sizeOfContentId( ptr.Size() + sizeof( wchar_t ) ); + + iContentModel[i].cid = + static_cast( User::AllocL( sizeOfContentId ) ); + + Mem::Copy( ( TAny* )iContentModel[i].cid, + ptr.PtrZ(), sizeOfContentId ); + + CleanupStack::PopAndDestroy( contentId ); + } + + iContent = AiUtility::CreateContentItemArrayIteratorL( + iContentModel, iDataCount ); + } + + contentItemsArr.Reset(); + // We own the array so destroy it + aSettings.ResetAndDestroy(); + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::GetProperty +// +// ---------------------------------------------------------------------------- +// +TAny* CCarouselPlugin::GetProperty( TProperty aProperty ) + { + if( aProperty == EPublisherContent ) + { + return static_cast< MAiContentItemIterator* >( iContent ); + } + + return NULL; + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::HandleEvent +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::HandleEvent( const TDesC& aEventName, const TDesC& aParam ) + { + if( aEventName == KEventNameLaunchByIndex ) + { + TInt32 index; + AiUtility::ParseInt( index, aParam ); + + TRAP_IGNORE( iEngine->LaunchItemL( index - 1 ) ); + } + else if( aEventName == KEventNameShowSettings ) + { + TRAP_IGNORE( iEngine->ShowSettingsL() ); + } + else if( aEventName == _L("ShowEditor")) + { + TRAP_IGNORE( PublishEditorItemsL() ); + } + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::CompareItems +// +// ---------------------------------------------------------------------------- +// +TInt CCarouselPlugin::CompareItems( const MAiPluginSettings& aFirst, + const MAiPluginSettings& aSecond ) + { + MAiPluginSettings& first = const_cast(aFirst); + MAiPluginSettings& second = const_cast(aSecond); + return first.AiPluginContentItem().Name().CompareC(second.AiPluginContentItem().Name()); + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::DeleteContentModel +// +// ---------------------------------------------------------------------------- +// +void CCarouselPlugin::DeleteContentModel() + { + if( iContentModel ) + { + for ( TInt i = 0; i < iDataCount; i++ ) + { + if( iContentModel[i].cid ) + { + TAny* cell = static_cast( const_cast( iContentModel[i].cid ) ); + User::Free( cell ); // Originally allocated with User::Alloc, so delete + // with correlating method. + iContentModel[i].cid = NULL; + } + } + + delete iContentModel; + iContentModel = NULL; + } + } + +// ---------------------------------------------------------------------------- +// CMCSPlugin::PublishRequired +// +// ---------------------------------------------------------------------------- +// +TBool CCarouselPlugin::PublishRequired() const + { + TInt count( iEngine->MenuItemCount() ); + + TBool retval( EFalse ); + + for ( TInt i = 0; !retval && i < count; i++ ) + { + TRAP_IGNORE( retval = iEngine->MenuDataL( i ).IsDirty() ); + } + + + return retval; + } + +// ======== GLOBAL FUNCTIONS ======== +// ---------------------------------------------------------------------------- +// Constructs and returns an application object. +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = sizeof( KImplementationTable ) / + sizeof( TImplementationProxy ); + return KImplementationTable; + } + +// End of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/src/carouselplugindata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/src/carouselplugindata.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,580 @@ +/* +* Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include +#include + +#include "carouselplugindata.h" +#include "carouselpluginengine.h" + +using namespace HSPluginSettingsIf; + +_LIT( KMenuAttrParam, "param" ); +_LIT( KMenuAttrLocked, "locked" ); +_LIT8( KProperNameType, "type" ); +_LIT8( KProperNameParam, "param" ); +_LIT8( KProperNameUid, "uid" ); +_LIT8( KProperNameView, "view" ); +_LIT8( KProperNameLocked, "locked" ); +_LIT8( KProperValueFolder, "folder" ); +_LIT8( KProperValueBookmark, "bookmark" ); +_LIT8( KProperValueAppl, "application" ); +_LIT8( KProperValueMailbox, "mailbox" ); +_LIT8( KMenuAttrUndefUid, "0x99999991" ); + +_LIT( KMyMenuData, "matrixmenudata" ); +_LIT( KMenuTypeMailbox, "menu:mailbox" ); + + +#define KMCSCmailMtmUidValue 0x2001F406 + +// ======== LOCAL FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// CleanupResetAndDestroy() +// ---------------------------------------------------------------------------- +// +template +static void CleanupResetAndDestroy( TAny* aObj ) + { + if( aObj ) + { + static_cast( aObj )->ResetAndDestroy(); + } + } + +// ---------------------------------------------------------------------------- +// CleanupResetAndDestroyPushL +// ---------------------------------------------------------------------------- +// +template +static void CleanupResetAndDestroyPushL(T& aArray) + { + CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy, &aArray ) ); + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CCarouselData::CCarouselData() + :iDirty( ETrue ) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CCarouselData::~CCarouselData() + { + delete iName; + delete iValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CCarouselData::SetMenuItem( TMenuItem& aMenuItem ) + { + iMenuItem = aMenuItem; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TMenuItem& CCarouselData::MenuItem() + { + return iMenuItem; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDesC& CCarouselData::Name() + { + return *iName; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CCarouselData::SetNameL( const TDesC& aName ) + { + delete iName; + iName = NULL; + iName = aName.AllocL(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDesC& CCarouselData::Value() + { + return *iValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CCarouselData::SetValueL( const TDesC& aValue ) + { + delete iValue; + iValue = NULL; + iValue = aValue.AllocL(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CCarouselData::SetDirty( TBool aDirty ) + { + iDirty = aDirty; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool CCarouselData::IsDirty() const + { + return iDirty; + } + + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave +// --------------------------------------------------------------------------- +// +CCarouselPluginData* CCarouselPluginData::NewL( CCarouselPluginEngine& aEngine, const TDesC8& aInstanceUid ) + { + CCarouselPluginData* self = new (ELeave) CCarouselPluginData( aEngine, aInstanceUid ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CCarouselPluginData::CCarouselPluginData( CCarouselPluginEngine& aEngine, const TDesC8& aInstanceUid ) + : iEngine( aEngine ), iInstanceUid( aInstanceUid ) + { + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::ConstructL() + { + iPluginSettings = CHomescreenSettings::Instance(); + if( iPluginSettings == NULL ) + { + User::Leave( KErrUnknown ); + } + iPluginSettings->AddObserverL( this ); + + iMenu.OpenL( KMyMenuData ); + + UpdateDataL(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CCarouselPluginData::~CCarouselPluginData() + { + if( iPluginSettings ) + { + iPluginSettings->RemoveObserver( this ); + } + iData.ResetAndDestroy(); + iMenu.Close(); + } + +// --------------------------------------------------------------------------- +// Gets the instance specific settings from HSPS and creates data items +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::UpdateDataL() + { + RPointerArray settings; + CleanupResetAndDestroyPushL( settings ); + + User::LeaveIfError( iPluginSettings->GetSettingsL( iInstanceUid, settings ) ); + if ( settings.Count() <= 0 ) + { + User::Leave( KErrNotFound ); + } + + TBool wasEmpty = !iData.Count(); + + for ( TInt i = 0; i < settings.Count(); i++ ) + { + CItemMap* itemMap = settings[ i ]; + + // get properties + RPointerArray& properties + = itemMap->Properties(); + + CCarouselData* data = GetMenuDataL( properties ); + CleanupStack::PushL( data ); + if ( wasEmpty ) + { + // list of shortcut slot was empty + // we append the shortcut data slots one-by-one to the list + data->SetDirty( ETrue ); + iData.AppendL( data ); + CleanupStack::Pop( data ); + } + else + { + // check for updates in existing shortcut data slot + // if menuitem id has changed, replace the item and + // set as dirty + TInt id( iData[ i ]->MenuItem().Id() ); + + // id of all bookmarks is zero so name has to be check + // in case of bookmark has changed + if ( id >= 0 && ( data->MenuItem().Id() != id || + ( id == 0 && data->Name().CompareF( + iData[ i ]->Name() ) != 0 ) ) ) + { + data->SetDirty( ETrue ); + CCarouselData* oldData = iData[i]; + iData.Remove( i ); + delete oldData; + + iData.InsertL( data, i ); + CleanupStack::Pop( data ); + } + else + { + CleanupStack::PopAndDestroy( data ); + } + } + } + + // Leave if there isn't any data filled into array as there isn't + // anything shortcut to publish on homescreen. + if ( iData.Count() <= 0 ) + { + User::Leave( KErrNotFound ); + } + + // Cleanup. + CleanupStack::PopAndDestroy(); // settings + } + +// --------------------------------------------------------------------------- +// Removes obsolete data and saves 'Undefined' item to HSPS +// Used when active mailbox is deleted from system. +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::RemoveDataL( TInt aId ) + { + TInt count = iData.Count(); + for( TInt i = 0; i < count; i++ ) + { + CCarouselData* data = iData[i]; + if( data->MenuItem().Type() == KMenuTypeMailbox && + data->MenuItem().Id() == aId ) + { + iData[i]->MenuItem().SetId( KErrNotFound ); + iData[i]->SetDirty( ETrue ); + SaveUndefinedItemL( i ); + } + } + } + +// --------------------------------------------------------------------------- +// Call back from Homescreen settings +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::SettingsChangedL( const TDesC8& /*aEvent*/, const TDesC8& /*aPluginName*/, + const TDesC8& /*aPluginUid*/, const TDesC8& aPluginId ) + { + if( aPluginId.CompareF( iInstanceUid ) == 0 ) + { + UpdateDataL(); + } + } + +// --------------------------------------------------------------------------- +// Gets the menu item from engine using the setting properties as filter +// --------------------------------------------------------------------------- +// +CCarouselData* CCarouselPluginData::GetMenuDataL( + RPointerArray& aProperties ) + { + if ( aProperties.Count() <= 0 ) + { + User::Leave( KErrArgument ); + } + + TPtrC8 type; + TPtrC8 uid; + TPtrC8 view; + TPtrC8 param; + + // first we need to check the item type + for ( TInt i = 0; i < aProperties.Count(); i++ ) + { + if ( aProperties[i]->Name() == KProperNameType ) + { + type.Set( aProperties[i]->Value()); + } + else if( aProperties[i]->Name() == KProperNameUid) + { + uid.Set( aProperties[i]->Value()); + } + else if( aProperties[i]->Name() == KProperNameView) + { + view.Set( aProperties[i]->Value()); + } + else if( aProperties[i]->Name() == KProperNameParam ) + { + param.Set( aProperties[i]->Value()); + } + } + CCarouselData* data = new ( ELeave ) CCarouselData(); + CleanupStack::PushL( data ); + if( type == KProperValueBookmark ) + { + GetBkmDataL( uid, view, param, *data ); + } + else if( type == KProperValueFolder ) + { + GetFolderData( param, *data ); + } + else if( type == KProperValueMailbox ) + { + GetMailboxDataL( uid, param, *data ); + } + else + { + GetMCSDataL( aProperties, *data ); + } + CleanupStack::Pop( data ); + return data; + } + +// --------------------------------------------------------------------------- +// Creates bookmark data item. +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::GetBkmDataL( const TDesC8& aUid, const TDesC8& aView, const TDesC8& aParam, CCarouselData& aData ) + { + TMenuItem item; + + if( aUid.Length() > 0 ) + { + CMenuFilter* filter = CMenuFilter::NewLC(); + HBufC* name( NULL ); + HBufC* value( NULL ); + name = AiUtility::CopyToBufferL( name, KProperNameUid ); + CleanupStack::PushL( name ); + value = AiUtility::CopyToBufferL( value, aUid ); + CleanupStack::PushL( value ); + filter->HaveAttributeL( *name, *value ); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( name ); + item = iEngine.FindMenuItemL( *filter ); + CleanupStack::PopAndDestroy( filter ); + } + + item.SetType( KMenuTypeUrl ); + aData.SetMenuItem( item ); + + HBufC* view( NULL ); + view = AiUtility::CopyToBufferL( view, aView ); + CleanupStack::PushL( view ); + aData.SetValueL( *view ); + CleanupStack::PopAndDestroy( view ); + + HBufC* param( NULL ); + param = AiUtility::CopyToBufferL( param, aParam ); + CleanupStack::PushL( param ); + aData.SetNameL( *param ); + CleanupStack::PopAndDestroy( param ); + } + +// --------------------------------------------------------------------------- +// Creates folder data item. +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::GetFolderData( const TDesC8& aParam, CCarouselData& aData ) + { + // In folder case, we have to extract id from + // param attribute and return item with this id + // convert id to integer + TInt id; + TLex8 lextmp( aParam); + lextmp.Val( id ); + + TMenuItem item; + item.SetType( KMenuTypeFolder ); + item.SetId( id ); + aData.SetMenuItem( item ); + } + +// --------------------------------------------------------------------------- +// Creates mailbox data item. +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::GetMailboxDataL( const TDesC8& aUid, const TDesC8& aParam, CCarouselData& aData ) + { + TInt id( KErrNotFound ); + TLex8 lextmp( aUid); + lextmp.Val( id ); + + TMenuItem item; + item.SetType( KMenuTypeMailbox ); + item.SetId( id ); + aData.SetMenuItem( item ); + + HBufC* param( NULL ); + param = AiUtility::CopyToBufferL( param, aParam ); + CleanupStack::PushL( param ); + + aData.SetNameL( *param ); + + CleanupStack::PopAndDestroy( param ); + } + +// --------------------------------------------------------------------------- +// Gets data item from MCS +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::GetMCSDataL( RPointerArray& aProperties, + CCarouselData& aData) + { + CMenuFilter* filter = CMenuFilter::NewLC(); + + // Exclude 'view' and 'param' attributes from search criteria by default + // Criterias will be added to filter if setting defines them + filter->DoNotHaveAttributeL( KMenuAttrView ); + filter->DoNotHaveAttributeL( KMenuAttrParam ); + + // then add all property/value pairs to the filter + for ( TInt i = 0; i < aProperties.Count(); i++ ) + { + // skip the type property + if( aProperties[i]->Name() == KProperNameType ) + { + continue; + } + + HBufC* name( NULL ); + HBufC* value( NULL ); + name = AiUtility::CopyToBufferL( name, aProperties[i]->Name() ); + CleanupStack::PushL( name ); + value = AiUtility::CopyToBufferL( value, aProperties[i]->Value() ); + CleanupStack::PushL( value ); + + if ( value->Length() != 0 ) + { + filter->HaveAttributeL( *name, *value ); + } + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( name ); + } + + // locked property excluded from search pattern + filter->DoNotHaveAttributeL( KMenuAttrLocked ); + + TMenuItem item = iEngine.FindMenuItemL( *filter ); + CleanupStack::PopAndDestroy( filter ); + aData.SetMenuItem( item ); + } + +// --------------------------------------------------------------------------- +// Returns menu item for given index +// --------------------------------------------------------------------------- +// +CCarouselData& CCarouselPluginData::DataItemL( TInt aIndex ) + { + if( aIndex < 0 || aIndex >= iData.Count()) + { + User::Leave( KErrArgument ); + } + return *iData[aIndex]; + } + +// --------------------------------------------------------------------------- +// Save the undefined item. +// --------------------------------------------------------------------------- +// +void CCarouselPluginData::SaveUndefinedItemL( const TInt& aIndex ) + { + RPointerArray settingItems; + CleanupResetAndDestroyPushL( settingItems ); + + iPluginSettings->GetSettingsL( iInstanceUid, settingItems ); + if ( aIndex >= 0 && aIndex < settingItems.Count() ) + { + CItemMap* itemMap = settingItems[ aIndex ]; + + // get properties + RPointerArray& properties + = itemMap->Properties(); + + for ( TInt i = 0; i < properties.Count(); i++ ) + { + if ( properties[ i ]->Name() == KProperNameType ) + { + properties[ i ]->SetValueL( KProperValueAppl ); + } + else if ( properties[ i ]->Name() == KProperNameUid ) + { + properties[ i ]->SetValueL( KMenuAttrUndefUid ); + } + else if ( properties[ i ]->Name() == KProperNameView ) + { + properties[ i ]->SetValueL( KNullDesC8 ); + } + else if ( properties[ i ]->Name() == KProperNameParam ) + { + properties[ i ]->SetValueL( KNullDesC8 ); + } + else if ( properties[ i ]->Name() == KProperNameLocked ) + { + properties[i]->SetValueL( KNullDesC8 ); + } + } + } + // ETrue tells that modified settings are stored also to plugin reference + iPluginSettings->SetSettingsL( iInstanceUid, settingItems, ETrue ); + CleanupStack::PopAndDestroy(); // settingItems + } + +// End of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/src/carouselpluginengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/src/carouselpluginengine.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,841 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The engine class of MCS plugin. +* +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // For CVwsSessionWrapper +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include + +// User includes +#include "carouselpluginengine.h" +#include "carouselplugin.h" +#include "carouselplugindata.h" +#include "carouselpluginuids.hrh" + +// Constants +_LIT( KMyMenuData, "matrixmenudata" ); +_LIT( KSkin, "skin" ); +_LIT( KMif, "mif" ); +_LIT( KResourceDrive, "Z:" ); +_LIT( KResourceFile, "mcspluginres.rsc" ); +_LIT( KResPath, "\\resource\\" ); +_LIT( KMMApplication, "mm://" ); +_LIT( KHideExit2, "&exit=hide" ); +_LIT( KSetFocusString, "!setfocus?applicationgroup_name=" ); +_LIT( KApplicationGroupName, "applicationgroup_name" ); +_LIT( KIcon, "icon" ); +_LIT( KMenuAttrUndefUid, "0x99999991" ); +_LIT( KMenuIconFile, "aimcsplugin.mif" ); +_LIT( KMenuBookmarkIconId, "16386" ); +_LIT( KMenuBookmarkMaskId, "16387" ); +_LIT( KMenuMailboxIconId, "16388" ); +_LIT( KMenuMailboxMaskId, "16389" ); +_LIT( KMenuTypeMailbox, "menu:mailbox" ); +_LIT( KPrefix, "0x" ); + +const TUid KHomescreenUid = { AI_UID3_AIFW_COMMON }; +const TUid KMMUid = { 0x101F4CD2 }; +const TUid KMCSCmailUidValue = { 0x2001E277 }; +const TUid KMCSCmailMailboxViewIdValue = { 0x2 }; +const TUid KBrowserUid = { 0x10008D39 }; + +// ======== LOCAL FUNCTIONS ======== +// ---------------------------------------------------------------------------- +// NextIdToken +// ---------------------------------------------------------------------------- +// +static TPtrC NextIdToken( TLex& aLexer ) + { + aLexer.SkipSpace(); + aLexer.Mark(); + + while( !aLexer.Eos() && !aLexer.Peek().IsSpace() && aLexer.Peek() != ')' ) + { + aLexer.Inc(); + } + + return aLexer.MarkedToken(); + } + +// ---------------------------------------------------------------------------- +// Shows note dailog, with the given resource. +// ---------------------------------------------------------------------------- +// +static void ShowNoteDlgL( TInt aResource ) + { + HBufC* temp = StringLoader::LoadLC( aResource ); + + CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( + CAknNoteDialog::EConfirmationTone, + CAknNoteDialog::ENoTimeout ); + CleanupStack::PushL( dialog ); + dialog->SetTextL( temp->Des() ); + dialog->ExecuteDlgLD( R_MCS_DISABLE_OPEN_ITEM_DLG ); + CleanupStack::Pop( dialog ); + CleanupStack::PopAndDestroy( temp ); + } + +// ---------------------------------------------------------------------------- +// Parses uid in Hexadecimal format from the given string. +// ---------------------------------------------------------------------------- +// +TUid ParseHexUidFromString(const TDesC& aUidString ) + { + TUid uid( KNullUid ); + const TInt pos( aUidString.FindF( KPrefix ) ); + + if ( pos != KErrNotFound ) + { + TLex lex( aUidString.Mid( pos + KPrefix().Length() ) ); + + // Hex parsing needs unsigned int + TUint32 value( 0 ); + const TInt parseResult( lex.Val( value, EHex ) ); + + if ( parseResult == KErrNone ) + { + TInt32 value32( value ); + uid.iUid = value32; + } + } + return uid; + } + +// ---------------------------------------------------------------------------- +// Start transition effect. User has launched the application with the given uid. +// ---------------------------------------------------------------------------- +// +void StartEffect( TUid aUid ) + { + //start a full screen effect + GfxTransEffect::BeginFullScreen( + AknTransEffect::EApplicationStart, + TRect(), + AknTransEffect::EParameterType, + AknTransEffect::GfxTransParam( aUid, + AknTransEffect::TParameter::EActivateExplicitContinue )); + } + +// ============================ MEMBER FUNCTIONS =============================== +// ---------------------------------------------------------------------------- +// CMCSPluginEngine::CMCSPluginEngine +// +// ---------------------------------------------------------------------------- +// +CCarouselPluginEngine::CCarouselPluginEngine( CCarouselPlugin& aPlugin, + const TDesC8& aInstanceUid ) + : iPlugin( aPlugin ), iInstanceUid( aInstanceUid ) + { + } + +// ---------------------------------------------------------------------------- +// CMCSPluginEngine::NewL +// +// ---------------------------------------------------------------------------- +// +CCarouselPluginEngine* CCarouselPluginEngine::NewL( CCarouselPlugin& aPlugin, + const TDesC8& aInstanceUid ) + { + CCarouselPluginEngine* self = + new( ELeave ) CCarouselPluginEngine( aPlugin, aInstanceUid ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ---------------------------------------------------------------------------- +// CMCSPluginEngine::ConstructL +// +// ---------------------------------------------------------------------------- +// +void CCarouselPluginEngine::ConstructL() + { + TFullName resourceFile( KResourceDrive ); + resourceFile.Append( KResPath ); + resourceFile.Append( KResourceFile ); + BaflUtils::NearestLanguageFile( + CCoeEnv::Static()->FsSession(), + resourceFile ); + iResourceOffset = + CCoeEnv::Static()->AddResourceFileL( resourceFile ); + InitL(); + StartObservingL(); + + // Get "Undefined" item + CMenuFilter* filter = CMenuFilter::NewL(); + CleanupStack::PushL( filter ); + filter->HaveAttributeL( KMenuAttrUid, KMenuAttrUndefUid ); + iUndefinedItemHeader = FindMenuItemL( *filter ); + CleanupStack::PopAndDestroy( filter ); + iUndefinedItem = CMenuItem::OpenL( iMenu, iUndefinedItemHeader ); + } + +// ---------------------------------------------------------------------------- +// CMCSPluginEngine::~CMCSPluginEngine +// +// ---------------------------------------------------------------------------- +// +CCarouselPluginEngine::~CCarouselPluginEngine() + { + StopObserving(); + + delete iPluginData; + + // Notifier close has to be before iMenu close + iNotifier.Close(); + iMenu.Close(); + delete iWatcher; + delete iNotifyWatcher; + + CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); + + delete iUndefinedItem; + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::InitL +// +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::InitL() + { + iMenu.OpenL( KMyMenuData ); + iPluginData = CCarouselPluginData::NewL( *this, iInstanceUid ); + iWatcher = CCarouselPluginWatcher::NewL( CCarouselPluginWatcher::EOperation ); + + TInt err( iNotifier.Open( iMenu ) ); + + if ( err == KErrNone ) + { + iNotifyWatcher = CCarouselPluginWatcher::NewL( CCarouselPluginWatcher::ENotify ); + + iNotifier.Notify( 0, + RMenuNotifier::EItemsAddedRemoved, + iNotifyWatcher->iStatus ); + iNotifyWatcher->WatchNotify( this ); + } + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::StartObservingL +// +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::StartObservingL() + { + // registering to mailbox db. changes observing + iMsvSession = CMsvSession::OpenAsObserverL( *this ); + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::StopObserving +// +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::StopObserving() + { + delete iMsvSession; + iMsvSession = NULL; + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::MenuDataL +// +// --------------------------------------------------------------------------- +// +CCarouselData& CCarouselPluginEngine::MenuDataL( const TInt& aIndex ) + { + return iPluginData->DataItemL( aIndex ); + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::MenuItemCount +// +// --------------------------------------------------------------------------- +// +TInt CCarouselPluginEngine::MenuItemCount() + { + return iPluginData->DataCount(); + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::FindMenuItemL +// Returns the menu item header, which matches the given filter. +// --------------------------------------------------------------------------- +// +TMenuItem CCarouselPluginEngine::FindMenuItemL( CMenuFilter& aFilter ) + { + TMenuItem item; + const TInt root( iMenu.RootFolderL() ); + + RArray items; + CleanupClosePushL( items ); + + iMenu.GetItemsL( items, root, &aFilter, ETrue ); + + if ( items.Count() > 0 ) + { + item = items[0]; + } + + CleanupStack::PopAndDestroy( &items ); + + return item; + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::FetchMenuItemL +// Returns the actual menu item for the given header. +// --------------------------------------------------------------------------- +// +CMenuItem* CCarouselPluginEngine::FetchMenuItemL( CCarouselData& aData ) + { + CMenuItem* item = NULL; + + TRAP_IGNORE( item = CMenuItem::OpenL( iMenu, aData.MenuItem().Id() ) ); + + if( item ) + { + return item; + } + + if( aData.MenuItem().Type() == KMenuTypeUrl ) + { + item = CreateBkmItemL( aData ); + } + else if( aData.MenuItem().Type() == KMenuTypeMailbox ) + { + item = CreateMailboxItemL( aData); + } + + return item; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CMenuItem* CCarouselPluginEngine::CreateBkmItemL( CCarouselData& aData ) + { + CMenuItem* item( NULL ); + if( aData.MenuItem().Id() != KErrNotFound ) + { + item = CMenuItem::CreateL( iMenu, KMenuTypeUrl, 0, 0 ); + CleanupStack::PushL( item ); + item->SetAttributeL( KMenuAttrLongName, aData.Name() ); + item->SetAttributeL( KMenuAttrIconFile, KMenuIconFile ); + item->SetAttributeL( KMenuAttrIconId, KMenuBookmarkIconId ); + item->SetAttributeL( KMenuAttrMaskId, KMenuBookmarkMaskId ); + CleanupStack::Pop( item ); + } + return item; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CMenuItem* CCarouselPluginEngine::CreateMailboxItemL( CCarouselData& aData ) + { + CMenuItem* item( NULL ); + if( aData.MenuItem().Id() != KErrNotFound ) + { + item = CMenuItem::CreateL( iMenu, KMenuTypeMailbox, 0, 0 ); + CleanupStack::PushL( item ); + item->SetAttributeL( KMenuAttrLongName, aData.Name() ); + item->SetAttributeL( KMenuAttrIconFile, KMenuIconFile ); + item->SetAttributeL( KMenuAttrIconId, KMenuMailboxIconId ); + item->SetAttributeL( KMenuAttrMaskId, KMenuMailboxMaskId ); + CleanupStack::Pop( item ); + } + return item; + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::ItemIconL +// Returns MCS default icon if attribute is 'icon' else parses the +// skin definition from attribute and sets attributes to aMenuItem. +// --------------------------------------------------------------------------- +// +CGulIcon* CCarouselPluginEngine::ItemIconL( CMenuItem* aMenuItem, + const TDesC& aAttr ) + { + + CMenuItem* menuItem; + + // check if item exists in MCS + if ( aMenuItem ) + { + TUint32 flags = aMenuItem->Flags(); + TUint32 isHidden = flags & TMenuItem::EHidden; + TUint32 isMissing = flags & TMenuItem::EMissing; + + if ( iUndefinedItem && ( isHidden || isMissing ) ) + { + menuItem = iUndefinedItem; + } + else + { + menuItem = aMenuItem; + } + } + else + { + // item not found in MCS. Use Undefined Icon + menuItem = iUndefinedItem; + } + + CAknIcon* icon( NULL ); + CGulIcon* gIcon( NULL ); + TBool exists( ETrue ); + + if ( aAttr != KIcon ) + { + // Resolve secondary icon definition from attribute + TPtrC iconDef( menuItem->GetAttributeL( aAttr, exists ) ); + + if ( exists ) + { + exists = ConstructMenuItemForIconL( iconDef, *menuItem ); + } + } + + if ( exists ) + { + icon = MenuIconUtility::GetItemIconL( *menuItem ); + + if ( icon ) + { + CleanupStack::PushL( icon ); + + gIcon = CGulIcon::NewL( icon->Bitmap(), icon->Mask() ); + + // Detach and delete + icon->SetBitmap( NULL ); + icon->SetMask( NULL ); + + CleanupStack::PopAndDestroy( icon ); + } + } + + return gIcon; + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::ItemTextL +// Returns text string for the given attribute +// --------------------------------------------------------------------------- +// +TPtrC CCarouselPluginEngine::ItemTextL( CMenuItem* aMenuItem, const TDesC& aAttr ) + { + + CMenuItem* menuItem; + + // check if item exists in MCS + if ( aMenuItem ) + { + TUint32 flags = aMenuItem->Flags(); + TUint32 isHidden = flags & TMenuItem::EHidden; + TUint32 isMissing = flags & TMenuItem::EMissing; + + // if item is hidden or missing (mmc card removed) + // use "Undefined" text instead + if ( iUndefinedItem && ( isHidden || isMissing ) ) + { + menuItem = iUndefinedItem; + } + else + { + menuItem = aMenuItem; + } + } + else + { + // item not found in MCS. Use "Undefined" text + menuItem = iUndefinedItem; + } + + TBool exists( KErrNotFound ); + + TPtrC name( menuItem->GetAttributeL( aAttr, exists ) ); + + if ( exists ) + { + return name; + } + + return KNullDesC(); + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::LaunchItemL +// Calls the open command for the given menu item header +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::LaunchItemL( const TInt& aIndex ) + { + if ( iBackupRestore ) + { + ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM ); + return; + } + + CCarouselData& dataItem( iPluginData->DataItemL( aIndex ) ); + // run item based on its type + TPtrC type( dataItem.MenuItem().Type()); + + // run folder + if ( type == KMenuTypeFolder ) + { + LaunchFolderItemL( dataItem ); + } + else if( type == KMenuTypeUrl ) + { + LaunchBookmarkItemL( dataItem ); + } + else if( type == KMenuTypeMailbox ) + { + LaunchMailboxItemL( dataItem ); + } + else + { + LaunchMCSItemL( dataItem ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::LaunchFolderItemL( CCarouselData& aData ) + { + CMenuItem* item = NULL; + TRAP_IGNORE( item = CMenuItem::OpenL( iMenu, aData.MenuItem().Id() ) ); + + // item does not exist at all in MCS + if ( item == NULL ) + { + ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM_MISSING ); + return; + } + + CleanupStack::PushL( item ); + + StartEffect( KMMUid ); + + // message for MM application + HBufC8* message; + + // prepare message for launching folder + TBool hasApplicationGroupName( EFalse ); + + TPtrC applicationGroupName( item->GetAttributeL( + KApplicationGroupName, hasApplicationGroupName ) ); + + if ( !hasApplicationGroupName ) + { + return; + } + + message = HBufC8::NewLC( KMMApplication().Length() + + KSetFocusString().Length() + + applicationGroupName.Length() + + KHideExit2().Length() ); + + message->Des().Copy( KMMApplication ); + message->Des().Append( KSetFocusString ); + message->Des().Append( applicationGroupName ); + message->Des().Append( KHideExit2 ); + + // find MM application + TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); + TApaTask task( taskList.FindApp( KMMUid ) ); + + if ( task.Exists() ) + { + // MM is already running in background - send APA Message + task.SendMessage( + TUid::Uid( KUidApaMessageSwitchOpenFileValue ), *message ); + } + else + { + // MM not running yet - use Command Line Tail + RApaLsSession appArcSession; + CleanupClosePushL( appArcSession ); + + User::LeaveIfError( appArcSession.Connect() ); + + TApaAppInfo appInfo; + TInt err( appArcSession.GetAppInfo( appInfo, KMMUid ) ); + + if ( err == KErrNone ) + { + CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); + cmdLine->SetExecutableNameL( appInfo.iFullName ); + cmdLine->SetCommandL( EApaCommandRun ); + cmdLine->SetTailEndL( *message ); + appArcSession.StartApp( *cmdLine ); + CleanupStack::PopAndDestroy( cmdLine ); + } + CleanupStack::PopAndDestroy( &appArcSession ); + } + CleanupStack::PopAndDestroy( message ); + CleanupStack::PopAndDestroy( item ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::LaunchBookmarkItemL( CCarouselData& aData ) + { + StartEffect( KBrowserUid ); + + CSchemeHandler* urlHandler = CSchemeHandler::NewL( aData.Value()); + CleanupStack::PushL( urlHandler ); + urlHandler->HandleUrlStandaloneL(); + CleanupStack::PopAndDestroy( urlHandler ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::LaunchMailboxItemL( CCarouselData& aData ) + { + TInt id( aData.MenuItem().Id()); + if ( id == KErrNotFound ) + { + ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM_MISSING ); + return; + } + + StartEffect( KMCSCmailUidValue ); + + TUid uId = TUid::Uid( id ); + const TVwsViewId viewId( KMCSCmailUidValue, KMCSCmailMailboxViewIdValue ); + CVwsSessionWrapper* vwsSession = CVwsSessionWrapper::NewL(); + vwsSession->CreateActivateViewEvent( viewId, uId, KNullDesC8() ); + delete vwsSession; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::LaunchMCSItemL( CCarouselData& aData ) + { + if( iWatcher->IsActive()) + { + return; + } + CMenuItem* item = NULL; + TRAP_IGNORE( item = CMenuItem::OpenL( iMenu, aData.MenuItem().Id() ) ); + + // item does not exist at all in MCS + if ( item == NULL ) + { + ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM_MISSING ); + return; + } + + CleanupStack::PushL( item ); + + TBool attrExists = ETrue; + TPtrC uid = item->GetAttributeL( KMenuAttrUid, attrExists ); + + // trying to run hidden or missing application (e.g. unistalled app + // or app on MMC which was removed ) + // -> We display a note for a user that this is not possible¨ + TUint32 isHidden = item->Flags() & TMenuItem::EHidden; + TUint32 isMissing = item->Flags() & TMenuItem::EMissing; + + if ( ( attrExists && uid == KMenuAttrUndefUid ) || isHidden || isMissing ) + { + CleanupStack::PopAndDestroy( item ); + ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM_MISSING ); + return; + } + + if ( attrExists ) + { + StartEffect( ParseHexUidFromString( uid )); + } + + // run application/shortcut + CMenuOperation* operation( item->HandleCommandL( + KMenuCmdOpen, KNullDesC8, iWatcher->iStatus ) ); + iWatcher->Watch( operation ); + CleanupStack::PopAndDestroy( item ); + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::HandleNotifyL +// Handle the change in Menu Content +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::HandleNotifyL() + { + TInt count( iPluginData->DataCount() ); + + for ( TInt i = 0; i < count; i++ ) + { + CCarouselData& data( iPluginData->DataItemL( i ) ); + data.SetDirty( ETrue ); + } + + iPlugin.PublishL(); + + // Notification must be activated again + iNotifyWatcher->Cancel(); + iNotifier.Notify( 0, + RMenuNotifier::EItemsAddedRemoved, + iNotifyWatcher->iStatus ); + + iNotifyWatcher->WatchNotify( this ); + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::HandleSessionEventL +// Handles an event from the message server. +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::HandleSessionEventL( TMsvSessionEvent aEvent, + TAny* aArg1, TAny* /*aArg2*/, TAny* /*aArg3*/) + { + switch ( aEvent ) + { + case EMsvEntriesDeleted: + { + CMsvEntrySelection* sel = static_cast( aArg1 ); + TInt count( sel->Count()); + for( TInt i = 0; i < count; i++ ) + { + iPluginData->RemoveDataL( sel->At( i ) ); + } + } + break; + default: + break; + } + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::SetBackupRestore +// +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::SetBackupRestore( TBool aBackupRestore ) + { + iBackupRestore = aBackupRestore; + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::ShowSettingsL +// Launch General Settings plugin +// --------------------------------------------------------------------------- +// +void CCarouselPluginEngine::ShowSettingsL() + { + TUid uid = {AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN}; + + CGSLauncher* launcher = CGSLauncher::NewLC(); + launcher->LaunchGSViewL ( uid, KHomescreenUid, iInstanceUid ); + CleanupStack::PopAndDestroy( launcher ); + } + +// --------------------------------------------------------------------------- +// CMCSPluginEngine::ConstructMenuItemForIconL +// Syntax: skin(major minor):mif(filename bimapId maskId) +// --------------------------------------------------------------------------- +// +TBool CCarouselPluginEngine::ConstructMenuItemForIconL( const TDesC& aPath, + CMenuItem& aMenuItem ) + { + TInt pos( aPath.Locate( ':' ) ); + if ( pos == KErrNotFound ) + { + pos = aPath.Length(); + } + TPtrC skin( aPath.Left( pos ) ); + TInt sf( skin.FindF( KSkin ) ); + + if ( sf == KErrNotFound ) + { + return EFalse; + } + + TPtrC temp( skin.Mid( sf + KSkin().Length() ) ); + TLex input( temp ); + input.SkipSpace(); + + if ( !input.Eos() && input.Peek() == '(' ) + { + input.Inc(); + } + TPtrC majorId( NextIdToken( input ) ); + TPtrC minorId( NextIdToken( input ) ); + + aMenuItem.SetAttributeL( KMenuAttrIconSkinMajorId, majorId ); + aMenuItem.SetAttributeL( KMenuAttrIconSkinMinorId, minorId ); + + if ( aPath.Length() > pos && + ( aPath.Mid( pos + 1 ).FindF( KMif ) != KErrNotFound ) ) + { + TPtrC mif( aPath.Mid( pos + 1 ) ); + TInt mf( mif.FindF( KMif ) ); + + TLex input1( mif.Mid( mf + KMif().Length() ) ); + input1.SkipSpace(); + + if ( !input1.Eos() && input1.Peek() == '(' ) + { + input1.Inc(); + } + + TPtrC file( NextIdToken( input1 ) ); + TPtrC bitmapId( NextIdToken( input1 ) ); + TPtrC maskId( NextIdToken( input1 ) ); + + aMenuItem.SetAttributeL( KMenuAttrIconFile, file ); + aMenuItem.SetAttributeL( KMenuAttrIconId, bitmapId ); + aMenuItem.SetAttributeL( KMenuAttrMaskId, maskId ); + } + + return ETrue; + } + +// End of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/publisher/src/carouselpluginwatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/publisher/src/carouselpluginwatcher.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,124 @@ +/* +* 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: Menu item operation watcher. +* +*/ + +#include +#include "carouselpluginwatcher.h" +#include "carouselpluginengine.h" + +// --------------------------------------------------------------------------- +// two-phased constructor +// --------------------------------------------------------------------------- +CCarouselPluginWatcher* CCarouselPluginWatcher::NewL( const Type& aType ) + { + CCarouselPluginWatcher* self = new (ELeave) CCarouselPluginWatcher( aType ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// default constructor +// --------------------------------------------------------------------------- +CCarouselPluginWatcher::CCarouselPluginWatcher( const Type& aType ) + : CActive( CActive::EPriorityStandard ), + iType( aType ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +CCarouselPluginWatcher::~CCarouselPluginWatcher() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// second phase constructor +// --------------------------------------------------------------------------- +void CCarouselPluginWatcher::ConstructL() + { + + } + +// --------------------------------------------------------------------------- +// Watch Async +// --------------------------------------------------------------------------- +void CCarouselPluginWatcher::Watch( CMenuOperation* aOperation) + { + __ASSERT_DEBUG( KRequestPending == iStatus.Int(), User::Invariant() ); + //__ASSERT_DEBUG( !iOperation, User::Invariant() ); + iOperation = aOperation; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Watch Async +// --------------------------------------------------------------------------- +void CCarouselPluginWatcher::WatchNotify( MCarouselPluginWatcherObserver* aObserver ) + { + __ASSERT_DEBUG( KRequestPending == iStatus.Int(), User::Invariant() ); + //__ASSERT_DEBUG( !iOperation, User::Invariant() ); + iObserver = aObserver; + SetActive(); + } + +void CCarouselPluginWatcher::StopAndWatch( CMenuOperation* aOperation, + CActiveSchedulerWait* aWaitScheduler ) + { + __ASSERT_DEBUG( KRequestPending == iStatus.Int(), User::Invariant() ); + iWaitScheduler = aWaitScheduler; + iOperation = aOperation; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Inherited from CActive class +// --------------------------------------------------------------------------- +void CCarouselPluginWatcher::RunL() + { + delete iOperation; + iOperation = NULL; + + if( iType == ENotify ) + { + iObserver->HandleNotifyL(); + } + if ( iWaitScheduler && iWaitScheduler->IsStarted() ) + { + Cancel(); + iWaitScheduler->AsyncStop(); + } + //CActiveScheduler::Stop(); + } + +// --------------------------------------------------------------------------- +// Inherited from CActive class +// --------------------------------------------------------------------------- +void CCarouselPluginWatcher::DoCancel() + { + delete iOperation; + iOperation = NULL; + } + +TInt CCarouselPluginWatcher::GetStatus() + { + return iStatus.Int(); + } + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/renderer/data/carouselwidget.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/renderer/data/carouselwidget.rss Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Carousel widget for Symbian Homescreen + * + */ + +#include + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0xEabba432; +interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x200286DF; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0xEabba433; + version_no = 1; + display_name = "CarouselWidget"; + default_data = "carousel"; + opaque_data = ""; + } + }; + } + }; +} diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/renderer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/renderer/group/bld.inf Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Carousel widget for Symbian Homescreen + * + */ + + +#include + +PRJ_PLATFORMS +ARMV5 WINSCW + +PRJ_EXPORTS + +../rom/carouselwidget.iby CORE_MW_LAYER_IBY_EXPORT_PATH(carouselwidget.iby) + +PRJ_MMPFILES + +carouselwidget.mmp diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/renderer/group/carouselwidget.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/renderer/group/carouselwidget.mmp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Carousel widget for Symbian Homescreen + * + */ + +#include +#include + +TARGET carouselwidget.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0xEabba432 + +CAPABILITY CAP_ECOM_PLUGIN + +EPOCALLOWDLLDATA + +SOURCEPATH ../src +SOURCE carouselwidget.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE carouselwidget.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +END + +LIBRARY extrenderingplugin.lib +LIBRARY euser.lib +LIBRARY eikcore.lib +LIBRARY cone.lib +LIBRARY xn3layoutengine.lib +LIBRARY xn3utils.lib +LIBRARY xn3domdocument.lib +LIBRARY avkon.lib +LIBRARY ws32.lib +LIBRARY fbscli.lib +LIBRARY bitgdi.lib +LIBRARY egul.lib +LIBRARY bafl.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY gdi.lib +LIBRARY aknicon.lib +LIBRARY aknphysics.lib +LIBRARY AknSkins.lib diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/renderer/inc/carouselwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/renderer/inc/carouselwidget.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Carousel widget for Symbian Homescreen + * + */ + +#ifndef _CCAROUSELWIDGET_H +#define _CCAROUSELWIDGET_H + +// INCLUDES +#include +#include + +class MXnExtEventHandler; +class CCarouselItem; +class CAknPhysics; + +// Class declaration +NONSHARABLE_CLASS( CCarouselItem ) : public CBase + { +public: + + // Constructors + + /** + * C++ default constructor. + */ +CCarouselItem(/* CCarouselEditor& aEditor,*/ CFbsBitmap* aBitmap, CFbsBitmap* aMask); + + /** + * Destructor. + */ + ~CCarouselItem(); + + void SetTextL( const TDesC& aText ); + + CFbsBitmap* iBitmap; + CFbsBitmap* iMask; +private: + + HBufC* iText; + }; + +// CLASS DECLARATION + +/** +* +*/ +class CCarouselWidget : public CXnExtRenderingPluginAdapter, + public MAknPhysicsObserver + { + +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CCarouselWidget* NewL(); + + /** + * Destructor. + */ + virtual ~CCarouselWidget(); + +public: // from base classes + + /** + * From CCoeControl Handles key events. + * @since Series 60 3.1 + * @param aKeyEvent Key event. + * @param aType Event type. + * @return Key response + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + /** + * From CCoeControl + */ + void SetContainerWindowL( const CCoeControl &aContainer ); + + /** + * See CCoeControl documentation + */ + void HandlePointerEventL( const TPointerEvent& aPointerEvent ); + + /** + * From CCoeControl, CountComponentControls + * @return Number of component controls + */ + TInt CountComponentControls() const; + + /** + * From CCoeControl, ComponentControl + * @param aIndex index of component control + * @return pointer to the specified control + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * Skin change notification. + * See CXnControlAdapter documentation + * @since Series 60 3.1 + */ + void SkinChanged(); + + /** + * See CXnControlAdapter documentation + */ + void EnterPowerSaveModeL(); + + /** + * See CXnControlAdapter documentation + */ + void ExitPowerSaveModeL(); + + // From MAknPhysicsObserver + /** + * Physics emulation has moved the view. + */ + void ViewPositionChanged( const TPoint& aNewPosition, + TBool aDrawNow, TUint aFlags ); + + /** + * Called when emulation ended. + */ + void PhysicEmulationEnded(); + + /** + * Returns the observer view position. + * + * @return Physics observer view position. + */ + TPoint ViewPosition() const; + +protected: // from base classes + + /** + * From CCoeControl + * Called if focus changes + */ + void FocusChanged( TDrawNow aDrawNow ); + + /** + * From CCoeControl + * Called if position or size changes + */ + void SizeChanged(); + + /** + * Sets the external event handler interface. + * + * @since Series 60 5.2 + * @param aEventHandler Event handler interface. + */ + void SetEventHandler( MXnExtEventHandler* aEventHandler ); + + /** + * Routes the data stream for the external rendering plugin. + * + * @since Series 60 5.2 + * @param aData Data stream. + * @param aType Type of the stream. + * @param aIndex Index of the data. + */ + void SetDataL( const TDesC8& aData, const TDesC& aType, TInt aIndex ); + +private: // from base classes + + /** + * From CCoeControl, Draw + * See CCoeControl documentation + */ + void Draw( const TRect& aRect ) const; + +public: + + /** + * C++ default constructor. + */ + CCarouselWidget(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + TRect ViewPort() {return iViewPort; }; + +private: + void InitPhysicEngineL(); + + TInt ItemIndex( TPoint& aPoint ); + + void LaunchItemL( TPoint& aPosition ); + +private: // Member data + /** + * Physics. + * Own. + */ + CAknPhysics* iPhysics; + + MXnExtEventHandler* iEventHandler; // not own + + /** + * Pointer down start time. + */ + TTime iStartTime; + + /** + * Start (pointer down) position. + */ + TPoint iStartPosition; + + /** + * Current pointer position. + */ + TPoint iStylusPosition; + + /** + * Current view position. + */ + TPoint iCurrentPosition; + + /** + * Adjusted view position + */ + TPoint iViewPosition; + + /** + * Visible area, i.e. area of the scollable control that is to be drawn. + */ + TRect iViewPort; + + RPointerArray iStripeItems; + + TBool iDrawHighlight; + }; + +#endif // _CCAROUSELWIDGET_H +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/renderer/rom/carouselwidget.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/renderer/rom/carouselwidget.iby Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* IBY file for Carousel Widget +* +*/ + +#ifndef CAROUSELWIDGET_IBY +#define CAROUSELWIDGET_IBY + +ECOM_PLUGIN(carouselwidget.dll, carouselwidget.rsc) + +#endif // CAROUSELWIDGET_IBY + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/renderer/src/carouselwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/renderer/src/carouselwidget.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,443 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Carousel widget for Symbian Homescreen + * + */ + +#include +#include +#include +#include +#include +#include +#include "carouselwidget.h" + +const TSize KIconSize(70,70); +const TInt KItemPadding( 6 ); + +_LIT( KLaunchByIndex, "LaunchByIndex("); + +template< class PtrT > inline PtrT* UnpackPtr( + const TDesC8& aBuf ) + { + TAny* result( NULL ); + + if ( aBuf.Size() == sizeof( TAny* ) ) + { + // Effectively writes aBuf contents to result + TPckg< TAny* >( result ).Copy( aBuf ); + } + + return static_cast< PtrT* >( result ); + } +// ============================ MEMBER FUNCTIONS =============================== +CCarouselItem::CCarouselItem( CFbsBitmap* aBitmap, CFbsBitmap* aMask) + :iBitmap( aBitmap ), iMask( aMask ) + { + } + +CCarouselItem::~CCarouselItem() + { + delete iBitmap; + delete iMask; + delete iText; + } + +void CCarouselItem::SetTextL( const TDesC& aText ) + { + delete iText; + iText = NULL; + iText = aText.AllocL(); + } + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Symbian static 1st phase constructor +// ----------------------------------------------------------------------------- +// +CCarouselWidget* CCarouselWidget::NewL() + { + CCarouselWidget* self = new( ELeave ) CCarouselWidget(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// C++ destructor +// ----------------------------------------------------------------------------- +// +CCarouselWidget::~CCarouselWidget() + { + delete iPhysics; + iStripeItems.ResetAndDestroy(); + //delete iCover; + } + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// Handles key events. +// ----------------------------------------------------------------------------- +// +TKeyResponse CCarouselWidget::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/, + TEventCode /*aType*/ ) + { + return EKeyWasConsumed; + } + +// ----------------------------------------------------------------------------- +// Set window for this control +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::SetContainerWindowL( const CCoeControl &aContainer ) + { + CCoeControl::SetContainerWindowL( aContainer ); + } + +// ----------------------------------------------------------------------------- +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::HandlePointerEventL( const TPointerEvent& aPointerEvent ) + { + if( !iPhysics ) + { + return; + } + TPoint stylusPos( aPointerEvent.iPosition ); + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + iPhysics->StopPhysics(); + iPhysics->ResetFriction(); + iStartPosition = stylusPos; + iStartTime.HomeTime(); + iStylusPosition = stylusPos; + iDrawHighlight = ETrue; + } + break; + + case TPointerEvent::EButton1Up: + { + iDrawHighlight = EFalse; + TInt distance = iStartPosition.iX - stylusPos.iX; + if( Abs(distance) <= iPhysics->DragThreshold() ) + { + LaunchItemL( stylusPos ); + } + else + { + TPoint drag( distance, 0 ); + iPhysics->StartPhysics( drag, iStartTime ); + } } + break; + case TPointerEvent::EDrag: + case TPointerEvent::EMove: + { + TPoint dragTh( iStartPosition - stylusPos ); + if( Abs(dragTh.iX) > iPhysics->DragThreshold() || + Abs(dragTh.iY) > iPhysics->DragThreshold()) + { + iDrawHighlight = EFalse; + } + TInt deltaX( iStylusPosition.iX - stylusPos.iX ); + iStylusPosition = stylusPos; + TPoint deltaPoint( deltaX, 0 ); + iPhysics->RegisterPanningPosition( deltaPoint ); + } + break; + default: + break; + } + + CCoeControl::HandlePointerEventL( aPointerEvent ); + } + +// ----------------------------------------------------------------------------- +// Returns the number of component controls +// ----------------------------------------------------------------------------- +// +TInt CCarouselWidget::CountComponentControls() const + { + return 0; + } + +// ----------------------------------------------------------------------------- +// Returns the specified control +// ----------------------------------------------------------------------------- +// +CCoeControl* CCarouselWidget::ComponentControl( TInt /*aIndex*/ ) const + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// Skin change notification. +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::SkinChanged() + { + } + +// ----------------------------------------------------------------------------- +// CCarouselWidget::EnterPowerSaveModeL +// +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::EnterPowerSaveModeL() + { + } + +// ----------------------------------------------------------------------------- +// CCarouselWidget::ExitPowerSaveModeL +// +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::ExitPowerSaveModeL() + { + } + +// ----------------------------------------------------------------------------- +// Called if focus changes +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::FocusChanged( TDrawNow /*aDrawNow*/ ) + { + } + +// ----------------------------------------------------------------------------- +// Called if position or size changes +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::SizeChanged() + { + iViewPort = Rect(); + TRAP_IGNORE( InitPhysicEngineL() ); + DrawNow(); + } + +// ----------------------------------------------------------------------------- +// Sets the external event handler interface. +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::SetEventHandler( MXnExtEventHandler* aEventHandler ) + { + iEventHandler = aEventHandler; + } + +// ----------------------------------------------------------------------------- +// Data stream from the publisher +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::SetDataL( const TDesC8& aData, const TDesC& aType, TInt aIndex ) + { + /// Unpack the data stream, works because publisher is in same process. + CGulIcon* icon( UnpackPtr( aData ) ); + CleanupStack::PushL( icon ); + AknIconUtils::SetSize( icon->Bitmap(), KIconSize); + + CCarouselItem* item = new ( ELeave ) CCarouselItem(/* *iEditor,*/ icon->Bitmap(), icon->Mask() ); + CleanupStack::PopAndDestroy( icon ); + + if( aType == _L("Appstripe/widget")) + { + if( iStripeItems.Count() <= aIndex ) + { + iStripeItems.AppendL( item ); + InitPhysicEngineL(); + } + else + { + CCarouselItem* citem = iStripeItems[ aIndex ]; + delete citem; + iStripeItems.Remove( aIndex ); + iStripeItems.Insert( item, aIndex ); + } + DrawNow(); + } + } + +// ----------------------------------------------------------------------------- +// Draws the carousel component +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::Draw( const TRect& /*aRect*/ ) const + { + CWindowGc& gc( SystemGc() ); + gc.SetClippingRect( iViewPort ); + TRect bitmapRect( TPoint(0,0), KIconSize ); + TPoint point( iViewPort.iTl ); + point.iX -= iViewPosition.iX; + + TInt count = iStripeItems.Count(); + for( TInt i = 0; i < count; i++ ) + { + CFbsBitmap* bitmap = iStripeItems[i]->iBitmap; + CFbsBitmap* mask = iStripeItems[i]->iMask; + + TRect drawRect( point, KIconSize ); + if( iDrawHighlight && drawRect.Contains( iStylusPosition )) + { + TRect innerRect( drawRect ); + innerRect.Shrink( 5, 5 ); + + MAknsSkinInstance* skin( AknsUtils::SkinInstance() ); + AknsDrawUtils::DrawFrame( skin, gc, drawRect, innerRect, + KAknsIIDQsnFrHomePressed, KAknsIIDDefault ); + } + if( iViewPort.Contains( drawRect.iBr )|| + iViewPort.Contains( drawRect.iTl )) + { + gc.BitBltMasked( point, bitmap, bitmapRect, mask, EFalse); + } + point.iX += KIconSize.iWidth + KItemPadding; + } + } + +// --------------------------------------------------------------------------- +// ViewPositionChanged +// --------------------------------------------------------------------------- +// +void CCarouselWidget::ViewPositionChanged( + const TPoint& aNewPosition, TBool aDrawNow, TUint /*aFlags*/ ) + { + iCurrentPosition = aNewPosition; + iViewPosition.iX = aNewPosition.iX - iViewPort.Width()/2; + if( aDrawNow ) + { + DrawNow( iViewPort ); + } + } + +// --------------------------------------------------------------------------- +// PhysicEmulationEnded +// --------------------------------------------------------------------------- +// +void CCarouselWidget::PhysicEmulationEnded() + { + } + +// --------------------------------------------------------------------------- +// ViewPosition +// --------------------------------------------------------------------------- +// +TPoint CCarouselWidget::ViewPosition() const + { + return iCurrentPosition; + } + +// --------------------------------------------------------------------------- +// InitPhysicEngineL +// --------------------------------------------------------------------------- +// +void CCarouselWidget::InitPhysicEngineL() + { + // Init physic engine + if ( !iPhysics && CAknPhysics::FeatureEnabled() ) + { + iPhysics = CAknPhysics::NewL( *this, this ); + } + if( !iPhysics ) + { + return; + } + TSize viewPortSize = iViewPort.Size(); + TInt totalWidth( iStripeItems.Count() * (KIconSize.iWidth + KItemPadding )); + TSize totalSize( totalWidth, viewPortSize.iHeight ); + iPhysics->InitPhysicsL( totalSize, viewPortSize, ETrue ); + iCurrentPosition = TPoint( viewPortSize.iWidth / 2, viewPortSize.iHeight / 2 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CCarouselWidget::ItemIndex( TPoint& aPoint ) + { + TPoint itemStartPoint( iViewPort.iTl ); + itemStartPoint.iX -= iViewPosition.iX; + + TRect dropRect( itemStartPoint, KIconSize ); + dropRect.Resize( KItemPadding, 0 ); + TInt index( 0 ); + do + { + if( dropRect.Contains( aPoint )) + { + return index; + } + dropRect.Move( KIconSize.iWidth+KItemPadding, 0); + index++; + } + while( index < iStripeItems.Count() ); + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// Launches the item, which is in aPosition +// ----------------------------------------------------------------------------- +// +void CCarouselWidget::LaunchItemL( TPoint& aPosition ) + { + TInt index = ItemIndex( aPosition ); + // carousel plugin expects indexes to start from 1 + index++; + TInt len( KLaunchByIndex().Length()+3 ); + TBuf<17> event; + event.Append( KLaunchByIndex ); + event.AppendNum( index ); + event.Append( _L(")")); + iEventHandler->HandleEventL( event, _L8("Appstripe")); + } + +// ----------------------------------------------------------------------------- +// C++ default constructor +// ----------------------------------------------------------------------------- +// +CCarouselWidget::CCarouselWidget() + { + } + +// ============================ PUBLIC FUNCTIONS =============================== +const TImplementationProxy KImplementationTable[] = + { +#ifdef __EABI__ + IMPLEMENTATION_PROXY_ENTRY( 0xEabba433, CCarouselWidget::NewL ) +#else + { { 0xEabba433 }, CCarouselWidget::NewL } +#endif + }; + +// ----------------------------------------------------------------------------- +// Returns the list of implementations provided by the plugin +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy ); + return KImplementationTable; + } + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/sis/carousel.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/sis/carousel.pkg Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,33 @@ +; Installation file for carousel widget +; +; +; UID is the dll's UID +; +#{"Carousel Shortcut"},(0xE001CB57),1,0,0 + + +;Localised Vendor name +%{"HSExample"} + +;Unique Vendor name +:"HSExample" + +;Supports Series 60 v 5.0 +[0x1028315F], 1, 0, 0, {"S60ProductID"} + +;Publisher plug-in +"/epoc32/release/armv5/urel/carouselplugin.dll" -"c:/sys/bin/carouselplugin.dll" +"/epoc32/data/z/resource/plugins/carouselplugin.rsc" -"c:/resource/plugins/carouselplugin.rsc" + +;Renderer plug-in +"/epoc32/release/armv5/urel/carouselwidget.dll" -"c:/sys/bin/carouselwidget.dll" +"/epoc32/data/z/resource/plugins/carouselwidget.rsc" -"c:/resource/plugins/carouselwidget.rsc" + +;Widget declaration +"../widget/hsps/00/widgetconfiguration.xml" - "c:/private/200159c0/import/2001f48a/101fb657/1725ad3d/1.0/widgetconfiguration.xml" +"../widget/hsps/00/manifest.dat" - "c:/private/200159c0/import/2001f48a/101fb657/1725ad3d/1.0/manifest.dat" +"/epoc32/data/z/private/200159c0/install/appstripe/xuikon/00/appstripe.o0000" - "c:/private/200159c0/import/2001f48a/101fb657/1725ad3d/1.0/00/appstripe.o0000" +"../widget/xuikon/00/appstripe.dat" - "c:/private/200159c0/import/plugin_2001f48a_101fb657_1725ad3d_1.0.dat" + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/group/bld.inf Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Editor for carousel widget. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// Support for productization and Carbide.Ui customization +//******************************************************** +../hsps/00/manifest.dat /epoc32/data/Z/resource/homescreen/appstripe/hsps/manifest.dat +../hsps/00/widgetconfiguration.xml /epoc32/data/Z/resource/homescreen/appstripe/hsps/widgetconfiguration.xml +../xuikon/00/appstripe.dat /epoc32/data/Z/resource/homescreen/appstripe/xuikon/appstripe.dat +../xuikon/00/appstripe.css /epoc32/data/Z/resource/homescreen/appstripe/xuikon/appstripe.css +../xuikon/00/appstripe.xml /epoc32/data/Z/resource/homescreen/appstripe/xuikon/appstripe.xml +//../xuikon/00/appstripe.dtd /epoc32/data/Z/resource/homescreen/appstripe/xuikon/appstripe.dtd + +// Support for S60 builds +//*********************** +// export iby files +../rom/appstripe_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(appstripe_resources.iby) +../rom/appstripe_customer.iby CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(appstripe_customer.iby) +../rom/appstripe_variant.iby CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(appstripe_variant.iby) +../rom/appstripe.iby CORE_MW_LAYER_IBY_EXPORT_PATH(appstripe.iby) + + +// Dtd-localization +//***************** +PRJ_EXTENSIONS +START EXTENSION tools/dtd +OPTION SWITCH_LOC_FILE_NAME appstripe +OPTION DTD_TYPE widget +END + +PRJ_MMPFILES + +// build icons + +// build application + +PRJ_TESTMMPFILES + +//#endif + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/hsps/00/manifest.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/hsps/00/manifest.dat Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,30 @@ + + + + qhd_tch + + widget + + + 0x2001f48a + + + 0x101fb657 + + + 0x1725ad3d + + + App Stripe + appstripe + 1.0 + + + widgetconfiguration.xml + + + + appstripe.o0000 + + + \ No newline at end of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/hsps/00/widgetconfiguration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/hsps/00/widgetconfiguration.xml Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/rom/appstripe.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/rom/appstripe.iby Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __APPSTRIPE_IBY__ +#define __APPSTRIPE_IBY__ + +// Enabled by DTD-localization tools +data=ZPRIVATE\200159c0\install\appstripe\hsps\00\manifest.dat \private\200159c0\install\appstripe\hsps\00\manifest.dat +data=ZPRIVATE\200159c0\install\appstripe\xuikon\00\appstripe.o0000 \private\200159c0\install\appstripe\xuikon\00\appstripe.o0000 + +#endif // __APPSTRIPE_IBY__ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/rom/appstripe_customer.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/rom/appstripe_customer.iby Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __APPSTRIPE_CUSTOMER_IBY__ +#define __APPSTRIPE_CUSTOMER_IBY__ + +#endif // __APPSTRIPE_CUSTOMER_IBY__ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/rom/appstripe_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/rom/appstripe_resources.iby Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __APPSTRIPE_RESOURCES_IBY__ +#define __APPSTRIPE_RESOURCES_IBY__ + +// Enabled by DTD-localization tools, language specific + +#endif // __APPSTRIPE_RESOURCES_IBY__ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/rom/appstripe_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/rom/appstripe_variant.iby Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __APPSTRIPE_VARIANT_IBY__ +#define __APPSTRIPE_VARIANT_IBY__ + +// Enabled by variation tools, variant specific +data=ZPRIVATE\200159c0\install\appstripe\hsps\00\widgetconfiguration.xml \private\200159c0\install\appstripe\hsps\00\widgetconfiguration.xml + +#endif // __APPSTRIPE_VARIANT_IBY__ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/xuikon/00/appstripe.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/xuikon/00/appstripe.css Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,10 @@ +widget +{ + width:auto; + height:auto; + padding-top: 5px; + padding-bottom: 5px; + padding-left: 3px; + background-color: none; +} + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/xuikon/00/appstripe.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/xuikon/00/appstripe.dat Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,11 @@ + + + 2001CB4F + 101FB657 + 11001240 + AppStripeWidget + appstripe + 1.0 + appstripe.xml + appstripe.css + \ No newline at end of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/xuikon/00/appstripe.dtd diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/carouselwidgetexample/widget/xuikon/00/appstripe.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/carouselwidgetexample/widget/xuikon/00/appstripe.xml Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample.l01 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample.l01 Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + +// localized strings for language: UK English (01) +#define STR_HsContentControlApplication_1 "" +#define STR_HsContentControlApplication_2 "" +#define STR_HsContentControlApplication_3 "" +#define STR_HsContentControlApplication_4 "HS Content Control" +#define STR_HsContentControlApplication_5 "HS Content Control" diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample.loc Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + +#ifdef LANGUAGE_01 +#include "hscontentcontrolexample.l01" +#endif diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample.rss Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + +NAME HSCO + +#include +#include +#include +#include +#include "hscontentcontrolexample.loc" + +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE TBUF + { + buf = "HsContentControl"; + } + +RESOURCE EIK_APP_INFO r_application_hs_content_control_app_ui + { + cba = R_AVKON_SOFTKEYS_EXIT; + status_pane = r_application_status_pane; + menubar = r_application_options_menu; + } + +RESOURCE STATUS_PANE_APP_MODEL r_application_status_pane + { + panes = + { + SPANE_PANE + { + id = EEikStatusPaneUidNavi; + type = EAknCtNaviPane; + resource = r_navi_decorator; + } + + }; + } + +RESOURCE NAVI_DECORATOR r_navi_decorator + { + type = ENaviDecoratorControlTabGroup; + + control = TAB_GROUP + { + tab_width = EAknTabWidthWithOneTab; + + active = 0; + + tabs = + { + TAB + { + id = 0; + txt = "Active configuration"; + }, + TAB + { + id = 1; + txt = "Configurations"; + }, + TAB + { + id = 2; + txt = "Views"; + }, + TAB + { + id = 3; + txt = "Widgets"; + } + }; + + }; + } + + +RESOURCE MENU_BAR r_application_options_menu + { + } + +RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info + { + short_caption = STR_HsContentControlApplication_5; + caption_and_icon = CAPTION_AND_ICON_INFO + { + caption = STR_HsContentControlApplication_4; + number_of_icons = 0; + }; + } + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample_reg.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample_reg.loc Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + +// LOCALISATION STRINGS + +// Caption string for app. +#define qtn_caption_string "hscontentcontrolexample" + +// Short caption string for app. +#define qtn_short_caption_string "HW" + +#define qtn_loc_resource_file_1 "\\resource\\apps\\hscontentcontrolexample" + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/data/hscontentcontrolexample_reg.rss Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + +#include +#include +#include +#include +#include "hscontentcontrolexample_reg.loc" +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0xE88D7143 + +RESOURCE APP_REGISTRATION_INFO + { + app_file="hscontentcontrolexample"; + localisable_resource_file = qtn_loc_resource_file_1; + localisable_resource_id = R_LOCALISABLE_APP_INFO; + + embeddability=KAppNotEmbeddable; + newfile=KAppDoesNotSupportNewFile; + } + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/gfx/list_icon.bmp Binary file idlehomescreen/examples/hscontentcontrolexample/gfx/list_icon.bmp has changed diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/gfx/list_icon_mask.bmp Binary file idlehomescreen/examples/hscontentcontrolexample/gfx/list_icon_mask.bmp has changed diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/gfx/mark_icon.bmp Binary file idlehomescreen/examples/hscontentcontrolexample/gfx/mark_icon.bmp has changed diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/gfx/mark_icon_mask.bmp Binary file idlehomescreen/examples/hscontentcontrolexample/gfx/mark_icon_mask.bmp has changed diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/gfx/qgn_menu_hscontentcontrolexample.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/gfx/qgn_menu_hscontentcontrolexample.svg Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/group/Icons_aif_scalable_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/group/Icons_aif_scalable_dc.mk Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,83 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Content Control example +# +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\hscontentcontrolexample_aif.mif +HEADERDIR=$(EPOCROOT)epoc32\include +HEADERFILENAME=$(HEADERDIR)\hscontentcontrolexample_aif.mbg + +ICONDIR=..\gfx + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @echo ...Deleting $(ICONTARGETFILENAME) + del /q /f $(ICONTARGETFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: 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. +# ---------------------------------------------------------------------------- +# NOTE: if you have JUSTINTIME enabled for your S60 3rd FP1 or newer SDK +# and this command crashes, consider adding "/X" to the command line. +# See +# ---------------------------------------------------------------------------- + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : $(ICONDIR)\qgn_menu_hscontentcontrolexample.svg + mifconv $(ICONTARGETFILENAME) \ + /H$(HEADERFILENAME) \ + /c32,8 $(ICONDIR)\qgn_menu_hscontentcontrolexample.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/group/bld.inf Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + +PRJ_PLATFORMS +WINSCW ARMV5 GCCE + +PRJ_EXPORTS + +PRJ_MMPFILES + +gnumakefile icons_aif_scalable_dc.mk + +hscontentcontrolexample.mmp + +#include "../root/group/bld.inf" + +// End of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/group/hscontentcontrolexample.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/group/hscontentcontrolexample.mmp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + +#include +#include +APP_LAYER_SYSTEMINCLUDE +TARGET hscontentcontrolexample.exe +UID 0x100039CE 0xE88D7143 +VENDORID 0 +TARGETTYPE exe +EPOCSTACKSIZE 0x5000 + +CAPABILITY WriteDeviceData ReadDeviceData + +SYSTEMINCLUDE /epoc32/include /epoc32/include/variant /epoc32/include/ecom +USERINCLUDE ../inc ../data + +SOURCEPATH ../data +START RESOURCE hscontentcontrolexample.rss +HEADER +TARGETPATH resource/apps +END //RESOURCE + +START RESOURCE hscontentcontrolexample_reg.rss +TARGETPATH /private/10003a3f/apps +END //RESOURCE + +LIBRARY euser.lib apparc.lib cone.lib eikcore.lib avkon.lib +LIBRARY commonengine.lib efsrv.lib estor.lib eikcoctl.lib eikdlg.lib +LIBRARY eikctl.lib bafl.lib fbscli.lib aknnotify.lib aknicon.lib +LIBRARY etext.lib gdi.lib egul.lib insock.lib +LIBRARY ecom.lib InetProtUtil.lib http.lib esock.lib aknhlist.lib +LIBRARY aknskins.lib +LIBRARY hsccapiclient.lib +LIBRARY hscontentinfo.lib + +LANG 01 + +START BITMAP hscontentcontrolexample.mbm +HEADER +TARGETPATH /resource/apps +SOURCEPATH ../gfx +SOURCE c12,1 list_icon.bmp list_icon_mask.bmp +END + +SOURCEPATH ../src + +#ifdef ENABLE_ABIV2_MODE +DEBUGGABLE_UDEBONLY +#endif + +SOURCE HsContentControlListBox.cpp +SOURCE HsContentControlApplication.cpp +SOURCE HsContentControlAppUi.cpp +SOURCE HsContentControlDocument.cpp + +// End of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlAppUi.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + + +#ifndef HSCONTENTCONTROLAPPUI_H +#define HSCONTENTCONTROLAPPUI_H + +// [[[ begin generated region: do not modify [Generated Includes] +#include +#include +// ]]] end generated region [Generated Includes] + +// [[[ begin generated region: do not modify [Generated Forward Declarations] +class CHsContentControlListBox; +// ]]] end generated region [Generated Forward Declarations] + +/** + * @class CHsContentControlAppUi HsContentControlAppUi.h + * @brief The AppUi class handles application-wide aspects of the user interface, including + * container management and the default menu, control pane, and status pane. + */ +class CHsContentControlAppUi : public CAknAppUi + { +public: + // constructor and destructor + CHsContentControlAppUi(); + void ConstructL(); + virtual ~CHsContentControlAppUi(); + +public: + // from CEikAppUi + void HandleCommandL( TInt aCommand ); + void HandleResourceChangeL( TInt aType ); + +private: + void InitializeContainersL(); + // [[[ begin generated region: do not modify [Generated Methods] +public: + // ]]] end generated region [Generated Methods] + + // [[[ begin generated region: do not modify [Generated Instance Variables] +private: + CHsContentControlListBox* iHsContentControlListBox; + // ]]] end generated region [Generated Instance Variables] + + + // [[[ begin [Overridden Methods] +protected: + // ]]] end [Overridden Methods] + + + // [[[ begin [User Handlers] +protected: + // ]]] end [User Handlers] + + }; + +#endif // HSCONTENTCONTROLAPPUI_H diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlApplication.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + + +#ifndef HSCONTENTCONTROLAPPLICATION_H +#define HSCONTENTCONTROLAPPLICATION_H + +// [[[ begin generated region: do not modify [Generated Includes] +#include +// ]]] end generated region [Generated Includes] + +// [[[ begin generated region: do not modify [Generated Constants] +const TUid KUidHsContentControlApplication = { 0xE88D7143 }; +// ]]] end generated region [Generated Constants] + +/** + * + * @class CHsContentControlApplication HsContentControlApplication.h + * @brief A CAknApplication-derived class is required by the S60 application + * framework. It is subclassed to create the application's document + * object. + */ +class CHsContentControlApplication : public CAknApplication + { +private: + TUid AppDllUid() const; + CApaDocument* CreateDocumentL(); + + }; + +#endif // HSCONTENTCONTROLAPPLICATION_H diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlDocument.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + + +#ifndef HSCONTENTCONTROLDOCUMENT_H +#define HSCONTENTCONTROLDOCUMENT_H + +#include + +class CEikAppUi; + +/** +* @class CHsContentControlDocument HsContentControlDocument.h +* @brief A CAknDocument-derived class is required by the S60 application +* framework. It is responsible for creating the AppUi object. +*/ +class CHsContentControlDocument : public CAknDocument + { +public: + // constructor + static CHsContentControlDocument* NewL( CEikApplication& aApp ); + +private: + // constructors + CHsContentControlDocument( CEikApplication& aApp ); + void ConstructL(); + +public: + // from base class CEikDocument + CEikAppUi* CreateAppUiL(); + }; +#endif // HSCONTENTCONTROLDOCUMENT_H diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlListBox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlListBox.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + + +#ifndef __HSCONTENTCONTROLLISTBOX_H__ +#define __HSCONTENTCONTROLLISTBOX_H__ + +// Includes +#include +#include +#include +#include + +// Forward declarations +class MEikCommandObserver; +class CAknSingleStyleTreeList; +class CAknsBasicBackgroundControlContext; +class CAknNavigationDecorator; +class CAknTabGroup; +class CAknStylusPopUpMenu; +class CHsCcApiClient; +class CHsContentInfoArray; + +/** + * Container class for HsContentControlListBox + * + * @class CHsContentControlListBox HsContentControlListBox.h + */ +class CHsContentControlListBox : public CCoeControl, + public MAknTreeListObserver, + public MAknTabObserver, + public MEikMenuObserver, + public MHsContentControl + { +public: + // constructors and destructor + + /** + * Two-phased constructor. + */ + static CHsContentControlListBox* NewL( + const TRect& aRect, + const CCoeControl* aParent, + MEikCommandObserver* aCommandObserver ); + + /** + * Two-phased constructor. + */ + static CHsContentControlListBox* NewLC( + const TRect& aRect, + const CCoeControl* aParent, + MEikCommandObserver* aCommandObserver ); + + /** + * Destructor + */ + ~CHsContentControlListBox(); + +public: + // from CCoeControl + + /** + * @see CCoeControl + */ + TInt CountComponentControls() const; + + /** + * @see CCoeControl + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * @see CCoeControl + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * @see CCoeControl + */ + void HandleResourceChange( TInt aType ); + + /** + * @see CCoeControl + */ + void SizeChanged(); + + /** + * @see CCoeControl + */ + TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); + +private: + // from MAknTreeListObserver + + /** + * @see MAknTreeListObserver + */ + TInt HandleTreeListEvent( + CAknTreeList& aList, + TAknTreeItemID aItem, + TEvent aEvent ); + +private: + // From MEikMenuObserver + + /** + * @see MEikMenuObserver + */ + void ProcessCommandL( TInt aCommandId ); + + /** + * @see MEikMenuObserver + */ + void SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis ); + +private: + // from MAknTabObserver + + /** + * @see MAknTabObserver + */ + void TabChangedL( TInt aIndex ); + +private: + // from MHsContentControl + + /** + * @see MHsContentControl + */ + void NotifyWidgetListChanged(); + + /** + * @see MHsContentControl + */ + void NotifyViewListChanged(); + + /** + * @see MHsContentControl + */ + void NotifyAppListChanged(); + +private: + // new functions + + void InitializeControlsL(); + void LayoutControls(); + void PopulateListL(); + + static TInt PopulateList( TAny* aAny ); + +private: + // constructors + + /** + * C++ default constructor + */ + CHsContentControlListBox(); + + /** + * 2nd phase constructor + */ + void ConstructL( + const TRect& aRect, + const CCoeControl* aParent, + MEikCommandObserver* aCommandObserver ); + +private: + // data + + /** Homescreen content control client, owned */ + CHsCcApiClient* iHsCcApiClient; + /** Callback, owned */ + CAsyncCallBack* iCallback; + /** Popup menu, owned */ + CAknStylusPopUpMenu* iPopup; + /** List box, owned */ + CAknSingleStyleTreeList* iListBox; + /** Bg context, owned */ + CAknsBasicBackgroundControlContext* iBgContext; + /** Content info array, owned */ + CHsContentInfoArray* iArray; + /** Navigation decorator, owned */ + CAknNavigationDecorator* iDecorator; + /** Tab group, not owned */ + CAknTabGroup* iTabGroup; + /** Selected tree item */ + TAknTreeItemID iSelectedItem; + /** Active tab index */ + TInt iTabIndex; + }; + +#endif // __HSCONTENTCONTROLLISTBOX_H__ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/root/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/root/group/bld.inf Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// Support for productization and Carbide.Ui customization +../hsps/00/manifest.dat /epoc32/data/Z/resource/homescreen/root2/hsps/manifest.dat +../hsps/00/widgetconfiguration.xml /epoc32/data/Z/resource/homescreen/root2/hsps/widgetconfiguration.xml +../xuikon/00/root2.dat /epoc32/data/Z/resource/homescreen/root2/xuikon/root2.dat +../xuikon/00/root2.css /epoc32/data/Z/resource/homescreen/root2/xuikon/root2.css +../xuikon/00/root2.xml /epoc32/data/Z/resource/homescreen/root2/xuikon/root2.xml +//../xuikon/00/root2.dtd /epoc32/data/Z/resource/homescreen/root2/xuikon/root2.dtd + + +PRJ_EXTENSIONS +START EXTENSION tools/dtd +OPTION SWITCH_LOC_FILE_NAME root2 +OPTION DTD_TYPE widget +END +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/root/hsps/00/manifest.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/root/hsps/00/manifest.dat Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,19 @@ + + + qhd_tch + application + + 0x102750F0 + 0x101fb657 + 0x20102020 + + HS Configuration + root2 + 1.0 + + widgetconfiguration.xml + + + root2.o0000 + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/root/hsps/00/widgetconfiguration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/root/hsps/00/widgetconfiguration.xml Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/root/sis/hs_configuration_urel.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/root/sis/hs_configuration_urel.pkg Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,33 @@ +; Installation file for recentcallswidget dll +; +; This is an auto-generated PKG file by Carbide. +; This file uses variables specific to Carbide builds that will not work +; on command-line builds. If you want to use this generated PKG file from the +; command-line tools you will need to modify the variables with the appropriate +; values: $(EPOCROOT), $(PLATFORM), $(TARGET) + +; +; UID is the dll's UID +; +#{"HS 6 pages configuration"},(0x20102020),1,0,0 + + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Supports Series 60 v 5.0 +[0x1028315F], 0, 0, 0, {"S60ProductID"} + + +"../hsps/00/widgetconfiguration.xml" - "c:/private/200159C0/import/102750F0/101FB657/20102020/1.0/widgetconfiguration.xml" +"../hsps/00/manifest.dat" - "c:/private/200159C0/import/102750F0/101FB657/20102020/1.0/manifest.dat" + +"/epoc32/data/z/private/200159c0/install/root2/xuikon/00/root2.o0000" - "c:/private/200159C0/import/102750F0/101FB657/20102020/1.0/00/root2.o0000" + +"../xuikon/00/root2.dat" - "c:/private/200159C0/import/plugin_102750F0_101FB657_20102020_1.0.dat" + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/root/xuikon/00/root2.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/root/xuikon/00/root2.css Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,3 @@ +views +{ +} diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/root/xuikon/00/root2.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/root/xuikon/00/root2.dat Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,12 @@ + + + + 2001CB4F + 101FB657 + 11001241 + Anything + root2 + 1.0 + root2.xml + root2.css + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/root/xuikon/00/root2.dtd diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/root/xuikon/00/root2.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/root/xuikon/00/root2.xml Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,4 @@ + + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/sis/hscontentcontrolexample_urel.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/sis/hscontentcontrolexample_urel.pkg Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,36 @@ +; hscontentcontrolexample.pkg +; This is an auto-generated PKG file by Carbide. +; This file uses variables specific to Carbide builds that will not work +; on command-line builds. If you want to use this generated PKG file from the +; command-line tools you will need to modify the variables with the appropriate +; values: $(EPOCROOT), $(PLATFORM), $(TARGET) +; Also, the resource file entries should be changed to match the language +; used in the build. For example, if building for LANGUAGE_01, change the file +; extensions .rsc to .r01. +; +;Language - standard language definitions +&EN + +; standard SIS file header +#{"HS ContentControl"},(0xE88D7143),1,0,0 + +;Localised Vendor name +%{"Vendor-EN"} + +;Unique Vendor name +:"Vendor" + +;Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;Files to install +;You should change the source paths to match that of your environment +; +"\epoc32\release\armv5\urel\hscontentcontrolexample.exe" -"!:\sys\bin\hscontentcontrolexample.exe" +"\epoc32\data\z\resource\apps\hscontentcontrolexample.r01" -"!:\resource\apps\hscontentcontrolexample.r01" +"\epoc32\data\z\private\10003a3f\apps\hscontentcontrolexample_reg.r01" -"!:\private\10003a3f\import\apps\hscontentcontrolexample_reg.r01" +"\epoc32\data\z\resource\apps\hscontentcontrolexample_aif.mif" -"!:\resource\apps\hscontentcontrolexample_aif.mif" +"\epoc32\data\z\resource\apps\hscontentcontrolexample.mbm" -"!:\resource\apps\hscontentcontrolexample.mbm" +; Add any installation notes if applicable +;"hscontentcontrolexample.txt" -"!:\private\0xE88D7143\hscontentcontrolexample.txt" + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlAppUi.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + + +// [[[ begin generated region: do not modify [Generated System Includes] +#include +#include +// ]]] end generated region [Generated System Includes] + +// [[[ begin generated region: do not modify [Generated User Includes] +#include "HsContentControlAppUi.h" +#include "HsContentControlListBox.h" +// ]]] end generated region [Generated User Includes] + +// [[[ begin generated region: do not modify [Generated Constants] +// ]]] end generated region [Generated Constants] + +/** + * Construct the CHsContentControlAppUi instance + */ +CHsContentControlAppUi::CHsContentControlAppUi() + { + // [[[ begin generated region: do not modify [Generated Contents] + iHsContentControlListBox = NULL; + // ]]] end generated region [Generated Contents] + + } + +/** + * The appui's destructor removes the container from the control + * stack and destroys it. + */ +CHsContentControlAppUi::~CHsContentControlAppUi() + { + // [[[ begin generated region: do not modify [Generated Contents] + if ( iHsContentControlListBox != NULL ) + { + RemoveFromStack( iHsContentControlListBox ); + delete iHsContentControlListBox; + iHsContentControlListBox = NULL; + } + // ]]] end generated region [Generated Contents] + + } + +/** + * @brief Completes the second phase of Symbian object construction. + * Put initialization code that could leave here. + */ +void CHsContentControlAppUi::ConstructL() + { + // [[[ begin generated region: do not modify [Generated Contents] + + BaseConstructL( EAknEnableSkin | EAknEnableMSK | + EAknTouchCompatible | EAknSingleClickCompatible ); + + InitializeContainersL(); + // ]]] end generated region [Generated Contents] + + } + +// [[[ begin generated function: do not modify +void CHsContentControlAppUi::InitializeContainersL() + { + iHsContentControlListBox = CHsContentControlListBox::NewL( ClientRect(), NULL, this ); + iHsContentControlListBox->SetMopParent( this ); + AddToStackL( iHsContentControlListBox ); + + iHsContentControlListBox->DrawNow(); + } +// ]]] end generated function + +/** + * Handle a command for this appui (override) + * @param aCommand command id to be handled + */ +void CHsContentControlAppUi::HandleCommandL( TInt aCommand ) + { + // [[[ begin generated region: do not modify [Generated Code] + TBool commandHandled = EFalse; + switch ( aCommand ) + { // code to dispatch to the AppUi's menu and CBA commands is generated here + default: + break; + } + + + if ( !commandHandled ) + { + if ( aCommand == EAknSoftkeyExit || + aCommand == EAknSoftkeyBack || + aCommand == EEikCmdExit ) + { + Exit(); + } + } + // ]]] end generated region [Generated Code] + + } + +/** + * Override of the HandleResourceChangeL virtual function + */ +void CHsContentControlAppUi::HandleResourceChangeL( TInt aType ) + { + CAknAppUi::HandleResourceChangeL( aType ); + // [[[ begin generated region: do not modify [Generated Code] + // ]]] end generated region [Generated Code] + + } + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlApplication.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + + +// [[[ begin generated region: do not modify [Generated System Includes] +// ]]] end generated region [Generated System Includes] + +// [[[ begin generated region: do not modify [Generated Includes] +#include "HsContentControlApplication.h" +#include "HsContentControlDocument.h" +#ifdef EKA2 +#include +#endif +// ]]] end generated region [Generated Includes] + +/** + * @brief Returns the application's UID (override from CApaApplication::AppDllUid()) + * @return UID for this application (KUidHsContentControlApplication) + */ +TUid CHsContentControlApplication::AppDllUid() const + { + return KUidHsContentControlApplication; + } + +/** + * @brief Creates the application's document (override from CApaApplication::CreateDocumentL()) + * @return Pointer to the created document object (CHsContentControlDocument) + */ +CApaDocument* CHsContentControlApplication::CreateDocumentL() + { + return CHsContentControlDocument::NewL( *this ); + } + +#ifdef EKA2 + +/** + * @brief Called by the application framework to construct the application object + * @return The application (CHsContentControlApplication) + */ +LOCAL_C CApaApplication* NewApplication() + { + return new CHsContentControlApplication; + } + +/** +* @brief This standard export is the entry point for all Series 60 applications +* @return error code + */ +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + +#else // Series 60 2.x main DLL program code + +/** +* @brief This standard export constructs the application object. +* @return The application (CHsContentControlApplication) +*/ +EXPORT_C CApaApplication* NewApplication() + { + return new CHsContentControlApplication; + } + +/** +* @brief This standard export is the entry point for all Series 60 applications +* @return error code +*/ +GLDEF_C TInt E32Dll(TDllReason /*reason*/) + { + return KErrNone; + } + +#endif // EKA2 diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlDocument.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + + +// [[[ begin generated region: do not modify [Generated User Includes] +#include "HsContentControlDocument.h" +#include "HsContentControlAppUi.h" +// ]]] end generated region [Generated User Includes] + +/** + * @brief Constructs the document class for the application. + * @param anApplication the application instance + */ +CHsContentControlDocument::CHsContentControlDocument( CEikApplication& anApplication ) + : CAknDocument( anApplication ) + { + } + +/** + * @brief Completes the second phase of Symbian object construction. + * Put initialization code that could leave here. + */ +void CHsContentControlDocument::ConstructL() + { + } + +/** + * Symbian OS two-phase constructor. + * + * Creates an instance of CHsContentControlDocument, constructs it, and + * returns it. + * + * @param aApp the application instance + * @return the new CHsContentControlDocument + */ +CHsContentControlDocument* CHsContentControlDocument::NewL( CEikApplication& aApp ) + { + CHsContentControlDocument* self = new ( ELeave ) CHsContentControlDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +/** + * @brief Creates the application UI object for this document. + * @return the new instance + */ +CEikAppUi* CHsContentControlDocument::CreateAppUiL() + { + return new ( ELeave ) CHsContentControlAppUi; + } + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlListBox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlListBox.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,598 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Content Control example +* +*/ + + +// Includes +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "HsContentControlListBox.h" + +// Constants +const TInt KFlags( CAknSingleStyleTreeList::EPersistent | + CAknSingleStyleTreeList::EExpanded ); + +_LIT( KActivate, "Activate" ); + +enum TTabs + { + ETabFirst = 0, + ETabActiveConfiguration = ETabFirst, + ETabConfigurations, + ETabViews, + ETabWidgets, + ETabLast = ETabWidgets + }; + +// ============================ LOCAL FUNCTIONS ================================ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::CHsContentControlListBox +// +// ----------------------------------------------------------------------------- +// +CHsContentControlListBox::CHsContentControlListBox() + { + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::~CHsContentControlListBox +// +// ----------------------------------------------------------------------------- +// +CHsContentControlListBox::~CHsContentControlListBox() + { + delete iHsCcApiClient; + delete iCallback; + delete iPopup; + delete iListBox; + delete iBgContext; + delete iArray; + delete iDecorator; + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::NewL +// +// ----------------------------------------------------------------------------- +// +CHsContentControlListBox* CHsContentControlListBox::NewL( const TRect& aRect, + const CCoeControl* aParent, MEikCommandObserver* aCommandObserver ) + { + CHsContentControlListBox* self = + CHsContentControlListBox::NewLC( aRect, aParent, aCommandObserver ); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::NewLC +// +// ----------------------------------------------------------------------------- +// +CHsContentControlListBox* CHsContentControlListBox::NewLC( const TRect& aRect, + const CCoeControl* aParent, MEikCommandObserver* aCommandObserver ) + { + CHsContentControlListBox* self = new ( ELeave ) CHsContentControlListBox(); + CleanupStack::PushL( self ); + + self->ConstructL( aRect, aParent, aCommandObserver ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::ConstructL( const TRect& aRect, + const CCoeControl* aParent, MEikCommandObserver* /*aCommandObserver*/ ) + { + iHsCcApiClient = CHsCcApiClient::NewL( this ); + + TCallBack cb( PopulateList, this ); + + iCallback = new ( ELeave ) CAsyncCallBack( cb, CActive::EPriorityStandard ); + + if ( !aParent ) + { + CreateWindowL(); + } + else + { + SetContainerWindowL( *aParent ); + } + + InitializeControlsL(); + + SetRect( aRect ); + + ActivateL(); + + PopulateListL(); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::CountComponentControls +// +// ----------------------------------------------------------------------------- +// +TInt CHsContentControlListBox::CountComponentControls() const + { + return 1; + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::CHsContentControlListBox +// +// ----------------------------------------------------------------------------- +// +CCoeControl* CHsContentControlListBox::ComponentControl( TInt aIndex ) const + { + if ( aIndex == 0 ) + { + return iListBox; + } + + return NULL; + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::OfferKeyEventL +// +// ----------------------------------------------------------------------------- +// +TKeyResponse CHsContentControlListBox::OfferKeyEventL( + const TKeyEvent& aKeyEvent, TEventCode aType ) + { + if ( iListBox->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed ) + { + return EKeyWasConsumed; + } + + return CCoeControl::OfferKeyEventL( aKeyEvent, aType ); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::HandleResourceChange +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::HandleResourceChange( TInt aType ) + { + CCoeControl::HandleResourceChange( aType ); + + SetRect( iAvkonAppUi->ClientRect() ); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::SizeChanged +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::SizeChanged() + { + CCoeControl::SizeChanged(); + + LayoutControls(); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::MopSupplyObject +// +// ----------------------------------------------------------------------------- +// +TTypeUid::Ptr CHsContentControlListBox::MopSupplyObject( TTypeUid aId ) + { + if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext ) + { + return MAknsControlContext::SupplyMopObject( aId, iBgContext ); + } + + return CCoeControl::MopSupplyObject( aId ); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::HandleTreeListEvent +// +// ----------------------------------------------------------------------------- +// +TInt CHsContentControlListBox::HandleTreeListEvent( + CAknTreeList& /*aList*/, + TAknTreeItemID aItem, + TEvent aEvent ) + { + if ( aEvent == EItemSelected ) + { + if ( !iListBox->IsLeaf( aItem ) && !iListBox->IsMarked( aItem ) ) + { + return KErrNone; + } + + const TWsEvent& event( iCoeEnv->LastEvent() ); + + if ( event.Type() == EEventPointer ) + { + TInt x, y; + + TPointerEvent& pointer( *event.Pointer() ); + + x = pointer.iParentPosition.iX; + y = pointer.iParentPosition.iY; + + delete iPopup; + iPopup = NULL; + + iPopup = CAknStylusPopUpMenu::NewL( this, TPoint( x, y ) ); + + if ( iTabIndex == ETabConfigurations ) + { + iSelectedItem = aItem; + + iPopup->AddMenuItemL( KActivate, 1 ); + + iPopup->SetPosition( TPoint( x, y ), + CAknStylusPopUpMenu::EPositionTypeRightBottom ); + + iPopup->ShowMenu(); + } + } + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::ProcessCommandL +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::ProcessCommandL( TInt aCommandId ) + { + TAknTreeItemID item( iSelectedItem ); + + iSelectedItem = KAknTreeIIDNone; + + if ( item == KAknTreeIIDNone || aCommandId == KErrCancel ) + { + return; + } + + // Resolve selected item + if ( iTabIndex == ETabConfigurations ) + { + TAknTreeItemID id = iListBox->Child( KAknTreeIIDRoot, 0 ); + + TInt count( iListBox->ChildCount( id ) ); + + for ( TInt i = 0; i < count; i++ ) + { + if ( iListBox->Child( id, i ) == item ) + { + CHsContentInfo* info( iArray->Array()[i] ); + + TRAP_IGNORE( iHsCcApiClient->ActivateAppL( *info ) ); + + break; + } + } + } + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::SetEmphasis +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::SetEmphasis( CCoeControl* /*aMenuControl*/, + TBool /*aEmphasis*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::TabChangedL +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::TabChangedL( TInt aIndex ) + { + if ( aIndex != iTabIndex ) + { + iTabIndex = aIndex; + + iDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ERightButton, EFalse ); + + iDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ELeftButton, EFalse ); + + if ( iTabIndex == ETabFirst ) + { + iDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ELeftButton, ETrue ); + } + else if ( iTabIndex == ETabLast ) + { + iDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ERightButton, ETrue ); + } + + iCallback->Cancel(); + iCallback->CallBack(); + } + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::NotifyWidgetListChanged +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::NotifyWidgetListChanged() + { + iCallback->Cancel(); + iCallback->CallBack(); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::NotifyViewListChanged +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::NotifyViewListChanged() + { + iCallback->Cancel(); + iCallback->CallBack(); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::NotifyAppListChanged +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::NotifyAppListChanged() + { + iCallback->Cancel(); + iCallback->CallBack(); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::InitializeControlsL +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::InitializeControlsL() + { + iListBox = CAknSingleStyleTreeList::NewL( *this ); + iListBox->SetContainerWindowL( *this ); + iListBox->AddObserverL( this ); + iListBox->SetFocus( ETrue ); + + iBgContext = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgScreen, TRect(), ETrue ); + + CEikStatusPane* sp( iAvkonAppUi->StatusPane() ); + + TUid naviPaneUid( TUid::Uid( EEikStatusPaneUidNavi ) ); + + CAknNavigationControlContainer* naviPane = + static_cast< CAknNavigationControlContainer* >( sp->ControlL( naviPaneUid ) ); + + iDecorator = naviPane->ResourceDecorator(); + + iDecorator->MakeScrollButtonVisible( ETrue ); + + iDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ELeftButton, ETrue ); + + iDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ERightButton, EFalse ); + + iTabGroup = static_cast< CAknTabGroup* > ( iDecorator->DecoratedControl() ); + iTabGroup->SetObserver( this ); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::LayoutControls +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::LayoutControls() + { + iListBox->SetRect( Rect() ); + + TRect rect; + + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect ); + + iBgContext->SetRect( rect ); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::PopulateListL +// +// ----------------------------------------------------------------------------- +// +void CHsContentControlListBox::PopulateListL() + { + if ( !iListBox->IsEmpty( KAknTreeIIDRoot ) ) + { + // Remove all + iListBox->RemoveItem( KAknTreeIIDRoot, EFalse ); + } + + delete iArray; + iArray = NULL; + + if ( iTabIndex == ETabActiveConfiguration ) + { + CHsContentInfo* activeApp = CHsContentInfo::NewL(); + CleanupStack::PushL( activeApp ); + + // Get active homescreen configuration + iHsCcApiClient->ActiveAppL( *activeApp ); + + _LIT( KActiveConfiguration, "Active configuration" ); + + TAknTreeItemID root = iListBox->AddNodeL( + KAknTreeIIDRoot, KActiveConfiguration, KFlags, EFalse ); + + CHsContentInfoArray* viewList = CHsContentInfoArray::NewL(); + CleanupStack::PushL( viewList ); + + // Get view list from the active configuration + iHsCcApiClient->ViewListL( *activeApp, *viewList ); + + _LIT( KView, "View " ); + + for ( TInt j = 0; j < viewList->Array().Count(); j++ ) + { + TBuf< 32 > viewname; + viewname = KView(); + viewname.AppendNum( j + 1 ); + + CHsContentInfo* view( viewList->Array()[j] ); + + TAknTreeItemID parent = iListBox->AddNodeL( + root, viewname, KFlags, EFalse ); + + CHsContentInfoArray* widgetList = CHsContentInfoArray::NewL(); + CleanupStack::PushL( widgetList ); + + // Get widget list from the view + iHsCcApiClient->WidgetListL( *view, *widgetList ); + + for ( TInt k = 0; k < widgetList->Array().Count(); k++ ) + { + CHsContentInfo* widget( widgetList->Array()[k] ); + + iListBox->AddLeafL( parent, widget->Name(), KFlags, EFalse ); + } + + CleanupStack::PopAndDestroy( widgetList ); + } + + CleanupStack::PopAndDestroy( viewList ); + + CleanupStack::PopAndDestroy( activeApp ); + } + else if ( iTabIndex == ETabConfigurations ) + { + _LIT( KConfigurations, "Configurations" ); + + TAknTreeItemID root = iListBox->AddNodeL( + KAknTreeIIDRoot, KConfigurations, KFlags, EFalse ); + + iArray = CHsContentInfoArray::NewL(); + + // Get all homescreen configurations + iHsCcApiClient->AppListL( *iArray ); + + _LIT( KConfiguration, "Configuration " ); + + for ( TInt i = 0; i < iArray->Array().Count(); i++ ) + { + TBuf< 32 > confname; + confname = KConfiguration(); + confname.AppendNum( i + 1 ); + + CHsContentInfo* app( iArray->Array()[i] ); + + iListBox->AddLeafL( root, confname, KFlags, EFalse ); + } + } + + else if ( iTabIndex == ETabViews ) + { + _LIT( KViews, "Views" ); + + TAknTreeItemID root = iListBox->AddNodeL( + KAknTreeIIDRoot, KViews, KFlags, EFalse ); + + iArray = CHsContentInfoArray::NewL(); + + // Get all homescreen views + iHsCcApiClient->ViewListL( *iArray ); + + _LIT( KView, "View " ); + + for ( TInt i = 0; i < iArray->Array().Count(); i++ ) + { + TBuf< 32 > viewname; + viewname = KView(); + viewname.AppendNum( i + 1 ); + + CHsContentInfo* view( iArray->Array()[i] ); + + iListBox->AddLeafL( root, viewname, KFlags, EFalse ); + } + } + + else if ( iTabIndex == ETabWidgets ) + { + _LIT( KWidgets, "Widgets" ); + + TAknTreeItemID root = iListBox->AddNodeL( + KAknTreeIIDRoot, KWidgets, KFlags, EFalse ); + + iArray = CHsContentInfoArray::NewL(); + + // Get all homescreen widgets + iHsCcApiClient->WidgetListL( *iArray ); + + for ( TInt i = 0; i < iArray->Array().Count(); i++ ) + { + CHsContentInfo* widget( iArray->Array()[i] ); + + iListBox->AddLeafL( root, widget->Name(), KFlags, EFalse ); + } + } + + DrawNow(); + } + +// ----------------------------------------------------------------------------- +// CHsContentControlListBox::PopulateList +// +// ----------------------------------------------------------------------------- +// +/*static*/ TInt CHsContentControlListBox::PopulateList( TAny* aAny ) + { + CHsContentControlListBox* self = + static_cast< CHsContentControlListBox* >( aAny ); + + TRAP_IGNORE( self->PopulateListL() ); + + return KErrNone; + } + +// End of file diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/data/MCSExample.rls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/data/MCSExample.rls Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// LOCALISATION STRINGS + +// Caption string for app. +#define qtn_caption_string "MCSExample" + +// First item in "Options" menu pane +#define qtn_command1 "Message" + +// Second item in "Options" menu pane +#define qtn_command2 "List all items" + +#define qtn_help "Help" + +#define qtn_about "About" + +// Third item in "Options" menu pane +#define qtn_exit "Exit" + +// When user requests ECommand1 event, text below is shown. +#define qtn_command1_text "MCS example application." + +#define qtn_loc_resource_file_1 "\\resource\\apps\\MCSExample_0xEB753B18" + +#define qtn_about_dialog_title "About" + +#define qtn_about_dialog_text "MCSExample Version 1.0.0\n\nAuthor: Jaakko Haukipuro\n\nSupport: \n\n(c) " + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/data/MCSExample.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/data/MCSExample.rss Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,310 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// RESOURCE IDENTIFIER +NAME MCSE // 4 letter ID + + +// INCLUDES +#include +#include +#include +#include +#include "MCSExample.hrh" +#include "MCSExample.rls" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// ----------------------------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +// ----------------------------------------------------------------------------- +// +// Default Document Name +// +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name + { + buf="MCSE"; + } + +// ----------------------------------------------------------------------------- +// +// Define default menu and CBA key. +// +// ----------------------------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar = r_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + +// ----------------------------------------------------------------------------- +// +// r_menubar +// Main menubar +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_menubar + { + titles = + { + MENU_TITLE { menu_pane = r_menu; } + }; + } + + +// ----------------------------------------------------------------------------- +// +// r_menu +// Menu for "Options" +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_menu + { + items = + { + // added the new Options menu command here + MENU_ITEM + { + command = ECommand1; + txt = qtn_command1; + }, + MENU_ITEM + { + command = ECommand2; + txt = qtn_command2; + }, + MENU_ITEM + { + command = EHelp; + txt = qtn_help; + }, + MENU_ITEM + { + command = EAbout; + txt = qtn_about; + }, + MENU_ITEM + { + command = EAknSoftkeyExit; + txt = qtn_exit; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// About dialog resource. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_about_query_dialog + { + flags = EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + itemflags = EEikDlgItemNonFocusing; + control = AVKON_HEADING + { + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + } + +RESOURCE DIALOG r_icon_query_dialog + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + form = r_icon_form; + } + +RESOURCE FORM r_icon_form + { + flags = EEikFormUseDoubleSpacedFormat|EEikFormEditModeOnly; + items = + { + DLG_LINE + { + type = EEikCtEdwin; + prompt = "Major skin ID"; + id = EMyFirstLine; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + width = 30; + maxlength = 30; + // added to limit expanding in forms. + // If you want full screen use 6 here + max_view_height_in_lines = 1; + // if you have the line above, you must have this. + // It's calculable from LAF + base_line_delta = 21; + }; + }, + DLG_LINE + { + type = EEikCtEdwin; + prompt = "Minor skin ID"; + id = EMySecondLine; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + width = 30; + maxlength = 30; + // added to limit expanding in forms. + // If you want full screen use 6 here + max_view_height_in_lines = 1; + // if you have the line above, you must have this. + // It's calculable from LAF + base_line_delta = 21; + }; + }, + DLG_LINE + { + type = EEikCtEdwin; + prompt = "MIF/MBM file name"; + id = EMyThirdLine; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + width = 30; + maxlength = 30; + // added to limit expanding in forms. + // If you want full screen use 6 here + max_view_height_in_lines = 1; + // if you have the line above, you must have this. + // It's calculable from LAF + base_line_delta = 21; + }; + }, + DLG_LINE + { + type = EEikCtEdwin; + prompt = "MIF/MBM bitmap ID"; + id = EMyFourthLine; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + width = 30; + maxlength = 30; + // added to limit expanding in forms. + // If you want full screen use 6 here + max_view_height_in_lines = 1; + // if you have the line above, you must have this. + // It's calculable from LAF + base_line_delta = 21; + }; + }, + DLG_LINE + { + type = EEikCtEdwin; + prompt = "MIF/MBM mask ID"; + id = EMyFifthLine; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + width = 30; + maxlength = 30; + // added to limit expanding in forms. + // If you want full screen use 6 here + max_view_height_in_lines = 1; + // if you have the line above, you must have this. + // It's calculable from LAF + base_line_delta = 21; + }; + }, + DLG_LINE + { + type = EEikCtEdwin; + prompt = "Presenceicon"; + id = EMySixthLine; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + width = 30; + maxlength = 30; + // added to limit expanding in forms. + // If you want full screen use 6 here + max_view_height_in_lines = 1; + // if you have the line above, you must have this. + // It's calculable from LAF + base_line_delta = 21; + }; + } + }; + } + + + +// ----------------------------------------------------------------------------- +// +// Resources for messages. +// +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF32 r_caption_string { buf=qtn_caption_string; } +RESOURCE TBUF32 r_about_dialog_title { buf=qtn_about_dialog_title; } +RESOURCE TBUF r_about_dialog_text { buf=qtn_about_dialog_text; } +RESOURCE TBUF r_command1_text { buf=qtn_command1_text; } + + +// ---------------------------------------------------------------------------- +// +// r_localisable_app_info +// +// ---------------------------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info + { + short_caption = qtn_caption_string; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_caption_string; + + number_of_icons = 1; + icon_file = "\\resource\\apps\\MCSExample_0xEB753B18.mif"; + }; + } + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/data/MCSExample_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/data/MCSExample_reg.rss Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MCSExample.hrh" +#include "MCSExample.rls" +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 _UID3 + +RESOURCE APP_REGISTRATION_INFO + { + app_file="MCSExample_0xEB753B18"; + localisable_resource_file = qtn_loc_resource_file_1; + localisable_resource_id = R_LOCALISABLE_APP_INFO; + + embeddability=KAppNotEmbeddable; + newfile=KAppDoesNotSupportNewFile; + } + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/gfx/qgn_menu_MCSExample.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/gfx/qgn_menu_MCSExample.svg Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/group/Icons_scalable_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/group/Icons_scalable_dc.mk Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,64 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\MCSExample_0xEB753B18.mif + +ICONDIR=..\gfx + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @echo ...Deleting $(ICONTARGETFILENAME) + del /q /f $(ICONTARGETFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# NOTE: if you have JUSTINTIME enabled for your S60 3rd FP1 or newer SDK +# and this command crashes, consider adding "/X" to the command line. +# See +# ---------------------------------------------------------------------------- + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : $(ICONDIR)\qgn_menu_MCSExample.svg + mifconv $(ICONTARGETFILENAME) \ + /c32 $(ICONDIR)\qgn_menu_MCSExample.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/group/MCSExample.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/group/MCSExample.mmp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +APP_LAYER_SYSTEMINCLUDE + + +TARGET MCSExample_0xEB753B18.exe +TARGETTYPE exe +UID 0x100039CE 0xEB753B18 + +SOURCEPATH ..\src +SOURCE MCSExample.cpp +SOURCE MCSExampleApplication.cpp +SOURCE MCSExampleAppView.cpp +SOURCE MCSExampleAppUi.cpp +SOURCE MCSExampleDocument.cpp +SOURCE mcspluginwatcher.cpp + +SOURCEPATH ..\data + +START RESOURCE MCSExample.rss +HEADER +TARGET MCSExample_0xEB753B18 +TARGETPATH resource\apps +END //RESOURCE + +START RESOURCE MCSExample_reg.rss +TARGET MCSExample_0xEB753B18_reg +TARGETPATH \private\10003a3f\apps +END //RESOURCE + + + +USERINCLUDE ..\inc + +SYSTEMINCLUDE \epoc32\include + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY avkon.lib +LIBRARY aknicon.lib +LIBRARY bafl.lib +LIBRARY commonengine.lib +LIBRARY aknnotify.lib +LIBRARY fbscli.lib +LIBRARY egul.lib +LIBRARY mcsmenu.lib +LIBRARY mcsextendedmenu.lib +LIBRARY eikdlg.lib + + +LANG SC + +VENDORID 0 +SECUREID 0xEB753B18 +CAPABILITY ReadUserData ReadDeviceData WriteDeviceData + +#ifdef ENABLE_ABIV2_MODE + DEBUGGABLE_UDEBONLY +#endif +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/group/bld.inf Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +PRJ_PLATFORMS +WINSCW ARMV5 GCCE + +PRJ_MMPFILES + +gnumakefile icons_scalable_dc.mk + +MCSExample.mmp + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/inc/MCSExample.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/inc/MCSExample.hrh Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MCSEXAMPLE_HRH__ +#define __MCSEXAMPLE_HRH__ + +#define _UID3 0xEB753B18 + +// MCSExample enumerate command codes +enum TMCSExampleIds + { + ECommand1 = 0x6001, // start value must not be 0 + ECommand2, + EHelp, + EAbout + }; + +enum TMyControlIds + { + EMyFirstLine = 100, + EMySecondLine, + EMyThirdLine, + EMyFourthLine, + EMyFifthLine, + EMySixthLine + }; + +#endif // __MCSEXAMPLE_HRH__ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/inc/MCSExample.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/inc/MCSExample.pan Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MCSEXAMPLE_PAN__ +#define __MCSEXAMPLE_PAN__ + +/** MCSExample application panic codes */ +enum TMCSExamplePanics + { + EMCSExampleUi = 1 + // add further panics here + }; + +inline void Panic(TMCSExamplePanics aReason) + { + _LIT(applicationName, "MCSExample"); + User::Panic(applicationName, aReason); + } + +#endif // __MCSEXAMPLE_PAN__ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/inc/MCSExampleAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/inc/MCSExampleAppUi.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MCSEXAMPLEAPPUI_h__ +#define __MCSEXAMPLEAPPUI_h__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CMCSExampleAppView; + +// CLASS DECLARATION +/** + * CMCSExampleAppUi application UI class. + * Interacts with the user through the UI and request message processing + * from the handler class + */ +class CMCSExampleAppUi : public CAknAppUi + { +public: + // Constructors and destructor + + /** + * ConstructL. + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * CMCSExampleAppUi. + * C++ default constructor. This needs to be public due to + * the way the framework constructs the AppUi + */ + CMCSExampleAppUi(); + + /** + * ~CMCSExampleAppUi. + * Virtual Destructor. + */ + virtual ~CMCSExampleAppUi(); + +private: + // Functions from base classes + + /** + * From CEikAppUi, HandleCommandL. + * Takes care of command handling. + * @param aCommand Command to be handled. + */ + void HandleCommandL(TInt aCommand); + + /** + * HandleStatusPaneSizeChange. + * Called by the framework when the application status pane + * size is changed. + */ + void HandleStatusPaneSizeChange(); + + /** + * From CCoeAppUi, HelpContextL. + * Provides help context for the application. + * size is changed. + */ + CArrayFix* HelpContextL() const; + +private: + // Data + + /** + * The application view + * Owned by CMCSExampleAppUi + */ + CMCSExampleAppView* iAppView; + + }; + +#endif // __MCSEXAMPLEAPPUI_h__ +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/inc/MCSExampleAppView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/inc/MCSExampleAppView.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MCSEXAMPLEAPPVIEW_h__ +#define __MCSEXAMPLEAPPVIEW_h__ + +// INCLUDES +#include +#include +#include +#include +#include // MEikListBoxObserver +#include + +class CMCSExampleWatcher; + +struct TMyData + { +public: // data + TBuf<256> majorID; + TBuf<256> minorID; + TBuf<256> iconFile; + TBuf<256> iconID; + TBuf<256> maskID; + TBuf<256> statusIcon; + TBool updated; + }; + +class CMyForm : public CAknForm + { +public: // construction + CMyForm( TMyData& aData ); + virtual ~CMyForm(); +public: // from CAknForm + //void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + //void ProcessCommandL( TInt aCommandId ); + TBool SaveFormDataL(); + void DoNotSaveFormDataL(); + //void AddItemL() ; + void PreLayoutDynInitL(); + //MEikDialogPageObserver::TFormControlTypes + // ConvertCustomControlTypeToBaseControlType( TInt aControlType ) const; +protected: + TBool OkToExitL( TInt aButtonId ); + +private: + void LoadFormDataL(); +private: // data + TMyData& iData; + }; + + + +// CLASS DECLARATION +class CMCSExampleAppView : public CCoeControl, public MEikListBoxObserver + { +public: + // New methods + + /** + * NewL. + * Two-phased constructor. + * Create a CMCSExampleAppView 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 CMCSExampleAppView. + */ + static CMCSExampleAppView* NewL(const TRect& aRect); + + /** + * NewLC. + * Two-phased constructor. + * Create a CMCSExampleAppView object, which will draw itself + * to aRect. + * @param aRect Rectangle this view will be drawn to. + * @return A pointer to the created instance of CMCSExampleAppView. + */ + static CMCSExampleAppView* NewLC(const TRect& aRect); + + /** + * ~CMCSExampleAppView + * Virtual Destructor. + */ + virtual ~CMCSExampleAppView(); + + void ListAllItemsL(); + +public: + // Functions from base classes + + /** + * From CCoeControl, Draw + * Draw this CMCSExampleAppView 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(); + + /** + * From CoeControl, HandlePointerEventL. + * Called by framework when a pointer touch event occurs. + * Note: although this method is compatible with earlier SDKs, + * it will not be called in SDKs without Touch support. + * @param aPointerEvent the information about this event + */ + virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + CCoeControl* ComponentControl( TInt aIndex) const; + + TInt CountComponentControls() const; + + void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); + +private: + // Constructors + + /** + * ConstructL + * 2nd phase constructor. + * Perform the second phase construction of a + * CMCSExampleAppView object. + * @param aRect The rectangle this view will be drawn to. + */ + void ConstructL(const TRect& aRect); + + /** + * CMCSExampleAppView. + * C++ default constructor. + */ + CMCSExampleAppView(); + + CDesCArray* GetArrayL(CArrayPtr* aIcons); + void MakeListBoxL(void); + void UpdateScrollBar(CEikListBox* aListBox); + void ShowFormL( TInt aItemIndex); + + RMenu iMCSMenu; + CAknSingleLargeStyleListBox* iListBox; + RArray iItemArray; + /** MCS asynchronous operation watcher, owned */ + CMCSExampleWatcher* iWatcher; + }; + +#endif // __MCSEXAMPLEAPPVIEW_h__ +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/inc/MCSExampleApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/inc/MCSExampleApplication.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MCSEXAMPLEAPPLICATION_H__ +#define __MCSEXAMPLEAPPLICATION_H__ + +// INCLUDES +#include +#include "MCSExample.hrh" + +// UID for the application; +// this should correspond to the uid defined in the mmp file +const TUid KUidMCSExampleApp = + { + _UID3 + }; + +// CLASS DECLARATION + +/** + * CMCSExampleApplication application class. + * Provides factory to create concrete document object. + * An instance of CMCSExampleApplication is the application part of the + * AVKON application framework for the MCSExample example application. + */ +class CMCSExampleApplication : public CAknApplication + { +public: + // Functions from base classes + + /** + * From CApaApplication, AppDllUid. + * @return Application's UID (KUidMCSExampleApp). + */ + TUid AppDllUid() const; + +protected: + // Functions from base classes + + /** + * From CApaApplication, CreateDocumentL. + * Creates CMCSExampleDocument document object. The returned + * pointer in not owned by the CMCSExampleApplication object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + }; + +#endif // __MCSEXAMPLEAPPLICATION_H__ +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/inc/MCSExampleDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/inc/MCSExampleDocument.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MCSEXAMPLEDOCUMENT_h__ +#define __MCSEXAMPLEDOCUMENT_h__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CMCSExampleAppUi; +class CEikApplication; + +// CLASS DECLARATION + +/** + * CMCSExampleDocument application class. + * An instance of class CMCSExampleDocument is the Document part of the + * AVKON application framework for the MCSExample example application. + */ +class CMCSExampleDocument : public CAknDocument + { +public: + // Constructors and destructor + + /** + * NewL. + * Two-phased constructor. + * Construct a CMCSExampleDocument for the AVKON application aApp + * using two phase construction, and return a pointer + * to the created object. + * @param aApp Application creating this document. + * @return A pointer to the created instance of CMCSExampleDocument. + */ + static CMCSExampleDocument* NewL(CEikApplication& aApp); + + /** + * NewLC. + * Two-phased constructor. + * Construct a CMCSExampleDocument for the AVKON application aApp + * using two phase construction, and return a pointer + * to the created object. + * @param aApp Application creating this document. + * @return A pointer to the created instance of CMCSExampleDocument. + */ + static CMCSExampleDocument* NewLC(CEikApplication& aApp); + + /** + * ~CMCSExampleDocument + * Virtual Destructor. + */ + virtual ~CMCSExampleDocument(); + +public: + // Functions from base classes + + /** + * CreateAppUiL + * From CEikDocument, CreateAppUiL. + * Create a CMCSExampleAppUi object and return a pointer to it. + * The object returned is owned by the Uikon framework. + * @return Pointer to created instance of AppUi. + */ + CEikAppUi* CreateAppUiL(); + +private: + // Constructors + + /** + * ConstructL + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * CMCSExampleDocument. + * C++ default constructor. + * @param aApp Application creating this document. + */ + CMCSExampleDocument(CEikApplication& aApp); + + }; + +#endif // __MCSEXAMPLEDOCUMENT_h__ +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/inc/mcspluginwatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/inc/mcspluginwatcher.h Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __MCSPLUGINWATCHER_H +#define __MCSPLUGINWATCHER_H + +#include + +class CMenuOperation; +class CMCSPluginEngine; +class CMCSExampleAppView; + + +/** + * + * This class implements MCS menu action watcher for async calls. + * + */ +class CMCSExampleWatcher: public CActive + { + public: + + + /** + * Two-phased constructor. + * + * @param aType + */ + static CMCSExampleWatcher* NewL( ); + + /** + * Destructor. + */ + virtual ~CMCSExampleWatcher(); + + /** + * Watch menu operation or notification. + * + * @param aOperation + */ + void Watch( CMenuOperation* aOperation, CMCSExampleAppView* aObserver ); + + + /** + * GetStatus + */ + TInt GetStatus(); + + private: + + /** + * Default constructor. + * + * @param aType + */ + CMCSExampleWatcher(); + + /** + * ConstructL + */ + void ConstructL(); + + /** + * Inherited from CActive class + */ + void RunL(); + + /** + * Inherited from CActive class + */ + void DoCancel(); + + private: + + /** + * Menu operation + * Owned + */ + CMenuOperation* iOperation; + CMCSExampleAppView* iObserver; + }; + +#endif /*__MCSPLUGINWATCHER_H*/ diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/sis/MCSExample_S60_3_X_v_1_0_0.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/sis/MCSExample_S60_3_X_v_1_0_0.pkg Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,37 @@ +; Installation file for MCSExample application +; +; This is an auto-generated PKG file by Carbide. +; This file uses variables specific to Carbide builds that will not work +; on command-line builds. If you want to use this generated PKG file from the +; command-line tools you will need to modify the variables with the appropriate +; values: $(EPOCROOT), $(PLATFORM), $(TARGET) +; +;Language - standard language definitions +&EN + +; standard SIS file header +#{"MCSExample"},(0xEB753B18),1,0,0 + +;Localised Vendor name +%{"Vendor-EN"} + +;Unique Vendor name +:"Vendor" + +;Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;Files to install +;You should change the source paths to match that of your environment +; +"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\MCSExample_0xEB753B18.exe" -"!:\sys\bin\MCSExample_0xEB753B18.exe" +"$(EPOCROOT)Epoc32\data\z\resource\apps\MCSExample_0xEB753B18.rsc" -"!:\resource\apps\MCSExample_0xEB753B18.rsc" +"$(EPOCROOT)Epoc32\data\z\private\10003a3f\apps\MCSExample_0xEB753B18_reg.rsc" -"!:\private\10003a3f\import\apps\MCSExample_0xEB753B18_reg.rsc" +"$(EPOCROOT)Epoc32\data\z\resource\apps\MCSExample_0xEB753B18.mif" -"!:\resource\apps\MCSExample_0xEB753B18.mif" +;"..\help\MCSExample_0xEB753B18.hlp" -"!:\resource\help\MCSExample_0xEB753B18.hlp" + +; Add any installation notes if applicable +;"MCSExample.txt" -"!:\private\EB753B18\MCSExample.txt" + +;required for application to be covered by backup/restore facility +"..\sis\backup_registration.xml" -"!:\private\EB753B18\backup_registration.xml" diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/sis/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/sis/backup_registration.xml Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,5 @@ + + + + + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/src/MCSExample.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/src/MCSExample.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include +#include "MCSExampleApplication.h" + +LOCAL_C CApaApplication* NewApplication() + { + return new CMCSExampleApplication; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/src/MCSExampleAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/src/MCSExampleAppUi.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include +#include "MCSExample.hrh" +#include "MCSExample.pan" +#include "MCSExampleApplication.h" +#include "MCSExampleAppUi.h" +#include "MCSExampleAppView.h" + + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// CMCSExampleAppUi::ConstructL() +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppUi::ConstructL() + { + // Initialise app UI with standard value. + BaseConstructL(CAknAppUi::EAknEnableSkin|CAknAppUi::EAknSingleClickCompatible); + + // Create view object + iAppView = CMCSExampleAppView::NewL(ClientRect()); + } +// ----------------------------------------------------------------------------- +// CMCSExampleAppUi::CMCSExampleAppUi() +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CMCSExampleAppUi::CMCSExampleAppUi() + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppUi::~CMCSExampleAppUi() +// Destructor. +// ----------------------------------------------------------------------------- +// +CMCSExampleAppUi::~CMCSExampleAppUi() + { + if (iAppView) + { + delete iAppView; + iAppView = NULL; + } + + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppUi::HandleCommandL() +// Takes care of command handling. +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppUi::HandleCommandL(TInt aCommand) + { + switch (aCommand) + { + case EEikCmdExit: + case EAknSoftkeyExit: + Exit(); + break; + + case ECommand1: + { + + // Load a string from the resource file and display it + HBufC* textResource = StringLoader::LoadLC(R_COMMAND1_TEXT); + CAknInformationNote* informationNote; + + informationNote = new (ELeave) CAknInformationNote; + + // Show the information Note with + // textResource loaded with StringLoader. + informationNote->ExecuteLD(*textResource); + + // Pop HBuf from CleanUpStack and Destroy it. + CleanupStack::PopAndDestroy(textResource); + } + break; + case ECommand2: + { + iAppView->ListAllItemsL(); + } + break; + case EHelp: + { + + } + break; + case EAbout: + { + + CAknMessageQueryDialog* dlg = + new (ELeave) CAknMessageQueryDialog(); + dlg->PrepareLC(R_ABOUT_QUERY_DIALOG); + HBufC* title = iEikonEnv->AllocReadResourceLC( + R_ABOUT_DIALOG_TITLE); + dlg->QueryHeading()->SetTextL(*title); + CleanupStack::PopAndDestroy(); //title + HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT); + dlg->SetMessageTextL(*msg); + CleanupStack::PopAndDestroy(); //msg + dlg->RunLD(); + } + break; + default: + Panic( EMCSExampleUi); + break; + } + } +// ----------------------------------------------------------------------------- +// Called by the framework when the application status pane +// size is changed. Passes the new client rectangle to the +// AppView +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppUi::HandleStatusPaneSizeChange() + { + iAppView->SetRect(ClientRect()); + } + +CArrayFix* CMCSExampleAppUi::HelpContextL() const + { +#warning "Please see comment about help and UID3..." + // Note: Help will not work if the application uid3 is not in the + // protected range. The default uid3 range for projects created + // from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they + // can be self signed and installed on the device during testing. + // Once you get your official uid3 from Symbian Ltd. and find/replace + // all occurrences of uid3 in your project, the context help will + // work. Alternatively, a patch now exists for the versions of + // HTML help compiler in SDKs and can be found here along with an FAQ: + // http://www3.symbian.com/faq.nsf/AllByDate/E9DF3257FD565A658025733900805EA2?OpenDocument +#ifdef _HELP_AVAILABLE_ + CArrayFixFlat* array = new(ELeave)CArrayFixFlat(1); + CleanupStack::PushL(array); + array->AppendL(TCoeHelpContext(KUidMCSExampleApp, KGeneral_Information)); + CleanupStack::Pop(array); + return array; +#else + return NULL; +#endif + } + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/src/MCSExampleAppView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/src/MCSExampleAppView.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,462 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include "MCSExampleAppView.h" +#include "mcspluginwatcher.h" +#include "MCSExample.hrh" + +_LIT( KMenuData, "matrixmenudata" ); + +CMyForm::CMyForm( TMyData& aData ) : iData( aData ) + { + } + +CMyForm::~CMyForm() + { + } + +void CMyForm::PreLayoutDynInitL() + { + CAknForm::PreLayoutDynInitL(); + LoadFormDataL(); + } + +void CMyForm::LoadFormDataL() + { + CEikEdwin* textEd1 = + (CEikEdwin*)Control( EMyFirstLine ); + textEd1->SetTextL( &iData.majorID ); + + CEikEdwin* textEd2 = + (CEikEdwin*)Control( EMySecondLine ); + textEd2->SetTextL( &iData.minorID ); + + CEikEdwin* textEd3 = + (CEikEdwin*)Control( EMyThirdLine ); + textEd3->SetTextL( &iData.iconFile ); + + CEikEdwin* textEd4 = + (CEikEdwin*)Control( EMyFourthLine ); + textEd4->SetTextL( &iData.iconID ); + + CEikEdwin* textEd5 = + (CEikEdwin*)Control( EMyFifthLine ); + textEd5->SetTextL( &iData.maskID ); + + CEikEdwin* textEd6 = + (CEikEdwin*)Control( EMySixthLine ); + textEd6->SetTextL( &iData.statusIcon ); + } + +TBool CMyForm::SaveFormDataL() + { + CEikEdwin* textEd1 = + (CEikEdwin*)Control( EMyFirstLine ); + textEd1->GetText( iData.majorID ); + + CEikEdwin* textEd2 = + (CEikEdwin*)Control( EMySecondLine ); + textEd2->GetText( iData.minorID ); + + CEikEdwin* textEd3 = + (CEikEdwin*)Control( EMyThirdLine ); + textEd3->GetText( iData.iconFile ); + + CEikEdwin* textEd4 = + (CEikEdwin*)Control( EMyFourthLine ); + textEd4->GetText( iData.iconID ); + + CEikEdwin* textEd5 = + (CEikEdwin*)Control( EMyFifthLine ); + textEd5->GetText( iData.maskID ); + + CEikEdwin* textEd6 = + (CEikEdwin*)Control( EMySixthLine ); + textEd6->GetText( iData.statusIcon ); + return ETrue; + } + +void CMyForm::DoNotSaveFormDataL() + { + LoadFormDataL(); + } + +TBool CMyForm::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyOk) + { + SaveFormDataL(); + iData.updated = ETrue; + } + else if( aButtonId == EAknSoftkeyCancel ) + { + iData.updated = EFalse; + } + return ETrue; + } + +CGulIcon* ConvertToGulIconLC( CAknIcon* aIcon ) + { + CGulIcon* icon = CGulIcon::NewL( aIcon->Bitmap(), aIcon->Mask() ); + CleanupStack::PushL( icon ); + // Detach bitmap and mask + aIcon->SetBitmap( NULL ); + aIcon->SetMask( NULL ); + return icon; + } + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMCSExampleAppView::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMCSExampleAppView* CMCSExampleAppView::NewL(const TRect& aRect) + { + CMCSExampleAppView* self = CMCSExampleAppView::NewLC(aRect); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppView::NewLC() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMCSExampleAppView* CMCSExampleAppView::NewLC(const TRect& aRect) + { + CMCSExampleAppView* self = new (ELeave) CMCSExampleAppView; + CleanupStack::PushL(self); + self->ConstructL(aRect); + return self; + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppView::ConstructL() +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::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(); + + iMCSMenu.OpenL( KMenuData ); + iWatcher = CMCSExampleWatcher::NewL(); + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppView::CMCSExampleAppView() +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CMCSExampleAppView::CMCSExampleAppView() + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppView::~CMCSExampleAppView() +// Destructor. +// ----------------------------------------------------------------------------- +// +CMCSExampleAppView::~CMCSExampleAppView() + { + iMCSMenu.Close(); + delete iListBox; + iItemArray.Close(); + delete iWatcher; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::ListAllItemsL() + { + + + CArrayPtr* icons =new( ELeave ) CAknIconArray(1); + CleanupStack::PushL(icons); + + iListBox->Model()->SetItemTextArray(GetArrayL(icons)); + iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); + // + // Inform the listbox of item additions. + // This should be done if you want your items displayed correctly + iListBox ->HandleItemAdditionL(); + + CleanupStack::Pop(icons); + CArrayPtr* oldArray = iListBox->ItemDrawer()->ColumnData()->IconArray(); + delete oldArray; + iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::MakeListBoxL() + { + TInt MySetIndex(0); + + if(iListBox) + { + MySetIndex = iListBox->CurrentItemIndex(); + } + + delete iListBox; + iListBox = NULL; + + iListBox = new( ELeave ) CAknSingleLargeStyleListBox(); + iListBox->ConstructL(this,EAknListBoxSelectionList); + iListBox->SetListBoxObserver( this ); + + iListBox->CreateScrollBarFrameL( ETrue ); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + + iListBox->SetRect(Rect()); + + iListBox->View()->SetListEmptyTextL(_L("No data")); + + iListBox->ActivateL(); + + TInt ItemsCount = iListBox->Model()->ItemTextArray()->MdcaCount(); + + if(ItemsCount > MySetIndex && MySetIndex >= 0) + iListBox->SetCurrentItemIndex(MySetIndex); + else if(ItemsCount > 0) + iListBox->SetCurrentItemIndex(0); + + UpdateScrollBar(iListBox); + iListBox->DrawNow(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CDesCArray* CMCSExampleAppView::GetArrayL(CArrayPtr* aIcons) +{ + TBuf<256> listString; + CDesCArrayFlat* myArray = new(ELeave)CDesCArrayFlat(1); + CleanupStack::PushL(myArray); + + const TInt rootId = iMCSMenu. RootFolderL(); + iItemArray.Reset(); + //CleanupClosePushL( itemArray ); + // Get all the items from MCS + iMCSMenu.GetItemsL( iItemArray, rootId, NULL, ETrue ); + + for( TInt i = 0; i < iItemArray.Count(); i++ ) + { + // Open the actual item + CMenuItem* menuItem = CMenuItem::OpenL( iMCSMenu, iItemArray[i] ); + CleanupStack::PushL( menuItem ); + + // Get the name of the item + TBool attrExists( EFalse ); + TPtrC attr = menuItem->GetAttributeL(_L("short_name" ), attrExists ); + + //Create listbox string + listString.Delete(0, 256); + listString.AppendNum( i ); + listString.Append( _L("\t")); + listString.Append( attr ); + myArray->AppendL( listString ); + + //Fetch the item icon from MCS + CAknIcon* icon = MenuIconUtility::GetItemIconL( *menuItem ); + CleanupStack::PushL( icon ); + if ( icon ) + { + CGulIcon* gIcon = ConvertToGulIconLC( icon ); + aIcons->AppendL( gIcon ); + CleanupStack::Pop( gIcon ); + } + CleanupStack::PopAndDestroy( icon ); + CleanupStack::PopAndDestroy( menuItem ); + } + CleanupStack::Pop(myArray); + return myArray; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::UpdateScrollBar(CEikListBox* aListBox) + { + if (aListBox) + { + TInt pos(aListBox->View()->CurrentItemIndex()); + if (aListBox->ScrollBarFrame()) + { + aListBox->ScrollBarFrame()->MoveVertThumbTo(pos); + } + } + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppView::Draw() +// Draws the display. +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::Draw(const TRect& /*aRect*/) const + { + // Get the standard graphics context + CWindowGc& gc = SystemGc(); + + // Gets the control's extent + TRect drawRect(Rect()); + + // Clears the screen + gc.Clear(drawRect); + + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppView::SizeChanged() +// Called by framework when the view size is changed. +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::SizeChanged() + { + TRAP_IGNORE( MakeListBoxL() ); + DrawNow(); + } + +// ----------------------------------------------------------------------------- +// CMCSExampleAppView::HandlePointerEventL() +// Called by framework to handle pointer touch events. +// Note: although this method is compatible with earlier SDKs, +// it will not be called in SDKs without Touch support. +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::HandlePointerEventL( + const TPointerEvent& aPointerEvent) + { + + // Call base class HandlePointerEventL() + CCoeControl::HandlePointerEventL(aPointerEvent); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) + { + if( iListBox && aEventType == EEventItemSingleClicked ) + { + TInt index = iListBox->CurrentItemIndex(); + if( index < iItemArray.Count()) + { + ShowFormL( index ); + } + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void CMCSExampleAppView::ShowFormL( TInt aItemIndex) + { + CMenuItem* menuItem = CMenuItem::OpenL( iMCSMenu, iItemArray[aItemIndex] ); + CleanupStack::PushL( menuItem ); + TBool attrExists( EFalse ); + TPtrC attr = menuItem->GetAttributeL(_L("short_name" ), attrExists ); + // Initialize form data. + TBool exists( EFalse );; + TMyData myData; + myData.majorID = menuItem->GetAttributeL( KMenuAttrIconSkinMajorId, exists ); + myData.minorID = menuItem->GetAttributeL( KMenuAttrIconSkinMinorId, exists ); + myData.iconFile = menuItem->GetAttributeL( KMenuAttrIconFile, exists ); + myData.iconID = menuItem->GetAttributeL( KMenuAttrIconId, exists ); + myData.maskID = menuItem->GetAttributeL( KMenuAttrMaskId, exists ); + // e.g. skin(0x101F86E3 0x1ee2) + myData.statusIcon = menuItem->GetAttributeL( _L("presenceicon"), exists ); + myData.updated = EFalse; + + // Launch the dialog to view/edit data + CAknForm* dlg = new ( ELeave ) CMyForm( myData ); + CleanupStack::PushL( dlg ); + dlg->ConstructL( 0 ); // default menu items only + CleanupStack::Pop( dlg ); + dlg->ExecuteLD( R_ICON_QUERY_DIALOG ); + // myData now contains the edited values. + + if( myData.updated ) + { + // Changes the main icon, if all values are empty then application icon is used. + // Piority 0 + menuItem->SetAttributeL(KMenuAttrIconSkinMajorId, myData.majorID ); + menuItem->SetAttributeL(KMenuAttrIconSkinMinorId, myData.minorID ); + // Pririty 1 + menuItem->SetAttributeL(KMenuAttrIconFile, myData.iconFile ); + menuItem->SetAttributeL(KMenuAttrIconId, myData.iconID ); + menuItem->SetAttributeL(KMenuAttrMaskId, myData.maskID ); + //Changes the presence icon + menuItem->SetAttributeL( _L("presenceicon"), myData.statusIcon ); + + CMenuOperation* operation = menuItem->SaveL( iWatcher->iStatus ); + // Deletes the operation after its completion + iWatcher->Watch( operation, this ); + } + CleanupStack::PopAndDestroy( menuItem ); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +CCoeControl* CMCSExampleAppView::ComponentControl( TInt /*aIndex*/) const +{ + return iListBox; +} + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +TInt CMCSExampleAppView::CountComponentControls() const +{ + if(iListBox) + return 1; + else + return 0; +} +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/src/MCSExampleApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/src/MCSExampleApplication.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include "MCSExample.hrh" +#include "MCSExampleDocument.h" +#include "MCSExampleApplication.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMCSExampleApplication::CreateDocumentL() +// Creates CApaDocument object +// ----------------------------------------------------------------------------- +// +CApaDocument* CMCSExampleApplication::CreateDocumentL() + { + // Create an MCSExample document, and return a pointer to it + return CMCSExampleDocument::NewL(*this); + } + +// ----------------------------------------------------------------------------- +// CMCSExampleApplication::AppDllUid() +// Returns application UID +// ----------------------------------------------------------------------------- +// +TUid CMCSExampleApplication::AppDllUid() const + { + // Return the UID for the MCSExample application + return KUidMCSExampleApp; + } + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/src/MCSExampleDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/src/MCSExampleDocument.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include "MCSExampleAppUi.h" +#include "MCSExampleDocument.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMCSExampleDocument::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMCSExampleDocument* CMCSExampleDocument::NewL(CEikApplication& aApp) + { + CMCSExampleDocument* self = NewLC(aApp); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CMCSExampleDocument::NewLC() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMCSExampleDocument* CMCSExampleDocument::NewLC(CEikApplication& aApp) + { + CMCSExampleDocument* self = new (ELeave) CMCSExampleDocument(aApp); + + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CMCSExampleDocument::ConstructL() +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMCSExampleDocument::ConstructL() + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// CMCSExampleDocument::CMCSExampleDocument() +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CMCSExampleDocument::CMCSExampleDocument(CEikApplication& aApp) : + CAknDocument(aApp) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// CMCSExampleDocument::~CMCSExampleDocument() +// Destructor. +// --------------------------------------------------------------------------- +// +CMCSExampleDocument::~CMCSExampleDocument() + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// CMCSExampleDocument::CreateAppUiL() +// Constructs CreateAppUi. +// --------------------------------------------------------------------------- +// +CEikAppUi* CMCSExampleDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it; + // the framework takes ownership of this object + return new (ELeave) CMCSExampleAppUi; + } + +// End of File diff -r d721605b30d0 -r d12a7ea0f775 idlehomescreen/examples/mcsexample/src/mcspluginwatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/examples/mcsexample/src/mcspluginwatcher.cpp Mon Aug 02 12:02:47 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Menu item operation watcher. +* +*/ + +#include +#include "mcspluginwatcher.h" +#include "MCSExampleAppView.h" + +// --------------------------------------------------------------------------- +// two-phased constructor +// --------------------------------------------------------------------------- +CMCSExampleWatcher* CMCSExampleWatcher::NewL( ) + { + CMCSExampleWatcher* self = new (ELeave) CMCSExampleWatcher( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// default constructor +// --------------------------------------------------------------------------- +CMCSExampleWatcher::CMCSExampleWatcher( ) + : CActive( CActive::EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +CMCSExampleWatcher::~CMCSExampleWatcher() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// second phase constructor +// --------------------------------------------------------------------------- +void CMCSExampleWatcher::ConstructL() + { + + } + +// --------------------------------------------------------------------------- +// Watch Async +// --------------------------------------------------------------------------- +void CMCSExampleWatcher::Watch( CMenuOperation* aOperation, CMCSExampleAppView* aObserver ) + { + iObserver = aObserver; + __ASSERT_DEBUG( KRequestPending == iStatus.Int(), User::Invariant() ); + //__ASSERT_DEBUG( !iOperation, User::Invariant() ); + iOperation = aOperation; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Inherited from CActive class +// --------------------------------------------------------------------------- +void CMCSExampleWatcher::RunL() + { + iObserver->ListAllItemsL(); + delete iOperation; + iOperation = NULL; + } + +// --------------------------------------------------------------------------- +// Inherited from CActive class +// --------------------------------------------------------------------------- +void CMCSExampleWatcher::DoCancel() + { + delete iOperation; + iOperation = NULL; + } + +TInt CMCSExampleWatcher::GetStatus() + { + return iStatus.Int(); + } +