<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>engine/nepomuk/nepomukmodel.cpp</filename>
    </added>
    <added>
      <filename>engine/nepomuk/nepomukmodel.h</filename>
    </added>
    <added>
      <filename>raptor.trig</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -5,6 +5,8 @@ project(raptor)
 # Find the required Libaries
 find_package(KDE4 REQUIRED)
 include(KDE4Defaults)
+find_package(Nepomuk REQUIRED)
+include(MacroAddOntologyClasses)
 #find_package(Plasma REQUIRED)
 
 #add_subdirectory(widget)
@@ -40,12 +42,23 @@ set(raptor_SRCS
     engine/kickoff/searchmodel.cpp
     engine/kickoff/kickoffmodel.cpp
     engine/kickoff/favoritesmodel.cpp
+    engine/nepomuk/nepomukmodel.cpp
 )
+
+NEPOMUK_ADD_ONTOLOGY_CLASSES(
+   raptor_SRCS
+   ONTOLOGIES
+   ${CMAKE_CURRENT_SOURCE_DIR}/raptor.trig
+ )
+
  
 # Now make sure all files get to the right place
+#kde4_add_library(plasma_applet_raptor STATIC ${raptor_SRCS})
 kde4_add_plugin(plasma_applet_raptor ${raptor_SRCS})
+#kde4_add_library(raptor STATIC ${raptor_SRCS})
+
 target_link_libraries(plasma_applet_raptor 
-                      ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${KDE4_KIO_LIBS} solidcontrol)
+                      ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${KDE4_KIO_LIBS} ${NEPOMUK_LIBRARIES} solidcontrol)
  
 install(TARGETS plasma_applet_raptor
         DESTINATION ${PLUGIN_INSTALL_DIR})</diff>
      <filename>CMakeLists.txt</filename>
    </modified>
    <modified>
      <diff>@@ -102,12 +102,13 @@ void RaptorGraphicsView::setRootIndex(const QModelIndex &amp;index)
         return;
     }
     if (!index.data(Qt::UserRole + 2).isNull()) {
-        emit applicationClicked(KUrl(index.data(Qt::UserRole + 2).toString())); //Qt::UserRole + 2 is Kickoff::UrlRole
+        emit applicationClicked(index); //Qt::UserRole + 2 is Kickoff::UrlRole
         return;
     }
     d-&gt;rootIndex = index;
 
     getItems();
+    setViewMode(viewModeFromItemCount());
     d-&gt;layout-&gt;setMenuItems(d-&gt;items);
     d-&gt;layout-&gt;invalidate();
     update();
@@ -172,9 +173,6 @@ void RaptorGraphicsView::setModel(QAbstractItemModel *model)
 void RaptorGraphicsView::setViewMode(ViewMode viewMode)
 {
     d-&gt;delegate-&gt;setViewMode((RaptorItemDelegate::ViewMode)viewMode);
-
-    d-&gt;layout-&gt;invalidate();
-    update();
 }
 
 RaptorGraphicsView::ViewMode RaptorGraphicsView::viewMode()
@@ -249,6 +247,7 @@ void RaptorGraphicsView::getItems()
     qDeleteAll(d-&gt;items);
     d-&gt;currentHoveredItem = 0;
     d-&gt;items.clear();
+
     if (d-&gt;model-&gt;canFetchMore(d-&gt;rootIndex)) {
         d-&gt;model-&gt;fetchMore(d-&gt;rootIndex);
     }
@@ -388,16 +387,18 @@ void RaptorGraphicsView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
 
 RaptorGraphicsView::ViewMode RaptorGraphicsView::viewModeFromItemCount()
 {
-    /*switch (d-&gt;items.count()) {
+    //return RaptorGraphicsView::TwoApps;
+    /*
+    switch (d-&gt;items.count()) {
         case 1:
             return RaptorGraphicsView::SingleApp;
         case 2:
             return RaptorGraphicsView::TwoApps;
         case 3:
         case 4:
-        case 5:
+        case 5:*/
             return RaptorGraphicsView::Normal;
-        default:*/
+        /*default:
             return RaptorGraphicsView::Search;
-    /*}*/
+    }*/
 }</diff>
      <filename>view/raptorgraphicsview.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -63,7 +63,7 @@ protected slots:
 
 signals:
     void enteredItem(const QModelIndex &amp;);
-    void applicationClicked(const KUrl &amp;);
+    void applicationClicked(const QModelIndex &amp;);
     void favoriteClicked(const QString &amp;);
 
 protected:</diff>
      <filename>view/raptorgraphicsview.h</filename>
    </modified>
    <modified>
      <diff>@@ -18,6 +18,7 @@
 #include &quot;engine/kickoff/applicationmodel.h&quot;
 #include &quot;engine/kickoff/searchmodel.h&quot;
 #include &quot;engine/kickoff/favoritesmodel.h&quot;
