messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp
changeset 70 a15d9966050f
parent 52 12db4185673b
equal deleted inserted replaced
61:8ba0afbb4637 70:a15d9966050f
    30 #include <xqappmgr.h>
    30 #include <xqappmgr.h>
    31 #include <xqpublishandsubscribeutils.h>
    31 #include <xqpublishandsubscribeutils.h>
    32 #include <xqsystemtoneservice.h>
    32 #include <xqsystemtoneservice.h>
    33 #include <xqconversions.h>
    33 #include <xqconversions.h>
    34 #include <QThreadPool>
    34 #include <QThreadPool>
       
    35 #include <ProfileEngineInternalCRKeys.h>
       
    36 #include <hwrmvibra.h>
    35 
    37 
    36 //USER INCLUDES
    38 //USER INCLUDES
    37 #include "msgnotifier.h"
    39 #include "msgnotifier.h"
    38 #include "msgnotifier_p.h"
    40 #include "msgnotifier_p.h"
    39 #include "msgstorehandler.h"
    41 #include "msgstorehandler.h"
    40 #include "msginfodefs.h"
    42 #include "msginfodefs.h"
    41 #include "conversationidpsconsts.h"
    43 #include "conversationidpsconsts.h"
    42 #include "debugtraces.h"
    44 #include "debugtraces.h"
    43 
    45 
       
    46 const XQCentralRepositorySettingsKey silenceModeKey(KCRUidProfileEngine.iUid, KProEngSilenceMode);
       
    47 
    44 // ----------------------------------------------------------------------------
    48 // ----------------------------------------------------------------------------
    45 // MsgNotifierPrivate::MsgNotifierPrivate
    49 // MsgNotifierPrivate::MsgNotifierPrivate
    46 // @see MsgNotifierPrivate.h
    50 // @see MsgNotifierPrivate.h
    47 // ----------------------------------------------------------------------------
    51 // ----------------------------------------------------------------------------
    48 MsgNotifierPrivate::MsgNotifierPrivate(MsgNotifier* MsgNotifier) :
    52 MsgNotifierPrivate::MsgNotifierPrivate(MsgNotifier* MsgNotifier) :
    87         {
    91         {
    88         delete mSts;
    92         delete mSts;
    89         mSts = NULL;
    93         mSts = NULL;
    90         }
    94         }
    91     
    95     
       
    96     if(mVibra)
       
    97         {
       
    98         delete mVibra;
       
    99         mVibra = NULL;
       
   100         }
    92     QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit")
   101     QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit")
    93 }
   102 }
    94 
   103 
    95 // ----------------------------------------------------------------------------
   104 // ----------------------------------------------------------------------------
    96 // MsgNotifierPrivate::initL
   105 // MsgNotifierPrivate::initL
   124     
   133     
   125     QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL "
   134     QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL "
   126                            "writing ret value",success)
   135                            "writing ret value",success)
   127     
   136     
   128     QT_TRYCATCH_LEAVING(mSts = new XQSystemToneService());
   137     QT_TRYCATCH_LEAVING(mSts = new XQSystemToneService());
       
   138     
       
   139     mVibra = CHWRMVibra::NewL();
   129     
   140     
   130     QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit")
   141     QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit")
   131 }
   142 }
   132 
   143 
   133 // ----------------------------------------------------------------------------
   144 // ----------------------------------------------------------------------------
   226         if(descrp)
   237         if(descrp)
   227             {
   238             {
   228             notifData.mDescription = XQConversions::s60DescToQString(*descrp);
   239             notifData.mDescription = XQConversions::s60DescToQString(*descrp);
   229             }
   240             }
   230         
   241         
   231         //Play new message alert tone.
   242         QVariant silenceMode = mSettingsManager->readItemValue(silenceModeKey, XQSettingsManager::TypeInt);
   232         mSts->playTone(XQSystemToneService::SmsAlertTone);
   243         int silent = silenceMode.toInt();
       
   244         if(silent < 1)
       
   245             {
       
   246             //Play new message alert tone.
       
   247             mSts->playTone(XQSystemToneService::SmsAlertTone);
       
   248             }
       
   249         // Execute the vibra effect.
       
   250         if (mVibra) 
       
   251             {
       
   252             TInt err = KErrNone;
       
   253             TRAP(err,mVibra->StartVibraL(1000));
       
   254             }
   233         
   255         
   234         // check whether opened cv id and received 
   256         // check whether opened cv id and received 
   235         // cv id are same and show notification
   257         // cv id are same and show notification
   236         if( showNotification(notifData.mConversationId ))
   258         if( showNotification(notifData.mConversationId ))
   237             {
   259             {