-rw-r--r-- | core/launcher/main.cpp | 104 | ||||
-rw-r--r-- | packages | 1 |
2 files changed, 44 insertions, 61 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 1e5eb46..49b41d6 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -48,34 +48,31 @@ | |||
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | using namespace Opie; | 50 | using namespace Opie; |
51 | 51 | ||
52 | void initEnvironment( ) | 52 | void initEnvironment() |
53 | { | 53 | { |
54 | Config config("locale"); | 54 | Config config("locale"); |
55 | config.setGroup( "Location" ); | 55 | config.setGroup( "Location" ); |
56 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); | 56 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); |
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 | |||
65 | config.setGroup( "Language" ); | ||
66 | QString lang = config.readEntry( "Language", getenv("LANG") ); | ||
67 | if ( !lang.isNull() ) | ||
68 | setenv( "LANG", lang, 1 ); | ||
69 | 64 | ||
65 | config.setGroup( "Language" ); | ||
66 | QString lang = config.readEntry( "Language", getenv("LANG") ); | ||
67 | if ( !lang.isNull() ) | ||
68 | setenv( "LANG", lang, 1 ); | ||
70 | } | 69 | } |
71 | 70 | ||
72 | 71 | ||
73 | int initApplication( int argc, char ** argv ) | 72 | int initApplication( int argc, char ** argv ) |
74 | { | 73 | { |
75 | struct ODevice *odev = ODevice::inst(); | 74 | initEnvironment(); |
76 | |||
77 | initEnvironment( ); | ||
78 | 75 | ||
79 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) | 76 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) |
80 | setenv( "QWS_SIZE", "240x320", 0 ); | 77 | setenv( "QWS_SIZE", "240x320", 0 ); |
81 | #endif | 78 | #endif |
@@ -83,27 +80,14 @@ int initApplication( int argc, char ** argv ) | |||
83 | //Don't flicker at startup: | 80 | //Don't flicker at startup: |
84 | QWSServer::setDesktopBackground( QImage() ); | 81 | QWSServer::setDesktopBackground( QImage() ); |
85 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 82 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
86 | 83 | ||
87 | int rot; | 84 | ODevice::inst ( )-> setSoftSuspend ( true ); |
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 ); | ||
101 | 85 | ||
102 | { // init backlight | 86 | { // init backlight |
103 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 87 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
104 | e << -3; // Forced on | 88 | e << -3; // Forced on |
105 | } | 89 | } |
106 | 90 | ||
107 | AlarmServer::initialize(); | 91 | AlarmServer::initialize(); |
108 | 92 | ||
109 | Desktop *d = new Desktop(); | 93 | Desktop *d = new Desktop(); |
@@ -119,68 +103,68 @@ int initApplication( int argc, char ** argv ) | |||
119 | Network::createServer(d); | 103 | Network::createServer(d); |
120 | 104 | ||
121 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 105 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
122 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 106 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
123 | // Make sure calibration widget starts on top. | 107 | // Make sure calibration widget starts on top. |
124 | Calibrate *cal = new Calibrate; | 108 | Calibrate *cal = new Calibrate; |
125 | cal->exec(); | 109 | cal->exec(); |
126 | delete cal; | 110 | delete cal; |
127 | } | 111 | } |
128 | #endif | 112 | #endif |
129 | 113 | ||
130 | d->show(); | 114 | d->show(); |
131 | 115 | ||
132 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { | 116 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { |
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 ) { | 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 ) { |
134 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 118 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
135 | e << QString ( ); | 119 | e << QString ( ); |
136 | } | 120 | } |
137 | } | 121 | } |
138 | 122 | ||
139 | int rv = a.exec(); | 123 | int rv = a.exec(); |
140 | 124 | ||
141 | delete d; | 125 | delete d; |
142 | 126 | ||
143 | odev-> setSoftSuspend ( false ); | 127 | ODevice::inst ( )-> setSoftSuspend ( false ); |
144 | 128 | ||
145 | return rv; | 129 | return rv; |
146 | } | 130 | } |
147 | 131 | ||
148 | static const char *pidfile_path = "/var/run/opie.pid"; | 132 | static const char *pidfile_path = "/var/run/opie.pid"; |
149 | 133 | ||
150 | void create_pidfile ( ) | 134 | void create_pidfile ( ) |
151 | { | 135 | { |
152 | FILE *f; | 136 | FILE *f; |
153 | 137 | ||
154 | if (( f = ::fopen ( pidfile_path, "w" ))) { | 138 | if (( f = ::fopen ( pidfile_path, "w" ))) { |
155 | ::fprintf ( f, "%d", getpid ( )); | 139 | ::fprintf ( f, "%d", getpid ( )); |
156 | ::fclose ( f ); | 140 | ::fclose ( f ); |
157 | } | 141 | } |
158 | } | 142 | } |
159 | 143 | ||
160 | void remove_pidfile ( ) | 144 | void remove_pidfile ( ) |
161 | { | 145 | { |
162 | ::unlink ( pidfile_path ); | 146 | ::unlink ( pidfile_path ); |
163 | } | 147 | } |
164 | 148 | ||
165 | void handle_sigterm ( int /* sig */ ) | 149 | void handle_sigterm ( int /* sig */ ) |
166 | { | 150 | { |
167 | if ( qApp ) | 151 | if ( qApp ) |
168 | qApp-> quit ( ); | 152 | qApp-> quit ( ); |
169 | } | 153 | } |
170 | 154 | ||
171 | int main( int argc, char ** argv ) | 155 | int main( int argc, char ** argv ) |
172 | { | 156 | { |
173 | ::signal ( SIGCHLD, SIG_IGN ); | 157 | ::signal ( SIGCHLD, SIG_IGN ); |
174 | 158 | ||
175 | ::signal ( SIGTERM, handle_sigterm ); | 159 | ::signal ( SIGTERM, handle_sigterm ); |
176 | ::signal ( SIGINT, handle_sigterm ); | 160 | ::signal ( SIGINT, handle_sigterm ); |
177 | 161 | ||
178 | ::setsid ( ); | 162 | ::setsid ( ); |
179 | ::setpgid ( 0, 0 ); | 163 | ::setpgid ( 0, 0 ); |
180 | 164 | ||
181 | ::atexit ( remove_pidfile ); | 165 | ::atexit ( remove_pidfile ); |
182 | create_pidfile ( ); | 166 | create_pidfile ( ); |
183 | 167 | ||
184 | int retVal = initApplication ( argc, argv ); | 168 | int retVal = initApplication ( argc, argv ); |
185 | 169 | ||
186 | // Kill them. Kill them all. | 170 | // Kill them. Kill them all. |
@@ -7,9 +7,8 @@ CONFIG_CONVERTER noncore/unsupported/opiemail/converter converter.pro | |||
7 | CONFIG_DIALUP noncore/unsupported/netsetup/dialupdialup.pro | 7 | CONFIG_DIALUP noncore/unsupported/netsetup/dialupdialup.pro |
8 | CONFIG_DICTIONARY noncore/apps/dictionarydictionary.pro | 8 | CONFIG_DICTIONARY noncore/apps/dictionarydictionary.pro |
9 | CONFIG_GSMTOOL noncore/comm/gsmtoolgsmtool.pro | 9 | CONFIG_GSMTOOL noncore/comm/gsmtoolgsmtool.pro |
10 | CONFIG_KEYVIEW development/keyviewkeyview.pro | 10 | CONFIG_KEYVIEW development/keyviewkeyview.pro |
11 | CONFIG_ROTTEST development/rottestrottest.pro | ||
12 | CONFIG_LAN noncore/unsupported/netsetup/lanlan.pro | 11 | CONFIG_LAN noncore/unsupported/netsetup/lanlan.pro |
13 | CONFIG_LIB noncore/unsupported/opiemail/liblib.pro | 12 | CONFIG_LIB noncore/unsupported/opiemail/liblib.pro |
14 | CONFIG_LIBFFMPEG core/multimedia/opieplayer/libffmpeglibffmpeg.pro | 13 | CONFIG_LIBFFMPEG core/multimedia/opieplayer/libffmpeglibffmpeg.pro |
15 | CONFIG_LIBFLASH core/multimedia/opieplayer/libflashlibflash.pro | 14 | CONFIG_LIBFLASH core/multimedia/opieplayer/libflashlibflash.pro |