--- a/messagingapp/msgui/msgapp/src/msgmainwindow.cpp Fri Sep 17 20:16:33 2010 +0530
+++ b/messagingapp/msgui/msgapp/src/msgmainwindow.cpp Tue Oct 05 13:58:47 2010 +0530
@@ -22,24 +22,68 @@
#include "msgserviceinterface.h"
#include "msgsendserviceinterface.h"
#include "conversationsengine.h"
+#include "msgactivityhandler.h"
+#include <hbapplication.h>
#include <QKeyEvent>
+#include <afactivation.h>
+#include <afactivitystorage.h>
+const int INVALID_MSGID = -1;
+
+//---------------------------------------------------------------
+// MsgMainWindow::MsgMainWindow
+// Constructor
+//---------------------------------------------------------------
+MsgMainWindow::MsgMainWindow(bool serviceRequest, QWidget *parent) :
+HbMainWindow(parent), mMsgSI(0), mMsgSendSI(0)
+{
+ initialize(serviceRequest);
+}
//---------------------------------------------------------------
// MsgMainWindow::MsgMainWindow
// Constructor
//---------------------------------------------------------------
-MsgMainWindow::MsgMainWindow(bool serviceRequest,int activityMsgId,QWidget *parent) :
-HbMainWindow(parent), mMsgSI(0), mMsgSendSI(0)
+void MsgMainWindow::initialize(bool serviceRequest)
{
+ int activityMsgId = INVALID_MSGID;
+
+ MsgActivityHandler* activityHandler =
+ new MsgActivityHandler(this);
+
+ AfActivation *activation = new AfActivation( this );
+
+ Af::ActivationReason reason = activation->reason();
+
+ if (reason == Af::ActivationReasonActivity)
+ {
+ // set service request to false , since its a activity launch
+ serviceRequest = false;
+
+ QString actName = activation->name();
+
+ QVariant data = activityHandler->activitiyStorage()->activityData(actName);
+
+ activityMsgId = activityHandler->parseActivityData(data);
+ }
+
mViewManager = new MsgViewManager(serviceRequest,this,this,activityMsgId);
mMsgSI = new MsgServiceInterface(NULL,mViewManager);
mMsgSendSI = new MsgSendServiceInterface(NULL,mViewManager);
-
+
//Model creation
ConversationsEngine::instance();
+ // clear the old activities
+ activityHandler->clearActivities();
+
+ // Set the main window pointer to activity handler.
+ activityHandler->setMainWindow(this);
+
+ // connect to aboutToQuit signal to save drafts content
+ QObject::connect(qApp, SIGNAL(aboutToQuit()),
+ activityHandler, SLOT(saveActivity()));
}
//---------------------------------------------------------------
@@ -90,4 +134,5 @@
}
}
+
// End of file