synaptiks::MouseDevicesMonitor Class Reference

Monitor and query plugged mouse devices. More...

#include <mousedevicesmonitor.h>

List of all members.

Public Slots

Q_SCRIPTABLE QStringList pluggedMouseDevices () const
 List all currently plugged mouse devices.
Q_SCRIPTABLE QString productName (const QString &id) const
 Query the product name of a device.
Q_SCRIPTABLE bool isTouchpad (const QString &id) const
 Is the given device a touchpad?

Signals

Q_SCRIPTABLE void mousePlugged (const QString &id)
 A mouse device was plugged.
Q_SCRIPTABLE void mouseUnplugged (const QString &id)
 A mouse device was unplugged.

Public Member Functions

 MouseDevicesMonitor (QObject *parent=0)
 Create a new object.
virtual ~MouseDevicesMonitor ()
 Destroy this object.

Detailed Description

Monitor and query plugged mouse devices.

This class constantly monitors mouse devices. It emits signals, if mouse devices are plugged or unplugged, and provides rudimentary information about plugged mouse devices.

Usage

To be informed about plugged and unplugged mouses, just connect to the corresponding signals:

 MouseDevicesMonitor *monitor = new MouseDevicesMonitor(this);
 this->connect(monitor, SIGNAL(mousePlugged(const QString&)),
               SLOT(doSomethingWithPluggedMouse(const QString&)));
 this->connect(monitor, SIGNAL(mouseUnplugged(const QString&)),
               SLOT(doSomethingWithUnluggedMouse(const QString&)));

You can also use this class to enumerate plugged devices:

 foreach (QString mouse, monitor->pluggedMouseDevices()) {
     kDebug() << monitor->productName(mouse);
 }

D-Bus

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


Constructor & Destructor Documentation

MouseDevicesMonitor::MouseDevicesMonitor ( QObject *  parent = 0  ) 

Create a new object.

Parameters:
parent same as for QObject(QObject*)

Member Function Documentation

bool MouseDevicesMonitor::isTouchpad ( const QString &  id  )  const [slot]

Is the given device a touchpad?

Warning:

Only use this method with plugged devices. This class cannot obtain information about devices, which are not currently plugged.

Parameters:
id the device id
Returns:
true, if the given device is a touchpad, false otherwise
Q_SCRIPTABLE void synaptiks::MouseDevicesMonitor::mousePlugged ( const QString &  id  )  [signal]

A mouse device was plugged.

Parameters:
id the id of this device
Q_SCRIPTABLE void synaptiks::MouseDevicesMonitor::mouseUnplugged ( const QString &  id  )  [signal]

A mouse device was unplugged.

Warning:

Do not pass the given id to methods of this class. This slot is invoked after the mouse has been unplugged, therefore this class cannot any longer obtain information about the device.

Parameters:
id the id of this device
QStringList MouseDevicesMonitor::pluggedMouseDevices (  )  const [slot]

List all currently plugged mouse devices.

Returns:
a list containing the ids of all plugged mouse devices
QString MouseDevicesMonitor::productName ( const QString &  id  )  const [slot]

Query the product name of a device.

Warning:

Only use this method with plugged devices. This class cannot obtain information about devices, which are not currently plugged.

Parameters:
id the device id
Returns:
the product name

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