calendarui/editors/inc/calenreminderfield.h
changeset 0 f979ecb2b13e
child 48 bf573002ff72
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002 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 : Editor alarm fields functionality for all entry types
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef CALENREMINDERFIELD_H
       
    19 #define CALENREMINDERFIELD_H
       
    20 
       
    21 // system includes
       
    22 #include <e32base.h>
       
    23 
       
    24 // forward declarations
       
    25 class CCalenUnifiedEditor;
       
    26 class CCalEntry;
       
    27 class CAknQueryValueTextArray;
       
    28 class CAknQueryValueText;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 NONSHARABLE_CLASS( CCalenReminderField ) : public CBase
       
    33     {
       
    34 private:
       
    35     // Define index of "AlarmTime" choicelist item
       
    36     enum TFormAlarmItemIndex
       
    37         {
       
    38         EAlarmNoAlarm,
       
    39         EAlarmActive
       
    40         };
       
    41 
       
    42 public:
       
    43     static CCalenReminderField* NewL( CCalenUnifiedEditor& aUnifiedEditor );
       
    44 
       
    45     /**
       
    46      * @brief C++ desrtuctor
       
    47      */
       
    48     virtual ~CCalenReminderField();
       
    49 
       
    50 public: // Data access API 
       
    51     
       
    52     /**
       
    53      * @brief Handle error codes related to the alarm fields.
       
    54      * @param aError
       
    55      */
       
    56     TBool HandleErrorL( const TInt& aError );
       
    57     
       
    58     /**
       
    59      * @brief Called when focus is moved from the specified line.
       
    60      * @param aFocusedId, Id of the focused field
       
    61      */
       
    62     void PrepareForFocusTransitionL( TInt aFocusedId );
       
    63 
       
    64     /**
       
    65      * @brief Reads data from the entry and updates the form with the appropriate
       
    66      *        values.
       
    67      */
       
    68     void SetDataToEditorL();
       
    69     
       
    70     /**
       
    71      * @brief Reads data from the form and updates the entry with the appropriate 
       
    72      *        values.
       
    73      */
       
    74     void ReadDataFromFormL( TBool aContinueOnError );
       
    75 
       
    76 public: // Layout API
       
    77     
       
    78     /**
       
    79      * @brief Remove any lines not needed by the current entry. 
       
    80      */
       
    81     void DeleteMeaninglessLinesL();
       
    82     
       
    83     /**
       
    84      * @brief Updates fields just before the form is shown.
       
    85      */
       
    86     void InitReminderFieldLdayoutL();
       
    87 
       
    88 public: // Control API 
       
    89     
       
    90     /**
       
    91      * @brief Called when a field is modifed.
       
    92      * @param aControlId field which is modified.
       
    93      */
       
    94     void HandleControlStateChangeL( TInt aControlId );
       
    95     
       
    96     /**
       
    97      * @brief Gets the info whether alarm on/off. adds & updates the alarm fields.
       
    98      * @param aAlarmAcitive, If ETrue Alaram is set to 'ON' else set to 'OFF'
       
    99      */
       
   100     void CheckAlarmActive( TBool aAlarmActive );
       
   101     
       
   102     /**
       
   103      * @brief Checks if the alarm is active.
       
   104      * @return ETrue if alarm is 'ON' else EFasle
       
   105      */
       
   106     TBool IsAlarmActiveInForm();
       
   107     
       
   108 
       
   109 private: 
       
   110     
       
   111     /**
       
   112      * @brief To Add/Delete Alaram Date & Time fields. 
       
   113      * @param If ETrue Alarm Off, Delete alarm date & alarm time fields from Editor
       
   114      *        If EFalse Alarm On, Add alarm date & alarm time fields to Editor 
       
   115      */
       
   116     void SetAlarmDateTimeLinesDimmedL( const TBool& aDimmed );
       
   117 
       
   118     /**
       
   119      * @brief Handle Editor fields, when an alarm field is changed.
       
   120      */
       
   121     void HandleAlarmActiveFieldChangeL();
       
   122 
       
   123     /**
       
   124      * @brief When the start time of the entry is changed, this function gets called 
       
   125      *        to keep time interval between the entry start and the alarm constant.
       
   126      */
       
   127     void UpdateAlarmTimeWhenStartChangedL();
       
   128     
       
   129     /**
       
   130      * @brief Sets the alarm date & time to the specified TTime.
       
   131      * @param aTime, TTime formate of alarm date & time.
       
   132      */
       
   133     void SetAlarmDateTimeField( const TTime& aTime );
       
   134     
       
   135     /**
       
   136      * @brief Checks to see if the current value of the alarm date/time line is in
       
   137      *        the future.
       
   138      * @return ETrue, If start time is in future       
       
   139      */
       
   140     TBool IsStartTimeInFutureL();
       
   141 
       
   142     /**
       
   143      * @brief Returns the current date/time value of the alarm field.
       
   144      * @return TTime formate of alarm date/time
       
   145      */
       
   146     TTime AlarmDateTimeFromFormL();
       
   147     
       
   148 private:   
       
   149     
       
   150 	/** 
       
   151 	 * @brief Get the time field in QHD resolutions
       
   152 	 * @return TTime form of time from field with aControlId 
       
   153 	 */ 
       
   154 	TTime GetTimeField( TInt aControlId );
       
   155 	 
       
   156 private:
       
   157     
       
   158     /**
       
   159      * @brief C++ constructor
       
   160      */
       
   161     CCalenReminderField( CCalenUnifiedEditor& aUnifiedEditor );
       
   162 
       
   163     /**
       
   164      * @brief Two-Phase constructor
       
   165      */
       
   166     void ConstructL();
       
   167 
       
   168 private:
       
   169     
       
   170     /**
       
   171      * @var iUnifiedEditor
       
   172      * @brief Reference to CCalenUnifiedEditor
       
   173      */
       
   174     CCalenUnifiedEditor& iUnifiedEditor;
       
   175     
       
   176     /**
       
   177      * @var iIsAlarmOnOff
       
   178      * @brief hold the Alarm On/Off state
       
   179      */
       
   180     TInt iIsAlarmOnOff;
       
   181 
       
   182     /**
       
   183      * @var iDefaultAlarmOffset
       
   184      * @brief Default alarm offset as minutes from start. Negative value means that
       
   185      *        it is before start time. Read from Central repository
       
   186      */
       
   187     TTimeIntervalMinutes iDefaultAlarmOffset;
       
   188 
       
   189     /**
       
   190      * @var iAlarmOffset
       
   191      * @brief Alarm offset as minutes from start Negative value means that it is 
       
   192      *        before start time
       
   193      */
       
   194     TTimeIntervalMinutes iAlarmOffset;
       
   195     };
       
   196 
       
   197 #endif // CALENALARMFIELDS_H
       
   198 
       
   199 
       
   200 // End of File