synaptiks::TouchpadManager Class Reference

Manage the touchpad. More...

#include <touchpadmanager.h>

List of all members.

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 ()
Touchpadtouchpad () const
 Return the touchpad managed by this class.
KeyboardMonitorkeyboardMonitor () const
 Return the KeyboardMonitor used by this class.
MouseDevicesMonitormouseDevicesMonitor () 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.

Detailed Description

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.

Usage

Simple create the touchpad

D-Bus

All members marked as Q_SCRIPTABLE are exported on D-Bus on the interface org.kde.TouchpadManager.


Constructor & Destructor Documentation

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!

Parameters:
touchpad the synaptiks::Touchpad to manage
mouseDevicesMonitor used for keyboard monitoring
parent same as for QObject(QObject*)
TouchpadManager::~TouchpadManager (  ) 

Destroy this object.


Member Function Documentation

Q_SCRIPTABLE QStringList synaptiks::TouchpadManager::ignoredMouseDevices (  )  const [slot]

Return the list of ignored mouse devices.

Returns:
the list of ignored mouse devices as HAL udis (may be empty)
See also:
monitorMouseDevices()
setIgnoredMouseDevices(const QStringList&)
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.

Returns:
true, if the touchpad is on, false otherwise
KeyboardMonitor * TouchpadManager::keyboardMonitor (  )  const

Return the KeyboardMonitor used by this class.

Returns:
the keyboard monitor, or a null pointer, if keyboard monitoring is disabled
See also:
monitorKeyboard()
Q_SCRIPTABLE bool synaptiks::TouchpadManager::monitorKeyboard (  )  const [slot]

Is mouse device monitoring enabled?

Returns:
true, if it is enabled, false otherwise
See also:
setMonitorMouseDevices(bool)
keyboardMonitor()
Q_SCRIPTABLE bool synaptiks::TouchpadManager::monitorMouseDevices (  )  const [slot]

Is mouse device monitoring enabled?

Returns:
true, if it is enabled, false otherwise
See also:
setMonitorMouseDevices(bool)
mouseDevicesMonitor()
MouseDevicesMonitor * TouchpadManager::mouseDevicesMonitor (  )  const

Return the MouseDevicesMonitor used by this class.

Returns:
a MouseDevicesMonitor instance
See also:
monitorMouseDevices()
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.

Parameters:
devices a list of devices to ignore (may be empty)
See also:
ignoredMouseDevices()
setMonitorMouseDevices(bool)
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".

Parameters:
enabled if true, monitor keyboard, otherwise stop monitoring.
See also:
monitorKeyboard()
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.

Parameters:
enabled if true, monitor mouse devices, otherwise stop monitoring.
See also:
monitorMouseDevices()
setIgnoredMouseDevices(const QStringList&)
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.

Parameters:
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
See also:
setTouchpadOn(bool, const QString&, const QVariant&)
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&).

Parameters:
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.

Returns:
the touchpad object
Q_SCRIPTABLE void synaptiks::TouchpadManager::touchpadError ( const QString &  message  )  [signal]

Emitted, if a touchpad error occurs.

Parameters:
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.

Parameters:
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)
See also:
touchpadSwitched(bool, const QString&, const QVariant&)
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&)

Parameters:
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)
See also:
setTouchpadOn(bool, const QString&, const QVariant&)

Property Documentation

QStringList TouchpadManager::ignoredMouseDevices [read, write]

A list of ignored mouse devices.

See also:
setIgnoredMouseDevices(const QStringList&)
ignoredMouseDevices()
bool TouchpadManager::monitorKeyboard [read, write]

Whether keyboard monitoring is enabled.

See also:
setMonitorKeyboard(bool)
monitorKeyboard()
bool TouchpadManager::monitorMouseDevices [read, write]

Whether mouse device monitoring is enabled.

See also:
setMonitorMouseDevices(bool)
monitorMouseDevices()

The documentation for this class was generated from the following files:
 All Classes Files Functions Typedefs Enumerations Enumerator Properties
Generated on Tue Apr 20 13:25:22 2010 for synaptiks by  doxygen 1.6.3