messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp
branchGCC_SURGE
changeset 47 5b14749788d7
parent 27 e4592d119491
parent 44 36f374c67aa8
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
    22 #include <ccsrequesthandler.h>
    22 #include <ccsrequesthandler.h>
    23 #include <ccsconversationentry.h>
    23 #include <ccsconversationentry.h>
    24 #include <xqservicerequest.h>
    24 #include <xqservicerequest.h>
    25 #include <QString>
    25 #include <QString>
    26 #include <w32std.h>
    26 #include <w32std.h>
    27 #include <APGTASK.H> 
    27 #include <apgtask.h> 
    28 #include <XQSettingsManager>
    28 #include <XQSettingsManager>
    29 #include <xqpublishandsubscribeutils.h>
    29 #include <xqpublishandsubscribeutils.h>
       
    30 #include <xqsystemtoneservice.h>
       
    31 #include <xqconversions.h>
    30 
    32 
    31 //USER INCLUDES
    33 //USER INCLUDES
    32 #include "msgnotifier.h"
    34 #include "msgnotifier.h"
    33 #include "msgnotifier_p.h"
    35 #include "msgnotifier_p.h"
    34 #include "s60qconversions.h"
       
    35 #include "msgstorehandler.h"
    36 #include "msgstorehandler.h"
    36 #include "msginfodefs.h"
    37 #include "msginfodefs.h"
    37 #include "conversationidpsconsts.h"
    38 #include "conversationidpsconsts.h"
    38 #include "debugtraces.h"
    39 #include "debugtraces.h"
    39 
       
    40 
    40 
    41 // ----------------------------------------------------------------------------
    41 // ----------------------------------------------------------------------------
    42 // MsgNotifierPrivate::MsgNotifierPrivate
    42 // MsgNotifierPrivate::MsgNotifierPrivate
    43 // @see MsgNotifierPrivate.h
    43 // @see MsgNotifierPrivate.h
    44 // ----------------------------------------------------------------------------
    44 // ----------------------------------------------------------------------------
    78     if(mSettingsManager)
    78     if(mSettingsManager)
    79         {
    79         {
    80         delete mSettingsManager;
    80         delete mSettingsManager;
    81         }
    81         }
    82     
    82     
       
    83     if(mSts)
       
    84         {
       
    85         delete mSts;
       
    86         mSts = NULL;
       
    87         }
       
    88     
    83     QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit")
    89     QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit")
    84 }
    90 }
    85 
    91 
    86 // ----------------------------------------------------------------------------
    92 // ----------------------------------------------------------------------------
    87 // MsgNotifierPrivate::initL
    93 // MsgNotifierPrivate::initL
   112     // write -1 initially 
   118     // write -1 initially 
   113     success = mSettingsManager->writeItemValue(convIdKey,-1);
   119     success = mSettingsManager->writeItemValue(convIdKey,-1);
   114     
   120     
   115     QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL "
   121     QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL "
   116                            "writing ret value",success)
   122                            "writing ret value",success)
       
   123     
       
   124     mSts = new XQSystemToneService();
   117     
   125     
   118     QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit")
   126     QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit")
   119 }
   127 }
   120 
   128 
   121 // ----------------------------------------------------------------------------
   129 // ----------------------------------------------------------------------------
   203         HBufC* descrp =  convEntry->Description();
   211         HBufC* descrp =  convEntry->Description();
   204         
   212         
   205         if(displayName)
   213         if(displayName)
   206             {
   214             {
   207             notifData.mDisplayName = 
   215             notifData.mDisplayName = 
   208                                 S60QConversions::s60DescToQString(*displayName);
   216                                 XQConversions::s60DescToQString(*displayName);
   209             }        
   217             }        
   210         if(number)
   218         if(number)
   211             {
   219             {
   212             notifData.mContactNum =  S60QConversions::s60DescToQString(*number);
   220             notifData.mContactNum =  XQConversions::s60DescToQString(*number);
   213             }
   221             }
   214         if(descrp)
   222         if(descrp)
   215             {
   223             {
   216             notifData.mDescription = S60QConversions::s60DescToQString(*descrp);
   224             notifData.mDescription = XQConversions::s60DescToQString(*descrp);
   217             }
   225             }
       
   226         
       
   227         //Play new message alert tone.
       
   228         mSts->playTone(XQSystemToneService::SmsAlertTone);
   218         
   229         
   219         // check whether opened cv id and received 
   230         // check whether opened cv id and received 
   220         // cv id are same and show notification
   231         // cv id are same and show notification
   221         if( showNotification(notifData.mConversationId ))
   232         if( showNotification(notifData.mConversationId ))
   222             {
   233             {
   287 // ----------------------------------------------------------------------------
   298 // ----------------------------------------------------------------------------
   288 // MsgNotifierPrivate::displayFailedNote
   299 // MsgNotifierPrivate::displayFailedNote
   289 // @see MsgNotifierPrivate.h
   300 // @see MsgNotifierPrivate.h
   290 // ----------------------------------------------------------------------------
   301 // ----------------------------------------------------------------------------
   291 void MsgNotifierPrivate::displayFailedNote(MsgInfo info)
   302 void MsgNotifierPrivate::displayFailedNote(MsgInfo info)
   292 {
   303     {
   293     // TODO: use XQAiwRequest
   304     QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote start.")
   294     QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : entered")
   305             
   295     // change to com.nokia.symbian.messaging (servicename), IMsgErrorNotifier
   306     // check whether opened cv id and received 
   296     // as the service name.
   307     // cv id are same then dont show failed note
   297     XQServiceRequest snd("messaging.com.nokia.symbian.MsgErrorNotifier",
   308     if (!showNotification(info.mConversationId))
   298         "displayErrorNote(QVariantList)", false);
   309         {
   299 
   310         return;
   300     QVariantList args;
   311         }
       
   312 
       
   313     //Even if name string is empty we shall add name into args
       
   314     QString nameString;
       
   315 
   301     info.mDisplayName.removeDuplicates();
   316     info.mDisplayName.removeDuplicates();
   302     info.mDisplayName.sort();
   317     info.mDisplayName.sort();
   303     
   318 
   304     QString nameString;
       
   305     
       
   306     nameString.append(info.mDisplayName.at(0));
   319     nameString.append(info.mDisplayName.at(0));
   307     for(int i = 1; i < info.mDisplayName.count(); ++i){
   320     for (int i = 1; i < info.mDisplayName.count(); ++i)
       
   321         {
   308         nameString.append(", ");
   322         nameString.append(", ");
   309         nameString.append(info.mDisplayName.at(i));
   323         nameString.append(info.mDisplayName.at(i));
   310     }
   324         }
   311       
   325 
   312     //Even if name string is empty we shall add name into args
   326     // create request arguments
   313     QVariant nameV(nameString);
   327     QVariantList args;
   314     args << nameV;
   328     args << QVariant(nameString);
   315 
       
   316     QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : name and contactnumber")
       
   317 
       
   318     args << info.mConversationId;
   329     args << info.mConversationId;
   319     args << info.mMessageType;
   330     args << info.mMessageType;
       
   331 
       
   332     // TODO: use XQAiwRequest
       
   333     XQServiceRequest snd("messaging.com.nokia.symbian.MsgErrorNotifier",
       
   334             "displayErrorNote(QVariantList)", false);
       
   335 
   320     snd << args;
   336     snd << args;
   321     snd.send();
   337     snd.send();
   322     QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : left")
   338     
   323 
   339     QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote end.")
   324 }
   340     }
   325 
   341 
   326 // ----------------------------------------------------------------------------
   342 // ----------------------------------------------------------------------------
   327 // MsgNotifierPrivate::showNotification
   343 // MsgNotifierPrivate::showNotification
   328 // @see MsgNotifierPrivate.h
   344 // @see MsgNotifierPrivate.h
   329 // ----------------------------------------------------------------------------
   345 // ----------------------------------------------------------------------------
   361         }
   377         }
   362 
   378 
   363     wsSession.Close();
   379     wsSession.Close();
   364     return showNotification;
   380     return showNotification;
   365 }
   381 }
       
   382 // ----------------------------------------------------------------------------
       
   383 // MsgNotifierPrivate::PartialDeleteConversationList
       
   384 // @see mcsconversationclientchangeobserver.h
       
   385 // ----------------------------------------------------------------------------
       
   386 void MsgNotifierPrivate::PartialDeleteConversationList(
       
   387         const CCsClientConversation& aClientConversation){/*empty implementation*/}
       
   388 
   366 //EOF
   389 //EOF