clock2/clockui/uilayer/clockmainview/inc/clockalarmarray.h
changeset 0 f979ecb2b13e
child 30 d68a4b5d5885
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2008 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:   This is the header file for the CClockAlarmArray class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CLOCK_ALARM_ARRAY_H__
       
    19 #define __CLOCK_ALARM_ARRAY_H__
       
    20 
       
    21 // System includes
       
    22 #include <e32base.h>
       
    23 #include <bamdesca.h>
       
    24 #include <asshddefs.h>
       
    25 #include <badesca.h>
       
    26 
       
    27 // User includes
       
    28 #include "clkcommon.h"
       
    29 
       
    30 // Forward declarations
       
    31 class CClkUiAlarmModel;
       
    32 class CCoeEnv;
       
    33 
       
    34 // Class declaration
       
    35 /**
       
    36 * @class CClockAlarmArray
       
    37 * @brief This the MDesCArray inheriting class. This acts as the data provider for the alarm list.
       
    38 */
       
    39 class CClockAlarmArray : public CBase, public MDesCArray
       
    40     {
       
    41     public:             // Constructor and destructor
       
    42         
       
    43         /**
       
    44         * @brief Two-phased constructor.
       
    45         * @param aAlarmModel Pointer to the alarm model.
       
    46         * @param aCoeEnv The the control environment.
       
    47         */
       
    48         static CClockAlarmArray* NewL( CClkUiAlarmModel* aAlarmModel, CCoeEnv* aCoeEnv );
       
    49         
       
    50         /**
       
    51         * @brief Destructor.
       
    52         */
       
    53         virtual ~CClockAlarmArray();
       
    54         
       
    55     public:             // From base classes
       
    56         
       
    57         /**
       
    58         * @brief From MDesCArray. Returns the number of items in the array.
       
    59         * @return TInt The number of items in the array.
       
    60         */
       
    61         TInt MdcaCount() const;
       
    62         
       
    63         /**
       
    64         * @brief Returns a descriptor to list item text of the given index.
       
    65         * @param aIndex The index of the list item.
       
    66         * @return TPtrC16 Descriptor pointing to the list item content.
       
    67         */
       
    68         TPtrC16 MdcaPoint( TInt aIndex ) const;
       
    69         
       
    70     public:             // New functions
       
    71         
       
    72         /**
       
    73         * @brief Returns the index of the listbox item with the given alarm id.
       
    74         * @param aAlarmId The id of the alarm.
       
    75         * @return TInt The index of the list item.
       
    76         */
       
    77         TInt ListBoxIndex( TAlarmId aAlarmId );
       
    78         
       
    79         /**
       
    80         * @brief Returns the index of the active alarm with the given alarm id.
       
    81         * @param aAlarmId The id of the alarm.
       
    82         * @param aErrorValue 
       
    83         * @return TInt The  Enabled Alarm's index. 
       
    84         */
       
    85         TInt GetEnabledAlarmIndex( TAlarmId aAlarmId, TInt aErrorValue );
       
    86         
       
    87         /**
       
    88         * @brief Returns the index of the inactive alarm with the given alarm id.
       
    89         * @param aAlarmId The id of the alarm.
       
    90         * @param aErrorValue 
       
    91         * @return TInt The  Disabled Alarm's index. 
       
    92         */
       
    93         TInt GetDisabledAlarmIndex( TAlarmId aAlarmId, TInt aErrorValue );
       
    94         
       
    95         /**
       
    96         * @brief Initialize the alarmid list.
       
    97         */
       
    98         void InitIdList();
       
    99         
       
   100         /**
       
   101         * @brief Gives the alarm id and alarm information of the alarm in the list indexed at aIndex.
       
   102         * @param aIndex The index of the alarm list item in the list.
       
   103         * @param aAlarmId The id of the alarm at aIndex in the list.
       
   104         * @param aAlarmInfo The information of the alarm at aIndex in the list.
       
   105         */
       
   106         void GetSortedAlmIdInfo( TInt aIndex, TAlarmId &aAlarmId, SClkAlarmInfo& aAlarmInfo ) const;
       
   107         
       
   108         /**
       
   109         * @brief Gives the enabled alarm's count.
       
   110         * @return Enabled alarms count
       
   111         */
       
   112         TInt GetEnabledAlarmCount() const;
       
   113         
       
   114         /**
       
   115         * @brief Gives alarm information of the active alarm in the list indexed at aIndex.
       
   116         * @param aIndex The index of the alarm list item in the list.
       
   117         * @param aAlarmId The id of the alarm at aIndex in the list.
       
   118         * @param aAlarmInfo The information of the alarm at aIndex in the list.
       
   119         */
       
   120         void GetActiveAlarmInfo(TInt aIndex, TAlarmId& aAlarmId, SClkAlarmInfo& aAlarmInfo  ) const;
       
   121         
       
   122         /**
       
   123         * @brief Gives alarm information of the inactive alarm in the list indexed at aIndex.
       
   124         * @param aIndex The index of the alarm list item in the list.
       
   125         * @param aAlarmId The id of the alarm at aIndex in the list.
       
   126         * @param aAlarmInfo The information of the alarm at aIndex in the list.
       
   127         */
       
   128         void GetInActiveAlarmInfo(TInt aIndex, TAlarmId& aAlarmId, SClkAlarmInfo& aAlarmInfo  ) const;
       
   129         
       
   130     private:            // New functions
       
   131         
       
   132         /**
       
   133         * @brief This performs the 2nd phase of the two-phase construction.
       
   134         * @param aAlarmModel Pointer to the alarm model.
       
   135         * @param aCoeEnv The the control environment.
       
   136         */
       
   137         void ConstructL( CClkUiAlarmModel* aAlarmModel, CCoeEnv* aCoeEnv );
       
   138         
       
   139         /**
       
   140         * @brief C++ default constructor.
       
   141         */
       
   142         CClockAlarmArray();
       
   143         
       
   144         /**
       
   145         * @brief This uses the Pow() API to get the workday from the workday list.
       
   146         * @param aNum The workday to be calculated.
       
   147         * @return TInt The computed value.
       
   148         */
       
   149         TInt Power( TInt aNum ) const;
       
   150 
       
   151     private:            // Data
       
   152         
       
   153         /**
       
   154         * @var iAlarmModel
       
   155         * @brief Pointer to the alarm model object. Not owned.
       
   156         */
       
   157         CClkUiAlarmModel*               iAlarmModel;
       
   158 
       
   159         /**        
       
   160         * @var iOccuranceList
       
   161         * @brief Descriptor array for the occurance items.
       
   162         */ 
       
   163         CDesCArrayFlat*                 iOccuranceList;
       
   164         
       
   165         /**
       
   166         * @var iWorkDaysList
       
   167         * @brief Descriptor array for the workdays items.
       
   168         */
       
   169         CDesCArrayFlat*                 iWorkDaysList;
       
   170         
       
   171         /**
       
   172         * @var iShortWorkDaysList
       
   173         * @brief Descriptor array for the workdays items in short form.
       
   174         */
       
   175         CDesCArrayFlat*                 iShortWorkDaysList;
       
   176         
       
   177         /**
       
   178         * @var iListBoxEntry
       
   179         * @brief Will hold the string to be displayed in the listbox.
       
   180         */
       
   181         HBufC*                          iListBoxEntry;
       
   182         
       
   183         /**
       
   184         * @var iAlarmInactiveText
       
   185         * @brief String holder for the string "Inactive".
       
   186         */
       
   187         HBufC*                          iAlarmInactiveText;
       
   188         
       
   189         /**
       
   190         * @var iTimeFormat
       
   191         * @brief String holder to hold the timeformatting string.
       
   192         */
       
   193         HBufC*                          iTimeFormat;
       
   194         
       
   195         /**
       
   196         * @var iDate
       
   197         * @brief String holder for the date string.
       
   198         */
       
   199         HBufC*                          iDate;
       
   200         
       
   201         /**
       
   202         * @var iEnv
       
   203         * @brief The control environment. Not owned.
       
   204         */
       
   205         CCoeEnv*                        iEnv;
       
   206         
       
   207         /**
       
   208         * @var iAlarmIdArray
       
   209         * @brief The array of alarm ids.
       
   210         */
       
   211         RArray< TAlarmId >              iAlarmIdArray;
       
   212         
       
   213         /**
       
   214         * @var iNewAlarmText
       
   215         * @brief String holder for the string "NewAlarm".
       
   216         */
       
   217         HBufC*                         iNewAlarmText;
       
   218     };
       
   219 
       
   220 #endif          // __CLOCK_ALARM_ARRAY_H__
       
   221 
       
   222 // End of file