diff options
| author | Peter Penz <[email protected]> | 2009-11-11 18:59:29 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2009-11-11 18:59:29 +0000 |
| commit | 36ae0b6185e310113e0e31e247919da866d7f91b (patch) | |
| tree | 0b3ee37adc99e364993c0624c56a8e8760d4bcb4 /src/panels/information/kcommentwidget.cpp | |
| parent | 6d0ddb92fd7e872a9b54782a2bf2a998c7980531 (diff) | |
* don't show the "Add Tags..." and "Add Comments..." links for the meta data inside a tooltip
* minor cleanup of thread-interface to allow a proper sorting/merging on client side
svn path=/trunk/KDE/kdebase/apps/; revision=1047662
Diffstat (limited to 'src/panels/information/kcommentwidget.cpp')
| -rw-r--r-- | src/panels/information/kcommentwidget.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/panels/information/kcommentwidget.cpp b/src/panels/information/kcommentwidget.cpp index 770b6c10c..c1f7ab757 100644 --- a/src/panels/information/kcommentwidget.cpp +++ b/src/panels/information/kcommentwidget.cpp @@ -29,6 +29,7 @@ KCommentWidget::KCommentWidget(QWidget* parent) : QWidget(parent), + m_readOnly(false), m_label(0), m_comment() { @@ -51,11 +52,22 @@ KCommentWidget::~KCommentWidget() void KCommentWidget::setText(const QString& comment) { - if (comment.isEmpty()) { - m_label->setText("<a href=\"addComment\">" + i18nc("@label", "Add Comment...") + "</a>"); + QString text; + if (comment.isEmpty()) { + if (m_readOnly) { + text = "-"; + } else { + text = "<a href=\"addComment\">" + i18nc("@label", "Add Comment...") + "</a>"; + } } else { - m_label->setText("<p>" + comment + " <a href=\"changeComment\">" + i18nc("@label", "Change...") + "</a></p>"); + if (m_readOnly) { + text = comment; + } else { + text = "<p>" + comment + " <a href=\"changeComment\">" + i18nc("@label", "Change...") + "</a></p>"; + } } + + m_label->setText(text); m_comment = comment; } @@ -64,6 +76,17 @@ QString KCommentWidget::text() const return m_comment; } +void KCommentWidget::setReadOnly(bool readOnly) +{ + m_readOnly = readOnly; + setText(m_comment); +} + +bool KCommentWidget::isReadOnly() const +{ + return m_readOnly; +} + void KCommentWidget::slotLinkActivated(const QString& link) { KDialog dialog(this, Qt::Dialog); |
