diff --git a/saoriaccount.cpp b/saoriaccount.cpp index fc9144c..e7ed131 100644 --- a/saoriaccount.cpp +++ b/saoriaccount.cpp @@ -108,13 +108,15 @@ } -void SaoriAccount::getTimelineData(const QString timeline) +void SaoriAccount::getTimelineData(const QString timeline, const QUrlQuery query) { // TODO max_id、since_id、limitの処理を追加すべし。 QUrl url = instance()->timelineUrl(timeline); if (url.isEmpty()) return; QNetworkRequest request = createHearder(); - request.setUrl(instance()->addQuery(url,"limit","10")); + QUrlQuery q = query; + q.addQueryItem("limit","10"); + request.setUrl(instance()->addQuery(url,q)); auto *reply = SaoriApplication::saori()->manager->get(request); connect(reply,&QNetworkReply::finished,[=](){ if (reply->error() == QNetworkReply::NoError) { diff --git a/saoriaccount.h b/saoriaccount.h index 5e518f7..59cc562 100644 --- a/saoriaccount.h +++ b/saoriaccount.h @@ -33,6 +33,7 @@ #include #include #include +#include class SaoriAccount : public QObject { @@ -51,7 +52,7 @@ const QStringList timelineList(); public slots: - void getTimelineData(const QString timeline); + void getTimelineData(const QString timeline,const QUrlQuery query); protected: void getAccountInfomation(); diff --git a/saoridon.cpp b/saoridon.cpp index b8094eb..99e356b 100644 --- a/saoridon.cpp +++ b/saoridon.cpp @@ -181,9 +181,20 @@ const QUrl Saoridon::addQuery(const QUrl url, const QString key, const QString value) { QUrl newurl = url; - QUrlQuery query(url.query()); - query.addQueryItem(key,value); - newurl.setQuery(query); + QUrlQuery q(url.query()); + q.addQueryItem(key,value); + newurl.setQuery(q); + return newurl; +} + +const QUrl Saoridon::addQuery(const QUrl url, const QUrlQuery query) +{ + QUrl newurl = url; + QUrlQuery q(url.query()); + auto list = query.queryItems(); + list += q.queryItems(); + q.setQueryItems(list); + newurl.setQuery(q); return newurl; } diff --git a/saoridon.h b/saoridon.h index 7cbd849..7a5a746 100644 --- a/saoridon.h +++ b/saoridon.h @@ -52,6 +52,7 @@ const QString instanceInfo(const QString key); const QUrl timelineUrl(const QString timeline); static const QUrl addQuery(const QUrl url,const QString key,const QString value); + static const QUrl addQuery(const QUrl url,const QUrlQuery query); protected: void getInstanceInfomation();