[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdeplasma-addons/plasma/sreich/kickoff-netrunner] applets/kickoff-netrunner: add the apps dataengin
From:       Shaun Reich <shaun.reich () kdemail ! net>
Date:       2012-02-24 19:39:31
Message-ID: 20120224193931.9ADE2A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 63bbb76bd8f743365c3a261f49f6499d8302e84f by Shaun Reich.
Committed on 24/02/2012 at 17:25.
Pushed by sreich into branch 'plasma/sreich/kickoff-netrunner'.

add the apps dataengine, copy+paste from plasma-mobile

we're going to use this, which should leave far better results for us

M  +2    -0    applets/kickoff-netrunner/CMakeLists.txt
A  +16   -0    applets/kickoff-netrunner/apps/CMakeLists.txt
A  +47   -0    applets/kickoff-netrunner/apps/appjob.cpp     [License: LGPL (v2)]
A  +45   -0    applets/kickoff-netrunner/apps/appjob.h     [License: LGPL (v2)]
A  +85   -0    applets/kickoff-netrunner/apps/appsengine.cpp     [License: LGPL (v2)]
A  +45   -0    applets/kickoff-netrunner/apps/appsengine.h     [License: LGPL (v2)]
A  +41   -0    applets/kickoff-netrunner/apps/appservice.cpp     [License: LGPL (v2)]
A  +49   -0    applets/kickoff-netrunner/apps/appservice.h     [License: LGPL (v2)]
A  +108  -0    applets/kickoff-netrunner/apps/appsource.cpp     [License: LGPL (v2)]
A  +52   -0    applets/kickoff-netrunner/apps/appsource.h     [License: LGPL (v2)]
A  +89   -0    applets/kickoff-netrunner/apps/categoriessource.cpp     [License: LGPL \
(v2)] A  +50   -0    applets/kickoff-netrunner/apps/categoriessource.h     [License: \
LGPL (v2)] A  +108  -0    applets/kickoff-netrunner/apps/groupsource.cpp     \
[License: LGPL (v2)] A  +52   -0    applets/kickoff-netrunner/apps/groupsource.h     \
[License: LGPL (v2)] A  +105  -0    applets/kickoff-netrunner/apps/groupssource.cpp   \
[License: LGPL (v2)] A  +53   -0    applets/kickoff-netrunner/apps/groupssource.h     \
[License: LGPL (v2)] A  +9    -0    \
applets/kickoff-netrunner/apps/org.kde.active.apps.operations A  +40   -0    \
applets/kickoff-netrunner/apps/plasma-dataengine-org.kde.active.apps.desktop

http://commits.kde.org/kdeplasma-addons/63bbb76bd8f743365c3a261f49f6499d8302e84f

diff --git a/applets/kickoff-netrunner/CMakeLists.txt \
b/applets/kickoff-netrunner/CMakeLists.txt index 097250f..5e52dda 100644
--- a/applets/kickoff-netrunner/CMakeLists.txt
+++ b/applets/kickoff-netrunner/CMakeLists.txt
@@ -1,5 +1,7 @@
 project(kickoff-netrunner)
 
+add_subdirectory(apps)
+
 install(DIRECTORY package/
         DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/kickoff-netrunner)
 
diff --git a/applets/kickoff-netrunner/apps/CMakeLists.txt \
b/applets/kickoff-netrunner/apps/CMakeLists.txt new file mode 100644
index 0000000..8660e55
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/CMakeLists.txt
@@ -0,0 +1,16 @@
+set(apps_engine_SRCS
+    appsengine.cpp
+    appsource.cpp
+    appservice.cpp
+    appjob.cpp
+    categoriessource.cpp
+    groupsource.cpp
+    groupssource.cpp
+)
+
+kde4_add_plugin(plasma_engine_active_apps ${apps_engine_SRCS})
+target_link_libraries(plasma_engine_active_apps ${KDE4_KDEUI_LIBS} \
${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS}) +
+install(TARGETS plasma_engine_active_apps DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES plasma-dataengine-org.kde.active.apps.desktop DESTINATION \
${SERVICES_INSTALL_DIR}) +install(FILES org.kde.active.apps.operations DESTINATION \
                ${DATA_INSTALL_DIR}/plasma/services)
