#include <kconfiggroup.h>
#include <kglobal.h>
#include <klocale.h>
+#include <kdebug.h>
#include <nepomuk/resource.h>
Item item;
item.name = prop.name();
item.label = tunedLabel(prop.label());
- if (it.value().isResource() || it.value().isResourceList()) {
- item.resources = it.value().toResourceList();
- } else {
- item.value = formatValue(it.value());
- }
+ item.value = formatValue(it.value());
m_items.append(item);
}
++it;
{
if (value.isDateTime()) {
return KGlobal::locale()->formatDateTime(value.toDateTime(), KLocale::FancyLongDate);
- } else if (value.isResource()) {
- return value.toResource().genericLabel();
- } else if (value.isResourceList()) {
- QStringList list;
+ } else if (value.isResource() || value.isResourceList()) {
+ QStringList links;
foreach(const Nepomuk::Resource& res, value.toResourceList()) {
- list << res.genericLabel();
+ links << QString::fromLatin1("<a href=\"%1\">%2</a>")
+ .arg(KUrl(res.resourceUri()).url())
+ .arg(res.genericLabel());
}
- return list.join(QLatin1String(";\n"));
+ return QLatin1String("<p>") + links.join(QLatin1String(";\n"));
} else {
return value.toString();
}
* Merges items like 'width' and 'height' as one item.
*/
QList<KLoadMetaDataThread::Item> mergedItems(const QList<KLoadMetaDataThread::Item>& items);
-
- /**
- * Returns a (clickable) text for the given item, that can be used for
- * the information value widget.
- */
- QString labelText(const KLoadMetaDataThread::Item& item) const;
#endif
bool m_sizeVisible;
} else {
// create new row
QLabel* infoLabel = new QLabel(item.label, q);
- QLabel* infoValue = new QLabel(labelText(item), q);
+ QLabel* infoValue = new QLabel(item.value, q);
connect(infoValue, SIGNAL(linkActivated(QString)),
q, SLOT(slotLinkActivated(QString)));
addRow(infoLabel, infoValue);
return mergedItems;
}
-
-QString KMetaDataWidget::Private::labelText(const KLoadMetaDataThread::Item& item) const
-{
- if (item.resources.isEmpty()) {
- return item.value;
- }
-
- QStringList links;
- foreach(const Nepomuk::Resource& res, item.resources) {
- links << QString::fromLatin1("<a href=\"%1\">%2</a>")
- .arg(KUrl(res.resourceUri()).url())
- .arg(res.genericLabel());
- }
- return QLatin1String("<p>") + links.join(QLatin1String(";\n"));
-}
#endif
KMetaDataWidget::KMetaDataWidget(QWidget* parent) :