From: Peter Penz Date: Sat, 12 Dec 2009 18:53:05 +0000 (+0000) Subject: use the same link style as used for tags X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/df0b75e8c86178d11b656cc456b8a58354e22293 use the same link style as used for tags svn path=/trunk/KDE/kdebase/apps/; revision=1061705 --- diff --git a/src/panels/information/kloadmetadatathread.cpp b/src/panels/information/kloadmetadatathread.cpp index 37c2cf64e..fd574766d 100644 --- a/src/panels/information/kloadmetadatathread.cpp +++ b/src/panels/information/kloadmetadatathread.cpp @@ -166,20 +166,23 @@ QString KLoadMetaDataThread::formatValue(const Nepomuk::Variant& value) { if (value.isDateTime()) { return KGlobal::locale()->formatDateTime(value.toDateTime(), KLocale::FancyLongDate); - } else if (value.isResource() || value.isResourceList()) { + } + + if (value.isResource() || value.isResourceList()) { QStringList links; foreach(const Nepomuk::Resource& res, value.toResourceList()) { - if (KProtocolInfo::isKnownProtocol(res.resourceUri())) + if (KProtocolInfo::isKnownProtocol(res.resourceUri())) { links << QString::fromLatin1("%2") - .arg(KUrl(res.resourceUri()).url()) - .arg(res.genericLabel()); - else + .arg(KUrl(res.resourceUri()).url()) + .arg(res.genericLabel()); + } else { links << res.genericLabel(); + } } - return QLatin1String("

") + links.join(QLatin1String(";\n")); - } else { - return value.toString(); + return links.join(QLatin1String(";\n")); } + + return value.toString(); } #include "kloadmetadatathread_p.moc" diff --git a/src/panels/information/kmetadatawidget.cpp b/src/panels/information/kmetadatawidget.cpp index d1deea1e7..3a0151004 100644 --- a/src/panels/information/kmetadatawidget.cpp +++ b/src/panels/information/kmetadatawidget.cpp @@ -368,16 +368,31 @@ void KMetaDataWidget::Private::slotLoadingFinished() const QList items = mergedItems(m_loadMetaDataThread->items()); foreach (const KLoadMetaDataThread::Item& item, items) { + const QString itemLabel = item.label; + QString itemValue = item.value; + if (item.value.startsWith("palette().text().color(); + QString decoration; + if (m_readOnly) { + decoration = QString::fromLatin1("text-decoration:none;"); + } + const QString styleText = QString::fromLatin1("style=\"color:%1;%2\" ") + .arg(linkColor.name()) + .arg(decoration); + itemValue.insert(3 /* after "setText(item.label); + m_rows[index].label->setText(itemLabel); QLabel* infoValueLabel = qobject_cast(m_rows[index].infoWidget); Q_ASSERT(infoValueLabel != 0); - infoValueLabel->setText(item.value); + infoValueLabel->setText(itemValue); } else { // create new row - QLabel* infoLabel = new QLabel(item.label, q); - QLabel* infoValue = new QLabel(item.value, q); + QLabel* infoLabel = new QLabel(itemLabel, q); + QLabel* infoValue = new QLabel(itemValue, q); connect(infoValue, SIGNAL(linkActivated(QString)), q, SLOT(slotLinkActivated(QString))); addRow(infoLabel, infoValue); diff --git a/src/panels/information/ktaggingwidget.cpp b/src/panels/information/ktaggingwidget.cpp index 6634d35af..ea17c6253 100644 --- a/src/panels/information/ktaggingwidget.cpp +++ b/src/panels/information/ktaggingwidget.cpp @@ -67,7 +67,7 @@ void KTaggingWidget::setTags(const QList& tags) } else { // use the text color for the tag-links, to create a visual difference // to the semantically different "Change..." link - const QColor linkColor =palette().text().color(); + const QColor linkColor = palette().text().color(); const char* link = "%3"; m_tagsText += QString::fromLatin1(link).arg(linkColor.name(), KUrl(tag.resourceUri()).url(),