From: Peter Penz Date: Thu, 25 Feb 2010 19:34:58 +0000 (+0000) Subject: Also show meta informations of files, if Nepomuk is not running or if the file is... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/e488496286f200f07ca3027ac7d20bdd679e2560 Also show meta informations of files, if Nepomuk is not running or if the file is not indexed. Still a lot of cleanups are required (e. g. the labels are not human readable currently). svn path=/trunk/KDE/kdebase/apps/; revision=1096092 --- diff --git a/src/panels/information/kloadmetadatathread.cpp b/src/panels/information/kloadmetadatathread.cpp index bae4d3e20..5569933a1 100644 --- a/src/panels/information/kloadmetadatathread.cpp +++ b/src/panels/information/kloadmetadatathread.cpp @@ -21,9 +21,10 @@ #include #include +#include +#include #include #include -#include #include #include @@ -111,6 +112,20 @@ void KLoadMetaDataThread::run() } ++it; } + + if (variants.isEmpty()) { + // TODO: The following code is just meant as temporary fallback to show + // non-indexed meta data. + KFileMetaInfo metaInfo(m_urls.first()); + const QHash metaInfoItems = metaInfo.items(); + foreach (const KFileMetaInfoItem& metaInfoItem, metaInfoItems) { + Item item; + item.name = metaInfoItem.name(); + item.label = metaInfoItem.name() + metaInfoItem.prefix() + metaInfoItem.suffix(); + item.value = metaInfoItem.value().toString(); + m_items.append(item); + } + } } first = false; diff --git a/src/panels/information/kmetadatawidget.cpp b/src/panels/information/kmetadatawidget.cpp index c8d7838c9..80d8062a6 100644 --- a/src/panels/information/kmetadatawidget.cpp +++ b/src/panels/information/kmetadatawidget.cpp @@ -358,12 +358,14 @@ void KMetaDataWidget::Private::slotLoadingFinished() return; } - Q_ASSERT(m_ratingWidget != 0); - Q_ASSERT(m_commentWidget != 0); - Q_ASSERT(m_taggingWidget != 0); - m_ratingWidget->setRating(m_loadMetaDataThread->rating()); - m_commentWidget->setText(m_loadMetaDataThread->comment()); - m_taggingWidget->setTags(m_loadMetaDataThread->tags()); + if (m_nepomukActivated) { + Q_ASSERT(m_ratingWidget != 0); + Q_ASSERT(m_commentWidget != 0); + Q_ASSERT(m_taggingWidget != 0); + m_ratingWidget->setRating(m_loadMetaDataThread->rating()); + m_commentWidget->setText(m_loadMetaDataThread->comment()); + m_taggingWidget->setTags(m_loadMetaDataThread->tags()); + } // Show the remaining meta information as text. The number // of required rows may very. Existing rows are reused to @@ -415,7 +417,7 @@ void KMetaDataWidget::Private::slotLoadingFinished() m_files = m_loadMetaDataThread->files(); - delete m_loadMetaDataThread; + m_loadMetaDataThread->deleteLater(); m_loadMetaDataThread = 0; #endif @@ -581,24 +583,22 @@ void KMetaDataWidget::setItems(const KFileItemList& items) } #ifdef HAVE_NEPOMUK - if (d->m_nepomukActivated) { - QList urls; - foreach (const KFileItem& item, items) { - const KUrl url = item.nepomukUri(); - if (url.isValid()) { - urls.append(url); - } - } - - if (d->m_loadMetaDataThread != 0) { - disconnect(d->m_loadMetaDataThread, SIGNAL(finished()), this, SLOT(slotLoadingFinished())); - d->m_loadMetaDataThread->cancelAndDelete(); + QList urls; + foreach (const KFileItem& item, items) { + const KUrl url = item.nepomukUri(); + if (url.isValid()) { + urls.append(url); } + } - d->m_loadMetaDataThread = new KLoadMetaDataThread(); - connect(d->m_loadMetaDataThread, SIGNAL(finished()), this, SLOT(slotLoadingFinished())); - d->m_loadMetaDataThread->load(urls); + if (d->m_loadMetaDataThread != 0) { + disconnect(d->m_loadMetaDataThread, SIGNAL(finished()), this, SLOT(slotLoadingFinished())); + d->m_loadMetaDataThread->cancelAndDelete(); } + + d->m_loadMetaDataThread = new KLoadMetaDataThread(); + connect(d->m_loadMetaDataThread, SIGNAL(finished()), this, SLOT(slotLoadingFinished())); + d->m_loadMetaDataThread->load(urls); #endif }