messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 43 35b64624a9e7
--- a/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp	Fri Jun 04 10:25:39 2010 +0100
+++ b/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp	Fri Jun 11 13:35:48 2010 +0300
@@ -50,12 +50,10 @@
 // Constructor
 //---------------------------------------------------------------
 MsgConversationBaseView::MsgConversationBaseView(QGraphicsItem* parent) :
-MsgBaseView(parent),
-mConversationId(-1),
-mCVIdkey(XQSettingsKey::TargetPublishAndSubscribe,KMsgCVIdProperty, 
-        KMsgCVIdKey)
-{ 
-    connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));   
+    MsgBaseView(parent), mConversationId(-1), mCVIdkey(XQSettingsKey::TargetPublishAndSubscribe,
+        KMsgCVIdProperty, KMsgCVIdKey)
+{
+    connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction()));
     initView();
 }
 
@@ -64,7 +62,7 @@
 // Destructor
 //---------------------------------------------------------------
 MsgConversationBaseView::~MsgConversationBaseView()
-{   
+{
 }
 
 //---------------------------------------------------------------
@@ -75,15 +73,14 @@
 {
     ConversationsEngine::instance()->getConversations(convId);
     mConversationId = convId;
-    connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
-    
-	// publsih conversation id
-    mSettingsManager->writeItemValue(mCVIdkey,(int)mConversationId);
-    
-    if(mConversationView)
-        {
+    connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction()));
+
+    // publsih conversation id
+    mSettingsManager->writeItemValue(mCVIdkey, (int) mConversationId);
+
+    if (mConversationView) {
         mConversationView->refreshView();
-        }
+    }
 }
 
 //---------------------------------------------------------------
@@ -91,8 +88,8 @@
 // create and initialise the conversationview
 //---------------------------------------------------------------
 void MsgConversationBaseView::initView()
-    {
-    
+{
+
     // Create header widget
     mContactCard = new MsgContactCardWidget(this);
 
@@ -100,8 +97,7 @@
 
     qreal spacing = HbDeviceProfile::profile(this).unitValue();
     mMainLayout->setSpacing(spacing);
-    mMainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN,
-                                   CONTENT_MARGIN, CONTENT_MARGIN);
+    mMainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN, CONTENT_MARGIN, CONTENT_MARGIN);
 
     mMainLayout->addItem(mContactCard);
 
@@ -114,25 +110,24 @@
 
     mConversationView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-    connect(mConversationView, SIGNAL(closeConversationView()),
-            this, SLOT(closeConversationView()));
+    connect(mConversationView, SIGNAL(closeConversationView()), this, SLOT(closeConversationView()));
+
+    connect(mConversationView, SIGNAL(replyStarted()), this, SLOT(markMessagesAsRead()));
 
-    connect(mConversationView,SIGNAL(replyStarted()),
-            this,SLOT(markMessagesAsRead()));
+    connect(mConversationView, SIGNAL(switchView(const QVariantList&)), this,
+        SIGNAL(switchView(const QVariantList&)));
 
-    connect(mConversationView, SIGNAL(switchView(const QVariantList&)),
-            this, SIGNAL(switchView(const QVariantList&)));
-    
-    connect(mConversationView,SIGNAL(hideChrome(bool)),this,SLOT(hideChrome(bool)));
+    connect(mConversationView, SIGNAL(vkbOpened(bool)), this, SLOT(hideChrome(bool)));
+    connect(mConversationView, SIGNAL(vkbOpened(bool)), mContactCard, SLOT(ignoreSignals(bool)));
 
     this->setMenu(mConversationView->menu());
 
     mMainLayout->addItem(mConversationView);
 
     this->setLayout(mMainLayout);
-    
+
     mSettingsManager = new XQSettingsManager(this);
-          
+
 }
 
 //---------------------------------------------------------------
@@ -141,7 +136,7 @@
 //---------------------------------------------------------------
 void MsgConversationBaseView::closeConversationView()
 {
-   markMessagesAsRead();
+    markMessagesAsRead();
 }
 
 //---------------------------------------------------------------
