calendarui/views/src/calenagendaview.cpp
changeset 75 7ac58b2aae6f
parent 70 a5ed90760192
child 81 ce92091cbd61
--- a/calendarui/views/src/calenagendaview.cpp	Mon Sep 06 15:58:44 2010 +0530
+++ b/calendarui/views/src/calenagendaview.cpp	Mon Sep 20 12:44:39 2010 +0530
@@ -154,21 +154,15 @@
     // Set self as the current view
     // mServices.MainWindow().setCurrentView(this);
     
-    // Dont override the soft key behavior if day view is the first view
-    if (ECalenAgendaView != mServices.getFirstView()) {
+    // Dont override the soft key behavior if day view or agenda view is the first view
+    if (ECalenMonthView == mServices.getFirstView()) {
 		mSoftKeyAction = new HbAction(Hb::BackNaviAction);
 		setNavigationAction(mSoftKeyAction);
 		// Connect to the signal triggered by clicking on back button.
 		connect(mSoftKeyAction, SIGNAL(triggered()), this,
 		        SLOT(launchMonthView()));
-		if (mSwitchToDayViewAction) {
-			mSwitchToDayViewAction->setVisible(true);
-				}
-	} else {
-		if (mSwitchToDayViewAction) {
-			mSwitchToDayViewAction->setVisible(false);
-		}
 	}
+    
     // Initialize the content widget
     mAgendaViewWidget->showWidget();
     
@@ -240,10 +234,16 @@
     if(HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) {
         if (gesture->state() == Qt::GestureStarted) {
             if(QSwipeGesture::Left == gesture->sceneHorizontalDirection()) {
-                mServices.IssueCommandL(ECalenShowNextDay);
+                // Check if we can swipe
+                if (checkIfWeCanSwipe(mDate, false)) {
+                    mServices.IssueCommandL(ECalenShowNextDay);
+                }
                 event->accept(Qt::SwipeGesture);
             } else if(QSwipeGesture::Right == gesture->sceneHorizontalDirection()) {
-                mServices.IssueCommandL(ECalenShowPrevDay);
+                // Check if we can swipe
+                if (checkIfWeCanSwipe(mDate, true)) {
+                    mServices.IssueCommandL(ECalenShowPrevDay);
+                }
                event->accept(Qt::SwipeGesture);
             }
         }