Пример #1
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;
}
Пример #2
0
void MprisPlayer::notifyPropertiesChanged(const QString& interfaceName, const QVariantMap &changedProperties, const QStringList &invalidatedProperties) const
{
    if (m_serviceName.isEmpty()) {
        return;
    }

    QDBusConnection connection = QDBusConnection::sessionBus();

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

    QDBusMessage message = QDBusMessage::createSignal(mprisObjectPath,
                                                      dBusPropertiesInterface,
                                                      dBusPropertiesChangedSignal);

    QList<QVariant> arguments;
    arguments << QVariant(interfaceName) << QVariant(changedProperties) << QVariant(invalidatedProperties);
    message.setArguments(arguments);

    if (!connection.send(message)) {
//        qmlInfo(this) << "Failed to send DBus property notification signal";
    }
}
Пример #3
0
void KnotsDeclarative::taskSwitch()
{
#if defined(Q_WS_MAEMO_5)
    QDBusConnection connection = QDBusConnection::sessionBus();
    QDBusMessage message = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view");
    connection.send(message);
#endif
}
Пример #4
0
Q_INVOKABLE void WindowHelper::minimize()
{
#if defined(Q_OS_MAEMO)
    QDBusConnection c = QDBusConnection::sessionBus();
    QDBusMessage m = QDBusMessage::createSignal("/", "com.nokia.hildon_desktop", "exit_app_view");
    c.send(m);
    c.send(m);
#endif
}
Пример #5
0
void MainWidget::minimizeWindow()
{
#if defined(Q_WS_MAEMO_5)
    // This is needed for Maemo5 to recognize minimization
    QDBusConnection connection = QDBusConnection::sessionBus();
    QDBusMessage message = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view");
    connection.send(message);
#else
    setWindowState(Qt::WindowMinimized);
#endif
}
Пример #6
0
void
SettingStations::okClicked()
{
    _config->stationsList(*_stationlist);
    _config->TemperatureUnit(ui->temperatureCombo->currentText().toStdString());
    _config->WindSpeedUnit(ui->windCombo->currentText().toStdString());
    _config->iconSet(ui->iconsetCombo->currentText().toStdString());
    _config->UpdateConnect(ui->updateCheck->isChecked());
    _config->UpdatePeriod(period_hash[ui->updateCombo->currentText()]);
    _config->saveConfig();

    QDBusConnection bus = QDBusConnection::sessionBus();
    QDBusMessage message = QDBusMessage::createSignal("/org/meego/omweather",
                               "org.meego.omweather", "reload_config");
    bus.send(message);
    message = QDBusMessage::createMethodCall("org.meego.omweather","/org/meego/omweather",
                               "org.meego.omweather", "reload_config");
    bus.send(message);

}
Пример #7
0
void Utility::taskSwitcher()
{
#if defined(Q_WS_MAEMO_5)
    QDBusConnection c = QDBusConnection::sessionBus();
    QDBusMessage m = QDBusMessage::createSignal("/", "com.nokia.hildon_desktop", "exit_app_view");
    c.send(m);
#elif defined(Q_OS_SYMBIAN)
    CEikonEnv::Static()->DisplayTaskList();
#else
    viewer->showMinimized();
#endif
}
Пример #8
0
void TaskSwitcher::minimizeApplication()
{
    //! [0]
    #ifdef Q_WS_MAEMO_5
    // Uses DBus to minimize application in Maemo
    QDBusConnection connection = QDBusConnection::sessionBus();
    QDBusMessage message =
            QDBusMessage::createSignal("/","com.nokia.hildon_desktop",
                                       "exit_app_view");
    connection.send(message);
    #endif
    //! [0]
}
Пример #9
0
void HomeApplication::sendStartupNotifications()
{
    static QDBusConnection systemBus = QDBusConnection::systemBus();
    QDBusMessage homeReadySignal =
        QDBusMessage::createSignal("/com/nokia/duihome",
                                   "com.nokia.duihome.readyNotifier",
                                   "ready");
    systemBus.send(homeReadySignal);

    // For device boot performance reasons initializing Home scene window must be done
    // only after ready signal is sent.
    mainWindowInstance()->showFullScreen();
}
Пример #10
0
void FlightToggle::onToggleLongPressed()
{
    QDBusMessage message = QDBusMessage::createMethodCall("com.nokia.DuiControlPanel", "/",
                                                          "com.nokia.DuiControlPanelIf", "appletPage");
    QList<QVariant> args;
    args.append(QVariant("Phone network"));
    message.setArguments(args);

    QDBusConnection bus = QDBusConnection::sessionBus();

    if (bus.isConnected())
        bus.send(message);
}
void HomeApplication::sendStartupNotifications()
{
    static QDBusConnection systemBus = QDBusConnection::systemBus();
    QDBusMessage homeReadySignal =
        QDBusMessage::createSignal(HOME_READY_SIGNAL_PATH,
                                   HOME_READY_SIGNAL_INTERFACE,
                                   HOME_READY_SIGNAL_NAME);
    systemBus.send(homeReadySignal);

    // Stop the application after it's ready but only when run by upstart
    if (upstartMode) {
        static pid_t selfPid = getpid();
        kill(selfPid, SIGSTOP);
    }
}
Пример #12
0
void Timed::send_next_bootup_event(int value)
{
#if HAVE_DSME
  QDBusConnection dsme = QDBusConnection::systemBus() ;
  QString path = Maemo::Timed::objpath() ;
  QString iface = Maemo::Timed::interface() ;
  QString signal = "next_bootup_event" ;
  QDBusMessage m = QDBusMessage::createSignal(path, iface, signal) ;
  m << value ;
  if(dsme.send(m))
    log_info("signal %s(%d) sent", string_q_to_std(signal).c_str(), value) ;
  else
    log_error("Failed to send the signal %s(%d) on system bus: %s", string_q_to_std(signal).c_str(), value, dsme.lastError().message().toStdString().c_str()) ;
#endif
}
void DeclarativeDBusInterface::call(const QString &method, const QJSValue &arguments)
{
    QVariantList dbusArguments = argumentsFromScriptValue(arguments);

    QDBusMessage message = QDBusMessage::createMethodCall(
                m_service,
                m_path,
                m_interface,
                method);
    message.setArguments(dbusArguments);

    QDBusConnection conn = DeclarativeDBus::connection(m_bus);

    if (!conn.send(message))
        qmlInfo(this) << conn.lastError();
}
Пример #14
0
void GameScene::clickedDashboardButton()
{
#if defined Q_WS_MAEMO_5
    QDBusConnection connection = QDBusConnection::sessionBus();
    QDBusMessage message = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view");
    connection.send(message);
#elif (defined Q_OS_LINUX || defined Q_OS_MAC || defined Q_OS_WIN32) && !defined OS_IS_HARMATTAN && !defined OS_IS_ANDROID
    if(viewMode() == ViewNormal) {
        setViewMode(ViewFullScreen);
    } else {
        setViewMode(ViewNormal);
    }
#else
    qDebug() << "Dashboard button should not have been shown...";
#endif
}
Пример #15
0
void HomeApplication::sendStartupNotifications()
{
    static QDBusConnection systemBus = QDBusConnection::systemBus();
    QDBusMessage homeReadySignal =
        QDBusMessage::createSignal("/com/nokia/duihome",
                                   "com.nokia.duihome.readyNotifier",
                                   "ready");
    systemBus.send(homeReadySignal);

    /* Let systemd know that we are initialized */
    if (arguments().indexOf("--systemd") >= 0) {
        sd_notify(0, "READY=1");
    }

    /* Let timed know that the UI is up */
    systemBus.call(QDBusMessage::createSignal("/com/nokia/startup/signal", "com.nokia.startup.signal", "desktop_visible"), QDBus::NoBlock);
}
Пример #16
0
void DBusSender::sendSyncMessage()
{
	QDBusConnection	sessionBus = QDBusConnection::connectToBus(QDBusConnection::SessionBus, m_senderName);

	if (!sessionBus.isConnected()) {
		qDebug() << m_senderName << "connectToBus() failed";
		return;
	}

	QDBusMessage stream = QDBusMessage::createSignal(
								m_objNameBase + m_senderName,
								com::servicename::ifname::staticInterfaceName(),
								"syncSend");

	stream << m_sender.text().toLocal8Bit();
	sessionBus.send(stream);
}
Пример #17
0
bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnection& connection)
{
    /* Check to make sure we're getting properties on our interface */
    if (message.type() != QDBusMessage::MessageType::MethodCallMessage) {
        return false;
    }

    /* Break down the path to just the app id */
    bool validpath = true;
    QString pathtemp = message.path();
    if (!pathtemp.startsWith(QLatin1String("/com/canonical/Unity/Launcher/"))) {
        validpath = false;
    }
    pathtemp.remove(QStringLiteral("/com/canonical/Unity/Launcher/"));
    if (pathtemp.indexOf('/') >= 0) {
        validpath = false;
    }

    /* Find ourselves an appid */
    QString appid = decodeAppId(pathtemp);

    // First handle methods of the Launcher interface
    if (message.interface() == QLatin1String("com.canonical.Unity.Launcher")) {
        if (message.member() == QLatin1String("Refresh")) {
            QDBusMessage reply = message.createReply();
            Q_EMIT refreshCalled();
            return connection.send(reply);
        }
    } else if (message.interface() == QLatin1String("com.canonical.Unity.Launcher.Item")) {
        // Handle methods of the Launcher-Item interface
        if (message.member() == QLatin1String("Alert") && validpath) {
            QDBusMessage reply = message.createReply();
            Q_EMIT alertCalled(appid);
            return connection.send(reply);
        }
    }

    // Now handle dynamic properties (for launcher emblems)
    if (message.interface() != QLatin1String("org.freedesktop.DBus.Properties")) {
        return false;
    }

    if (message.member() == QLatin1String("Get") && (message.arguments().count() != 2 || message.arguments()[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) {
        return false;
    }

    if (message.member() == QLatin1String("Set") && (message.arguments().count() != 3 || message.arguments()[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) {
        return false;
    }

    if (!validpath) {
        return false;
    }

    int index = m_launcherModel->findApplication(appid);
    LauncherItem *item = static_cast<LauncherItem*>(m_launcherModel->get(index));

    QVariantList retval;
    if (message.member() == QLatin1String("Get")) {
        QString cachedString = message.arguments()[1].toString();
        if (!item) {
            return false;
        }
        if (cachedString == QLatin1String("count")) {
            retval.append(QVariant::fromValue(QDBusVariant(item->count())));
        } else if (cachedString == QLatin1String("countVisible")) {
            retval.append(QVariant::fromValue(QDBusVariant(item->countVisible())));
        } else if (cachedString == QLatin1String("progress")) {
            retval.append(QVariant::fromValue(QDBusVariant(item->progress())));
        }
    } else if (message.member() == QLatin1String("Set")) {
        QString cachedString = message.arguments()[1].toString();
        if (cachedString == QLatin1String("count")) {
            int newCount = message.arguments()[2].value<QDBusVariant>().variant().toInt();
            if (!item || newCount != item->count()) {
                Q_EMIT countChanged(appid, newCount);
                notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("count"), QVariant(newCount));
            }
        } else if (cachedString == QLatin1String("countVisible")) {
            bool newVisible = message.arguments()[2].value<QDBusVariant>().variant().toBool();
            if (!item || newVisible != item->countVisible()) {
                Q_EMIT countVisibleChanged(appid, newVisible);
                notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("countVisible"), newVisible);
            }
        } else if (cachedString == QLatin1String("progress")) {
            int newProgress = message.arguments()[2].value<QDBusVariant>().variant().toInt();
            if (!item || newProgress != item->progress()) {
                Q_EMIT progressChanged(appid, newProgress);
                notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("progress"), QVariant(newProgress));
            }
        }
    } else if (message.member() == QLatin1String("GetAll")) {
        if (item) {
            QVariantMap all;
            all.insert(QStringLiteral("count"), item->count());
            all.insert(QStringLiteral("countVisible"), item->countVisible());
            all.insert(QStringLiteral("progress"), item->progress());
            retval.append(all);
        }
    } else {
        return false;
    }

    QDBusMessage reply = message.createReply(retval);
    return connection.send(reply);
}
void SailorgramInterface::sendWakeUp()
{
    QDBusMessage message = QDBusMessage::createMethodCall(SailorgramInterface::INTERFACE_NAME, "/", SailorgramInterface::INTERFACE_NAME, "wakeUp");
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.send(message);
}