messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp
changeset 70 a15d9966050f
parent 52 12db4185673b
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp	Thu Sep 02 20:23:03 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp	Fri Sep 17 08:28:39 2010 +0300
@@ -32,6 +32,8 @@
 #include <xqsystemtoneservice.h>
 #include <xqconversions.h>
 #include <QThreadPool>
+#include <ProfileEngineInternalCRKeys.h>
+#include <hwrmvibra.h>
 
 //USER INCLUDES
 #include "msgnotifier.h"
@@ -41,6 +43,8 @@
 #include "conversationidpsconsts.h"
 #include "debugtraces.h"
 
+const XQCentralRepositorySettingsKey silenceModeKey(KCRUidProfileEngine.iUid, KProEngSilenceMode);
+
 // ----------------------------------------------------------------------------
 // MsgNotifierPrivate::MsgNotifierPrivate
 // @see MsgNotifierPrivate.h
@@ -89,6 +93,11 @@
         mSts = NULL;
         }
     
+    if(mVibra)
+        {
+        delete mVibra;
+        mVibra = NULL;
+        }
     QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit")
 }
 
@@ -127,6 +136,8 @@
     
     QT_TRYCATCH_LEAVING(mSts = new XQSystemToneService());
     
+    mVibra = CHWRMVibra::NewL();
+    
     QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit")
 }
 
@@ -228,8 +239,19 @@
             notifData.mDescription = XQConversions::s60DescToQString(*descrp);
             }
         
-        //Play new message alert tone.
-        mSts->playTone(XQSystemToneService::SmsAlertTone);
+        QVariant silenceMode = mSettingsManager->readItemValue(silenceModeKey, XQSettingsManager::TypeInt);
+        int silent = silenceMode.toInt();
+        if(silent < 1)
+            {
+            //Play new message alert tone.
+            mSts->playTone(XQSystemToneService::SmsAlertTone);
+            }
+        // Execute the vibra effect.
+        if (mVibra) 
+            {
+            TInt err = KErrNone;
+            TRAP(err,mVibra->StartVibraL(1000));
+            }
         
         // check whether opened cv id and received 
         // cv id are same and show notification