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

List:       kde-commits
Subject:    =?utf-8?q?=5Bkdelibs/libkactivities/resourceinstance=5D_experime?=
From:       Ivan Čukić <ivan.cukic () kde ! org>
Date:       2011-05-31 19:22:41
Message-ID: 20110531192241.71C4AA60A4 () git ! kde ! org
[Download RAW message or body]

Git commit 0da4d8f64edf2ead07e2a8d66fd2efbdb5c32a25 by Ivan Čukić.
Committed on 31/05/2011 at 19:40.
Pushed by ivan into branch 'libkactivities/resourceinstance'.

- Template for the ResourceInstance class
- Refactoring KActivitySmth -> Activities::Smth

M  +10   -8    experimental/libkactivities/CMakeLists.txt     
A  +90   -0    experimental/libkactivities/consumer.cpp         [License: LGPL (v2)]
A  +123  -0    experimental/libkactivities/consumer.h         [License: LGPL (v2)]
A  +31   -0    experimental/libkactivities/consumer_p.h         [License: LGPL (v2)]
A  +93   -0    experimental/libkactivities/controller.cpp         [License: LGPL \
(v2)] A  +122  -0    experimental/libkactivities/controller.h         [License: LGPL \
(v2)] A  +183  -0    experimental/libkactivities/info.cpp         [License: LGPL \
(v2)] A  +176  -0    experimental/libkactivities/info.h         [License: LGPL (v2)]
A  +46   -0    experimental/libkactivities/info_p.h         [License: LGPL (v2)]
D  +0    -86   experimental/libkactivities/kactivityconsumer.cpp     
D  +0    -118  experimental/libkactivities/kactivityconsumer.h     
D  +0    -27   experimental/libkactivities/kactivityconsumer_p.h     
D  +0    -89   experimental/libkactivities/kactivitycontroller.cpp     
D  +0    -117  experimental/libkactivities/kactivitycontroller.h     
D  +0    -179  experimental/libkactivities/kactivityinfo.cpp     
D  +0    -169  experimental/libkactivities/kactivityinfo.h     
D  +0    -42   experimental/libkactivities/kactivityinfo_p.h     
D  +0    -83   experimental/libkactivities/kactivitymanager_p.cpp     
D  +0    -49   experimental/libkactivities/kactivitymanager_p.h     
A  +87   -0    experimental/libkactivities/manager_p.cpp         [License: GPL (v2)]
A  +52   -0    experimental/libkactivities/manager_p.h         [License: GPL (v2)]
A  +82   -0    experimental/libkactivities/resourceinstance.cpp         [License: GPL \
(v2)] A  +163  -0    experimental/libkactivities/resourceinstance.h         [License: \
GPL (v2)]

http://commits.kde.org/kdelibs/0da4d8f64edf2ead07e2a8d66fd2efbdb5c32a25

