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