|
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 <hbmainwindow.h> |
|
20 #include <QTranslator> |
|
21 #include <QLocale> |
|
22 #include <QFile> |
|
23 #include <QPointer> |
|
24 #include <QDateTime> |
|
25 |
|
26 #include "settingsserviceinterface.h" |
|
27 #include "debugtraces.h" |
|
28 |
|
29 //Localised constants |
|
30 #define LOC_TITLE hbTrId("txt_messaging_title_messaging") |
|
31 |
|
32 const QString debugFileName("c:/settingsservice_app.txt"); |
|
33 |
|
34 #ifdef _DEBUG_TRACES_ |
|
35 void debugInit(QtMsgType type, const char *msg) |
|
36 { |
|
37 |
|
38 QFile ofile(debugFileName); |
|
39 if (!ofile.open(QIODevice::Append | QIODevice::Text)) |
|
40 { |
|
41 qFatal("error opening results file"); |
|
42 return; |
|
43 } |
|
44 QDateTime dt = QDateTime::currentDateTime(); |
|
45 |
|
46 QTextStream out(&ofile); |
|
47 switch (type) |
|
48 { |
|
49 case QtDebugMsg: |
|
50 out << " DEBUG:"; |
|
51 out << msg; |
|
52 break; |
|
53 case QtWarningMsg: |
|
54 out << " WARN:"; |
|
55 out << msg; |
|
56 break; |
|
57 case QtCriticalMsg: |
|
58 out << "\n "; |
|
59 out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap"); |
|
60 out << " CRITICAL:"; |
|
61 out << msg; |
|
62 break; |
|
63 case QtFatalMsg: |
|
64 out << " FATAL:"; |
|
65 out << msg; |
|
66 abort(); |
|
67 break; |
|
68 default: |
|
69 out << " No Log Selection Type:"; |
|
70 out << msg; |
|
71 break; |
|
72 |
|
73 } |
|
74 } |
|
75 #endif |
|
76 |
|
77 int main(int argc, char **argv) |
|
78 { |
|
79 HbApplication app( argc, argv ); |
|
80 |
|
81 //TODO: Uncomment the lines when actual 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 app.installTranslator(&translator); |
|
89 app.installTranslator(&translator_comm); |
|
90 |
|
91 app.setApplicationName(LOC_TITLE); |
|
92 |
|
93 #ifdef _DEBUG_TRACES_ |
|
94 //Debug Logs |
|
95 QFile ofile; |
|
96 if (ofile.exists(debugFileName)) |
|
97 { |
|
98 ofile.remove(debugFileName); |
|
99 } |
|
100 qInstallMsgHandler(debugInit); |
|
101 #endif |
|
102 |
|
103 |
|
104 HbMainWindow *window = new HbMainWindow(); |
|
105 |
|
106 SettingsViewInterface *settingsViewInterface = new SettingsViewInterface(window); |
|
107 window->show(); |
|
108 |
|
109 int rv = app.exec(); |
|
110 delete window; |
|
111 delete settingsViewInterface; |
|
112 return rv; |
|
113 } |
|
114 |