]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Activated "clicking on tags" fix from Sebastian TrĂ¼g. By providing a different link...
authorPeter Penz <peter.penz19@gmail.com>
Mon, 7 Dec 2009 20:45:20 +0000 (20:45 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Mon, 7 Dec 2009 20:45:20 +0000 (20:45 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1059985

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

index 8b658a03f8d5e015928d631b813e25141a822b0d..5d019691b8419268109f8a64fb1da649dc5358f3 100644 (file)
@@ -97,9 +97,9 @@ public:
     void slotMetaDataUpdateDone();
     void slotLinkActivated(const QString& link);
 
-#ifdef HAVE_NEPOMUK
     void slotTagActivated(const Nepomuk::Tag& tag);
 
+#ifdef HAVE_NEPOMUK
     /**
      * Disables the metadata widget and starts the job that
      * changes the meta data asynchronously. After the job
@@ -264,9 +264,11 @@ void KMetaDataWidget::Private::setRowVisible(QWidget* infoWidget, bool visible)
 
 void KMetaDataWidget::Private::initMetaInfoSettings()
 {
-    static const int s_metainformationrcVersion = 1;
+    const int currentVersion = 1; // increase version, if the blacklist of disabled
+                                  // properties should be updated
+
     KConfig config("kmetainformationrc", KConfig::NoGlobals);
-    if (config.group( "Misc" ).readEntry("version", 0) < s_metainformationrcVersion) {
+    if (config.group("Misc").readEntry("version", 0) < currentVersion) {
         // The resource file is read the first time. Assure
         // that some meta information is disabled per default.
 
@@ -289,7 +291,7 @@ void KMetaDataWidget::Private::initMetaInfoSettings()
         }
 
         // mark the group as initialized
-        config.group( "Misc" ).writeEntry("version", s_metainformationrcVersion);
+        config.group("Misc").writeEntry("version", currentVersion);
     }
 }
 
@@ -429,12 +431,14 @@ void KMetaDataWidget::Private::slotCommentChanged(const QString& comment)
 #endif
 }
 
-#ifdef HAVE_NEPOMUK
 void KMetaDataWidget::Private::slotTagActivated(const Nepomuk::Tag& tag)
 {
+#ifdef HAVE_NEPOMUK
     emit q->urlActivated(tag.resourceUri());
-}
+#else
+    Q_UNUSED(tag);
 #endif
+}
 
 void KMetaDataWidget::Private::slotMetaDataUpdateDone()
 {
index a7d131e14b7084a57d292d111b5e97a8ce441ed7..715defbc321eb859fd33dbb0a7e185b074568c99 100644 (file)
@@ -140,9 +140,7 @@ private:
     Q_PRIVATE_SLOT(d, void slotCommentChanged(const QString& comment))
     Q_PRIVATE_SLOT(d, void slotMetaDataUpdateDone())
     Q_PRIVATE_SLOT(d, void slotLinkActivated(const QString& link))
-#ifdef HAVE_NEPOMUK
     Q_PRIVATE_SLOT(d, void slotTagActivated(const Nepomuk::Tag& tag))
-#endif
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(KMetaDataWidget::MetaDataTypes)
index 4c0ab98bea1e8b660ab57b240d9eefcc83f8ca32..6634d35af10088ab8f59030ab27b3b7cbc1b1070 100644 (file)
@@ -62,15 +62,17 @@ void KTaggingWidget::setTags(const QList<Nepomuk::Tag>& tags)
         if (!first) {
             m_tagsText += ", ";
         }
-#ifdef DOLPHIN_ENABLE_CLICKABLE_TAGS
         if (m_readOnly) {
-#endif
             m_tagsText += tag.genericLabel();
-#ifdef DOLPHIN_ENABLE_CLICKABLE_TAGS
         } else {
-            m_tagsText += QString::fromLatin1( "<a href=\"%1\">%2</a>" ).arg( KUrl(tag.resourceUri()).url(), tag.genericLabel() );
+            // 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 char* link = "<a style=\"color:%1;\" href=\"%2\">%3</a>";
+            m_tagsText += QString::fromLatin1(link).arg(linkColor.name(),
+                                                        KUrl(tag.resourceUri()).url(),
+                                                        tag.genericLabel());
         }
-#endif
         first = false;
     }
 
@@ -85,7 +87,7 @@ void KTaggingWidget::setTags(const QList<Nepomuk::Tag>& tags)
         if (m_readOnly) {
             text = m_tagsText;
         } else {
-            text = "<p>" + m_tagsText + " <a href=\"changeTags\">" + i18nc("@label", "Change...") + "</a></p>";
+            text += m_tagsText + " <a href=\"changeTags\">" + i18nc("@label", "Change...") + "</a>";
         }
     }
     m_label->setText(text);
@@ -117,36 +119,35 @@ bool KTaggingWidget::event(QEvent* event)
 
 void KTaggingWidget::slotLinkActivated(const QString& link)
 {
-    if ( link == QLatin1String( "changeTags" ) ) {
-        KEditTagsDialog dialog(m_tags, this, Qt::Dialog);
-        KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KEditTagsDialog");
-        dialog.restoreDialogSize(dialogConfig);
-
-        if (dialog.exec() == QDialog::Accepted) {
-            const QList<Nepomuk::Tag> oldTags = m_tags;
-            m_tags = dialog.tags();
-
-            if (oldTags.count() != m_tags.count()) {
-                emit tagsChanged(m_tags);
-            } else {
-                // The number of tags is equal. Check whether the
-                // content of the tags are also equal:
-                const int tagsCount = m_tags.count();
-                for (int i = 0; i < tagsCount; ++i) {
-                    if (oldTags[i].genericLabel() != m_tags[i].genericLabel()) {
-                        // at least one tag has been changed
-                        emit tagsChanged(m_tags);
-                        break;
-                    }
+    if (link != QLatin1String("changeTags")) {
+        emit tagActivated(Nepomuk::Tag(KUrl(link)));
+        return;
+    }
+
+    KEditTagsDialog dialog(m_tags, this, Qt::Dialog);
+    KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KEditTagsDialog");
+    dialog.restoreDialogSize(dialogConfig);
+
+    if (dialog.exec() == QDialog::Accepted) {
+        const QList<Nepomuk::Tag> oldTags = m_tags;
+        m_tags = dialog.tags();
+
+        if (oldTags.count() != m_tags.count()) {
+            emit tagsChanged(m_tags);
+        } else {
+            // The number of tags is equal. Check whether the
+            // content of the tags are also equal:
+            const int tagsCount = m_tags.count();
+            for (int i = 0; i < tagsCount; ++i) {
+                if (oldTags[i].genericLabel() != m_tags[i].genericLabel()) {
+                    // at least one tag has been changed
+                    emit tagsChanged(m_tags);
+                    break;
                 }
             }
         }
-
-        dialog.saveDialogSize(dialogConfig, KConfigBase::Persistent);
-    }
-    else {
-        emit tagActivated(Nepomuk::Tag(KUrl(link)));
     }
+    dialog.saveDialogSize(dialogConfig, KConfigBase::Persistent);
 }
 
 #include "ktaggingwidget_p.moc"