23 #include "logsmessage.h" |
23 #include "logsmessage.h" |
24 #include "logscontact.h" |
24 #include "logscontact.h" |
25 #include "logsabstractmodel.h" |
25 #include "logsabstractmodel.h" |
26 #include "logsmodel.h" |
26 #include "logsmodel.h" |
27 #include "logsdetailsmodel.h" |
27 #include "logsdetailsmodel.h" |
|
28 #include "logsconfigurationparams.h" |
28 |
29 |
29 //SYSTEM |
30 //SYSTEM |
30 #include <hbaction.h> |
31 #include <hbaction.h> |
31 #include <hbmainwindow.h> |
32 #include <hbmainwindow.h> |
32 #include <hbmessagebox.h> |
33 #include <hbmessagebox.h> |
71 mCall(0), |
72 mCall(0), |
72 mMessage(0), |
73 mMessage(0), |
73 mContact(0), |
74 mContact(0), |
74 mDetailsModel(0), |
75 mDetailsModel(0), |
75 mCallTypeMapper(0), |
76 mCallTypeMapper(0), |
76 mOptionsMenu(0) |
77 mOptionsMenu(0), |
|
78 mActivating(false) |
77 { |
79 { |
78 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::LogsBaseView()" ); |
80 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::LogsBaseView()" ); |
79 |
81 |
80 setNavigationAction(new HbAction(Hb::BackNaviAction, this)); |
82 setNavigationAction(new HbAction(Hb::BackNaviAction, this)); |
81 connect(navigationAction(), SIGNAL(triggered()), this, |
83 connect(navigationAction(), SIGNAL(triggered()), this, |
193 mRepository.setObjectTreeToView( mViewId ); |
195 mRepository.setObjectTreeToView( mViewId ); |
194 |
196 |
195 if (!mInitialized) { |
197 if (!mInitialized) { |
196 initView(); |
198 initView(); |
197 } |
199 } |
198 |
200 mActivating = true; |
|
201 |
199 connect( mDialpad, SIGNAL( aboutToClose() ), this, |
202 connect( mDialpad, SIGNAL( aboutToClose() ), this, |
200 SLOT( dialpadClosed() ), Qt::QueuedConnection ); |
203 SLOT( dialpadClosed() ), Qt::QueuedConnection ); |
201 connect( mDialpad, SIGNAL( aboutToOpen() ), this, |
204 connect( mDialpad, SIGNAL( aboutToOpen() ), this, |
202 SLOT( dialpadOpened() ), Qt::QueuedConnection ); |
205 SLOT( dialpadOpened() ), Qt::QueuedConnection ); |
203 connect( &mDialpad->editor(), SIGNAL( contentsChanged() ), this, |
206 connect( &mDialpad->editor(), SIGNAL( contentsChanged() ), this, |
207 openDialpad(); |
210 openDialpad(); |
208 } |
211 } |
209 |
212 |
210 updateWidgetsSizeAndLayout(); |
213 updateWidgetsSizeAndLayout(); |
211 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::activated()" ); |
214 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::activated()" ); |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 void LogsBaseView::activationCompleted() |
|
222 { |
|
223 LOGS_QDEBUG( "logs [UI] <-> LogsBaseView::activationCompleted()" ); |
|
224 mActivating = false; |
212 } |
225 } |
213 |
226 |
214 // ----------------------------------------------------------------------------- |
227 // ----------------------------------------------------------------------------- |
215 // |
228 // |
216 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
277 // ----------------------------------------------------------------------------- |
290 // ----------------------------------------------------------------------------- |
278 // |
291 // |
279 void LogsBaseView::addActionNamesToMap() |
292 void LogsBaseView::addActionNamesToMap() |
280 { |
293 { |
281 mActionMap.clear(); |
294 mActionMap.clear(); |
282 mActionMap.insert(LogsServices::ViewReceived, logsShowFilterReceivedMenuActionId); |
295 mActionMap.insert(XQService::LogsViewReceived, logsShowFilterReceivedMenuActionId); |
283 mActionMap.insert(LogsServices::ViewCalled, logsShowFilterDialledMenuActionId); |
296 mActionMap.insert(XQService::LogsViewCalled, logsShowFilterDialledMenuActionId); |
284 mActionMap.insert(LogsServices::ViewMissed, logsShowFilterMissedMenuActionId); |
297 mActionMap.insert(XQService::LogsViewMissed, logsShowFilterMissedMenuActionId); |
285 mActionMap.insert(LogsServices::ViewAll, logsShowFilterRecentMenuActionId); |
298 mActionMap.insert(XQService::LogsViewAll, logsShowFilterRecentMenuActionId); |
286 } |
299 } |
287 |
300 |
288 // ----------------------------------------------------------------------------- |
301 // ----------------------------------------------------------------------------- |
289 // |
302 // |
290 // ----------------------------------------------------------------------------- |
303 // ----------------------------------------------------------------------------- |
336 mViewManager.exitApplication(); |
349 mViewManager.exitApplication(); |
337 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::handleExit()" ); |
350 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::handleExit()" ); |
338 } |
351 } |
339 |
352 |
340 // ----------------------------------------------------------------------------- |
353 // ----------------------------------------------------------------------------- |
341 // LogsBaseView::callKeyPressed |
354 // |
342 // ----------------------------------------------------------------------------- |
355 // ----------------------------------------------------------------------------- |
343 // |
356 // |
344 void LogsBaseView::callKeyPressed() |
357 void LogsBaseView::callKeyPressed() |
345 { |
358 { |
346 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::callKeyPressed()" ); |
359 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::callKeyPressed()" ); |
357 |
370 |
358 // ----------------------------------------------------------------------------- |
371 // ----------------------------------------------------------------------------- |
359 // |
372 // |
360 // ----------------------------------------------------------------------------- |
373 // ----------------------------------------------------------------------------- |
361 // |
374 // |
|
375 void LogsBaseView::localeChanged() |
|
376 { |
|
377 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::localeChanged()" ); |
|
378 if (logsModel()) { |
|
379 LogsConfigurationParams params; |
|
380 params.setLocaleChanged(true); |
|
381 logsModel()->updateConfiguration(params); |
|
382 } |
|
383 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::localeChanged()" ); |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // |
|
388 // ----------------------------------------------------------------------------- |
|
389 // |
362 void LogsBaseView::showFilterMenu() |
390 void LogsBaseView::showFilterMenu() |
363 { |
391 { |
364 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::showFilterMenu()" ); |
392 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::showFilterMenu()" ); |
365 if ( mShowFilterMenu ) { |
393 if ( mShowFilterMenu ) { |
366 QRectF toolbarGeometry = toolBar()->geometry(); |
394 QRectF toolbarGeometry = toolBar()->geometry(); |
367 QSizeF menuSize = mShowFilterMenu->size(); |
395 QSizeF menuSize = mShowFilterMenu->size(); |
368 LOGS_QDEBUG_2("logs [UI] menusize:", menuSize) |
396 LOGS_QDEBUG_2("logs [UI] menusize:", menuSize) |
369 |
397 |
370 QPointF pos( toolbarGeometry.bottomRight().x(), |
398 if ( layoutDirection() == Qt::LeftToRight ){ |
371 toolbarGeometry.topRight().y() ); |
399 QPointF pos( toolbarGeometry.bottomRight().x(), |
372 |
400 toolbarGeometry.topRight().y() ); |
373 pos.setX(toolbarGeometry.bottomRight().x()); |
401 |
374 pos.setY(toolbarGeometry.topRight().y()); |
402 mShowFilterMenu->setPreferredPos(pos,HbPopup::BottomRightCorner); |
375 |
403 LOGS_QDEBUG_2("logs [UI] menu br pos:", pos) |
376 mShowFilterMenu->setPreferredPos(pos,HbPopup::BottomRightCorner); |
404 } else { |
377 LOGS_QDEBUG_2("logs [UI] menupos:", pos) |
405 QPointF pos( toolbarGeometry.topLeft().x(), |
|
406 toolbarGeometry.topLeft().y() ); |
|
407 |
|
408 mShowFilterMenu->setPreferredPos(pos,HbPopup::BottomLeftCorner); |
|
409 LOGS_QDEBUG_2("logs [UI] menu bl pos:", pos) |
|
410 } |
378 mShowFilterMenu->open(); |
411 mShowFilterMenu->open(); |
379 } |
412 } |
380 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::showFilterMenu()" ); |
413 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::showFilterMenu()" ); |
381 } |
414 } |
382 |
415 |
479 // ----------------------------------------------------------------------------- |
512 // ----------------------------------------------------------------------------- |
480 // |
513 // |
481 void LogsBaseView::changeFilter(HbAction* action) |
514 void LogsBaseView::changeFilter(HbAction* action) |
482 { |
515 { |
483 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::changeFilter()" ); |
516 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::changeFilter()" ); |
484 LogsServices::LogsView view = mActionMap.key( action->objectName(), |
517 XQService::LogsViewIndex view = mActionMap.key( action->objectName(), |
485 LogsServices::ViewAll ); |
518 XQService::LogsViewAll ); |
486 QVariant args(view); |
519 QVariant args(view); |
487 mViewManager.activateView( LogsRecentViewId, false, args ); |
520 mViewManager.activateView( LogsRecentViewId, false, args ); |
488 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::changeFilter()" ); |
521 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::changeFilter()" ); |
489 } |
522 } |
490 |
523 |
516 { |
549 { |
517 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::saveNumberInDialpadToContacts()" ); |
550 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::saveNumberInDialpadToContacts()" ); |
518 if (mDialpad->editor().text().length() > 0){ |
551 if (mDialpad->editor().text().length() > 0){ |
519 delete mContact; |
552 delete mContact; |
520 mContact = 0; |
553 mContact = 0; |
521 mContact = logsModel()->createContact(mDialpad->editor().text()); |
554 QString phoneNumber = |
|
555 HbStringUtil::convertDigitsTo(mDialpad->editor().text(), WesternDigit); |
|
556 mContact = logsModel()->createContact(phoneNumber); |
522 saveContact(); |
557 saveContact(); |
523 } |
558 } |
524 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::saveNumberInDialpadToContacts()" ); |
559 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::saveNumberInDialpadToContacts()" ); |
525 } |
560 } |
526 |
561 |
588 this, SLOT( initiateCall(int)) ); |
623 this, SLOT( initiateCall(int)) ); |
589 } |
624 } |
590 |
625 |
591 if (mMessage) { |
626 if (mMessage) { |
592 HbAction* messageAction = new HbAction; |
627 HbAction* messageAction = new HbAction; |
593 messageAction->setText(hbTrId("txt_common_menu_create_message")); |
628 messageAction->setText(hbTrId("txt_common_menu_send_message")); |
594 menu.addAction(messageAction); |
629 menu.addAction(messageAction); |
595 QObject::connect( messageAction, SIGNAL(triggered()), |
630 QObject::connect( messageAction, SIGNAL(triggered()), |
596 this, SLOT( createMessage() ) ); |
631 this, SLOT( createMessage() ) ); |
597 } |
632 } |
598 if (mContact) { |
633 if (mContact) { |
675 { |
710 { |
676 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::tryMessageToDialpadNumber()" ); |
711 LOGS_QDEBUG( "logs [UI] -> LogsBaseView::tryMessageToDialpadNumber()" ); |
677 bool messageSent = false; |
712 bool messageSent = false; |
678 if ( isDialpadInput() ){ |
713 if ( isDialpadInput() ){ |
679 // Message to inputted number |
714 // Message to inputted number |
680 LogsMessage::sendMessageToNumber( mDialpad->editor().text() ); |
715 QString phoneNumber = |
|
716 HbStringUtil::convertDigitsTo(mDialpad->editor().text(), WesternDigit); |
|
717 LogsMessage::sendMessageToNumber( phoneNumber ); |
681 messageSent = true; |
718 messageSent = true; |
682 } |
719 } |
683 LOGS_QDEBUG_2( "logs [UI] <- LogsBaseView::tryMessageToDialpadNumber(), sent", |
720 LOGS_QDEBUG_2( "logs [UI] <- LogsBaseView::tryMessageToDialpadNumber(), sent", |
684 messageSent ); |
721 messageSent ); |
685 return messageSent; |
722 return messageSent; |
843 mRepository.findWidget( logsLabelEmptyListId ) ); |
880 mRepository.findWidget( logsLabelEmptyListId ) ); |
844 } |
881 } |
845 if ( model ){ |
882 if ( model ){ |
846 // Listen for changes in model and update empty list label accordingly |
883 // Listen for changes in model and update empty list label accordingly |
847 connect( model, SIGNAL(rowsInserted(const QModelIndex&,int,int)), |
884 connect( model, SIGNAL(rowsInserted(const QModelIndex&,int,int)), |
848 this, SLOT(updateEmptyListWidgetsVisibility())); |
885 this, SLOT(updateEmptyListWidgetsVisibility()), |
|
886 Qt::UniqueConnection); |
849 connect( model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), |
887 connect( model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), |
850 this, SLOT(updateEmptyListWidgetsVisibility())); |
888 this, SLOT(updateEmptyListWidgetsVisibility()), |
|
889 Qt::UniqueConnection); |
851 connect( model, SIGNAL(modelReset()), |
890 connect( model, SIGNAL(modelReset()), |
852 this, SLOT(updateEmptyListWidgetsVisibility())); |
891 this, SLOT(updateEmptyListWidgetsVisibility()), |
|
892 Qt::UniqueConnection); |
853 // Update to reflect current situation |
893 // Update to reflect current situation |
854 updateEmptyListWidgetsVisibility(); |
894 updateEmptyListWidgetsVisibility(); |
855 } |
895 } |
856 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::activateEmptyListIndicator()" ); |
896 LOGS_QDEBUG( "logs [UI] <- LogsBaseView::activateEmptyListIndicator()" ); |
857 } |
897 } |