messagingapp/msgui/unifiededitor/src/msgunieditorattachmentcontainer.cpp
changeset 76 60a8a215b0ec
parent 37 518b245aa84c
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorattachmentcontainer.cpp	Tue Oct 05 13:58:47 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorattachmentcontainer.cpp	Tue Oct 19 11:30:16 2010 +0530
@@ -35,13 +35,15 @@
 // @see header file
 //---------------------------------------------------------------
 MsgAttachmentContainer::MsgAttachmentContainer( QGraphicsItem *parent ) :
-HbWidget(parent),
+MsgUnifiedEditorBaseWidget(parent),
 mIsMMContent(false)
 {
+    this->setObjectName("attachmentContainer");
+    
     mLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
     mLayout->setContentsMargins(0,0,0,0);
     mLayout->setSpacing(0);
-    mMmsConformanceCheck = new MmsConformanceCheck;
+    mMmsConformanceCheck = new MmsConformanceCheck;   
 }
 
 //---------------------------------------------------------------
@@ -64,7 +66,8 @@
     if(EInsertSuccess != mMmsConformanceCheck->checkModeForInsert(filepath))
         return EAddNotSupported;
 
-    int msgSize = messageSize();
+    int msgSize = MsgUnifiedEditorMonitor::messageSize();
+    
     QFileInfo fileinfo(filepath);
     int fileSize = fileinfo.size() + KEstimatedMimeHeaderSize;
     
@@ -81,10 +84,12 @@
         int index = mLayout->count();
         mLayout->insertItem(index,att);
         connect(att, SIGNAL(deleteMe(MsgUnifiedEditorAttachment*)),
-            this, SLOT(deleteAttachment(MsgUnifiedEditorAttachment*)));
+                this, SLOT(deleteAttachment(MsgUnifiedEditorAttachment*)));
 
         // emit to signal that container content & size changed
-        emit contentChanged();
+        QVariantList data;
+        data << containerSize() << mIsMMContent;        
+        emit contentsChanged(data);
     }
     else
     {
@@ -111,7 +116,10 @@
     }
 
     // emit to indicate change in container content & size
-    emit contentChanged();
+    QVariantList data;
+    data << containerSize() << mIsMMContent;
+    emit contentsChanged(data);
+    
     if(mAttachmentList.count() == 0)
     {
         emit emptyAttachmentContainer();
@@ -153,15 +161,6 @@
 }
 
 //---------------------------------------------------------------
-// MsgAttachmentContainer::messageSize
-// @see header file
-//---------------------------------------------------------------
-int MsgAttachmentContainer::messageSize()
-{
-    return containerSize() + MsgUnifiedEditorMonitor::bodySize() + MsgUnifiedEditorMonitor::subjectSize();
-}
-
-//---------------------------------------------------------------
 // MsgAttachmentContainer::hasMMContent
 // @see header file
 //---------------------------------------------------------------
@@ -170,5 +169,26 @@
     return mIsMMContent;
 }
 
+//---------------------------------------------------------------
+// MsgAttachmentContainer::fileNameInUse
+// @see header file
+//---------------------------------------------------------------
+bool MsgAttachmentContainer::fileNameInUse(const QString& fileName)
+{
+    bool alreadyExists = false;
+    
+    for(int i=0; i<mAttachmentList.count(); i++)
+    {
+        QFileInfo fileinfo(mAttachmentList.at(i)->path());
+        if(fileName == fileinfo.fileName())
+        {
+            alreadyExists = true;
+            break;
+        }
+    } 
+    
+    return alreadyExists;
+}
+
 //EOF