messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp
changeset 34 84197e66a4bd
parent 25 84d9eb65b26f
child 43 35b64624a9e7
--- a/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp	Fri Jun 04 10:25:39 2010 +0100
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp	Fri Jun 11 13:35:48 2010 +0300
@@ -63,10 +63,6 @@
         iFailedMessages = NULL;
     }
 
-    if (iFailedNotes) {
-        delete iFailedNotes;
-        iFailedNotes = NULL;
-    }
 }
 
 // ---------------------------------------------------------
@@ -80,7 +76,6 @@
     iMsvEntry->AddObserverL(*this);
 
     iFailedMessages = new (ELeave) CMsvEntrySelection;
-    iFailedNotes = new (ELeave) CMsvEntrySelection;
 }
 
 // ---------------------------------------------------------
@@ -108,8 +103,7 @@
     }
 
     //Handling for outbox entries
-    if( parent == KMsvGlobalOutBoxIndexEntryIdValue )
-    {
+    if (parent == KMsvGlobalOutBoxIndexEntryIdValue) {
         CMsvEntry* rootEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
 
         for (TInt i = 0; i < selection->Count(); ++i) {
@@ -120,45 +114,55 @@
                 TInt index = iFailedMessages->Find(entry.Id());
 
                 if (sendingState == KMsvSendStateFailed && KErrNotFound == index) {
+
                     iFailedMessages->AppendL(entry.Id());
-                    iFailedNotes->AppendL(entry.Id());
+                    MsgInfo aInfo;
+                    ProcessIndicatorDataL(entry.Id(), aInfo);
+                    iNotifier->displayFailedNote(aInfo);
                 }
                 else if (sendingState != KMsvSendStateFailed && KErrNotFound != index) {
                     iFailedMessages->Delete(index);
                     iFailedMessages->Compress();
                 }
-                if (iFailedNotes->Count()) {
-                    MsgInfo aInfo;
-                    ProcessIndicatorDataL(iFailedNotes->At(0), aInfo);
-                    iNotifier->displayFailedNote(aInfo);
-                    iFailedNotes->Delete(0);
-                    iFailedNotes->Compress();
-                }
+
             }
         }//end for
     }
-    else
-    {
+    else {
         TMsvEntry entry;
         TMsvId service;
-        TInt error= KErrNone;
-        for (TInt i = 0; i < selection->Count(); ++i)
-        {
+        TInt error = KErrNone;
+        for (TInt i = 0; i < selection->Count(); ++i) {
             error = iMsvSession->GetEntry(selection->At(i), service, entry);
 
-            if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification && MmsNotificationStatus(
-                entry) == EMsgStatusFailed)
-            {
-                MsgInfo aInfo;
-                                
-                //Fill aInfo with appropriate data
-                aInfo.mMessageType = ECsMmsNotification;
+            if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification && 
+                MmsNotificationStatus(entry) == EMsgStatusFailed) {
+
+                TInt index = iFailedMessages->Find(entry.Id());
+
+                if (KErrNotFound == index) {
+                    iFailedMessages->AppendL(entry.Id());
+                    MsgInfo aInfo;
+                    //Fill aInfo with appropriate data
+                    aInfo.mMessageType = ECsMmsNotification;
+                    ProcessIndicatorDataL(entry.Id(), aInfo);
+                    iNotifier->displayFailedNote(aInfo);
 
-                ProcessIndicatorDataL(entry.Id(),aInfo);
-                iNotifier->displayFailedNote(aInfo);
+                }// end of if
             }
-        }
+            else if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification
+                && MmsNotificationStatus(entry) == EMsgStatusRetrieving) {
+                
+                TInt index = iFailedMessages->Find(entry.Id());
+                if (KErrNotFound != index) {
+                    iFailedMessages->Delete(index);
+                    iFailedMessages->Compress();
+                }// end of KErrNotFound != index if block
+
+            } // end of 2nd if  
+        } // for loop
     }
+
 }
 
 // ---------------------------------------------------------