Hello community, here is the log from the commit of package attica-qt5 for openSUSE:Factory checked in at 2018-07-21 10:09:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/attica-qt5 (Old) and /work/SRC/openSUSE:Factory/.attica-qt5.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "attica-qt5" Sat Jul 21 10:09:52 2018 rev:56 rq:623250 version:5.48.0 Changes: -------- --- /work/SRC/openSUSE:Factory/attica-qt5/attica-qt5.changes 2018-06-22 13:16:55.167619875 +0200 +++ /work/SRC/openSUSE:Factory/.attica-qt5.new/attica-qt5.changes 2018-07-21 10:09:55.191174794 +0200 @@ -1,0 +2,17 @@ +Mon Jul 16 04:37:32 UTC 2018 - lbeltr...@kde.org + +- Update to 5.48.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.48.0.php +- Changes since 5.47.0: + * Use more nullptr + * Port remaining uses of qDebug() to qcDebug(ATTICA) + * Remove QT definitions duplicated from KDEFrameworkCompilerSettings or dead + * Add debug output for all network requests + * Fix checking invalid provider url + * Unbreak building tests on Windows + * Add provider auto test + * Fix broken url to API specification + +------------------------------------------------------------------- Old: ---- attica-5.47.0.tar.xz New: ---- attica-5.48.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ attica-qt5.spec ++++++ --- /var/tmp/diff_new_pack.8rhc1c/_old 2018-07-21 10:09:55.683174681 +0200 +++ /var/tmp/diff_new_pack.8rhc1c/_new 2018-07-21 10:09:55.683174681 +0200 @@ -19,13 +19,13 @@ %define sonum 5 %define rname attica %define _libname KF5Attica -%define _tar_path 5.47 +%define _tar_path 5.48 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) -%{!?_kf5_bugfix_version: %global _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} +%{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} Name: attica-qt5 -Version: 5.47.0 +Version: 5.48.0 Release: 0 Summary: Open Collaboration Service client library License: LGPL-2.1-or-later ++++++ attica-5.47.0.tar.xz -> attica-5.48.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/CMakeLists.txt new/attica-5.48.0/CMakeLists.txt --- old/attica-5.47.0/CMakeLists.txt 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/CMakeLists.txt 2018-07-07 23:51:40.000000000 +0200 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.47.0") # handled by release scripts +set(KF5_VERSION "5.48.0") # handled by release scripts project(Attica VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.47.0 NO_MODULE) +find_package(ECM 5.48.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -39,9 +39,6 @@ set(ATTICA_LIB_SONAME KF5Attica) -add_definitions( -DQT_NO_CAST_FROM_ASCII ) -add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) - # Enable static build option(ATTICA_STATIC_BUILD "Build a static library" Off) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/README.md new/attica-5.48.0/README.md --- old/attica-5.47.0/README.md 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/README.md 2018-07-07 23:51:40.000000000 +0200 @@ -6,7 +6,7 @@ Attica is a Qt library that implements the Open Collaboration Services API version 1.6. The REST API is defined here: -http://freedesktop.org/wiki/Specifications/open-collaboration-services/ +https://www.freedesktop.org/wiki/Specifications/open-collaboration-services/ It grants easy access to the services such as querying information about persons and contents. The library is used in KNewStuff3 as content provider. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/autotests/CMakeLists.txt new/attica-5.48.0/autotests/CMakeLists.txt --- old/attica-5.47.0/autotests/CMakeLists.txt 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/autotests/CMakeLists.txt 2018-07-07 23:51:40.000000000 +0200 @@ -4,6 +4,8 @@ set_package_properties(Qt5Test PROPERTIES PURPOSE "Required for autotests") ecm_add_tests( + configtest.cpp persontest.cpp + providertest.cpp LINK_LIBRARIES Qt5::Test KF5::Attica ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/autotests/configtest.cpp new/attica-5.48.0/autotests/configtest.cpp --- old/attica-5.47.0/autotests/configtest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/attica-5.48.0/autotests/configtest.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -0,0 +1,58 @@ +/* + This file is part of KDE. + + Copyright (c) 2018 Ralf Habacker <ralf.habac...@freenet.de> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include <QtTest/QtTest> +#include <configparser.h> + +using namespace Attica; + +class ConfigTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void testParsing(); +}; + +void ConfigTest::testParsing() +{ + Config::Parser parser; + QString validData (QLatin1String("<?xml version=\"1.0\"?>" + "<ocs><data>" + "<version>1.7</version>" + "<website>store.kde.org</website>" + "<host>api.kde-look.org</host>" + "<contact>cont...@opendesktop.org</contact>" + "<ssl>true</ssl>" + "</data></ocs>")); + Config config = parser.parse(validData); + QVERIFY(config.isValid()); + + QString invalidData = QLatin1String("<ocs><braaaaaaaaaaawrlawrf></braaaaaaaaaaawrlawrf></ocs>"); + config = parser.parse(invalidData); + QVERIFY(!config.isValid()); +} + +QTEST_MAIN(ConfigTest) + +#include "configtest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/autotests/providertest.cpp new/attica-5.48.0/autotests/providertest.cpp --- old/attica-5.47.0/autotests/providertest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/attica-5.48.0/autotests/providertest.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -0,0 +1,150 @@ +/* + This file is part of KDE. + + Copyright (c) 2018 Ralf Habacker <ralf.habac...@freenet.de> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include <QtTest/QtTest> +#include <QEventLoop> + +#include <QLoggingCategory> + +#include <config.h> +#include <providermanager.h> + + +using namespace Attica; + +class ProviderTest : public QObject +{ + Q_OBJECT +public: + ProviderTest(); + virtual ~ProviderTest(); + +private: + void initProvider(const QUrl &url); + +private Q_SLOTS: + void testFetchValidProvider(); + void testFetchInvalidProvider(); + +protected Q_SLOTS: + void providerAdded(Attica::Provider p); + void slotDefaultProvidersLoaded(); + void slotConfigResult(Attica::BaseJob *j); + void slotTimeout(); + +private: + Attica::ProviderManager *m_manager; + QEventLoop *m_eventloop; + QTimer m_timer; + bool m_checkFail; +}; + +ProviderTest::ProviderTest() + : m_manager(nullptr), + m_eventloop(new QEventLoop), + m_checkFail(true) +{ + QLoggingCategory::setFilterRules(QStringLiteral("org.kde.attica.debug=true")); +} + +ProviderTest::~ProviderTest() +{ + delete m_manager; +} + +void ProviderTest::slotDefaultProvidersLoaded() +{ + qDebug() << "default providers loaded"; + m_eventloop->exit(); +} + +void ProviderTest::providerAdded(Attica::Provider p) +{ + qDebug() << "got provider" << p.name(); + m_eventloop->exit(); +} + +void ProviderTest::initProvider(const QUrl &url) +{ + delete m_manager; + m_manager = new Attica::ProviderManager; + m_manager->setAuthenticationSuppressed(true); + connect(m_manager, SIGNAL(defaultProvidersLoaded()), this, SLOT(slotDefaultProvidersLoaded())); + connect(m_manager, SIGNAL(providerAdded(Attica::Provider)), this, SLOT(providerAdded(Attica::Provider))); + m_manager->addProviderFile(url); + m_timer.singleShot(5000, this, SLOT(slotTimeout())); + m_checkFail = true; + + m_eventloop->exec(); +} +void ProviderTest::testFetchValidProvider() +{ + initProvider(QUrl(QLatin1String("https://autoconfig.kde.org/ocs/providers.xml"))); + Attica::Provider provider = m_manager->providers().at(0); + ItemJob<Config>* job = provider.requestConfig(); + QVERIFY(job); + connect(job, SIGNAL(finished(Attica::BaseJob*)), SLOT(slotConfigResult(Attica::BaseJob*))); + job->start(); + m_eventloop->exec(); +} + +void ProviderTest::slotConfigResult(Attica::BaseJob* j) +{ + if (j->metadata().error() == Metadata::NoError) { + Attica::ItemJob<Config> *itemJob = static_cast<Attica::ItemJob<Config> *>( j ); + Attica::Config p = itemJob->result(); + qDebug() << QLatin1String("Config loaded - Server has version") << p.version(); + } else if (j->metadata().error() == Metadata::OcsError) { + qDebug() << QString(QLatin1String("OCS Error: %1")).arg(j->metadata().message()); + } else if (j->metadata().error() == Metadata::NetworkError) { + qDebug() << QString(QLatin1String("Network Error: %1")).arg(j->metadata().message()); + } else { + qDebug() << QString(QLatin1String("Unknown Error: %1")).arg(j->metadata().message()); + } + m_eventloop->exit(); + m_timer.stop(); + QVERIFY(j->metadata().error() == Metadata::NoError); +} + +void ProviderTest::slotTimeout() +{ + if (m_eventloop->isRunning()) { + m_eventloop->exit(); + if (m_checkFail) + QFAIL("Could not fetch provider"); + } +} + +void ProviderTest::testFetchInvalidProvider() +{ + // TODO error state could only be checked indirectly by timeout + initProvider(QUrl(QLatin1String("https://invalid-url.org/ocs/providers.xml"))); + m_timer.singleShot(5000, this, SLOT(slotTimeout())); + m_checkFail = false; + m_eventloop->exec(); + QVERIFY(m_manager->providers().size() == 0); +} + +QTEST_MAIN(ProviderTest) + +#include "providertest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/CMakeLists.txt new/attica-5.48.0/src/CMakeLists.txt --- old/attica-5.47.0/src/CMakeLists.txt 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/CMakeLists.txt 2018-07-07 23:51:40.000000000 +0200 @@ -26,6 +26,8 @@ categoryparser.cpp comment.cpp commentparser.cpp + config.cpp + configparser.cpp content.cpp contentparser.cpp deletejob.cpp @@ -102,6 +104,7 @@ AccountBalance Achievement Comment + Config Content Category DeleteJob diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/atticabasejob.cpp new/attica-5.48.0/src/atticabasejob.cpp --- old/attica-5.47.0/src/atticabasejob.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/atticabasejob.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -29,6 +29,7 @@ #include <QAuthenticator> #include <attica_debug.h> +#include <atticautils.h> #include "platformdependent.h" using namespace Attica; @@ -94,7 +95,7 @@ // handle redirections automatically QUrl newUrl; if (d->redirection(newUrl)) { - //qDebug() << "BaseJob::dataFinished" << newUrl; + //qCDebug(ATTICA) << "BaseJob::dataFinished" << newUrl; QNetworkRequest request = d->m_reply->request(); QNetworkAccessManager::Operation operation = d->m_reply->operation(); if (newUrl.isValid() && operation == QNetworkAccessManager::GetOperation) { @@ -111,7 +112,7 @@ if (!error) { QByteArray data = d->m_reply->readAll(); - //qDebug() << "XML Returned:\n" << data; + //qCDebug(ATTICA) << "XML Returned:\n" << data; parse(QString::fromUtf8(data.constData())); if (d->m_metadata.statusCode() == 100) { d->m_metadata.setError(Metadata::NoError); @@ -137,6 +138,7 @@ void BaseJob::doWork() { d->m_reply = executeRequest(); + qCDebug(ATTICA) << "executing" << Utils::toString(d->m_reply->operation()) << "request for" << d->m_reply->url(); connect(d->m_reply, SIGNAL(finished()), SLOT(dataFinished())); connect(d->m_reply->manager(), SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/atticautils.cpp new/attica-5.48.0/src/atticautils.cpp --- old/attica-5.47.0/src/atticautils.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/atticautils.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -72,3 +72,17 @@ return result; } + +const char *Utils::toString(QNetworkAccessManager::Operation operation) +{ + switch(operation) { + case QNetworkAccessManager::GetOperation : return "Get"; + case QNetworkAccessManager::HeadOperation : return "Head"; + case QNetworkAccessManager::PutOperation : return "Put"; + case QNetworkAccessManager::PostOperation : return "Post"; + case QNetworkAccessManager::DeleteOperation : return "Delete"; + case QNetworkAccessManager::CustomOperation : return "Custom"; + default: return "unknown"; + } + return "invalid"; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/atticautils.h new/attica-5.48.0/src/atticautils.h --- old/attica-5.47.0/src/atticautils.h 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/atticautils.h 2018-07-07 23:51:40.000000000 +0200 @@ -26,6 +26,7 @@ #include <QDateTime> #include <QString> +#include <QNetworkAccessManager> namespace Attica { @@ -35,6 +36,7 @@ public: /// parses the QtDateTime in ISO 8601 format correctly (recognizes TZ properly) static QDateTime parseQtDateTimeIso8601(const QString &str); + static const char *toString(QNetworkAccessManager::Operation operation); }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/buildservicejobparser.cpp new/attica-5.48.0/src/buildservicejobparser.cpp --- old/attica-5.47.0/src/buildservicejobparser.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/buildservicejobparser.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -33,7 +33,7 @@ // For specs about the XML provided, see here: // http://www.freedesktop.org/wiki/Specifications/open-collaboration-services-draft#BuildServiceJobs while (!xml.atEnd()) { - //qDebug() << "XML returned:" << xml.text().toString(); + //qCDebug(ATTICA) << "XML returned:" << xml.text().toString(); xml.readNext(); if (xml.isStartElement()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/config.cpp new/attica-5.48.0/src/config.cpp --- old/attica-5.47.0/src/config.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/attica-5.48.0/src/config.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -0,0 +1,116 @@ +/* + This file is part of KDE. + + Copyright (c) 2018 Ralf Habacker <ralf.habac...@freenet.de> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include "config.h" + +using namespace Attica; + +class Config::Private : public QSharedData { + public: + QString m_version; + QString m_website; + QString m_host; + QString m_contact; + bool m_ssl; + + Private() + : m_ssl(false) + { + } +}; + + +Config::Config() + : d(new Private) +{ +} + +Config::Config(const Attica::Config& other) + : d(other.d) +{ +} + +Config& Config::operator=(const Attica::Config & other) +{ + d = other.d; + return *this; +} + +Config::~Config() +{ +} + +QString Attica::Config::version() const +{ + return d->m_version; +} + +QString Config::website() const +{ + return d->m_website; +} + +QString Config::host() const +{ + return d->m_host; +} + +QString Config::contact() const +{ + return d->m_contact; +} + +bool Config::ssl() const +{ + return d->m_ssl; +} + +bool Config::isValid() const +{ + return !(d->m_version.isEmpty()); +} + +void Config::setContact(const QString &contact) +{ + d->m_contact = contact; +} + +void Config::setVersion(const QString &version) +{ + d->m_version = version; +} + +void Config::setWebsite(const QString &website) +{ + d->m_website = website; +} + +void Config::setHost(const QString &host) +{ + d->m_host = host; +} + +void Config::setSsl(bool ssl) +{ + d->m_ssl = ssl; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/config.h new/attica-5.48.0/src/config.h --- old/attica-5.47.0/src/config.h 1970-01-01 01:00:00.000000000 +0100 +++ new/attica-5.48.0/src/config.h 2018-07-07 23:51:40.000000000 +0200 @@ -0,0 +1,90 @@ +/* + This file is part of KDE. + + Copyright (c) 2018 Ralf Habacker <ralf.habac...@freenet.de> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. + +*/ +#ifndef ATTICA_CONFIG_H +#define ATTICA_CONFIG_H + +#include <QtCore/QString> +#include <QtCore/QSharedDataPointer> + +#include "attica_export.h" + +namespace Attica { + +/** + * Represents a server config + */ +class ATTICA_EXPORT Config +{ + public: + typedef QList<Config> List; + class Parser; + + /** + * Creates an empty Config + */ + Config(); + + /** + * Copy constructor. + * @param other the Config to copy from + */ + Config(const Config& other); + + /** + * Assignment operator. + * @param other the Config to assign from + * @return pointer to this Config + */ + Config& operator=(const Config& other); + + /** + * Destructor. + */ + ~Config(); + + QString contact() const; + QString host() const; + QString version() const; + bool ssl() const; + QString website() const; + + void setContact(const QString &contact); + void setHost(const QString &host); + void setSsl(bool ssl); + void setVersion(const QString &version); + void setWebsite(const QString &website); + + /** + * Checks whether this config is valid + * @return @c true if config is valid, @c false otherwise + */ + bool isValid() const; + + private: + class Private; + QSharedDataPointer<Private> d; +}; + +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/configparser.cpp new/attica-5.48.0/src/configparser.cpp --- old/attica-5.47.0/src/configparser.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/attica-5.48.0/src/configparser.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -0,0 +1,61 @@ +/* + This file is part of KDE. + + Copyright (c) 2018 Ralf Habacker <ralf.habac...@freenet.de> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include "configparser.h" + + +using namespace Attica; + +Config Config::Parser::parseXml(QXmlStreamReader& xml) +{ + Config config; + + while (!xml.atEnd()) { + xml.readNext(); + + if (xml.isStartElement()) { + if (xml.name() == QLatin1String("version")) { + config.setVersion( xml.readElementText()); + } else if (xml.name() == QLatin1String("website")) { + config.setWebsite( xml.readElementText()); + } else if (xml.name() == QLatin1String("host")) { + config.setHost( xml.readElementText()); + } else if (xml.name() == QLatin1String("contact")) { + config.setContact( xml.readElementText()); + } else if (xml.name() == QLatin1String("ssl")) { + config.setSsl(xml.readElementText() == QLatin1String("true")); + } + } + + if (xml.isEndElement() && xml.name() == QLatin1String("data")) { + break; + } + } + + return config; +} + + +QStringList Config::Parser::xmlElement() const { + return QStringList(QLatin1String( "data" )); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/configparser.h new/attica-5.48.0/src/configparser.h --- old/attica-5.47.0/src/configparser.h 1970-01-01 01:00:00.000000000 +0100 +++ new/attica-5.48.0/src/configparser.h 2018-07-07 23:51:40.000000000 +0200 @@ -0,0 +1,45 @@ +/* + This file is part of KDE. + + Copyright (c) 2018 Ralf Habacker <ralf.habac...@freenet.de> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#ifndef ATTICA_CONFIGPARSER_H +#define ATTICA_CONFIGPARSER_H + +#include "config.h" +#include "parser.h" + +#include "attica_export.h" + +namespace Attica { + +class ATTICA_EXPORT Config::Parser : public Attica::Parser<Config> +{ +private: + Config parseXml(QXmlStreamReader& xml) override; + QStringList xmlElement() const override; + +}; + +} + + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/getjob.cpp new/attica-5.48.0/src/getjob.cpp --- old/attica-5.47.0/src/getjob.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/getjob.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -37,7 +37,6 @@ QNetworkReply *GetJob::executeRequest() { - qCDebug(ATTICA) << "executing get request for url" << m_request.url().toString(); return internals()->get(m_request); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/listjob_inst.cpp new/attica-5.48.0/src/listjob_inst.cpp --- old/attica-5.47.0/src/listjob_inst.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/listjob_inst.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -44,6 +44,8 @@ #include "categoryparser.h" #include "comment.h" #include "commentparser.h" +#include "config.h" +#include "configparser.h" #include "content.h" #include "contentparser.h" #include "distribution.h" @@ -119,6 +121,7 @@ template class ItemJob<BuildService>; template class ItemJob<Forum>; template class ItemJob<PrivateData>; +template class ItemJob<Config>; template class ItemJob<Content>; template class ItemJob<DownloadItem>; template class ItemJob<Event>; @@ -143,6 +146,7 @@ template class Parser<PrivateData>; template class Parser<Category>; template class Parser<Comment>; +template class Parser<Config>; template class Parser<Content>; template class Parser<Distribution>; template class Parser<DownloadItem>; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/parser.cpp new/attica-5.48.0/src/parser.cpp --- old/attica-5.47.0/src/parser.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/parser.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -108,7 +108,7 @@ </ocs>\ "); - qDebug() << "parsing list:" << xmlString; + qCDebug(ATTICA) << "parsing list:" << xmlString; */ QStringList elements = xmlElement(); typename T::List items; @@ -118,7 +118,7 @@ while (!xml.atEnd()) { xml.readNext(); - //qDebug() << "parseList():: Looking for:" << xml.name().toString(); + //qCDebug(ATTICA) << "parseList():: Looking for:" << xml.name().toString(); if (xml.isStartElement()) { if (xml.name() == QLatin1String("data")) { while (!xml.atEnd()) { @@ -129,7 +129,7 @@ } if (xml.isStartElement() && elements.contains(xml.name().toString())) { - //qDebug() << "xxxxxxxxx New Item!" << xml.name().toString(); + //qCDebug(ATTICA) << "xxxxxxxxx New Item!" << xml.name().toString(); items.append(parseXml(xml)); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/postfiledata.cpp new/attica-5.48.0/src/postfiledata.cpp --- old/attica-5.47.0/src/postfiledata.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/postfiledata.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -97,7 +97,7 @@ void PostFileData::addFile(const QString& fileName, QIODevice* file, const QString& mimeType) { if (d->finished) { - qDebug() << "PostFileData::addFile: should not add data after calling request() or data()"; + qCDebug(ATTICA) << "PostFileData::addFile: should not add data after calling request() or data()"; } QByteArray data = file->readAll(); addFile(fileName, data, mimeType); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/postjob.cpp new/attica-5.48.0/src/postjob.cpp --- old/attica-5.47.0/src/postjob.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/postjob.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -68,7 +68,7 @@ void PostJob::parse(const QString &xmlString) { - //qDebug() << "PostJob::parse" << xmlString; + //qCDebug(ATTICA) << "PostJob::parse" << xmlString; QXmlStreamReader xml(xmlString); Metadata data; while (!xml.atEnd()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/projectparser.cpp new/attica-5.48.0/src/projectparser.cpp --- old/attica-5.47.0/src/projectparser.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/projectparser.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -33,7 +33,7 @@ // For specs about the XML provided, see here: // http://www.freedesktop.org/wiki/Specifications/open-collaboration-services-draft#Projects while (!xml.atEnd()) { - //qDebug() << "XML returned:" << xml.text().toString(); + //qCDebug(ATTICA) << "XML returned:" << xml.text().toString(); xml.readNext(); if (xml.isStartElement()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/provider.cpp new/attica-5.48.0/src/provider.cpp --- old/attica-5.47.0/src/provider.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/provider.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -43,6 +43,7 @@ #include "categoryparser.h" #include "comment.h" #include "commentparser.h" +#include "config.h" #include "content.h" #include "contentparser.h" #include "distribution.h" @@ -309,6 +310,16 @@ return new PostJob(d->m_internals, createRequest(QLatin1String("person/check")), postParameters); } +ItemJob<Config> *Provider::requestConfig() +{ + if (!isValid()) { + return nullptr; + } + + QUrl url = createUrl(QLatin1String("config")); + return doRequestConfig(url); +} + PostJob *Provider::registerAccount(const QString &id, const QString &password, const QString &mail, const QString &firstName, const QString &lastName) { if (!isValid()) { @@ -560,7 +571,7 @@ return nullptr; } - //qDebug() << "request activity"; + //qCDebug(ATTICA) << "request activity"; QUrl url = createUrl(QLatin1String("activity")); return doRequestActivityList(url); } @@ -571,7 +582,7 @@ return nullptr; } - //qDebug() << "request projects"; + //qCDebug(ATTICA) << "request projects"; QUrl url = createUrl(QLatin1String("buildservice/project/list")); return new ListJob<Project>(d->m_internals, createRequest(url)); } @@ -583,7 +594,7 @@ } QUrl url = createUrl(QLatin1String("buildservice/project/get/") + id); - //qDebug() << url; + //qCDebug(ATTICA) << url; return new ItemJob<Project>(d->m_internals, createRequest(url)); } @@ -671,7 +682,7 @@ return nullptr; } - //qDebug() << "request publisher" << id; + //qCDebug(ATTICA) << "request publisher" << id; QUrl url = createUrl(QLatin1String("buildservice/publishing/getpublisher/") + id); return new ItemJob<Publisher>(d->m_internals, createRequest(url)); } @@ -688,7 +699,7 @@ postParameters.insert(QLatin1String("fields[0][data]"), field.data()); QString url = QLatin1String("buildservice/publishing/savefields/") + project.id(); - //qDebug() << "saving field values..."; + //qCDebug(ATTICA) << "saving field values..."; return new PostJob(d->m_internals, createRequest(url), postParameters); } @@ -703,7 +714,7 @@ QString url = QLatin1String("buildservice/publishing/publishtargetresult/") + buildjob.id() + QLatin1Char('/') + publisher.id(); - //qDebug() << "pub'ing"; + //qCDebug(ATTICA) << "pub'ing"; return new PostJob(d->m_internals, createRequest(url), postParameters); } @@ -715,7 +726,7 @@ } QUrl url = createUrl(QLatin1String("buildservice/jobs/getoutput/") + id); - //qDebug() << url; + //qCDebug(ATTICA) << url; return new ItemJob<BuildServiceJobOutput>(d->m_internals, createRequest(url)); } @@ -726,7 +737,7 @@ } QUrl url = createUrl(QLatin1String("buildservice/jobs/get/") + id); - //qDebug() << url; + //qCDebug(ATTICA) << url; return new ItemJob<BuildServiceJob>(d->m_internals, createRequest(url)); } @@ -758,7 +769,7 @@ StringMap postParameters; postParameters.insert(QLatin1String("dummyparameter"), QLatin1String("dummyvalue")); - //qDebug() << "b....................b"; + //qCDebug(ATTICA) << "b....................b"; return new PostJob(d->m_internals, createRequest( QLatin1String("buildservice/jobs/cancel/") + job.id()), postParameters); } @@ -774,7 +785,7 @@ // so even while we don't need any in this case, // we add dummy data to the request postParameters.insert(QLatin1String("dummyparameter"), QLatin1String("dummyvalue")); - //qDebug() << "Creating new BSJ on" << job.buildServiceId(); + //qCDebug(ATTICA) << "Creating new BSJ on" << job.buildServiceId(); return new PostJob(d->m_internals, createRequest( QLatin1String("buildservice/jobs/create/") + job.projectId() + QLatin1Char('/') + job.buildServiceId() + QLatin1Char('/') + job.target()), @@ -787,7 +798,7 @@ return nullptr; } - //qDebug() << "request projects"; + //qCDebug(ATTICA) << "request projects"; QUrl url = createUrl(QLatin1String("buildservice/buildservices/list")); return new ListJob<BuildService>(d->m_internals, createRequest(url)); } @@ -799,7 +810,7 @@ } QUrl url = createUrl(QLatin1String("buildservice/publishing/getpublishingcapabilities")); - //qDebug() << "request publishers" << url; + //qCDebug(ATTICA) << "request publishers" << url; return new ListJob<Publisher>(d->m_internals, createRequest(url)); } @@ -809,7 +820,7 @@ return nullptr; } - //qDebug() << "request projects"; + //qCDebug(ATTICA) << "request projects"; QUrl url = createUrl(QLatin1String("buildservice/jobs/list/") + project.id()); return new ListJob<BuildServiceJob>(d->m_internals, createRequest(url)); } @@ -820,7 +831,7 @@ return nullptr; } - //qDebug() << "request remoteaccounts"; + //qCDebug(ATTICA) << "request remoteaccounts"; QUrl url = createUrl(QLatin1String("buildservice/remoteaccounts/list/")); return new ListJob<RemoteAccount>(d->m_internals, createRequest(url)); } @@ -840,7 +851,7 @@ postParameters.insert(QLatin1String("type"), account.type()); postParameters.insert(QLatin1String("typeid"), account.remoteServiceId()); // FIXME: remoteserviceid? postParameters.insert(QLatin1String("data"), account.data()); - //qDebug() << "Creating new Remoteaccount" << account.id() << account.login() << account.password(); + //qCDebug(ATTICA) << "Creating new Remoteaccount" << account.id() << account.login() << account.password(); return new PostJob(d->m_internals, createRequest(QLatin1String("buildservice/remoteaccounts/add")), postParameters); } @@ -860,7 +871,7 @@ postParameters.insert(QLatin1String("type"), account.type()); postParameters.insert(QLatin1String("typeid"), account.remoteServiceId()); // FIXME: remoteserviceid? postParameters.insert(QLatin1String("data"), account.data()); - //qDebug() << "Creating new Remoteaccount" << account.id() << account.login() << account.password(); + //qCDebug(ATTICA) << "Creating new Remoteaccount" << account.id() << account.login() << account.password(); return new PostJob(d->m_internals, createRequest(QLatin1String("buildservice/remoteaccounts/edit/") + account.id()), postParameters); } @@ -872,7 +883,7 @@ } QUrl url = createUrl(QLatin1String("buildservice/remoteaccounts/get/") + id); - //qDebug() << url; + //qCDebug(ATTICA) << url; return new ItemJob<RemoteAccount>(d->m_internals, createRequest(url)); } @@ -895,7 +906,7 @@ } QUrl url = createUrl(QLatin1String("buildservice/project/uploadsource/") + projectId); - //qDebug() << "Up'ing tarball" << url << projectId << fileName << payload; + //qCDebug(ATTICA) << "Up'ing tarball" << url << projectId << fileName << payload; PostFileData postRequest(url); postRequest.addFile(fileName, payload, QLatin1String("application/octet-stream"), QLatin1String("source")); return new PostJob(d->m_internals, postRequest.request(), postRequest.data()); @@ -1155,7 +1166,7 @@ pars.insert(QLatin1String("type"), category.id()); pars.insert(QLatin1String("name"), cont.name()); - //qDebug() << "Parameter map: " << pars; + //qCDebug(ATTICA) << "Parameter map: " << pars; return new ItemPostJob<Content>(d->m_internals, createRequest(url), pars); } @@ -1173,7 +1184,7 @@ pars.insert(QLatin1String("type"), updatedCategory.id()); pars.insert(QLatin1String("name"), updatedContent.name()); - //qDebug() << "Parameter map: " << pars; + //qCDebug(ATTICA) << "Parameter map: " << pars; return new ItemPostJob<Content>(d->m_internals, createRequest(url), pars); } @@ -1266,7 +1277,7 @@ StringMap postParameters; postParameters.insert(QLatin1String("vote"), positiveVote ? QLatin1String("good") : QLatin1String("bad")); - //qDebug() << "vote: " << positiveVote; + //qCDebug(ATTICA) << "vote: " << positiveVote; return new PostJob(d->m_internals, createRequest(QLatin1String("content/vote/") + contentId), postParameters); } @@ -1284,7 +1295,7 @@ StringMap postParameters; postParameters.insert(QLatin1String("vote"), QString::number(rating)); - //qDebug() << "vote: " << QString::number(rating); + //qCDebug(ATTICA) << "vote: " << QString::number(rating); return new PostJob(d->m_internals, createRequest(QLatin1String("content/vote/") + contentId), postParameters); } @@ -1597,6 +1608,11 @@ return createRequest(createUrl(path)); } +ItemJob<Config>* Provider::doRequestConfig(const QUrl& url) +{ + return new ItemJob<Config>(d->m_internals, createRequest(url)); +} + ItemJob<Person> *Provider::doRequestPerson(const QUrl &url) { return new ItemJob<Person>(d->m_internals, createRequest(url)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/provider.h new/attica-5.48.0/src/provider.h --- old/attica-5.47.0/src/provider.h 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/provider.h 2018-07-07 23:51:40.000000000 +0200 @@ -59,6 +59,7 @@ class BuildServiceJob; class BuildService; class PrivateData; +class Config; class Content; class DownloadItem; class Distribution; @@ -271,6 +272,12 @@ */ PostJob *checkLogin(const QString &user, const QString &password); + /** + * Fetches server config + * @return The job responsible for fetching data + */ + ItemJob<Config> *requestConfig(); + // Person part of OCS PostJob *registerAccount(const QString &id, const QString &password, const QString &mail, const QString &firstName, const QString &lastName); @@ -670,6 +677,7 @@ // Convenience overload QNetworkRequest createRequest(const QString &path); + ItemJob<Config> *doRequestConfig(const QUrl &url); ItemJob<Person> *doRequestPerson(const QUrl &url); ItemJob<AccountBalance> *doRequestAccountBalance(const QUrl &url); ListJob<Person> *doRequestPersonList(const QUrl &url); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/providermanager.cpp new/attica-5.48.0/src/providermanager.cpp --- old/attica-5.47.0/src/providermanager.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/providermanager.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -24,6 +24,9 @@ #include "providermanager.h" +#include "attica_debug.h" +#include "atticautils.h" + #include <QCoreApplication> #include <QDebug> #include <QFile> @@ -145,6 +148,7 @@ QNetworkRequest req(url); req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); QNetworkReply *reply = d->m_internals->get(req); + qCDebug(ATTICA) << "executing" << Utils::toString(reply->operation()) << "for" << reply->url(); connect(reply, SIGNAL(finished()), &d->m_downloadMapping, SLOT(map())); d->m_downloadMapping.setMapping(reply, url.toString()); d->m_downloads.insert(url.toString(), reply); @@ -223,7 +227,7 @@ } } if (!baseUrl.isEmpty()) { - //qDebug() << "Adding provider" << baseUrl; + //qCDebug(ATTICA) << "Adding provider" << baseUrl; d->m_providers.insert(baseUrl, Provider(d->m_internals, baseUrl, name, icon, person, friendV, message, achievement, activity, content, fan, forum, knowledgebase, event, comment, registerUrl)); @@ -234,7 +238,7 @@ } if (xml.error() != QXmlStreamReader::NoError) { - qDebug() << "error:" << xml.errorString() << "in" << url; + qCDebug(ATTICA) << "error:" << xml.errorString() << "in" << url; } if (d->m_downloads.isEmpty()) { @@ -278,14 +282,14 @@ } } - //qDebug() << "ProviderManager::authenticate" << baseUrl; + //qCDebug(ATTICA) << "ProviderManager::authenticate" << baseUrl; QString user; QString password; if (auth->user().isEmpty() && auth->password().isEmpty()) { if (d->m_internals->hasCredentials(baseUrl)) { if (d->m_internals->loadCredentials(baseUrl, user, password)) { - //qDebug() << "ProviderManager::authenticate: loading authentication"; + //qCDebug(ATTICA) << "ProviderManager::authenticate: loading authentication"; auth->setUser(user); auth->setPassword(password); return; @@ -294,7 +298,7 @@ } if (!d->m_authenticationSuppressed && d->m_internals->askForCredentials(baseUrl, user, password)) { - //qDebug() << "ProviderManager::authenticate: asking internals for new credentials"; + //qCDebug(ATTICA) << "ProviderManager::authenticate: asking internals for new credentials"; //auth->setUser(user); //auth->setPassword(password); return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/publisherparser.cpp new/attica-5.48.0/src/publisherparser.cpp --- old/attica-5.47.0/src/publisherparser.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/publisherparser.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -35,7 +35,7 @@ QStringList fields; while (!xml.atEnd()) { - //qDebug() << "XML returned:" << xml.text().toString(); + //qCDebug(ATTICA) << "XML returned:" << xml.text().toString(); xml.readNext(); if (xml.isStartElement()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/putjob.cpp new/attica-5.48.0/src/putjob.cpp --- old/attica-5.47.0/src/putjob.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/putjob.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -73,7 +73,7 @@ void PutJob::parse(const QString &xmlString) { - //qDebug() << "PutJob::parse" << xmlString; + //qCDebug(ATTICA) << "PutJob::parse" << xmlString; QXmlStreamReader xml(xmlString); Metadata data; while (!xml.atEnd()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-5.47.0/src/remoteaccountparser.cpp new/attica-5.48.0/src/remoteaccountparser.cpp --- old/attica-5.47.0/src/remoteaccountparser.cpp 2018-06-02 18:26:04.000000000 +0200 +++ new/attica-5.48.0/src/remoteaccountparser.cpp 2018-07-07 23:51:40.000000000 +0200 @@ -33,7 +33,7 @@ // For specs about the XML provided, see here: // http://www.freedesktop.org/wiki/Specifications/open-collaboration-services-draft#RemoteAccounts while (!xml.atEnd()) { - //qDebug() << "XML returned:" << xml.text().toString(); + //qCDebug(ATTICA) << "XML returned:" << xml.text().toString(); xml.readNext(); if (xml.isStartElement()) {