calendarui/views/dayview/tsrc/unittests/unittest_calendayitemview/calendayinfo.h
changeset 57 bb2d3e476f29
parent 45 b6db4fd4947b
child 81 ce92091cbd61
equal deleted inserted replaced
55:2c54b51f39c4 57:bb2d3e476f29
     1 /*
     1 /*
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3 * All rights reserved.
     4  * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8  *
     8 *
     9  * Initial Contributors:
     9 * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11  *
    11 *
    12  * Contributors:
    12 * Contributors:
    13  *
    13 *
    14  * Description:
    14 * Description: Mocked classes for testing CalenDayItemView class
    15  *
    15 *
    16  */
    16 */
    17 
    17 
    18 #ifndef  CALENDAYINFO_H
    18 #ifndef  CALENDAYINFO_H
    19 #define  CALENDAYINFO_H
    19 #define  CALENDAYINFO_H
    20 
    20 
    21 #include <QtGlobal>
    21 #include <calinstance.h>
    22 #include "caleninstanceid.h"
    22 #include "caleninstanceid.h"
    23 #include <QtGui>
    23 #include <hb_calencommands.hrh>
    24 
    24 
    25 //from hb_calencommands.hrh
    25 const int KFSCalMaxDescriptionLength = 100;
    26 
    26 
    27 enum TCalenCommandId
    27 /*!
    28     {
    28  Mocked struct SCalenApptInfo
    29     ECalenMonthView,
    29  */
    30     ECalenWeekView,
       
    31     ECalenAgendaView,
       
    32     ECalenDayView,
       
    33     ECalenTodoEditor,
       
    34     ECalenTodoEditorDone,
       
    35     ECalenForwardsToDayView,
       
    36     ECalenNextView,
       
    37     ECalenPrevView,
       
    38     ECalenSwitchView,
       
    39     ECalenShowToolbar,
       
    40     ECalenHideToolbar,
       
    41     ECalenUpdateToolbar,
       
    42     ECalenHidePreview,
       
    43     ECalenShowPreview,
       
    44     ECalenStartActiveStep,
       
    45     ECalenGotoToday,
       
    46     ECalenGotoDate,
       
    47     ECalenEventView,
       
    48     ECalenCmdPromptThenEdit,    
       
    49     ECalenFasterAppExit,
       
    50     ECalenShowNextDay,
       
    51     ECalenShowPrevDay,
       
    52     ECalenNewMeeting,
       
    53     ECalenNewAnniv,
       
    54     ECalenNewDayNote,
       
    55     ECalenNewReminder,
       
    56     ECalenNewMeetingRequest,
       
    57     ECalenNewEntry, 
       
    58     ECalenEditCurrentEntry,
       
    59     ECalenEditSeries,
       
    60     ECalenEditOccurrence,
       
    61     ECalenEditEntryFromViewer,
       
    62     ECalenViewCurrentEntry,
       
    63     ECalenNotifyFocusChange,
       
    64     ECalenCompleteTodo,
       
    65     ECalenRestoreTodo,
       
    66     ECalenSend,
       
    67     ECalenDeleteCurrentEntry,
       
    68     ECalenDeleteEntryWithoutQuery,
       
    69     ECalenDeleteSeries,
       
    70     ECalenDeleteCurrentOccurrence,
       
    71     ECalenDeleteAllEntries,
       
    72     ECalenDeleteEntriesBeforeDate,
       
    73     ECalenCancelDelete,
       
    74     ECalenDeleteEntryFromViewer,
       
    75     ECalenShowSettings,
       
    76     ECalenGetLocation,
       
    77     ECalenShowLocation,
       
    78     ECalenGetLocationAndSave,
       
    79     ECalenMissedAlarmsView,
       
    80     ECalenMissedEventView,
       
    81     ECalenCmdClear,
       
    82     ECalenCmdClearAll,                          
       
    83     ECalenCmdGotoCalendar,
       
    84     ECalenMissedAlarmsViewFromIdle,
       
    85     ECalenMissedEventViewFromIdle,
       
    86     ECalenLastCommand,
       
    87     ECalenRegionalPluginTapEvent
       
    88     };
       
    89 
       
    90 //////////////////end of hb_calencommands.hrh
       
    91 
       
    92 struct SCalenApptInfo
    30 struct SCalenApptInfo
    93     {
    31 {
    94     QModelIndex iIndex;
    32     QModelIndex iIndex;
    95     QDateTime iStartTime;
    33     QDateTime iStartTime;
    96     QDateTime iEndTime;
    34     QDateTime iEndTime;
    97     bool iAllDay;
    35     bool iAllDay;
    98     TCalenInstanceId iId;
    36     TCalenInstanceId iId;
    99 //    AgendaEntry::Status iStatus;
    37     AgendaEntry::Status iStatus;
   100 //    AgendaEntry::TReplicationStatus iReplicationStatus;
    38     TBufC<KFSCalMaxDescriptionLength> iSummary;
   101  //   TBufC<KFSCalMaxDescriptionLength> iSummary;
       
   102     TUint32 iColor;
    39     TUint32 iColor;
   103     };
    40 };
   104 
    41 
       
    42 /*!
       
    43  Mocked class CalenTimeColumn
       
    44  */
       
    45 class CalenTimeColumn
       
    46 {
       
    47 public:
       
    48     CalenTimeColumn() {
       
    49         
       
    50     }
       
    51     
       
    52     ~CalenTimeColumn() {
       
    53         
       
    54     }
       
    55 };
       
    56 
       
    57 /*!
       
    58  Mocked class CalenTimeRegion
       
    59  */
       
    60 class CalenTimeRegion
       
    61 {
       
    62 public:
       
    63     CalenTimeRegion() {
       
    64         
       
    65     }
       
    66     
       
    67     ~CalenTimeRegion() {
       
    68         
       
    69     }
       
    70     
       
    71     QList<CalenTimeColumn> iColumns;
       
    72     
       
    73     int iStartSlot;
       
    74     int iEndSlot;
       
    75 };
       
    76 
       
    77 /*!
       
    78  Mocked class CalenDayInfo
       
    79  */
   105 class CalenDayInfo
    80 class CalenDayInfo
   106 {
    81 {
   107 public:
    82 public:
       
    83     enum TSlotsInHour
       
    84     {
       
    85         EOne = 1, ETwo, EThree, EFour
       
    86     };
   108 
    87 
   109     enum TSlotsInHour
    88 public:
   110         {
       
   111         EOne = 1,
       
   112         ETwo,
       
   113         EThree,
       
   114         EFour
       
   115         };
       
   116 
    89 
   117 public:  // Constructors and destructor
    90     CalenDayInfo(TSlotsInHour aSlotsInHour) 
   118 
    91     {
   119     /**
    92         Q_UNUSED(aSlotsInHour)
   120      * C++ default constructor.
    93     }
   121      */
    94     virtual ~CalenDayInfo()
   122     CalenDayInfo( TSlotsInHour aSlotsInHour ) {Q_UNUSED(aSlotsInHour);}
    95     {
   123     
    96         
   124 public:     
    97     }
   125 
    98 
   126     void Reset() {}
    99     void Reset() {}
   127 
   100 
   128     void InsertTimedEvent( const SCalenApptInfo& aItemInfo ) {Q_UNUSED(aItemInfo);}
   101     void InsertTimedEvent( const SCalenApptInfo& aItemInfo ) {Q_UNUSED(aItemInfo);}
   129 
   102 	
   130     //void InsertUntimedEvent( AgendaEntry::Type aType,
   103 	
   131     //                         const TCalenInstanceId& aId );
   104     void GetLocation( const SCalenApptInfo& aItemInfo, int& aStartSlot,
   132 
   105         int& aEndSlot, int& aColumnIndex, int& aColumns ) 
   133     void InsertAlldayEvent( const SCalenApptInfo& aItemInfo ){Q_UNUSED(aItemInfo);}
   106     {
   134 
   107         Q_UNUSED(aItemInfo)
   135     //static bool IsAlldayEvent( QDateTime aStart, QDateTime aEnd );
   108         Q_UNUSED(aStartSlot)
   136 
   109         Q_UNUSED(aEndSlot)
   137 
   110         Q_UNUSED(aColumnIndex)
   138     //int SuggestedUntimedSlotPos();
   111         Q_UNUSED(aColumns)
   139 
   112     }
   140     //int NeededUntimedSlotCount();
       
   141 
       
   142     //int UpdateUntimedPos( int aSlot = -1, int aUntimedCount = 0 );
       
   143 
       
   144     //int FirstOccupiedSlot();
       
   145 
       
   146     //int LastOccupiedSlot();
       
   147 
       
   148     //int EarliestEndSlot();
       
   149     //int LastStartSlot();
       
   150 
       
   151 
       
   152     //int SlotIndexForStartTime( QDateTime aStartTime );
       
   153 
       
   154     //int SlotIndexForEndTime( QDateTime aStartTime );
       
   155 
       
   156     //void GetLocation( const SCalenApptInfo& aItemInfo,
       
   157     //                  int& aStartSlot,
       
   158     //                  int& aEndSlot,
       
   159     //                  int& aColumnIndex,
       
   160     //                  int& aColumns );
       
   161 
       
   162     //int AlldayCount();
       
   163 
       
   164     //int TodoCount();
       
   165 
       
   166     //bool IsHourStartSlot( const int& aSlotIndex ) const;
       
   167 
       
   168     //bool IsExtraSlot( const int& aSlotIndex ) const;
       
   169 
       
   170     //int HourFromSlotIndex( const int& aSlotIndex ) const;
       
   171 
       
   172     //int SlotIndexFromHour( int aHour );
       
   173 
       
   174     //int RoundHourUp( int aSlot );
       
   175 
       
   176     //int RoundHourDown( int aSlot );
       
   177 
       
   178     //void GetSelectedSlot( int& aSlot, int& aRegion, int& aColumnIndex, int& aColumns );
       
   179 
       
   180     //bool MoveSelection( TScrollDirection aDirection );
       
   181 
       
   182     //void MoveSelectionInEvent( TScrollDirection aDirection );
       
   183 
       
   184     //void UpdateSelectionInEvent();
       
   185 
       
   186     //bool IsEventSelected() const;
       
   187 
       
   188    // bool IsMultipleEventsSelected() const;
       
   189 
       
   190     //bool IsAlldayEventSelected() const;
       
   191 
       
   192     //TCalenInstanceId SelectedEvent();
       
   193 
       
   194     //int SelectEvent( const TCalenInstanceId& aId );
       
   195 
       
   196     //TCalenInstanceId UntimedEvent( int aIndex );
       
   197 
       
   198     //const CalenTimedEventInfo& AlldayEvent( int aIndex );
       
   199 
       
   200     //void SelectSlot( int aSlot );
       
   201 
       
   202 
       
   203     //const QList<CalenTimeRegion>& RegionList() const;
       
   204 
       
   205 
       
   206     //void GetEventIntervals( QList<CalenEventInterval>& aArray ) const;
       
   207 
       
   208 
       
   209    // CalenSlotInterval SelectedInterval();
       
   210     
   113     
   211    // bool SetSelectionInRegion( int aRegion, int aColumn, int aSlot );
   114     int AlldayCount() 
       
   115     {
       
   116         return 0;
       
   117     }
       
   118     
       
   119     const QList<CalenTimeRegion>& RegionList() const 
       
   120     {
       
   121        return mList; 
       
   122     }
       
   123     
       
   124     void InsertAlldayEvent( const SCalenApptInfo& aItemInfo )
       
   125     {
       
   126         Q_UNUSED(aItemInfo)
       
   127             
       
   128         CalenTimeRegion region;
       
   129         
       
   130         region.iStartSlot = 10;
       
   131         region.iEndSlot = 13;
       
   132         region.iColumns << CalenTimeColumn();
       
   133         
       
   134         mList  << region;
       
   135     }
       
   136     
       
   137 public:
       
   138     QList<CalenTimeRegion> mList;
   212 };
   139 };
   213 
   140 
   214 #endif
   141 #endif // CALENDAYINFO_H
       
   142 
       
   143 // End of File