Пример #1
0
bool QNetworkManagerInterfaceDeviceWireless::setConnections()
{
    if (!isValid())
        return false;

    QDBusConnection dbusConnection = QDBusConnection::systemBus();
    bool allOk = true;

    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                               interfacePath,
                                QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
                                QLatin1String("AccessPointAdded"),
                                this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
        allOk = false;
    }


    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                              interfacePath,
                              QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
                              QLatin1String("AccessPointRemoved"),
                              this, SLOT(slotAccessPointRemoved(QDBusObjectPath)))) {
        allOk = false;
    }

    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                               interfacePath,
                               QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
                               QLatin1String("ScanDone"),
                               this, SLOT(scanIsDone()))) {
        allOk = false;
    }
    return allOk;
}
Пример #2
0
UdisksManager::UdisksManager(QObject *parent)
    : QObject(parent)
{
    QDBusConnection system = QDBusConnection::systemBus();

    if (!system.isConnected())
    {
        emit error(tr("Cannot connect to Udisks daemon"));
    }

    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceAdded",
                    this,
                    SLOT(onDeviceAdded(QDBusObjectPath)));
    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceRemoved",
                    this,
                    SLOT(onDeviceRemoved(QDBusObjectPath)));
    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceChanged",
                    this,
                    SLOT(onDeviceChanged(QDBusObjectPath)));

    QDBusInterface devEnum("org.freedesktop.UDisks",
                           "/org/freedesktop/UDisks",
                           "org.freedesktop.UDisks",
                           QDBusConnection::systemBus());

    QDBusMessage enumRes = devEnum.call("EnumerateDevices");
    // TODO/FIXME: error checking
//    if (enumRes.type() == QDBusMessage::ErrorMessage)
//    {
//        fprintf(stderr, "ERROR: Can't call EnumerateDevices\n");
//        fprintf(stderr, "       %s : %s\n", qPrintable(enumRes.errorName()), qPrintable(enumRes.errorMessage()));
//    }
//
//    if (enumRes.type() != QDBusMessage::ReplyMessage || !enumRes.arguments().at(0).canConvert<QDBusArgument>())
//    {
//        fprintf(stderr, "ERROR: Unexpected result type of EnumerateDevices call\n");
//    }
//
    const QDBusArgument enumArg = enumRes.arguments().at(0).value<QDBusArgument>();
