emailuis/nmailuiwidgets/src/nmattachmentlistwidget.cpp
changeset 54 997a02608b3a
parent 53 bf7eb7911fc5
child 59 16ed8d08d0b1
--- a/emailuis/nmailuiwidgets/src/nmattachmentlistwidget.cpp	Wed Jun 23 18:00:21 2010 +0300
+++ b/emailuis/nmailuiwidgets/src/nmattachmentlistwidget.cpp	Tue Jul 06 14:04:34 2010 +0300
@@ -119,7 +119,10 @@
 {
     NM_FUNCTION;
     
+    qDeleteAll(mItemList);
+
     mItemList.clear();
+	
 }
 
 /*!
@@ -257,6 +260,8 @@
     Q_UNUSED(option);
     Q_UNUSED(widget);
     if (painter&&mLayout){
+        painter->save();
+        
         // Use text color as a line color if set, otherwise use theme
         // normal list content color.
         if (mTextColor.isValid()){
@@ -280,7 +285,8 @@
                               layoutRect.bottomRight().x(), itemRect.bottomRight().y());
                 painter->drawLine(line1);                     
             }     
-        }        
+        }
+        painter->restore();
     }
 }
 
@@ -318,8 +324,9 @@
     //construct UI after orientation has been figured out
     constructUi();
 
-    //set default values, needed?
-    setFlag(QGraphicsItem::ItemIsFocusable);      
+    //set flags
+    setFlag(QGraphicsItem::ItemIsFocusable);  
+    setFlag(QGraphicsItem::ItemHasNoContents,false);
 }
 
 /*!
@@ -339,8 +346,7 @@
     loader.setObjectTree(objectList);
     QObjectList widgetlist = loader.load(FILE_PATH_DOCML, &loadingOk);
 
-    int widgetCount = widgetlist.count();
-    if(loadingOk && widgetCount){
+    if(loadingOk){
         if(layout()){
             mLayout = dynamic_cast<QGraphicsGridLayout*>(layout());
             mLayout->setContentsMargins(0,0,0,0);