messagingapp/msgnotifications/msgerrornotifier/src/msgerrornotifiersvc.cpp
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 62 fdbe8253b596
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
    23 #include <HbAction>
    23 #include <HbAction>
    24 #include <xqservicerequest.h>
    24 #include <xqservicerequest.h>
    25 #include <xqaiwrequest.h>
    25 #include <xqaiwrequest.h>
    26 #include <xqappmgr.h>
    26 #include <xqappmgr.h>
    27 #include <ccsdefs.h>
    27 #include <ccsdefs.h>
       
    28 #include <qaction.h>
       
    29 #include <xqsystemtoneservice.h>
    28 
    30 
    29 #define LOC_VIEW hbTrId("txt_messaging_button_view")
    31 #define LOC_VIEW hbTrId("txt_messaging_button_view")
    30 #define LOC_CANCEL hbTrId("txt_common_button_cancel")
    32 #define LOC_CANCEL hbTrId("txt_common_button_cancel")
    31 #define LOC_SEND_FAILURE hbTrId("txt_messaging_list_message_sending_failed")
    33 #define LOC_SEND_FAILURE hbTrId("txt_messaging_list_message_sending_failed")
    32 
    34 #define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
    33 //---------------------------------------------------------
    35 //---------------------------------------------------------
    34 // Constructor
    36 // Constructor
    35 //---------------------------------------------------------
    37 //---------------------------------------------------------
    36 MsgErrorNotifierSvc::MsgErrorNotifierSvc(QObject* parent) :
    38 MsgErrorNotifierSvc::MsgErrorNotifierSvc(QObject* parent) :
    37     XQServiceProvider(QLatin1String("messaging.com.nokia.symbian.MsgErrorNotifier"), parent)
    39     XQServiceProvider(QLatin1String("messaging.com.nokia.symbian.MsgErrorNotifier"), parent)
    38 {
    40 {
       
    41     mSts = new XQSystemToneService();
    39     publishAll();
    42     publishAll();
    40 
    43 
    41 }
    44 }
    42 //---------------------------------------------------------
    45 //---------------------------------------------------------
    43 // Destructor
    46 // Destructor
    44 //---------------------------------------------------------
    47 //---------------------------------------------------------
    45 MsgErrorNotifierSvc::~MsgErrorNotifierSvc()
    48 MsgErrorNotifierSvc::~MsgErrorNotifierSvc()
    46 {
    49 {
    47 
    50     if(mSts)
       
    51         {
       
    52         delete mSts;
       
    53         mSts = NULL;
       
    54         }
    48 }
    55 }
    49 
    56 
    50 //---------------------------------------------------------
    57 //---------------------------------------------------------
    51 // displayErrorNote
    58 // displayErrorNote
    52 // @see msgerrornotifiersvc.h
    59 // @see msgerrornotifiersvc.h
    64     QString errorNote;
    71     QString errorNote;
    65     
    72     
    66     int msgType = third.toInt();
    73     int msgType = third.toInt();
    67     if (msgType == ECsMmsNotification)
    74     if (msgType == ECsMmsNotification)
    68     {
    75     {
    69         errorNote.append("Message Retrieval Failed!");//TODO: use logical str name
    76         errorNote.append(LOC_MMS_RETRIEVAL_FAILED);
    70     }
    77     }
    71     else
    78     else
    72     {
    79     {
    73         errorNote.append(LOC_SEND_FAILURE);
    80         errorNote.append(LOC_SEND_FAILURE);
    74         errorNote.append(QChar(QChar::LineSeparator));
    81         errorNote.append(QChar(QChar::LineSeparator));
    77         errorNote.append(contactName);        
    84         errorNote.append(contactName);        
    78     }
    85     }
    79     
    86     
    80     messageBox.setTimeout(HbPopup::NoTimeout);
    87     messageBox.setTimeout(HbPopup::NoTimeout);
    81     messageBox.setText(errorNote);
    88     messageBox.setText(errorNote);
    82     HbAction* actionView = new HbAction(LOC_VIEW);
    89     QAction* actionView = new QAction(LOC_VIEW,this);
    83     messageBox.setPrimaryAction(actionView);
    90     messageBox.setAction(actionView,HbDeviceMessageBox::AcceptButtonRole);
    84 
    91 
    85     HbAction* actionQuit = new HbAction(LOC_CANCEL);
    92     QAction* actionQuit = new QAction(LOC_CANCEL,this);
    86     actionQuit->setCommandRole(HbAction::QuitRole);
    93     messageBox.setAction(actionQuit,HbDeviceMessageBox::RejectButtonRole);
    87     messageBox.setSecondaryAction(actionQuit);
       
    88 
    94 
    89     setCurrentRequestAsync();
    95     setCurrentRequestAsync();
    90 
    96 
    91     HbAction* result = messageBox.exec();
    97     //Play audio alert when error notification is shown
    92 
    98     mSts->playTone(XQSystemToneService::MessageSendFailureTone);
    93     // TODO: use XQAiwrequest
    99     
    94     if (result->commandRole() != HbAction::QuitRole) {
   100     // launch Messagebox
       
   101     const QAction* result = messageBox.exec();
       
   102   
       
   103     // if accepted launch view else quit
       
   104     if (messageBox.isAcceptAction(result)) {
    95         QList<QVariant> args;
   105         QList<QVariant> args;
    96         QString serviceName("com.nokia.services.hbserviceprovider");
   106         QString serviceName("com.nokia.services.hbserviceprovider");
    97         QString operation("open(qint64)");
   107         QString operation("open(qint64)");
    98         XQAiwRequest* request;
   108         XQAiwRequest* request;
    99         XQApplicationManager appManager;
   109         XQApplicationManager appManager;