38 #include <hblineedit.h> |
38 #include <hblineedit.h> |
39 #include <hbgroupbox.h> |
39 #include <hbgroupbox.h> |
40 #include <hbmainwindow.h> |
40 #include <hbmainwindow.h> |
41 #include <hbswipegesture.h> |
41 #include <hbswipegesture.h> |
42 #include <hbmessagebox.h> |
42 #include <hbmessagebox.h> |
43 #include <hbactivitymanager.h> |
|
44 #include <hbstyleloader.h> |
43 #include <hbstyleloader.h> |
|
44 #include <hblistwidget.h> |
|
45 #include <hblistwidgetitem.h> |
45 #include <QTimer> |
46 #include <QTimer> |
46 |
47 |
47 Q_DECLARE_METATYPE(LogsMatchesModel*) |
48 Q_DECLARE_METATYPE(LogsMatchesModel*) |
48 |
49 |
49 const int logsMissedCallsMarkingDelayMs = 1000; |
50 const int logsMissedCallsMarkingDelayMs = 1000; |
104 |
105 |
105 // ----------------------------------------------------------------------------- |
106 // ----------------------------------------------------------------------------- |
106 // LogsRecentCallsView::activated |
107 // LogsRecentCallsView::activated |
107 // ----------------------------------------------------------------------------- |
108 // ----------------------------------------------------------------------------- |
108 // |
109 // |
109 void LogsRecentCallsView::activated(bool showDialer, QVariant args) |
110 void LogsRecentCallsView::activated(bool showDialer, QVariant args, const QString& dialpadText) |
110 { |
111 { |
111 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::activated()" ); |
112 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::activated()" ); |
112 HbStyleLoader::registerFilePath(":/hbgroupboxheadingwidget.css"); |
|
113 |
|
114 // base class handling first |
113 // base class handling first |
115 LogsBaseView::activated(showDialer, args); |
114 LogsBaseView::activated(showDialer, args, dialpadText); |
116 |
115 |
117 int internalViewId = args.toInt(); |
116 int internalViewId = args.toInt(); |
118 if ( internalViewId < 0 || internalViewId > XQService::LogsViewMissed ){ |
117 if ( internalViewId < 0 || internalViewId > XQService::LogsViewMissed ){ |
119 internalViewId = XQService::LogsViewAll; |
118 internalViewId = XQService::LogsViewAll; |
120 } |
119 } |
144 // LogsRecentCallsView::deactivated |
143 // LogsRecentCallsView::deactivated |
145 // ----------------------------------------------------------------------------- |
144 // ----------------------------------------------------------------------------- |
146 // |
145 // |
147 void LogsRecentCallsView::deactivated() |
146 void LogsRecentCallsView::deactivated() |
148 { |
147 { |
149 HbStyleLoader::unregisterFilePath(":/hbgroupboxheadingwidget.css"); |
|
150 |
|
151 //base class handling first |
148 //base class handling first |
152 LogsBaseView::deactivated(); |
149 LogsBaseView::deactivated(); |
153 |
150 |
154 deactivateEmptyListIndicator(mFilter); |
151 deactivateEmptyListIndicator(mFilter); |
155 } |
152 } |
214 qobject_cast<HbGroupBox*>(mRepository.findWidget(logsGroupboxViewNameId)); |
211 qobject_cast<HbGroupBox*>(mRepository.findWidget(logsGroupboxViewNameId)); |
215 |
212 |
216 addStringsToMap(); |
213 addStringsToMap(); |
217 initListWidget(); |
214 initListWidget(); |
218 |
215 |
219 mEffectHandler = new LogsEffectHandler; |
216 mEffectHandler = new LogsEffectHandler(mViewManager.mainWindow()); |
220 connect(mEffectHandler, SIGNAL(dissappearByMovingComplete()), |
217 connect(mEffectHandler, SIGNAL(dissappearByMovingComplete()), |
221 this, SLOT(dissappearByMovingComplete())); |
218 this, SLOT(dissappearByMovingComplete())); |
222 connect(mEffectHandler, SIGNAL(dissappearByFadingComplete()), |
219 connect(mEffectHandler, SIGNAL(dissappearByFadingComplete()), |
223 this, SLOT(dissappearByFadingComplete())); |
220 this, SLOT(dissappearByFadingComplete())); |
224 connect(mEffectHandler, SIGNAL(appearByMovingComplete()), |
221 connect(mEffectHandler, SIGNAL(appearByMovingComplete()), |
297 // ----------------------------------------------------------------------------- |
294 // ----------------------------------------------------------------------------- |
298 // |
295 // |
299 void LogsRecentCallsView::dialpadEditorTextChanged() |
296 void LogsRecentCallsView::dialpadEditorTextChanged() |
300 { |
297 { |
301 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::dialpadEditorTextChanged()" ); |
298 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::dialpadEditorTextChanged()" ); |
302 if ( mDialpad->editor().text().length() > 0 && isContactSearchEnabled() ) { |
299 if ( currDialpadText().length() > 0 && isContactSearchEnabled() ) { |
|
300 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::dialpadEditorTextChanged() editor().txt.length() > 0" ); |
303 QVariant arg = qVariantFromValue( mMatchesModel ); |
301 QVariant arg = qVariantFromValue( mMatchesModel ); |
304 if ( mViewManager.activateView( LogsMatchesViewId, true, arg ) ){ |
302 if ( mViewManager.activateView( LogsMatchesViewId, true, arg , currDialpadText()) ){ |
305 mMatchesModel = 0; // Ownership was given to matches view |
303 mMatchesModel = 0; // Ownership was given to matches view |
306 } |
304 } |
307 } else { |
305 } else { |
308 updateMenu(); |
306 updateMenu(); |
309 updateCallButton(); |
307 updateCallButton(); |
375 LOGS_QDEBUG_2( "logs [UI] -> LogsRecentCallsView::updateView(), view:", view ); |
373 LOGS_QDEBUG_2( "logs [UI] -> LogsRecentCallsView::updateView(), view:", view ); |
376 mCurrentView = view; |
374 mCurrentView = view; |
377 LogsFilter::FilterType filter = getFilter( view ); |
375 LogsFilter::FilterType filter = getFilter( view ); |
378 updateFilter(filter); |
376 updateFilter(filter); |
379 updateViewName(); |
377 updateViewName(); |
380 updateContextMenuItems(mCurrentView); |
378 updateViewSwitchList(mCurrentView); |
381 handleMissedCallsCounter(); |
379 handleMissedCallsCounter(); |
382 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateView()" ); |
380 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateView()" ); |
383 } |
381 } |
384 |
382 |
385 // ----------------------------------------------------------------------------- |
383 // ----------------------------------------------------------------------------- |
386 // LogsRecentCallsView::changeFilter |
384 // LogsRecentCallsView::handleViewSwitchSelected |
387 // ----------------------------------------------------------------------------- |
385 // ----------------------------------------------------------------------------- |
388 // |
386 // |
389 void LogsRecentCallsView::changeFilter(HbAction* action) |
387 void LogsRecentCallsView::handleViewSwitchSelected(HbListWidgetItem* item) |
390 { |
388 { |
391 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::changeFilter()" ); |
389 LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::handleViewSwitchSelected()" ); |
392 XQService::LogsViewIndex view = mActionMap.key( action->objectName(), |
390 XQService::LogsViewIndex viewId = |
393 XQService::LogsViewAll ); |
391 (XQService::LogsViewIndex)item->data(Qt::UserRole).toInt(); |
394 updateContextMenuItems(view); |
392 changeView(viewId); |
395 changeView(view); |
393 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::handleViewSwitchSelected()" ); |
396 |
394 } |
397 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::changeFilter()" ); |
395 |
398 } |
|
399 |
396 |
400 // ----------------------------------------------------------------------------- |
397 // ----------------------------------------------------------------------------- |
401 // LogsRecentCallsView::handleBackSoftkey |
398 // LogsRecentCallsView::handleBackSoftkey |
402 // ----------------------------------------------------------------------------- |
399 // ----------------------------------------------------------------------------- |
403 // |
400 // |
499 mViewName->setHeading( mTitleMap.value(mConversionMap.value(mCurrentView))); |
496 mViewName->setHeading( mTitleMap.value(mConversionMap.value(mCurrentView))); |
500 } |
497 } |
501 } |
498 } |
502 |
499 |
503 // ----------------------------------------------------------------------------- |
500 // ----------------------------------------------------------------------------- |
504 // LogsRecentCallsView::updateContextMenuItems |
501 // LogsRecentCallsView::updateViewSwitchList |
505 // ----------------------------------------------------------------------------- |
502 // ----------------------------------------------------------------------------- |
506 // |
503 // |
507 void LogsRecentCallsView::updateContextMenuItems(XQService::LogsViewIndex view) |
504 void LogsRecentCallsView::updateViewSwitchList(XQService::LogsViewIndex view) |
508 { |
505 { |
509 LOGS_QDEBUG_2( |
506 LOGS_QDEBUG_2( "logs [UI] -> LogsRecentCallsView::updateShowViewList(), view:", view ); |
510 "logs [UI] -> LogsRecentCallsView::updateContextMenuItems(), view:", view ); |
507 if (mViewSwitchList) { |
511 if ( mShowFilterMenu ) { |
508 for (int i=0; i < mViewSwitchList->count(); i++) { |
512 QString activeActionName = mActionMap.value(view); |
509 if (mViewSwitchList->item(i)->data(Qt::UserRole).toInt() == view) { |
513 foreach (QAction* action, mShowFilterMenu->actions() ) { |
510 mViewSwitchList->setCurrentRow(i); |
514 action->setChecked( action->objectName() == activeActionName ); |
511 mViewSwitchList->selectionModel()->setCurrentIndex( |
515 } |
512 mViewSwitchList->currentIndex(), |
516 } |
513 QItemSelectionModel::SelectCurrent); |
517 LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateContextMenuItems()" ); |
514 break; |
|
515 } |
|
516 } |
|
517 } |
518 } |
518 } |
519 |
519 |
520 // ----------------------------------------------------------------------------- |
520 // ----------------------------------------------------------------------------- |
521 // LogsRecentCallsView::getFilter |
521 // LogsRecentCallsView::getFilter |
522 // ----------------------------------------------------------------------------- |
522 // ----------------------------------------------------------------------------- |
842 // If dialpad contains text or there is items in list, call button is enabled |
842 // If dialpad contains text or there is items in list, call button is enabled |
843 // ----------------------------------------------------------------------------- |
843 // ----------------------------------------------------------------------------- |
844 // |
844 // |
845 void LogsRecentCallsView::updateCallButton() |
845 void LogsRecentCallsView::updateCallButton() |
846 { |
846 { |
847 bool isVisible = !mDialpad->editor().text().isEmpty(); |
847 bool isVisible = !currDialpadText().isEmpty(); |
848 if ( !isVisible && mFilter ) { |
848 if ( !isVisible && mFilter ) { |
849 isVisible = ( mFilter->rowCount() > 0 ); |
849 isVisible = ( mFilter->rowCount() > 0 ); |
850 } |
850 } |
851 mDialpad->setCallButtonEnabled( isVisible ); |
851 mDialpad->setCallButtonEnabled( isVisible ); |
852 } |
852 } |
900 // LogsRecentCallsView::handleMissedCallsCounter |
900 // LogsRecentCallsView::handleMissedCallsCounter |
901 // ----------------------------------------------------------------------------- |
901 // ----------------------------------------------------------------------------- |
902 // |
902 // |
903 void LogsRecentCallsView::handleMissedCallsCounter() |
903 void LogsRecentCallsView::handleMissedCallsCounter() |
904 { |
904 { |
905 if (mModel && mCurrentView == XQService::LogsViewMissed) { |
905 if (mModel && (mCurrentView == XQService::LogsViewMissed |
|
906 || mCurrentView == XQService::LogsViewAll)) { |
906 LOGS_QDEBUG( "logs [UI] <-> LogsRecentCallsView::clearMissedCallsCounter()" ); |
907 LOGS_QDEBUG( "logs [UI] <-> LogsRecentCallsView::clearMissedCallsCounter()" ); |
907 mModel->clearMissedCallsCounter(); |
908 mModel->clearMissedCallsCounter(); |
908 } |
909 } |
909 } |
910 } |
910 |
911 |
|
912 |