diff --git a/plugins/akregator/CMakeLists.txt b/plugins/akregator/CMakeLists.txt --- a/plugins/akregator/CMakeLists.txt +++ b/plugins/akregator/CMakeLists.txt @@ -4,23 +4,25 @@ #set(akregatorkonqplugin_PART_SRCS akregatorplugin.cpp pluginbase.cpp ) # -#kde4_add_plugin(akregatorkonqplugin ${akregatorkonqplugin_PART_SRCS}) +#kde4_add_plugin(akregatorkonqplugin ${akregatorkonqplugin_PART_SRCS} ${akregatorplugin_DEBUG_SRCS}) # #target_link_libraries(akregatorkonqplugin ${KDE4_KDE3SUPPORT_LIBS} Qt5::Xml konq # KF5::KHtml ) # #install(TARGETS akregatorkonqplugin DESTINATION ${KDE_INSTALL_PLUGINDIR} ) +ecm_qt_declare_logging_category(akregatorplugin_DEBUG_SRCS HEADER akregatorplugindebug.h IDENTIFIER AKREGATORPLUGIN_LOG CATEGORY_NAME org.kde.konqueror.akregatorplugin) + ########### next target ############### set(akregatorkonqfeedicon_PART_SRCS konqfeedicon.cpp feeddetector.cpp pluginbase.cpp ) -add_library(akregatorkonqfeedicon MODULE ${akregatorkonqfeedicon_PART_SRCS}) +add_library(akregatorkonqfeedicon MODULE ${akregatorkonqfeedicon_PART_SRCS} ${akregatorplugin_DEBUG_SRCS}) target_compile_definitions(akregatorkonqfeedicon PRIVATE TRANSLATION_DOMAIN="akregator_konqplugin") -target_link_libraries(akregatorkonqfeedicon KF5::Parts KF5::KDELibs4Support) +target_link_libraries(akregatorkonqfeedicon KF5::Parts KF5::IconThemes) install(TARGETS akregatorkonqfeedicon DESTINATION ${KDE_INSTALL_PLUGINDIR} ) diff --git a/plugins/akregator/feeddetector.cpp b/plugins/akregator/feeddetector.cpp --- a/plugins/akregator/feeddetector.cpp +++ b/plugins/akregator/feeddetector.cpp @@ -25,10 +25,11 @@ #include #include #include + #include #include "feeddetector.h" -#include +#include "akregatorplugindebug.h" using namespace Akregator; @@ -98,7 +99,7 @@ } if (!url.isEmpty()) { - kDebug() << "found feed:" << url << title; + qCDebug(AKREGATORPLUGIN_LOG) << "found feed:" << url << title; list.append(FeedDetectorEntry(url, title)); } } diff --git a/plugins/akregator/konqfeedicon.cpp b/plugins/akregator/konqfeedicon.cpp --- a/plugins/akregator/konqfeedicon.cpp +++ b/plugins/akregator/konqfeedicon.cpp @@ -25,8 +25,8 @@ #include "konqfeedicon.h" #include "feeddetector.h" #include "pluginbase.h" +#include "akregatorplugindebug.h" -#include #include #include #include @@ -36,29 +36,23 @@ #include #include #include -#include -#include #include - #include #include #include #include #include +#include #include -#include - -//KDELibs4Support -#include using namespace Akregator; K_PLUGIN_FACTORY(KonqFeedIconFactory, registerPlugin();) -static KUrl baseUrl(KParts::ReadOnlyPart *part) +static QUrl baseUrl(KParts::ReadOnlyPart *part) { - KUrl url; + QUrl url; KParts::HtmlExtension *ext = KParts::HtmlExtension::childObject(part); if (ext) { url = ext->baseUrl(); @@ -102,7 +96,7 @@ bool KonqFeedIcon::feedFound() { // Ensure that it is safe to use the URL, before doing anything else with it - const KUrl partUrl(m_part->url()); + const QUrl partUrl(m_part->url()); if (!partUrl.isValid()) { return false; } @@ -117,7 +111,6 @@ QString doc; if (selectorInterface) { QList linkNodes = selectorInterface->querySelectorAll(QStringLiteral("head > link[rel=\"alternate\"]"), KParts::SelectorInterface::EntireContent); - //kDebug() << linkNodes.length() << "links"; for (int i = 0; i < linkNodes.count(); i++) { const KParts::SelectorInterface::Element element = linkNodes.at(i); @@ -131,7 +124,7 @@ } doc += QLatin1String("/>"); } - kDebug() << doc; + qCDebug(AKREGATORPLUGIN_LOG) << doc; } m_feedList = FeedDetector::extractFromLinkTags(doc); @@ -225,7 +218,7 @@ } addFeedsViaDBUS(list); } else { - kDebug() << "KonqFeedIcon::addFeeds(): use command line"; + qCDebug(AKREGATORPLUGIN_LOG) << "use command line"; KProcess proc; proc << QStringLiteral("akregator") << QStringLiteral("-g") << i18n("Imported Feeds"); diff --git a/plugins/akregator/pluginbase.h b/plugins/akregator/pluginbase.h --- a/plugins/akregator/pluginbase.h +++ b/plugins/akregator/pluginbase.h @@ -27,7 +27,7 @@ class QString; class QStringList; -class KUrl; +class QUrl; namespace Akregator { @@ -52,7 +52,7 @@ * Adds feed to aKregator via command line. */ void addFeedViaCmdLine(const QString &url); - QString fixRelativeURL(const QString &s, const KUrl &baseurl); + QString fixRelativeURL(const QString &s, const QUrl &baseurl); }; } diff --git a/plugins/akregator/pluginbase.cpp b/plugins/akregator/pluginbase.cpp --- a/plugins/akregator/pluginbase.cpp +++ b/plugins/akregator/pluginbase.cpp @@ -22,16 +22,18 @@ without including the source code for Qt in the source distribution. */ -#include #include #include +#include #include "feeddetector.h" #include "pluginbase.h" +#include "akregatorplugindebug.h" + #include +#include #include -#include -#include + using namespace Akregator; PluginBase::PluginBase() @@ -48,7 +50,7 @@ void PluginBase::addFeedsViaDBUS(const QStringList &urls) { - kDebug() << "PluginBase::addFeedsViaDBUS"; + qCDebug(AKREGATORPLUGIN_LOG); QDBusInterface akregator(QStringLiteral("org.kde.akregator"), QStringLiteral("/Akregator"), QStringLiteral("org.kde.akregator.part")); QDBusReply reply = akregator.call(QStringLiteral("addFeedsToGroup"), urls, i18n("Imported Feeds")); if (!reply.isValid()) { @@ -65,28 +67,28 @@ proc.startDetached(); } -// handle all the wild stuff that KUrl doesn't handle -QString PluginBase::fixRelativeURL(const QString &s, const KUrl &baseurl) +// handle all the wild stuff that QUrl doesn't handle +QString PluginBase::fixRelativeURL(const QString &s, const QUrl &baseurl) { QString s2 = s; - KUrl u; - if (KUrl::isRelativeUrl(s2)) { + QUrl u; + if (QUrl(s2).isRelative()) { if (s2.startsWith(QLatin1String("//"))) { - s2 = s2.prepend(baseurl.protocol() + ':'); - u = s2; + s2 = s2.prepend(baseurl.scheme() + ':'); + u.setUrl(s2); } else if (s2.startsWith(QLatin1String("/"))) { - KUrl b2(baseurl); + QUrl b2(baseurl); b2.setPath(QString()); // delete path and query, so that only protocol://host remains b2.setQuery(QString()); - u = KUrl(b2, s2.remove(0, 1)); // remove leading "/" + u = b2.resolved(QUrl(s2.remove(0, 1))); // remove leading "/" } else { - u = KUrl(baseurl, s2); + u = baseurl.resolved(QUrl(s2)); } } else { - u = s2; + u.setUrl(s2); } - u.cleanPath(); - //kDebug() << "AKREGATOR_PLUGIN_FIXURL: " << "url=" << s << " baseurl=" << baseurl.url() << " fixed=" << u.url(); + u = u.adjusted(QUrl::NormalizePathSegments); + //qCDebug(AKREGATORPLUGIN_LOG) << "url=" << s << " baseurl=" << baseurl.url() << "fixed=" << u.url(); return u.url(); }