┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-02-25 19:34:58 +0000
committerPeter Penz <[email protected]>2010-02-25 19:34:58 +0000
commite488496286f200f07ca3027ac7d20bdd679e2560 (patch)
tree4d97354e3055a944b82488369469e6e8e639c4d2 /src
parent3beca2e7f1fa88015dabaa2a492b4763736cb589 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/panels/information/kloadmetadatathread.cpp17
-rw-r--r--src/panels/information/kmetadatawidget.cpp44
2 files changed, 38 insertions, 23 deletions
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 <kconfig.h>
#include <kconfiggroup.h>
+#include <kfilemetainfo.h>
+#include <kfilemetainfoitem.h>
#include <kglobal.h>
#include <klocale.h>
-#include <kdebug.h>
#include <kprotocolinfo.h>
#include <nepomuk/resource.h>
@@ -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<QString, KFileMetaInfoItem> 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<KUrl> 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<KUrl> 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
}