messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
--- a/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp	Fri May 14 15:49:35 2010 +0300
@@ -24,7 +24,7 @@
 #include <hbmessagebox.h>
 #include <hbnotificationdialog.h>
 #include <HbStyleLoader>
-#include <centralrepository.h>       
+#include <centralrepository.h>
 #include <MmsEngineDomainCRKeys.h>
 
 // USER INCLUDES
@@ -44,7 +44,7 @@
 // LOCAL CONSTANTS
 const QString REPLY_ICON("qtg_mono_reply");
 const QString REPLY_ALL_ICON("qtg_mono_reply_all");
-const QString FORWARD_ICON("qtg_mono_forward");
+const QString FORWARD_ICON("qtg_mono_forward_msg");
 const QString SEND_ICON("qtg_mono_send");
 const QString DELETE_ICON("qtg_mono_delete");
 
@@ -70,14 +70,13 @@
     mMessageId = messageId;
     mViewFeeder = new UniViewerFeeder(mMessageId, this);
 
-    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
-
     mScrollArea = new UniScrollArea(this);
+    this->setWidget(mScrollArea);
 
     mContentsWidget = new UniContentsWidget(mViewFeeder,this);
-	
-    connect(mContentsWidget,SIGNAL(sendMessage(const QString&)),
-            this, SLOT(sendMessage(const QString&)));
+
+    connect(mContentsWidget,SIGNAL(sendMessage(const QString&,const QString&)),
+            this, SLOT(sendMessage(const QString&,const QString&)));
 
     connect(mScrollArea, SIGNAL(scrolledToNextSlide()),
     mContentsWidget, SLOT(populateNextSlide()));
@@ -85,11 +84,6 @@
     mScrollArea->setContentWidget(mContentsWidget);
     mScrollArea->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
     mScrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAutoHide);
-    mMainLayout->addItem(mScrollArea);
-    mMainLayout->setSpacing(0);
-    mMainLayout->setContentsMargins(0, 0, 0, 0);
-
-    setLayout(mMainLayout);
 
     QDEBUG_WRITE("UnifiedViewer contruction End");
 }
@@ -167,6 +161,9 @@
     }
     QDEBUG_WRITE("UnifiedViewer feeder->updateContent END");
 
+    // Dont show the scroll bar.
+    mScrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
+
     if ( (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) &&
          (mViewFeeder->slideCount() > 0) )
     {
@@ -226,7 +223,7 @@
 void UnifiedViewer::resizeEvent(QGraphicsSceneResizeEvent * event)
 {
     Q_UNUSED(event)
-    mContentsWidget->resize(this->rect().width(), -1);
+    mContentsWidget->resize(this->rect().width(), this->rect().height()+1);
 }
 
 //---------------------------------------------------------------
@@ -235,46 +232,22 @@
 //---------------------------------------------------------------
 void UnifiedViewer::handleDeleteAction()
 {
-    bool result = HbMessageBox::question(LOC_DELETE_MESSAGE,
+    HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogDeleteMsg(HbAction*)),
                                          LOC_BUTTON_DELETE, 
                                          LOC_BUTTON_CANCEL);
-    if (result)
-    {
-        QList<int> msgIdList;
-        msgIdList << mMessageId;
-
-        ConversationsEngine::instance()->deleteMessages(msgIdList);
-
-        QVariantList param;
-        if (mMsgCount > 1)
-        {
-            param << MsgBaseView::CV;
-            param << MsgBaseView::UNIVIEWER;
-        }
-        else
-        {
-            param << MsgBaseView::CLV;
-            param << MsgBaseView::UNIVIEWER;
-        }
-
-        QVariant dummy(QVariant::Invalid);
-        param << dummy;
-        emit switchView(param);
-    }
-
 }
 
 //---------------------------------------------------------------
 // UnifiedViewer::sendMessage
 // @see header file
 //---------------------------------------------------------------
-void UnifiedViewer::sendMessage(const QString& phoneNumber)
+void UnifiedViewer::sendMessage(const QString& phoneNumber,const QString& alias)
     {
     ConvergedMessage message;
     message.setBodyText(QString());
 
     ConvergedMessageAddress address;
-    address.setAlias(phoneNumber);
+    address.setAlias(alias);
     address.setAddress(phoneNumber);
     message.addToRecipient(address);
 
@@ -312,4 +285,33 @@
     return true;
 }
 
+//---------------------------------------------------------------
+// UnifiedViewer::onDialogDeleteMsg
+// @see header file
+//---------------------------------------------------------------
+void UnifiedViewer::onDialogDeleteMsg(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        QList<int> msgIdList;
+        msgIdList << mMessageId;
+
+        ConversationsEngine::instance()->deleteMessages(msgIdList);
+
+        QVariantList param;
+        if (mMsgCount > 1) {
+            param << MsgBaseView::CV;
+            param << MsgBaseView::UNIVIEWER;
+        }
+        else {
+            param << MsgBaseView::CLV;
+            param << MsgBaseView::UNIVIEWER;
+        }
+
+        QVariant dummy(QVariant::Invalid);
+        param << dummy;
+        emit switchView(param);
+    }
+}
+
 // EOF