1
1
/***************************************************************************
2
* Copyright (C) 2009 by Kai Dombrowe <just89@gmx.de> *
2
* Copyright (C) 2010 by Kai Dombrowe <just89@gmx.de> *
4
4
* This program is free software; you can redistribute it and/or modify *
5
5
* it under the terms of the GNU General Public License as published by *
46
KeyMon::Device *Manager::watch(const QString &device, QObject *parent)
49
KeyMon::Device *dev = new KeyMon::Device(parent, device);
64
QList<KeyMon::DeviceInfo> Manager::getInputDeviceList()
67
QList<KeyMon::DeviceInfo> list;
68
foreach (const Solid::Device &device, Solid::Device::allDevices()) {
71
KeyMon::DeviceInfo info;
72
const Solid::GenericInterface *interface = device.as<Solid::GenericInterface>();
74
if (interface && interface->isValid()) {
75
foreach (const QString &cap, interface->property("info.capabilities").toStringList()) {
76
if (cap == QLatin1String("input.mouse")) {
77
if (interface->property("input.x11_driver").toString() != QLatin1String("evdev")) {
80
info.file = interface->property("input.device").toString();
81
info.uuid = device.udi();
82
info.name = device.product();
83
info.icon = device.icon();
84
info.type = KeyMon::DeviceInfo::MouseType;
88
} else if (cap == QLatin1String("input.keyboard")) {
89
if (interface->property("input.x11_driver").toString() != QLatin1String("evdev")) {
92
info.file = interface->property("input.device").toString();
93
info.uuid = device.udi();
94
info.name = device.product();
95
info.icon = device.icon();
96
info.type = KeyMon::DeviceInfo::KeyboardType;
103
kDebug() << "Found input device:" << info.name;
115
QString Manager::fileForDevice(const KeyMon::DeviceInfo &info)
118
Solid::Device device = Solid::Device(info.uuid);
119
if (device.isValid()) {
120
const Solid::GenericInterface *interface = device.as<Solid::GenericInterface>();
121
if (interface && interface->isValid()) {
122
return interface->property("input.device").toString();
124
kWarning() << "Invalid interface!";
128
kWarning() << "Device not found...";
56
134
}; // Namespace KeyMon