|
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 |
|
25 #include "msgservicewindow.h" |
|
26 #include "debugtraces.h" |
|
27 |
|
28 //Localised constants |
|
29 #define LOC_TITLE hbTrId("txt_messaging_title_messaging") |
|
30 |
|
31 const QString debugFileName("c:/msgservice_app.txt"); |
|
32 |
|
33 #ifdef _DEBUG_TRACES_ |
|
34 void debugInit(QtMsgType type, const char *msg) |
|
35 { |
|
36 |
|
37 QFile ofile(debugFileName); |
|
38 if (!ofile.open(QIODevice::Append | QIODevice::Text)) |
|
39 { |
|
40 qFatal("error opening results file"); |
|
41 return; |
|
42 } |
|
43 QDateTime dt = QDateTime::currentDateTime(); |
|
44 |
|
45 QTextStream out(&ofile); |
|
46 switch (type) |
|
47 { |
|
48 case QtDebugMsg: |
|
49 out << " DEBUG:"; |
|
50 out << msg; |
|
51 break; |
|
52 case QtWarningMsg: |
|
53 out << " WARN:"; |
|
54 out << msg; |
|
55 break; |
|
56 case QtCriticalMsg: |
|
57 out << "\n "; |
|
58 out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap"); |
|
59 out << " CRITICAL:"; |
|
60 out << msg; |
|
61 break; |
|
62 case QtFatalMsg: |
|
63 out << " FATAL:"; |
|
64 out << msg; |
|
65 abort(); |
|
66 break; |
|
67 default: |
|
68 out << " No Log Selection Type:"; |
|
69 out << msg; |
|
70 break; |
|
71 |
|
72 } |
|
73 } |
|
74 #endif |
|
75 |
|
76 int main(int argc, char **argv) |
|
77 { |
|
78 HbApplication app( argc, argv ); |
|
79 |
|
80 //TODO: Uncomment the lines when actual |
|
81 //translation files are available in sdk and remove loading locally. |
|
82 QString locale = QLocale::system().name(); |
|
83 QString path = "z:/resource/qt/translations/"; |
|
84 QTranslator translator; |
|
85 //QTranslator translator_comm; |
|
86 //translator.load(path + QString("messaging_") + locale); |
|
87 //translator_comm.load(path + QString("common_") + locale); |
|
88 translator.load( "messaging_en_GB", ":/translations" ); |
|
89 app.installTranslator(&translator); |
|
90 //app.installTranslator(&translator_comm); |
|
91 |
|
92 app.setApplicationName(LOC_TITLE); |
|
93 |
|
94 QPointer<MsgServiceWindow> window = new MsgServiceWindow(); |
|
95 window->show(); |
|
96 |
|
97 int rv = app.exec(); |
|
98 delete window; |
|
99 return rv; |
|
100 } |
|
101 |