mobilemessaging/unieditor/application/src/UniEditorAppUi.cpp
branchRCL_3
changeset 24 e00582ce7ecd
parent 22 52d61119153d
child 28 fbb813aef148
--- a/mobilemessaging/unieditor/application/src/UniEditorAppUi.cpp	Wed Apr 14 15:53:21 2010 +0300
+++ b/mobilemessaging/unieditor/application/src/UniEditorAppUi.cpp	Tue Apr 27 16:33:37 2010 +0300
@@ -2968,19 +2968,31 @@
         resourceId = R_QTN_WAIT_MSG_SAVED_OUTBOX;
         }
 
-    iSendOperation = CUniEditorSendOperation::NewL( *this,
-                                                    *Document(),
-                                                    *iHeader,
-                                                    *plugin,
-                                                    *iView,
-                                                    FsSession() );
-    ActivateInputBlockerL( iSendOperation );
-    
-    ShowWaitNoteL( resourceId ); 
-
-    iEditorFlags |= EEditorClosing;
-
-    iSendOperation->Send();
+    if (IsObjectsPathValidL())
+        {
+    	iSendOperation = CUniEditorSendOperation::NewL( *this,
+                                                    	*Document(),
+                                                    	*iHeader,
+                                                    	*plugin,
+                                                    	*iView,
+                                                    	FsSession() );
+        ActivateInputBlockerL(iSendOperation);
+
+        ShowWaitNoteL(resourceId);
+
+        iEditorFlags |= EEditorClosing;
+
+        iSendOperation->Send();
+        }
+    else
+        {
+        if (ShowConfirmationQueryL(R_UNIEDITOR_QUEST_CLOSE_OOD))
+            {
+            // Exit without saving.
+            Exit(EAknSoftkeyClose);
+            }
+        //else nothing.
+        }
     }
 
 
@@ -3017,7 +3029,7 @@
         }
     else if ( ( Document()->Modified() || 
                 Document()->PrevSaveType() < EClosingSave ) && 
-              CanSaveMessageL() )
+              CanSaveMessageL())
         {
         // Needs saving
         if ( IsForeground() )
@@ -3060,14 +3072,24 @@
         {
         iEditorFlags |= ERunAppShutterAtExit;
         }
-        
-    if ( iEditorFlags & ELaunchSuccessful &&  
-         Document()->MediaAvailable() )
-        {
-        DoMsgSaveExitL();
-        }
-        
-    Exit(); 
+    if (IsObjectsPathValidL())
+        {
+        if (iEditorFlags & ELaunchSuccessful && Document()->MediaAvailable())
+            {
+            DoMsgSaveExitL();
+            }
+
+        Exit();
+        }
+    else
+        {
+        if (ShowConfirmationQueryL(R_UNIEDITOR_QUEST_CLOSE_OOD))
+            {
+            // Exit without saving.
+            Exit(EAknSoftkeyClose);
+            }
+        }
+    
     }
 
 // ---------------------------------------------------------
@@ -3102,7 +3124,7 @@
             // Message has data
             if ( Document()->Modified() || Document()->PrevSaveType() < EClosingSave )
                 {
-                if ( CanSaveMessageL() )
+                if ( CanSaveMessageL() && IsObjectsPathValidL())                    
                     {
                     TInt resId = Document()->Saved() ? R_QTN_UNI_WAIT_SAVING_MESSAGE : 
                                                        R_QTN_UNI_WAIT_SAVING_MESSAGE_NEW;
@@ -9857,6 +9879,28 @@
             iTapConsumed = ETrue;
             }
         }   
-    }  
+    }
+
+// ---------------------------------------------------------
+// CUniEditorAppUi::IsObjectPathValidL
+// Checks whether all inserted object's path are valid
+// message.
+// ---------------------------------------------------------
+//
+TBool CUniEditorAppUi::IsObjectsPathValidL() const
+    {
+    TBool bCanSave = ETrue;  
+    if ( Document()->DataModel()->SmilType() == EMmsSmil )
+        {
+        bCanSave = Document()->DataModel()->ObjectList().IsListValid();
+        
+        if(bCanSave)
+            {
+            bCanSave = Document()->DataModel()->AttachmentList().IsListValid();
+            }
+        }      
+    return bCanSave;
+    }
+
 // End of file