phonesettings/cpphonesettingsplugins/divertplugin/src/cpdivertplugingroup.cpp
changeset 56 5bcb308bd24d
parent 46 bc5a64e5bc3c
child 65 2a5d4ab426d3
equal deleted inserted replaced
46:bc5a64e5bc3c 56:5bcb308bd24d
    27 #include <hblistwidget.h>
    27 #include <hblistwidget.h>
    28 #include <hblistwidgetitem.h>
    28 #include <hblistwidgetitem.h>
    29 #include <hblabel.h>
    29 #include <hblabel.h>
    30 #include <hbparameterlengthlimiter.h>
    30 #include <hbparameterlengthlimiter.h>
    31 #include <cpitemdatahelper.h>
    31 #include <cpitemdatahelper.h>
       
    32 #include <psuinotes.h>
    32 #include "cpdivertplugingroup.h"
    33 #include "cpdivertplugingroup.h"
    33 #include "cpplugincommon.h"
    34 #include "cpplugincommon.h"
    34 #include "cpphonenotes.h"
       
    35 #include "cppluginlogging.h"
    35 #include "cppluginlogging.h"
    36 #include "cpdivertitemdata.h"
    36 #include "cpdivertitemdata.h"
    37 
    37 
    38 Q_DECLARE_METATYPE(PsCallDivertingCondition)
    38 Q_DECLARE_METATYPE(PsCallDivertingCondition)
    39 Q_DECLARE_METATYPE(PsServiceGroup)
    39 Q_DECLARE_METATYPE(PsServiceGroup)
   132 void CpDivertPluginGroup::createVoiceCallItems(CpSettingFormItemData *parent)
   132 void CpDivertPluginGroup::createVoiceCallItems(CpSettingFormItemData *parent)
   133 {
   133 {
   134     DPRINT << ": IN";
   134     DPRINT << ": IN";
   135     CpSettingFormItemData *page = new CpSettingFormItemData(
   135     CpSettingFormItemData *page = new CpSettingFormItemData(
   136                 HbDataFormModelItem::GroupPageItem,
   136                 HbDataFormModelItem::GroupPageItem,
   137                 hbTrId("txt_phone_setlabel_service_val_voice_divert"));
   137                 hbTrId("txt_phone_setlabel_service_val_voice_divert"),
       
   138                 this);
   138     page->setObjectName("voiceCallSettingsGroupItem");
   139     page->setObjectName("voiceCallSettingsGroupItem");
   139     parent->appendChild(page);
       
   140 
   140 
   141     m_DataItemVoiceAllCalls = createDivertItem(
   141     m_DataItemVoiceAllCalls = createDivertItem(
   142             DivertConditionUnconditional,
   142             DivertConditionUnconditional,
   143             ServiceGroupVoice,
   143             ServiceGroupVoice,
   144             hbTrId("txt_phone_setlabel_all_calls"),
   144             hbTrId("txt_phone_setlabel_all_calls"),
   188 {
   188 {
   189     DPRINT << ": IN";
   189     DPRINT << ": IN";
   190     
   190     
   191     CpSettingFormItemData *page = new CpSettingFormItemData(
   191     CpSettingFormItemData *page = new CpSettingFormItemData(
   192             HbDataFormModelItem::GroupPageItem,
   192             HbDataFormModelItem::GroupPageItem,
   193             hbTrId("txt_phone_setlabel_service_val_video_divert"));
   193             hbTrId("txt_phone_setlabel_service_val_video_divert"),
       
   194             this);
   194     page->setObjectName("videoCallSettingsGroupItem"); 
   195     page->setObjectName("videoCallSettingsGroupItem"); 
   195     
       
   196     parent->appendChild(page);
       
   197     
   196     
   198     m_DataItemVideoAllCalls = createDivertItem(
   197     m_DataItemVideoAllCalls = createDivertItem(
   199             DivertConditionUnconditional,
   198             DivertConditionUnconditional,
   200             ServiceGroupData,
   199             ServiceGroupData,
   201             hbTrId("txt_phone_setlabel_all_calls"),
   200             hbTrId("txt_phone_setlabel_all_calls"),
   271     // Connect signals
   270     // Connect signals
   272     QObject::connect(
   271     QObject::connect(
   273         item, SIGNAL(itemClicked(CpDivertItemData&)),
   272         item, SIGNAL(itemClicked(CpDivertItemData&)),
   274         this, SLOT(changeDivertingStateRequested(CpDivertItemData&)));
   273         this, SLOT(changeDivertingStateRequested(CpDivertItemData&)));
   275     
   274     
   276     parent->appendChild(item);
       
   277     
       
   278     DPRINT << ": OUT";
   275     DPRINT << ": OUT";
   279     return item;
   276     return item;
   280 }
   277 }
   281 
   278 
   282 /*!
   279 /*!
   294     }
   291     }
   295     
   292     
   296     bool isInitialStatusQueryDoneForItem = 
   293     bool isInitialStatusQueryDoneForItem = 
   297         modelItem->contentWidgetData("text").isValid();
   294         modelItem->contentWidgetData("text").isValid();
   298     if (!isInitialStatusQueryDoneForItem) {
   295     if (!isInitialStatusQueryDoneForItem) {
   299         CpDivertItemData *item = static_cast<CpDivertItemData*>(modelItem); 
   296         CpDivertItemData *pitem = static_cast<CpDivertItemData*>(modelItem); 
   300         if (qvariant_cast<PsCallDivertingCondition>(item->property("condition")) !=
   297         if (qvariant_cast<PsCallDivertingCondition>(pitem->property("condition")) !=
   301                 DivertConditionAllConditionalCases) {
   298                 DivertConditionAllConditionalCases) {
   302             addToDivertingRequestQueue(CheckDivertStatus, *item);
   299             addToDivertingRequestQueue(CheckDivertStatus, *pitem);
   303         }
   300         }
   304     }
   301     }
   305     
   302     
   306     DPRINT << ": OUT";
   303     DPRINT << ": OUT";
   307 }
   304 }
   340         processDivertingRequestQueue();
   337         processDivertingRequestQueue();
   341     }
   338     }
   342 
   339 
   343     if (m_divertRequestQueue.isEmpty()) {
   340     if (m_divertRequestQueue.isEmpty()) {
   344         // Queue empty so cancel process note
   341         // Queue empty so cancel process note
   345         CpPhoneNotes::instance()->cancelNote(m_activeProgressNoteId);
   342         PsUiNotes::instance()->cancelNote(m_activeProgressNoteId);
   346     }
   343     }
   347     
   344     
   348     DPRINT << ": OUT";
   345     DPRINT << ": OUT";
   349 }
   346 }
   350 
   347 
   555             m_callDivertingWrapper->getCallDivertingStatus(
   552             m_callDivertingWrapper->getCallDivertingStatus(
   556                 m_divertCommand.iServiceGroup,
   553                 m_divertCommand.iServiceGroup,
   557                 m_divertCommand.iCondition,
   554                 m_divertCommand.iCondition,
   558                 bscParam(m_divertCommand.iServiceGroup) );
   555                 bscParam(m_divertCommand.iServiceGroup) );
   559             
   556             
   560             if (!CpPhoneNotes::instance()->noteShowing()) {
   557             if (!PsUiNotes::instance()->noteShowing()) {
   561                 CpPhoneNotes::instance()->showGlobalProgressNote(
   558                 PsUiNotes::instance()->showGlobalProgressNote(
   562                         m_activeProgressNoteId, 
   559                         m_activeProgressNoteId, 
   563                         hbTrId("txt_common_info_requesting"));
   560                         hbTrId("txt_common_info_requesting"));
   564             }
   561             }
   565         }
   562         }
   566             break;
   563             break;
   598         const PSCallDivertingCommand& aSetting, 
   595         const PSCallDivertingCommand& aSetting, 
   599         bool aPlural)
   596         bool aPlural)
   600 {
   597 {
   601     DPRINT << ": IN";
   598     DPRINT << ": IN";
   602     
   599     
   603     CpPhoneNotes::instance()->cancelNote(m_activeNoteId);
   600     PsUiNotes::instance()->cancelNote(m_activeNoteId);
   604     DPRINT << "aPlural:" << aPlural;
   601     DPRINT << "aPlural:" << aPlural;
   605     DPRINT << "iCondition:" << aSetting.iCondition;
   602     DPRINT << "iCondition:" << aSetting.iCondition;
   606     DPRINT << "iNoReplyTimer:" << aSetting.iNoReplyTimer;
   603     DPRINT << "iNoReplyTimer:" << aSetting.iNoReplyTimer;
   607     DPRINT << "iNumber:" << aSetting.iNumber;
   604     DPRINT << "iNumber:" << aSetting.iNumber;
   608     DPRINT << "iServiceGroup:" << aSetting.iServiceGroup;
   605     DPRINT << "iServiceGroup:" << aSetting.iServiceGroup;
   619             (DivertingStatusActive != aSetting.iStatus) );
   616             (DivertingStatusActive != aSetting.iStatus) );
   620     
   617     
   621     switch (aSetting.iStatus) {
   618     switch (aSetting.iStatus) {
   622         case DivertingStatusActive: {
   619         case DivertingStatusActive: {
   623             if (aPlural) {
   620             if (aPlural) {
   624                 CpPhoneNotes::instance()->showNotificationDialog(
   621                 PsUiNotes::instance()->showNotificationDialog(
   625                     hbTrId("txt_phone_info_diverts_activated"));
   622                     hbTrId("txt_phone_info_diverts_activated"));
   626             } else {
   623             } else {
   627                 CpPhoneNotes::instance()->showNotificationDialog(
   624                 PsUiNotes::instance()->showNotificationDialog(
   628                     hbTrId("txt_phone_info_divert_activated"));
   625                     hbTrId("txt_phone_info_divert_activated"));
   629             }
   626             }
   630             QString voiceMailBoxNumber;
   627             QString voiceMailBoxNumber;
   631             QString videoMailBoxNumber;
   628             QString videoMailBoxNumber;
   632             m_callDivertingWrapper->getVoiceMailBoxNumber(voiceMailBoxNumber, ServiceGroupVoice);
   629             m_callDivertingWrapper->getVoiceMailBoxNumber(voiceMailBoxNumber, ServiceGroupVoice);
   638         }
   635         }
   639             break;
   636             break;
   640         case DivertingStatusNotRegistered:  
   637         case DivertingStatusNotRegistered:  
   641         case DivertingStatusInactive:
   638         case DivertingStatusInactive:
   642             if (aPlural) {
   639             if (aPlural) {
   643                 CpPhoneNotes::instance()->showNotificationDialog(
   640                 PsUiNotes::instance()->showNotificationDialog(
   644                     hbTrId("txt_phone_info_diverts_deactivated"));
   641                     hbTrId("txt_phone_info_diverts_deactivated"));
   645             } else {
   642             } else {
   646                 CpPhoneNotes::instance()->showNotificationDialog(
   643                 PsUiNotes::instance()->showNotificationDialog(
   647                     hbTrId("txt_phone_info_divert_deactivated"));
   644                     hbTrId("txt_phone_info_divert_deactivated"));
   648             }
   645             }
   649             break;
   646             break;
   650         case DivertingStatusNotProvisioned:
   647         case DivertingStatusNotProvisioned:
   651         case DivertingStatusUnknown:
   648         case DivertingStatusUnknown:
   652         default:
   649         default:
   653             CpPhoneNotes::instance()->showNotificationDialog(
   650             PsUiNotes::instance()->showNotificationDialog(
   654                 hbTrId("txt_phone_info_request_not_completed"));
   651                 hbTrId("txt_phone_info_request_not_completed"));
   655             break; 
   652             break; 
   656     }
   653     }
   657     
   654     
   658     DPRINT << ": OUT";
   655     DPRINT << ": OUT";
   705         
   702         
   706     // Clear queue
   703     // Clear queue
   707     m_divertRequestQueue.clear();
   704     m_divertRequestQueue.clear();
   708         
   705         
   709     // Cancel previous note
   706     // Cancel previous note
   710     CpPhoneNotes::instance()->cancelNote(m_activeNoteId);
   707     PsUiNotes::instance()->cancelNote(m_activeNoteId);
   711         
   708         
   712     // Show error note
   709     // Show error note
   713     CpPhoneNotes::instance()->showGlobalErrorNote(m_activeNoteId, aReason);
   710     PsUiNotes::instance()->showGlobalErrorNote(m_activeNoteId, aReason);
   714     
   711     
   715     DPRINT << ": OUT";
   712     DPRINT << ": OUT";
   716 }
   713 }
   717 
   714 
   718 /*!
   715 /*!
   920         }
   917         }
   921         
   918         
   922         DPRINT << ": m_divertCommand.iNumber "
   919         DPRINT << ": m_divertCommand.iNumber "
   923             << m_divertCommand.iNumber;
   920             << m_divertCommand.iNumber;
   924         if (m_divertCommand.iNumber.isEmpty()) {
   921         if (m_divertCommand.iNumber.isEmpty()) {
   925             CpPhoneNotes::instance()->showNotificationDialog(hbTrId("txt_phone_info_invalid_phone_number"));
   922             PsUiNotes::instance()->showNotificationDialog(hbTrId("txt_phone_info_invalid_phone_number"));
   926         }
   923         }
   927     }
   924     }
   928     if (m_dialog) {
   925     if (m_dialog) {
   929         m_dialog->deleteLater();
   926         m_dialog->deleteLater();
   930         m_dialog = NULL;
   927         m_dialog = NULL;
   949     DPRINT << "iStatus:" << command.iStatus;
   946     DPRINT << "iStatus:" << command.iStatus;
   950     
   947     
   951     int result = m_callDivertingWrapper->setCallDiverting(
   948     int result = m_callDivertingWrapper->setCallDiverting(
   952             command, bscParam(command.iServiceGroup));
   949             command, bscParam(command.iServiceGroup));
   953     if (0 == result) {
   950     if (0 == result) {
   954         if (!CpPhoneNotes::instance()->noteShowing()) {
   951         if (!PsUiNotes::instance()->noteShowing()) {
   955             CpPhoneNotes::instance()->showGlobalProgressNote(
   952             PsUiNotes::instance()->showGlobalProgressNote(
   956                     m_activeProgressNoteId, hbTrId("txt_common_info_requesting"));
   953                     m_activeProgressNoteId, hbTrId("txt_common_info_requesting"));
   957         }
   954         }
   958     } else {
   955     } else {
   959         handleDivertingError(result);
   956         handleDivertingError(result);
   960     }
   957     }
  1311                 break;
  1308                 break;
  1312             case PopUpTimerQueryPhase: {
  1309             case PopUpTimerQueryPhase: {
  1313                 m_activateDivertPhase = NonePhase;
  1310                 m_activateDivertPhase = NonePhase;
  1314                 setCallDiverting(m_divertCommand);
  1311                 setCallDiverting(m_divertCommand);
  1315             }
  1312             }
       
  1313                 break;
  1316             default:
  1314             default:
  1317                 DPRINT << "Error: unknown enum value";
  1315                 DPRINT << "Error: unknown enum value";
  1318                 break;
  1316                 break;
  1319         }
  1317         }
  1320     } else {
  1318     } else {