예제 #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()));
}
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()));
}
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";
    }
}
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()));
}
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()));
}
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
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"));
    }
}
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
Plasma::Service *TasksEngine::serviceForSource(const QString &name)
{
    Plasma::Service *service;
    if (name.isEmpty())
    {
	service = new TaskWindowService();
    } else if (name == "tasks") {
	service = new TaskService(m_tasksModel, m_groupManager);
    } else {
        service = Plasma::DataEngine::serviceForSource(name);
    }
    service->setParent(this);
    return service;
}
예제 #10
0
Plasma::Service *AppsEngine::serviceForSource(const QString &name)
{
    if (name == "Groups") {
        return Plasma::DataEngine::serviceForSource(name);
    }

    AppSource *source = dynamic_cast<AppSource*>(containerForSource(name));
    // if source does not exist, return null service
    if (!source) {
        return Plasma::DataEngine::serviceForSource(name);
    }

    // if source is a group of apps, return real service
    Plasma::Service *service = new AppService(source);
    service->setParent(this);
    return service;
}
예제 #11
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()));
}
예제 #12
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()));
}