KNewStuff
kdxscomments.cpp
Go to the documentation of this file.
00001 /* 00002 This file is part of KNewStuff2. 00003 Copyright (c) 2006, 2007 Josef Spillner <spillner@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library. If not, see <http://www.gnu.org/licenses/>. 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 // FIXME: get email address?? 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 void urlSelected(const QString & link, int, int, const QString &, KParts::URLArgs) 00080 { 00081 KURL url(link); 00082 QString urlProtocol = url.protocol(); 00083 QString urlPath = url.path(); 00084 if(urlProtocol == "mailto") 00085 { 00086 kapp->invokeMailer( url ); 00087 } 00088 } 00089 */ 00090 00091 #include "kdxscomments.moc"
KDE 4.6 API Reference