Commit a263b044 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Adjust to KCalCore API changes

parent 35596fb3
......@@ -35,6 +35,7 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX KBLOG
########### Find packages ###########
find_package(KF5CoreAddons ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarCore ${CALENDARCORE_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Syndication ${SYNDICATION_LIB_VERSION} CONFIG REQUIRED)
......
......@@ -29,6 +29,7 @@
#include <unistd.h>
#include <QDateTime>
#include <QTimeZone>
#include <QDebug>
#define TIMEOUT 10000
#define GLOBALTIMEOUT 70000
......
......@@ -29,6 +29,7 @@
#include <QTimer>
#include <QDateTime>
#include <QTimeZone>
#include <QDebug>
#include <unistd.h>
......
......@@ -29,6 +29,7 @@
#include <QDateTime>
#include <QTimeZone>
#include <QTimer>
#include <QDebug>
#include <unistd.h>
......
......@@ -29,6 +29,7 @@
#include <QDateTime>
#include <QTimeZone>
#include <QTimer>
#include <QDebug>
#include <unistd.h>
......
......@@ -26,6 +26,7 @@
#include "kblog/blogmedia.h"
#include <qtest.h>
#include <QDebug>
#include <unistd.h>
#include <QTimer>
......
......@@ -37,6 +37,7 @@ PRIVATE
KF5::XmlRpcClient
KF5::CoreAddons
KF5::KIOCore
KF5::I18n
)
set_target_properties(KF5Blog PROPERTIES
......
......@@ -81,7 +81,7 @@ BlogPost::BlogPost(const KCalCore::Journal::Ptr &journal)
d_ptr->mContent = journal->description();
}
d_ptr->mCategories = journal->categories();
d_ptr->mCreationDateTime = journal->dtStart().dateTime();
d_ptr->mCreationDateTime = journal->dtStart();
}
// BlogPost::BlogPost( const KCal::Journal &journal, BlogPostPrivate &dd )
......@@ -116,7 +116,7 @@ KCalCore::Journal::Ptr BlogPost::journal(const Blog &blog) const
journal->setSummary(d_ptr->mTitle);
journal->setCategories(d_ptr->mCategories);
journal->setDescription(d_ptr->mContent, true);
journal->setDtStart(KDateTime(d_ptr->mCreationDateTime));
journal->setDtStart(d_ptr->mCreationDateTime);
journal->setCustomProperty("KBLOG", "URL", url);
journal->setCustomProperty("KBLOG", "USER", blog.username());
journal->setCustomProperty("KBLOG", "BLOG", blogId);
......
......@@ -32,6 +32,7 @@
#include "kblog_debug.h"
#include <KLocalizedString>
#include <QUrl>
#include <QUrlQuery>
#include <QByteArray>
#include <QRegExp>
......@@ -117,22 +118,24 @@ void GData::listRecentPosts(const QStringList &labels, int number,
}
qCDebug(KBLOG_LOG) << "listRecentPosts()";
QUrl url(urlString);
QUrlQuery q;
if (!upMinTime.isNull()) {
url.addQueryItem(QStringLiteral("updated-min"), upMinTime.toUTC().toString(QStringLiteral("yyyy-MM-ddTHH:mm:ssZ")));
q.addQueryItem(QStringLiteral("updated-min"), upMinTime.toUTC().toString(QStringLiteral("yyyy-MM-ddTHH:mm:ssZ")));
}
if (!upMaxTime.isNull()) {
url.addQueryItem(QStringLiteral("updated-max"), upMaxTime.toUTC().toString(QStringLiteral("yyyy-MM-ddTHH:mm:ssZ")));
q.addQueryItem(QStringLiteral("updated-max"), upMaxTime.toUTC().toString(QStringLiteral("yyyy-MM-ddTHH:mm:ssZ")));
}
if (!pubMinTime.isNull()) {
url.addQueryItem(QStringLiteral("published-min"), pubMinTime.toUTC().toString(QStringLiteral("yyyy-MM-ddTHH:mm:ssZ")));
q.addQueryItem(QStringLiteral("published-min"), pubMinTime.toUTC().toString(QStringLiteral("yyyy-MM-ddTHH:mm:ssZ")));
}
if (!pubMaxTime.isNull()) {
url.addQueryItem(QStringLiteral("published-max"), pubMaxTime.toUTC().toString(QStringLiteral("yyyy-MM-ddTHH:mm:ssZ")));
q.addQueryItem(QStringLiteral("published-max"), pubMaxTime.toUTC().toString(QStringLiteral("yyyy-MM-ddTHH:mm:ssZ")));
}
url.setQuery(q);
Syndication::Loader *loader = Syndication::Loader::create();
if (number > 0) {
......@@ -475,10 +478,12 @@ bool GDataPrivate::authenticate()
Q_Q(GData);
QByteArray data;
QUrl authGateway(QStringLiteral("https://www.google.com/accounts/ClientLogin"));
authGateway.addQueryItem(QStringLiteral("Email"), q->username());
authGateway.addQueryItem(QStringLiteral("Passwd"), q->password());
authGateway.addQueryItem(QStringLiteral("source"), q->userAgent());
authGateway.addQueryItem(QStringLiteral("service"), QStringLiteral("blogger"));
QUrlQuery query;
query.addQueryItem(QStringLiteral("Email"), q->username());
query.addQueryItem(QStringLiteral("Passwd"), q->password());
query.addQueryItem(QStringLiteral("source"), q->userAgent());
query.addQueryItem(QStringLiteral("service"), QStringLiteral("blogger"));
authGateway.setQuery(query);
if (!mAuthenticationTime.isValid() ||
QDateTime::currentDateTime().toTime_t() - mAuthenticationTime.toTime_t() > TIMEOUT ||
mAuthenticationString.isEmpty()) {
......@@ -486,7 +491,7 @@ bool GDataPrivate::authenticate()
QObject::connect(job, &KIO::TransferJob::data,
q, [&data](KIO::Job *, const QByteArray &newdata) {
data.reserve(data.size() + newdata.size());
qMemCopy(data.data() + data.size(), newdata.data(), newdata.size());
memcpy(data.data() + data.size(), newdata.data(), newdata.size());
});
if (job->exec()) {
QRegExp rx(QStringLiteral("Auth=(.+)"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment