messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp
changeset 73 ecf6a73a9186
parent 62 fdbe8253b596
child 76 60a8a215b0ec
equal deleted inserted replaced
68:e8a69c93c830 73:ecf6a73a9186
   369 // MsgNotifierPrivate::showNotification
   369 // MsgNotifierPrivate::showNotification
   370 // @see MsgNotifierPrivate.h
   370 // @see MsgNotifierPrivate.h
   371 // ----------------------------------------------------------------------------
   371 // ----------------------------------------------------------------------------
   372 bool MsgNotifierPrivate::showNotification(int receivedMsgConvId)
   372 bool MsgNotifierPrivate::showNotification(int receivedMsgConvId)
   373 {
   373 {
   374     bool showNotification = true;
   374     bool showNotification = false;
   375     
   375     
   376     RWsSession wsSession ;
   376     RWsSession wsSession ;
   377     wsSession.Connect();
   377     int err = wsSession.Connect();
   378 
   378 
   379     TApaTaskList taskList( wsSession );
   379     if ( KErrNone == err )
   380     TApaTask task = taskList.FindApp(KMsgAppUid); // find msgapp is running
   380         {
   381 
   381         showNotification = true;
   382     if(task.Exists())
   382         TApaTaskList taskList(wsSession);
   383         {
   383         TApaTask task = taskList.FindApp(KMsgAppUid); // find msgapp is running
   384         TApaTask foregndtask =   taskList.FindByPos(0) ;  // foreground app
   384 
   385         // compare  window group id  
   385         if (task.Exists())
   386         // if application is in foregorund, then check the currently
   386             {
   387         // opened conversation is same as received one.
   387             TApaTask foregndtask = taskList.FindByPos(0); // foreground app
   388         if(task.WgId() == foregndtask.WgId() )
   388             // compare  window group id  
   389             {
   389             // if application is in foregorund, then check the currently
   390             // get the current conversation ID
   390             // opened conversation is same as received one.
   391             XQPublishAndSubscribeSettingsKey convIdKey( KMsgCVIdProperty, 
   391             if (task.WgId() == foregndtask.WgId())
   392                     KMsgCVIdKey);
       
   393             QVariant value = mSettingsManager->readItemValue(convIdKey, 
       
   394                     XQSettingsManager::TypeInt);
       
   395 
       
   396             int openedConvId  = value.toInt();
       
   397             if( openedConvId == receivedMsgConvId)
       
   398                 {
   392                 {
   399                 showNotification = false;
   393                 // get the current conversation ID
   400                 QDEBUG_WRITE("processListEntry : Notification not shown")
   394                 XQPublishAndSubscribeSettingsKey convIdKey(KMsgCVIdProperty,
       
   395                         KMsgCVIdKey);
       
   396                 QVariant value = mSettingsManager->readItemValue(convIdKey,
       
   397                         XQSettingsManager::TypeInt);
       
   398 
       
   399                 int openedConvId = value.toInt();
       
   400                 if (openedConvId == receivedMsgConvId)
       
   401                     {
       
   402                     showNotification = false;
       
   403                     QDEBUG_WRITE("processListEntry : Notification not shown")
       
   404                     }
   401                 }
   405                 }
   402             }
   406             }
   403         }
   407 
   404 
   408         wsSession.Close();
   405     wsSession.Close();
   409         }
   406     return showNotification;
   410     return showNotification;
   407 }
   411 }
   408 // ----------------------------------------------------------------------------
   412 // ----------------------------------------------------------------------------
   409 // MsgNotifierPrivate::PartialDeleteConversationList
   413 // MsgNotifierPrivate::PartialDeleteConversationList
   410 // @see mcsconversationclientchangeobserver.h
   414 // @see mcsconversationclientchangeobserver.h