cellular/psuinotes/src/psuinotes.cpp
changeset 50 2313cb430f28
parent 32 1f002146abb4
child 48 78df25012fda
equal deleted inserted replaced
45:61f927bc9441 50:2313cb430f28
     1 /*
     1 /*
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   412  */
   412  */
   413 void PsUiNotes::formatActiveDivertsNoteText(
   413 void PsUiNotes::formatActiveDivertsNoteText(
   414     const QList<PSCallDivertingStatus*> &divertingStatusList,
   414     const QList<PSCallDivertingStatus*> &divertingStatusList,
   415     QString &text)
   415     QString &text)
   416 {
   416 {
   417     text.append(hbTrId("Active for:") + "\n\n"); //txt_phone_title_active_for
   417     text.append(hbTrId("txt_phone_title_active_for") + "\n\n"); 
   418              
   418              
   419     int entries = divertingStatusList.count(); 
   419     int entries = divertingStatusList.count(); 
   420     DPRINT << ": entries " << entries;
   420     DPRINT << ": entries " << entries;
   421     bool dataSet = false;
   421     bool dataSet = false;
   422     bool voiceSet = false;
   422     bool voiceSet = false;
   425        
   425        
   426        if (((entry->iServiceGroup & ServiceGroupVoice) && !voiceSet ) ||
   426        if (((entry->iServiceGroup & ServiceGroupVoice) && !voiceSet ) ||
   427            ((entry->iServiceGroup & ServiceGroupData)) && !dataSet) {   
   427            ((entry->iServiceGroup & ServiceGroupData)) && !dataSet) {   
   428            if ((entry->iServiceGroup & ServiceGroupVoice) && !voiceSet) {
   428            if ((entry->iServiceGroup & ServiceGroupVoice) && !voiceSet) {
   429                voiceSet = true;
   429                voiceSet = true;
   430                text.append(hbTrId("Voice calls") + "\n"); //txt_phone_info_voice_calls  
   430                text.append(hbTrId("txt_phone_info_voice_calls") + "\n"); 
   431               
   431               
   432            }
   432            }
   433            else if ((entry->iServiceGroup & ServiceGroupData) && !dataSet) {
   433            else if ((entry->iServiceGroup & ServiceGroupData) && !dataSet) {
   434                dataSet = true;
   434                dataSet = true;
   435                text.append(hbTrId("Video calls") + "\n"); //txt_phone_info_video_calls
   435                text.append(hbTrId("txt_phone_info_video_calls") + "\n"); 
   436            }
   436            }
   437                 
   437                 
   438            QString phoneNumber = formatPhoneNumber(divertingStatusList.at(i)->iNumber);
   438            QString phoneNumber = formatPhoneNumber(divertingStatusList.at(i)->iNumber);
   439            text.append(hbTrId("To number:\n%L1").arg(phoneNumber) +"\n"); //txt_phone_info_to_numbernl1
   439            text.append(hbTrId("txt_phone_info_to_numbernl1").arg(phoneNumber) +"\n");
   440            if (0 < entry->iTimeout) {
   440            if (0 < entry->iTimeout) {
   441                text.append(hbTrId("Delay time:\n%L1 seconds").
   441                text.append(hbTrId("txt_phone_info_delay_timenln_seconds",
   442                    arg(entry->iTimeout) +"\n\n"); // txt_phone_info_delay_timenln_seconds    
   442                    entry->iTimeout) + "\n\n");     
   443            }
   443            }
   444            else {
   444            else {
   445                text.append("\n");
   445                text.append("\n");
   446            }
   446            }
   447           
       
   448        }
   447        }
   449     }
   448     }
   450     // Convert plain text to html 
   449     // Convert plain text to html 
   451     text = Qt::convertFromPlainText(text);
   450     text = Qt::convertFromPlainText(text);
   452 }
   451 }
   455   PsUiNotes::activeNoteAboutToClose.
   454   PsUiNotes::activeNoteAboutToClose.
   456  */
   455  */
   457 void PsUiNotes::activeNoteAboutToClose()
   456 void PsUiNotes::activeNoteAboutToClose()
   458 {
   457 {
   459     DPRINT << ": IN";
   458     DPRINT << ": IN";
   460     
   459 
       
   460 
   461     if (m_isNoteShowingOngoing) {
   461     if (m_isNoteShowingOngoing) {
   462         m_isNoteShowingOngoing = false;
   462         m_isNoteShowingOngoing = false;
   463         QObject* note(NULL);
   463         QObject* note(NULL);
   464         if (!m_notesQueue->isEmpty()) {
   464         if (!m_notesQueue->isEmpty()) {
   465             note = m_notesQueue->dequeue();
   465             note = m_notesQueue->dequeue();
   471             HbDeviceProgressDialog *pNote = 
   471             HbDeviceProgressDialog *pNote = 
   472                 qobject_cast<HbDeviceProgressDialog *>(note);
   472                 qobject_cast<HbDeviceProgressDialog *>(note);
   473             note->deleteLater();
   473             note->deleteLater();
   474         }
   474         }
   475     }
   475     }
   476     
   476 
   477     DPRINT << ": OUT";
   477     DPRINT << ": OUT";
   478 }
   478 }
   479 
   479 
   480 /*!
   480 /*!
   481   PsUiNotes::handleProgressNoteCanceled().
   481   PsUiNotes::handleProgressNoteCanceled().
   482  */
   482  */
   483 void PsUiNotes::handleProgressNoteCanceled()
   483 void PsUiNotes::handleProgressNoteCanceled()
   484 {
   484 {
   485     DPRINT << ": IN";
   485     DPRINT << ": IN";
   486     
   486 
   487     emit progressNoteCanceled();
   487     emit progressNoteCanceled();
   488     
   488 
   489     DPRINT << ": OUT";
   489     DPRINT << ": OUT";
   490 }
   490 }
   491 
   491 
   492 /*!
   492 /*!
   493   PsUiNotes::passwordTextChanged().
   493   PsUiNotes::passwordTextChanged().
   494  */
   494  */
   495 void PsUiNotes::passwordTextChanged()
   495 void PsUiNotes::passwordTextChanged()
   496 {
   496 {
   497     DPRINT << ": IN";
   497     DPRINT << ": IN";
   498     Q_ASSERT(m_passwordDialog && m_passwordValidator);
   498     Q_ASSERT(m_passwordDialog && m_passwordValidator);
   499     
   499 
   500     HbLineEdit *hbLineEdit = m_passwordDialog->lineEdit();
   500     HbLineEdit *hbLineEdit = m_passwordDialog->lineEdit();
   501     int position = 0;
   501     int position = 0;
   502     QString password = hbLineEdit->text();
   502     QString password = hbLineEdit->text();
   503     bool isPasswordValid = 
   503     bool isPasswordValid = 
   504         (QValidator::Acceptable == m_passwordValidator->validate(
   504         (QValidator::Acceptable == m_passwordValidator->validate(
   505             password, position));
   505             password, position));
   506     m_passwordDialog->actions().at(0)->setEnabled(isPasswordValid);
   506     m_passwordDialog->actions().at(0)->setEnabled(isPasswordValid);
   507         
   507 
   508     DPRINT << ": OUT";
   508     DPRINT << ": OUT";
   509 }
   509 }
   510 
   510 
   511 
   511 
   512 /*!
   512 /*!
   513   PsUiNotes::showNotificationDialog.
   513   PsUiNotes::showNotificationDialog.
   514  */
   514  */
   515 void PsUiNotes::showNotificationDialog(const QString& text)
   515 void PsUiNotes::showNotificationDialog(const QString& text)
   516 {
   516 {
   517     DPRINT << ": IN";
   517     DPRINT << ": IN";
   518     
   518 
   519     HbNotificationDialog *notifDialog = new HbNotificationDialog();
   519     HbNotificationDialog *notifDialog = new HbNotificationDialog();
   520     
   520     
   521     notifDialog->setDismissPolicy(HbPopup::TapAnywhere);
   521     notifDialog->setDismissPolicy(HbPopup::TapAnywhere);
   522     notifDialog->setAttribute(Qt::WA_DeleteOnClose, true);
   522     notifDialog->setAttribute(Qt::WA_DeleteOnClose, true);
   523     notifDialog->setText(text);
   523     notifDialog->setTitle(text);
   524     notifDialog->show();
   524     notifDialog->show();
   525 
   525 
   526     DPRINT << ": OUT";
   526     DPRINT << ": OUT";
   527 }
   527 }
   528 
   528 
   532 void PsUiNotes::showGlobalNotificationDialog(const QString& text)
   532 void PsUiNotes::showGlobalNotificationDialog(const QString& text)
   533 {
   533 {
   534     DPRINT << ": IN";
   534     DPRINT << ": IN";
   535         
   535         
   536     HbDeviceNotificationDialog notifDialog;
   536     HbDeviceNotificationDialog notifDialog;
   537       
   537 
   538     notifDialog.setText(text);
   538     notifDialog.setTitle(text);
   539     notifDialog.show();
   539     notifDialog.show();
   540     
   540 
   541     DPRINT << ": OUT";    
   541     DPRINT << ": OUT";    
   542 }
   542 }
   543 
   543 
   544 // End of File.
   544 // End of File.