]> git.sesse.net Git - kdenlive/commitdiff
When downloading from online resource, save license, url, etc in Nepomuk metadata
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 31 Dec 2011 13:31:58 +0000 (14:31 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 31 Dec 2011 13:31:58 +0000 (14:31 +0100)
src/projectlist.cpp
src/utils/freesound.cpp

index bfbfd78a1495cc738847fb30ddad150eebd52739..aea4ddfe0685515c1d3fef2cd451a1dd3b680510 100644 (file)
 #include <KActionCollection>
 #include <KUrlRequester>
 
-#ifdef NEPOMUK
+#ifdef USE_NEPOMUK
 #include <nepomuk/global.h>
 #include <nepomuk/resourcemanager.h>
+#include <Nepomuk/Resource>
 //#include <nepomuk/tag.h>
 #endif
 
@@ -306,7 +307,7 @@ ProjectList::ProjectList(QWidget *parent) :
     
     m_listViewDelegate = new ItemDelegate(m_listView);
     m_listView->setItemDelegate(m_listViewDelegate);
-#ifdef NEPOMUK
+#ifdef USE_NEPOMUK
     if (KdenliveSettings::activate_nepomuk()) {
         Nepomuk::ResourceManager::instance()->init();
         if (!Nepomuk::ResourceManager::instance()->initialized()) {
@@ -954,7 +955,7 @@ void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QSt
         monitorItemEditing(false);
         clip->setText(1, properties.value("description"));
         monitorItemEditing(true);
-#ifdef NEPOMUK
+#ifdef USE_NEPOMUK
         if (KdenliveSettings::activate_nepomuk() && (type == AUDIO || type == VIDEO || type == AV || type == IMAGE || type == PLAYLIST)) {
             // Use Nepomuk system to store clip description
             Nepomuk::Resource f(clip->clipUrl().path());
@@ -1297,7 +1298,7 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
     }*/
     
     KUrl url = clip->fileURL();
-#ifdef NEPOMUK
+#ifdef USE_NEPOMUK
     if (!url.isEmpty() && KdenliveSettings::activate_nepomuk()) {
         // if file has Nepomuk comment, use it
         Nepomuk::Resource f(url.path());
index d1d233f91ac3aa04aa2bd62bcb6b445675b6b6cb..bb8a2e5ba18365a1c87a7ee001d6c358e35a30a2 100644 (file)
 #include <Solid/Networking>
 #include <KRun>
 
+#ifdef USE_NEPOMUK
+#include <Nepomuk/Variant>
+#include <Nepomuk/Resource>
+#include <Nepomuk/ResourceManager>
+#include <Soprano/Vocabulary/NAO>
+#include <Nepomuk/Vocabulary/NIE>
+#include <Nepomuk/Vocabulary/NDO>
+#endif
+
 #ifdef USE_QJSON
 #include <qjson/parser.h>
 #endif
@@ -89,6 +98,7 @@ FreeSound::FreeSound(const QString & folder, QWidget * parent) :
     connect(page_number, SIGNAL(valueChanged(int)), this, SLOT(slotStartSearch(int)));
     sound_box->setEnabled(false);
     search_text->setFocus();
+    Nepomuk::ResourceManager::instance()->init();
 }
 
 FreeSound::~FreeSound()
@@ -340,7 +350,16 @@ void FreeSound::slotSaveSound()
     QString saveUrl = KFileDialog::getSaveFileName(KUrl(path), ext);
     if (saveUrl.isEmpty()) return;
     if (KIO::NetAccess::download(KUrl(m_currentUrl), saveUrl, this)) {
-        emit addClip(KUrl(saveUrl), sound_name->url());
+        const KUrl filePath = KUrl(saveUrl);
+#ifdef USE_NEPOMUK
+        Nepomuk::Resource res( filePath );
+        res.setProperty( Nepomuk::Vocabulary::NIE::license(), (Nepomuk::Variant) item_license->text() );
+        res.setProperty( Nepomuk::Vocabulary::NIE::licenseType(), (Nepomuk::Variant) item_license->url() );
+        res.setProperty( Nepomuk::Vocabulary::NDO::copiedFrom(), sound_name->url() );
+        //res.setDescription(item_description->toPlainText());
+        //res.setProperty( Soprano::Vocabulary::NAO::description(), 
+#endif
+        emit addClip(KUrl(saveUrl), QString());//, sound_name->url());
     }
 }