//    if (enumArg.currentType() != QDBusArgument::ArrayType)
//    {
//        fprintf(stderr, "ERROR: Unexpected argument type of EnumerateDevices call\n");
//    }

    enumArg.beginArray();
    while (!enumArg.atEnd())
    {
        addDevice(qdbus_cast<QDBusObjectPath>(enumArg));
    }
    enumArg.endArray();
}
bool QNetworkManagerInterface::setConnections()
{
    if(!isValid() )
        return false;

    QDBusConnection dbusConnection = QDBusConnection::systemBus();

    bool allOk = false;
    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                                  QLatin1String(NM_DBUS_PATH),
                                  QLatin1String(NM_DBUS_INTERFACE),
                                  QLatin1String("PropertiesChanged"),
                                nmDBusHelper,SLOT(slotPropertiesChanged(QMap<QString,QVariant>)))) {
        allOk = true;
    }
    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                                  QLatin1String(NM_DBUS_PATH),
                                  QLatin1String(NM_DBUS_INTERFACE),
                                  QLatin1String("DeviceAdded"),
                                this,SIGNAL(deviceAdded(QDBusObjectPath)))) {
        allOk = true;
    }
    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                                  QLatin1String(NM_DBUS_PATH),
                                  QLatin1String(NM_DBUS_INTERFACE),
                                  QLatin1String("DeviceRemoved"),
                                  this,SIGNAL(deviceRemoved(QDBusObjectPath)))) {
        allOk = true;
    }

    return allOk;
}
Пример #4
0
UDiskProvider::UDiskProvider(QObject *parent):
    RzMountProvider(parent)
{
    QDBusConnection system = QDBusConnection::systemBus();

    if (!system.isConnected())
    {
        return;
    }

    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceAdded",
                    this,
                    SLOT(dbusDeviceAdded(QDBusObjectPath)));

    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceRemoved",
                    this,
                    SLOT(dbusDeviceRemoved(QDBusObjectPath)));

    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceChanged",
                    this,
                    SLOT(dbusDeviceChanged(QDBusObjectPath)));

    mIsValid = true;
}
bool QNetworkManagerSettingsConnection::setConnections()
{
    if(!isValid() )
        return false;

    QDBusConnection dbusConnection = QDBusConnection::systemBus();
    bool allOk = false;
    if(!dbusConnection.connect(d->service, d->path,
                           QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Updated"),
                           this, SIGNAL(updated(QNmSettingsMap)))) {
        allOk = true;
    } else {
        QDBusError error = dbusConnection.lastError();
    }

    delete nmDBusHelper;
    nmDBusHelper = new QNmDBusHelper(this);
    connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(QString)),
            this,SIGNAL(removed(QString)));

    if (!dbusConnection.connect(d->service, d->path,
                           QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Removed"),
                           nmDBusHelper, SIGNAL(slotSettingsRemoved()))) {
        allOk = true;
    }

    return allOk;
}
PackageKitProxy::PackageKitProxy(QObject *parent):
    QObject(parent)
{
    QDBusConnection bus = QDBusConnection::systemBus();
    qDebug() << "DBus System Connection: " << bus.isConnected();
    qDebug() << "DBus PackageKit transactionListChanged connected" <<
    bus.connect(PKG_SERVICE, PKG_PATH, PKG_IFACE, "TransactionListChanged", this, SLOT(d_onTransactionListChanged(QStringList)));
    qDebug() << "DBus PackageKit updatesChanged connected" <<
    bus.connect(PKG_SERVICE, PKG_PATH, PKG_IFACE, "UpdatesChanged", this, SLOT(d_onUpdatesChanged()));
    qDebug() << "DBus PackageKit repoListChanged connect" <<
    bus.connect(PKG_SERVICE, PKG_PATH, PKG_IFACE, "RepoListChanged", this, SLOT(d_onRepoListChanged()));
    qDebug() << "DBus PackageKit restartScheduled connect" <<
    bus.connect(PKG_SERVICE, PKG_PATH, PKG_IFACE, "RestartScheduled", this, SLOT(d_onRestartScheduled()));

    PackageKit::Daemon *daemon = PackageKit::Daemon::global();
    qDebug() << "Found backend" << daemon->backendName();
    /*
     *  Bugged and dont work DBus used instead
     *
    qDebug() << "connect repoListChanged" <<
    connect(daemon,SIGNAL(repoListChanged()), SLOT(d_onRepoListChanged()));
    qDebug() << "connect restartScheduled" <<
    connect(daemon,SIGNAL(restartScheduled()), SLOT(d_onRestartScheduled()));
    qDebug() << "connect transactionListChanged" <<
    connect(daemon,SIGNAL(transactionListChanged(const QStringList&)), SLOT(d_onTransactionListChanged(const QStringList&)));
    qDebug() << "connect updatesChanged" <<
    connect(daemon,SIGNAL(updatesChanged()), SLOT(d_onUpdatesChanged()));
    */
    qDebug() << "connect daemonQuit" <<
    connect(daemon,SIGNAL(daemonQuit()), SLOT(d_onDaemonQuit()));

    /*
    qDebug() << "packageArch test" << PackageKit::Daemon::packageArch("ownNotes;1.1.2-1;i586;installed");
    qDebug() << "packageData test" << PackageKit::Daemon::packageData("ownNotes;1.1.2-1;i586;installed");
    qDebug() << "packageIcon test" << PackageKit::Daemon::packageIcon("ownNotes;1.1.2-1;i586;installed");
    qDebug() << "packageName test" << PackageKit::Daemon::packageName("ownNotes;1.1.2-1;i586;installed");
    qDebug() << "packageVersion test" << PackageKit::Daemon::packageVersion("ownNotes;1.1.2-1;i586;installed");

    qDebug() << "packageArch test2" << PackageKit::Daemon::packageArch("ownNotes;1.1.1-1;i586;openrepos-Khertan");
    qDebug() << "packageData test2" << PackageKit::Daemon::packageData("ownNotes;1.1.1-1;i586;openrepos-Khertan");
    qDebug() << "packageIcon test2" << PackageKit::Daemon::packageIcon("ownNotes;1.1.1-1;i586;openrepos-Khertan");
    qDebug() << "packageName test2" << PackageKit::Daemon::packageName("ownNotes;1.1.1-1;i586;openrepos-Khertan");
    qDebug() << "packageVersion test2" << PackageKit::Daemon::packageVersion("ownNotes;1.1.1-1;i586;openrepos-Khertan");
    */

    /*
    qDebug() << "Test install transaction";
    PackageKit::Transaction* tester = createTransaction();
    tester->installPackage("ownNotes;1.1.0-1;i586;openrepos-Khertan");
    /**/

    /*
    qDebug() << "Test remove transaction";
    TransactionProxy* tester = createTransaction();
    //tester->searchNames("ownNotes",PackageKit::Transaction::FilterInstalled);
    tester->removePackage("ownNotes;1.1.0-1;i586;installed");
    /**/
}
Пример #7
0
KSystemTimeZones::KSystemTimeZones()
  : d(0)
{
    QDBusConnection dbus = QDBusConnection::sessionBus();
    const QString dbusIface = QString::fromLatin1(KTIMEZONED_DBUS_IFACE);
    dbus.connect(QString(), QString(), dbusIface, QLatin1String("configChanged"), this, SLOT(configChanged()));
    dbus.connect(QString(), QString(), dbusIface, QLatin1String("zonetabChanged"), this, SLOT(zonetabChanged(QString)));
    // No need to connect to definitionChanged() - see comments in zoneDefinitionChanged()
    //dbus.connect(QString(), QString(), dbusIface, QLatin1String("definitionChanged"), this, SLOT(zoneDefinitionChanged(QString)));
}
Пример #8
0
KSystemTimeZones::KSystemTimeZones()
  : d(0)
{
#if !defined(TIMED_SUPPORT) && !defined(KCALCORE_FOR_MEEGO)
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.connect(QString(), QString(), KTIMEZONED_DBUS_IFACE, "configChanged", this, SLOT(configChanged()));
    dbus.connect(QString(), QString(), KTIMEZONED_DBUS_IFACE, "zonetabChanged", this, SLOT(zonetabChanged(QString)));
    // No need to connect to definitionChanged() - see comments in zoneDefinitionChanged()
    //dbus.connect(QString(), QString(), KTIMEZONED_DBUS_IFACE, "definitionChanged", this, SLOT(zoneDefinitionChanged(QString)));
#endif
}
Пример #9
0
int main(int argc, char *argv[])
{
    QCoreApplication::setOrganizationName("Hangish");
    QCoreApplication::setApplicationName("Hangish");
    QCoreApplication::setApplicationVersion("0.6.0");

    QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
    QScopedPointer<QQuickView> view(SailfishApp::createView());
    ConversationModel *conversationModel = new ConversationModel();
    RosterModel *rosterModel = new RosterModel();
    ContactsModel *contactsModel = new ContactsModel();
    FileModel *fileModel = new FileModel();
    Client *c = new Client(rosterModel, conversationModel, contactsModel);
    ImageHandler *ih = new ImageHandler();
    ih->setAuthenticator(c->getAuthenticator());
    //Do this once when app is launching
    ih->cleanCache();

    view->rootContext()->setContextProperty("conversationModel", conversationModel);
    view->rootContext()->setContextProperty("rosterModel", rosterModel);
    view->rootContext()->setContextProperty("contactsModel", contactsModel);
    view->rootContext()->setContextProperty("fileModel", fileModel);
    view->engine()->rootContext()->setContextProperty("Client", c);
    view->engine()->rootContext()->setContextProperty("ImageHandler", ih);


    QDBusConnection system = QDBusConnection::systemBus();
    if (!system.isConnected())
    {
        qFatal("Cannot connect to the D-Bus session bus.");
        return 1;
    }
    system.connect("net.connman",
                   "/net/connman/technology/wifi",
                   "net.connman.Technology",
                   "PropertyChanged",
                   c,
                   SLOT(connectivityChanged(QString,QDBusVariant))
                  );
    system.connect("net.connman",
                   "/net/connman/technology/cellular",
                   "net.connman.Technology",
                   "PropertyChanged",
                   c,
                   SLOT(connectivityChanged(QString,QDBusVariant))
                  );

    view->setSource(SailfishApp::pathTo("qml/harbour-hangish.qml"));
    view->showFullScreen();
    app->exec();
}
Пример #10
0
 void connectWithDBus(const char* dbusSignal, QObject* obj, const char* slot,
                      QDBusConnection connection = QDBusConnection::sessionBus())
 {
     // connect to slave signals
     connection.connect(QString(), QLatin1String("/ChangesetRelay"),
                        QLatin1String("org.kde.digikam.DatabaseChangesetRelay"),
                        QString::fromUtf8(dbusSignal),
                        obj, slot);
     // connect to master signals
     connection.connect(QString(), QLatin1String("/ChangesetRelayForPeers"),
                        QLatin1String("org.kde.digikam.DatabaseChangesetRelay"),
                        QString::fromUtf8(dbusSignal),
                        obj, slot);
 }
