KNewStuff
kdxscomments.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "kdxscomments.h"
00020
00021 #include <klocale.h>
00022 #include <ktextbrowser.h>
00023
00024 #include <QtGui/QLayout>
00025 #include <QtGui/QApplication>
00026
00027 #include <QtGui/QCursor>
00028
00029 KDXSComments::KDXSComments(QWidget *parent)
00030 : KDialog(parent)
00031 {
00032 setCaption(i18n("User comments"));
00033 setButtons(KDialog::Close);
00034
00035 m_log = new KTextBrowser(this);
00036 setMainWidget(m_log);
00037
00038 connect(m_log, SIGNAL(anchorClicked(const QUrl&)),
00039 SLOT(slotUrl(const QUrl&)));
00040 }
00041
00042 void KDXSComments::slotUrl(const QUrl& url)
00043 {
00044 if (!url.isEmpty()) {
00045 qDebug("SHOW %s!", qPrintable(url.toString()));
00046 }
00047 }
00048
00049 void KDXSComments::addComment(const QString& username, const QString& comment)
00050 {
00051
00052 QString t;
00053
00054 t += m_log->toHtml();
00055
00056 QString email = "spillner@kde.org";
00057
00058 t += "<a href='" + email + "'>" + Qt::escape(username) + "</a>"
00059 + "<table class='itemBox'>"
00060 + "<tr>"
00061 + "<td class='contentsColumn'>"
00062 + "<table class='contentsHeader' cellspacing='2' cellpadding='0'><tr>"
00063 + "<td>Comment!</td>"
00064 + "</tr></table>"
00065 + "<div class='contentsBody'>"
00066 + Qt::escape(comment)
00067 + "</div>"
00068 + "<div class='contentsFooter'>"
00069 + "<em>" + Qt::escape(username) + "</em>"
00070 + "</div>"
00071 + "</td>"
00072 + "</tr>"
00073 + "</table>";
00074
00075 m_log->setHtml(t);
00076 }
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 #include "kdxscomments.moc"