55 |
55 |
56 \param parent The parent of scroll area widget |
56 \param parent The parent of scroll area widget |
57 */ |
57 */ |
58 CalenDayContentScrollArea::CalenDayContentScrollArea(QGraphicsItem *parent) : |
58 CalenDayContentScrollArea::CalenDayContentScrollArea(QGraphicsItem *parent) : |
59 HbScrollArea(parent), mPanDayDirection(ECalenPanNotSet), mIsMoving(false), |
59 HbScrollArea(parent), mPanDayDirection(ECalenPanNotSet), mIsMoving(false), |
60 mMoveDirection(ECalenScrollNoDayChange) |
60 mMoveDirection(ECalenScrollNoDayChange), mDisallowedDirection(ECalenScrollNoDayChange) |
61 { |
61 { |
62 #ifdef CALENDAYVIEW_PANNING_ENABLED |
62 #ifdef CALENDAYVIEW_PANNING_ENABLED |
63 grabGesture(Qt::PanGesture); |
63 grabGesture(Qt::PanGesture); |
64 ungrabGesture(Qt::SwipeGesture); |
64 ungrabGesture(Qt::SwipeGesture); |
65 #else |
65 #else |
85 /*! |
85 /*! |
86 \brief Destructor |
86 \brief Destructor |
87 */ |
87 */ |
88 CalenDayContentScrollArea::~CalenDayContentScrollArea() |
88 CalenDayContentScrollArea::~CalenDayContentScrollArea() |
89 { |
89 { |
|
90 } |
|
91 |
|
92 /*! |
|
93 \brief Returns disallowed scroll direction (if defined) |
|
94 |
|
95 \return Disallowed scroll direction |
|
96 */ |
|
97 CalenScrollDirection CalenDayContentScrollArea::disallowedScrollDirection() const |
|
98 { |
|
99 return mDisallowedDirection; |
|
100 } |
|
101 |
|
102 /*! |
|
103 \brief Sets disallowed scroll direction |
|
104 |
|
105 \param direction Disallowed scroll direction to be set |
|
106 */ |
|
107 void CalenDayContentScrollArea::setDisallowedScrollDirection( |
|
108 const CalenScrollDirection direction) |
|
109 { |
|
110 mDisallowedDirection = direction; |
90 } |
111 } |
91 |
112 |
92 /*! |
113 /*! |
93 \brief Scrolls to middle widget. |
114 \brief Scrolls to middle widget. |
94 |
115 |
374 \param newPosition Destination position |
395 \param newPosition Destination position |
375 \param time Time of scroll movement |
396 \param time Time of scroll movement |
376 */ |
397 */ |
377 void CalenDayContentScrollArea::moveTo(const QPointF &newPosition, int time) |
398 void CalenDayContentScrollArea::moveTo(const QPointF &newPosition, int time) |
378 { |
399 { |
379 // Connect to scrollingEnded SIGNAL to get feedback when scrolling ends |
400 bool canMove(true); |
380 connect(this, SIGNAL(scrollingEnded()), this, SLOT(moveFinished())); |
401 if (mDisallowedDirection != ECalenScrollNoDayChange) { |
|
402 canMove = (mMoveDirection != mDisallowedDirection); |
|
403 } |
381 |
404 |
382 // Scroll the content to new position and set isMoving flag |
405 if (canMove) { |
383 scrollContentsTo(newPosition, time); |
406 // Connect to scrollingEnded SIGNAL to get feedback when scrolling ends |
384 mIsMoving = true; |
407 connect(this, SIGNAL(scrollingEnded()), this, SLOT(moveFinished())); |
385 |
408 |
386 // Emit signal that moving has just started |
409 // Scroll the content to new position and set isMoving flag |
387 if (mMoveDirection != ECalenScrollNoDayChange) { |
410 scrollContentsTo(newPosition, time); |
388 emit scrollAreaMoveStarted(mMoveDirection); |
411 mIsMoving = true; |
|
412 |
|
413 // Emit signal that moving has just started |
|
414 if (mMoveDirection != ECalenScrollNoDayChange) { |
|
415 emit scrollAreaMoveStarted(mMoveDirection); |
|
416 } |
389 } |
417 } |
390 } |
418 } |
391 |
419 |
392 /*! |
420 /*! |
393 \brief isHorizontalSwipe |
421 \brief isHorizontalSwipe |