-rw-r--r-- | core/launcher/firstuse.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 50ae6c2..4316648 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp | |||
@@ -1,353 +1,353 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // I need access to some things you don't normally get access to. | 21 | // I need access to some things you don't normally get access to. |
22 | 22 | ||
23 | #ifndef _MSC_VER | 23 | #ifndef _MSC_VER |
24 | //### revise to allow removal of translators under MSVC | 24 | //### revise to allow removal of translators under MSVC |
25 | #define private public | 25 | #define private public |
26 | #define protected public | 26 | #define protected public |
27 | #endif | 27 | #endif |
28 | #include "firstuse.h" | 28 | #include "firstuse.h" |
29 | #include "inputmethods.h" | 29 | #include "inputmethods.h" |
30 | #include "applauncher.h" | 30 | #include "applauncher.h" |
31 | #include "serverapp.h" | 31 | #include "serverapp.h" |
32 | //#include <qtopia/custom.h> | 32 | //#include <qtopia/custom.h> |
33 | 33 | ||
34 | #include "calibrate.h" | 34 | #include "calibrate.h" |
35 | #include "documentlist.h" | 35 | #include "documentlist.h" |
36 | 36 | ||
37 | #include <qtopia/resource.h> | 37 | #include <qtopia/resource.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #include <qtopia/config.h> | 39 | #include <qtopia/config.h> |
40 | #include <qtopia/fontmanager.h> | 40 | #include <qtopia/fontmanager.h> |
41 | 41 | ||
42 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #include <qpainter.h> | 43 | #include <qpainter.h> |
44 | #include <qsimplerichtext.h> | 44 | #include <qsimplerichtext.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qtimer.h> | 47 | #include <qtimer.h> |
48 | 48 | ||
49 | #if defined( Q_WS_QWS ) | 49 | #if defined( Q_WS_QWS ) |
50 | #include <qwsdisplay_qws.h> | 50 | #include <qwsdisplay_qws.h> |
51 | #include <qgfx_qws.h> | 51 | #include <qgfx_qws.h> |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | 54 | ||
55 | #include <stdlib.h> | 55 | #include <stdlib.h> |
56 | #include <sys/types.h> | 56 | #include <sys/types.h> |
57 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) | 57 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) |
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | 61 | ||
62 | struct { | 62 | struct { |
63 | bool enabled; | 63 | bool enabled; |
64 | const char *app; | 64 | const char *app; |
65 | const char *start; | 65 | const char *start; |
66 | const char *stop; | 66 | const char *stop; |
67 | const char *desc; | 67 | const char *desc; |
68 | } | 68 | } |
69 | settingsTable [] = | 69 | settingsTable [] = |
70 | { | 70 | { |
71 | { FALSE, "language", "raise()", "accept()", // No tr | 71 | { FALSE, "language", "raise()", "accept()", // No tr |
72 | QT_TR_NOOP("Language") }, | 72 | QT_TR_NOOP("Language") }, |
73 | { FALSE, "doctab", "raise()", "accept()", // No tr | 73 | { FALSE, "doctab", "raise()", "accept()", // No tr |
74 | QT_TR_NOOP("DocTab") }, | 74 | QT_TR_NOOP("DocTab") }, |
75 | #ifndef Q_OS_WIN32 | 75 | #ifndef Q_OS_WIN32 |
76 | { FALSE, "systemtime", "raise()", "accept()", // No tr | 76 | { FALSE, "systemtime", "raise()", "accept()", // No tr |
77 | QT_TR_NOOP("Time and Date") }, | 77 | QT_TR_NOOP("Time and Date") }, |
78 | #endif | 78 | #endif |
79 | { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr | 79 | { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr |
80 | QT_TR_NOOP("Personal Information") }, | 80 | QT_TR_NOOP("Personal Information") }, |
81 | { FALSE, 0, 0, 0, 0 } | 81 | { FALSE, 0, 0, 0, 0 } |
82 | }; | 82 | }; |
83 | 83 | ||
84 | 84 | ||
85 | FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : | 85 | FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : |
86 | QDialog( parent, name, TRUE, wf), | 86 | QDialog( parent, name, TRUE, wf), |
87 | transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), | 87 | transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), |
88 | waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) | 88 | waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) |
89 | { | 89 | { |
90 | ServerApplication::allowRestart = FALSE; | 90 | ServerApplication::allowRestart = FALSE; |
91 | // we force our height beyound the maximum (which we set anyway) | 91 | // we force our height beyound the maximum (which we set anyway) |
92 | QRect desk = qApp->desktop()->geometry(); | 92 | QRect desk = qApp->desktop()->geometry(); |
93 | setGeometry( 0, 0, desk.width(), desk.height() ); | 93 | setGeometry( 0, 0, desk.width(), desk.height() ); |
94 | 94 | ||
95 | connect(qwsServer, SIGNAL(newChannel(const QString&)), | 95 | connect(qwsServer, SIGNAL(newChannel(const QString&)), |
96 | this, SLOT(newQcopChannel(const QString&))); | 96 | this, SLOT(newQcopChannel(const QString&))); |
97 | 97 | ||
98 | // Create a DocumentList so appLauncher has appLnkSet to search | 98 | // Create a DocumentList so appLauncher has appLnkSet to search |
99 | docList = new DocumentList( 0, FALSE ); | 99 | docList = new DocumentList( 0, FALSE ); |
100 | appLauncher = new AppLauncher( this ); | 100 | appLauncher = new AppLauncher( this ); |
101 | connect( appLauncher, SIGNAL(terminated(int, const QString&)), | 101 | connect( appLauncher, SIGNAL(terminated(int,const QString&)), |
102 | this, SLOT(terminated(int, const QString&)) ); | 102 | this, SLOT(terminated(int,const QString&)) ); |
103 | 103 | ||
104 | // more hackery | 104 | // more hackery |
105 | // I will be run as either the main server or as part of the main server | 105 | // I will be run as either the main server or as part of the main server |
106 | QWSServer::setScreenSaverIntervals(0); | 106 | QWSServer::setScreenSaverIntervals(0); |
107 | loadPixmaps(); | 107 | loadPixmaps(); |
108 | 108 | ||
109 | //check if there is a language program | 109 | //check if there is a language program |
110 | #ifndef Q_OS_WIN32 | 110 | #ifndef Q_OS_WIN32 |
111 | QString exeSuffix; | 111 | QString exeSuffix; |
112 | #else | 112 | #else |
113 | QString exeSuffix(".exe"); | 113 | QString exeSuffix(".exe"); |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | for ( int i = 0; settingsTable[i].app; i++ ) { | 116 | for ( int i = 0; settingsTable[i].app; i++ ) { |
117 | QString file = QPEApplication::qpeDir() + "bin/"; | 117 | QString file = QPEApplication::qpeDir() + "bin/"; |
118 | file += settingsTable[i].app; | 118 | file += settingsTable[i].app; |
119 | file += exeSuffix; | 119 | file += exeSuffix; |
120 | if ( QFile::exists(file) ) | 120 | if ( QFile::exists(file) ) |
121 | settingsTable[i].enabled = TRUE; | 121 | settingsTable[i].enabled = TRUE; |
122 | } | 122 | } |
123 | 123 | ||
124 | setFocusPolicy(NoFocus); | 124 | setFocusPolicy(NoFocus); |
125 | 125 | ||
126 | taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); | 126 | taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); |
127 | 127 | ||
128 | inputMethods = new InputMethods(taskBar); | 128 | inputMethods = new InputMethods(taskBar); |
129 | connect(inputMethods, SIGNAL(inputToggled(bool)), | 129 | connect(inputMethods, SIGNAL(inputToggled(bool)), |
130 | this, SLOT(calcMaxWindowRect())); | 130 | this, SLOT(calcMaxWindowRect())); |
131 | 131 | ||
132 | back = new QPushButton(tr("<< Back"), taskBar); | 132 | back = new QPushButton(tr("<< Back"), taskBar); |
133 | back->setFocusPolicy(NoFocus); | 133 | back->setFocusPolicy(NoFocus); |
134 | connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); | 134 | connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); |
135 | 135 | ||
136 | next = new QPushButton(tr("Next >>"), taskBar); | 136 | next = new QPushButton(tr("Next >>"), taskBar); |
137 | next->setFocusPolicy(NoFocus); | 137 | next->setFocusPolicy(NoFocus); |
138 | connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); | 138 | connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); |
139 | 139 | ||
140 | // need to set the geom to lower corner | 140 | // need to set the geom to lower corner |
141 | QSize sz = inputMethods->sizeHint(); | 141 | QSize sz = inputMethods->sizeHint(); |
142 | int buttonWidth = (width() - sz.width()) / 2; | 142 | int buttonWidth = (width() - sz.width()) / 2; |
143 | int x = 0; | 143 | int x = 0; |
144 | 144 | ||
145 | controlHeight = back->sizeHint().height(); | 145 | controlHeight = back->sizeHint().height(); |
146 | 146 | ||
147 | inputMethods->setGeometry(0,0, sz.width(), controlHeight ); | 147 | inputMethods->setGeometry(0,0, sz.width(), controlHeight ); |
148 | x += sz.width(); | 148 | x += sz.width(); |
149 | 149 | ||
150 | back->setGeometry(x, 0, buttonWidth, controlHeight); | 150 | back->setGeometry(x, 0, buttonWidth, controlHeight); |
151 | x += buttonWidth; | 151 | x += buttonWidth; |
152 | next->setGeometry(x, 0, buttonWidth, controlHeight); | 152 | next->setGeometry(x, 0, buttonWidth, controlHeight); |
153 | 153 | ||
154 | taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); | 154 | taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); |
155 | taskBar->hide(); | 155 | taskBar->hide(); |
156 | 156 | ||
157 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 157 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
158 | qDebug("Setting up QCop to QPE/System"); | 158 | qDebug("Setting up QCop to QPE/System"); |
159 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 159 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
160 | connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 160 | connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
161 | this, SLOT(message(const QCString &, const QByteArray &)) ); | 161 | this, SLOT(message(const QCString&,const QByteArray&)) ); |
162 | #endif | 162 | #endif |
163 | calcMaxWindowRect(); | 163 | calcMaxWindowRect(); |
164 | 164 | ||
165 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; | 165 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; |
166 | 166 | ||
167 | if ( m_calHandler) { | 167 | if ( m_calHandler) { |
168 | if ( !QFile::exists("/etc/pointercal") ) { | 168 | if ( !QFile::exists("/etc/pointercal") ) { |
169 | needCalibrate = TRUE; | 169 | needCalibrate = TRUE; |
170 | grabMouse(); | 170 | grabMouse(); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | Config config("locale"); | 174 | Config config("locale"); |
175 | config.setGroup( "Language"); | 175 | config.setGroup( "Language"); |
176 | lang = config.readEntry( "Language", "en"); | 176 | lang = config.readEntry( "Language", "en"); |
177 | 177 | ||
178 | defaultFont = font(); | 178 | defaultFont = font(); |
179 | 179 | ||
180 | //###language/font hack; should look it up somewhere | 180 | //###language/font hack; should look it up somewhere |
181 | #ifdef Q_WS_QWS | 181 | #ifdef Q_WS_QWS |
182 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 182 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
183 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 183 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
184 | qApp->setFont( fn, TRUE ); | 184 | qApp->setFont( fn, TRUE ); |
185 | } | 185 | } |
186 | #endif | 186 | #endif |
187 | } | 187 | } |
188 | 188 | ||
189 | FirstUse::~FirstUse() | 189 | FirstUse::~FirstUse() |
190 | { | 190 | { |
191 | delete appLauncher; | 191 | delete appLauncher; |
192 | delete docList; | 192 | delete docList; |
193 | delete taskBar; | 193 | delete taskBar; |
194 | ServerApplication::allowRestart = TRUE; | 194 | ServerApplication::allowRestart = TRUE; |
195 | } | 195 | } |
196 | 196 | ||
197 | void FirstUse::calcMaxWindowRect() | 197 | void FirstUse::calcMaxWindowRect() |
198 | { | 198 | { |
199 | #ifdef Q_WS_QWS | 199 | #ifdef Q_WS_QWS |
200 | QRect wr; | 200 | QRect wr; |
201 | int displayWidth = qApp->desktop()->width(); | 201 | int displayWidth = qApp->desktop()->width(); |
202 | QRect ir = inputMethods->inputRect(); | 202 | QRect ir = inputMethods->inputRect(); |
203 | if ( ir.isValid() ) { | 203 | if ( ir.isValid() ) { |
204 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | 204 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); |
205 | } else { | 205 | } else { |
206 | wr.setCoords( 0, 0, displayWidth-1, | 206 | wr.setCoords( 0, 0, displayWidth-1, |
207 | qApp->desktop()->height() - controlHeight-1); | 207 | qApp->desktop()->height() - controlHeight-1); |
208 | } | 208 | } |
209 | 209 | ||
210 | #if QT_VERSION < 0x030000 | 210 | #if QT_VERSION < 0x030000 |
211 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, | 211 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, |
212 | QSize(qt_screen->width(),qt_screen->height())) | 212 | QSize(qt_screen->width(),qt_screen->height())) |
213 | ); | 213 | ); |
214 | #else | 214 | #else |
215 | QWSServer::setMaxWindowRect( wr ); | 215 | QWSServer::setMaxWindowRect( wr ); |
216 | #endif | 216 | #endif |
217 | #endif | 217 | #endif |
218 | } | 218 | } |
219 | 219 | ||
220 | /* cancel current dialog, and bring up next */ | 220 | /* cancel current dialog, and bring up next */ |
221 | void FirstUse::nextDialog() | 221 | void FirstUse::nextDialog() |
222 | { | 222 | { |
223 | int prevApp = currApp; | 223 | int prevApp = currApp; |
224 | do { | 224 | do { |
225 | currApp++; | 225 | currApp++; |
226 | qDebug( "currApp = %d", currApp ); | 226 | qDebug( "currApp = %d", currApp ); |
227 | if ( settingsTable[currApp].app == 0 ) { | 227 | if ( settingsTable[currApp].app == 0 ) { |
228 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 228 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
229 | // The last application is still running. | 229 | // The last application is still running. |
230 | // Tell it to stop, and when its done we'll come back | 230 | // Tell it to stop, and when its done we'll come back |
231 | // to nextDialog and exit. | 231 | // to nextDialog and exit. |
232 | qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); | 232 | qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); |
233 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 233 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
234 | settingsTable[prevApp].stop ); | 234 | settingsTable[prevApp].stop ); |
235 | currApp = prevApp; | 235 | currApp = prevApp; |
236 | } else { | 236 | } else { |
237 | qDebug( "Done!" ); | 237 | qDebug( "Done!" ); |
238 | Config config( "qpe" ); | 238 | Config config( "qpe" ); |
239 | config.setGroup( "Startup" ); | 239 | config.setGroup( "Startup" ); |
240 | config.writeEntry( "FirstUse", FALSE ); | 240 | config.writeEntry( "FirstUse", FALSE ); |
241 | QPixmap pix = Resource::loadPixmap("bigwait"); | 241 | QPixmap pix = Resource::loadPixmap("bigwait"); |
242 | QLabel *lblWait = new QLabel(0, "wait hack!", // No tr | 242 | QLabel *lblWait = new QLabel(0, "wait hack!", // No tr |
243 | QWidget::WStyle_Customize | QWidget::WDestructiveClose | | 243 | QWidget::WStyle_Customize | QWidget::WDestructiveClose | |
244 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | | 244 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | |
245 | QWidget::WStyle_StaysOnTop); | 245 | QWidget::WStyle_StaysOnTop); |
246 | lblWait->setPixmap( pix ); | 246 | lblWait->setPixmap( pix ); |
247 | lblWait->setAlignment( QWidget::AlignCenter ); | 247 | lblWait->setAlignment( QWidget::AlignCenter ); |
248 | lblWait->setGeometry( qApp->desktop()->geometry() ); | 248 | lblWait->setGeometry( qApp->desktop()->geometry() ); |
249 | lblWait->show(); | 249 | lblWait->show(); |
250 | qApp->processEvents(); | 250 | qApp->processEvents(); |
251 | QTimer::singleShot( 1000, lblWait, SLOT(close()) ); | 251 | QTimer::singleShot( 1000, lblWait, SLOT(close()) ); |
252 | repaint(); | 252 | repaint(); |
253 | close(); | 253 | close(); |
254 | ServerApplication::allowRestart = TRUE; | 254 | ServerApplication::allowRestart = TRUE; |
255 | } | 255 | } |
256 | return; | 256 | return; |
257 | } | 257 | } |
258 | } while ( !settingsTable[currApp].enabled ); | 258 | } while ( !settingsTable[currApp].enabled ); |
259 | 259 | ||
260 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 260 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
261 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); | 261 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); |
262 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 262 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
263 | settingsTable[prevApp].stop ); | 263 | settingsTable[prevApp].stop ); |
264 | waitForExit = prevApp; | 264 | waitForExit = prevApp; |
265 | } else { | 265 | } else { |
266 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 266 | qDebug( "Startup: %s", settingsTable[currApp].app ); |
267 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 267 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
268 | settingsTable[currApp].start ); | 268 | settingsTable[currApp].start ); |
269 | waitingForLaunch = TRUE; | 269 | waitingForLaunch = TRUE; |
270 | } | 270 | } |
271 | 271 | ||
272 | updateButtons(); | 272 | updateButtons(); |
273 | } | 273 | } |
274 | 274 | ||
275 | /* accept current dialog and bring up previous */ | 275 | /* accept current dialog and bring up previous */ |
276 | void FirstUse::previousDialog() | 276 | void FirstUse::previousDialog() |
277 | { | 277 | { |
278 | int prevApp = currApp; | 278 | int prevApp = currApp; |
279 | do { | 279 | do { |
280 | currApp--; | 280 | currApp--; |
281 | if ( currApp < 0 ) { | 281 | if ( currApp < 0 ) { |
282 | currApp = prevApp; | 282 | currApp = prevApp; |
283 | return; | 283 | return; |
284 | } | 284 | } |
285 | } while ( !settingsTable[currApp].enabled ); | 285 | } while ( !settingsTable[currApp].enabled ); |
286 | 286 | ||
287 | if ( prevApp >= 0 ) { | 287 | if ( prevApp >= 0 ) { |
288 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); | 288 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); |
289 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 289 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
290 | settingsTable[prevApp].stop ); | 290 | settingsTable[prevApp].stop ); |
291 | /* | 291 | /* |
292 | if (settingsTable[prevApp].app == QString("systemtime")) | 292 | if (settingsTable[prevApp].app == QString("systemtime")) |
293 | QCopEnvelope e("QPE/Application/citytime", "close()"); | 293 | QCopEnvelope e("QPE/Application/citytime", "close()"); |
294 | */ | 294 | */ |
295 | waitForExit = prevApp; | 295 | waitForExit = prevApp; |
296 | } else { | 296 | } else { |
297 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 297 | qDebug( "Startup: %s", settingsTable[currApp].app ); |
298 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 298 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
299 | settingsTable[currApp].start ); | 299 | settingsTable[currApp].start ); |
300 | waitingForLaunch = TRUE; | 300 | waitingForLaunch = TRUE; |
301 | } | 301 | } |
302 | 302 | ||
303 | updateButtons(); | 303 | updateButtons(); |
304 | } | 304 | } |
305 | 305 | ||
306 | void FirstUse::message(const QCString &msg, const QByteArray &data) | 306 | void FirstUse::message(const QCString &msg, const QByteArray &data) |
307 | { | 307 | { |
308 | QDataStream stream( data, IO_ReadOnly ); | 308 | QDataStream stream( data, IO_ReadOnly ); |
309 | if ( msg == "timeChange(QString)" ) { | 309 | if ( msg == "timeChange(QString)" ) { |
310 | QString t; | 310 | QString t; |
311 | stream >> t; | 311 | stream >> t; |
312 | if ( t.isNull() ) | 312 | if ( t.isNull() ) |
313 | unsetenv("TZ"); | 313 | unsetenv("TZ"); |
314 | else | 314 | else |
315 | setenv( "TZ", t.latin1(), 1 ); | 315 | setenv( "TZ", t.latin1(), 1 ); |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | void FirstUse::terminated( int, const QString &app ) | 319 | void FirstUse::terminated( int, const QString &app ) |
320 | { | 320 | { |
321 | qDebug( "--- terminated: %s", app.latin1() ); | 321 | qDebug( "--- terminated: %s", app.latin1() ); |
322 | if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { | 322 | if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { |
323 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 323 | qDebug( "Startup: %s", settingsTable[currApp].app ); |
324 | if ( settingsTable[waitForExit].app == "language" ) { // No tr | 324 | if ( settingsTable[waitForExit].app == "language" ) { // No tr |
325 | Config config("locale"); | 325 | Config config("locale"); |
326 | config.setGroup( "Language"); | 326 | config.setGroup( "Language"); |
327 | QString l = config.readEntry( "Language", "en"); | 327 | QString l = config.readEntry( "Language", "en"); |
328 | if ( l != lang ) { | 328 | if ( l != lang ) { |
329 | reloadLanguages(); | 329 | reloadLanguages(); |
330 | needRestart = TRUE; | 330 | needRestart = TRUE; |
331 | lang = l; | 331 | lang = l; |
332 | } | 332 | } |
333 | } | 333 | } |
334 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 334 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
335 | settingsTable[currApp].start ); | 335 | settingsTable[currApp].start ); |
336 | waitingForLaunch = TRUE; | 336 | waitingForLaunch = TRUE; |
337 | updateButtons(); | 337 | updateButtons(); |
338 | repaint(); | 338 | repaint(); |
339 | waitForExit = -1; | 339 | waitForExit = -1; |
340 | } else if ( settingsTable[currApp].app == app ) { | 340 | } else if ( settingsTable[currApp].app == app ) { |
341 | nextDialog(); | 341 | nextDialog(); |
342 | } else { | 342 | } else { |
343 | back->setEnabled(TRUE); | 343 | back->setEnabled(TRUE); |
344 | next->setEnabled(TRUE); | 344 | next->setEnabled(TRUE); |
345 | } | 345 | } |
346 | } | 346 | } |
347 | 347 | ||
348 | void FirstUse::newQcopChannel(const QString& channelName) | 348 | void FirstUse::newQcopChannel(const QString& channelName) |
349 | { | 349 | { |
350 | qDebug("channel %s added", channelName.data() ); | 350 | qDebug("channel %s added", channelName.data() ); |
351 | QString prefix("QPE/Application/"); | 351 | QString prefix("QPE/Application/"); |
352 | if (channelName.startsWith(prefix)) { | 352 | if (channelName.startsWith(prefix)) { |
353 | QString appName = channelName.mid(prefix.length()); | 353 | QString appName = channelName.mid(prefix.length()); |