calendarui/views/dayview/inc/calendayitemview.h
changeset 77 b0711afde476
parent 50 579cc610882e
child 75 7ac58b2aae6f
equal deleted inserted replaced
68:a5a1242fd2e8 77:b0711afde476
     1 /*
     1 /*
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 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:  Day view control of calendar
    14  * Description:  Day view control of calendar
    15 *
    15  *
    16 */
    16  */
    17 
    17 
    18 #ifndef CALENDAYITEMVIEW_H
    18 #ifndef CALENDAYITEMVIEW_H
    19 #define CALENDAYITEMVIEW_H
    19 #define CALENDAYITEMVIEW_H
    20 
    20 
    21 //System includes
    21 //System includes
    29 class CalenDayContainer;
    29 class CalenDayContainer;
    30 class MCalenServices;
    30 class MCalenServices;
    31 
    31 
    32 class CalenDayItemView : public HbAbstractItemView
    32 class CalenDayItemView : public HbAbstractItemView
    33 {
    33 {
    34     Q_OBJECT
    34 	Q_OBJECT
    35 
    35 
    36 public:
    36 public:
    37     enum CalendarPanDirection {
    37     enum CalendarPanDirection {
    38         CalendarPanNotSet,
    38         CalendarPanNotSet,
    39         CalendarPanVertical,
    39         CalendarPanVertical,
    44         CalendarNoRecycle,
    44         CalendarNoRecycle,
    45         CalendarBackwardRecycle,
    45         CalendarBackwardRecycle,
    46         CalendarForwardRecycle
    46         CalendarForwardRecycle
    47     };
    47     };
    48 
    48 
    49     /**
    49     CalenDayItemView(
    50      * Constructor.
    50         MCalenServices &services,
    51      */
    51         HbModelIterator* iterator,
    52     CalenDayItemView(MCalenServices &services, HbModelIterator* iterator, QGraphicsItem *parent);
    52         QGraphicsItem *parent);
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     ~CalenDayItemView();
    53     ~CalenDayItemView();
    58 
    54 
    59     /**
    55     void scrollTo(
    60      * 
    56         const QModelIndex &index,
    61      */
    57         HbAbstractItemView::ScrollHint hint = EnsureVisible);
    62     void scrollTo(const QModelIndex &index, HbAbstractItemView::ScrollHint hint = EnsureVisible);
       
    63 
    58 
    64 public slots:
    59 public slots:
    65 
    60 
    66     /**
       
    67      * 
       
    68      */
       
    69     virtual void reset();
    61     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();
    62     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();
    63     void modelReset();
    82 
    64 
    83     /**
       
    84      * 
       
    85      */
       
    86     void scrollVertically(const QPointF &newPosition);
    65     void scrollVertically(const QPointF &newPosition);
    87     
    66 
    88 private slots:
    67 private slots:
    89     
    68 
    90     /**
    69     void itemPressed(const QModelIndex &index);
    91      * This function is called when a touch down event is received within Abstract view item that is representing index.
    70     void itemReleased(const QModelIndex &index);
    92      */
    71     void itemActivated(const QModelIndex &index);
    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);
    72     void itemLongPressed(HbAbstractViewItem*, QPointF);
   112     
    73 
   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);
    74     void orientationChanged(Qt::Orientation orientation);
   118     
    75 
   119     /**
       
   120      * Opens currently selected model item.
       
   121      */
       
   122     void openSelectedItem();
    76     void openSelectedItem();
   123     
       
   124     /**
       
   125      * Edits currently selected model item.
       
   126      */
       
   127     void editSelectedItem();
    77     void editSelectedItem();
   128     
    78     void deleteSelectedItem();
   129     /**
       
   130      * Deletes currently selected model item.
       
   131      */
       
   132     void deleteSelectedItem(); 
       
   133 
    79 
   134 private:
    80 private:
   135     
    81 
   136     /**
       
   137      * Connects item view's slots.
       
   138      */
       
   139     void setupSlots();
    82     void setupSlots();
   140     
       
   141     /**
       
   142      * Creates Context menu.
       
   143      */
       
   144     void setupContextMenu();
    83     void setupContextMenu();
   145     
    84     bool issueCommandOnSelectedItem(int command);
   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();
    85     void clearSelectionInModel();
   157 
    86 
   158 private:
    87 private:
   159 
    88 
   160     /**
    89     /**
   161      * Calendar services. Not owned.
    90      * Calendar services. Not owned.
   162      */
    91      */
   163     MCalenServices  &mServices;
    92     MCalenServices &mServices;
   164     
    93 
   165     /**
    94     /**
   166      * Item container.
    95      * Item container.
   167      */
    96      */
   168     CalenDayContainer* mContainer;
    97     CalenDayContainer* mContainer;
   169     
    98 
   170     /**
    99     /**
   171      * Day event info.
   100      * Day event info.
   172      * Own.
   101      * Own.
   173      */
   102      */
   174     CalenDayInfo* mInfo;
   103     CalenDayInfo* mInfo;
   175     
   104 
   176     /**
   105     /**
   177      * context menu
   106      * context menu
   178      */
   107      */
   179     HbMenu* mContextMenu;
   108     HbMenu* mContextMenu;
   180 };
   109 };