-rw-r--r-- | core/launcher/firstuse.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 2dc6a72..3f769ae 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp | |||
@@ -27,15 +27,14 @@ | |||
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 | #if defined(QPE_NEED_CALIBRATION) | 33 | |
34 | #include "calibrate.h" | 34 | #include "calibrate.h" |
35 | #endif | ||
36 | #include "documentlist.h" | 35 | #include "documentlist.h" |
37 | 36 | ||
38 | #include <qtopia/resource.h> | 37 | #include <qtopia/resource.h> |
39 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
40 | #include <qtopia/qpeapplication.h> | 39 | #include <qtopia/qpeapplication.h> |
41 | #include <qtopia/config.h> | 40 | #include <qtopia/config.h> |
@@ -165,18 +164,22 @@ FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : | |||
165 | qDebug("Setting up QCop to QPE/System"); | 164 | qDebug("Setting up QCop to QPE/System"); |
166 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 165 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
167 | connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 166 | connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
168 | this, SLOT(message(const QCString &, const QByteArray &)) ); | 167 | this, SLOT(message(const QCString &, const QByteArray &)) ); |
169 | #endif | 168 | #endif |
170 | calcMaxWindowRect(); | 169 | calcMaxWindowRect(); |
171 | #if defined(QPE_NEED_CALIBRATION) | 170 | |
172 | if ( !QFile::exists("/etc/pointercal") ) { | 171 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; |
173 | needCalibrate = TRUE; | 172 | |
174 | grabMouse(); | 173 | if ( m_calHandler) { |
174 | if ( !QFile::exists("/etc/pointercal") ) { | ||
175 | needCalibrate = TRUE; | ||
176 | grabMouse(); | ||
177 | } | ||
175 | } | 178 | } |
176 | #endif | 179 | |
177 | Config config("locale"); | 180 | Config config("locale"); |
178 | config.setGroup( "Language"); | 181 | config.setGroup( "Language"); |
179 | lang = config.readEntry( "Language", "en"); | 182 | lang = config.readEntry( "Language", "en"); |
180 | 183 | ||
181 | defaultFont = font(); | 184 | defaultFont = font(); |
182 | 185 | ||
@@ -227,13 +230,13 @@ void FirstUse::nextDialog() | |||
227 | do { | 230 | do { |
228 | currApp++; | 231 | currApp++; |
229 | qDebug( "currApp = %d", currApp ); | 232 | qDebug( "currApp = %d", currApp ); |
230 | if ( settingsTable[currApp].app == 0 ) { | 233 | if ( settingsTable[currApp].app == 0 ) { |
231 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 234 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
232 | // The last application is still running. | 235 | // The last application is still running. |
233 | // Tell it to stop, and when its done we'll come back | 236 | // Tell it to stop, and when its done we'll come back |
234 | // to nextDialog and exit. | 237 | // to nextDialog and exit. |
235 | qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); | 238 | qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); |
236 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 239 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
237 | settingsTable[prevApp].stop ); | 240 | settingsTable[prevApp].stop ); |
238 | currApp = prevApp; | 241 | currApp = prevApp; |
239 | } else { | 242 | } else { |
@@ -488,12 +491,13 @@ void FirstUse::updateButtons() | |||
488 | while ( settingsTable[i].app && !settingsTable[i].enabled ) | 491 | while ( settingsTable[i].app && !settingsTable[i].enabled ) |
489 | i++; | 492 | i++; |
490 | if ( !settingsTable[i].app ) | 493 | if ( !settingsTable[i].app ) |
491 | next->setText(tr("Finish")); | 494 | next->setText(tr("Finish")); |
492 | else | 495 | else |
493 | next->setText(tr("Next >>")); | 496 | next->setText(tr("Next >>")); |
497 | |||
494 | next->setEnabled( !waitingForLaunch ); | 498 | next->setEnabled( !waitingForLaunch ); |
495 | } | 499 | } |
496 | 500 | ||
497 | void FirstUse::keyPressEvent( QKeyEvent *e ) | 501 | void FirstUse::keyPressEvent( QKeyEvent *e ) |
498 | { | 502 | { |
499 | // Allow cancelling at first dialog, in case display is broken. | 503 | // Allow cancelling at first dialog, in case display is broken. |
@@ -501,17 +505,15 @@ void FirstUse::keyPressEvent( QKeyEvent *e ) | |||
501 | QDialog::keyPressEvent(e); | 505 | QDialog::keyPressEvent(e); |
502 | } | 506 | } |
503 | 507 | ||
504 | void FirstUse::mouseReleaseEvent( QMouseEvent * ) | 508 | void FirstUse::mouseReleaseEvent( QMouseEvent * ) |
505 | { | 509 | { |
506 | if ( currApp < 0 ) { | 510 | if ( currApp < 0 ) { |
507 | #if defined(QPE_NEED_CALIBRATION) | 511 | if ( m_calHandler && needCalibrate ) { |
508 | if ( needCalibrate ) { | ||
509 | releaseMouse(); | 512 | releaseMouse(); |
510 | Calibrate *cal = new Calibrate; | 513 | Calibrate *cal = new Calibrate; |
511 | cal->exec(); | 514 | cal->exec(); |
512 | delete cal; | 515 | delete cal; |
513 | } | 516 | } |
514 | #endif | ||
515 | nextDialog(); | 517 | nextDialog(); |
516 | } | 518 | } |
517 | } | 519 | } |