コード例 #1
0
void ActivityManager::remove(QString id) {
  Plasma::Service *service = dataEngine("org.kde.activities")->serviceForSource(id);
  KConfigGroup op = service->operationDescription("remove");
  op.writeEntry("Id", id);
  Plasma::ServiceJob *job = service->startOperationCall(op);
  connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
}
コード例 #2
0
void FdoSelectionManagerPrivate::createNotification(WId winId)
{
    if (!tasks.contains(winId)) {
        kDebug() << "message request from unknown task" << winId;
        return;
    }

    MessageRequest &request = messageRequests[winId];
    Task *task = tasks[winId];

    QString message = QString::fromUtf8(request.message);
    message = QTextDocument(message).toHtml();

    if (!notificationsEngine) {
        notificationsEngine = Plasma::DataEngineManager::self()->loadEngine("notifications");
    }
    //FIXME: who is the source in this case?
    Plasma::Service *service = notificationsEngine->serviceForSource("notification");
    KConfigGroup op = service->operationDescription("createNotification");

    if (op.isValid()) {
        op.writeEntry("appName", task->name());
        //FIXME: find a way to pass icons trough here
        op.writeEntry("appIcon", task->name());

        //op.writeEntry("summary", task->name());
        op.writeEntry("body", message);
        op.writeEntry("timeout", (int)request.timeout);
        KJob *job = service->startOperationCall(op);
        QObject::connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
    } else {
        delete service;
        kDebug() << "invalid operation";
    }
}
コード例 #3
0
void WorkareasManager::setCurrentPreviousActivity()
{
    Plasma::Service *service = m_dataEngine->serviceForSource("");
    KConfigGroup op = service->operationDescription("setCurrentPreviousActivity");
    Plasma::ServiceJob *job = service->startOperationCall(op);
    connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
}
コード例 #4
0
void WorkareasManager::moveActivity(QString id, int position)
{
    Plasma::Service *service = m_dataEngine->serviceForSource(id);
    KConfigGroup op = service->operationDescription("setOrder");
    op.writeEntry("Order", position+1);
    Plasma::ServiceJob *job = service->startOperationCall(op);
    connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
}
コード例 #5
0
void WorkareasManager::cloneActivity(QString id)
{
    Plasma::Service *service = m_dataEngine->serviceForSource(id);
    KConfigGroup op = service->operationDescription("cloneActivity");
    //op.writeEntry("Activity", id);
    Plasma::ServiceJob *job = service->startOperationCall(op);
    connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
}
コード例 #6
0
void WorkareasManager::removeWorkarea(QString id, int desktop)
{
    Plasma::Service *service = m_dataEngine->serviceForSource(id);
    KConfigGroup op = service->operationDescription("removeWorkarea");
    op.writeEntry("Desktop", desktop);
    Plasma::ServiceJob *job = service->startOperationCall(op);
    connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
}
コード例 #7
0
ファイル: switch.cpp プロジェクト: mgottschlag/kwin-tiling
void SwitchWindow::switchTo(QAction *action)
{
    QString source = action->data().toString();
    kDebug() << source;
    Plasma::Service *service = dataEngine("tasks")->serviceForSource(source);
    if (service) {
        service->startOperationCall(service->operationDescription("activateRaiseOrIconify"));
    }
}
コード例 #8
0
void PlasmaServiceListModel::activate(int index)
{
    Plasma::Service * service =
        d->engine->serviceForSource("data");
    KConfigGroup cg = service->operationDescription("activate");

    QStringList list = d->data["data"].toStringList();
    cg.writeEntry("data", list.at(index));

    service->startOperationCall(cg);
}
コード例 #9
0
void ActivityManager::start(QString id) {
  Plasma::Service *service = dataEngine("org.kde.activities")->serviceForSource(id);
  Plasma::ServiceJob *job = service->startOperationCall(service->operationDescription("start"));
  connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
}
コード例 #10
0
void ActivityManager::stop(QString id) {
  // TODO: when activity is stopped, take a screenshot and use that icon
  Plasma::Service *service = dataEngine("org.kde.activities")->serviceForSource(id);
  Plasma::ServiceJob *job = service->startOperationCall(service->operationDescription("stop"));
  connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
}