Manage the touchpad. More...
#include <touchpadmanager.h>
Public Slots | |
| void | setTouchpadOn (bool on, const QString &reason=QString("unknown"), const QVariant &closure=QVariant()) |
| Switch the touchpad according to the given parameter. | |
| Q_SCRIPTABLE void | setTouchpadOn (bool on, const QString &reason, const QDBusVariant &closure) |
| Switch the touchpad on or off (DBus overload). | |
| Q_SCRIPTABLE bool | isTouchpadOn () |
| Is the touchpad on or not? | |
| Q_SCRIPTABLE void | setMonitorMouseDevices (bool enabled) |
| Enable or disable mouse device monitoring. | |
| Q_SCRIPTABLE bool | monitorMouseDevices () const |
| Is mouse device monitoring enabled? | |
| Q_SCRIPTABLE void | setIgnoredMouseDevices (const QStringList &devices) |
| Set the mouse device, which should be ignored by the monitor. | |
| Q_SCRIPTABLE QStringList | ignoredMouseDevices () const |
| Return the list of ignored mouse devices. | |
| Q_SCRIPTABLE void | setMonitorKeyboard (bool enabled) |
| Enable or disable keyboard monitoring. | |
| Q_SCRIPTABLE bool | monitorKeyboard () const |
| Is mouse device monitoring enabled? | |
Signals | |
| void | touchpadSwitched (bool on, const QString &reason, const QVariant &closure) |
| Emitted, if the touchpad is switched. | |
| Q_SCRIPTABLE void | touchpadSwitched (bool on, const QString &reason, const QDBusVariant &closure) |
| Emitted, if the touchpad is switched (DBus overload). | |
| Q_SCRIPTABLE void | touchpadError (const QString &message) |
| Emitted, if a touchpad error occurs. | |
Public Member Functions | |
| TouchpadManager (Touchpad *touchpad, MouseDevicesMonitor *mouseDevicesMonitor, QObject *parent=0) | |
| ~TouchpadManager () | |
| Touchpad * | touchpad () const |
| Return the touchpad managed by this class. | |
| KeyboardMonitor * | keyboardMonitor () const |
| Return the KeyboardMonitor used by this class. | |
| MouseDevicesMonitor * | mouseDevicesMonitor () const |
| Return the MouseDevicesMonitor used by this class. | |
Properties | |
| bool | monitorMouseDevices |
| Whether mouse device monitoring is enabled. | |
| bool | monitorKeyboard |
| Whether keyboard monitoring is enabled. | |
| QStringList | ignoredMouseDevices |
| A list of ignored mouse devices. | |
Manage the touchpad.
This class controls, whether the touchpad is on or off. It monitors the keyboard (using KeyboardMonitor) and mouse devices (using MouseDevicesMonitor) and switches the touchpad on or off accordingly.
Simple create the touchpad
All members marked as Q_SCRIPTABLE are exported on D-Bus on the interface org.kde.TouchpadManager.
| TouchpadManager::TouchpadManager | ( | Touchpad * | touchpad, | |
| MouseDevicesMonitor * | mouseDevicesMonitor, | |||
| QObject * | parent = 0 | |||
| ) |
Create a new TouchpadManager for the given touchpad.
The new instance will become the parent object of the touchpad and the mouseDevicesMonitor. Do not use the same touchpad object with multiple managers!
| touchpad | the synaptiks::Touchpad to manage | |
| mouseDevicesMonitor | used for keyboard monitoring | |
| parent | same as for QObject(QObject*) |
| TouchpadManager::~TouchpadManager | ( | ) |
Destroy this object.
| Q_SCRIPTABLE QStringList synaptiks::TouchpadManager::ignoredMouseDevices | ( | ) | const [slot] |
Return the list of ignored mouse devices.
| bool TouchpadManager::isTouchpadOn | ( | ) | [slot] |
Is the touchpad on or not?
This method is mainly intented for DBus clients, it is not recommended to use it from C++ code.
This method is distinguished from touchpad()->isOn() by its error reporting behaviour. Unlike touchpad()->isOn() it does not throw any exceptions, but emits touchpadError(const QString&) in case of error. If called from D-Bus, a org.kde.TouchpadError is reported to the caller.
true, if the touchpad is on, false otherwise | KeyboardMonitor * TouchpadManager::keyboardMonitor | ( | ) | const |
Return the KeyboardMonitor used by this class.
| Q_SCRIPTABLE bool synaptiks::TouchpadManager::monitorKeyboard | ( | ) | const [slot] |
Is mouse device monitoring enabled?
true, if it is enabled, false otherwise | Q_SCRIPTABLE bool synaptiks::TouchpadManager::monitorMouseDevices | ( | ) | const [slot] |
Is mouse device monitoring enabled?
true, if it is enabled, false otherwise | MouseDevicesMonitor * TouchpadManager::mouseDevicesMonitor | ( | ) | const |
Return the MouseDevicesMonitor used by this class.
| void TouchpadManager::setIgnoredMouseDevices | ( | const QStringList & | devices | ) | [slot] |
Set the mouse device, which should be ignored by the monitor.
devices must contain device IDs as used by synaptiks::MouseDevicesMonitor. Do not attempt to construct such IDs manually, only rely on synaptiks::MouseDevicesMonitor.
Some computers have virtual mouse devices, which do not correspond to any physical device. Such devices should not cause changes to the touchpad state. Therefore, this class will ignore all given devices. If such a device is plugged or unplugged, nothing will happen.
| devices | a list of devices to ignore (may be empty) |
| void TouchpadManager::setMonitorKeyboard | ( | bool | enabled | ) | [slot] |
Enable or disable keyboard monitoring.
If keyboard monitoring is enabled, the touchpad will automatically be switched off, while the keyboard is active. This is done by calling setTouchpadOn(bool, const QString&, const QVariant&) with reason "keyboard". The closure parameter is unused. Thus, touchpad switches caused by keyboard events emit touchpadSwitched(bool, const QString&, const QVariant&) with reason "keyboard".
| enabled | if true, monitor keyboard, otherwise stop monitoring. |
| void TouchpadManager::setMonitorMouseDevices | ( | bool | enabled | ) | [slot] |
Enable or disable mouse device monitoring.
If mouse device monitoring is enabled, the touchpad will automatically be switched off, if any mouse is plugged, and on again, if no mouse is plugged anymore. This is done by calling setTouchpadOn(bool, const QString&, const QVariant&) with reason "mouse". The closure will be set to the product name of the (un-)plugged mouse. Thus, touchpad switches caused by mouse devices emit touchpadSwitched(bool, const QString&, const QVariant&) with reason "mouse" and the product name as closure.
| enabled | if true, monitor mouse devices, otherwise stop monitoring. |
| void TouchpadManager::setTouchpadOn | ( | bool | on, | |
| const QString & | reason, | |||
| const QDBusVariant & | closure | |||
| ) | [slot] |
Switch the touchpad on or off (DBus overload).
This is an overloaded slot with a D-Bus specific signature. See setTouchpadOn(bool, const QString&, const QVariant&) for documentation.
If called over D-Bus, this method may return the D-Bus error org.kde.TouchpadError, if the underlying Touchpad object throws a QXDeviceError.
| on | if true, try to switch the touchpad on, otherwise switch it off | |
| reason | the reason for switching the touchpad | |
| closure | closure data for slots |
| void TouchpadManager::setTouchpadOn | ( | bool | on, | |
| const QString & | reason = QString("unknown"), |
|||
| const QVariant & | closure = QVariant() | |||
| ) | [slot] |
Switch the touchpad according to the given parameter.
reason tells this class, why the touchpad was switched. This class makes a difference between "interactive" and all other strings. If reason is "interactive", the touchpad is always switched on or off, depending on the parameter on. If the touchpad is switched off by "interactive" reason, no other value for reason will switch the touchpad on again. Switching the touchpad off interactively thus overrides everything else.
All other values for "reason" are considered ”automatic“ reasons. No such reason will switch the touchpad on, if it was switched off by reason "interactive". Moreover, no such reason will switch the touchpad on, if there is still a automatic reason remaining. For instance, if the user stops typing with keyboard monitoring enabled, while the touchpad is still switched off by reason "mouse" (a mouse device is plugged), the touchpad will not be switched on. Only if the mouse device is unpluggged, and the touchpad switched on by reason "mouse", the touchpad will be switched again.
Sometimes you might to pass additional context data to slots (for instance, the name of a plugged mouse device). For such situations this method provides the closure parameter, which is passed unchanged to touchpadSwitched(bool, const QString&, const QVariant&).
| on | if true, try to switch the touchpad on, otherwise switch it off | |
| reason | the reason for switching the touchpad | |
| closure | closure data for slots |
| Touchpad * TouchpadManager::touchpad | ( | ) | const |
Return the touchpad managed by this class.
You can use this object to configure touchpad settings like scrolling speed, tap buttons and the like.
| Q_SCRIPTABLE void synaptiks::TouchpadManager::touchpadError | ( | const QString & | message | ) | [signal] |
Emitted, if a touchpad error occurs.
| message | a human readable error message |
| Q_SCRIPTABLE void synaptiks::TouchpadManager::touchpadSwitched | ( | bool | on, | |
| const QString & | reason, | |||
| const QDBusVariant & | closure | |||
| ) | [signal] |
Emitted, if the touchpad is switched (DBus overload).
This is an overloaded signal with a D-Bus specific signature. See touchpadSwitched(bool, const QString&, const QVariant&) for documentation.
| on | true, if the touchpad is now on, otherwise the touchpad is now off | |
| reason | the reason for the switch | |
| closure | some closure data (e.g. the name of the mouse device) |
| void synaptiks::TouchpadManager::touchpadSwitched | ( | bool | on, | |
| const QString & | reason, | |||
| const QVariant & | closure | |||
| ) | [signal] |
Emitted, if the touchpad is switched.
closure and reason are passed unchanged from the call to setTouchpadOn(bool, const QString&, const QVariant&)
| on | true, if the touchpad is now on, otherwise the touchpad is now off | |
| reason | the reason for the switch | |
| closure | some closure data (e.g. the name of the mouse device) |
QStringList TouchpadManager::ignoredMouseDevices [read, write] |
A list of ignored mouse devices.
bool TouchpadManager::monitorKeyboard [read, write] |
Whether keyboard monitoring is enabled.
bool TouchpadManager::monitorMouseDevices [read, write] |
Whether mouse device monitoring is enabled.
1.6.3