diff --git a/applets/kickoff-netrunner/apps/appjob.cpp \
b/applets/kickoff-netrunner/apps/appjob.cpp new file mode 100644
index 0000000..c3fc1ab
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/appjob.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "appjob.h"
+
+#include <KRun>
+
+AppJob::AppJob(AppSource *source, const QString &operation, QMap<QString, QVariant> \
&parameters, QObject *parent) : +    ServiceJob(source->objectName(), operation, \
parameters, parent), +    m_source(source)
+{
+}
+
+AppJob::~AppJob()
+{
+}
+
+void AppJob::start()
+{
+    const QString operation = operationName();
+    const QString path = parameters().value("Path").toString();
+
+    if (operation == "launch") {
+        new KRun(KUrl(path), 0);
+        setResult(true);
+        return;
+    }
+    setResult(false);
+}
+
+#include "appjob.moc"
diff --git a/applets/kickoff-netrunner/apps/appjob.h \
b/applets/kickoff-netrunner/apps/appjob.h new file mode 100644
index 0000000..0489f0a
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/appjob.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef TASKJOB_H
+#define TASKJOB_H
+
+// plasma
+#include <Plasma/ServiceJob>
+
+// own
+#include "appsource.h"
+
+class AppJob : public Plasma::ServiceJob
+{
+
+    Q_OBJECT
+
+    public:
+        AppJob(AppSource *source, const QString &operation, QMap<QString, QVariant> \
&parameters, QObject *parent = 0); +        ~AppJob();
+
+    protected:
+        void start();
+
+    private:
+        AppSource *m_source;
+
+};
+
+#endif // TASKJOB_H
diff --git a/applets/kickoff-netrunner/apps/appsengine.cpp \
b/applets/kickoff-netrunner/apps/appsengine.cpp new file mode 100644
index 0000000..f828c52
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/appsengine.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License version 2 as
+ *   published by the Free Software Foundation
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Library General Public License for more details
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "appsengine.h"
+#include "appsource.h"
+#include "appservice.h"
+#include "categoriessource.h"
+#include "groupsource.h"
+#include "groupssource.h"
+
+
+AppsEngine::AppsEngine(QObject *parent, const QVariantList &args) :
+    Plasma::DataEngine(parent, args)
+{
+    Q_UNUSED(args);
+}
+
+AppsEngine::~AppsEngine()
+{
+}
+
+bool AppsEngine::sourceRequestEvent(const QString &name)
+{
+    if (containerForSource(name)) {
+        return true;
+    }
+
+    if (name.startsWith("Apps")) {
+        AppSource *appSource = new AppSource(name, this);
+        addSource(appSource);
+        return true;
+    } else if (name.startsWith("Categories")) {
+        CategoriesSource *catSource = new CategoriesSource(name, this);
+        addSource(catSource);
+        return true;
+    } else if (name.startsWith("Groups")) {
+        GroupsSource *grpsSource = new GroupsSource(name, this);
+        addSource(grpsSource);
+        return true;
+    } else if (name.startsWith("Group")) {
+        GroupSource *grpSource = new GroupSource(name, this);
+        addSource(grpSource);
+        return true;
+    }
+
+    return false;
+}
+
+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;
+}
+
+K_EXPORT_PLASMA_DATAENGINE(apps, AppsEngine)
+
+#include "appsengine.moc"
diff --git a/applets/kickoff-netrunner/apps/appsengine.h \
b/applets/kickoff-netrunner/apps/appsengine.h new file mode 100644
index 0000000..2318dfd
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/appsengine.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License version 2 as
+ *   published by the Free Software Foundation
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Library General Public License for more details
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef APPSSENGINE_H
+#define APPSSENGINE_H
+
+// plasma
+#include <Plasma/DataEngine>
+#include <Plasma/Service>
+
+#include <KService>
+#include <KServiceGroup>
+
+/**
+ * Apps Data Engine
+ */
+class AppsEngine : public Plasma::DataEngine
+{
+    Q_OBJECT
+
+public:
+    AppsEngine(QObject *parent, const QVariantList &args);
+    ~AppsEngine();
+
+    bool sourceRequestEvent(const QString &name);
+    Plasma::Service *serviceForSource(const QString &name);
+};
+
+#endif // APPSSENGINE_H
diff --git a/applets/kickoff-netrunner/apps/appservice.cpp \
b/applets/kickoff-netrunner/apps/appservice.cpp new file mode 100644
index 0000000..6fbe8fc
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/appservice.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "appservice.h"
+
+// own
+#include "appjob.h"
+
+AppService::AppService(AppSource *source) :
+    Plasma::Service(source),
+    m_source(source)
+{
+    setName("org.kde.active.apps");
+}
+
+AppService::~AppService()
+{
+}
+
+Plasma::ServiceJob *AppService::createJob(const QString &operation, QMap<QString, \
QVariant> &parameters) +{
+    return new AppJob(m_source, operation, parameters, this);
+}
+
+#include "appservice.moc"
diff --git a/applets/kickoff-netrunner/apps/appservice.h \
b/applets/kickoff-netrunner/apps/appservice.h new file mode 100644
index 0000000..3b08eed
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/appservice.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef APPSSERVICE_H
+#define APPSSERVICE_H
+
+// plasma
+#include <Plasma/Service>
+#include <Plasma/ServiceJob>
+
+// own
+#include "appsource.h"
+
+/**
+ * App Service
+ */
+class AppService : public Plasma::Service
+{
+
+    Q_OBJECT
+
+    public:
+        AppService(AppSource *source);
+        ~AppService();
+
+    protected:
+        Plasma::ServiceJob *createJob(const QString &operation, QMap<QString, \
QVariant> &parameters); +
+    private:
+        AppSource *m_source;
+};
+
+#endif // APPSSERVICE_H
diff --git a/applets/kickoff-netrunner/apps/appsource.cpp \
b/applets/kickoff-netrunner/apps/appsource.cpp new file mode 100644
index 0000000..a033a84
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/appsource.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "appsource.h"
+
+#include <KDebug>
+#include <KServiceTypeTrader>
+#include <KSycoca>
+
+AppSource::AppSource(const QString &name, QObject *parent)
+    : Plasma::DataContainer(parent)
+{
+    setObjectName(name);
+
+    QStringList names = name.split(':');
+    if (names.length() == 2) {
+        m_categories = names.last().split('|');
+    }
+
+    KSharedConfigPtr ptr = KSharedConfig::openConfig("active-blacklistrc");
+    KConfigGroup config = KConfigGroup(ptr, "blacklist");
+    m_blackList = config.readEntry("apps", QStringList());
+    populate();
+    connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, \
SLOT(sycocaChanged(QStringList))); +}
+
+AppSource::~AppSource()
+{
+}
+
+void AppSource::sycocaChanged(const QStringList &changes)
+{
+    if (changes.contains("apps") || changes.contains("xdgdata-apps")) {
+        populate();
+    }
+}
+
+void AppSource::populate()
+{
+    QString query = "exist Exec";
+
+    if (!m_categories.isEmpty()) {
+        query += " and (";
+        bool first = true;
+        foreach (const QString &category, m_categories) {
+            if (!first) {
+                query += " or ";
+            }
+            first = false;
+            query += QString(" (exist Categories and '%1' ~subin \
Categories)").arg(category); +        }
+        query += ")";
+    }
+
+    //openSUSE: exclude YaST modules from the list
+    query += " and (not (exist Categories and 'X-SuSE-YaST' in Categories))";
+
+    // Filter out blacklisted apps as to not show too much crap
+    foreach (const QString appName, m_blackList) {
+        query += QString(" and (DesktopEntryName != '%1' )").arg(appName);
+    }
+    //kWarning()<<query;
+    KService::List services = KServiceTypeTrader::self()->query("Application", \
query); +
+    removeAllData();
+    Plasma::DataEngine::Data data;
+
+    foreach (const KService::Ptr &service, services) {
+        if (service->noDisplay()) {
+            continue;
+        }
+
+        QString description;
+        if (!service->genericName().isEmpty() && service->genericName() != \
service->name()) { +            description = service->genericName();
+        } else if (!service->comment().isEmpty()) {
+            description = service->comment();
+        }
+
+        data["iconName"] = service->icon();
+        data["name"] = service->name();
+        data["genericName"] = service->genericName();
+        data["description"] = description;
+        data["storageId"] = service->storageId();
+        data["entryPath"] = service->entryPath();
+        setData(service->storageId(), data);
+    }
+
+    checkForUpdate();
+}
+
+#include "appsource.moc"
diff --git a/applets/kickoff-netrunner/apps/appsource.h \
b/applets/kickoff-netrunner/apps/appsource.h new file mode 100644
index 0000000..10a6ed7
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/appsource.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef APPSOURCE_H
+#define APPSOURCE_H
+
+// plasma
+#include <Plasma/DataContainer>
+
+#include <KService>
+#include <KServiceGroup>
+
+/**
+ * App categories Source
+ */
+class AppSource : public Plasma::DataContainer
+{
+    Q_OBJECT
+
+public:
+    AppSource(const QString &name, QObject *parent = 0);
+    ~AppSource();
+
+protected:
+    Plasma::Service *createService();
+    void populate();
+
+private Q_SLOTS:
+    void sycocaChanged(const QStringList &changes);
+
+private:
+    QStringList m_categories;
+    QStringList m_blackList;
+};
+
+#endif // APPSOURCE_H
diff --git a/applets/kickoff-netrunner/apps/categoriessource.cpp \
b/applets/kickoff-netrunner/apps/categoriessource.cpp new file mode 100644
index 0000000..7748f70
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/categoriessource.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "categoriessource.h"
+
+#include <KDebug>
+#include <KServiceTypeTrader>
+#include <KSycoca>
+
+CategoriesSource::CategoriesSource(const QString &name, QObject *parent)
+    : Plasma::DataContainer(parent)
+{
+    setObjectName(name);
+
+    populate();
+    connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, \
SLOT(sycocaChanged(QStringList))); +}
+
+CategoriesSource::~CategoriesSource()
+{
+}
+
+void CategoriesSource::sycocaChanged(const QStringList &changes)
+{
+    if (changes.contains("apps") || changes.contains("xdgdata-apps")) {
+        populate();
+    }
+}
+
+void CategoriesSource::populate()
+{
+    QString query = "exist Exec";
+
+    //openSUSE: exclude YaST modules from the list
+    query += " and (not (exist Categories and 'X-SuSE-YaST' in Categories))";
+
+    KService::List services = KServiceTypeTrader::self()->query("Application", \
query); +
+    removeAllData();
+
+    QMap<QString, int> categoryWeights;
+
+    foreach (const KService::Ptr &service, services) {
+        if (service->noDisplay()) {
+            continue;
+        }
+
+        foreach (const QString &category, service->categories()) {
+            categoryWeights[category] = categoryWeights[category]+1;
+        }
+    }
+
+
+    QMap<QString, int>::const_iterator i = categoryWeights.constBegin();
+    while (i != categoryWeights.constEnd()) {
+        if (i.key().startsWith("X-") || i.key() == "KDE" || i.key() == "GNOME" || \
i.key() == "GTK" || i.key() == "Qt") { +            ++i;
+            continue;
+        }
+
+        Plasma::DataEngine::Data data;
+        data["name"] = i.key();
+        data["items"] = i.value();
+
+        setData(i.key(), data);
+
+        ++i;
+    }
+
+    checkForUpdate();
+}
+
+#include "categoriessource.moc"
diff --git a/applets/kickoff-netrunner/apps/categoriessource.h \
b/applets/kickoff-netrunner/apps/categoriessource.h new file mode 100644
index 0000000..8410175
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/categoriessource.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef CATEGORIESSOURCE_H
+#define CATEGORIESSOURCE_H
+
+// plasma
+#include <Plasma/DataContainer>
+
+#include <KService>
+#include <KServiceGroup>
+
+/**
+ * App Source
+ */
+class CategoriesSource : public Plasma::DataContainer
+{
+    Q_OBJECT
+
+public:
+    CategoriesSource(const QString &name, QObject *parent = 0);
+    ~CategoriesSource();
+
+protected:
+    void populate();
+
+private Q_SLOTS:
+    void sycocaChanged(const QStringList &changes);
+
+private:
+    QStringList m_categories;
+};
+
+#endif // CATEGORIESSOURCE_H
diff --git a/applets/kickoff-netrunner/apps/groupsource.cpp \
b/applets/kickoff-netrunner/apps/groupsource.cpp new file mode 100644
index 0000000..7515665
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/groupsource.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "groupsource.h"
+
+#include <KDebug>
+#include <KServiceTypeTrader>
+#include <KSycoca>
+
+GroupSource::GroupSource(const QString &name, QObject *parent)
+    : Plasma::DataContainer(parent)
+{
+    setObjectName(name);
+
+    QStringList split = name.split(':');
+    if (split.length() == 2) {
+        m_group = split.last();
+    }
+
+    if (m_group.isEmpty()) {
+        m_group = "/";
+    }
+
+    populate();
+    connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, \
SLOT(sycocaChanged(QStringList))); +}
+
+GroupSource::~GroupSource()
+{
+}
+
+void GroupSource::sycocaChanged(const QStringList &changes)
+{
+    if (changes.contains("apps") || changes.contains("xdgdata-apps")) {
+        populate();
+    }
+}
+
+void GroupSource::populate()
+{
+    KServiceGroup::Ptr group = KServiceGroup::group(m_group);
+
+    removeAllData();
+    loadGroup(group);
+    checkForUpdate();
+}
+
+void GroupSource::loadGroup(KServiceGroup::Ptr group)
+{
+    if (group && group->isValid()) {
+        KServiceGroup::List list = group->entries();
+
+        for( KServiceGroup::List::ConstIterator it = list.constBegin();
+             it != list.constEnd(); it++) {
+            const KSycocaEntry::Ptr p = (*it);
+
+            if (p->isType(KST_KService)) {
+                const KService::Ptr service = KService::Ptr::staticCast(p);
+
+                if (!service->noDisplay()) {
+                    QString genericName = service->genericName();
+                    if (genericName.isNull()) {
+                        genericName = service->comment();
+                    }
+                    QString description;
+                    if (!service->genericName().isEmpty() && service->genericName() \
!= service->name()) { +                        description = service->genericName();
+                    } else if (!service->comment().isEmpty()) {
+                        description = service->comment();
+                    }
+                    Plasma::DataEngine::Data data;
+                    data["iconName"] = service->icon();
+                    data["name"] = service->name();
+                    data["genericName"] = service->genericName();
+                    data["description"] = description;
+                    data["storageId"] = service->storageId();
+                    data["entryPath"] = service->entryPath();
+                    setData(service->storageId(), data);
+                }
+
+            } else if (p->isType(KST_KServiceGroup)) {
+                const KServiceGroup::Ptr subGroup = \
KServiceGroup::Ptr::staticCast(p); +
+                if (!subGroup->noDisplay() && subGroup->childCount() > 0) {
+                    loadGroup(subGroup);
+                }
+            }
+        }
+    }
+}
+
+#include "groupsource.moc"
diff --git a/applets/kickoff-netrunner/apps/groupsource.h \
b/applets/kickoff-netrunner/apps/groupsource.h new file mode 100644
index 0000000..d2530a9
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/groupsource.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef GROUPSOURCE_H
+#define GROUPSOURCE_H
+
+// plasma
+#include <Plasma/DataContainer>
+
+#include <KService>
+#include <KServiceGroup>
+
+/**
+ * App group Source
+ */
+class GroupSource : public Plasma::DataContainer
+{
+    Q_OBJECT
+
+public:
+    GroupSource(const QString &name, QObject *parent = 0);
+    ~GroupSource();
+
+protected:
+    Plasma::Service *createService();
+    void populate();
+    void loadGroup(KServiceGroup::Ptr group);
+
+private Q_SLOTS:
+    void sycocaChanged(const QStringList &changes);
+
+private:
+    QString m_group;
+};
+
+#endif // GROUPSOURCE_H
diff --git a/applets/kickoff-netrunner/apps/groupssource.cpp \
b/applets/kickoff-netrunner/apps/groupssource.cpp new file mode 100644
index 0000000..95e9d9a
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/groupssource.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "groupssource.h"
+
+#include <KDebug>
+#include <KServiceTypeTrader>
+#include <KSycoca>
+
+int GroupsSource::s_depth = 0;
+
+GroupsSource::GroupsSource(const QString &name, QObject *parent)
+    : Plasma::DataContainer(parent),
+      m_maxDepth(-1)
+{
+    setObjectName(name);
+
+    QStringList split = name.split(':');
+    if (split.length() >= 2) {
+        m_group = split[1];
+    }
+    if (split.length() == 3) {
+        m_maxDepth = split[2].toInt();
+    }
+
+    if (m_group.isEmpty()) {
+        m_group = "/";
+    }
+
+    populate();
+    connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, \
SLOT(sycocaChanged(QStringList))); +}
+
+GroupsSource::~GroupsSource()
+{
+}
+
+void GroupsSource::sycocaChanged(const QStringList &changes)
+{
+    if (changes.contains("apps") || changes.contains("xdgdata-apps")) {
+        populate();
+    }
+}
+
+void GroupsSource::populate()
+{
+    KServiceGroup::Ptr group = KServiceGroup::group(m_group);
+
+    s_depth = 0;
+    removeAllData();
+    loadGroup(group);
+    checkForUpdate();
+}
+
+void GroupsSource::loadGroup(KServiceGroup::Ptr group)
+{
+    if (m_maxDepth >= 0 && s_depth > m_maxDepth) {
+        return;
+    }
+    ++s_depth;
+
+    if (group && group->isValid()) {
+        KServiceGroup::List list = group->entries();
+
+        for( KServiceGroup::List::ConstIterator it = list.constBegin();
+             it != list.constEnd(); it++) {
+            const KSycocaEntry::Ptr p = (*it);
+
+            if (p->isType(KST_KServiceGroup)) {
+                const KServiceGroup::Ptr subGroup = \
KServiceGroup::Ptr::staticCast(p); +
+                Plasma::DataEngine::Data data;
+                data["iconName"] = subGroup->icon();
+                data["name"] = subGroup->name();
+                data["description"] = subGroup->comment();
+                data["relPath"] = subGroup->relPath();
+                data["display"] = !subGroup->noDisplay();
+                data["childCount"] = subGroup->childCount();
+                setData(subGroup->relPath(), data);
+
+                if (!subGroup->noDisplay() && subGroup->childCount() > 0) {
+                    loadGroup(subGroup);
+                }
+            }
+        }
+    }
+}
+
+#include "groupssource.moc"
diff --git a/applets/kickoff-netrunner/apps/groupssource.h \
b/applets/kickoff-netrunner/apps/groupssource.h new file mode 100644
index 0000000..ac46824
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/groupssource.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2009 Chani Armitage <chani@kde.org>
+ * Copyright 2011 Marco Martin <mart@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef GROUPSSOURCE_H
+#define GROUPSSOURCE_H
+
+// plasma
+#include <Plasma/DataContainer>
+
+#include <KService>
+#include <KServiceGroup>
+
+/**
+ * App groups listing Source
+ */
+class GroupsSource : public Plasma::DataContainer
+{
+    Q_OBJECT
+
+public:
+    GroupsSource(const QString &name, QObject *parent = 0);
+    ~GroupsSource();
+
+protected:
+    void populate();
+    void loadGroup(KServiceGroup::Ptr group);
+
+private Q_SLOTS:
+    void sycocaChanged(const QStringList &changes);
+
+private:
+    QString m_group;
+    int m_maxDepth;
+    static int s_depth;
+};
+
+#endif // GROUPSSOURCE_H
diff --git a/applets/kickoff-netrunner/apps/org.kde.active.apps.operations \
b/applets/kickoff-netrunner/apps/org.kde.active.apps.operations new file mode 100644
index 0000000..34c3ba5
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/org.kde.active.apps.operations
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
+<kcfg>
+    <group name="launch">
+        <entry name="Path" type="String">
+            <label>The path to launch</label>
+        </entry>
+    </group>
+</kcfg>
diff --git a/applets/kickoff-netrunner/apps/plasma-dataengine-org.kde.active.apps.desktop \
b/applets/kickoff-netrunner/apps/plasma-dataengine-org.kde.active.apps.desktop new \
file mode 100644 index 0000000..f31dff0
--- /dev/null
+++ b/applets/kickoff-netrunner/apps/plasma-dataengine-org.kde.active.apps.desktop
@@ -0,0 +1,40 @@
+[Desktop Entry]
+Name=Application Information
+Name[cs]=Informace o aplikaci
+Name[es]=Información de aplicaciones
+Name[et]=Rakenduse teave
+Name[ga]=Eolas faoi Fheidhmchláir
+Name[nl]=Programmainformatie
+Name[pl]=Informacja o programie
+Name[pt]=Informação da Aplicação
+Name[pt_BR]=Informações do aplicativo
+Name[sv]=Information om program
+Name[ug]=پروگرامما ئۇچۇرى
+Name[uk]=Відомості щодо програм
+Name[x-test]=xxApplication Informationxx
+Comment=Information and launching of all applications in the app menu.
+Comment[cs]=Informace a spouštění všech aplikací v menu aplikací.
+Comment[de]=Informationen und Starten aller Anwendungen im Programmmenü.
+Comment[et]=Kõigi rakenduste menüü rakenduste teave ja käivitamine.
+Comment[nl]=Informatie en starten van alle programma's in het progmenu.
+Comment[pl]=Informacje i uruchamianie wszystkich programów w menu programów.
+Comment[pt]=Informação e lançamento de todas as aplicações no menu de \
aplicações. +Comment[pt_BR]=Informação e inicialização de todos os aplicativos \
no menu de aplicativos. +Comment[sv]=Information om och start av alla program i \
programmenyn. +Comment[ug]=ئۇچۇر كۆرسىتىدۇ ياكى \
تىزىملىكتىكى ھەممە پروگراممىلارنى ئىجرا \
قىلىدۇ +Comment[uk]=Відомості і запуск всіх \
програма з меню програм. +Comment[x-test]=xxInformation and \
launching of all applications in the app menu.xx +Type=Service
+Icon=user-desktop
+
+X-KDE-ServiceTypes=Plasma/DataEngine
+X-KDE-Library=plasma_engine_active_apps
+
+X-KDE-PluginInfo-Author=Chani
+X-KDE-PluginInfo-Email=chani@kde.org
+X-KDE-PluginInfo-Name=org.kde.active.apps
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=http://plasma.kde.org/
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=LGPL
+X-KDE-PluginInfo-EnabledByDefault=true


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic