diff -upNr touchfreeze-pre-0.2/res/touchpad-disabled.svg touchfreeze-pre-0.2+pau/res/touchpad-disabled.svg
--- touchfreeze-pre-0.2/res/touchpad-disabled.svg 1970-01-01 01:00:00.000000000 +0100
+++ touchfreeze-pre-0.2+pau/res/touchpad-disabled.svg 2008-05-22 13:36:29.000000000 +0200
@@ -0,0 +1,499 @@
+
+
+
\ No newline at end of file
diff -upNr touchfreeze-pre-0.2/stuff.qrc touchfreeze-pre-0.2+pau/stuff.qrc
--- touchfreeze-pre-0.2/stuff.qrc 2008-01-11 19:21:56.000000000 +0100
+++ touchfreeze-pre-0.2+pau/stuff.qrc 2008-05-22 13:18:56.000000000 +0200
@@ -1,5 +1,6 @@
res/touchpad.svg
+ res/touchpad-disabled.svg
diff -upNr touchfreeze-pre-0.2/SynDaemon.cpp touchfreeze-pre-0.2+pau/SynDaemon.cpp
--- touchfreeze-pre-0.2/SynDaemon.cpp 2008-01-12 10:52:32.000000000 +0100
+++ touchfreeze-pre-0.2+pau/SynDaemon.cpp 2008-05-22 13:46:00.000000000 +0200
@@ -37,7 +37,7 @@ void SynDaemon::onStartTyping()
void SynDaemon::onStopTyping()
{
- if ( !hasKeyboardActivity() )
+ if ( !hasKeyboardActivity() && !touchPadExplicitlyDisabledByUser() )
emit stopTyping();
else
mBypassTimer.start();
@@ -100,3 +100,11 @@ bool SynDaemon::touchPadBlocked() const
{
return mTouchPadBlocked;
}
+
+void SynDaemon::setTouchPadExplicitlyDisabledByUser( bool status ) {
+ mTouchPadExplicitlyDisabledbyUser = status;
+}
+
+bool SynDaemon::touchPadExplicitlyDisabledByUser() const {
+ return mTouchPadExplicitlyDisabledbyUser;
+}
diff -upNr touchfreeze-pre-0.2/SynDaemon.h touchfreeze-pre-0.2+pau/SynDaemon.h
--- touchfreeze-pre-0.2/SynDaemon.h 2008-01-12 10:54:08.000000000 +0100
+++ touchfreeze-pre-0.2+pau/SynDaemon.h 2008-05-22 13:45:16.000000000 +0200
@@ -44,6 +44,12 @@ class SynDaemon : public QObject
//! checks whether touch pad events are blocked currently
bool touchPadBlocked() const;
+ //! set whether touch pad has been explicitly disabled the the user by clicking on "Disable Touchpad"
+ void setTouchPadExplicitlyDisabledByUser( bool );
+
+ //! has the touchpad been explicitly disabled by the user by clicking on "Disable Touchpad"?
+ bool touchPadExplicitlyDisabledByUser() const;
+
signals:
//! emitted when typing starts, ignores keyboard modifiers if set
//! regardless whether key events are being blocked or not
@@ -78,6 +84,9 @@ class SynDaemon : public QObject
//! touch pad events are blocked?
bool mTouchPadBlocked;
+ //! touchpad disabled by user?
+ bool mTouchPadExplicitlyDisabledbyUser;
+
//! for bypass typing
QTimer mBypassTimer;
diff -upNr touchfreeze-pre-0.2/TouchFreezeApp.cpp touchfreeze-pre-0.2+pau/TouchFreezeApp.cpp
--- touchfreeze-pre-0.2/TouchFreezeApp.cpp 2008-01-12 03:58:07.000000000 +0100
+++ touchfreeze-pre-0.2+pau/TouchFreezeApp.cpp 2008-05-22 13:47:11.000000000 +0200
@@ -48,10 +48,27 @@ TouchFreezeApp::~TouchFreezeApp()
// FIXME!! restore initial touch pad state
}
+void TouchFreezeApp::enableTouchpad()
+{
+ qDebug( "enable touchpad" );
+ QProcess p( this );
+
+ QProcess::execute( mClientPath + " TouchpadOff=0" );
+ mUI->setEnabledIcon();
+}
+
+void TouchFreezeApp::disableTouchpad()
+{
+ qDebug( "disable touchpad" );
+
+ QProcess::execute( mClientPath + " TouchpadOff=1" );
+ mSynDaemon->setTouchPadExplicitlyDisabledByUser(true);
+ mUI->setDisabledIcon();
+}
+
void TouchFreezeApp::onStartTyping()
{
qDebug( "start typing" );
- QProcess p( this );
QProcess::execute( mClientPath + " TouchpadOff=2" );
}
@@ -59,7 +76,7 @@ void TouchFreezeApp::onStartTyping()
void TouchFreezeApp::onStopTyping()
{
qDebug( "stop typing" );
- QProcess::execute( mClientPath + " TouchpadOff=0" );
+ enableTouchpad();
}
void TouchFreezeApp::onDelayChanged( unsigned int delay )
diff -upNr touchfreeze-pre-0.2/TouchFreezeApp.h touchfreeze-pre-0.2+pau/TouchFreezeApp.h
--- touchfreeze-pre-0.2/TouchFreezeApp.h 2008-01-12 03:53:30.000000000 +0100
+++ touchfreeze-pre-0.2+pau/TouchFreezeApp.h 2008-05-22 13:05:55.000000000 +0200
@@ -18,6 +18,8 @@ public:
protected:
protected slots:
+ void enableTouchpad();
+ void disableTouchpad();
void onStartTyping();
void onStopTyping();
// void onEventActivity();
diff -upNr touchfreeze-pre-0.2/TouchFreezeUI.cpp touchfreeze-pre-0.2+pau/TouchFreezeUI.cpp
--- touchfreeze-pre-0.2/TouchFreezeUI.cpp 2008-01-12 10:40:35.000000000 +0100
+++ touchfreeze-pre-0.2+pau/TouchFreezeUI.cpp 2008-05-22 13:31:57.000000000 +0200
@@ -7,16 +7,22 @@ TouchFreezeUI::TouchFreezeUI( QWidget* p
{
setupUi( this );
- QSystemTrayIcon* systray = new QSystemTrayIcon( this );
+ systray = new QSystemTrayIcon( this );
systray->setIcon( QIcon( ":/stuff/touchpad.svg" ) );
systray->show();
QMenu* trayMenu = new QMenu( this );
+ QAction* enableTouchpadAction = new QAction( tr( "&Enable touchpad" ), this );
+ QAction* disableTouchpadAction = new QAction( tr( "&Disable touchpad" ), this );
QAction* quitAction = new QAction( tr( "&Quit" ), this );
+ connect( enableTouchpadAction, SIGNAL( triggered() ), qApp, SLOT( enableTouchpad() ) );
+ connect( disableTouchpadAction, SIGNAL( triggered() ), qApp, SLOT( disableTouchpad() ) );
connect( quitAction, SIGNAL( triggered() ), qApp, SLOT( quit() ) );
+ trayMenu->addAction( enableTouchpadAction );
+ trayMenu->addAction( disableTouchpadAction );
trayMenu->addAction( quitAction );
systray->setContextMenu( trayMenu );
@@ -105,3 +111,11 @@ void TouchFreezeUI::onApply()
applyPushButton->setDisabled( true );
emit delayChanged( delaySlider->value() );
}
+
+void TouchFreezeUI::setDisabledIcon() {
+ systray->setIcon( QIcon( ":/stuff/touchpad-disabled.svg" ) );
+}
+
+void TouchFreezeUI::setEnabledIcon() {
+ systray->setIcon( QIcon( ":/stuff/touchpad.svg" ) );
+}
diff -upNr touchfreeze-pre-0.2/TouchFreezeUI.h touchfreeze-pre-0.2+pau/TouchFreezeUI.h
--- touchfreeze-pre-0.2/TouchFreezeUI.h 2008-01-12 03:40:14.000000000 +0100
+++ touchfreeze-pre-0.2+pau/TouchFreezeUI.h 2008-05-22 13:32:08.000000000 +0200
@@ -17,6 +17,8 @@ public:
void setup( const QString& tpStr, const QString& clientStr, unsigned int delay );
void setStatusText( const QString& );
+ void setDisabledIcon();
+ void setEnabledIcon();
signals:
void delayChanged( unsigned int );
@@ -34,6 +36,7 @@ protected slots:
void onApply();
private:
+ QSystemTrayIcon* systray;
};