+#include &quot;engine/nepomuk/nepomukmodel.h&quot;
 #include &quot;view/raptorgraphicsview.h&quot;
 
 #include &quot;view/breadcrumb.h&quot;
@@ -37,6 +38,7 @@
 #include &lt;KConfig&gt;
 #include &lt;KDebug&gt;
 #include &lt;KIcon&gt;
+#include &lt;KNotification&gt;
 
 // Plasma
 #include &lt;Plasma/Theme&gt;
@@ -46,6 +48,11 @@
 #include &lt;Plasma/FrameSvg&gt;
 #include &lt;plasma/runnermanager.h&gt;
 
+//Nepomuk
+#include &lt;Nepomuk/ResourceManager&gt;
+#include &quot;application.h&quot;
+#include &quot;applicationlaunch.h&quot;
+
 const int CONTENTS_RECT_HORIZONTAL_MARGIN = 32;
 const int CONTENTS_RECT_VERTICAL_MARGIN = 10;
 const int FRAME_RECT_HORIZONTAL_MARGIN = 22;
@@ -72,7 +79,8 @@ public:
     RaptorGraphicsWidget *q;
     RaptorGraphicsView *view;
 
-    Kickoff::ApplicationModel *model;
+    //Kickoff::ApplicationModel *model;
+    QAbstractItemModel * model;
     Kickoff::SearchModel * searchModel;
     Kickoff::FavoritesModel * favoritesModel;
 
@@ -94,8 +102,16 @@ RaptorGraphicsWidget::RaptorGraphicsWidget(QGraphicsItem *parent, const KConfigG
 {
     setAcceptHoverEvents(true);
 
-    d-&gt;model = new Kickoff::ApplicationModel(this);
-    d-&gt;model-&gt;init();
+//     d-&gt;model = new Kickoff::ApplicationModel(this);
+//     d-&gt;model-&gt;init();
+    if (!Nepomuk::ResourceManager::instance()-&gt;init()) {
+        kDebug() &lt;&lt; &quot;fucking nepomuk never dies&quot;;
+        d-&gt;model = new Raptor::NepomukModel(this);
+    } else {
+        KNotification::event(i18n(&quot;Nepomuk is not running. Falling back to useless mode!!!&quot;));
+        d-&gt;model = new Kickoff::ApplicationModel(this);
+        qobject_cast&lt;Kickoff::ApplicationModel*&gt;(d-&gt;model)-&gt;init();
+    }
     d-&gt;searchModel = new Kickoff::SearchModel();
     d-&gt;favoritesModel = new Kickoff::FavoritesModel(this);
 
@@ -184,7 +200,7 @@ RaptorGraphicsWidget::RaptorGraphicsWidget(QGraphicsItem *parent, const KConfigG
 // 
 
     connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateColors()));
-    connect(d-&gt;view, SIGNAL(applicationClicked(const KUrl &amp;)), this, SLOT(launchApplication(const KUrl &amp;)));
+    connect(d-&gt;view, SIGNAL(applicationClicked(const QModelIndex &amp;)), this, SLOT(launchApplication(const QModelIndex &amp;)));
     connect(d-&gt;searchLine, SIGNAL(textEdited(const QString&amp;)), this, SLOT(refineModel()));
     connect(d-&gt;manager, SIGNAL(matchesChanged(const QList&lt;Plasma::QueryMatch&gt;&amp;)), this,
             SLOT(matchesChanged(const QList&lt;Plasma::QueryMatch&gt;&amp;)));
@@ -214,16 +230,23 @@ void RaptorGraphicsWidget::setFavoritesModel()
     if (d-&gt;view-&gt;model() == d-&gt;favoritesModel) {
         //d-&gt;view-&gt;setRootIndex(QModelIndex());
         refineModel();
-    }
-    else {
+    } else {
         d-&gt;view-&gt;setModel(d-&gt;favoritesModel);
         d-&gt;view-&gt;setRootIndex(d-&gt;favoritesModel-&gt;index(0, 0, QModelIndex()));
     }
 }
 
-void RaptorGraphicsWidget::launchApplication(const KUrl &amp;url)
+void RaptorGraphicsWidget::launchApplication(const QModelIndex &amp;index)
 {
-    KDesktopFile desktopFile(url.pathOrUrl());
+    if (qobject_cast&lt;Raptor::NepomukModel*&gt;(d-&gt;model)) {
+        Nepomuk::Application app(index.data(Raptor::NepomukModel::NepomukUriRole).toString());//FIXME: Need to change the role maybe...
+	app.setLaunchCount(app.launchCount() + 1);
+	Nepomuk::ApplicationLaunch launch(QDateTime::currentDateTime().toString());
+	launch.setLaunchDate(QDateTime::currentDateTime());
+	launch.setLaunchedApplication(app);
+	app.setLastLaunch(launch);
+    }
+    KDesktopFile desktopFile(KUrl(index.data(Raptor::NepomukModel::UrlRole).toUrl()).pathOrUrl());
     KService service(&amp;desktopFile);
     KRun::run(service, KUrl::List(), 0);
 }</diff>
      <filename>view/raptorgraphicswidget.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,7 @@
 #define RAPTORGRAPHICSWIDGET_H
 
 #include &lt;QGraphicsWidget&gt;
