19 #include "logscomponentrepository.h" |
19 #include "logscomponentrepository.h" |
20 #include "logsabstractviewmanager.h" |
20 #include "logsabstractviewmanager.h" |
21 #include "logsmodel.h" |
21 #include "logsmodel.h" |
22 #include "logsdefs.h" |
22 #include "logsdefs.h" |
23 #include "logslogger.h" |
23 #include "logslogger.h" |
24 #include "logscall.h" |
|
25 #include "logsmessage.h" |
|
26 #include "logscontact.h" |
|
27 #include "logseffecthandler.h" |
24 #include "logseffecthandler.h" |
28 #include "logsmatchesmodel.h" |
25 #include "logsmatchesmodel.h" |
29 #include "logspageindicator.h" |
26 #include "logspageindicator.h" |
30 #include "logsconfigurationparams.h" |
27 #include "logsconfigurationparams.h" |
31 |
28 |
126 |
122 |
127 // View update is needed when we activate view for the first time (!mFilter) |
123 // View update is needed when we activate view for the first time (!mFilter) |
128 // or if view has to be changed |
124 // or if view has to be changed |
129 if ( !mFilter || ( !args.isNull() && (mCurrentView != view) ) ) { |
125 if ( !mFilter || ( !args.isNull() && (mCurrentView != view) ) ) { |
130 updateView( view ); |
126 updateView( view ); |
131 } |
127 } else { |
132 activateEmptyListIndicator(mFilter); |
128 activateEmptyListIndicator(mFilter); |
|
129 handleMissedCallsCounter(); |
|
130 } |
133 |
131 |
134 mPageIndicator->setActiveItemIndex(mConversionMap.value(mCurrentView)); |
132 mPageIndicator->setActiveItemIndex(mConversionMap.value(mCurrentView)); |
135 |
133 |
136 if (mEmptyListLabel) { |
134 if (mEmptyListLabel) { |
137 mEmptyListLabelX = mEmptyListLabel->pos().x(); |
135 mEmptyListLabelX = mEmptyListLabel->pos().x(); |
138 } |
136 } |
139 |
137 |
140 qApp->installEventFilter(this); |
|
141 |
|
142 LogsBaseView::activationCompleted(); |
138 LogsBaseView::activationCompleted(); |
143 |
139 |
144 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::activated()" ); |
140 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::activated()" ); |
145 } |
141 } |
146 |
142 |
381 LOGS_QDEBUG_2( "logs [UI] -> LogsRecentCallsView::updateView(), view:", view ); |
376 LOGS_QDEBUG_2( "logs [UI] -> LogsRecentCallsView::updateView(), view:", view ); |
382 mCurrentView = view; |
377 mCurrentView = view; |
383 LogsFilter::FilterType filter = getFilter( view ); |
378 LogsFilter::FilterType filter = getFilter( view ); |
384 updateFilter(filter); |
379 updateFilter(filter); |
385 updateViewName(); |
380 updateViewName(); |
386 updateContextMenuItems(mCurrentView); |
381 updateContextMenuItems(mCurrentView); |
|
382 handleMissedCallsCounter(); |
387 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateView()" ); |
383 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateView()" ); |
388 } |
384 } |
389 |
385 |
390 // ----------------------------------------------------------------------------- |
386 // ----------------------------------------------------------------------------- |
391 // LogsRecentCallsView::changeFilter |
387 // LogsRecentCallsView::changeFilter |
546 break; |
542 break; |
547 } |
543 } |
548 return filter; |
544 return filter; |
549 } |
545 } |
550 |
546 |
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // LogsRecentCallsView::eventFilter |
|
554 // ----------------------------------------------------------------------------- |
|
555 // |
|
556 bool LogsRecentCallsView::eventFilter(QObject *obj, QEvent *event) |
|
557 { |
|
558 //This is a hack to fix ou1cimx1#481152(horizontal swiping initiates call) |
|
559 //Since w26 HbAbstractViewItemPrivate is setting threshold for Tap gesture |
|
560 //to be the bounding rect (i.e. if swiping is happening inside one list item |
|
561 //it will also be considered as a tap => item activated => call) |
|
562 //We are trying to prevent usage of the list item rect threshold by |
|
563 //setting "horizontallyRestricted" property. |
|
564 //See HbAbstractViewItemPrivate::tapTriggered() and |
|
565 //HbTapGestureLogic::handleMouseMove() for more info |
|
566 if (event->type() == QEvent::Gesture) { |
|
567 QGestureEvent* gesture = static_cast<QGestureEvent*> (event); |
|
568 QTapGesture* tap = qobject_cast<QTapGesture*>(gesture->gesture(Qt::TapGesture)); |
|
569 //only change property if swiping on our list, since for the menu it is |
|
570 //fine to generate tap gesture event during swiping on one item |
|
571 bool tapOnListView = (mListView && mListView->currentViewItem() == obj); |
|
572 if (tap && tapOnListView && tap->state() == Qt::GestureStarted) { |
|
573 tap->setProperty("horizontallyRestricted", true); |
|
574 LOGS_QDEBUG( "logs [UI] TapGesture on list, setting horizontallyRestricted" ); |
|
575 } |
|
576 } |
|
577 return LogsBaseView::eventFilter(obj,event); |
|
578 } |
|
579 |
|
580 // ----------------------------------------------------------------------------- |
547 // ----------------------------------------------------------------------------- |
581 // LogsRecentCallsView::gestureEvent |
548 // LogsRecentCallsView::gestureEvent |
582 // ----------------------------------------------------------------------------- |
549 // ----------------------------------------------------------------------------- |
583 // |
550 // |
584 void LogsRecentCallsView::gestureEvent(QGestureEvent *event) |
551 void LogsRecentCallsView::gestureEvent(QGestureEvent *event) |
585 { |
552 { |
586 QGesture* gesture = event->gesture(Qt::SwipeGesture); |
553 QGesture* gesture = event->gesture(Qt::SwipeGesture); |
587 if (gesture) { |
554 if (gesture) { |
588 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::gestureEvent()" ); |
555 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::gestureEvent()" ); |
589 HbSwipeGesture* swipe = static_cast<HbSwipeGesture *>(gesture); |
556 HbSwipeGesture* swipe = static_cast<HbSwipeGesture *>(gesture); |
590 if (swipe && swipe->state() == Qt::GestureFinished) { |
557 if (swipe) { |
591 LOGS_QDEBUG_2( "logs [UI] sceneSwipeAngle: ", swipe->sceneSwipeAngle() ); |
|
592 LOGS_QDEBUG_2( "logs [UI] swipeAngle: ", swipe->swipeAngle() ); |
|
593 |
|
594 QSwipeGesture::SwipeDirection direction = swipe->sceneHorizontalDirection(); |
558 QSwipeGesture::SwipeDirection direction = swipe->sceneHorizontalDirection(); |
595 if ( decideListMoveDirection(direction) ) |
559 if (swipe->state() == Qt::GestureStarted) { |
596 event->accept(Qt::SwipeGesture); |
560 //fix for ou1cimx1#481152, if policy not set then every swipe |
|
561 //within list item boundaries will also activate list item |
|
562 if (direction == QSwipeGesture::Left |
|
563 || direction == QSwipeGesture::Right) { |
|
564 swipe->setGestureCancelPolicy(QGesture::CancelAllInContext); |
|
565 LOGS_QDEBUG( "logs [UI] swipe->state() == Qt::GestureStarted" ); |
|
566 } |
|
567 } else if (swipe->state() == Qt::GestureFinished) { |
|
568 LOGS_QDEBUG_2( "logs [UI] sceneSwipeAngle: ", swipe->sceneSwipeAngle() ); |
|
569 LOGS_QDEBUG_2( "logs [UI] swipeAngle: ", swipe->swipeAngle() ); |
|
570 |
|
571 if ( decideListMoveDirection(direction) ) { |
|
572 event->accept(Qt::SwipeGesture); |
|
573 } |
597 } |
574 } |
598 } |
575 } |
|
576 } |
599 } |
577 } |
600 |
578 |
601 // ----------------------------------------------------------------------------- |
579 // ----------------------------------------------------------------------------- |
602 // LogsRecentCallsView::decideListMoveDirection |
580 // LogsRecentCallsView::decideListMoveDirection |
603 // ----------------------------------------------------------------------------- |
581 // ----------------------------------------------------------------------------- |