From: Jean-Baptiste Mardelle Date: Sat, 31 Dec 2011 13:31:58 +0000 (+0100) Subject: When downloading from online resource, save license, url, etc in Nepomuk metadata X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=290b7e5faddb8a6e13c6bb40eea01b6008760f29;p=kdenlive When downloading from online resource, save license, url, etc in Nepomuk metadata --- diff --git a/src/projectlist.cpp b/src/projectlist.cpp index bfbfd78a..aea4ddfe 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -58,9 +58,10 @@ #include #include -#ifdef NEPOMUK +#ifdef USE_NEPOMUK #include #include +#include //#include #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 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()); diff --git a/src/utils/freesound.cpp b/src/utils/freesound.cpp index d1d233f9..bb8a2e5b 100644 --- a/src/utils/freesound.cpp +++ b/src/utils/freesound.cpp @@ -36,6 +36,15 @@ #include #include +#ifdef USE_NEPOMUK +#include +#include +#include +#include +#include +#include +#endif + #ifdef USE_QJSON #include #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()); } }