┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/information/kcommentwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels/information/kcommentwidget.cpp')
-rw-r--r--src/panels/information/kcommentwidget.cpp29
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);