calendarui/views/src/calenpreviewpane.cpp
changeset 57 bb2d3e476f29
parent 55 2c54b51f39c4
child 63 a3cb48f6c889
equal deleted inserted replaced
55:2c54b51f39c4 57:bb2d3e476f29
   187 			// Check the entry type, based on the type display time field in
   187 			// Check the entry type, based on the type display time field in
   188 			// preview pane.
   188 			// preview pane.
   189 			QString start;
   189 			QString start;
   190 			if(mInstanceArray[i].type() != AgendaEntry::TypeTodo && 
   190 			if(mInstanceArray[i].type() != AgendaEntry::TypeTodo && 
   191 					mInstanceArray[i].type() != AgendaEntry::TypeAnniversary && 
   191 					mInstanceArray[i].type() != AgendaEntry::TypeAnniversary && 
   192 					mInstanceArray[i].type() != AgendaEntry::TypeEvent) {
   192 					!CalenAgendaUtils::isAlldayEvent(mInstanceArray[i])) {
   193 				QDateTime startTime = mInstanceArray[i].startTime();
   193 				QDateTime startTime = mInstanceArray[i].startTime();
   194 				// Check if event starts in past
   194 				// Check if event starts in past
   195 				checkStartTimeOfEvent(startTime);
   195 				checkStartTimeOfEvent(startTime);
   196 				HbExtendedLocale systemLocale =HbExtendedLocale::system();
   196 				HbExtendedLocale systemLocale =HbExtendedLocale::system();
   197 				start = systemLocale.format(startTime.time(), 
   197 				start = systemLocale.format(startTime.time(), 
   368 {
   368 {
   369     OstTraceFunctionEntry0( CALENPREVIEWPANE_GESTUREEVENT_ENTRY );
   369     OstTraceFunctionEntry0( CALENPREVIEWPANE_GESTUREEVENT_ENTRY );
   370     
   370     
   371     if(HbPanGesture *gesture = qobject_cast<HbPanGesture *>(event->gesture(Qt::PanGesture))) {
   371     if(HbPanGesture *gesture = qobject_cast<HbPanGesture *>(event->gesture(Qt::PanGesture))) {
   372         if (gesture->state() == Qt::GestureUpdated) {
   372         if (gesture->state() == Qt::GestureUpdated) {
       
   373             // Check if effect is not yet completed, ignore the current gesture if it is
       
   374             if (mIsGestureHandled) {
       
   375                 OstTraceFunctionExit0( CALENPREVIEWPANE_GESTUREEVENT_EXIT );
       
   376                 return;
       
   377             }
   373             // TODO: This work around till framework provides an api
   378             // TODO: This work around till framework provides an api
   374             // to know the direciton of the pan, until then we need
   379             // to know the direciton of the pan, until then we need
   375             // calculate the direction explicitly
   380             // calculate the direction explicitly
   376             // Get to know the direction of the gesture
   381             // Get to know the direction of the gesture
   377             QPointF delta = gesture->delta();
   382             QPointF delta = gesture->delta();
   398                     // left gesture
   403                     // left gesture
   399                     mView->handlePreviewPaneGesture(false);
   404                     mView->handlePreviewPaneGesture(false);
   400                     event->accept(Qt::PanGesture);
   405                     event->accept(Qt::PanGesture);
   401                 } else {
   406                 } else {
   402                     event->accept(Qt::PanGesture);
   407                     event->accept(Qt::PanGesture);
   403                     OstTraceFunctionExit0( CALENPREVIEWPANE_GESTUREEVENT_EXIT );
   408                     OstTraceFunctionExit0( DUP1_CALENPREVIEWPANE_GESTUREEVENT_EXIT );
   404                     return;
   409                     return;
   405                 }
   410                 }
   406             } else if (abs(verticalDiff) < MAX_PAN_DIRECTION_THRESHOLD) {
   411             } else if (abs(verticalDiff) < MAX_PAN_DIRECTION_THRESHOLD) {
   407                if (horizontalDiff > MIN_PAN_DIRECTION_THRESHOLD) {
   412                if (horizontalDiff > MIN_PAN_DIRECTION_THRESHOLD) {
   408                    mIsGestureHandled = true;
   413                    mIsGestureHandled = true;
   414                    // left gesture
   419                    // left gesture
   415                    mView->handlePreviewPaneGesture(false);
   420                    mView->handlePreviewPaneGesture(false);
   416                    event->accept(Qt::PanGesture);
   421                    event->accept(Qt::PanGesture);
   417                }else {
   422                }else {
   418                    event->accept(Qt::PanGesture);
   423                    event->accept(Qt::PanGesture);
   419                    OstTraceFunctionExit0( DUP1_CALENPREVIEWPANE_GESTUREEVENT_EXIT );
   424                    OstTraceFunctionExit0( DUP2_CALENPREVIEWPANE_GESTUREEVENT_EXIT );
   420                    return;
   425                    return;
   421                }
   426                }
   422             }
   427             }
   423         }
   428         }
   424     } else if(QTapGesture *tapGesture = qobject_cast<QTapGesture *>(event->gesture(Qt::TapGesture))) {
   429     } else if(QTapGesture *tapGesture = qobject_cast<QTapGesture *>(event->gesture(Qt::TapGesture))) {
   476         QTime time(0,0,0,0); // 0 means 12:00 AM
   481         QTime time(0,0,0,0); // 0 means 12:00 AM
   477         dateTime.setTime(time);
   482         dateTime.setTime(time);
   478     }
   483     }
   479 }
   484 }
   480 
   485 
       
   486 /*!
       
   487  Sets the effect beign handled flag to true
       
   488  */
       
   489 void CalenPreviewPane::effectStarted()
       
   490 {
       
   491     mIsGestureHandled = true;
       
   492 }
       
   493 
       
   494 /*!
       
   495  Resets the effect beign handled flag to true
       
   496  */
       
   497 void CalenPreviewPane::effectFinished()
       
   498 {
       
   499     mIsGestureHandled = false;
       
   500 }
       
   501 
   481 // End of file  --Don't remove this.
   502 // End of file  --Don't remove this.