messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp
changeset 41 25fe1fe642e3
parent 37 518b245aa84c
child 46 b1f0785c289d
--- a/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp	Tue Jul 06 22:50:16 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp	Fri Jul 09 14:46:10 2010 +0530
@@ -21,6 +21,7 @@
 #include <QFile>
 #include <HbTextItem>
 #include <HbMainWindow>
+#include <HbIconItem>
 
 // USER INCLUDES
 #include "univiewertextitem.h"
@@ -39,7 +40,7 @@
 //---------------------------------------------------------------
 UniViewerBodyWidget::UniViewerBodyWidget(QGraphicsItem *parent) :
     HbWidget(parent), mHasText(false), mHasPixmap(false), mTextItem(0), mSlideCounter(0),
-        mPixmapItem(0), mAudioItem(0)
+        mPixmapItem(0), mAudioItem(0), mOverlayItem(0)
 {
     this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 }
@@ -97,6 +98,7 @@
     if (!mPixmapItem) {
        mPixmapItem = new UniViewerPixmapWidget(this);
        HbStyle::setItemName(mPixmapItem, "pixmap");
+       connect(mPixmapItem, SIGNAL(setOverlayIcon(QString)), this, SLOT(setOverlayIcon(QString)));
     }
     mPixmapItem->hide();
     mPixmapItem->populate(info);
@@ -122,6 +124,7 @@
     text.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
     text.replace('\r', QChar::LineSeparator);
     mTextItem->setText(text);
+
     this->repolish();
 }
 
@@ -138,6 +141,7 @@
 
     mSlideCounter->hide();
     mSlideCounter->setText(slideCounter);
+
     this->repolish();
 }
 
@@ -214,7 +218,7 @@
 }
 
 //---------------------------------------------------------------
-//UniViewerBodyWidget :: clearContent
+// UniViewerBodyWidget :: clearContent
 // @see header file
 //---------------------------------------------------------------
 void UniViewerBodyWidget::clearContent()
@@ -238,12 +242,35 @@
         mTextItem = NULL;
     }
 
+    if (mOverlayItem) {
+        mOverlayItem->setParent(NULL);
+        delete mOverlayItem;
+        mOverlayItem = NULL;
+    }
+
     setHasText(false);
     setHasPixmap(false);
     repolish();
 }
 
 //---------------------------------------------------------------
+// UniViewerBodyWidget::setOverlayIcon
+// @see header file
+//---------------------------------------------------------------
+void UniViewerBodyWidget::setOverlayIcon(const QString &iconName)
+{
+    if (!mOverlayItem) {
+        mOverlayItem = new HbIconItem(this);
+        HbStyle::setItemName(mOverlayItem, "overlayItem");
+    }
+
+    mOverlayItem->hide();
+    mOverlayItem->setIconName(iconName);
+
+    this->repolish();
+}
+
+//---------------------------------------------------------------
 //UniViewerBodyWidget::sizeHint
 // @see header file
 //---------------------------------------------------------------
@@ -360,6 +387,10 @@
         mPixmapItem->show();
     }
 
+    if (mOverlayItem) {
+        mOverlayItem->show();
+    }
+
     // Calculate the size hint to be returned.
     szHint.setHeight(0);