summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/firstuse.cpp6
-rw-r--r--pics/launcher/firstuse.jpgbin0 -> 12739 bytes
2 files changed, 2 insertions, 4 deletions
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp
index e9e2d83..acddeea 100644
--- a/core/launcher/firstuse.cpp
+++ b/core/launcher/firstuse.cpp
@@ -69,447 +69,445 @@ struct {
69 const char *desc; 69 const char *desc;
70} 70}
71settingsTable [] = 71settingsTable [] =
72{ 72{
73 { FALSE, "language", "raise()", "accept()", // No tr 73 { FALSE, "language", "raise()", "accept()", // No tr
74 QT_TR_NOOP("Language") }, 74 QT_TR_NOOP("Language") },
75 { FALSE, "doctab", "raise()", "accept()", // No tr 75 { FALSE, "doctab", "raise()", "accept()", // No tr
76 QT_TR_NOOP("DocTab") }, 76 QT_TR_NOOP("DocTab") },
77#ifndef Q_OS_WIN32 77#ifndef Q_OS_WIN32
78 { FALSE, "systemtime", "raise()", "accept()", // No tr 78 { FALSE, "systemtime", "raise()", "accept()", // No tr
79 QT_TR_NOOP("Time and Date") }, 79 QT_TR_NOOP("Time and Date") },
80#endif 80#endif
81 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr 81 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr
82 QT_TR_NOOP("Personal Information") }, 82 QT_TR_NOOP("Personal Information") },
83 { FALSE, 0, 0, 0, 0 } 83 { FALSE, 0, 0, 0, 0 }
84}; 84};
85 85
86 86
87FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : 87FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) :
88 QDialog( parent, name, TRUE, wf), 88 QDialog( parent, name, TRUE, wf),
89 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), 89 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1),
90 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) 90 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE)
91{ 91{
92 ServerApplication::allowRestart = FALSE; 92 ServerApplication::allowRestart = FALSE;
93 // we force our height beyound the maximum (which we set anyway) 93 // we force our height beyound the maximum (which we set anyway)
94 QRect desk = qApp->desktop()->geometry(); 94 QRect desk = qApp->desktop()->geometry();
95 setGeometry( 0, 0, desk.width(), desk.height() ); 95 setGeometry( 0, 0, desk.width(), desk.height() );
96 96
97 connect(qwsServer, SIGNAL(newChannel(const QString&)), 97 connect(qwsServer, SIGNAL(newChannel(const QString&)),
98 this, SLOT(newQcopChannel(const QString&))); 98 this, SLOT(newQcopChannel(const QString&)));
99 99
100 // Create a DocumentList so appLauncher has appLnkSet to search 100 // Create a DocumentList so appLauncher has appLnkSet to search
101 docList = new DocumentList( 0, FALSE ); 101 docList = new DocumentList( 0, FALSE );
102 appLauncher = new AppLauncher( this ); 102 appLauncher = new AppLauncher( this );
103 connect( appLauncher, SIGNAL(terminated(int,const QString&)), 103 connect( appLauncher, SIGNAL(terminated(int,const QString&)),
104 this, SLOT(terminated(int,const QString&)) ); 104 this, SLOT(terminated(int,const QString&)) );
105 105
106 // more hackery 106 // more hackery
107 // I will be run as either the main server or as part of the main server 107 // I will be run as either the main server or as part of the main server
108 QWSServer::setScreenSaverIntervals(0); 108 QWSServer::setScreenSaverIntervals(0);
109 loadPixmaps(); 109 loadPixmaps();
110 110
111 //check if there is a language program 111 //check if there is a language program
112#ifndef Q_OS_WIN32 112#ifndef Q_OS_WIN32
113 QString exeSuffix; 113 QString exeSuffix;
114#else 114#else
115 QString exeSuffix(".exe"); 115 QString exeSuffix(".exe");
116#endif 116#endif
117 117
118 for ( int i = 0; settingsTable[i].app; i++ ) { 118 for ( int i = 0; settingsTable[i].app; i++ ) {
119 QString file = QPEApplication::qpeDir() + "bin/"; 119 QString file = QPEApplication::qpeDir() + "bin/";
120 file += settingsTable[i].app; 120 file += settingsTable[i].app;
121 file += exeSuffix; 121 file += exeSuffix;
122 if ( QFile::exists(file) ) 122 if ( QFile::exists(file) )
123 settingsTable[i].enabled = TRUE; 123 settingsTable[i].enabled = TRUE;
124 } 124 }
125 125
126 setFocusPolicy(NoFocus); 126 setFocusPolicy(NoFocus);
127 127
128 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); 128 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader);
129 129
130 inputMethods = new InputMethods(taskBar); 130 inputMethods = new InputMethods(taskBar);
131 connect(inputMethods, SIGNAL(inputToggled(bool)), 131 connect(inputMethods, SIGNAL(inputToggled(bool)),
132 this, SLOT(calcMaxWindowRect())); 132 this, SLOT(calcMaxWindowRect()));
133 133
134 back = new QPushButton(tr("<< Back"), taskBar); 134 back = new QPushButton(tr("<< Back"), taskBar);
135 back->setFocusPolicy(NoFocus); 135 back->setFocusPolicy(NoFocus);
136 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); 136 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) );
137 137
138 next = new QPushButton(tr("Next >>"), taskBar); 138 next = new QPushButton(tr("Next >>"), taskBar);
139 next->setFocusPolicy(NoFocus); 139 next->setFocusPolicy(NoFocus);
140 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); 140 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) );
141 141
142 // need to set the geom to lower corner 142 // need to set the geom to lower corner
143 QSize sz = inputMethods->sizeHint(); 143 QSize sz = inputMethods->sizeHint();
144 int buttonWidth = (width() - sz.width()) / 2; 144 int buttonWidth = (width() - sz.width()) / 2;
145 int x = 0; 145 int x = 0;
146 146
147 controlHeight = back->sizeHint().height(); 147 controlHeight = back->sizeHint().height();
148 148
149 inputMethods->setGeometry(0,0, sz.width(), controlHeight ); 149 inputMethods->setGeometry(0,0, sz.width(), controlHeight );
150 x += sz.width(); 150 x += sz.width();
151 151
152 back->setGeometry(x, 0, buttonWidth, controlHeight); 152 back->setGeometry(x, 0, buttonWidth, controlHeight);
153 x += buttonWidth; 153 x += buttonWidth;
154 next->setGeometry(x, 0, buttonWidth, controlHeight); 154 next->setGeometry(x, 0, buttonWidth, controlHeight);
155 155
156 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); 156 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight);
157 taskBar->hide(); 157 taskBar->hide();
158 158
159#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 159#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
160 odebug << "Setting up QCop to QPE/System" << oendl; 160 odebug << "Setting up QCop to QPE/System" << oendl;
161 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 161 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
162 connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), 162 connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
163 this, SLOT(message(const QCString&,const QByteArray&)) ); 163 this, SLOT(message(const QCString&,const QByteArray&)) );
164#endif 164#endif
165 calcMaxWindowRect(); 165 calcMaxWindowRect();
166 166
167 m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; 167 m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false;
168 168
169 if ( m_calHandler) { 169 if ( m_calHandler) {
170 if ( !QFile::exists("/etc/pointercal") ) { 170 if ( !QFile::exists("/etc/pointercal") ) {
171 needCalibrate = TRUE; 171 needCalibrate = TRUE;
172 grabMouse(); 172 grabMouse();
173 } 173 }
174 } 174 }
175 175
176 Config config("locale"); 176 Config config("locale");
177 config.setGroup( "Language"); 177 config.setGroup( "Language");
178 lang = config.readEntry( "Language", "en"); 178 lang = config.readEntry( "Language", "en");
179 179
180 defaultFont = font(); 180 defaultFont = font();
181 181
182 //###language/font hack; should look it up somewhere 182 //###language/font hack; should look it up somewhere
183#ifdef Q_WS_QWS 183#ifdef Q_WS_QWS
184 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 184 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
185 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 185 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
186 qApp->setFont( fn, TRUE ); 186 qApp->setFont( fn, TRUE );
187 } 187 }
188#endif 188#endif
189} 189}
190 190
191FirstUse::~FirstUse() 191FirstUse::~FirstUse()
192{ 192{
193 delete appLauncher; 193 delete appLauncher;
194 delete docList; 194 delete docList;
195 delete taskBar; 195 delete taskBar;
196 ServerApplication::allowRestart = TRUE; 196 ServerApplication::allowRestart = TRUE;
197} 197}
198 198
199void FirstUse::calcMaxWindowRect() 199void FirstUse::calcMaxWindowRect()
200{ 200{
201#ifdef Q_WS_QWS 201#ifdef Q_WS_QWS
202 QRect wr; 202 QRect wr;
203 int displayWidth = qApp->desktop()->width(); 203 int displayWidth = qApp->desktop()->width();
204 QRect ir = inputMethods->inputRect(); 204 QRect ir = inputMethods->inputRect();
205 if ( ir.isValid() ) { 205 if ( ir.isValid() ) {
206 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 206 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
207 } else { 207 } else {
208 wr.setCoords( 0, 0, displayWidth-1, 208 wr.setCoords( 0, 0, displayWidth-1,
209 qApp->desktop()->height() - controlHeight-1); 209 qApp->desktop()->height() - controlHeight-1);
210 } 210 }
211 211
212#if QT_VERSION < 0x030000 212#if QT_VERSION < 0x030000
213 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 213 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
214 QSize(qt_screen->width(),qt_screen->height())) 214 QSize(qt_screen->width(),qt_screen->height()))
215 ); 215 );
216#else 216#else
217 QWSServer::setMaxWindowRect( wr ); 217 QWSServer::setMaxWindowRect( wr );
218#endif 218#endif
219#endif 219#endif
220} 220}
221 221
222/* cancel current dialog, and bring up next */ 222/* cancel current dialog, and bring up next */
223void FirstUse::nextDialog() 223void FirstUse::nextDialog()
224{ 224{
225 int prevApp = currApp; 225 int prevApp = currApp;
226 do { 226 do {
227 currApp++; 227 currApp++;
228 odebug << "currApp = " << currApp << "" << oendl; 228 odebug << "currApp = " << currApp << "" << oendl;
229 if ( settingsTable[currApp].app == 0 ) { 229 if ( settingsTable[currApp].app == 0 ) {
230 if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { 230 if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) {
231 // The last application is still running. 231 // The last application is still running.
232 // Tell it to stop, and when its done we'll come back 232 // Tell it to stop, and when its done we'll come back
233 // to nextDialog and exit. 233 // to nextDialog and exit.
234 odebug << "Waiting for " << settingsTable[prevApp].app << " to exit" << oendl; 234 odebug << "Waiting for " << settingsTable[prevApp].app << " to exit" << oendl;
235 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, 235 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
236 settingsTable[prevApp].stop ); 236 settingsTable[prevApp].stop );
237 currApp = prevApp; 237 currApp = prevApp;
238 } else { 238 } else {
239 odebug << "Done!" << oendl; 239 odebug << "Done!" << oendl;
240 Config config( "qpe" ); 240 Config config( "qpe" );
241 config.setGroup( "Startup" ); 241 config.setGroup( "Startup" );
242 config.writeEntry( "FirstUse", FALSE ); 242 config.writeEntry( "FirstUse", FALSE );
243 QPixmap pix = Resource::loadPixmap("bigwait"); 243 QPixmap pix = Resource::loadPixmap("bigwait");
244 QLabel *lblWait = new QLabel(0, "wait hack!", // No tr 244 QLabel *lblWait = new QLabel(0, "wait hack!", // No tr
245 QWidget::WStyle_Customize | QWidget::WDestructiveClose | 245 QWidget::WStyle_Customize | QWidget::WDestructiveClose |
246 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | 246 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool |
247 QWidget::WStyle_StaysOnTop); 247 QWidget::WStyle_StaysOnTop);
248 lblWait->setPixmap( pix ); 248 lblWait->setPixmap( pix );
249 lblWait->setAlignment( QWidget::AlignCenter ); 249 lblWait->setAlignment( QWidget::AlignCenter );
250 lblWait->setGeometry( qApp->desktop()->geometry() ); 250 lblWait->setGeometry( qApp->desktop()->geometry() );
251 lblWait->show(); 251 lblWait->show();
252 qApp->processEvents(); 252 qApp->processEvents();
253 QTimer::singleShot( 1000, lblWait, SLOT(close()) ); 253 QTimer::singleShot( 1000, lblWait, SLOT(close()) );
254 repaint(); 254 repaint();
255 close(); 255 close();
256 ServerApplication::allowRestart = TRUE; 256 ServerApplication::allowRestart = TRUE;
257 } 257 }
258 return; 258 return;
259 } 259 }
260 } while ( !settingsTable[currApp].enabled ); 260 } while ( !settingsTable[currApp].enabled );
261 261
262 if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { 262 if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) {
263 odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; 263 odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl;
264 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, 264 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
265 settingsTable[prevApp].stop ); 265 settingsTable[prevApp].stop );
266 waitForExit = prevApp; 266 waitForExit = prevApp;
267 } else { 267 } else {
268 odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; 268 odebug << "Startup: " << settingsTable[currApp].app << "" << oendl;
269 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, 269 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
270 settingsTable[currApp].start ); 270 settingsTable[currApp].start );
271 waitingForLaunch = TRUE; 271 waitingForLaunch = TRUE;
272 } 272 }
273 273
274 updateButtons(); 274 updateButtons();
275} 275}
276 276
277/* accept current dialog and bring up previous */ 277/* accept current dialog and bring up previous */
278void FirstUse::previousDialog() 278void FirstUse::previousDialog()
279{ 279{
280 int prevApp = currApp; 280 int prevApp = currApp;
281 do { 281 do {
282 currApp--; 282 currApp--;
283 if ( currApp < 0 ) { 283 if ( currApp < 0 ) {
284 currApp = prevApp; 284 currApp = prevApp;
285 return; 285 return;
286 } 286 }
287 } while ( !settingsTable[currApp].enabled ); 287 } while ( !settingsTable[currApp].enabled );
288 288
289 if ( prevApp >= 0 ) { 289 if ( prevApp >= 0 ) {
290 odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; 290 odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl;
291 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, 291 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
292 settingsTable[prevApp].stop ); 292 settingsTable[prevApp].stop );
293/* 293/*
294 if (settingsTable[prevApp].app == QString("systemtime")) 294 if (settingsTable[prevApp].app == QString("systemtime"))
295 QCopEnvelope e("QPE/Application/citytime", "close()"); 295 QCopEnvelope e("QPE/Application/citytime", "close()");
296*/ 296*/
297 waitForExit = prevApp; 297 waitForExit = prevApp;
298 } else { 298 } else {
299 odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; 299 odebug << "Startup: " << settingsTable[currApp].app << "" << oendl;
300 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, 300 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
301 settingsTable[currApp].start ); 301 settingsTable[currApp].start );
302 waitingForLaunch = TRUE; 302 waitingForLaunch = TRUE;
303 } 303 }
304 304
305 updateButtons(); 305 updateButtons();
306} 306}
307 307
308void FirstUse::message(const QCString &msg, const QByteArray &data) 308void FirstUse::message(const QCString &msg, const QByteArray &data)
309{ 309{
310 QDataStream stream( data, IO_ReadOnly ); 310 QDataStream stream( data, IO_ReadOnly );
311 if ( msg == "timeChange(QString)" ) { 311 if ( msg == "timeChange(QString)" ) {
312 QString t; 312 QString t;
313 stream >> t; 313 stream >> t;
314 if ( t.isNull() ) 314 if ( t.isNull() )
315 unsetenv("TZ"); 315 unsetenv("TZ");
316 else 316 else
317 setenv( "TZ", t.latin1(), 1 ); 317 setenv( "TZ", t.latin1(), 1 );
318 } 318 }
319} 319}
320 320
321void FirstUse::terminated( int, const QString &app ) 321void FirstUse::terminated( int, const QString &app )
322{ 322{
323 odebug << "--- terminated: " << app << "" << oendl; 323 odebug << "--- terminated: " << app << "" << oendl;
324 if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { 324 if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) {
325 odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; 325 odebug << "Startup: " << settingsTable[currApp].app << "" << oendl;
326 if ( settingsTable[waitForExit].app == "language" ) { // No tr 326 if ( settingsTable[waitForExit].app == "language" ) { // No tr
327 Config config("locale"); 327 Config config("locale");
328 config.setGroup( "Language"); 328 config.setGroup( "Language");
329 QString l = config.readEntry( "Language", "en"); 329 QString l = config.readEntry( "Language", "en");
330 if ( l != lang ) { 330 if ( l != lang ) {
331 reloadLanguages(); 331 reloadLanguages();
332 needRestart = TRUE; 332 needRestart = TRUE;
333 lang = l; 333 lang = l;
334 } 334 }
335 } 335 }
336 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, 336 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
337 settingsTable[currApp].start ); 337 settingsTable[currApp].start );
338 waitingForLaunch = TRUE; 338 waitingForLaunch = TRUE;
339 updateButtons(); 339 updateButtons();
340 repaint(); 340 repaint();
341 waitForExit = -1; 341 waitForExit = -1;
342 } else if ( settingsTable[currApp].app == app ) { 342 } else if ( settingsTable[currApp].app == app ) {
343 nextDialog(); 343 nextDialog();
344 } else { 344 } else {
345 back->setEnabled(TRUE); 345 back->setEnabled(TRUE);
346 next->setEnabled(TRUE); 346 next->setEnabled(TRUE);
347 } 347 }
348} 348}
349 349
350void FirstUse::newQcopChannel(const QString& channelName) 350void FirstUse::newQcopChannel(const QString& channelName)
351{ 351{
352 odebug << "channel " << channelName.data() << " added" << oendl; 352 odebug << "channel " << channelName.data() << " added" << oendl;
353 QString prefix("QPE/Application/"); 353 QString prefix("QPE/Application/");
354 if (channelName.startsWith(prefix)) { 354 if (channelName.startsWith(prefix)) {
355 QString appName = channelName.mid(prefix.length()); 355 QString appName = channelName.mid(prefix.length());
356 if ( currApp >= 0 && appName == settingsTable[currApp].app ) { 356 if ( currApp >= 0 && appName == settingsTable[currApp].app ) {
357 odebug << "Application: " << settingsTable[currApp].app << " started" << oendl; 357 odebug << "Application: " << settingsTable[currApp].app << " started" << oendl;
358 waitingForLaunch = FALSE; 358 waitingForLaunch = FALSE;
359 updateButtons(); 359 updateButtons();
360 repaint(); 360 repaint();
361 } else if (appName != "quicklauncher") { 361 } else if (appName != "quicklauncher") {
362 back->setEnabled(FALSE); 362 back->setEnabled(FALSE);
363 next->setEnabled(FALSE); 363 next->setEnabled(FALSE);
364 } 364 }
365 } 365 }
366} 366}
367 367
368void FirstUse::reloadLanguages() 368void FirstUse::reloadLanguages()
369{ 369{
370 // read language from config file. Waiting on QCop takes too long. 370 // read language from config file. Waiting on QCop takes too long.
371 Config config("locale"); 371 Config config("locale");
372 config.setGroup( "Language"); 372 config.setGroup( "Language");
373 QString l = config.readEntry( "Language", "en"); 373 QString l = config.readEntry( "Language", "en");
374 QString cl = getenv("LANG"); 374 QString cl = getenv("LANG");
375 owarn << "language message - " + l << oendl; 375 owarn << "language message - " + l << oendl;
376 // setting anyway... 376 // setting anyway...
377 if (l.isNull() ) 377 if (l.isNull() )
378 unsetenv( "LANG" ); 378 unsetenv( "LANG" );
379 else { 379 else {
380 owarn << "and its not null" << oendl; 380 owarn << "and its not null" << oendl;
381 setenv( "LANG", l.latin1(), 1 ); 381 setenv( "LANG", l.latin1(), 1 );
382 } 382 }
383#ifndef QT_NO_TRANSLATION 383#ifndef QT_NO_TRANSLATION
384 // clear old translators 384 // clear old translators
385#ifndef _MSC_VER 385#ifndef _MSC_VER
386 //### revise to allow removal of translators under MSVC 386 //### revise to allow removal of translators under MSVC
387 if(qApp->translators) { 387 if(qApp->translators) {
388 qApp->translators->setAutoDelete(TRUE); 388 qApp->translators->setAutoDelete(TRUE);
389 delete (qApp->translators); 389 delete (qApp->translators);
390 qApp->translators = 0; 390 qApp->translators = 0;
391 } 391 }
392#endif 392#endif
393 393
394 // load translation tables 394 // load translation tables
395 transApp = new QTranslator(qApp); 395 transApp = new QTranslator(qApp);
396 QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm"; 396 QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm";
397 owarn << "loading " + tfn << oendl; 397 owarn << "loading " + tfn << oendl;
398 if ( transApp->load(tfn) ) { 398 if ( transApp->load(tfn) ) {
399 owarn << "installing translator" << oendl; 399 owarn << "installing translator" << oendl;
400 qApp->installTranslator( transApp ); 400 qApp->installTranslator( transApp );
401 } else { 401 } else {
402 delete transApp; 402 delete transApp;
403 transApp = 0; 403 transApp = 0;
404 } 404 }
405 405
406 transLib = new QTranslator(qApp); 406 transLib = new QTranslator(qApp);
407 tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; 407 tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm";
408 owarn << "loading " + tfn << oendl; 408 owarn << "loading " + tfn << oendl;
409 if ( transLib->load(tfn) ) { 409 if ( transLib->load(tfn) ) {
410 owarn << "installing translator library" << oendl; 410 owarn << "installing translator library" << oendl;
411 qApp->installTranslator( transLib ); 411 qApp->installTranslator( transLib );
412 } else { 412 } else {
413 delete transLib; 413 delete transLib;
414 transLib = 0; 414 transLib = 0;
415 } 415 }
416 loadPixmaps(); 416 loadPixmaps();
417 //###language/font hack; should look it up somewhere 417 //###language/font hack; should look it up somewhere
418#ifdef Q_WS_QWS 418#ifdef Q_WS_QWS
419 if ( l == "ja" || l == "zh_CN" || l == "zh_TW" || l == "ko" ) { 419 if ( l == "ja" || l == "zh_CN" || l == "zh_TW" || l == "ko" ) {
420 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 420 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
421 qApp->setFont( fn, TRUE ); 421 qApp->setFont( fn, TRUE );
422 } else { 422 } else {
423 qApp->setFont( defaultFont, TRUE ); 423 qApp->setFont( defaultFont, TRUE );
424 } 424 }
425#endif 425#endif
426#endif 426#endif
427} 427}
428 428
429void FirstUse::paintEvent( QPaintEvent * ) 429void FirstUse::paintEvent( QPaintEvent * )
430{ 430{
431 QPainter p( this ); 431 QPainter p( this );
432 432
433 p.drawPixmap(0,0, splash); 433 p.drawPixmap(0,0, splash);
434 434
435 QFont f = p.font(); 435 QFont f = p.font();
436 f.setPointSize(15); 436 f.setPointSize(15);
437 f.setItalic(FALSE); 437 f.setItalic(FALSE);
438 f.setBold(FALSE); 438 f.setBold(FALSE);
439 p.setFont(f); 439 p.setFont(f);
440 440
441 if ( currApp < 0 ) { 441 if ( currApp < 0 ) {
442 drawText(p, tr( "Tap anywhere on the screen to continue." )); 442 drawText(p, tr( "Tap anywhere on the screen to continue." ));
443 } else if ( settingsTable[currApp].app ) { 443 } else if ( settingsTable[currApp].app ) {
444 if ( waitingForLaunch ) 444 if ( waitingForLaunch )
445 drawText(p, tr("Please wait, loading %1 settings.").arg(tr(settingsTable[currApp].desc)) ); 445 drawText(p, tr("Please wait, loading %1 settings.").arg(tr(settingsTable[currApp].desc)) );
446 } else { 446 } else {
447 drawText(p, tr("Please wait...")); 447 drawText(p, tr("Please wait..."));
448 } 448 }
449} 449}
450 450
451void FirstUse::loadPixmaps() 451void FirstUse::loadPixmaps()
452{ 452{
453 /* create background, tr so can change image with language. 453 splash.convertFromImage( Resource::loadImage("launcher/firstuse")
454 images will likely contain text. */ 454 .smoothScale( width(), height() ) );
455 splash.convertFromImage( Resource::loadImage(tr("FirstUseBackground"))
456 .smoothScale( width(), height() ) );
457 455
458 setBackgroundPixmap(splash); 456 setBackgroundPixmap(splash);
459} 457}
460 458
461void FirstUse::drawText(QPainter &p, const QString &text) 459void FirstUse::drawText(QPainter &p, const QString &text)
462{ 460{
463 QString altered = "<CENTER>" + text + "</CENTER>"; 461 QString altered = "<CENTER>" + text + "</CENTER>";
464 462
465 QSimpleRichText rt(altered, p.font()); 463 QSimpleRichText rt(altered, p.font());
466 rt.setWidth(width() - 20); 464 rt.setWidth(width() - 20);
467 465
468 int h = (height() * 3) / 10; // start at 30% 466 int h = (height() * 3) / 10; // start at 30%
469 if (rt.height() < height() / 2) 467 if (rt.height() < height() / 2)
470 h += ((height() / 2) - rt.height()) / 2; 468 h += ((height() / 2) - rt.height()) / 2;
471 rt.draw(&p, 10, h, QRegion(0,0, width()-20, height()), palette()); 469 rt.draw(&p, 10, h, QRegion(0,0, width()-20, height()), palette());
472} 470}
473 471
474void FirstUse::updateButtons() 472void FirstUse::updateButtons()
475{ 473{
476 if ( currApp >= 0 ) { 474 if ( currApp >= 0 ) {
477 taskBar->show(); 475 taskBar->show();
478 } 476 }
479 477
480 int i = currApp-1; 478 int i = currApp-1;
481 while ( i >= 0 && !settingsTable[i].enabled ) 479 while ( i >= 0 && !settingsTable[i].enabled )
482 i--; 480 i--;
483 back->setText(tr("<< Back")); 481 back->setText(tr("<< Back"));
484 back->setEnabled( i >= 0 && !waitingForLaunch ); 482 back->setEnabled( i >= 0 && !waitingForLaunch );
485 483
486 i = currApp+1; 484 i = currApp+1;
487 while ( settingsTable[i].app && !settingsTable[i].enabled ) 485 while ( settingsTable[i].app && !settingsTable[i].enabled )
488 i++; 486 i++;
489 if ( !settingsTable[i].app ) 487 if ( !settingsTable[i].app )
490 next->setText(tr("Finish")); 488 next->setText(tr("Finish"));
491 else 489 else
492 next->setText(tr("Next >>")); 490 next->setText(tr("Next >>"));
493 491
494 next->setEnabled( !waitingForLaunch ); 492 next->setEnabled( !waitingForLaunch );
495} 493}
496 494
497void FirstUse::keyPressEvent( QKeyEvent *e ) 495void FirstUse::keyPressEvent( QKeyEvent *e )
498{ 496{
499 // Allow cancelling at first dialog, in case display is broken. 497 // Allow cancelling at first dialog, in case display is broken.
500 if ( e->key() == Key_Escape && currApp < 0 ) 498 if ( e->key() == Key_Escape && currApp < 0 )
501 QDialog::keyPressEvent(e); 499 QDialog::keyPressEvent(e);
502} 500}
503 501
504void FirstUse::mouseReleaseEvent( QMouseEvent * ) 502void FirstUse::mouseReleaseEvent( QMouseEvent * )
505{ 503{
506 if ( currApp < 0 ) { 504 if ( currApp < 0 ) {
507 if ( m_calHandler && needCalibrate ) { 505 if ( m_calHandler && needCalibrate ) {
508 releaseMouse(); 506 releaseMouse();
509 Calibrate *cal = new Calibrate; 507 Calibrate *cal = new Calibrate;
510 cal->exec(); 508 cal->exec();
511 delete cal; 509 delete cal;
512 } 510 }
513 nextDialog(); 511 nextDialog();
514 } 512 }
515} 513}
diff --git a/pics/launcher/firstuse.jpg b/pics/launcher/firstuse.jpg
new file mode 100644
index 0000000..92fb044
--- a/dev/null
+++ b/pics/launcher/firstuse.jpg
Binary files differ