--- a/calendarui/views/dayview/src/calendaycontentscrollarea.cpp Mon Sep 20 12:44:39 2010 +0530
+++ b/calendarui/views/dayview/src/calendaycontentscrollarea.cpp Tue Oct 05 13:57:00 2010 +0530
@@ -57,7 +57,7 @@
*/
CalenDayContentScrollArea::CalenDayContentScrollArea(QGraphicsItem *parent) :
HbScrollArea(parent), mPanDayDirection(ECalenPanNotSet), mIsMoving(false),
- mMoveDirection(ECalenScrollNoDayChange)
+ mMoveDirection(ECalenScrollNoDayChange), mDisallowedDirection(ECalenScrollNoDayChange)
{
#ifdef CALENDAYVIEW_PANNING_ENABLED
grabGesture(Qt::PanGesture);
@@ -90,6 +90,27 @@
}
/*!
+ \brief Returns disallowed scroll direction (if defined)
+
+ \return Disallowed scroll direction
+ */
+CalenScrollDirection CalenDayContentScrollArea::disallowedScrollDirection() const
+{
+ return mDisallowedDirection;
+}
+
+/*!
+ \brief Sets disallowed scroll direction
+
+ \param direction Disallowed scroll direction to be set
+ */
+void CalenDayContentScrollArea::setDisallowedScrollDirection(
+ const CalenScrollDirection direction)
+{
+ mDisallowedDirection = direction;
+}
+
+/*!
\brief Scrolls to middle widget.
Scrolling to middle widget is done if needed.
@@ -376,16 +397,23 @@
*/
void CalenDayContentScrollArea::moveTo(const QPointF &newPosition, int time)
{
- // Connect to scrollingEnded SIGNAL to get feedback when scrolling ends
- connect(this, SIGNAL(scrollingEnded()), this, SLOT(moveFinished()));
+ bool canMove(true);
+ if (mDisallowedDirection != ECalenScrollNoDayChange) {
+ canMove = (mMoveDirection != mDisallowedDirection);
+ }
- // Scroll the content to new position and set isMoving flag
- scrollContentsTo(newPosition, time);
- mIsMoving = true;
-
- // Emit signal that moving has just started
- if (mMoveDirection != ECalenScrollNoDayChange) {
- emit scrollAreaMoveStarted(mMoveDirection);
+ if (canMove) {
+ // Connect to scrollingEnded SIGNAL to get feedback when scrolling ends
+ connect(this, SIGNAL(scrollingEnded()), this, SLOT(moveFinished()));
+
+ // Scroll the content to new position and set isMoving flag
+ scrollContentsTo(newPosition, time);
+ mIsMoving = true;
+
+ // Emit signal that moving has just started
+ if (mMoveDirection != ECalenScrollNoDayChange) {
+ emit scrollAreaMoveStarted(mMoveDirection);
+ }
}
}