Exemplo n.º 1
0
void TaskWindowJob::start()
{
    const QString operation = operationName();
    if (operation == "cascade") {
        QDBusInterface  *kwinInterface = new QDBusInterface("org.kde.kwin", "/KWin", "org.kde.KWin");
        QDBusPendingCall pcall = kwinInterface->asyncCall("cascadeDesktop");
       // kDebug() << " connected to kwin interface! ";
        setResult(true);
        return;
    } else if (operation == "unclutter") {
        QDBusInterface  *kwinInterface = new QDBusInterface("org.kde.kwin", "/KWin", "org.kde.KWin");
        QDBusPendingCall pcall = kwinInterface->asyncCall("unclutterDesktop");
      //  kDebug() << "connected to kwin interface! ";
        setResult(true);
        return;
    } 
}
void GnomeSessionClient::connectToSessionManager()
{
    QString startupId = QString::fromLocal8Bit(qgetenv("DESKTOP_AUTOSTART_ID"));

    QDBusInterface* managerIface = new QDBusInterface(
        SM_DBUS_SERVICE,
        SM_DBUS_PATH,
        SM_DBUS_INTERFACE,
        QDBusConnection::sessionBus(),
        this);

    QDBusPendingCall call = managerIface->asyncCall("RegisterClient", d->m_applicationId, startupId);
    QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(call, this);
    connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
        SLOT(slotRegisterClientFinished(QDBusPendingCallWatcher*)));
}