diff --git a/experimental/libkactivities/CMakeLists.txt \
b/experimental/libkactivities/CMakeLists.txt index 50cd86e..24d52d9 100644
--- a/experimental/libkactivities/CMakeLists.txt
+++ b/experimental/libkactivities/CMakeLists.txt
@@ -10,10 +10,11 @@ include_directories(
 set(
    kactivities_LIB_SRCS
 
-   kactivityconsumer.cpp
-   kactivitycontroller.cpp
-   kactivityinfo.cpp
-   kactivitymanager_p.cpp
+   consumer.cpp
+   controller.cpp
+   info.cpp
+   manager_p.cpp
+   resourceinstance.cpp
    )
 
 qt4_add_dbus_interface(
@@ -45,14 +46,15 @@ target_link_libraries(
 
 set(
    kactivities_LIB_HEADERS
-   kactivityconsumer.h
-   kactivitycontroller.h
-   kactivityinfo.h
+   consumer.h
+   controller.h
+   info.h
+   resourceinstance.h
    )
 
 install(
    FILES ${kactivities_LIB_HEADERS}
-   DESTINATION ${INCLUDE_INSTALL_DIR}/
+   DESTINATION ${INCLUDE_INSTALL_DIR}/libkactivities
    COMPONENT Devel
    )
 
diff --git a/experimental/libkactivities/consumer.cpp \
b/experimental/libkactivities/consumer.cpp new file mode 100644
index 0000000..8acbd8b
--- /dev/null
+++ b/experimental/libkactivities/consumer.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "consumer.h"
+#include "consumer_p.h"
+#include "manager_p.h"
+
+#include <kdebug.h>
+
+namespace Activities {
+
+Consumer::Consumer(QObject * parent)
+    : QObject(parent), d(new ConsumerPrivate())
+{
+    connect(
+        Manager::self(), SIGNAL(CurrentActivityChanged(const QString &)),
+        this,                     SIGNAL(currentActivityChanged(const QString &))
+    );
+}
+
+Consumer::~Consumer()
+{
+    delete d;
+}
+
+// macro defines a shorthand for validating and returning a d-bus result
+// @param TYPE type of the result
+// @param METHOD invocation of the d-bus method
+// @param DEFAULT value to be used if the reply was not valid
+#define KACTIVITYCONSUMER_DBUS_RETURN(TYPE, METHOD, DEFAULT)  \
+    QDBusReply < TYPE > dbusReply = METHOD;                   \
+    if (dbusReply.isValid()) {                                \
+        return dbusReply.value();                             \
+    } else {                                                  \
+        kDebug() << "d-bus reply was invalid"                 \
+                 << dbusReply.value()                         \
+                 << dbusReply.error();                        \
+        return DEFAULT;                                       \
+    }
+
+QString Consumer::currentActivity() const
+{
+    KACTIVITYCONSUMER_DBUS_RETURN(
+        QString, Manager::self()->CurrentActivity(), QString() );
+}
+
+QStringList Consumer::listActivities(Info::State state) const
+{
+    KACTIVITYCONSUMER_DBUS_RETURN(
+        QStringList, Manager::self()->ListActivities(state), QStringList() );
+}
+
+QStringList Consumer::listActivities() const
+{
+    KACTIVITYCONSUMER_DBUS_RETURN(
+        QStringList, Manager::self()->ListActivities(), QStringList() );
+}
+
+#undef KACTIVITYCONSUMER_DBUS_RETURN
+
+Consumer::ServiceStatus Consumer::serviceStatus()
+{
+    if (!Manager::isActivityServiceRunning()) {
+        return NotRunning;
+    }
+
+    if (!Manager::self()->IsBackstoreAvailable()) {
+        return BareFunctionality;
+    }
+
+    return FullFunctionality;
+}
+
+} // namespace Activities
+
diff --git a/experimental/libkactivities/consumer.h \
b/experimental/libkactivities/consumer.h new file mode 100644
index 0000000..f04b0ef
--- /dev/null
+++ b/experimental/libkactivities/consumer.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ACTIVITY_CONSUMER_H
+#define ACTIVITY_CONSUMER_H
+
+#include <QObject>
+#include <QWidget>
+#include <QString>
+#include <QStringList>
+
+#include "info.h"
+
+#include <kurl.h>
+#include <kdemacros.h>
+
+namespace Activities {
+
+class ConsumerPrivate;
+
+/**
+ * Contextual information can be, from the user's point of view, divided
+ * into three aspects - "who am I?", "where am I?" (what are my surroundings?)
+ * and "what am I doing?".
+ *
+ * Activities deal with the last one - "what am I doing?". The current activity
+ * refers to what the user is doing at the moment, while the other activities \
represent + * things that he/she was doing before, and probably will be doing again.
+ *
+ * Activity is an abstract concept whose meaning can differ from one user to \
another. + * Typical examples of activities are "developing a KDE project", "studying \
the + * 19th century art", "composing music", "lazing on a Sunday afternoon" etc.
+ *
+ * Every activity can have applications, documents, or other types of resources
+ * assigned to it.
+ *
+ * Consumer provides an entry-level API for supporting activities in an
+ * application - to react to the changes to the current activity as well as
+ * registering the resources with its windows.
+ *
+ * Resource can be anything that is identifiable by an URI (for example,
+ * a local file or a web page)
+ *
+ * @since 4.5
+ */
+class KDE_EXPORT Consumer: public QObject {
+    Q_OBJECT
+
+    Q_PROPERTY(QString currentActivity READ currentActivity)
+    Q_PROPERTY(QStringList activities READ listActivities)
+
+public:
+    /**
+     * Different states of the activities service
+     */
+    enum ServiceStatus {
+        NotRunning,        ///< Service is not running
+        BareFunctionality, ///< Service is running without a sane backend
+        FullFunctionality  ///< Service is running, and a backend is available
+    };
+
+    explicit Consumer(QObject * parent = 0);
+
+    ~Consumer();
+
+    /**
+     * @returns the id of the current activity
+     */
+    QString currentActivity() const;
+
+    /**
+     * @returns the list of activities filtered by state
+     * @param state state of the activity
+     */
+    QStringList listActivities(Info::State state) const;
+
+    /**
+     * @returns the list of all existing activities
+     */
+    QStringList listActivities() const;
+
+    /**
+     * @returns status of the activities service
+     */
+    static ServiceStatus serviceStatus();
+
+Q_SIGNALS:
+    /**
+     * This signal is emitted when the global
+     * activity is changed
+     * @param id id of the new current activity
+     */
+    void currentActivityChanged(const QString & id);
+
+    /**
+     * This signal is emitted when the activity service
+     * goes online or offline
+     * @param status new status of the service
+     */
+    void serviceStatusChanged(Consumer::ServiceStatus status);
+
+private:
+    ConsumerPrivate * const d;
+};
+
+} // namespace Activities
+
+#endif // ACTIVITY_CONSUMER_H
diff --git a/experimental/libkactivities/consumer_p.h \
b/experimental/libkactivities/consumer_p.h new file mode 100644
index 0000000..4abac79
--- /dev/null
+++ b/experimental/libkactivities/consumer_p.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ACTIVITYCONSUMER_P_H
+#define ACTIVITYCONSUMER_P_H
+
+#include "activitymanager_interface.h"
+
+namespace Activities {
+
+class ConsumerPrivate {
+};
+
+} // namespace Activities
+
+#endif // ACTIVITY_CONSUMER_H
diff --git a/experimental/libkactivities/controller.cpp \
b/experimental/libkactivities/controller.cpp new file mode 100644
index 0000000..9ba422f
--- /dev/null
+++ b/experimental/libkactivities/controller.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "controller.h"
+#include "consumer_p.h"
+#include "manager_p.h"
+
+#include <QObject>
+
+#include <kdebug.h>
+
+namespace Activities {
+
+class ControllerPrivate: public QObject {
+public:
+    ControllerPrivate(Controller * parent)
+        : q(parent)
+    {
+    }
+
+private:
+    Controller * const q;
+};
+
+Controller::Controller(QObject * parent)
+    : Consumer(parent), d(new ControllerPrivate(this))
+{
+    connect(Manager::self(), SIGNAL(ActivityAdded(QString)),
+            this, SIGNAL(activityAdded(QString)));
+
+    connect(Manager::self(), SIGNAL(ActivityRemoved(QString)),
+            this, SIGNAL(activityRemoved(QString)));
+
+}
+
+Controller::~Controller()
+{
+    delete d;
+}
+
+void Controller::setActivityName(const QString & id, const QString & name)
+{
+    Manager::self()->SetActivityName(id, name);
+}
+
+void Controller::setActivityIcon(const QString & id, const QString & icon)
+{
+    Manager::self()->SetActivityIcon(id, icon);
+}
+
+bool Controller::setCurrentActivity(const QString & id)
+{
+    return Manager::self()->SetCurrentActivity(id);
+}
+
+QString Controller::addActivity(const QString & name)
+{
+    return Manager::self()->AddActivity(name);
+}
+
+void Controller::removeActivity(const QString & id)
+{
+    Manager::self()->RemoveActivity(id);
+}
+
+void Controller::stopActivity(const QString & id)
+{
+    Manager::self()->StopActivity(id);
+}
+
+void Controller::startActivity(const QString & id)
+{
+    Manager::self()->StartActivity(id);
+}
+
+} // namespace Activities
+
+#include "controller.moc"
diff --git a/experimental/libkactivities/controller.h \
b/experimental/libkactivities/controller.h new file mode 100644
index 0000000..3b0273f
--- /dev/null
+++ b/experimental/libkactivities/controller.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ACTIVITY_CONTROLLER_H
+#define ACTIVITY_CONTROLLER_H
+
+#include <QObject>
+#include <QWidget>
+#include <QString>
+#include <QStringList>
+
+#include "consumer.h"
+
+#include <kurl.h>
+#include <kdemacros.h>
+
+namespace Activities {
+
+class ControllerPrivate;
+
+/**
+ * This class provides methods for controlling and managing
+ * the activities.
+ *
+ * @see Consumer for info about activities
+ *
+ * @since 4.5
+ */
+class KDE_EXPORT Controller: public Consumer
+{
+    Q_OBJECT
+
+    Q_PROPERTY(QString currentActivity READ currentActivity WRITE \
setCurrentActivity) +
+public:
+    explicit Controller(QObject * parent = 0);
+
+    ~Controller();
+
+    /**
+     * Sets the name of the specified activity
+     * @param id id of the activity
+     * @param name name to be set
+     */
+    void setActivityName(const QString & id, const QString & name);
+
+    /**
+     * Sets the icon of the specified activity
+     * @param id id of the activity
+     * @param icon icon to be set - freedesktop.org name or file path
+     */
+    void setActivityIcon(const QString & id, const QString & icon);
+
+    /**
+     * Sets the current activity
+     * @param id id of the activity to make current
+     * @returns true if successful
+     */
+    bool setCurrentActivity(const QString & id);
+
+    /**
+     * Adds a new activity
+     * @param name name of the activity
+     * @returns id of the newly created activity
+     */
+    QString addActivity(const QString & name);
+
+    /**
+     * Removes the specified activity
+     * @param id id of the activity to delete
+     */
+    void removeActivity(const QString & id);
+
+    /**
+     * Stops the activity
+     * @param id id of the activity to stop
+     */
+    void stopActivity(const QString & id);
+
+    /**
+     * Starts the activity
+     * @param id id of the activity to start
+     */
+    void startActivity(const QString & id);
+
+Q_SIGNALS:
+    /**
+     * This signal is emitted when the global
+     * activity is changed
+     * @param id id of the new current activity
+     */
+    void activityAdded(const QString & id);
+
+    /**
+     * This signal is emitted when the activity
+     * is removed
+     * @param id id of the removed activity
+     */
+    void activityRemoved(const QString & id);
+
+private:
+    ControllerPrivate * const d;
+};
+
+} // namespace Activities
+
+#endif // ACTIVITY_CONTROLLER_H
diff --git a/experimental/libkactivities/info.cpp \
b/experimental/libkactivities/info.cpp new file mode 100644
index 0000000..a8bd791
--- /dev/null
+++ b/experimental/libkactivities/info.cpp
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kdebug.h>
+
+#include "info.h"
+#include "info_p.h"
+#include "manager_p.h"
+
+namespace Activities {
+
+// Private
+
+InfoPrivate::InfoPrivate(Info *info, const QString &activityId)
+    : q(info),
+      state(Info::Invalid),
+      id(activityId)
+{
+    Manager::self();
+}
+
+#define IMPLEMENT_SIGNAL_HANDLER(ORIGINAL, INTERNAL) \
+    void InfoPrivate::INTERNAL(const QString & _id) const  \
+    {                                                                 \
+        if (id == _id) emit q->INTERNAL();                            \
+    }
+
+IMPLEMENT_SIGNAL_HANDLER(ActivityAdded,   added)
+IMPLEMENT_SIGNAL_HANDLER(ActivityRemoved, removed)
+IMPLEMENT_SIGNAL_HANDLER(ActivityStarted, started)
+IMPLEMENT_SIGNAL_HANDLER(ActivityStopped, stopped)
+IMPLEMENT_SIGNAL_HANDLER(ActivityChanged, infoChanged)
+
+#undef IMPLEMENT_SIGNAL_HANDLER
+
+void InfoPrivate::activityStateChanged(const QString & idChanged, int newState)
+{
+    if (idChanged == id) {
+        state = static_cast<Info::State>(newState);
+        emit q->stateChanged(state);
+    }
+}
+
+// Info
+Info::Info(const QString &activityId, QObject *parent)
+    : QObject(parent),
+      d(new InfoPrivate(this, activityId))
+{
+    d->id = activityId;
+    connect(Manager::self(), SIGNAL(ActivityStateChanged(const QString &, int)),
+            this, SLOT(activityStateChanged(const QString &, int)));
+
+    connect(Manager::self(), SIGNAL(ActivityChanged(const QString &)),
+            this, SLOT(infoChanged(const QString &)));
+
+    connect(Manager::self(), SIGNAL(ActivityAdded(const QString &)),
+            this, SLOT(added(const QString &)));
+
+    connect(Manager::self(), SIGNAL(ActivityRemoved(const QString &)),
+            this, SLOT(removed(const QString &)));
+
+    connect(Manager::self(), SIGNAL(ActivityStarted(const QString &)),
+            this, SLOT(started(const QString &)));
+
+    connect(Manager::self(), SIGNAL(ActivityStopped(const QString &)),
+            this, SLOT(stopped(const QString &)));
+}
+
+Info::~Info()
+{
+    delete d;
+}
+
+bool Info::isValid() const
+{
+    return (state() != Invalid);
+}
+
+// macro defines a shorthand for validating and returning a d-bus result
+// @param REPLY_TYPE type of the d-bus result
+// @param CAST_TYPE type to which to cast the result
+// @param METHOD invocation of the d-bus method
+#define KACTIVITYINFO_DBUS_CAST_RETURN(REPLY_TYPE, CAST_TYPE, METHOD)  \
+    QDBusReply < REPLY_TYPE > dbusReply = METHOD;                      \
+    if (dbusReply.isValid()) {                                         \
+        return (CAST_TYPE)(dbusReply.value());                         \
+    } else {                                                           \
+        return CAST_TYPE();                                            \
+    }
+
+
+KUrl Info::uri() const
+{
+    // TODO:
+    return KUrl();
+    // KACTIVITYINFO_DBUS_CAST_RETURN(
+    //     QString, KUrl, Private::s_store->uri(d->id));
+}
+
+KUrl Info::resourceUri() const
+{
+    // TODO:
+    return KUrl();
+    // KACTIVITYINFO_DBUS_CAST_RETURN(
+    //     QString, KUrl, Private::s_store->resourceUri(d->id));
+}
+
+QString Info::id() const
+{
+    return d->id;
+}
+
+QString Info::name() const
+{
+    KACTIVITYINFO_DBUS_CAST_RETURN(
+        QString, QString, Manager::self()->ActivityName(d->id));
+}
+
+QString Info::icon() const
+{
+    KACTIVITYINFO_DBUS_CAST_RETURN(
+        QString, QString, Manager::self()->ActivityIcon(d->id));
+}
+
+Info::State Info::state() const
+{
+    if (d->state == Invalid) {
+        QDBusReply < int > dbusReply = Manager::self()->ActivityState(d->id);
+
+        if (dbusReply.isValid()) {
+            d->state = (State)(dbusReply.value());
+        }
+    }
+
+    return d->state;
+}
+
+QString Info::name(const QString & id)
+{
+    KACTIVITYINFO_DBUS_CAST_RETURN(
+            QString, QString, Manager::self()->ActivityName(id));
+}
+
+#undef KACTIVITYINFO_DBUS_CAST_RETURN
+
+Info::Availability Info::availability() const
+{
+    Availability result = Nothing;
+
+    if (!Manager::isActivityServiceRunning()) {
+        return result;
+    }
+
+    if (Manager::self()->ListActivities().value().contains(d->id)) {
+        result = BasicInfo;
+
+        if (Manager::self()->IsBackstoreAvailable()) {
+            result = Everything;
+        }
+    }
+
+    return result;
+}
+
+} // namespace Activities
+
+#include "info.moc"
+
diff --git a/experimental/libkactivities/info.h b/experimental/libkactivities/info.h
new file mode 100644
index 0000000..07511e1
--- /dev/null
+++ b/experimental/libkactivities/info.h
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ACTIVITY_INFO_H
+#define ACTIVITY_INFO_H
+
+#include <QObject>
+#include <QWidget>
+#include <QString>
+#include <QStringList>
+
+#include <kurl.h>
+#include <kdemacros.h>
+
+namespace Activities {
+
+class InfoPrivate;
+
+/**
+ * This class provides info about an activity. Most methods in it
+ * require a Nepomuk backend running.
+ *
+ * @see Consumer for info about activities
+ *
+ * @since 4.5
+ */
+class KDE_EXPORT Info: public QObject
+{
+    Q_OBJECT
+
+    Q_PROPERTY(KUrl uri READ uri)
+    Q_PROPERTY(KUrl resourceUri READ resourceUri)
+    Q_PROPERTY(QString id READ id)
+    Q_PROPERTY(QString name READ name)
+
+public:
+    explicit Info(const QString & activityId, QObject *parent=0);
+    ~Info();
+
+    /**
+     * @return true if the activity represented by this object exists and is valid
+     */
+    bool isValid() const;
+
+    /**
+     * Specifies which parts of this class are functional
+     */
+    enum Availability {
+        Nothing = 0,             ///< No activity info provided (isValid is false)
+        BasicInfo = 1,           ///< Basic info is provided
+        Everything = 2           ///< Everything is available
+    };
+
+    /**
+     * State of the activity
+     */
+    enum State {
+        Invalid  = 0,
+        Running  = 2,
+        Starting = 3,
+        Stopped  = 4,
+        Stopping = 5
+    };
+
+    /**
+     * @returns what info is provided by this instance of Info
+     */
+    Availability availability() const;
+
+    /**
+     * @returns the URI of this activity. The same URI is used by
+     * activities KIO slave.
+     * @note Functional only when availability is Everything
+     */
+    KUrl uri() const;
+
+    /**
+     * @returns the Nepomuk resource URI of this activity
+     * @note Functional only when availability is Everything
+     */
+    KUrl resourceUri() const;
+
+    /**
+     * @returns the id of the activity
+     */
+    QString id() const;
+
+    /**
+     * @returns the name of the activity
+     * @note Functional when availability is BasicInfo or Everything
+     */
+    QString name() const;
+
+    /**
+     * @returns the icon of the activity. Icon can be a
+     * freedesktop.org name or a file path. Or empty if
+     * no icon is set.
+     * @note Functional only when availability is Everything
+     */
+    QString icon() const;
+
+    /**
+     * @returns the state of the activity
+     */
+    State state() const;
+
+    /**
+     * This function is provided for convenience.
+     * @returns the name of the specified activity
+     * @param id id of the activity
+     */
+    static QString name(const QString & id);
+
+Q_SIGNALS:
+    /**
+     * Emitted when the activity's name, icon or description is changed
+     */
+    void infoChanged();
+
+    /**
+     * Emitted when the activity is added
+     */
+    void added();
+
+    /**
+     * Emitted when the activity is removed
+     */
+    void removed();
+
+    /**
+     * Emitted when the activity is started
+     */
+    void started();
+
+    /**
+     * Emitted when the activity is stopped
+     */
+    void stopped();
+
+    /**
+     * Emitted when the activity changes state
+     * @param state new state of the activity
+     */
+    void stateChanged(Info::State state);
+
+private:
+    InfoPrivate * const d;
+
+    Q_PRIVATE_SLOT(d, void activityStateChanged(const QString &, int))
+    Q_PRIVATE_SLOT(d, void added(const QString &))
+    Q_PRIVATE_SLOT(d, void removed(const QString &))
+    Q_PRIVATE_SLOT(d, void started(const QString &))
+    Q_PRIVATE_SLOT(d, void stopped(const QString &))
+    Q_PRIVATE_SLOT(d, void infoChanged(const QString &))
+
+    friend class InfoPrivate;
+};
+
+} // namespace Activities
+
+#endif // ACTIVITY_INFO_H
diff --git a/experimental/libkactivities/info_p.h \
b/experimental/libkactivities/info_p.h new file mode 100644
index 0000000..61db93f
--- /dev/null
+++ b/experimental/libkactivities/info_p.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ACTIVITY_INFO_PH
+#define ACTIVITY_INFO_PH
+
+#include "activitymanager_interface.h"
+#include "info.h"
+
+namespace Activities {
+
+class InfoPrivate {
+public:
+    InfoPrivate(Info * info, const QString & activityId);
+
+    void activityStateChanged(const QString &, int);
+
+    void added(const QString &) const;
+    void removed(const QString &) const;
+    void started(const QString &) const;
+    void stopped(const QString &) const;
+    void infoChanged(const QString &) const;
+
+    Info *q;
+    Info::State state;
+    QString id;
+};
+
+} // namespace Activities
+
+#endif // ACTIVITY_INFO_PH
diff --git a/experimental/libkactivities/kactivityconsumer.cpp \
b/experimental/libkactivities/kactivityconsumer.cpp deleted file mode 100644
index 5ce5443..0000000
--- a/experimental/libkactivities/kactivityconsumer.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "kactivityconsumer.h"
-#include "kactivityconsumer_p.h"
-#include "kactivitymanager_p.h"
-
-#include <kdebug.h>
-
-KActivityConsumer::KActivityConsumer(QObject * parent)
-    : QObject(parent), d(new KActivityConsumerPrivate())
-{
-    connect(
-        KActivityManager::self(), SIGNAL(CurrentActivityChanged(const QString &)),
-        this,                     SIGNAL(currentActivityChanged(const QString &))
-    );
-}
-
-KActivityConsumer::~KActivityConsumer()
-{
-    delete d;
-}
-
-// macro defines a shorthand for validating and returning a d-bus result
-// @param TYPE type of the result
-// @param METHOD invocation of the d-bus method
-// @param DEFAULT value to be used if the reply was not valid
-#define KACTIVITYCONSUMER_DBUS_RETURN(TYPE, METHOD, DEFAULT)  \
-    QDBusReply < TYPE > dbusReply = METHOD;                   \
-    if (dbusReply.isValid()) {                                \
-        return dbusReply.value();                             \
-    } else {                                                  \
-        kDebug() << "d-bus reply was invalid"                 \
-                 << dbusReply.value()                         \
-                 << dbusReply.error();                        \
-        return DEFAULT;                                       \
-    }
-
-QString KActivityConsumer::currentActivity() const
-{
-    KACTIVITYCONSUMER_DBUS_RETURN(
-        QString, KActivityManager::self()->CurrentActivity(), QString() );
-}
-
-QStringList KActivityConsumer::listActivities(KActivityInfo::State state) const
-{
-    KACTIVITYCONSUMER_DBUS_RETURN(
-        QStringList, KActivityManager::self()->ListActivities(state), QStringList() \
                );
-}
-
-QStringList KActivityConsumer::listActivities() const
-{
-    KACTIVITYCONSUMER_DBUS_RETURN(
-        QStringList, KActivityManager::self()->ListActivities(), QStringList() );
-}
-
-#undef KACTIVITYCONSUMER_DBUS_RETURN
-
-KActivityConsumer::ServiceStatus KActivityConsumer::serviceStatus()
-{
-    if (!KActivityManager::isActivityServiceRunning()) {
-        return NotRunning;
-    }
-
-    if (!KActivityManager::self()->IsBackstoreAvailable()) {
-        return BareFunctionality;
-    }
-
-    return FullFunctionality;
-}
-
diff --git a/experimental/libkactivities/kactivityconsumer.h \
b/experimental/libkactivities/kactivityconsumer.h deleted file mode 100644
index 9be996b..0000000
--- a/experimental/libkactivities/kactivityconsumer.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ACTIVITY_CONSUMER_H
-#define ACTIVITY_CONSUMER_H
-
-#include <QObject>
-#include <QWidget>
-#include <QString>
-#include <QStringList>
-
-#include "kactivityinfo.h"
-
-#include <kurl.h>
-#include <kdemacros.h>
-
-class KActivityConsumerPrivate;
-/**
- * Contextual information can be, from the user's point of view, divided
- * into three aspects - "who am I?", "where am I?" (what are my surroundings?)
- * and "what am I doing?".
- *
- * Activities deal with the last one - "what am I doing?". The current activity
- * refers to what the user is doing at the moment, while the other activities \
                represent
- * things that he/she was doing before, and probably will be doing again.
- *
- * Activity is an abstract concept whose meaning can differ from one user to \
                another.
- * Typical examples of activities are "developing a KDE project", "studying the
- * 19th century art", "composing music", "lazing on a Sunday afternoon" etc.
- *
- * Every activity can have applications, documents, or other types of resources
- * assigned to it.
- *
- * KActivityConsumer provides an entry-level API for supporting activities in an
- * application - to react to the changes to the current activity as well as
- * registering the resources with its windows.
- *
- * Resource can be anything that is identifiable by an URI (for example,
- * a local file or a web page)
- *
- * @since 4.5
- */
-class KDE_EXPORT KActivityConsumer: public QObject {
-    Q_OBJECT
-
-    Q_PROPERTY(QString currentActivity READ currentActivity)
-    Q_PROPERTY(QStringList activities READ listActivities)
-
-public:
-    /**
-     * Different states of the activities service
-     */
-    enum ServiceStatus {
-        NotRunning,        ///< Service is not running
-        BareFunctionality, ///< Service is running without a sane backend
-        FullFunctionality  ///< Service is running, and a backend is available
-    };
-
-    explicit KActivityConsumer(QObject * parent = 0);
-
-    ~KActivityConsumer();
-
-    /**
-     * @returns the id of the current activity
-     */
-    QString currentActivity() const;
-
-    /**
-     * @returns the list of activities filtered by state
-     * @param state state of the activity
-     */
-    QStringList listActivities(KActivityInfo::State state) const;
-
-    /**
-     * @returns the list of all existing activities
-     */
-    QStringList listActivities() const;
-
-    /**
-     * @returns status of the activities service
-     */
-    static ServiceStatus serviceStatus();
-
-Q_SIGNALS:
-    /**
-     * This signal is emitted when the global
-     * activity is changed
-     * @param id id of the new current activity
-     */
-    void currentActivityChanged(const QString & id);
-
-    /**
-     * This signal is emitted when the activity service
-     * goes online or offline
-     * @param status new status of the service
-     */
-    void serviceStatusChanged(KActivityConsumer::ServiceStatus status);
-
-private:
-    KActivityConsumerPrivate * const d;
-};
-
-#endif // ACTIVITY_CONSUMER_H
diff --git a/experimental/libkactivities/kactivityconsumer_p.h \
b/experimental/libkactivities/kactivityconsumer_p.h deleted file mode 100644
index 3e78120..0000000
--- a/experimental/libkactivities/kactivityconsumer_p.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ACTIVITYCONSUMER_P_H
-#define ACTIVITYCONSUMER_P_H
-
-#include "activitymanager_interface.h"
-
-class KActivityConsumerPrivate {
-};
-
-#endif // ACTIVITY_CONSUMER_H
diff --git a/experimental/libkactivities/kactivitycontroller.cpp \
b/experimental/libkactivities/kactivitycontroller.cpp deleted file mode 100644
index 8a6aa3e..0000000
--- a/experimental/libkactivities/kactivitycontroller.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "kactivitycontroller.h"
-#include "kactivityconsumer_p.h"
-#include "kactivitymanager_p.h"
-
-#include <QObject>
-
-#include <kdebug.h>
-
-class KActivityController::Private: public QObject {
-public:
-    Private(KActivityController * parent)
-        : q(parent)
-    {
-    }
-
-private:
-    KActivityController * const q;
-};
-
-KActivityController::KActivityController(QObject * parent)
-    : KActivityConsumer(parent), d(new Private(this))
-{
-    connect(KActivityManager::self(), SIGNAL(ActivityAdded(QString)),
-            this, SIGNAL(activityAdded(QString)));
-
-    connect(KActivityManager::self(), SIGNAL(ActivityRemoved(QString)),
-            this, SIGNAL(activityRemoved(QString)));
-
-}
-
-KActivityController::~KActivityController()
-{
-    delete d;
-}
-
-void KActivityController::setActivityName(const QString & id, const QString & name)
-{
-    KActivityManager::self()->SetActivityName(id, name);
-}
-
-void KActivityController::setActivityIcon(const QString & id, const QString & icon)
-{
-    KActivityManager::self()->SetActivityIcon(id, icon);
-}
-
-bool KActivityController::setCurrentActivity(const QString & id)
-{
-    return KActivityManager::self()->SetCurrentActivity(id);
-}
-
-QString KActivityController::addActivity(const QString & name)
-{
-    return KActivityManager::self()->AddActivity(name);
-}
-
-void KActivityController::removeActivity(const QString & id)
-{
-    KActivityManager::self()->RemoveActivity(id);
-}
-
-void KActivityController::stopActivity(const QString & id)
-{
-    KActivityManager::self()->StopActivity(id);
-}
-
-void KActivityController::startActivity(const QString & id)
-{
-    KActivityManager::self()->StartActivity(id);
-}
-
-#include "kactivitycontroller.moc"
diff --git a/experimental/libkactivities/kactivitycontroller.h \
b/experimental/libkactivities/kactivitycontroller.h deleted file mode 100644
index 766152d..0000000
--- a/experimental/libkactivities/kactivitycontroller.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ACTIVITY_CONTROLLER_H
-#define ACTIVITY_CONTROLLER_H
-
-#include <QObject>
-#include <QWidget>
-#include <QString>
-#include <QStringList>
-
-#include "kactivityconsumer.h"
-
-#include <kurl.h>
-#include <kdemacros.h>
-
-/**
- * This class provides methods for controlling and managing
- * the activities.
- *
- * @see KActivityConsumer for info about activities
- *
- * @since 4.5
- */
-class KDE_EXPORT KActivityController: public KActivityConsumer
-{
-    Q_OBJECT
-
-    Q_PROPERTY(QString currentActivity READ currentActivity WRITE \
                setCurrentActivity)
-
-public:
-    explicit KActivityController(QObject * parent = 0);
-
-    ~KActivityController();
-
-    /**
-     * Sets the name of the specified activity
-     * @param id id of the activity
-     * @param name name to be set
-     */
-    void setActivityName(const QString & id, const QString & name);
-
-    /**
-     * Sets the icon of the specified activity
-     * @param id id of the activity
-     * @param icon icon to be set - freedesktop.org name or file path
-     */
-    void setActivityIcon(const QString & id, const QString & icon);
-
-    /**
-     * Sets the current activity
-     * @param id id of the activity to make current
-     * @returns true if successful
-     */
-    bool setCurrentActivity(const QString & id);
-
-    /**
-     * Adds a new activity
-     * @param name name of the activity
-     * @returns id of the newly created activity
-     */
-    QString addActivity(const QString & name);
-
-    /**
-     * Removes the specified activity
-     * @param id id of the activity to delete
-     */
-    void removeActivity(const QString & id);
-
-    /**
-     * Stops the activity
-     * @param id id of the activity to stop
-     */
-    void stopActivity(const QString & id);
-
-    /**
-     * Starts the activity
-     * @param id id of the activity to start
-     */
-    void startActivity(const QString & id);
-
-Q_SIGNALS:
-    /**
-     * This signal is emitted when the global
-     * activity is changed
-     * @param id id of the new current activity
-     */
-    void activityAdded(const QString & id);
-
-    /**
-     * This signal is emitted when the activity
-     * is removed
-     * @param id id of the removed activity
-     */
-    void activityRemoved(const QString & id);
-
-private:
-    class Private;
-    Private * const d;
-};
-
-#endif // ACTIVITY_CONTROLLER_H
diff --git a/experimental/libkactivities/kactivityinfo.cpp \
b/experimental/libkactivities/kactivityinfo.cpp deleted file mode 100644
index 739783d..0000000
--- a/experimental/libkactivities/kactivityinfo.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <kdebug.h>
-
-#include "kactivityinfo.h"
-#include "kactivityinfo_p.h"
-#include "kactivitymanager_p.h"
-
-// Private
-
-KActivityInfo::Private::Private(KActivityInfo *info, const QString &activityId)
-    : q(info),
-      state(KActivityInfo::Invalid),
-      id(activityId)
-{
-    KActivityManager::self();
-}
-
-#define IMPLEMENT_SIGNAL_HANDLER(ORIGINAL, INTERNAL) \
-    void KActivityInfo::Private::INTERNAL(const QString & _id) const  \
-    {                                                                 \
-        if (id == _id) emit q->INTERNAL();                            \
-    }
-
-IMPLEMENT_SIGNAL_HANDLER(ActivityAdded,   added)
-IMPLEMENT_SIGNAL_HANDLER(ActivityRemoved, removed)
-IMPLEMENT_SIGNAL_HANDLER(ActivityStarted, started)
-IMPLEMENT_SIGNAL_HANDLER(ActivityStopped, stopped)
-IMPLEMENT_SIGNAL_HANDLER(ActivityChanged, infoChanged)
-
-#undef IMPLEMENT_SIGNAL_HANDLER
-
-void KActivityInfo::Private::activityStateChanged(const QString & idChanged, int \
                newState)
-{
-    if (idChanged == id) {
-        state = static_cast<KActivityInfo::State>(newState);
-        emit q->stateChanged(state);
-    }
-}
-
-// KActivityInfo
-KActivityInfo::KActivityInfo(const QString &activityId, QObject *parent)
-    : QObject(parent),
-      d(new Private(this, activityId))
-{
-    d->id = activityId;
-    connect(KActivityManager::self(), SIGNAL(ActivityStateChanged(const QString &, \
                int)),
-            this, SLOT(activityStateChanged(const QString &, int)));
-
-    connect(KActivityManager::self(), SIGNAL(ActivityChanged(const QString &)),
-            this, SLOT(infoChanged(const QString &)));
-
-    connect(KActivityManager::self(), SIGNAL(ActivityAdded(const QString &)),
-            this, SLOT(added(const QString &)));
-
-    connect(KActivityManager::self(), SIGNAL(ActivityRemoved(const QString &)),
-            this, SLOT(removed(const QString &)));
-
-    connect(KActivityManager::self(), SIGNAL(ActivityStarted(const QString &)),
-            this, SLOT(started(const QString &)));
-
-    connect(KActivityManager::self(), SIGNAL(ActivityStopped(const QString &)),
-            this, SLOT(stopped(const QString &)));
-}
-
-KActivityInfo::~KActivityInfo()
-{
-    delete d;
-}
-
-bool KActivityInfo::isValid() const
-{
-    return (state() != Invalid);
-}
-
-// macro defines a shorthand for validating and returning a d-bus result
-// @param REPLY_TYPE type of the d-bus result
-// @param CAST_TYPE type to which to cast the result
-// @param METHOD invocation of the d-bus method
-#define KACTIVITYINFO_DBUS_CAST_RETURN(REPLY_TYPE, CAST_TYPE, METHOD)  \
-    QDBusReply < REPLY_TYPE > dbusReply = METHOD;                      \
-    if (dbusReply.isValid()) {                                         \
-        return (CAST_TYPE)(dbusReply.value());                         \
-    } else {                                                           \
-        return CAST_TYPE();                                            \
-    }
-
-
-KUrl KActivityInfo::uri() const
-{
-    // TODO:
-    return KUrl();
-    // KACTIVITYINFO_DBUS_CAST_RETURN(
-    //     QString, KUrl, Private::s_store->uri(d->id));
-}
-
-KUrl KActivityInfo::resourceUri() const
-{
-    // TODO:
-    return KUrl();
-    // KACTIVITYINFO_DBUS_CAST_RETURN(
-    //     QString, KUrl, Private::s_store->resourceUri(d->id));
-}
-
-QString KActivityInfo::id() const
-{
-    return d->id;
-}
-
-QString KActivityInfo::name() const
-{
-    KACTIVITYINFO_DBUS_CAST_RETURN(
-        QString, QString, KActivityManager::self()->ActivityName(d->id));
-}
-
-QString KActivityInfo::icon() const
-{
-    KACTIVITYINFO_DBUS_CAST_RETURN(
-        QString, QString, KActivityManager::self()->ActivityIcon(d->id));
-}
-
-KActivityInfo::State KActivityInfo::state() const
-{
-    if (d->state == Invalid) {
-        QDBusReply < int > dbusReply = \
                KActivityManager::self()->ActivityState(d->id);
-
-        if (dbusReply.isValid()) {
-            d->state = (State)(dbusReply.value());
-        }
-    }
-
-    return d->state;
-}
-
-QString KActivityInfo::name(const QString & id)
-{
-    KACTIVITYINFO_DBUS_CAST_RETURN(
-            QString, QString, KActivityManager::self()->ActivityName(id));
-}
-
-#undef KACTIVITYINFO_DBUS_CAST_RETURN
-
-KActivityInfo::Availability KActivityInfo::availability() const
-{
-    Availability result = Nothing;
-
-    if (!KActivityManager::isActivityServiceRunning()) {
-        return result;
-    }
-
-    if (KActivityManager::self()->ListActivities().value().contains(d->id)) {
-        result = BasicInfo;
-
-        if (KActivityManager::self()->IsBackstoreAvailable()) {
-            result = Everything;
-        }
-    }
-
-    return result;
-}
-
-#include "kactivityinfo.moc"
-
diff --git a/experimental/libkactivities/kactivityinfo.h \
b/experimental/libkactivities/kactivityinfo.h deleted file mode 100644
index 3637c93..0000000
--- a/experimental/libkactivities/kactivityinfo.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ACTIVITY_INFO_H
-#define ACTIVITY_INFO_H
-
-#include <QObject>
-#include <QWidget>
-#include <QString>
-#include <QStringList>
-
-#include <kurl.h>
-#include <kdemacros.h>
-
-/**
- * This class provides info about an activity. Most methods in it
- * require a Nepomuk backend running.
- *
- * @see KActivityConsumer for info about activities
- *
- * @since 4.5
- */
-class KDE_EXPORT KActivityInfo: public QObject
-{
-    Q_OBJECT
-
-    Q_PROPERTY(KUrl uri READ uri)
-    Q_PROPERTY(KUrl resourceUri READ resourceUri)
-    Q_PROPERTY(QString id READ id)
-    Q_PROPERTY(QString name READ name)
-
-public:
-    explicit KActivityInfo(const QString & activityId, QObject *parent=0);
-    ~KActivityInfo();
-
-    /**
-     * @return true if the activity represented by this object exists and is valid
-     */
-    bool isValid() const;
-
-    /**
-     * Specifies which parts of this class are functional
-     */
-    enum Availability {
-        Nothing = 0,             ///< No activity info provided (isValid is false)
-        BasicInfo = 1,           ///< Basic info is provided
-        Everything = 2           ///< Everything is available
-    };
-
-    /**
-     * State of the activity
-     */
-    enum State {
-        Invalid  = 0,
-        Running  = 2,
-        Starting = 3,
-        Stopped  = 4,
-        Stopping = 5
-    };
-
-    /**
-     * @returns what info is provided by this instance of KActivityInfo
-     */
-    Availability availability() const;
-
-    /**
-     * @returns the URI of this activity. The same URI is used by
-     * activities KIO slave.
-     * @note Functional only when availability is Everything
-     */
-    KUrl uri() const;
-
-    /**
-     * @returns the Nepomuk resource URI of this activity
-     * @note Functional only when availability is Everything
-     */
-    KUrl resourceUri() const;
-
-    /**
-     * @returns the id of the activity
-     */
-    QString id() const;
-
-    /**
-     * @returns the name of the activity
-     * @note Functional when availability is BasicInfo or Everything
-     */
-    QString name() const;
-
-    /**
-     * @returns the icon of the activity. Icon can be a
-     * freedesktop.org name or a file path. Or empty if
-     * no icon is set.
-     * @note Functional only when availability is Everything
-     */
-    QString icon() const;
-
-    /**
-     * @returns the state of the activity
-     */
-    State state() const;
-
-    /**
-     * This function is provided for convenience.
-     * @returns the name of the specified activity
-     * @param id id of the activity
-     */
-    static QString name(const QString & id);
-
-Q_SIGNALS:
-    /**
-     * Emitted when the activity's name, icon or description is changed
-     */
-    void infoChanged();
-
-    /**
-     * Emitted when the activity is added
-     */
-    void added();
-
-    /**
-     * Emitted when the activity is removed
-     */
-    void removed();
-
-    /**
-     * Emitted when the activity is started
-     */
-    void started();
-
-    /**
-     * Emitted when the activity is stopped
-     */
-    void stopped();
-
-    /**
-     * Emitted when the activity changes state
-     * @param state new state of the activity
-     */
-    void stateChanged(KActivityInfo::State state);
-
-private:
-    class Private;
-    Private * const d;
-
-    Q_PRIVATE_SLOT(d, void activityStateChanged(const QString &, int))
-    Q_PRIVATE_SLOT(d, void added(const QString &))
-    Q_PRIVATE_SLOT(d, void removed(const QString &))
-    Q_PRIVATE_SLOT(d, void started(const QString &))
-    Q_PRIVATE_SLOT(d, void stopped(const QString &))
-    Q_PRIVATE_SLOT(d, void infoChanged(const QString &))
-};
-
-#endif // ACTIVITY_INFO_H
diff --git a/experimental/libkactivities/kactivityinfo_p.h \
b/experimental/libkactivities/kactivityinfo_p.h deleted file mode 100644
index 0633ba0..0000000
--- a/experimental/libkactivities/kactivityinfo_p.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- * This library 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 library 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 library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ACTIVITY_INFO_PH
-#define ACTIVITY_INFO_PH
-
-#include "activitymanager_interface.h"
-#include "kactivityinfo.h"
-
-class KActivityInfo::Private {
-public:
-    Private(KActivityInfo *info, const QString &activityId);
-
-    void activityStateChanged(const QString &, int);
-
-    void added(const QString &) const;
-    void removed(const QString &) const;
-    void started(const QString &) const;
-    void stopped(const QString &) const;
-    void infoChanged(const QString &) const;
-
-    KActivityInfo *q;
-    KActivityInfo::State state;
-    QString id;
-};
-
-#endif // ACTIVITY_INFO_PH
diff --git a/experimental/libkactivities/kactivitymanager_p.cpp \
b/experimental/libkactivities/kactivitymanager_p.cpp deleted file mode 100644
index 1e2db56..0000000
--- a/experimental/libkactivities/kactivitymanager_p.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *   Copyright (C) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License version 2,
- *   or (at your option) any later version, 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 General Public License for more details
- *
- *   You should have received a copy of the GNU 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 "kactivitymanager_p.h"
-
-#include <QDBusConnection>
-
-#include <ktoolinvocation.h>
-#include <kdebug.h>
-
-KActivityManager * KActivityManager::s_instance = NULL;
-
-// #define ACTIVITY_MANAGER_DBUS_PATH   "org.kde.ActivityManager"
-#define ACTIVITY_MANAGER_DBUS_PATH   "org.kde.kactivitymanagerd"
-#define ACTIVITY_MANAGER_DBUS_OBJECT "/ActivityManager"
-
-KActivityManager::KActivityManager()
-    : org::kde::ActivityManager(
-            ACTIVITY_MANAGER_DBUS_PATH,
-            ACTIVITY_MANAGER_DBUS_OBJECT,
-            QDBusConnection::sessionBus()
-            )
-{
-    connect(&m_watcher, SIGNAL(serviceOwnerChanged(const QString &, const QString &, \
                const QString &)),
-            this, SLOT(serviceOwnerChanged(const QString &, const QString &, const \
                QString &)));
-}
-
-KActivityManager * KActivityManager::self()
-{
-    if (!s_instance) {
-        // check if the activity manager is already running
-        if (!isActivityServiceRunning()) {
-
-            // not running, trying to launch it
-            QString error;
-
-            int ret = \
KToolInvocation::startServiceByDesktopPath("kactivitymanagerd.desktop", \
                QStringList(), &error);
-            if (ret > 0) {
-                kDebug() << "Activity: Couldn't start kactivitymanagerd: " << error \
                << endl;
-            }
-
-            if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(ACTIVITY_MANAGER_DBUS_PATH)) \
                {
-                kDebug() << "Activity: The kactivitymanagerd service is still not \
                registered";
-            } else {
-                kDebug() << "Activity: The kactivitymanagerd service has been \
                registered";
-            }
-        }
-
-        // creating a new instance of the class
-        s_instance = new KActivityManager();
-    }
-
-    return s_instance;
-}
-
-bool KActivityManager::isActivityServiceRunning()
-{
-    return QDBusConnection::sessionBus().interface()->isServiceRegistered(ACTIVITY_MANAGER_DBUS_PATH);
                
-}
-
-void KActivityManager::serviceOwnerChanged(const QString & serviceName, const \
                QString & oldOwner, const QString & newOwner)
-{
-    if (serviceName == ACTIVITY_MANAGER_DBUS_PATH) {
-        emit presenceChanged(!newOwner.isEmpty());
-    }
-}
-
diff --git a/experimental/libkactivities/kactivitymanager_p.h \
b/experimental/libkactivities/kactivitymanager_p.h deleted file mode 100644
index 8c24ae7..0000000
--- a/experimental/libkactivities/kactivitymanager_p.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *   Copyright (C) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License version 2,
- *   or (at your option) any later version, 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 General Public License for more details
- *
- *   You should have received a copy of the GNU 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 ACTIVITY_MANAGER_P_
-#define ACTIVITY_MANAGER_P_
-
-#include "activitymanager_interface.h"
-
-#include <QDBusServiceWatcher>
-
-class KActivityManager: public org::kde::ActivityManager {
-    Q_OBJECT
-public:
-    static KActivityManager * self();
-
-    static bool isActivityServiceRunning();
-
-public Q_SLOTS:
-    void serviceOwnerChanged(const QString & serviceName, const QString & oldOwner, \
                const QString & newOwner);
-
-Q_SIGNALS:
-    void presenceChanged(bool present);
-
-private:
-    KActivityManager();
-
-    QDBusServiceWatcher m_watcher;
-
-    static KActivityManager * s_instance;
-};
-
-
-#endif // ACTIVITY_MANAGER_P_
diff --git a/experimental/libkactivities/manager_p.cpp \
b/experimental/libkactivities/manager_p.cpp new file mode 100644
index 0000000..10caaab
--- /dev/null
+++ b/experimental/libkactivities/manager_p.cpp
@@ -0,0 +1,87 @@
+/*
+ *   Copyright (C) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   or (at your option) any later version, 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 General Public License for more details
+ *
+ *   You should have received a copy of the GNU 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 "manager_p.h"
+
+#include <QDBusConnection>
+
+#include <ktoolinvocation.h>
+#include <kdebug.h>
+
+namespace Activities {
+
+Manager * Manager::s_instance = NULL;
+
+// #define ACTIVITY_MANAGER_DBUS_PATH   "org.kde.ActivityManager"
+#define ACTIVITY_MANAGER_DBUS_PATH   "org.kde.kactivitymanagerd"
+#define ACTIVITY_MANAGER_DBUS_OBJECT "/ActivityManager"
+
+Manager::Manager()
+    : org::kde::ActivityManager(
+            ACTIVITY_MANAGER_DBUS_PATH,
+            ACTIVITY_MANAGER_DBUS_OBJECT,
+            QDBusConnection::sessionBus()
+            )
+{
+    connect(&m_watcher, SIGNAL(serviceOwnerChanged(const QString &, const QString &, \
const QString &)), +            this, SLOT(serviceOwnerChanged(const QString &, const \
QString &, const QString &))); +}
+
+Manager * Manager::self()
+{
+    if (!s_instance) {
+        // check if the activity manager is already running
+        if (!isActivityServiceRunning()) {
+
+            // not running, trying to launch it
+            QString error;
+
+            int ret = \
KToolInvocation::startServiceByDesktopPath("kactivitymanagerd.desktop", \
QStringList(), &error); +            if (ret > 0) {
+                kDebug() << "Activity: Couldn't start kactivitymanagerd: " << error \
<< endl; +            }
+
+            if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(ACTIVITY_MANAGER_DBUS_PATH)) \
{ +                kDebug() << "Activity: The kactivitymanagerd service is still not \
registered"; +            } else {
+                kDebug() << "Activity: The kactivitymanagerd service has been \
registered"; +            }
+        }
+
+        // creating a new instance of the class
+        s_instance = new Manager();
+    }
+
+    return s_instance;
+}
+
+bool Manager::isActivityServiceRunning()
+{
+    return QDBusConnection::sessionBus().interface()->isServiceRegistered(ACTIVITY_MANAGER_DBUS_PATH);
 +}
+
+void Manager::serviceOwnerChanged(const QString & serviceName, const QString & \
oldOwner, const QString & newOwner) +{
+    if (serviceName == ACTIVITY_MANAGER_DBUS_PATH) {
+        emit presenceChanged(!newOwner.isEmpty());
+    }
+}
+
+} // namespace Activities
+
diff --git a/experimental/libkactivities/manager_p.h \
b/experimental/libkactivities/manager_p.h new file mode 100644
index 0000000..1eef9b5
--- /dev/null
+++ b/experimental/libkactivities/manager_p.h
@@ -0,0 +1,52 @@
+/*
+ *   Copyright (C) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   or (at your option) any later version, 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 General Public License for more details
+ *
+ *   You should have received a copy of the GNU 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 ACTIVITY_MANAGER_P_
+#define ACTIVITY_MANAGER_P_
+
+#include "activitymanager_interface.h"
+
+#include <QDBusServiceWatcher>
+
+namespace Activities {
+
+class Manager: public org::kde::ActivityManager {
+    Q_OBJECT
+public:
+    static Manager * self();
+
+    static bool isActivityServiceRunning();
+
+public Q_SLOTS:
+    void serviceOwnerChanged(const QString & serviceName, const QString & oldOwner, \
const QString & newOwner); +
+Q_SIGNALS:
+    void presenceChanged(bool present);
+
+private:
+    Manager();
+
+    QDBusServiceWatcher m_watcher;
+
+    static Manager * s_instance;
+};
+
+} // namespace Activities
+
+#endif // ACTIVITY_MANAGER_P_
diff --git a/experimental/libkactivities/resourceinstance.cpp \
b/experimental/libkactivities/resourceinstance.cpp new file mode 100644
index 0000000..9c4be5e
--- /dev/null
+++ b/experimental/libkactivities/resourceinstance.cpp
@@ -0,0 +1,82 @@
+/*
+ *   Copyright (C) 2011 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   or (at your option) any later version, 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 General Public License for more details
+ *
+ *   You should have received a copy of the GNU 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 "resourceinstance.h"
+
+namespace Activities {
+
+class ResourceInstancePrivate {
+};
+
+ResourceInstance::ResourceInstance(QObject * parent)
+    : d(new ResourceInstancePrivate())
+{
+}
+
+ResourceInstance::ResourceInstance(WId wid, QUrl resourceUri, const QString & \
mimetype, QObject * parent) +    : d(new ResourceInstancePrivate())
+{
+}
+
+ResourceInstance::~ResourceInstance()
+{
+    delete d;
+}
+
+void ResourceInstance::notifyModified()
+{
+}
+
+void ResourceInstance::notifyFocussedIn()
+{
+}
+
+void ResourceInstance::notifyFocussedOut()
+{
+}
+
+void ResourceInstance::setUri(const QUrl & newUri)
+{
+}
+
+void ResourceInstance::setMimetype(const QString & mimetype)
+{
+}
+
+void ResourceInstance::setWinId(WId wid)
+{
+}
+
+QUrl ResourceInstance::uri()
+{
+    return QUrl();
+}
+
+QString ResourceInstance::mimetype() const
+{
+    return QString();
+}
+
+WId ResourceInstance::winId() const
+{
+    return 0;
+}
+
+
+} // namespace Activities
diff --git a/experimental/libkactivities/resourceinstance.h \
b/experimental/libkactivities/resourceinstance.h new file mode 100644
index 0000000..b5c9caf
--- /dev/null
+++ b/experimental/libkactivities/resourceinstance.h
@@ -0,0 +1,163 @@
+/*
+ *   Copyright (C) 2011 Ivan Cukic <ivan.cukic(at)kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   or (at your option) any later version, 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 General Public License for more details
+ *
+ *   You should have received a copy of the GNU 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 <QObject>
+#include <QWidget>
+#include <QUrl>
+
+#include <kdemacros.h>
+
+namespace Activities {
+
+class ResourceInstancePrivate;
+
+/**
+ * This class is used to notify the system that a file, web page
+ * or some other resource has been accessed.
+ *
+ * It provides methods to notify the system when the resource was
+ * opened, modified and closed, along with in what window the
+ * resource is shown.
+ *
+ * You should create an instance of this class for every resource
+ * you open.
+ *
+ * "The system" in this case can be the backend for tracking
+ * and automatically scoring files that are being accessed, the
+ * system to show the open files per window in the taskbar,
+ * the share-like-connect, etc.
+ *
+ * The user of this class shouldn't care about the backend
+ * systems - everything is done under-the-hood automatically.
+ *
+ */
+class KDE_EXPORT ResourceInstance: public QObject {
+    Q_OBJECT
+    Q_PROPERTY(QUrl uri READ uri WRITE setUri)
+    Q_PROPERTY(QString mimetype READ mimetype WRITE setMimetype)
+    Q_PROPERTY(WId winId READ winId WRITE setWinId)
+
+public:
+    /**
+     * Creates a new resource instance
+     * @param parent pointer to the parent object
+     */
+    ResourceInstance(QObject * parent = 0);
+
+    /**
+     * Creates a new resource instance and automatically
+     * notifies the system that it was opened.
+     *
+     * In some special cases, where the URI of the resource is
+     * being constantly changed (for example, in the world globe,
+     * street map applications) you have two options:
+     *  - to pass an empty resourceUri while passing the mimetype
+     *  - to update the uri from time to time (in the example of
+     *    the world map - to send URIs for major objects - cities
+     *    or main streets.
+     * and in both cases reimplementing the currentUri() method
+     * which will return the exact URI shown at that specific moment.
+     *
+     * @param wid window id in which the resource is shown
+     * @param resourceUri URI of the resource that is shown
+     * @param mimetype the mime type of the resource
+     * @param parent pointer to the parent object
+     */
+    ResourceInstance(WId wid, QUrl resourceUri, const QString & mimetype = \
QString(), QObject * parent = 0); +
+    /**
+     * Destroys the ResourceInstance and notifies the system
+     * that the resource has been closed
+     */
+    ~ResourceInstance();
+
+public Q_SLOTS:
+    /**
+     * Call this method to notify the system that you modified
+     * (the contents of) the resource
+     */
+    void notifyModified();
+
+    /**
+     * Call this method to notify the system that the resource
+     * has the focus in your application
+     * @note You only need to call this in MDI applications
+     */
+    void notifyFocussedIn();
+
+    /**
+     * Call this method to notify the system that the resource
+     * lost the focus in your application
+     * @note You only need to call this in MDI applications
+     */
+    void notifyFocussedOut();
+
+    /**
+     * This is a convenience method that sets the new URI.
+     * This is usually handled by sending the close event for
+     * the previous URI, and an open event for the new one.
+     */
+    void setUri(const QUrl & newUri);
+
+    /**
+     * Sets the mimetype for this resource
+     */
+    void setMimetype(const QString & mimetype);
+
+    /**
+     * Sets the window id
+     */
+    void setWinId(WId wid);
+
+Q_SIGNALS:
+    /**
+     * Emitted when the system wants to show the resource
+     * represented by this ResourceInstance.
+     *
+     * You should listen to this signal if you have multiple
+     * resources shown in one window (MDI). On catching it, show
+     * the resource and give it focus.
+     */
+    void requestsFocus();
+
+public:
+    /**
+     * @returns the current uri
+     * The default implementation returns the URI that was passed
+     * to the constructor.
+     * You need to reimplement it only for the applications with
+     * frequently updated URIs.
+     */
+    virtual QUrl uri();
+
+    /**
+     * @returns mimetype of the resource
+     */
+    QString mimetype() const;
+
+    /**
+     * @returns the window id
+     */
+    WId winId() const;
+
+private:
+    ResourceInstancePrivate * const d;
+};
+
+}


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

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