#105 can fetch list of categories and feeds, lang sync
This commit is contained in:
parent
e1ec6ddadd
commit
01240dda24
7 changed files with 84 additions and 42 deletions
|
@ -573,11 +573,11 @@ Status: %3</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Developer access token</source>
|
<source>Developer access token</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Токен доступа разработчика</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Get token</source>
|
<source>Get token</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Получить токен</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source> message(s)</source>
|
<source> message(s)</source>
|
||||||
|
@ -605,11 +605,11 @@ Status: %3</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Your %1 build has official Feedly support. You do not have to use "developer acess token". You can therefore leave corresponding field empty.</source>
|
<source>Your %1 build has official Feedly support. You do not have to use "developer acess token". You can therefore leave corresponding field empty.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>У вашей сборки %1 есть официальная поддержка Feedly. Вам не обязательно использовать «токен доступа разработчика». Поэтому вы можете оставить соответствующее поле пустым.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Your %1 does not offer official Feedly support, thus you must authorize via special authorization code called "developer access token". These tokens are usually valid only for 1 month and allow only 250 API calls each day.</source>
|
<source>Your %1 does not offer official Feedly support, thus you must authorize via special authorization code called "developer access token". These tokens are usually valid only for 1 month and allow only 250 API calls each day.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>%1 не предлагает официальную поддержку Feedly, поэтому вы должны авторизоваться с помощью специального кода авторизации, который называется «токен доступа разработчика». Эти токены обычно действительны только в течение 1 месяца и допускают только 250 вызовов API в день.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>= unlimited</source>
|
<source>= unlimited</source>
|
||||||
|
@ -649,15 +649,15 @@ Status: %3</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Login was successful.</source>
|
<source>Login was successful.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Вход прошел успешно.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Make sure your "development access token" is correct and your internet works.</source>
|
<source>Make sure your "development access token" is correct and your internet works.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Убедитесь, что ваш «токен доступа разработки» правильный и нет проблем с Интернет-сетью.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Some problems.</source>
|
<source>Some problems.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Некоторые проблемы.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Username cannot be empty.</source>
|
<source>Username cannot be empty.</source>
|
||||||
|
@ -669,18 +669,18 @@ Status: %3</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Access token is empty.</source>
|
<source>Access token is empty.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Токен доступа пуст.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Access token is okay.</source>
|
<source>Access token is okay.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Токен доступа в порядке.</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FeedlyNetwork</name>
|
<name>FeedlyNetwork</name>
|
||||||
<message>
|
<message>
|
||||||
<source>Feedly: authentication error</source>
|
<source>Feedly: authentication error</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Feedly: ошибка аутентификации</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Click this to login again. Error is: '%1'</source>
|
<source>Click this to login again. Error is: '%1'</source>
|
||||||
|
@ -688,7 +688,7 @@ Status: %3</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Feedly: authorization denied</source>
|
<source>Feedly: authorization denied</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Feedly: авторизация отклонена</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Click this to login again.</source>
|
<source>Click this to login again.</source>
|
||||||
|
@ -700,7 +700,7 @@ Status: %3</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Your login to Feedly was authorized.</source>
|
<source>Your login to Feedly was authorized.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Ваш логин в Feedly был авторизован.</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
|
|
@ -573,11 +573,11 @@ Status: %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Developer access token</source>
|
<source>Developer access token</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Åtkomst-token för utvecklare</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Get token</source>
|
<source>Get token</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Hämta token</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source> message(s)</source>
|
<source> message(s)</source>
|
||||||
|
@ -605,11 +605,11 @@ Status: %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Your %1 build has official Feedly support. You do not have to use "developer acess token". You can therefore leave corresponding field empty.</source>
|
<source>Your %1 build has official Feedly support. You do not have to use "developer acess token". You can therefore leave corresponding field empty.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Din %1 har officiellt Feedly-stöd. Du behöver inte använda "Åtkomst-token för utvecklare". Du kan därför lämna motsvarande fält tomt.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Your %1 does not offer official Feedly support, thus you must authorize via special authorization code called "developer access token". These tokens are usually valid only for 1 month and allow only 250 API calls each day.</source>
|
<source>Your %1 does not offer official Feedly support, thus you must authorize via special authorization code called "developer access token". These tokens are usually valid only for 1 month and allow only 250 API calls each day.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Din %1 har inte officiellt Feedly-stöd. Därför måste du använda en speciell auktoriseringskod kallad "Åtkomst-token för utvecklare". Dessa token är vanligtvis giltiga i endast en månad och tillåter bara 250 API-anrop per dag.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>= unlimited</source>
|
<source>= unlimited</source>
|
||||||
|
@ -649,15 +649,15 @@ Status: %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Login was successful.</source>
|
<source>Login was successful.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Inloggning slutförd</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Make sure your "development access token" is correct and your internet works.</source>
|
<source>Make sure your "development access token" is correct and your internet works.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Tillse att din "Åtkomst-token för utvecklare" är korrekt och att din internetuppkoppling fungerar.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Some problems.</source>
|
<source>Some problems.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Lite problem.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Username cannot be empty.</source>
|
<source>Username cannot be empty.</source>
|
||||||
|
@ -669,18 +669,18 @@ Status: %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Access token is empty.</source>
|
<source>Access token is empty.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Åtkomst-token saknas.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Access token is okay.</source>
|
<source>Access token is okay.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Åtkomst-token är OK.</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FeedlyNetwork</name>
|
<name>FeedlyNetwork</name>
|
||||||
<message>
|
<message>
|
||||||
<source>Feedly: authentication error</source>
|
<source>Feedly: authentication error</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Feedly: Autentiseringsfel</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Click this to login again. Error is: '%1'</source>
|
<source>Click this to login again. Error is: '%1'</source>
|
||||||
|
@ -688,7 +688,7 @@ Status: %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Feedly: authorization denied</source>
|
<source>Feedly: authorization denied</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Feedly: Autentisering nekad</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Click this to login again.</source>
|
<source>Click this to login again.</source>
|
||||||
|
@ -700,7 +700,7 @@ Status: %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Your login to Feedly was authorized.</source>
|
<source>Your login to Feedly was authorized.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Din inloggning till Feedly godkändes.</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -1173,7 +1173,7 @@ att funktionen inte är implementerad än.</translation>
|
||||||
<name>FormEditFeedlyAccount</name>
|
<name>FormEditFeedlyAccount</name>
|
||||||
<message>
|
<message>
|
||||||
<source>Service setup</source>
|
<source>Service setup</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Tjänstinställning</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -2695,7 +2695,7 @@ Inloggningstoken upphör: %2</translation>
|
||||||
<name>GreaderNetwork</name>
|
<name>GreaderNetwork</name>
|
||||||
<message>
|
<message>
|
||||||
<source>Other services</source>
|
<source>Other services</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Andra tjänster</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -3637,7 +3637,7 @@ genom att klicka på denna popup-avisering.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Keep up with the topics and trends you care about, without the overwhelm. Feedly is a secure space where you can privately organize and research the topics and trends that matter to you.</source>
|
<source>Keep up with the topics and trends you care about, without the overwhelm. Feedly is a secure space where you can privately organize and research the topics and trends that matter to you.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Håll koll på de ämnen och trender du bryr dig om, utan att överdriva. Feedly är ett säkert utrymme där du privat kan organisera och utforska de ämnen och trender som är viktiga för dig.</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -4631,19 +4631,19 @@ Typ: %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>The source does not seem to use "#" separator for arguments.</source>
|
<source>The source does not seem to use "#" separator for arguments.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Källan verkar inte använda "#" som separator för argument.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Command is ok.</source>
|
<source>Command is ok.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Kommandot är OK.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Command not seem to use "#" separator for arguments.</source>
|
<source>Command not seem to use "#" separator for arguments.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Kommandot verkar inte använda "#" som separator för argument.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Command is empty.</source>
|
<source>Command is empty.</source>
|
||||||
<translation type="unfinished"/>
|
<translation>Kommano saknas.</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 47f4125753452eff8800dbd6600c5a05540b15d9
|
Subproject commit 9c10723bfbaf6cb85107d6ee16e0324e9e487749
|
|
@ -142,11 +142,15 @@ QNetworkReply::NetworkError NetworkFactory::downloadIcon(const QList<QString>& u
|
||||||
QNetworkReply::NetworkError network_result = QNetworkReply::NetworkError::UnknownNetworkError;
|
QNetworkReply::NetworkError network_result = QNetworkReply::NetworkError::UnknownNetworkError;
|
||||||
|
|
||||||
for (const QString& url : urls) {
|
for (const QString& url : urls) {
|
||||||
|
if (url.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray icon_data;
|
QByteArray icon_data;
|
||||||
|
|
||||||
network_result = performNetworkOperation(url,
|
network_result = performNetworkOperation(url,
|
||||||
timeout,
|
timeout,
|
||||||
QByteArray(),
|
{},
|
||||||
icon_data,
|
icon_data,
|
||||||
QNetworkAccessManager::Operation::GetOperation,
|
QNetworkAccessManager::Operation::GetOperation,
|
||||||
{},
|
{},
|
||||||
|
|
|
@ -70,10 +70,11 @@ RootItem* FeedlyNetwork::collections(bool obtain_icons) {
|
||||||
throw NetworkException(result.first);
|
throw NetworkException(result.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
return decodeCollections(output_msgs);
|
return decodeCollections(output_msgs, obtain_icons, m_service->networkProxy(), timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
RootItem* FeedlyNetwork::decodeCollections(const QByteArray& json, bool obtain_url) const {
|
RootItem* FeedlyNetwork::decodeCollections(const QByteArray& json, bool obtain_icons,
|
||||||
|
const QNetworkProxy& proxy, int timeout) const {
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(json);
|
QJsonDocument doc = QJsonDocument::fromJson(json);
|
||||||
auto* parent = new RootItem();
|
auto* parent = new RootItem();
|
||||||
QList<QString> used_feeds;
|
QList<QString> used_feeds;
|
||||||
|
@ -87,18 +88,45 @@ RootItem* FeedlyNetwork::decodeCollections(const QByteArray& json, bool obtain_u
|
||||||
|
|
||||||
for (const QJsonValue& fee : cat["feeds"].toArray()) {
|
for (const QJsonValue& fee : cat["feeds"].toArray()) {
|
||||||
QJsonObject fee_obj = fee.toObject();
|
QJsonObject fee_obj = fee.toObject();
|
||||||
|
|
||||||
|
if (used_feeds.contains(fee_obj["id"].toString())) {
|
||||||
|
qWarningNN << LOGSEC_FEEDLY
|
||||||
|
<< "Feed"
|
||||||
|
<< QUOTE_W_SPACE(fee_obj["id"].toString())
|
||||||
|
<< "is already decoded and cannot be placed under several categories.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto* feed = new FeedlyFeed(category);
|
auto* feed = new FeedlyFeed(category);
|
||||||
|
|
||||||
feed->setTitle(fee_obj["title"].toString());
|
feed->setTitle(fee_obj["title"].toString());
|
||||||
feed->setDescription(fee_obj["description"].toString());
|
feed->setDescription(fee_obj["description"].toString());
|
||||||
feed->setCustomId(fee_obj["id"].toString());
|
feed->setCustomId(fee_obj["id"].toString());
|
||||||
|
|
||||||
if (obtain_url) {
|
if (obtain_icons) {
|
||||||
// TODO: TODO
|
QIcon icon;
|
||||||
|
auto result = NetworkFactory::downloadIcon({ fee_obj["iconUrl"].toString(),
|
||||||
|
fee_obj["logo"].toString(),
|
||||||
|
fee_obj["website"].toString() },
|
||||||
|
timeout,
|
||||||
|
icon,
|
||||||
|
proxy);
|
||||||
|
|
||||||
|
if (result == QNetworkReply::NetworkError::NoError && !icon.isNull()) {
|
||||||
|
feed->setIcon(icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
used_feeds.append(feed->customId());
|
||||||
|
category->appendChild(feed);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent->appendChild(category);
|
if (category->childCount() == 0) {
|
||||||
|
delete category;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
parent->appendChild(category);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent;
|
return parent;
|
||||||
|
@ -136,6 +164,10 @@ QVariantHash FeedlyNetwork::profile(const QNetworkProxy& network_proxy) {
|
||||||
return QJsonDocument::fromJson(output_msgs).object().toVariantHash();
|
return QJsonDocument::fromJson(output_msgs).object().toVariantHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<RootItem*> FeedlyNetwork::tags() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
QString FeedlyNetwork::username() const {
|
QString FeedlyNetwork::username() const {
|
||||||
return m_username;
|
return m_username;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ class FeedlyNetwork : public QObject {
|
||||||
|
|
||||||
// API operations.
|
// API operations.
|
||||||
QVariantHash profile(const QNetworkProxy& network_proxy);
|
QVariantHash profile(const QNetworkProxy& network_proxy);
|
||||||
|
QList<RootItem*> tags();
|
||||||
RootItem* collections(bool obtain_icons);
|
RootItem* collections(bool obtain_icons);
|
||||||
|
|
||||||
// Getters and setters.
|
// Getters and setters.
|
||||||
|
@ -55,7 +55,7 @@ class FeedlyNetwork : public QObject {
|
||||||
|
|
||||||
QString fullUrl(Service service) const;
|
QString fullUrl(Service service) const;
|
||||||
QString bearer() const;
|
QString bearer() const;
|
||||||
RootItem* decodeCollections(const QByteArray& json, bool obtain_url) const;
|
RootItem* decodeCollections(const QByteArray& json, bool obtain_icons, const QNetworkProxy& proxy, int timeout = 0) const;
|
||||||
QPair<QByteArray, QByteArray> bearerHeader(const QString& bearer) const;
|
QPair<QByteArray, QByteArray> bearerHeader(const QString& bearer) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "miscellaneous/mutex.h"
|
#include "miscellaneous/mutex.h"
|
||||||
#include "miscellaneous/textfactory.h"
|
#include "miscellaneous/textfactory.h"
|
||||||
#include "services/abstract/importantnode.h"
|
#include "services/abstract/importantnode.h"
|
||||||
|
#include "services/abstract/labelsnode.h"
|
||||||
#include "services/abstract/recyclebin.h"
|
#include "services/abstract/recyclebin.h"
|
||||||
#include "services/feedly/feedlyentrypoint.h"
|
#include "services/feedly/feedlyentrypoint.h"
|
||||||
#include "services/feedly/feedlyfeed.h"
|
#include "services/feedly/feedlyfeed.h"
|
||||||
|
@ -112,9 +113,14 @@ void FeedlyServiceRoot::saveAccountDataToDatabase(bool creating_new) {
|
||||||
}
|
}
|
||||||
|
|
||||||
RootItem* FeedlyServiceRoot::obtainNewTreeForSyncIn() const {
|
RootItem* FeedlyServiceRoot::obtainNewTreeForSyncIn() const {
|
||||||
return nullptr;
|
auto tree = m_network->collections(true);
|
||||||
|
auto* lblroot = new LabelsNode(tree);
|
||||||
|
auto labels = m_network->tags();
|
||||||
|
|
||||||
//return m_network->categoriesFeedsLabelsTree(true, networkProxy());
|
lblroot->setChildItems(labels);
|
||||||
|
tree->appendChild(lblroot);
|
||||||
|
|
||||||
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedlyServiceRoot::loadFromDatabase() {
|
void FeedlyServiceRoot::loadFromDatabase() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue