Logo Search packages:      
Sourcecode: kcm-tablet version File versions  Download package

void TabletDeamon::deviceAdded ( const QString &  udi  )  [private, slot]

Called when solid detects a new device.

Checks if the device is a tablet device. Calls reloadDeviceInformation() from wacom::DeviceHandler. If a tablet could be detected a notification is send and the default profile will be applied

This function is exported on DBus.

Parameters:
udi udi number of the newly created device detected be Solid.

Definition at line 123 of file tabletdeamon.cpp.

References setProfile(), and tabletAdded().

Referenced by TabletDeamon().

{
    Q_D(TabletDeamon);

    // if we already have a device ... skip this step
    if (d->deviceHandler->isDeviceAvailable()) {
        return;
    }

    Solid::Device dev(udi);
    //@TODO add tablet interface to solid
    const Solid::GenericInterface *unknown = dev.as<Solid::GenericInterface>();
    QStringList category = unknown->property("input.x11_options.Type").toStringList();
    QString     driver   = unknown->property("input.x11_driver").toString();
    if (category.contains("pad") || category.contains("stylus") || category.contains("eraser") || category.contains("cursor") || driver.contains("wacom")) {

        // remove old info and try to detect the tablet
        d->deviceHandler->reloadDeviceInformation();

        // if we found something notify about it and set the default profile to it
        if (d->deviceHandler->isDeviceAvailable()) {
            // maybe not the best solution. but it does work to surpress the notification dialog on kde startup
            if (!d->initPhase) {
                KNotification *notification = new KNotification("tabletAdded");
                notification->setTitle(i18n("Tablet added"));
                notification->setText(i18n("New %1 tablet added", d->deviceHandler->deviceName()));
                notification->setPixmap(d->iconLoader->loadIcon("input-tablet", KIconLoader::Panel));
                notification->setComponentData(d->applicationData);
                notification->sendEvent();
            }

            d->udi = udi;

            emit tabletAdded();

            setProfile("default");
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index