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

TabletDeamon::TabletDeamon ( QObject *  parent = 0,
const QVariantList &  args = QVariantList() 
) [explicit]

Creates a new deamon module

Parameters:
parent the parent object
args ignored, required by KPlugin signature

Definition at line 62 of file tabletdeamon.cpp.

References deviceAdded(), and deviceRemoved().

        : KDEDModule(parent), d_ptr(new TabletDeamonPrivate)
{
    Q_UNUSED(args);
    Q_D(TabletDeamon);

    KGlobal::locale()->insertCatalog("tablet");

    KAboutData about("tablet", 0, ki18n("Graphic Tablet Configuration deamon"), "0.1.0",
                     ki18n("A wacom tablet control daemon"),
                     KAboutData::License_GPL,
                     ki18n("(c) 2010 Jörg Ehrichs"),
                     KLocalizedString(),
                     "http://www.etricceline.de");

    about.addAuthor(ki18n("Jörg Ehrichs"), ki18n("Maintainer") , "joerg.ehrichs@gmx.de");

    d->applicationData = KComponentData(about);
    d->iconLoader = new KIconLoader(d->applicationData);
    d->profilesConfig = KSharedConfig::openConfig("tabletprofilesrc", KConfig::SimpleConfig);
    d->deviceHandler = new DeviceHandler();

    //DBus connection
    new TabletAdaptor(this);
    new DeviceAdaptor(d->deviceHandler);
    QDBusConnection::sessionBus().registerObject("/Tablet", this);
    QDBusConnection::sessionBus().registerObject("/Device", d->deviceHandler);
    QDBusConnection::sessionBus().registerService("de.etricceline.Tablet");

    //initial search for devices with solid
    bool foundDevice = false;
    d->initPhase = true;

    foreach(const Solid::Device &device, Solid::Device::allDevices()) {
        deviceAdded(device.udi());
        if (d->deviceHandler->isDeviceAvailable()) {
            foundDevice = true;
            break;
        }
    }

    // if no device via solid could be found try again with normal search over all devices (serial and such)
    if (!foundDevice) {
        d->deviceHandler->reloadDeviceInformation();
    }

    // on deviceAdded, check to see if the device was added
    connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(const QString&)), SLOT(deviceAdded(const QString &)));
    // likewise if removed
    connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceRemoved(const QString&)), SLOT(deviceRemoved(const QString &)));

    d->initPhase = false;
}


Generated by  Doxygen 1.6.0   Back to index