logsui/logsapp/src/logsbaseview.cpp
changeset 4 e52d42f9500c
parent 2 7119b73b84d6
child 6 41c0a814d878
equal deleted inserted replaced
2:7119b73b84d6 4:e52d42f9500c
   390         mDialpad->setPos(QPointF(screenRect.width()/2,
   390         mDialpad->setPos(QPointF(screenRect.width()/2,
   391                                  this->scenePos().y()));
   391                                  this->scenePos().y()));
   392         mDialpad->setPreferredSize(screenRect.width()/2,
   392         mDialpad->setPreferredSize(screenRect.width()/2,
   393                                    (screenRect.height()-scenePos().y()));                                  
   393                                    (screenRect.height()-scenePos().y()));                                  
   394     } else {
   394     } else {
   395         // dialpad takes 65% of the screen height
   395         // dialpad takes 55% of the screen height
   396         qreal screenHeight = screenRect.height();
   396         qreal screenHeight = screenRect.height();
   397         mDialpad->setPos(QPointF(0, screenHeight/2.25));
   397         mDialpad->setPos(QPointF(0, screenHeight*0.45));
   398         mDialpad->setPreferredSize(screenRect.width(),
   398         mDialpad->setPreferredSize(screenRect.width(),
   399                                    screenHeight-screenHeight/2.25);        
   399                                    screenHeight*0.55);        
   400     }
   400     }
   401     LOGS_QDEBUG( "logs [UI] <- LogsBaseView::setDialpadPosition()" );
   401     LOGS_QDEBUG( "logs [UI] <- LogsBaseView::setDialpadPosition()" );
   402 }
   402 }
   403 
   403 
   404 // -----------------------------------------------------------------------------
   404 // -----------------------------------------------------------------------------
   508         mDialpad->closeDialpad();
   508         mDialpad->closeDialpad();
   509     }    
   509     }    
   510     if (itemContextMenu->actions().count() > 0) {
   510     if (itemContextMenu->actions().count() > 0) {
   511         itemContextMenu->setPreferredPos(coords,HbPopup::TopLeftCorner);
   511         itemContextMenu->setPreferredPos(coords,HbPopup::TopLeftCorner);
   512         itemContextMenu->open();
   512         itemContextMenu->open();
   513         //TODO: 
       
   514         //the hack below is needed since otherwise listbox will get mouse event
       
   515         //and "activated" signal will be emitted (=>initiateCallback() called)
       
   516         //Remove it, when something is done in platform code for that
       
   517         if (scene()) {
       
   518              QGraphicsItem *item = scene()->mouseGrabberItem();
       
   519              if (item) {
       
   520                  LOGS_QDEBUG( "logs [UI] -> LogsBaseView::showListItemMenu() ungrabbing the mouse" );
       
   521                  item->ungrabMouse();
       
   522              }
       
   523         }
       
   524     }
   513     }
   525 }
   514 }
   526 
   515 
   527 // -----------------------------------------------------------------------------
   516 // -----------------------------------------------------------------------------
   528 //
   517 //
   713         popup->setDismissPolicy(HbDialog::NoDismiss);
   702         popup->setDismissPolicy(HbDialog::NoDismiss);
   714         popup->setHeadingWidget(
   703         popup->setHeadingWidget(
   715                 new HbLabel(hbTrId("txt_dial_title_add_to_contacts"), popup));
   704                 new HbLabel(hbTrId("txt_dial_title_add_to_contacts"), popup));
   716         popup->setAttribute(Qt::WA_DeleteOnClose);
   705         popup->setAttribute(Qt::WA_DeleteOnClose);
   717         popup->setTimeout( HbPopup::NoTimeout );
   706         popup->setTimeout( HbPopup::NoTimeout );
   718         popup->setSecondaryAction(
   707         popup->addAction(
   719                 new HbAction(hbTrId("txt_dial_button_cancel"), popup));
   708                 new HbAction(hbTrId("txt_dial_button_cancel"), popup));
   720 
   709 
   721         HbWidget* buttonWidget = new HbWidget(popup);
   710         HbWidget* buttonWidget = new HbWidget(popup);
   722         QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
   711         QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
   723         
   712         
  1035 //
  1024 //
  1036 // -----------------------------------------------------------------------------
  1025 // -----------------------------------------------------------------------------
  1037 //
  1026 //
  1038 void LogsBaseView::handleOrientationChanged()
  1027 void LogsBaseView::handleOrientationChanged()
  1039 {
  1028 {
  1040     LOGS_QDEBUG( "logs [UI] -> LogsBaseView::handleOrientationChanged()!" );
  1029     LOGS_QDEBUG( "logs [UI] -> LogsBaseView::handleOrientationChanged()" );
  1041     setDialpadPosition();
  1030     setDialpadPosition();
  1042     updateWidgetsSizeAndLayout();    
  1031     updateWidgetsSizeAndLayout();    
  1043     LOGS_QDEBUG( "logs [UI] <- LogsBaseView::handleOrientationChanged()");
  1032     LOGS_QDEBUG( "logs [UI] <- LogsBaseView::handleOrientationChanged()");
  1044 }
  1033 }
  1045 
  1034 
  1061 void LogsBaseView::askConfirmation( QString heading , QString text,
  1050 void LogsBaseView::askConfirmation( QString heading , QString text,
  1062         QObject* receiver, const char* okSlot, const char* cancelSlot )
  1051         QObject* receiver, const char* okSlot, const char* cancelSlot )
  1063 {
  1052 {
  1064     HbMessageBox* note = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion);
  1053     HbMessageBox* note = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion);
  1065     note->setAttribute(Qt::WA_DeleteOnClose);
  1054     note->setAttribute(Qt::WA_DeleteOnClose);
  1066     note->setHeadingWidget(new HbLabel( heading ));
  1055     note->setHeadingWidget(new HbLabel(heading));
  1067     //note->setText( text );
  1056     note->setDismissPolicy(HbPopup::TapOutside);    
  1068     note->setPrimaryAction(new HbAction(hbTrId("txt_common_button_ok"), note));
  1057     
  1069     note->setSecondaryAction(new HbAction(hbTrId("txt_common_button_cancel"), note));
  1058     if (note->actions().count() > 0 && note->actions().at(0)) {
  1070 
  1059         note->actions().at(0)->setText(hbTrId("txt_common_button_ok"));
  1071     if (receiver && okSlot) {
  1060         
  1072         connect(note->primaryAction(), SIGNAL(triggered()), receiver, okSlot);
  1061         if (receiver && okSlot) {
  1073     }
  1062             connect(note->actions().at(0), SIGNAL(triggered()), receiver, okSlot);
  1074     if (receiver && cancelSlot) {
  1063         }
  1075         connect(note->secondaryAction(), SIGNAL(triggered()), receiver, cancelSlot);
  1064     }
       
  1065     if (note->actions().count() > 1 && note->actions().at(1)) {
       
  1066         note->actions().at(1)->setText(hbTrId("txt_common_button_cancel"));
       
  1067     
       
  1068         if (receiver && cancelSlot) {
       
  1069             connect(note->actions().at(1), SIGNAL(triggered()), receiver, cancelSlot);
       
  1070         }
  1076     }
  1071     }
  1077     note->open();
  1072     note->open();
  1078 }
  1073 }
  1079 
  1074 
  1080 // -----------------------------------------------------------------------------
  1075 // -----------------------------------------------------------------------------
  1088                       mRepository.findObject( logsRecentViewContactSearchMenuActionId ) );
  1083                       mRepository.findObject( logsRecentViewContactSearchMenuActionId ) );
  1089     if ( contactSearchAction ) {
  1084     if ( contactSearchAction ) {
  1090         if ( isContactSearchPermanentlyDisabled() ){
  1085         if ( isContactSearchPermanentlyDisabled() ){
  1091            contactSearchAction->setVisible(false);
  1086            contactSearchAction->setVisible(false);
  1092         } else if ( isContactSearchEnabled() ){
  1087         } else if ( isContactSearchEnabled() ){
  1093            contactSearchAction->setIconText("Contact search off");
       
  1094            contactSearchAction->setText(hbTrId("txt_dialer_ui_opt_contact_search_off"));
  1088            contactSearchAction->setText(hbTrId("txt_dialer_ui_opt_contact_search_off"));
  1095            contactSearchAction->setVisible(mDialpad->isOpen());
  1089            contactSearchAction->setVisible(mDialpad->isOpen());
  1096         } else {
  1090         } else {
  1097            contactSearchAction->setIconText("Contact search on");
       
  1098            contactSearchAction->setText(hbTrId("txt_dialer_ui_opt_contact_search_on"));
  1091            contactSearchAction->setText(hbTrId("txt_dialer_ui_opt_contact_search_on"));
  1099            contactSearchAction->setVisible(mDialpad->isOpen());
  1092            contactSearchAction->setVisible(mDialpad->isOpen());
  1100         }
  1093         }
  1101     }
  1094     }
  1102     LOGS_QDEBUG( "logs [UI] <- LogsBaseView::updateContactSearchAction()" );
  1095     LOGS_QDEBUG( "logs [UI] <- LogsBaseView::updateContactSearchAction()" );