]> cloud.milkyroute.net Git - dolphin.git/commitdiff
use the same link style as used for tags
authorPeter Penz <peter.penz19@gmail.com>
Sat, 12 Dec 2009 18:53:05 +0000 (18:53 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 12 Dec 2009 18:53:05 +0000 (18:53 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1061705

src/panels/information/kloadmetadatathread.cpp
src/panels/information/kmetadatawidget.cpp
src/panels/information/ktaggingwidget.cpp

index 37c2cf64ea64f83f6cd84391a5591d04b061756f..fd574766dbd13b6ac70e2b648339decc4e685dcd 100644 (file)
@@ -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("<a href=\"%1\">%2</a>")
-                    .arg(KUrl(res.resourceUri()).url())
-                    .arg(res.genericLabel());
-            else
+                         .arg(KUrl(res.resourceUri()).url())
+                         .arg(res.genericLabel());
+            } else {
                 links << res.genericLabel();
+            }
         }
-        return QLatin1String("<p>") + links.join(QLatin1String(";\n"));
-    } else {
-        return value.toString();
+        return links.join(QLatin1String(";\n"));
     }
+
+    return value.toString();
 }
 
 #include "kloadmetadatathread_p.moc"
index d1deea1e75965aed82de4b0e13b1566886d39f9a..3a01510042a44f7b5cc655d33fa72db1e25413b5 100644 (file)
@@ -368,16 +368,31 @@ void KMetaDataWidget::Private::slotLoadingFinished()
 
     const QList<KLoadMetaDataThread::Item> items = mergedItems(m_loadMetaDataThread->items());
     foreach (const KLoadMetaDataThread::Item& item, items) {
+        const QString itemLabel = item.label;
+        QString itemValue = item.value;
+        if (item.value.startsWith("<a href=")) {
+           // use the text color for the value-links, to create a visual difference
+           // to the semantically different links like "Change..."
+           const QColor linkColor = q->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 "<a "*/, styleText);
+        }
         if (index < rowCount) {
             // adjust texts of the current row
-            m_rows[index].label->setText(item.label);
+            m_rows[index].label->setText(itemLabel);
             QLabel* infoValueLabel = qobject_cast<QLabel*>(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);
index 6634d35af10088ab8f59030ab27b3b7cbc1b1070..ea17c625327b5597092d01e84635caa2691200b3 100644 (file)
@@ -67,7 +67,7 @@ void KTaggingWidget::setTags(const QList<Nepomuk::Tag>& 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 = "<a style=\"color:%1;\" href=\"%2\">%3</a>";
             m_tagsText += QString::fromLatin1(link).arg(linkColor.name(),
                                                         KUrl(tag.resourceUri()).url(),