equal
deleted
inserted
replaced
21 #include <QFile> |
21 #include <QFile> |
22 #include "debugtraces.h" |
22 #include "debugtraces.h" |
23 #include <QDateTime> |
23 #include <QDateTime> |
24 #include <QPointer> |
24 #include <QPointer> |
25 #include <HbSplashScreen> |
25 #include <HbSplashScreen> |
|
26 #include <HbApplication> |
26 |
27 |
27 #include "msgmainwindow.h" |
28 #include "msgmainwindow.h" |
|
29 #include "msgviewmanager.h" |
|
30 #include "msgactivityhandler.h" |
28 #include "msgapplication.h" |
31 #include "msgapplication.h" |
29 |
32 |
30 //Localised constants |
33 //Localised constants |
31 #define LOC_TITLE hbTrId("txt_messaging_title_messaging") |
34 #define LOC_TITLE hbTrId("txt_messaging_title_messaging") |
32 |
35 |
33 const QString debugFileName("c:/art2_app_log.txt"); |
36 const QString debugFileName("c:/art2_app_log.txt"); |
34 const QString activityParam("-activity"); |
37 const QString activityParam("-activity"); |
35 const int INVALID_MSGID = -1; |
|
36 |
38 |
37 #ifdef _DEBUG_TRACES_ |
39 #ifdef _DEBUG_TRACES_ |
38 void debugInit(QtMsgType type, const char *msg) |
40 void debugInit(QtMsgType type, const char *msg) |
39 { |
41 { |
40 |
42 |
92 } |
94 } |
93 else |
95 else |
94 { |
96 { |
95 HbSplashScreen::setScreenId("clv"); |
97 HbSplashScreen::setScreenId("clv"); |
96 } |
98 } |
97 |
99 |
98 // Application |
100 // Application |
99 //MsgApplication class dervied from HbApplication is create in order to |
101 //MsgApplication class dervied from HbApplication is create in order to |
100 //emit applicationReady signal for Matti tool |
102 //emit applicationReady signal for Matti tool |
101 MsgApplication app(argc, argv); |
103 MsgApplication app(argc, argv); |
102 |
104 |
103 |
105 //TODO pass this flag to viewmanager to prevent saving of activity |
|
106 //if this is set |
|
107 //bool preloaded = HbApplication::startedToBackground(); |
|
108 |
104 //TODO: Uncomment the lines when actual translation files are available in sdk and remove loading locally. |
109 //TODO: Uncomment the lines when actual translation files are available in sdk and remove loading locally. |
105 QString locale = QLocale::system().name(); |
110 QString locale = QLocale::system().name(); |
106 QString path = "z:/resource/qt/translations/"; |
111 QString path = "z:/resource/qt/translations/"; |
107 QTranslator translator; |
112 QTranslator translator; |
108 QTranslator translator_comm; |
113 QTranslator translator_comm; |
120 { |
125 { |
121 ofile.remove(debugFileName); |
126 ofile.remove(debugFileName); |
122 } |
127 } |
123 qInstallMsgHandler(debugInit); |
128 qInstallMsgHandler(debugInit); |
124 #endif |
129 #endif |
|
130 |
|
131 MsgActivityHandler* activityHandler = new MsgActivityHandler(&app); |
|
132 // Main window |
|
133 QPointer<MsgMainWindow> mainWindow = new MsgMainWindow(serviceRequest, |
|
134 activityHandler); |
|
135 app.initViewReady(); |
|
136 // Set the main window pointer to activity handler. |
|
137 activityHandler->setMainWindow(mainWindow); |
|
138 |
|
139 //Install event filter on app |
|
140 app.installEventFilter(mainWindow); |
125 |
141 |
126 // Main window |
142 // connect to aboutToQuit signal to save activity |
127 QPointer<MsgMainWindow> mainWindow = |
143 QObject::connect(&app, SIGNAL(closeEvent()), |
128 new MsgMainWindow(serviceRequest); |
144 mainWindow->viewManager(), SLOT(handleSendToBackGround())); |
129 app.initViewReady(); |
145 |
130 mainWindow->show(); |
146 mainWindow->show(); |
131 |
147 |
132 // Event loop |
148 // Event loop |
133 int error = app.exec(); |
149 int error = app.exec(); |
134 HbApplication::processEvents(); |
150 HbApplication::processEvents(); |