Пример #1
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;
}
Пример #2
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;
}