From 364d30ca7c212a531b79bb7cbceb8af7a0130f2c Mon Sep 17 00:00:00 2001 From: zecke Date: Sat, 04 Oct 2003 07:27:33 +0000 Subject: Check if there is a Mouse Driver And get rid off the QPE_NEED_CALIBRATION define for defining the need of calibration We will find out at runtime SomeOne Apply this to core/server in the BRANCH as well --- (limited to 'core/launcher') 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 @@ -30,9 +30,8 @@ #include "applauncher.h" #include "serverapp.h" #include -#if defined(QPE_NEED_CALIBRATION) + #include "calibrate.h" -#endif #include "documentlist.h" #include @@ -168,12 +167,16 @@ FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : this, SLOT(message(const QCString &, const QByteArray &)) ); #endif calcMaxWindowRect(); -#if defined(QPE_NEED_CALIBRATION) - if ( !QFile::exists("/etc/pointercal") ) { - needCalibrate = TRUE; - grabMouse(); + + m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; + + if ( m_calHandler) { + if ( !QFile::exists("/etc/pointercal") ) { + needCalibrate = TRUE; + grabMouse(); + } } -#endif + Config config("locale"); config.setGroup( "Language"); lang = config.readEntry( "Language", "en"); @@ -230,7 +233,7 @@ void FirstUse::nextDialog() if ( settingsTable[currApp].app == 0 ) { if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { // The last application is still running. - // Tell it to stop, and when its done we'll come back + // Tell it to stop, and when its done we'll come back // to nextDialog and exit. qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, @@ -491,6 +494,7 @@ void FirstUse::updateButtons() next->setText(tr("Finish")); else next->setText(tr("Next >>")); + next->setEnabled( !waitingForLaunch ); } @@ -504,14 +508,12 @@ void FirstUse::keyPressEvent( QKeyEvent *e ) void FirstUse::mouseReleaseEvent( QMouseEvent * ) { if ( currApp < 0 ) { -#if defined(QPE_NEED_CALIBRATION) - if ( needCalibrate ) { + if ( m_calHandler && needCalibrate ) { releaseMouse(); Calibrate *cal = new Calibrate; cal->exec(); delete cal; } -#endif nextDialog(); } } diff --git a/core/launcher/firstuse.h b/core/launcher/firstuse.h index 44a95a8..98858f8 100644 --- a/core/launcher/firstuse.h +++ b/core/launcher/firstuse.h @@ -79,6 +79,7 @@ private: int waitForExit; bool waitingForLaunch; bool needRestart; + bool m_calHandler : 1; QFont defaultFont; }; diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 075985d..ad40536 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp @@ -198,7 +198,8 @@ static void initKeyboard() static bool firstUse() { bool needFirstUse = FALSE; - if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { + if ( QWSServer::mouseHandler() && + QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { if ( !QFile::exists( "/etc/pointercal" ) ) needFirstUse = TRUE; } -- cgit v0.9.0.2