Пример #11
0
DataHandler::DataHandler(QObject* parent): QObject(parent) {

    connect(this, &DataHandler::credentialsInsideWallet, this, &DataHandler::startDaemon);
    QMetaObject::invokeMethod(this, "checkWallet", Qt::QueuedConnection);

    QDBusConnection dbus = QDBusConnection::sessionBus();

    dbus.connect("org.kde.kdenow", "/Event", "org.kde.kdenow.event",
                 "update", this, SLOT(onEventMapReceived(QStringList, QStringList)));
    dbus.connect("org.kde.kdenow", "/Event", "org.kde.kdenow.event",
                 "loadedEventPlugin", this, SLOT(onLoadedEventPlugin()));

    dbus.connect("org.kde.kdenow", "/Flight", "org.kde.kdenow.flight",
                 "update", this, SLOT(onFlightMapReceived(QStringList, QStringList)));
    dbus.connect("org.kde.kdenow", "/Flight", "org.kde.kdenow.flight",
                 "loadedFlightPlugin", this, SLOT(onLoadedFlightPlugin()));

    dbus.connect("org.kde.kdenow", "/Hotel", "org.kde.kdenow.hotel",
                 "update", this, SLOT(onHotelMapReceived(QStringList, QStringList)));
    dbus.connect("org.kde.kdenow", "/Hotel", "org.kde.kdenow.hotel",
                 "loadedHotelPlugin", this, SLOT(onLoadedHotelPlugin()));

    dbus.connect("org.kde.kdenow", "/Restaurant", "org.kde.kdenow.restaurant",
                 "update", this, SLOT(onRestaurantMapReceived(QStringList, QStringList)));
    dbus.connect("org.kde.kdenow", "/Restaurant", "org.kde.kdenow.restaurant",
                 "loadedRestaurantPlugin", this, SLOT(onLoadedRestaurantPlugin()));
}
Пример #12
0
void Launcher::startup(const QString &app)
{
    QDBusConnection dbc = QDBus::sessionBus();

    if (!dbc.isConnected()) {
        fprintf(stderr, "QtopiaLauncher: Could not connect to DBUS bus\n");
        exit(1);
    }

    bool r = dbc.connect(QString(),                           // Service
                         "/DBusLauncher",                     // Path
                         "com.trolltech.qtopia.DBusLauncher", // Interface
                         "launched",                          // Name
                         this,
                         SLOT(handleSignalReceived(QString,QDBusMessage)));

    QDBusMessage message =
            QDBusMessage::methodCall("com.trolltech.qtopia.DBusLauncher",
                                     "/DBusLauncher",
                                     "com.trolltech.qtopia.DBusLauncher",
                                     "launch", dbc);
    message << app;

    bool ret = dbc.send(message);
    if (!ret)
        fprintf(stderr, "Unable to send message: %s", dbc.lastError().message().toAscii().constData());

    m_app = app;
}
Пример #13
0
MprisManager::MprisManager(QObject *parent)
    : QObject(parent)
    , m_singleService(false)
    , m_playbackStatusMapper(new QSignalMapper(this))
{
    QDBusConnection connection = QDBusConnection::sessionBus();

    if (!connection.isConnected()) {
//        qmlInfo(this) << "Failed attempting to connect to DBus";
        return;
    }

    connection.connect(dBusService, dBusObjectPath, dBusInterface, dBusNameOwnerChangedSignal,
                       QStringList(), QString(),
                       this, SLOT(onNameOwnerChanged(QString, QString, QString)));

    QStringList serviceNames = connection.interface()->registeredServiceNames();
    QStringList::const_iterator i = serviceNames.constBegin();
    while (i != serviceNames.constEnd()) {
        QRegExp rx(mprisNameSpace);
        rx.setPatternSyntax(QRegExp::Wildcard);
        if (rx.exactMatch(*i)) {
            onServiceAppeared(*i);
        }

        ++i;
    }
}
Пример #14
0
KeyboardApplet::KeyboardApplet(QObject *parent, const QVariantList &args):
    Plasma::Applet(parent, args),
    xEventNotifier(),
    rules(Rules::readRules(Rules::READ_EXTRAS)),
    keyboardConfig(new KeyboardConfig()),
    layoutsMenu(new LayoutsMenu(*keyboardConfig, *rules, flags))
{
    if( ! X11Helper::xkbSupported(NULL) ) {
        setFailedToLaunch(true, i18n("XKB extension failed to initialize"));
        return;
    }

    m_svg = new Plasma::Svg(this);
    m_svg->setImagePath("widgets/labeltexture");
    m_svg->setContainsMultipleImages(true);
    resize(48,48);

    setHasConfigurationInterface(false);

    setAspectRatioMode(Plasma::KeepAspectRatio);
    //setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
    setBackgroundHints(DefaultBackground);
    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(themeChanged()));

    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.connect(QString(), KEYBOARD_DBUS_OBJECT_PATH, KEYBOARD_DBUS_SERVICE_NAME, KEYBOARD_DBUS_CONFIG_RELOAD_MESSAGE, this, SLOT(configChanged()));
}
ConflictResolutionScreen::ConflictResolutionScreen()
{
    setStyleSheet( "background-color: white;" );

    new OneclickinstallerAdaptor( this );
    QDBusConnection connection = QDBusConnection::systemBus();
    if ( !connection.isConnected() ) {
        qFatal( "Cannot connect to the D-Bus system bus" );
        exit( 1 );
    }
    connection.registerObject( "/OCI", this );
    if ( !connection.registerService("org.opensuse.oneclickinstaller") ) {
        qFatal( qPrintable( QDBusConnection::systemBus().lastError().message() ) );
        exit( 1 );
    }

    m_mainLayout = new QVBoxLayout;

    //QObject::connect( m_ociHelper, SIGNAL( displayProblemAndSolutions( QString, QString ) ), this, SLOT( problemSolutionWidget( QString, QString ) ) );
    QDBusConnection sysBus = QDBusConnection::systemBus();
    if ( !sysBus.isConnected() ) {
        qFatal( "Cannot connect to the D-Bus system bus" );
        exit( 1 );
    }
    sysBus.connect( QString(), QString(), "org.opensuse.OCIHelper", "displayProblemAndSolutions", this, SLOT( problemSolutionWidget( QString, QStringList ) ) );

    setLayout ( m_mainLayout );
}
Пример #16
0
void
BTAdaptor::searchBtDevices ()
{
    // Connect to the signal DeviceFound to obtain the list of devices
    QDBusConnection bus = QDBusConnection::systemBus ();
    bool success = bus.connect ("org.bluez",
                                mAdapterPath,
                                "org.bluez.Adapter",
                                "DeviceFound",
                                this,
                                SLOT (deviceFound(QString,QMap<QString,QVariant>)));

    if (!success)
    {
        qDebug() << "Failure in connecting dbus signal";
        return;
    }
    
    QDBusMessage msg = QDBusMessage::createMethodCall ("org.bluez",
                                                       mAdapterPath,
                                                       "org.bluez.Adapter",
                                                       "StartDiscovery");

    QDBusMessage reply = bus.call (msg);
    if (reply.type () == QDBusMessage::ErrorMessage)
    {
        qWarning() << "Error in dbus call to search for devices";
        return ;
    }
}
Пример #17
0
manager::manager()
{
    //firstTime = 1;
    QDBusConnection connection = QDBusConnection ::systemBus();
    connection.connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
                       MCE_TKLOCK_MODE_SIG, this,
                       SLOT(controlPolling(QString)));

    mceInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH,
                                      MCE_REQUEST_IF, connection, this);

    modifyProximitydState("turnOn");


    QDBusMessage msg = QDBusMessage::createMethodCall(
            "proximityd.method.change", // --dest
            "/proximityd/method/change", // destination object path
            "proximityd.method.change", // message name (w/o method)
            "Change" // method
        );

    msg << QString("changeInterval");
    msg << getpid();
    msg << getSetting("interval","2000").toInt();
    QDBusMessage reply = QDBusConnection::sessionBus().call(msg);

    qDebug() << reply;
    QDBusConnection sessionConnection = QDBusConnection::sessionBus();
    sessionConnection.connect("", "/proximityd/signal/state", "proximityd.signal.state", "changed", this, SLOT(printTime(QString)));

    keepTkLockOn = new QTimer(this);
    keepTkLockOn->setSingleShot(true);
    keepTkLockOn->setInterval(getSetting("timeout","8000").toInt());
    pressPowerTimer = new QTimer(this);
    pressPowerTimer->setInterval(4100);
    connect(keepTkLockOn, SIGNAL(timeout()), this, SLOT(off()));
    connect(pressPowerTimer, SIGNAL(timeout()), this, SLOT(pressPower()));
