calendarui/views/dayview/src/calendaycontentwidget.cpp
changeset 68 a5a1242fd2e8
parent 50 579cc610882e
child 75 7ac58b2aae6f
equal deleted inserted replaced
58:ef813d54df51 68:a5a1242fd2e8
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 // System includes
    18 // System includes
    19 #include <QGraphicsLinearLayout>
    19 #include <QGraphicsLinearLayout>
    20 #include <hbmodeliterator.h>
    20 #include <HbModelIterator>
    21 
    21 
    22 // User includes
    22 // User includes
    23 #include "calendaymodelmanager.h"
    23 #include "calendaymodelmanager.h"
    24 #include "calendaycontentwidget.h"
    24 #include "calendaycontentwidget.h"
    25 #include "calendayitemview.h"
    25 #include "calendayitemview.h"
    31  */
    31  */
    32 
    32 
    33 /*!
    33 /*!
    34  \brief Constructor
    34  \brief Constructor
    35  
    35  
       
    36  \param modelManager Day View model manager
    36  \param parent The parent of central widget
    37  \param parent The parent of central widget
    37  */
    38  */
    38 CalenDayContentWidget::CalenDayContentWidget(
    39 CalenDayContentWidget::CalenDayContentWidget(
    39     CalenDayModelManager &modelManager,
    40     CalenDayModelManager &modelManager,
    40     QGraphicsItem *parent) :
    41     QGraphicsItem *parent) :
    41     HbWidget(parent), mLayout(NULL), mModelManager(modelManager)
    42     HbWidget(parent), mLayout(NULL), mModelManager(modelManager)
    42 {
    43 {
    43     mWidgets.clear();
    44     mWidgets.clear();
    44     initializeViews(parent);
    45     initializeViews();
    45 }
    46 }
    46 
    47 
    47 /*!
    48 /*!
    48  \brief Destructor
    49  \brief Destructor
    49  */
    50  */
   196 /*!
   197 /*!
   197  \brief Initializes content widgets and adds them to layout.
   198  \brief Initializes content widgets and adds them to layout.
   198  
   199  
   199  \param parent Parent object 
   200  \param parent Parent object 
   200  */
   201  */
   201 void CalenDayContentWidget::initializeViews(QGraphicsItem *parent)
   202 void CalenDayContentWidget::initializeViews()
   202 {
   203 {
   203     // Create item views
   204     // Create item views
   204     HbModelIterator *iterator(0);
   205     HbModelIterator *iterator(0);
   205 
   206 
   206     iterator = new HbModelIterator(&mModelManager.getModel(
   207     iterator = new HbModelIterator(&mModelManager.getModel(
   225     connect(currItemView, SIGNAL(scrollPositionChanged(const QPointF&)), this,
   226     connect(currItemView, SIGNAL(scrollPositionChanged(const QPointF&)), this,
   226         SLOT(widgetScrolled(const QPointF&)));
   227         SLOT(widgetScrolled(const QPointF&)));
   227     connect(nextItemView, SIGNAL(scrollPositionChanged(const QPointF&)), this,
   228     connect(nextItemView, SIGNAL(scrollPositionChanged(const QPointF&)), this,
   228         SLOT(widgetScrolled(const QPointF&)));
   229         SLOT(widgetScrolled(const QPointF&)));
   229 
   230 
   230     // Install event filters to receive events necessary for gesture handling
   231     if (parentItem()) {
   231     CalenDayContentScrollArea* scrollArea =
   232         // Install event filters to receive events necessary for gesture handling
   232         static_cast<CalenDayContentScrollArea*> (parent);
   233         CalenDayContentScrollArea* scrollArea =
   233     prevItemView->installEventFilter(scrollArea);
   234             static_cast<CalenDayContentScrollArea*> (parentItem());
   234     currItemView->installEventFilter(scrollArea);
   235         prevItemView->installEventFilter(scrollArea);
   235     nextItemView->installEventFilter(scrollArea);
   236         currItemView->installEventFilter(scrollArea);
       
   237         nextItemView->installEventFilter(scrollArea);
       
   238     }
   236 
   239 
   237     // Add views to layout
   240     // Add views to layout
   238     add(prevItemView);
   241     add(prevItemView);
   239     add(currItemView);
   242     add(currItemView);
   240     add(nextItemView);
   243     add(nextItemView);