-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
59 lines (51 loc) · 1.39 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <QtGui/QApplication>
#include "mainwindow.h"
#include "osso-intl.h"
#include <QFile>
#include <QTextStream>
#ifdef Q_WS_MAEMO_5
#include <QDBusConnection>
#include <QDBusMessage>
#define DBUS_SERVICE "com.nokia.worldclock"
#define DBUS_PATH "/com/nokia/worldclock"
#define DBUS_INTERFACE "com.nokia.worldclock"
#endif
int main(int argc, char *argv[])
{
intl("osso-clock");
QApplication a(argc, argv);
QString line, lang;
QFile data( "/etc/osso-af-init/locale" );
if (data.open(QFile::ReadOnly | QFile::Truncate))
{
QTextStream out(&data);
while ( !out.atEnd() )
{
line = out.readLine();
if ( line.indexOf("export LANG") == 0 )
{
lang = line;
lang.replace("export LANG=","");
}
}
}
data.close();
QLocale::setDefault(lang);
#ifdef Q_WS_MAEMO_5
if ( ! QDBusConnection::sessionBus().registerService(DBUS_SERVICE) ) {
QDBusConnection::sessionBus().send(QDBusMessage::createMethodCall(DBUS_SERVICE, DBUS_PATH, DBUS_INTERFACE, "top_application"));
return 0;
}
#endif
MainWindow w;
#ifdef Q_WS_MAEMO_5
if ( ! QDBusConnection::sessionBus().registerObject(DBUS_PATH, &w, QDBusConnection::ExportScriptableSlots) )
return 1;
#endif
#if defined(Q_WS_S60)
w.showMaximized();
#else
w.show();
#endif
return a.exec();
}