messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp
changeset 73 ecf6a73a9186
parent 62 fdbe8253b596
child 76 60a8a215b0ec
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp	Fri Sep 17 20:16:33 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp	Tue Oct 05 13:58:47 2010 +0530
@@ -371,38 +371,42 @@
 // ----------------------------------------------------------------------------
 bool MsgNotifierPrivate::showNotification(int receivedMsgConvId)
 {
-    bool showNotification = true;
+    bool showNotification = false;
     
     RWsSession wsSession ;
-    wsSession.Connect();
+    int err = wsSession.Connect();
 
-    TApaTaskList taskList( wsSession );
-    TApaTask task = taskList.FindApp(KMsgAppUid); // find msgapp is running
-
-    if(task.Exists())
+    if ( KErrNone == err )
         {
-        TApaTask foregndtask =   taskList.FindByPos(0) ;  // foreground app
-        // compare  window group id  
-        // if application is in foregorund, then check the currently
-        // opened conversation is same as received one.
-        if(task.WgId() == foregndtask.WgId() )
+        showNotification = true;
+        TApaTaskList taskList(wsSession);
+        TApaTask task = taskList.FindApp(KMsgAppUid); // find msgapp is running
+
+        if (task.Exists())
             {
-            // get the current conversation ID
-            XQPublishAndSubscribeSettingsKey convIdKey( KMsgCVIdProperty, 
-                    KMsgCVIdKey);
-            QVariant value = mSettingsManager->readItemValue(convIdKey, 
-                    XQSettingsManager::TypeInt);
+            TApaTask foregndtask = taskList.FindByPos(0); // foreground app
+            // compare  window group id  
+            // if application is in foregorund, then check the currently
+            // opened conversation is same as received one.
+            if (task.WgId() == foregndtask.WgId())
+                {
+                // get the current conversation ID
+                XQPublishAndSubscribeSettingsKey convIdKey(KMsgCVIdProperty,
+                        KMsgCVIdKey);
+                QVariant value = mSettingsManager->readItemValue(convIdKey,
+                        XQSettingsManager::TypeInt);
 
-            int openedConvId  = value.toInt();
-            if( openedConvId == receivedMsgConvId)
-                {
-                showNotification = false;
-                QDEBUG_WRITE("processListEntry : Notification not shown")
+                int openedConvId = value.toInt();
+                if (openedConvId == receivedMsgConvId)
+                    {
+                    showNotification = false;
+                    QDEBUG_WRITE("processListEntry : Notification not shown")
+                    }
                 }
             }
+
+        wsSession.Close();
         }
-
-    wsSession.Close();
     return showNotification;
 }
 // ----------------------------------------------------------------------------