[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:23:28 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=38610e5
The following commit has been merged in the master branch:
commit 38610e5e796faf7cbee96322fb067cede4c59bcd
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Mon Feb 11 23:09:19 2013 +0000
Update bugzilla filter to comply with review comments
---
filters/CMakeLists.txt | 2 ++
filters/bugzilla/CMakeLists.txt | 5 +++--
filters/bugzilla/bugzilla-filter.cpp | 26 ++++++++++++++++------
filters/bugzilla/bugzilla-filter.h | 11 +++++----
.../ktptextui_message_filter_bugzilla.desktop | 1 +
filters/emoticons/CMakeLists.txt | 1 -
filters/formatting/CMakeLists.txt | 1 -
filters/images/CMakeLists.txt | 1 -
filters/texttospeech/CMakeLists.txt | 1 -
9 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/filters/CMakeLists.txt b/filters/CMakeLists.txt
index dd2d088..9c433d7 100644
--- a/filters/CMakeLists.txt
+++ b/filters/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_subdirectory(bugzilla)
+
add_subdirectory(emoticons)
#Commented out until https://bugs.kde.org/show_bug.cgi?id=302534 AND https://bugs.kde.org/show_bug.cgi?id=302862
add_subdirectory(formatting)
diff --git a/filters/bugzilla/CMakeLists.txt b/filters/bugzilla/CMakeLists.txt
index aeb6cd9..39dbc7d 100644
--- a/filters/bugzilla/CMakeLists.txt
+++ b/filters/bugzilla/CMakeLists.txt
@@ -9,10 +9,11 @@ kde4_add_plugin (ktptextui_message_filter_bugzilla
)
target_link_libraries (ktptextui_message_filter_bugzilla
- ktpchat
${QT_LIBRARIES}
- ${QJSON_LIBRARIES}
+ ${qjson_LIBRARIES}
${KDE4_KIO_LIBS}
+ ${KTP_LIBRARIES}
+ ${TELEPATHY_QT4_LIBRARIES}
)
# Install:
diff --git a/filters/bugzilla/bugzilla-filter.cpp b/filters/bugzilla/bugzilla-filter.cpp
index d7f8dfe..c66f30f 100644
--- a/filters/bugzilla/bugzilla-filter.cpp
+++ b/filters/bugzilla/bugzilla-filter.cpp
@@ -23,7 +23,6 @@
#include <KPluginFactory>
#include <KDebug>
#include <KUrl>
-#include <KUriFilter>
#include <KIO/Job>
#include <QTextDocument>
@@ -38,7 +37,7 @@ BugzillaFilter::BugzillaFilter(QObject *parent, const QVariantList &) :
AbstractMessageFilter(parent), d(new Private)
{
d->bugText = QRegExp(QLatin1String("BUG:[ ]*(\d+)"));
- d->sectionTemplate = QLatin1String("[BUG <a href='%1'>%2</a>] %3");
+ d->sectionTemplate = QLatin1String("<br/>[BUG <a href='%1'>%2</a>] %3 - %4");
}
BugzillaFilter::~BugzillaFilter()
@@ -46,7 +45,7 @@ BugzillaFilter::~BugzillaFilter()
delete d;
}
-void BugzillaFilter::addBugDescription(Message &msg, KUrl &baseUrl) {
+void BugzillaFilter::addBugDescription(KTp::Message &msg, const KUrl &baseUrl) {
KUrl request;
request.setHost(baseUrl.host());
request.setProtocol(baseUrl.protocol());
@@ -62,6 +61,7 @@ void BugzillaFilter::addBugDescription(Message &msg, KUrl &baseUrl) {
KIO::StoredTransferJob *job = KIO::storedGet(request);
job->exec();
+
QVariantMap response = QJson::Parser().parse(job->data()).toMap();
if (response.contains(QLatin1String("result"))) {
QVariantMap result = response.value(QLatin1String("result")).toMap();
@@ -71,12 +71,17 @@ void BugzillaFilter::addBugDescription(Message &msg, KUrl &baseUrl) {
QVariantMap bug = bugs.first().toMap();
if (bug.contains(QLatin1String("summary"))) {
QString summary = bug.value(QLatin1String("summary")).toString();
- kDebug() << summary;
+ QString status = bug.value(QLatin1String("status")).toString();
+
+ if (status == QLatin1String("RESOLVED")) {
+ status += QString::fromLatin1(" (%1)").arg(bug.value(QLatin1String("resolution")).toString());
+ }
msg.appendMessagePart(d->sectionTemplate
.arg(baseUrl.url())
.arg(Qt::escape(baseUrl.queryItemValue(QLatin1String("id"))))
- .arg(Qt::escape(summary)));
+ .arg(Qt::escape(summary))
+ .arg(status));
}
}
}
@@ -84,18 +89,26 @@ void BugzillaFilter::addBugDescription(Message &msg, KUrl &baseUrl) {
}
-void BugzillaFilter::filterMessage(Message &message)
+void BugzillaFilter::filterMessage(KTp::Message &message, const KTp::MessageContext &context)
{
+ //if we're hidden we don't want to make network requests that can show we're online
+ if (context.account()->currentPresence().type() == Tp::ConnectionPresenceTypeHidden) {
+ return;
+ }
+
QString msg = message.mainMessagePart();
int index = msg.indexOf(d->bugText);
while (index >= 0) {
KUrl baseUrl;
+
+ //TODO make this configurable
baseUrl.setProtocol(QLatin1String("https"));
baseUrl.setHost(QLatin1String("bugs.kde.org"));
baseUrl.setFileName(QLatin1String("show_bug.cgi"));
baseUrl.addQueryItem(QLatin1String("id"), d->bugText.cap(1));
addBugDescription(message, baseUrl);
+
index = msg.indexOf(d->bugText, index + 1);
}
@@ -105,7 +118,6 @@ void BugzillaFilter::filterMessage(Message &message)
if (url.fileName() == QLatin1String("show_bug.cgi")) { //a bugzilla of some sort
kDebug() << "link is to a bugzilla:" << url.host();
- //by using the host from the link, it will work with *any* bugzilla installation
addBugDescription(message, url);
}
}
diff --git a/filters/bugzilla/bugzilla-filter.h b/filters/bugzilla/bugzilla-filter.h
index edc3fa8..91bf3bd 100644
--- a/filters/bugzilla/bugzilla-filter.h
+++ b/filters/bugzilla/bugzilla-filter.h
@@ -19,9 +19,11 @@
#ifndef BUGZILLA_FILTER_H
#define BUGZILLA_FILTER_H
-#include <KTp/AbstractMessageFilter>
+#include <KTp/abstract-message-filter.h>
-class BugzillaFilter : public AbstractMessageFilter
+#include <KUrl>
+
+class BugzillaFilter : public KTp::AbstractMessageFilter
{
Q_OBJECT
@@ -29,10 +31,11 @@ public:
BugzillaFilter(QObject *parent, const QVariantList &);
virtual ~BugzillaFilter();
- virtual void filterMessage(Message &message);
- void addBugDescription(Message &msg, KUrl &baseUrl);
+ virtual void filterMessage(KTp::Message &message, const KTp::MessageContext &context);
private:
+ void addBugDescription(KTp::Message &msg, const KUrl &baseUrl);
+
class Private;
Private *d;
};
diff --git a/filters/bugzilla/ktptextui_message_filter_bugzilla.desktop b/filters/bugzilla/ktptextui_message_filter_bugzilla.desktop
index 75dcd9a..cc8e95e 100644
--- a/filters/bugzilla/ktptextui_message_filter_bugzilla.desktop
+++ b/filters/bugzilla/ktptextui_message_filter_bugzilla.desktop
@@ -11,3 +11,4 @@ X-KDE-PluginInfo-Version=0.4
X-KDE-PluginInfo-Website=http://community.kde.org/Real-Time_Communication_and_Collaboration
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
+X-KTp-PluginInfo-Version=2
diff --git a/filters/emoticons/CMakeLists.txt b/filters/emoticons/CMakeLists.txt
index 780f8cb..f61ef6f 100644
--- a/filters/emoticons/CMakeLists.txt
+++ b/filters/emoticons/CMakeLists.txt
@@ -10,7 +10,6 @@ kde4_add_plugin (ktptextui_message_filter_emoticons
)
target_link_libraries (ktptextui_message_filter_emoticons
- ktpchat
${QT_LIBRARIES}
${KDE4_KDEUI_LIBS}
${TELEPATHY_QT4_LIBRARIES}
diff --git a/filters/formatting/CMakeLists.txt b/filters/formatting/CMakeLists.txt
index fd80379..68447d8 100644
--- a/filters/formatting/CMakeLists.txt
+++ b/filters/formatting/CMakeLists.txt
@@ -10,7 +10,6 @@ kde4_add_plugin (ktptextui_message_filter_formatting
)
target_link_libraries (ktptextui_message_filter_formatting
- ktpchat
${QT_LIBRARIES}
${KDE4_KDEUI_LIBS}
${TELEPATHY_QT4_LIBRARIES}
diff --git a/filters/images/CMakeLists.txt b/filters/images/CMakeLists.txt
index 0b9548f..692301b 100644
--- a/filters/images/CMakeLists.txt
+++ b/filters/images/CMakeLists.txt
@@ -10,7 +10,6 @@ kde4_add_plugin (ktptextui_message_filter_images
)
target_link_libraries (ktptextui_message_filter_images
- ktpchat
${QT_LIBRARIES}
${KDE4_KDEUI_LIBS}
${TELEPATHY_QT4_LIBRARIES}
diff --git a/filters/texttospeech/CMakeLists.txt b/filters/texttospeech/CMakeLists.txt
index 7116a85..32410fd 100644
--- a/filters/texttospeech/CMakeLists.txt
+++ b/filters/texttospeech/CMakeLists.txt
@@ -12,7 +12,6 @@ kde4_add_plugin (ktptextui_message_filter_tts
)
target_link_libraries (ktptextui_message_filter_tts
- ktpchat
${QT_LIBRARIES}
${KDE4_KDEUI_LIBS}
${TELEPATHY_QT4_LIBRARIES}
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list