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

List:       kde-commits
Subject:    KDE/kdepim/akonadi/agents
From:       Volker Krause <vkrause () kde ! org>
Date:       2009-09-16 13:54:22
Message-ID: 1253109262.823453.29939.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1024382 by vkrause:

Convert categories to Nepomuk tags.


 M  +8 -0      nepomuk_calendar_feeder/nepomukcalendarfeeder.cpp  
 M  +2 -0      nepomuk_contact_feeder/nepomukcontactfeeder.cpp  
 M  +10 -0     nepomukfeeder/nepomukfeederagent.cpp  
 M  +5 -0      nepomukfeeder/nepomukfeederagent.h  


--- trunk/KDE/kdepim/akonadi/agents/nepomuk_calendar_feeder/nepomukcalendarfeeder.cpp \
#1024381:1024382 @@ -45,6 +45,7 @@
 #include "journal.h"
 #include "participationstatus.h"
 #include "personcontact.h"
+#include "todo.h"
 
 #include <QtCore/QTime>
 #include <QtCore/QTimer>
@@ -190,6 +191,8 @@
 
     event.addAttendee( attendee );
   }
+
+  tagsFromCategories( event, calEvent->categories() );
 }
 
 void NepomukCalendarFeeder::updateJournalItem( const Akonadi::Item &item, const \
KCal::Journal::Ptr &calJournal, const QUrl &graphUri ) @@ -198,10 +201,15 @@
     NepomukFast::Journal journal( item.url(), graphUri );
 
     journal.setLabel( calJournal->summary() );
+
+    tagsFromCategories( journal, calJournal->categories() );
 }
 
 void NepomukCalendarFeeder::updateTodoItem( const Akonadi::Item &item, const \
KCal::Todo::Ptr &calTodo, const QUrl &graphUri )  {
+  NepomukFast::Todo todo( item.url(), graphUri );
+  todo.setLabel( calTodo->summary() );
+  tagsFromCategories( todo, calTodo->categories() );
 }
 
 } // namespace Akonadi
--- trunk/KDE/kdepim/akonadi/agents/nepomuk_contact_feeder/nepomukcontactfeeder.cpp \
#1024381:1024382 @@ -259,6 +259,8 @@
 
     contact.addPostalAddress( address );
   }
+
+  tagsFromCategories( contact, addressee.categories() );
 }
 
 void NepomukContactFeeder::updateGroupItem( const Akonadi::Item &item, const QUrl \
                &graphUri )
--- trunk/KDE/kdepim/akonadi/agents/nepomukfeeder/nepomukfeederagent.cpp \
#1024381:1024382 @@ -31,6 +31,7 @@
 
 #include <nepomuk/resource.h>
 #include <nepomuk/resourcemanager.h>
+#include <nepomuk/tag.h>
 
 #include <KUrl>
 
@@ -141,5 +142,14 @@
   std::for_each( items.constBegin(), items.constEnd(), boost::bind( \
&NepomukFeederAgent::updateItem, this, _1 ) );  }
 
+void NepomukFeederAgent::tagsFromCategories(NepomukFast::Resource& resource, const \
QStringList& categories) +{
+  // FIXME: this voids the usage of the XFast classes...
+  Nepomuk::Resource res( resource.uri() );
+  foreach ( const QString &category, categories ) {
+    const Nepomuk::Tag tag( category );
+    res.addTag( tag );
+  }
+}
 
 #include "nepomukfeederagent.moc"
--- trunk/KDE/kdepim/akonadi/agents/nepomukfeeder/nepomukfeederagent.h \
#1024381:1024382 @@ -27,6 +27,8 @@
 #include <akonadi/item.h>
 #include <akonadi/mimetypechecker.h>
 
+#include "resource.h"
+
 #include <QStringList>
 
 namespace Akonadi
@@ -46,6 +48,9 @@
     /** Remove all references to the given item from Nepomuk. */
     static void removeItemFromNepomuk( const Akonadi::Item &item );
 
+    /** Adds tags to @p resource based on the given string list. */
+    static void tagsFromCategories( NepomukFast::Resource &resource, const \
QStringList &categories ); +
     /** Add a supported mimetype. */
     void addSupportedMimeType( const QString &mimeType );
 


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

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