+#include &lt;QModelIndex&gt;
 #include &lt;plasma/querymatch.h&gt;
 
 class KUrl;
@@ -35,7 +36,7 @@ class RaptorGraphicsWidget : public QGraphicsWidget
         void addOrRemoveFavorite(const QString &amp;);
 
         void updateColors();
-        void launchApplication(const KUrl &amp;);
+        void launchApplication(const QModelIndex &amp;);
         void refineModel();
         void matchesChanged(const QList&lt;Plasma::QueryMatch&gt;&amp;);
 </diff>
      <filename>view/raptorgraphicswidget.h</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,7 @@
 
 #include &quot;raptoritemdelegate.h&quot;
 #include &quot;engine/kickoff/favoritesmodel.h&quot;
+#include &quot;engine/nepomuk/nepomukmodel.h&quot;
 
 //Qt
 #include &lt;QPainter&gt;</diff>
      <filename>view/raptoritemdelegate.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,7 @@
 #include &quot;raptormenuitem.h&quot;
 #include &quot;raptoritemdelegate.h&quot;
 #include &quot;raptorgraphicsview.h&quot;
+#include &quot;engine/nepomuk/nepomukmodel.h&quot;
 
 #include &lt;QStyleOptionViewItem&gt;
 #include &lt;QPainter&gt;
@@ -29,8 +30,8 @@ class RaptorMenuItem::Private
 public:
     Private(const QModelIndex &amp;index, RaptorGraphicsView *p, RaptorMenuItem *q) : q(q), index(index), option(new QStyleOptionViewItem), view(p), value(0)
     {
-        lastUsed = i18n(&quot;20 Minutes&quot;);//FIXME: Replace with proper last used info :)
-        lastUsedWidth = Plasma::Theme::defaultTheme()-&gt;fontMetrics().width(lastUsed);
+        //lastUsed = i18n(&quot;20 Minutes&quot;);//FIXME: Replace with proper last used info :)
+        //lastUsedWidth = Plasma::Theme::defaultTheme()-&gt;fontMetrics().width(lastUsed);
     }
     ~Private()
     {
@@ -177,11 +178,11 @@ void RaptorMenuItem::update()
 
 QString RaptorMenuItem::lastUsed() const
 {
-    //TODO: Check whether the lastused text changed in the modelindex later and recalculate the size then...
-    return d-&gt;lastUsed;
+    //FIXME: Caching?
+    return d-&gt;index.data(Raptor::NepomukModel::LastLaunchedRole).toDateTime().toString();
 }
 
 int RaptorMenuItem::lastUsedWidth()
 {
-    return d-&gt;lastUsedWidth;
+    return Plasma::Theme::defaultTheme()-&gt;fontMetrics().width(d-&gt;index.data(Raptor::NepomukModel::LastLaunchedRole).toDateTime().toString());
 }</diff>
      <filename>view/raptormenuitem.cpp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>faecae1fdfaf877c047e7b091a25d502bb03a496</id>
    </parent>
  </parents>
  <author>
    <name>Lukas Appelhans</name>
    <email>l.appelhans@gmx.de</email>
  </author>
  <url>http://github.com/ruphy/raptor/commit/f887040424e326b59abd9a19525ff3825f31eccb</url>
  <id>f887040424e326b59abd9a19525ff3825f31eccb</id>
  <committed-date>2009-06-21T13:51:21-07:00</committed-date>
  <authored-date>2009-06-21T13:51:21-07:00</authored-date>
  <message>This commit introduces the changes done at Nepomuk-Sprint by Alessandro,
Francesco and me...
-hard dep on Nepomuk for now / needs nepomuk-playground
-new default model based on nepomuk
-raptor-ontology
-menu structure saved nepomuk
-last launched date in menu

things to discuss:
-how to get TOM categories: ideas: introduce fdo spec &amp; if that is not
in the .desktop-file guess the category from the current category system
(Audio;Qt;KDE or sth like that) or from the documentation...
-how to do ordered by click-count, idea: just use the click-count-role
in the model and then let the layout order the items correctly... (dunno
if that'll work though, just thinking...)

Now launching Raptor will bring you some weird menu-structure, but it
will be great! xD</message>
  <tree>4279e235cbd2e584477b57ebe4900c2ffecb49ba</tree>
  <committer>
    <name>Lukas Appelhans</name>
    <email>l.appelhans@gmx.de</email>
  </committer>
</commit>
