calendarui/views/dayview/inc/calendayitemview.h
changeset 45 b6db4fd4947b
child 70 a5ed90760192
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
       
     1 /*
       
     2 * Copyright (c) 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:  Day view control of calendar
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CALENDAYITEMVIEW_H
       
    19 #define CALENDAYITEMVIEW_H
       
    20 
       
    21 //System includes
       
    22 #include <hbabstractitemview.h>
       
    23 #include <hbmenu.h>
       
    24 
       
    25 //User includes
       
    26 
       
    27 //Forward declarations
       
    28 class CalenDayInfo;
       
    29 class CalenDayContainer;
       
    30 class MCalenServices;
       
    31 
       
    32 class CalenDayItemView : public HbAbstractItemView
       
    33 {
       
    34     Q_OBJECT
       
    35 
       
    36 public:
       
    37     enum CalendarPanDirection {
       
    38         CalendarPanNotSet,
       
    39         CalendarPanVertical,
       
    40         CalendarPanHorizontal
       
    41     };
       
    42 
       
    43     enum CalendaRecycleDays {
       
    44         CalendarNoRecycle,
       
    45         CalendarBackwardRecycle,
       
    46         CalendarForwardRecycle
       
    47     };
       
    48 
       
    49     /**
       
    50      * Constructor.
       
    51      */
       
    52     CalenDayItemView(MCalenServices &services, HbModelIterator* iterator, QGraphicsItem *parent);
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     ~CalenDayItemView();
       
    58 
       
    59     /**
       
    60      * 
       
    61      */
       
    62     void scrollTo(const QModelIndex &index, HbAbstractItemView::ScrollHint hint = EnsureVisible);
       
    63 
       
    64 public slots:
       
    65 
       
    66     /**
       
    67      * 
       
    68      */
       
    69     virtual void reset();
       
    70     
       
    71     /**
       
    72      * Handles signal that is emitted when reset() is called, before the model's
       
    73      * internal state (e.g. persistent model indexes) has been invalidated.
       
    74      */
       
    75     void modelAboutToBeReset();
       
    76     
       
    77     /**
       
    78      * Handles signal that is emitted when reset() is called, after the model's
       
    79      * internal state (e.g. persistent model indexes) has been invalidated.
       
    80      */
       
    81     void modelReset();
       
    82 
       
    83     /**
       
    84      * 
       
    85      */
       
    86     void scrollVertically(const QPointF &newPosition);
       
    87     
       
    88 private slots:
       
    89     
       
    90     /**
       
    91      * This function is called when a touch down event is received within Abstract view item that is representing index.
       
    92      */
       
    93     void itemPressed(const QPointF &position);
       
    94     
       
    95     /**
       
    96      * This function is called when a touch release event is received within Abstract view item that is representing index.
       
    97      */
       
    98     void itemReleased(const QPointF &position);
       
    99     
       
   100     /**
       
   101      * This function is called when the item specified by index is activated by the user.
       
   102      */
       
   103     void itemActivated(const QPointF &position);
       
   104     
       
   105     /**
       
   106      * This function is called when long press event is received within Abstract view item viewItem. 
       
   107      * 
       
   108      * @param item The item.
       
   109      * @param coords is scene position where the long press event happened
       
   110      */
       
   111     void itemLongPressed(HbAbstractViewItem*, QPointF);
       
   112     
       
   113     /**
       
   114      * Slot which is called whenever the orientation of the device changes
       
   115      * @param orientation Current device orientation
       
   116      */
       
   117     void orientationChanged(Qt::Orientation orientation);
       
   118     
       
   119     /**
       
   120      * Opens currently selected model item.
       
   121      */
       
   122     void openSelectedItem();
       
   123     
       
   124     /**
       
   125      * Edits currently selected model item.
       
   126      */
       
   127     void editSelectedItem();
       
   128     
       
   129     /**
       
   130      * Deletes currently selected model item.
       
   131      */
       
   132     void deleteSelectedItem(); 
       
   133 
       
   134 private:
       
   135     
       
   136     /**
       
   137      * Connects item view's slots.
       
   138      */
       
   139     void setupSlots();
       
   140     
       
   141     /**
       
   142      * Creates Context menu.
       
   143      */
       
   144     void setupContextMenu();
       
   145     
       
   146     /**
       
   147      * Sets context to currently selected model item and issues calendar command.
       
   148      * 
       
   149      * @param command Calendar command.
       
   150      */
       
   151     bool issueCommandOnSelectedItem( int command );
       
   152     
       
   153     /**
       
   154      * Clears current selection in Selection Model.
       
   155      */
       
   156     void clearSelectionInModel();
       
   157 
       
   158 private:
       
   159 
       
   160     /**
       
   161      * Calendar services. Not owned.
       
   162      */
       
   163     MCalenServices  &mServices;
       
   164     
       
   165     /**
       
   166      * Item container.
       
   167      */
       
   168     CalenDayContainer* mContainer;
       
   169     
       
   170     /**
       
   171      * Day event info.
       
   172      * Own.
       
   173      */
       
   174     CalenDayInfo* mInfo;
       
   175     
       
   176     /**
       
   177      * context menu
       
   178      */
       
   179     HbMenu* mContextMenu;
       
   180 };
       
   181 
       
   182 #endif // CALENDAYITEMVIEW_H
       
   183 
       
   184 // End of File