messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
--- a/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp	Fri May 14 15:49:35 2010 +0300
@@ -29,6 +29,8 @@
 #include <qtcontactsglobal.h>
 #include <qtcontacts.h>
 #include <ccsdefs.h>
+#include <XQSettingsManager>
+#include <QTimer>
 
 // USER INCLUDES
 #include "msgconversationview.h"
@@ -36,6 +38,7 @@
 #include "msgviewdefines.h"
 #include "conversationsenginedefines.h"
 #include "msgcontactcardwidget.h"
+#include "conversationidpsconsts.h"
 
 QTM_USE_NAMESPACE
 
@@ -48,8 +51,9 @@
 //---------------------------------------------------------------
 MsgConversationBaseView::MsgConversationBaseView(QGraphicsItem* parent) :
 MsgBaseView(parent),
-mConversationView(NULL),
-mConversationId(-1)
+mConversationId(-1),
+mCVIdkey(XQSettingsKey::TargetPublishAndSubscribe,KMsgCVIdProperty, 
+        KMsgCVIdKey)
 { 
     connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));   
     initView();
@@ -73,6 +77,9 @@
     mConversationId = convId;
     connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
     
+	// publsih conversation id
+    mSettingsManager->writeItemValue(mCVIdkey,(int)mConversationId);
+    
     if(mConversationView)
         {
         mConversationView->refreshView();
@@ -123,7 +130,9 @@
     mMainLayout->addItem(mConversationView);
 
     this->setLayout(mMainLayout);
-
+    
+    mSettingsManager = new XQSettingsManager(this);
+          
 }
 
 //---------------------------------------------------------------
@@ -165,6 +174,15 @@
         }
     }
 
+//--------------------------------------------------------------- 
+// MsgConversationBaseView::conversationId 
+// get the conversation ID 
+//---------------------------------------------------------------     
+qint64 MsgConversationBaseView::conversationId() 
+    { 
+    return mConversationId; 
+    }
+
 //---------------------------------------------------------------
 // MsgConversationBaseView::clearContent
 // clears conversation view content
@@ -201,8 +219,18 @@
 void MsgConversationBaseView::doDelayedConstruction()
 {
     disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
+    QTimer::singleShot(50,this,SLOT(handleViewReady()));    
+}
+
+
+//---------------------------------------------------------------
+// MsgConversationBaseView::handleViewReady
+//
+//---------------------------------------------------------------	
+void MsgConversationBaseView::handleViewReady()
+    {
     ConversationsEngine::instance()->fetchMoreConversations();
-}
+    }
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::hideChrome
@@ -234,4 +262,17 @@
         }
     }
 
+//---------------------------------------------------------------
+// MsgConversationBaseView::setPSCVId
+//
+//---------------------------------------------------------------
+void MsgConversationBaseView::setPSCVId(bool setId)
+{
+    if(setId){
+    mSettingsManager->writeItemValue(mCVIdkey,(int)mConversationId);
+    }
+    else {
+    mSettingsManager->writeItemValue(mCVIdkey,-1);
+    }
+}
 // EOF