uifw/AvKon/inc/aknstatuspanedatapublisher.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2006,2007 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:  AVKON internal publisher for system owned status pane data.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_AKNSTATUSPANEDATAPUBLISHER_H
       
    20 #define C_AKNSTATUSPANEDATAPUBLISHER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <e32property.h>
       
    26 #include <AknPreviewPopUpObserver.h>
       
    27 
       
    28 class CAknStatusPanePublisherData;
       
    29 class CAknIndicatorPlugin;
       
    30 class CAknIndicatorPopup;
       
    31 
       
    32 /**
       
    33 * This class is used to publish system controlled status pane data.
       
    34 *
       
    35 * @since S60 3.2
       
    36 * @lib avkon.lib
       
    37 *
       
    38 */
       
    39 NONSHARABLE_CLASS( CAknStatusPaneDataPublisher ) : public CBase,
       
    40                                                    public MAknPreviewPopUpObserver
       
    41     {
       
    42 public:
       
    43 
       
    44     /**
       
    45     * Two-phased constructor.
       
    46     */
       
    47     IMPORT_C static CAknStatusPaneDataPublisher* NewL();
       
    48 
       
    49     /**
       
    50     * Destructor.
       
    51     */
       
    52     ~CAknStatusPaneDataPublisher();
       
    53 
       
    54     /**
       
    55     * Publishes the current data.
       
    56     */
       
    57     IMPORT_C void PublishDataL();
       
    58 
       
    59     /**
       
    60     * Sets the ID of the current foreground app's subscriber.
       
    61     *
       
    62     * @param  aId  ID of the subscriber.
       
    63     */
       
    64     IMPORT_C void SetForegroundSubscriberId( TInt aId );
       
    65 
       
    66     /**
       
    67     * Sets the battery level.
       
    68     *
       
    69     * @param  aLevel  New battery level.
       
    70     */
       
    71     IMPORT_C void SetBatteryLevel( TInt aLevel );
       
    72 
       
    73     /**
       
    74     * Sets the battery re-charge indication on/off.
       
    75     *
       
    76     * @param  aRecharging  @c ETrue to set recharging animation on,
       
    77     *                      @c EFalse otherwise.
       
    78     */
       
    79     IMPORT_C void SetRecharge( TBool aRecharging );
       
    80 
       
    81     /**
       
    82     * Sets the signal level.
       
    83     *
       
    84     * @param  aLevel  New signal level.
       
    85     */
       
    86     IMPORT_C void SetSignalLevel( TInt aLevel );
       
    87 
       
    88     /**
       
    89     * Sets the signal icon (GPRS, EDGE, WCDMA, etc.)
       
    90     *
       
    91     * @param  aIcon  The icon state to be set.
       
    92     */
       
    93     IMPORT_C void SetSignalIcon( TInt aIcon );
       
    94 
       
    95     /**
       
    96     * Sets flags for the status pane incall bubble.
       
    97     *
       
    98     * @param  aFlags  Flags to be set, @see TAvkonIncallStatusBubbleFlags
       
    99     *                 in @c avkon.hrh.
       
   100     */
       
   101     IMPORT_C void SetIncallBubbleFlags( TInt aFlags );
       
   102 
       
   103     /**
       
   104     * Sets wheter incall status bubble is to be shown/not shown
       
   105     * in "usual" status pane layouts.
       
   106     *
       
   107     * @param  aAllowed  @c ETrue to shown incall status bubble in
       
   108     *                   "usual" status pane layouts, @c EFalse
       
   109     *                   otherwise.
       
   110     */
       
   111     IMPORT_C void SetIncallBubbleAllowedInUsual( TBool aAllowed );
       
   112 
       
   113     /**
       
   114     * Sets wheter incall status bubble is to be shown/not shown
       
   115     * in "usual" status pane layouts.
       
   116     *
       
   117     * @param  aAllowed  @c ETrue to shown incall status bubble in
       
   118     *                   "usual" status pane layouts, @c EFalse
       
   119     *                   otherwise.
       
   120     */
       
   121     IMPORT_C void SetIncallBubbleAllowedInUsual( TBool aAllowed, const TUint64& aClientId );
       
   122     
       
   123     /**
       
   124     * Sets wheter incall bubble is to be shown/not shown
       
   125     * in "idle" status pane layouts.
       
   126     *
       
   127     * @param  aAllowed  @c ETrue to shown incall status bubble in
       
   128     *                   "idle" status pane layouts, @c EFalse
       
   129     *                   otherwise.
       
   130     */
       
   131     IMPORT_C void SetIncallBubbleAllowedInIdle( TBool aAllowed );
       
   132 
       
   133     /**
       
   134     * Sets status indicator state.
       
   135     * Possible states are:
       
   136     *   - EAknIndicatorStateOff
       
   137     *   - EAknIndicatorStateOn
       
   138     *   - EAknIndicatorStateAnimate
       
   139     *
       
   140     * @param  aUid    UID of the indicator.
       
   141     * @param  aState  New state of the indicator, @see indicator states
       
   142     *                 in @c avkon.hrh.
       
   143     */
       
   144     IMPORT_C void SetIndicatorState( TUid aUid, TInt aState );
       
   145 
       
   146     /**
       
   147     * Handles indicator tap event.
       
   148     *
       
   149     * @param  aIndicatorUid  UID of the indicator which received the tap event.
       
   150     */
       
   151     IMPORT_C void HandleIndicatorTapL( TUid aIndicatorUid );
       
   152 
       
   153     /**
       
   154     * Clears status indicator states.
       
   155     */
       
   156     void ClearIndicatorStates();
       
   157 
       
   158     /**
       
   159     * Sets the battery icon state.
       
   160     * Possible states are:
       
   161     *   - EAknBatteryIndicatorNormal
       
   162     *   - EAknBatteryIndicatorPowerSave
       
   163     *
       
   164     * @param  aIcon  ID of the battery state, @see TAknBatteryIndicatorStates
       
   165     *                in @c avkon.hrh.
       
   166     */
       
   167     IMPORT_C void SetBatteryIcon( TInt aIcon );
       
   168     
       
   169     /**
       
   170     * Calculate and set the indicator popup's position 
       
   171     * 
       
   172     */
       
   173     IMPORT_C void SetIndicatorPopupPosition();
       
   174     
       
   175 public: // From base class @c MAknPreviewPopUpObserver.
       
   176 
       
   177     /**
       
   178     * Called by the preview popup when an appropriate event takes place.
       
   179     *
       
   180     * @param  aController  Pointer to the sender of the event.
       
   181     * @param  aEvent       Event type.
       
   182     */
       
   183     virtual void HandlePreviewPopUpEventL(
       
   184         CAknPreviewPopUpController* aController,
       
   185         TPreviewPopUpEvent aEvent );
       
   186 
       
   187 private:
       
   188 
       
   189     /**
       
   190     * Data structure to hold all indicators because only visible ones
       
   191     * (currently 3-6 depending on the layout) in the UI are published.
       
   192     */
       
   193     struct TAknStatusIndicator
       
   194         {
       
   195         TAknStatusIndicator() : iUid( 0 ),
       
   196                                 iNarrowPriority( 0xFF ),
       
   197                                 iWidePriority( 0xFF ),
       
   198                                 iState( 0 ),
       
   199                                 iPluginLoaded( EFalse ),
       
   200                                 iPlugin( NULL ),
       
   201                                 iPopupItemExists( EFalse )
       
   202         {};
       
   203 
       
   204         TInt                 iUid;
       
   205         TInt                 iNarrowPriority;
       
   206         TInt                 iWidePriority;
       
   207         TInt                 iState;
       
   208         TBool                iPluginLoaded;
       
   209         CAknIndicatorPlugin* iPlugin; // Own
       
   210         TBool                iPopupItemExists;
       
   211         };
       
   212 
       
   213     /**
       
   214     * Symbian second-phase constructor.
       
   215     */
       
   216     void ConstructL();
       
   217 
       
   218     /**
       
   219     * Standard constructor
       
   220     */
       
   221     CAknStatusPaneDataPublisher();
       
   222 
       
   223     /**
       
   224     * Sets status indicator state.
       
   225     * Possible states are:
       
   226     *   - EAknIndicatorStateOff
       
   227     *   - EAknIndicatorStateOn
       
   228     *   - EAknIndicatorStateAnimate
       
   229     *
       
   230     * @param  aUid    UID of the indicator.
       
   231     * @param  aState  New state of the indicator, @see indicator states
       
   232     *                 in @c avkon.hrh.
       
   233     */
       
   234     void SetIndicatorStateL( TUid aUid, TInt aState );
       
   235 
       
   236     /**
       
   237     * Prioritizes status indicators.
       
   238     */
       
   239     void PrioritizeIndicatorsL();
       
   240 
       
   241     /**
       
   242     * Loads the ECOM-plugin of an indicator.
       
   243     *
       
   244     * @param  aIndicator  @c TAknStatusIndicator data structure
       
   245     *                     of the indicator.
       
   246     */
       
   247     void LoadIndicatorPlugin( TAknStatusIndicator& aIndicator );
       
   248     
       
   249     /**
       
   250     * Gets the default description for a status indicator
       
   251     * to be displayed in the status indicator popup.
       
   252     *
       
   253     * @param          aUid   UID of the indicator.
       
   254     * @param[in,out]  aText  Text to be displayed in the popup.
       
   255     */
       
   256     void GetDefaultIndicatorTextL( TInt aUid, TDes& aText );
       
   257 
       
   258 private:
       
   259 
       
   260     /** Property for server updated status pane state data. */
       
   261     RProperty iProperty;
       
   262 
       
   263     /** Data structure to hold status pane state data. */
       
   264     CAknStatusPanePublisherData* iStatusPaneStateData;
       
   265 
       
   266     /** Array containing the status indicators information. */
       
   267     RArray<TAknStatusIndicator> iIndicators;
       
   268     
       
   269     /**
       
   270     * Universal status indicator popup.
       
   271     * Own.
       
   272     */
       
   273     CAknIndicatorPopup* iPopup;
       
   274 
       
   275     /**
       
   276     * Handle to the Autolock state property.
       
   277     * This is checked to disable universal indicator popup
       
   278     * when device lock is active.
       
   279     */ 
       
   280     RProperty iAutolockStateProperty;
       
   281     };
       
   282 
       
   283 #endif // C_AKNSTATUSPANEDATAPUBLISHER_H