idlefw/plugins/mcsplugin/settings/inc/mcspluginsettingscontainer.h
branchRCL_3
changeset 30 a5a39a295112
child 31 8baec10861af
equal deleted inserted replaced
29:0efa10d348c0 30:a5a39a295112
       
     1 /*
       
     2 * Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  MCS settings plug-in container.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMCSPLUGINSETTINGSCONTAINER_H
       
    20 #define CMCSPLUGINSETTINGSCONTAINER_H
       
    21 
       
    22 // External includes
       
    23 #include <gsbasecontainer.h>
       
    24 #include <mcsmenu.h>
       
    25 #include <mcsmenunotifier.h>
       
    26 #include <favouritesdbobserver.h>   // For MFavouritesDbObserver
       
    27 #include <favouritesdb.h>           // For RFavouritesDb
       
    28 #include <msvapi.h>                 // For MMsvSessionObserver
       
    29 
       
    30 // Internal includes
       
    31 #include "mcspluginwatcher.h"
       
    32 
       
    33 // Forward declaration
       
    34 class CAknRadioButtonSettingPage;
       
    35 class CMCSPluginSettingsModel;
       
    36 class CActiveFavouritesDbNotifier;
       
    37 class CMCSPluginWatcher;
       
    38 
       
    39 /**
       
    40  *  @ingroup group_mcsplugin
       
    41  *
       
    42  * Shortcut settings plug-in container
       
    43  *
       
    44  * @lib mcspluginsettings.lib
       
    45  * @since S60 v3.2
       
    46  */
       
    47 class CMCSPluginSettingsContainer : public CGSBaseContainer, 
       
    48     public MFavouritesDbObserver, public MMsvSessionObserver,
       
    49     public MMCSPluginWatcherObserver
       
    50 {
       
    51 
       
    52 public:
       
    53     /**
       
    54      * Public constructor
       
    55      */
       
    56     CMCSPluginSettingsContainer();
       
    57 
       
    58     /*
       
    59      * Descructor
       
    60      */
       
    61     virtual ~CMCSPluginSettingsContainer();
       
    62 
       
    63     /**
       
    64      * Sets pointer to settings plug-in model.
       
    65      *
       
    66      * @since S60 v3.2
       
    67      * @param aModel Pointer to settings plug-in model
       
    68      */
       
    69     void SetModel(CMCSPluginSettingsModel* aModel);
       
    70 
       
    71     /**
       
    72      * Handles a setting change command
       
    73      *
       
    74      * @since S60 v3.2
       
    75      */
       
    76     void HandleChangeCommandL();
       
    77 
       
    78     /**
       
    79      * Handles a help command
       
    80      *
       
    81      * @since S60 v9.1
       
    82      */
       
    83     void HandleHelpCommandL();
       
    84 
       
    85     /**
       
    86      * Close change dialog
       
    87      *
       
    88      * @since S60 v3.2
       
    89      */
       
    90     void CloseChangeDialog();
       
    91 
       
    92     /**
       
    93      * Reset current list
       
    94      *
       
    95      * @since S60 v3.2
       
    96      */
       
    97     void ResetCurrentListL(TInt aIndex);
       
    98 
       
    99     // from base class MMsvSessionObserver
       
   100 
       
   101     /**
       
   102      * Handles an event from the message server.
       
   103      * Not used, but must be defined to be able to use the messaging server.
       
   104      *
       
   105      * @since S60 v3.2
       
   106      * @param aEvent Indicates the event type.
       
   107      * @param aArg1 Event type-specific argument value
       
   108      * @param aArg2 Event type-specific argument value
       
   109      * @param aArg3 Event type-specific argument value
       
   110      */
       
   111     void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, 
       
   112         TAny* aArg2, TAny* aArg3 );
       
   113 
       
   114     // from base class MMCSPluginWatcherObserver
       
   115 
       
   116     /**
       
   117      * Hanle notify
       
   118      */
       
   119     void HandleNotifyL();
       
   120 
       
   121 private:
       
   122 
       
   123     /*
       
   124      * Leaving constructor
       
   125      * 
       
   126      * @param aRect
       
   127      */
       
   128     void ConstructL(const TRect& aRect);
       
   129 
       
   130     /**
       
   131      * Tells the settings container to start observing for changes in favorites
       
   132      * database and mailbox db.
       
   133      *
       
   134      */
       
   135     void StartObservingL();
       
   136 
       
   137     /**
       
   138      * Tells the settings container to stop observing for changes in favorites
       
   139      * database and mailbox db.
       
   140      *
       
   141      */
       
   142     void StopObserving();
       
   143 
       
   144     // from base class CGSBaseContainer
       
   145 
       
   146     /**
       
   147      * From CGSBaseContainer
       
   148      * Constructs the settings listbox
       
   149      *
       
   150      * @since S60 v3.2
       
   151      * @param aResLbxId Listbox resource id
       
   152      */
       
   153     void ConstructListBoxL(TInt aResLbxId);
       
   154 
       
   155     /**
       
   156      * Chandles a setting change command to select application from a list
       
   157      *
       
   158      * @since S60 v3.2
       
   159      * @param aItem Applist item to modify
       
   160      * @param aNew ETrue if selecting an application for first time, 
       
   161      *             EFalse if not
       
   162      * @return ETrue if shortcut was changed. EFalse if not
       
   163      */
       
   164     TBool HandleAppListChangeCommandL( const TInt& aIndex,
       
   165         const TInt& aSettingIndex );
       
   166 
       
   167     /**
       
   168      * Chandles a setting change command to select bookmark from a list
       
   169      *
       
   170      * @since S60 v3.2
       
   171      * @param aItem Applist item to modify
       
   172      * @param aNew ETrue if selecting an application for first time, 
       
   173      *             EFalse if not
       
   174      * @return ETrue if shortcut was changed. EFalse if not
       
   175      */
       
   176     TBool HandleBookmarkChangeCommandL( const TInt& aIndex,
       
   177         const TInt& aSettingIndex );
       
   178 
       
   179     /**
       
   180      * Creates Help Context for launching Shortcuts Help page.
       
   181      */
       
   182     TCoeHelpContext GetHelpContext() const;
       
   183 
       
   184     /**
       
   185      * Offer key event
       
   186      * 
       
   187      * @param aKeyEvent
       
   188      * @param aType
       
   189      */
       
   190     TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
   191 
       
   192     /**
       
   193      * Checks if there is a need to update the middle softkey label.
       
   194      */
       
   195     void CheckMiddleSoftkeyLabel();
       
   196 
       
   197     // From MFavouritesDbObserver
       
   198     /**
       
   199      * Handles database event.
       
   200      * @param aEvent Database event.
       
   201      */
       
   202     void HandleFavouritesDbEventL(RDbNotifier::TEvent aEvent);
       
   203 
       
   204 private:  // data
       
   205 
       
   206     /**
       
   207      * Settings plug-in model.
       
   208      * Not own.
       
   209      */
       
   210     CMCSPluginSettingsModel*       iModel;
       
   211 
       
   212     /**
       
   213      * Application selection list page.
       
   214      * Own.
       
   215      */
       
   216     CAknRadioButtonSettingPage* iAppListDialog;
       
   217 
       
   218     /**
       
   219      * Bookmark selection list page.
       
   220      * Own.
       
   221      */
       
   222     CAknRadioButtonSettingPage* iBkmListDialog;
       
   223 
       
   224     /**
       
   225      * Bookmark database change observer.
       
   226      * Own.
       
   227      */
       
   228     CActiveFavouritesDbNotifier* iBookmarkDbObserver;
       
   229 
       
   230     /**
       
   231      * Bookmark database.
       
   232      */
       
   233     RFavouritesDb iBookmarkDb;
       
   234 
       
   235     /**
       
   236      * Bookmark database session.
       
   237      */
       
   238     RFavouritesSession iBookmarkSession;
       
   239 
       
   240     /**
       
   241      * Message server session
       
   242      * Own.
       
   243      */
       
   244     CMsvSession* iMsvSession;
       
   245 
       
   246     // MCS resource
       
   247     RMenu iMenu;
       
   248 
       
   249     // MCS change notifier
       
   250     RMenuNotifier iNotifier;
       
   251 
       
   252     /* MCS change notifier watcher
       
   253      * Own
       
   254      */
       
   255     CMCSPluginWatcher* iNotifyWatcher;
       
   256 };
       
   257 
       
   258 #endif // CMCSPLUGINSETTINGSCONTAINER_H
       
   259 
       
   260 // End of File.