X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/73007f7d632bdd5565b8394043bb2de07bebb336..ebba84fbdd1effc828f88e08966dad5982371ecc:/src/panels/information/kcommentwidget.cpp 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("" + i18nc("@label", "Add Comment...") + ""); + QString text; + if (comment.isEmpty()) { + if (m_readOnly) { + text = "-"; + } else { + text = "" + i18nc("@label", "Add Comment...") + ""; + } } else { - m_label->setText("
" + comment + " " + i18nc("@label", "Change...") + "
"); + if (m_readOnly) { + text = comment; + } else { + text = "" + comment + " " + i18nc("@label", "Change...") + "
"; + } } + + 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);