|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Messaging service application startup main(). |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <hbapplication.h> |
|
19 #include <QTranslator> |
|
20 #include <QLocale> |
|
21 #include <QFile> |
|
22 #include <QPointer> |
|
23 #include <QDateTime> |
|
24 #include <HbSplashScreen> |
|
25 #include <xqserviceutil.h> |
|
26 |
|
27 #include "msgservicewindow.h" |
|
28 #include "debugtraces.h" |
|
29 |
|
30 //Localised constants |
|
31 #define LOC_TITLE hbTrId("txt_messaging_title_messaging") |
|
32 |
|
33 const QString debugFileName("c:/msgservice_app.txt"); |
|
34 const QString TRANSLATOR_FILE_PATH("z:/resource/qt/translations/"); |
|
35 |
|
36 #ifdef _DEBUG_TRACES_ |
|
37 void debugInit(QtMsgType type, const char *msg) |
|
38 { |
|
39 |
|
40 QFile ofile(debugFileName); |
|
41 if (!ofile.open(QIODevice::Append | QIODevice::Text)) |
|
42 { |
|
43 qFatal("error opening results file"); |
|
44 return; |
|
45 } |
|
46 QDateTime dt = QDateTime::currentDateTime(); |
|
47 |
|
48 QTextStream out(&ofile); |
|
49 switch (type) |
|
50 { |
|
51 case QtDebugMsg: |
|
52 out << " DEBUG:"; |
|
53 out << msg; |
|
54 break; |
|
55 case QtWarningMsg: |
|
56 out << " WARN:"; |
|
57 out << msg; |
|
58 break; |
|
59 case QtCriticalMsg: |
|
60 out << "\n "; |
|
61 out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap"); |
|
62 out << " CRITICAL:"; |
|
63 out << msg; |
|
64 break; |
|
65 case QtFatalMsg: |
|
66 out << " FATAL:"; |
|
67 out << msg; |
|
68 abort(); |
|
69 break; |
|
70 default: |
|
71 out << " No Log Selection Type:"; |
|
72 out << msg; |
|
73 break; |
|
74 |
|
75 } |
|
76 } |
|
77 #endif |
|
78 |
|
79 int main(int argc, char **argv) |
|
80 { |
|
81 // if else loop to launch the splash screen based on the service called. |
|
82 |
|
83 QString serviceName = XQServiceUtil::interfaceName( argc, argv); |
|
84 |
|
85 if( !serviceName.compare( QString( "com.nokia.symbian.IMessageSend") ) ) |
|
86 { |
|
87 HbSplashScreen::setScreenId( "sendservice" ); |
|
88 } |
|
89 else if ( !serviceName.compare( "com.nokia.symbian.IMessageView") ) |
|
90 { |
|
91 HbSplashScreen::setScreenId( "viewservice" ); |
|
92 } |
|
93 |
|
94 HbApplication app( argc, argv ); |
|
95 |
|
96 //installing translator. |
|
97 QString locale = QLocale::system().name(); |
|
98 QTranslator translator; |
|
99 QTranslator translator_comm; |
|
100 translator.load(TRANSLATOR_FILE_PATH + QString("messaging_") + locale); |
|
101 translator_comm.load(TRANSLATOR_FILE_PATH + QString("common_") + locale); |
|
102 app.installTranslator(&translator); |
|
103 app.installTranslator(&translator_comm); |
|
104 |
|
105 app.setApplicationName(LOC_TITLE); |
|
106 |
|
107 QPointer<MsgServiceWindow> window = new MsgServiceWindow(); |
|
108 window->show(); |
|
109 |
|
110 int rv = app.exec(); |
|
111 delete window; |
|
112 return rv; |
|
113 } |
|
114 |