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