void ColordEngine::init() { // Creates a ColorD interface, it must be created with new // otherwise the object will be deleted when this block ends QDBusInterface *interface; interface = new QDBusInterface(QLatin1String("org.freedesktop.ColorManager"), QLatin1String("/org/freedesktop/ColorManager"), QLatin1String("org.freedesktop.ColorManager"), QDBusConnection::systemBus(), this); // listen to colord for device events connect(interface, SIGNAL(DeviceAdded(QDBusObjectPath)), this, SLOT(deviceAdded(QDBusObjectPath))); connect(interface, SIGNAL(DeviceRemoved(QDBusObjectPath)), this, SLOT(deviceRemoved(QDBusObjectPath))); connect(interface, SIGNAL(DeviceChanged(QDBusObjectPath)), this, SLOT(deviceChanged(QDBusObjectPath))); // listen to colord for profile events connect(interface, SIGNAL(ProfileAdded(QDBusObjectPath)), this, SLOT(profileAdded(QDBusObjectPath))); connect(interface, SIGNAL(ProfileRemoved(QDBusObjectPath)), this, SLOT(profileRemoved(QDBusObjectPath))); connect(interface, SIGNAL(ProfileChanged(QDBusObjectPath)), this, SLOT(profileChanged(QDBusObjectPath))); // Ask for profiles QDBusMessage msg; msg = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.ColorManager"), QLatin1String("/org/freedesktop/ColorManager"), QLatin1String("org.freedesktop.ColorManager"), QLatin1String("GetProfiles")); QDBusConnection::systemBus().callWithCallback(msg, this, SLOT(gotProfiles(QDBusMessage))); // Ask for devices QDBusMessage message; message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.ColorManager"), QLatin1String("/org/freedesktop/ColorManager"), QLatin1String("org.freedesktop.ColorManager"), QLatin1String("GetDevices")); QDBusConnection::systemBus().callWithCallback(message, this, SLOT(gotDevices(QDBusMessage))); }
void ProfileManager::addProfile(Profile* profile) { profiles << profile; emit profileAdded(profile); }