//    timerOff = new QTimer(this);
//    connect(timerOff, SIGNAL(timeout()), this, SLOT(off()));
//    timer = new QTimer(this);
//    connect(timer, SIGNAL(timeout()), this, SLOT(refreshTime()));

    //QDBusInterface *Interface = new QDBusInterface(QString("com.nokia.mce"), QString("/com/nokia/mce/request"), QString("com.nokia.mce.request.get_tklock_mode"), connection);
    //Interface->connection().connect("com.nokia.mce", "/com/nokia/mce/request", "com.nokia.mce.request.get_tklock_mode", "status_changed", this, SLOT(killEverybody()));
    //QDBusConnection::systemBus().connect("com.nokia.mce", "/com/nokia/mce/signal", "com.nokia.mce.signal", "tklock_mode_ind", this, SLOT(killEverybody()));
    //printTime("d");
}
bool QNetworkManagerInterfaceDeviceWireless::setConnections()
{
    if(!isValid() )
        return false;

    QDBusConnection dbusConnection = QDBusConnection::systemBus();
    bool allOk = false;
    delete nmDBusHelper;
    nmDBusHelper = new QNmDBusHelper(this);
    connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
            this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));

    connect(nmDBusHelper, SIGNAL(pathForAccessPointAdded(QString,QDBusObjectPath)),
            this,SIGNAL(accessPointAdded(QString,QDBusObjectPath)));

    connect(nmDBusHelper, SIGNAL(pathForAccessPointRemoved(QString,QDBusObjectPath)),
            this,SIGNAL(accessPointRemoved(QString,QDBusObjectPath)));

    if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                              d->path,
                              QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
                              QLatin1String("AccessPointAdded"),
                              nmDBusHelper, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
        allOk = true;
    }


    if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                              d->path,
                              QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
                              QLatin1String("AccessPointRemoved"),
                              nmDBusHelper, SLOT(slotAccessPointRemoved(QDBusObjectPath)))) {
        allOk = true;
    }


    if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                              d->path,
                              QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
                              QLatin1String("PropertiesChanged"),
                              nmDBusHelper,SLOT(slotPropertiesChanged(QMap<QString,QVariant>)))) {
        allOk = true;
    }

    return allOk;
}
Пример #19
0
ServiceResolver::ServiceResolver()
{
    QDBusConnection conn = QDBusConnection::sessionBus();

    conn.connect(MAPPER_SERVICENAME,
                 MAPPER_PATH,
                 MAPPER_INTERFACE,
                 "serviceAvailable",
                 this,
                 SLOT(onServiceAvailable(QString,QString)));
    conn.connect(MAPPER_SERVICENAME,
                 MAPPER_PATH,
                 MAPPER_INTERFACE,
                 "serviceUnavailable",
                 this,
                 SLOT(onServiceUnavailable(QString,QString)));
}
Пример #20
0
BTClient::BTClient(QObject *parent) : QObject (parent)
{
    QDBusConnection bus = QDBusConnection::systemBus ();
    bool success = bus.connect ("org.bluez", "", "org.bluez.Adapter", "PropertyChanged", this, SLOT (btStateChanged (QString, QDBusVariant)));
    qDebug () << success;
    if (success == false)
        qWarning("Cannot connect to org.bluez.Adapter::PropertyChanged signal.");
}
void TrackerDocumentProvider::componentComplete()
{
    QDBusConnection sessionBus = QDBusConnection::sessionBus();
    sessionBus.connect(dbusService, dbusPath, dbusInterface, dbusSignal, this, SLOT(trackerGraphChanged(QString,QVariantList,QVariantList)));

    d->connection = new QSparqlConnection(trackerDriver);
    startSearch();
}
Пример #22
0
void SearchModule::init()
{
    m_dirNotify = new org::kde::KDirNotify(QString(), QString(),
                                           QDBusConnection::sessionBus(), this);
    connect(m_dirNotify, &OrgKdeKDirNotifyInterface::enteredDirectory,
            this, &SearchModule::registerSearchUrl);
    connect(m_dirNotify, &OrgKdeKDirNotifyInterface::leftDirectory,
            this, &SearchModule::unregisterSearchUrl);


    // FIXME: Listen to changes from Baloo!!
    // Listen to dbChanged
    QDBusConnection con = QDBusConnection::sessionBus();
    con.connect(QString(), QStringLiteral("/files"), QStringLiteral("org.kde.baloo"),
                QStringLiteral("updated"), this, SLOT(slotBalooFileDbChanged()));
    con.connect(QString(), QStringLiteral("/files"), QStringLiteral("org.kde"),
                QStringLiteral("changed"), this, SLOT(slotFileMetaDataChanged(QStringList)));
}
Пример #23
0
void Camera::startCamera()
{
    QDBusConnection bus = QDBusConnection::sessionBus();

    bus.connect("com.nokia.maemo.CameraService",
                "/",
                "com.nokia.maemo.meegotouch.CameraInterface",
                "captureCanceled",
                this, SLOT(captureCanceled(QString)));

    bus.connect("com.nokia.maemo.CameraService",
                "/",
                "com.nokia.maemo.meegotouch.CameraInterface",
                "captureCompleted",
                this, SLOT(captureCompleted(QString,QString)));

    QDBusMessage message = QDBusMessage::createMethodCall(
                "com.nokia.maemo.CameraService",
                "/",
                "com.nokia.maemo.meegotouch.CameraInterface",
                "showCamera");

    QList<QVariant> args;
    args << (uint)0 << "" << "still-capture" << true;
    message.setArguments(args);

    QDBusMessage reply = bus.call(message);
    if (reply.type() == QDBusMessage::ErrorMessage) {
        qDebug() << Q_FUNC_INFO << "reply.type == errormessage; name=" << reply.errorName() << "; message=" << reply.errorMessage();
        bus.disconnect("com.nokia.maemo.CameraService",
                    "/",
                    "com.nokia.maemo.meegotouch.CameraInterface",
                    "captureCanceled",
                    this, SLOT(captureCanceled(QString)));

        bus.disconnect("com.nokia.maemo.CameraService",
                    "/",
                    "com.nokia.maemo.meegotouch.CameraInterface",
                    "captureCompleted",
                    this, SLOT(captureCompleted(QString,QString)));
        if (m_lastEcId)
            this->callback(m_lastEcId, "");
    }
}
Пример #24
0
void PowerDevilRunner::initUpdateTriggers()
{
    // Also receive updates triggered through the DBus
    QDBusConnection dbus = QDBusConnection::sessionBus();
    if (dbus.interface()->isServiceRegistered("org.kde.Solid.PowerManagement")) {
        if (!dbus.connect("org.kde.Solid.PowerManagement",
                          "/org/kde/Solid/PowerManagement",
                          "org.kde.Solid.PowerManagement",
                          "profileChanged", this, SLOT(updateStatus()))) {
            kDebug() << "error!";
        }
        if (!dbus.connect("org.kde.Solid.PowerManagement",
                          "/org/kde/Solid/PowerManagement",
                          "org.kde.Solid.PowerManagement",
                          "configurationReloaded", this, SLOT(updateStatus()))) {
            kDebug() << "error!";
        }
    }
}
Пример #25
0
void KCupsConnection::notifierConnect(const QString &signal, QObject *receiver, const char *slot)
{
    QDBusConnection systemBus = QDBusConnection::systemBus();
    systemBus.connect(QString(),
                      QLatin1String("/org/cups/cupsd/Notifier"),
                      QLatin1String("org.cups.cupsd.Notifier"),
                      signal,
                      receiver,
                      slot);
}
void GnomeSessionClient::slotRegisterClientFinished(QDBusPendingCallWatcher* watcher)
{
    QDBusPendingReply<QDBusObjectPath> reply = *watcher;
    watcher->deleteLater();
    if (!reply.isValid()) {
        UQ_WARNING << "Failed to register with GnomeSession:" << reply.error().message();
        return;
    }

    d->m_waitingForEndSession = true;
    QDBusConnection bus = QDBusConnection::sessionBus();
    d->m_clientPath = reply.value().path();

    bus.connect(SM_DBUS_SERVICE, d->m_clientPath, SM_CLIENT_DBUS_INTERFACE,
        "Stop", "", this, SLOT(stop()));
    bus.connect(SM_DBUS_SERVICE, d->m_clientPath, SM_CLIENT_DBUS_INTERFACE,
        "QueryEndSession", "u", this, SLOT(queryEndSession()));
    bus.connect(SM_DBUS_SERVICE, d->m_clientPath, SM_CLIENT_DBUS_INTERFACE,
        "EndSession", "u", this, SLOT(endSession()));
}
void QGeoSatelliteInfoSourceGeoclueMaster::positionProviderChanged(const QString &name,
                                                                   const QString &description,
                                                                   const QString &service,
                                                                   const QString &path)
{
    Q_UNUSED(name)
    Q_UNUSED(description)

    cleanupSatelliteSource();

    QString providerService;
    QString providerPath;

    if (service.isEmpty() || path.isEmpty()) {
        // No valid position provider has been selected. This probably means that the GPS provider
        // has not yet obtained a position fix. It can still provide satellite information though.
        if (!m_satellitesChangedConnected) {
            QDBusConnection conn = QDBusConnection::sessionBus();
            conn.connect(QString(), QString(), QStringLiteral("org.freedesktop.Geoclue.Satellite"),
                         QStringLiteral("SatelliteChanged"), this,
                         SLOT(satelliteChanged(QDBusMessage)));
            m_satellitesChangedConnected = true;
            return;
        }
    } else {
        if (m_satellitesChangedConnected) {
            QDBusConnection conn = QDBusConnection::sessionBus();
            conn.disconnect(QString(), QString(),
                            QStringLiteral("org.freedesktop.Geoclue.Satellite"),
                            QStringLiteral("SatelliteChanged"), this,
                            SLOT(satelliteChanged(QDBusMessage)));
            m_satellitesChangedConnected = false;
        }

        providerService = service;
        providerPath = path;
    }

    if (providerService.isEmpty() || providerPath.isEmpty()) {
        m_error = AccessError;
        emit QGeoSatelliteInfoSource::error(m_error);
        return;
    }

    m_provider = new OrgFreedesktopGeoclueInterface(providerService, providerPath, QDBusConnection::sessionBus());
    m_provider->AddReference();

    m_sat = new OrgFreedesktopGeoclueSatelliteInterface(providerService, providerPath, QDBusConnection::sessionBus());

    if (m_running) {
        connect(m_sat, SIGNAL(SatelliteChanged(qint32,qint32,qint32,QList<qint32>,QList<QGeoSatelliteInfo>)),
                this, SLOT(satelliteChanged(qint32,qint32,qint32,QList<qint32>,QList<QGeoSatelliteInfo>)));
    }
}
Пример #28
0
CompositorDBusInterface::CompositorDBusInterface(Compositor *parent)
    : QObject(parent)
    , m_compositor(parent)
{
    connect(m_compositor, &Compositor::compositingToggled, this, &CompositorDBusInterface::compositingToggled);
    new CompositingAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject(QStringLiteral("/Compositor"), this);
    dbus.connect(QString(), QStringLiteral("/Compositor"), QStringLiteral("org.kde.kwin.Compositing"),
                 QStringLiteral("reinit"), m_compositor, SLOT(slotReinitialize()));
}
/*!
 * Main function.
 *
 * Creates a RedshiftEnabler object and connects it to the readyCheck dbus signal, so that if a new redshift plasmoid
 * is created (this sends the readyCheck signal) this is enabled by this program. Moreover this program sends the
 * readyForStart signal once launched to enable already existent redshift plasmoids during the login phase.
 */
