KIO
Go to the documentation of this file.
30 #include <QVBoxLayout>
39 m_label =
new QLabel(
this);
40 m_label->setWordWrap(
true);
41 m_label->setAlignment(Qt::AlignTop);
42 connect(m_label, SIGNAL(linkActivated(
QString)),
this, SLOT(slotLinkActivated(
QString)));
44 m_sizeHintHelper =
new QLabel(
this);
45 m_sizeHintHelper->hide();
47 QVBoxLayout* layout =
new QVBoxLayout(
this);
49 layout->addWidget(m_label);
61 if (comment.isEmpty()) {
65 text =
"<a href=\"addComment\">" +
i18nc(
"@label",
"Add Comment...") +
"</a>";
69 text = Qt::escape(comment);
71 text =
"<p>" + Qt::escape(comment) +
" <a href=\"changeComment\">" +
i18nc(
"@label",
"Change...") +
"</a></p>";
75 m_label->setText(text);
76 m_sizeHintHelper->setText(text);
87 m_readOnly = readOnly;
103 return m_sizeHintHelper->sizeHint();
108 if (event->type() == QEvent::Polish) {
109 m_label->setForegroundRole(foregroundRole());
111 return QWidget::event(event);
114 void KCommentWidget::slotLinkActivated(
const QString&
link)
116 QPointer<KDialog> dialog =
new KDialog(
this);
119 editor->setText(m_comment);
121 dialog->setMainWidget(editor);
124 i18nc(
"@title:window",
"Change Comment") :
125 i18nc(
"@title:window",
"Add Comment");
126 dialog->setCaption(caption);
127 dialog->setButtons(KDialog::Ok | KDialog::Cancel);
128 dialog->setDefaultButton(KDialog::Ok);
130 KConfigGroup dialogConfig(KGlobal::config(),
"Nepomuk KEditCommentDialog");
131 dialog->restoreDialogSize(dialogConfig);
133 if (dialog->exec() == QDialog::Accepted) {
134 const QString oldText = m_comment;
136 setText(editor->toPlainText());
138 if (oldText != m_comment) {
144 dialog->saveDialogSize(dialogConfig);
150 #include "kcommentwidget_p.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Thu Sep 25 2014 04:20:28 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.