@@ -149,39 +144,36 @@
 // Mark unread msgs in cv as read
 //---------------------------------------------------------------
 void MsgConversationBaseView::markMessagesAsRead()
-    {
-    if( mConversationId >= 0)
-        {
+{
+    if (mConversationId >= 0) {
         ConversationsEngine::instance()->markConversationRead(mConversationId);
-        }
     }
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::saveContentToDrafts
 // saves the editors content to drafts
 //---------------------------------------------------------------
 void MsgConversationBaseView::saveContentToDrafts()
-    {
+{
     bool result = false;
-    if( mConversationId >= 0)
-        {
+    if (mConversationId >= 0) {
         result = mConversationView->saveContentToDrafts();
-        }
-    
-    if(result)
-        {
+    }
+
+    if (result) {
         HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS);
-        }
     }
+}
 
 //--------------------------------------------------------------- 
 // MsgConversationBaseView::conversationId 
 // get the conversation ID 
 //---------------------------------------------------------------     
-qint64 MsgConversationBaseView::conversationId() 
-    { 
-    return mConversationId; 
-    }
+qint64 MsgConversationBaseView::conversationId()
+{
+    return mConversationId;
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::clearContent
@@ -198,19 +190,19 @@
 //
 //---------------------------------------------------------------
 void MsgConversationBaseView::handleOk(const QVariant& result)
-    {
+{
     Q_UNUSED(result)
-    }
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::handleError
 //
 //---------------------------------------------------------------
 void MsgConversationBaseView::handleError(int errorCode, const QString& errorMessage)
-    {
+{
     Q_UNUSED(errorMessage)
     Q_UNUSED(errorCode)
-    }
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::doDelayedConstruction
@@ -218,49 +210,44 @@
 //---------------------------------------------------------------	
 void MsgConversationBaseView::doDelayedConstruction()
 {
-    disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
-    QTimer::singleShot(50,this,SLOT(handleViewReady()));    
+    disconnect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction()));
+    QTimer::singleShot(50, this, SLOT(handleViewReady()));
 }
 
-
 //---------------------------------------------------------------
 // MsgConversationBaseView::handleViewReady
 //
 //---------------------------------------------------------------	
 void MsgConversationBaseView::handleViewReady()
-    {
+{
     ConversationsEngine::instance()->fetchMoreConversations();
-    }
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::hideChrome
 //
 //---------------------------------------------------------------
 void MsgConversationBaseView::hideChrome(bool hide)
-    {
-    if(hide)
-        {        
+{
+    if (hide) {
         this->hideItems(Hb::StatusBarItem | Hb::TitleBarItem);
         this->setContentFullScreen(true);
-        
-        if(this->mainWindow()->orientation() == Qt::Horizontal)
-            {
+
+        if (this->mainWindow()->orientation() == Qt::Horizontal) {
             mMainLayout->removeItem(mContactCard);
             mContactCard->hide();
-            }
         }
-    else
-        {
+    }
+    else {
         this->showItems(Hb::StatusBarItem | Hb::TitleBarItem);
         this->setContentFullScreen(false);
-        
-        if(!mContactCard->isVisible())
-            {
-            mMainLayout->insertItem(0,mContactCard);
+
+        if (!mContactCard->isVisible()) {
+            mMainLayout->insertItem(0, mContactCard);
             mContactCard->show();
-            }
         }
     }
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::setPSCVId
@@ -268,11 +255,11 @@
 //---------------------------------------------------------------
 void MsgConversationBaseView::setPSCVId(bool setId)
 {
-    if(setId){
-    mSettingsManager->writeItemValue(mCVIdkey,(int)mConversationId);
+    if (setId) {
+        mSettingsManager->writeItemValue(mCVIdkey, (int) mConversationId);
     }
     else {
-    mSettingsManager->writeItemValue(mCVIdkey,-1);
+        mSettingsManager->writeItemValue(mCVIdkey, -1);
     }
 }
 // EOF