int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);
    RedshiftEnabler *enabler = new RedshiftEnabler();
    //Responds to the readyCheck signal with a readyForStart signal
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.connect("", "/", "org.kde.redshift", "readyCheck",
                 enabler, SLOT(sendSignal()));
    //Sends the signal once started to enable already possibly running instances of redshift data engine
    enabler->sendSignal();
    return app.exec();
}
Пример #30
0
DbusAdapter::DbusAdapter(QObject *parent) :
    QObject(parent)
{
    QDBusConnection systemConn = QDBusConnection::systemBus();
    systemConn.connect("org.ofono", "/ril_0", "org.ofono.VoiceCallManager", "CallAdded",
                         this, SLOT(_phoneCall(QDBusMessage)));
    systemConn.connect("org.ofono", "/ril_0", "org.ofono.MessageManager", "IncomingMessage",
                         this, SLOT(_smsReceived(QDBusMessage)));

    QDBusConnection sessionConn = QDBusConnection::sessionBus();
    sessionConn.connect("", "/", "org.coderus.harbour_mitakuuluu_server", "messageReceived",
                        this, SLOT(_mitakuuluuMessageReceived(QDBusMessage)));

    qDebug() << "Setting up hack for getting notifications...";
    // The inspiration for this hack was taken from: http://stackoverflow.com/questions/22592042/qt-dbus-monitor-method-calls
    sessionConn.registerObject("/org/freedesktop/Notifications", this, QDBusConnection::ExportAllSlots);
    QString matchString = "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'";
    QDBusInterface busInterface("org.freedesktop.DBus", "/org/freedesktop/DBus",
                                "org.freedesktop.DBus");
    busInterface.call("AddMatch", matchString);
    qDebug() << "Leaving constructor...";
}