-rw-r--r-- | core/launcher/main.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 49b41d6..1e5eb46 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -57,40 +57,56 @@ void initEnvironment() | |||
57 | 57 | ||
58 | // if not timezone set, pick New York | 58 | // if not timezone set, pick New York |
59 | if (tz.isNull()) | 59 | if (tz.isNull()) |
60 | tz = "America/New_York"; | 60 | tz = "America/New_York"; |
61 | 61 | ||
62 | setenv( "TZ", tz, 1 ); | 62 | setenv( "TZ", tz, 1 ); |
63 | config.writeEntry( "Timezone", tz); | 63 | config.writeEntry( "Timezone", tz); |
64 | 64 | ||
65 | config.setGroup( "Language" ); | 65 | config.setGroup( "Language" ); |
66 | QString lang = config.readEntry( "Language", getenv("LANG") ); | 66 | QString lang = config.readEntry( "Language", getenv("LANG") ); |
67 | if ( !lang.isNull() ) | 67 | if ( !lang.isNull() ) |
68 | setenv( "LANG", lang, 1 ); | 68 | setenv( "LANG", lang, 1 ); |
69 | |||
69 | } | 70 | } |
70 | 71 | ||
71 | 72 | ||
72 | int initApplication( int argc, char ** argv ) | 73 | int initApplication( int argc, char ** argv ) |
73 | { | 74 | { |
75 | struct ODevice *odev = ODevice::inst(); | ||
76 | |||
74 | initEnvironment(); | 77 | initEnvironment(); |
75 | 78 | ||
76 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) | 79 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) |
77 | setenv( "QWS_SIZE", "240x320", 0 ); | 80 | setenv( "QWS_SIZE", "240x320", 0 ); |
78 | #endif | 81 | #endif |
79 | 82 | ||
80 | //Don't flicker at startup: | 83 | //Don't flicker at startup: |
81 | QWSServer::setDesktopBackground( QImage() ); | 84 | QWSServer::setDesktopBackground( QImage() ); |
82 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 85 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
83 | 86 | ||
84 | ODevice::inst ( )-> setSoftSuspend ( true ); | 87 | int rot; |
88 | switch ( odev-> rotation( ) ) { | ||
89 | case None: | ||
90 | rot = 0; | ||
91 | case Rot90: | ||
92 | rot = 90; | ||
93 | case Rot180: | ||
94 | rot = 180; | ||
95 | case Rot270: | ||
96 | rot = 270; | ||
97 | } | ||
98 | a.setDefaultRotation( rot ); | ||
99 | |||
100 | odev-> setSoftSuspend ( true ); | ||
85 | 101 | ||
86 | { // init backlight | 102 | { // init backlight |
87 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 103 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
88 | e << -3; // Forced on | 104 | e << -3; // Forced on |
89 | } | 105 | } |
90 | 106 | ||
91 | AlarmServer::initialize(); | 107 | AlarmServer::initialize(); |
92 | 108 | ||
93 | Desktop *d = new Desktop(); | 109 | Desktop *d = new Desktop(); |
94 | 110 | ||
95 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 111 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
96 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 112 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
@@ -115,25 +131,25 @@ int initApplication( int argc, char ** argv ) | |||
115 | 131 | ||
116 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { | 132 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { |
117 | if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { | 133 | if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { |
118 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 134 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
119 | e << QString ( ); | 135 | e << QString ( ); |
120 | } | 136 | } |
121 | } | 137 | } |
122 | 138 | ||
123 | int rv = a.exec(); | 139 | int rv = a.exec(); |
124 | 140 | ||
125 | delete d; | 141 | delete d; |
126 | 142 | ||
127 | ODevice::inst ( )-> setSoftSuspend ( false ); | 143 | odev-> setSoftSuspend ( false ); |
128 | 144 | ||
129 | return rv; | 145 | return rv; |
130 | } | 146 | } |
131 | 147 | ||
132 | static const char *pidfile_path = "/var/run/opie.pid"; | 148 | static const char *pidfile_path = "/var/run/opie.pid"; |
133 | 149 | ||
134 | void create_pidfile ( ) | 150 | void create_pidfile ( ) |
135 | { | 151 | { |
136 | FILE *f; | 152 | FILE *f; |
137 | 153 | ||
138 | if (( f = ::fopen ( pidfile_path, "w" ))) { | 154 | if (( f = ::fopen ( pidfile_path, "w" ))) { |
139 | ::fprintf ( f, "%d", getpid ( )); | 155 | ::fprintf ( f, "%d", getpid ( )); |