From f896860f75a557e441bfd5679be253707d07f54c Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 17 Mar 2023 08:45:43 +0100 Subject: [PATCH] rename, fix build --- .../network-web/networkfactory.cpp | 13 ++++----- src/librssguard/network-web/networkfactory.h | 6 ++++- src/librssguard/network-web/oauth2service.cpp | 4 +-- src/librssguard/services/abstract/feed.h | 3 +-- .../abstract/gui/authenticationdetails.cpp | 27 ++++++++++--------- .../abstract/gui/authenticationdetails.h | 5 ++-- .../owncloud/owncloudnetworkfactory.cpp | 18 ++++++------- .../standard/gui/standardfeeddetails.cpp | 4 +-- .../standard/gui/standardfeeddetails.h | 4 +-- .../services/standard/standardfeed.cpp | 11 ++++---- .../services/standard/standardfeed.h | 10 ++++--- .../standardfeedsimportexportmodel.cpp | 2 +- .../tt-rss/gui/formttrssfeeddetails.cpp | 2 +- .../services/tt-rss/ttrssnetworkfactory.cpp | 26 +++++++++--------- 14 files changed, 72 insertions(+), 63 deletions(-) diff --git a/src/librssguard/network-web/networkfactory.cpp b/src/librssguard/network-web/networkfactory.cpp index 01ba996b2..6fc936a33 100644 --- a/src/librssguard/network-web/networkfactory.cpp +++ b/src/librssguard/network-web/networkfactory.cpp @@ -44,14 +44,11 @@ QStringList NetworkFactory::extractFeedLinksFromHtmlPage(const QUrl& url, const return feeds; } -QPair NetworkFactory::generateBasicAuthHeader(Feed::Protection protection, +QPair NetworkFactory::generateBasicAuthHeader(NetworkAuthentication protection, const QString& username, const QString& password) { switch (protection) { - case Feed::Protection::NoProtection: - return {}; - - case Feed::Protection::BasicProtection: { + case NetworkFactory::NetworkAuthentication::Basic: { if (username.isEmpty()) { return {}; } @@ -63,11 +60,15 @@ QPair NetworkFactory::generateBasicAuthHeader(Feed::Prot } } - case Feed::Protection::TokenProtection: { + case NetworkFactory::NetworkAuthentication::Token: { QString header_value = QSL("Bearer ") + username; return QPair(HTTP_HEADERS_AUTHORIZATION, header_value.toLocal8Bit()); } + + case NetworkFactory::NetworkAuthentication::NoAuthentication: + default: + return {}; } } diff --git a/src/librssguard/network-web/networkfactory.h b/src/librssguard/network-web/networkfactory.h index bae312342..211ae86a7 100644 --- a/src/librssguard/network-web/networkfactory.h +++ b/src/librssguard/network-web/networkfactory.h @@ -38,8 +38,10 @@ class NetworkFactory { explicit NetworkFactory() = default; public: + enum class NetworkAuthentication { NoAuthentication = 0, Basic = 1, Token = 2 }; + static QStringList extractFeedLinksFromHtmlPage(const QUrl& url, const QString& html); - static QPair generateBasicAuthHeader(Feed::Protection protection, + static QPair generateBasicAuthHeader(NetworkAuthentication protection, const QString& username, const QString& password); @@ -81,4 +83,6 @@ class NetworkFactory { QNetworkProxy::ProxyType::DefaultProxy); }; +Q_DECLARE_METATYPE(NetworkFactory::NetworkAuthentication) + #endif // NETWORKFACTORY_H diff --git a/src/librssguard/network-web/oauth2service.cpp b/src/librssguard/network-web/oauth2service.cpp index 4ea0ef064..ad072af31 100644 --- a/src/librssguard/network-web/oauth2service.cpp +++ b/src/librssguard/network-web/oauth2service.cpp @@ -175,7 +175,7 @@ void OAuth2Service::retrieveAccessToken(const QString& auth_code) { network_request.setHeader(QNetworkRequest::KnownHeaders::ContentTypeHeader, "application/x-www-form-urlencoded"); if (m_useHttpBasicAuthWithClientData) { - auto basic_auth = NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, + auto basic_auth = NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, properClientId(), properClientSecret()); @@ -205,7 +205,7 @@ void OAuth2Service::refreshAccessToken(const QString& refresh_token) { network_request.setHeader(QNetworkRequest::KnownHeaders::ContentTypeHeader, "application/x-www-form-urlencoded"); if (m_useHttpBasicAuthWithClientData) { - auto basic_auth = NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, + auto basic_auth = NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, properClientId(), properClientSecret()); diff --git a/src/librssguard/services/abstract/feed.h b/src/librssguard/services/abstract/feed.h index d7b229a16..28ce3d983 100644 --- a/src/librssguard/services/abstract/feed.h +++ b/src/librssguard/services/abstract/feed.h @@ -19,8 +19,6 @@ class Feed : public RootItem { // Specifies the auto-download strategy for the feed. enum class AutoUpdateType { DontAutoUpdate = 0, DefaultAutoUpdate = 1, SpecificAutoUpdate = 2 }; - enum class Protection { NoProtection = 0, BasicProtection = 1, TokenProtection = 2 }; - // Specifies the actual "status" of the feed. // For example if it has new messages, error // occurred, and so on. @@ -107,5 +105,6 @@ class Feed : public RootItem { }; Q_DECLARE_METATYPE(Feed::AutoUpdateType) +Q_DECLARE_METATYPE(Feed::Status) #endif // FEED_H diff --git a/src/librssguard/services/abstract/gui/authenticationdetails.cpp b/src/librssguard/services/abstract/gui/authenticationdetails.cpp index 9d32dd4f3..31575e694 100644 --- a/src/librssguard/services/abstract/gui/authenticationdetails.cpp +++ b/src/librssguard/services/abstract/gui/authenticationdetails.cpp @@ -12,11 +12,12 @@ AuthenticationDetails::AuthenticationDetails(bool only_basic, QWidget* parent) : m_txtPassword->lineEdit()->setPlaceholderText(tr("Password")); m_txtPassword->lineEdit()->setToolTip(tr("Set password to access the feed.")); - m_cbAuthType->addItem(tr("No authentication"), QVariant::fromValue(Feed::Protection::NoProtection)); - m_cbAuthType->addItem(tr("HTTP Basic"), QVariant::fromValue(Feed::Protection::BasicProtection)); + m_cbAuthType->addItem(tr("No authentication"), + QVariant::fromValue(NetworkFactory::NetworkAuthentication::NoAuthentication)); + m_cbAuthType->addItem(tr("HTTP Basic"), QVariant::fromValue(NetworkFactory::NetworkAuthentication::Basic)); if (!only_basic) { - m_cbAuthType->addItem(tr("Token"), QVariant::fromValue(Feed::Protection::TokenProtection)); + m_cbAuthType->addItem(tr("Token"), QVariant::fromValue(NetworkFactory::NetworkAuthentication::Token)); } connect(m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &AuthenticationDetails::onUsernameChanged); @@ -26,7 +27,7 @@ AuthenticationDetails::AuthenticationDetails(bool only_basic, QWidget* parent) : onAuthenticationSwitched(); } -void AuthenticationDetails::setAuthenticationType(Feed::Protection protect) { +void AuthenticationDetails::setAuthenticationType(NetworkFactory::NetworkAuthentication protect) { auto fnd = m_cbAuthType->findData(QVariant::fromValue(protect)); if (fnd >= 0) { @@ -34,12 +35,13 @@ void AuthenticationDetails::setAuthenticationType(Feed::Protection protect) { } } -Feed::Protection AuthenticationDetails::authenticationType() const { - return m_cbAuthType->currentData().value(); +NetworkFactory::NetworkFactory::NetworkAuthentication AuthenticationDetails::authenticationType() const { + return m_cbAuthType->currentData().value(); } void AuthenticationDetails::onUsernameChanged(const QString& new_username) { - bool is_username_ok = authenticationType() == Feed::Protection::NoProtection || !new_username.simplified().isEmpty(); + bool is_username_ok = authenticationType() == NetworkFactory::NetworkAuthentication::NoAuthentication || + !new_username.simplified().isEmpty(); m_txtUsername->setStatus(is_username_ok ? LineEditWithStatus::StatusType::Ok : LineEditWithStatus::StatusType::Warning, @@ -48,7 +50,8 @@ void AuthenticationDetails::onUsernameChanged(const QString& new_username) { } void AuthenticationDetails::onPasswordChanged(const QString& new_password) { - bool is_password_ok = authenticationType() == Feed::Protection::NoProtection || !new_password.simplified().isEmpty(); + bool is_password_ok = authenticationType() == NetworkFactory::NetworkAuthentication::NoAuthentication || + !new_password.simplified().isEmpty(); m_txtPassword->setStatus(is_password_ok ? LineEditWithStatus::StatusType::Ok : LineEditWithStatus::StatusType::Warning, @@ -61,15 +64,15 @@ void AuthenticationDetails::onAuthenticationSwitched() { auto prot = authenticationType(); - m_lblPassword->setVisible(prot != Feed::Protection::TokenProtection); - m_txtPassword->setVisible(prot != Feed::Protection::TokenProtection); + m_lblPassword->setVisible(prot != NetworkFactory::NetworkAuthentication::Token); + m_txtPassword->setVisible(prot != NetworkFactory::NetworkAuthentication::Token); - if (prot == Feed::Protection::TokenProtection) { + if (prot == NetworkFactory::NetworkAuthentication::Token) { m_lblUsername->setText(tr("Access token")); } else { m_lblUsername->setText(tr("Username")); } - m_gbAuthentication->setEnabled(prot != Feed::Protection::NoProtection); + m_gbAuthentication->setEnabled(prot != NetworkFactory::NetworkAuthentication::NoAuthentication); } diff --git a/src/librssguard/services/abstract/gui/authenticationdetails.h b/src/librssguard/services/abstract/gui/authenticationdetails.h index bc9bfc937..6776b0f8b 100644 --- a/src/librssguard/services/abstract/gui/authenticationdetails.h +++ b/src/librssguard/services/abstract/gui/authenticationdetails.h @@ -7,6 +7,7 @@ #include "ui_authenticationdetails.h" +#include "network-web/networkfactory.h" #include "services/abstract/feed.h" class AuthenticationDetails : public QWidget, public Ui::AuthenticationDetails { @@ -15,8 +16,8 @@ class AuthenticationDetails : public QWidget, public Ui::AuthenticationDetails { public: explicit AuthenticationDetails(bool only_basic, QWidget* parent = nullptr); - void setAuthenticationType(Feed::Protection protect); - Feed::Protection authenticationType() const; + void setAuthenticationType(NetworkFactory::NetworkFactory::NetworkAuthentication protect); + NetworkFactory::NetworkFactory::NetworkAuthentication authenticationType() const; private slots: void onUsernameChanged(const QString& new_username); diff --git a/src/librssguard/services/owncloud/owncloudnetworkfactory.cpp b/src/librssguard/services/owncloud/owncloudnetworkfactory.cpp index 8c4277696..5f9ec7994 100644 --- a/src/librssguard/services/owncloud/owncloudnetworkfactory.cpp +++ b/src/librssguard/services/owncloud/owncloudnetworkfactory.cpp @@ -79,7 +79,7 @@ OwnCloudStatusResponse OwnCloudNetworkFactory::status(const QNetworkProxy& custo QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlStatus, @@ -111,7 +111,7 @@ OwnCloudGetFeedsCategoriesResponse OwnCloudNetworkFactory::feedsCategories(const QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlFolders, @@ -166,7 +166,7 @@ bool OwnCloudNetworkFactory::deleteFeed(const QString& feed_id, const QNetworkPr QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(final_url, @@ -210,7 +210,7 @@ bool OwnCloudNetworkFactory::createFeed(const QString& url, int parent_id, const QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlFeeds, @@ -248,7 +248,7 @@ bool OwnCloudNetworkFactory::renameFeed(const QString& new_name, QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(final_url, @@ -287,7 +287,7 @@ OwnCloudGetMessagesResponse OwnCloudNetworkFactory::getMessages(int feed_id, con QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(final_url, @@ -318,7 +318,7 @@ QNetworkReply::NetworkError OwnCloudNetworkFactory::triggerFeedUpdate(int feed_i QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlFeedsUpdate.arg(authUsername(), QString::number(feed_id)), @@ -365,7 +365,7 @@ NetworkResult OwnCloudNetworkFactory::markMessagesRead(RootItem::ReadStatus stat QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); QByteArray output; @@ -411,7 +411,7 @@ NetworkResult OwnCloudNetworkFactory::markMessagesStarred(RootItem::Importance i QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, OWNCLOUD_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); QByteArray output; diff --git a/src/librssguard/services/standard/gui/standardfeeddetails.cpp b/src/librssguard/services/standard/gui/standardfeeddetails.cpp index 14f58bf2c..a882bff1b 100644 --- a/src/librssguard/services/standard/gui/standardfeeddetails.cpp +++ b/src/librssguard/services/standard/gui/standardfeeddetails.cpp @@ -131,7 +131,7 @@ StandardFeedDetails::StandardFeedDetails(QWidget* parent) : QWidget(parent) { void StandardFeedDetails::guessIconOnly(StandardFeed::SourceType source_type, const QString& source, const QString& post_process_script, - Feed::Protection protection, + NetworkFactory::NetworkAuthentication protection, const QString& username, const QString& password, const QNetworkProxy& custom_proxy) { @@ -168,7 +168,7 @@ void StandardFeedDetails::guessIconOnly(StandardFeed::SourceType source_type, void StandardFeedDetails::guessFeed(StandardFeed::SourceType source_type, const QString& source, const QString& post_process_script, - Feed::Protection protection, + NetworkFactory::NetworkAuthentication protection, const QString& username, const QString& password, const QNetworkProxy& custom_proxy) { diff --git a/src/librssguard/services/standard/gui/standardfeeddetails.h b/src/librssguard/services/standard/gui/standardfeeddetails.h index 006edae0d..c59127622 100644 --- a/src/librssguard/services/standard/gui/standardfeeddetails.h +++ b/src/librssguard/services/standard/gui/standardfeeddetails.h @@ -28,14 +28,14 @@ class StandardFeedDetails : public QWidget { void guessIconOnly(StandardFeed::SourceType source_type, const QString& source, const QString& post_process_script, - Feed::Protection protection, + NetworkFactory::NetworkAuthentication protection, const QString& username, const QString& password, const QNetworkProxy& custom_proxy = QNetworkProxy::ProxyType::DefaultProxy); void guessFeed(StandardFeed::SourceType source_type, const QString& source, const QString& post_process_script, - Feed::Protection protection, + NetworkFactory::NetworkAuthentication protection, const QString& username, const QString& password, const QNetworkProxy& custom_proxy = QNetworkProxy::ProxyType::DefaultProxy); diff --git a/src/librssguard/services/standard/standardfeed.cpp b/src/librssguard/services/standard/standardfeed.cpp index 008f56309..174f1debb 100644 --- a/src/librssguard/services/standard/standardfeed.cpp +++ b/src/librssguard/services/standard/standardfeed.cpp @@ -14,7 +14,6 @@ #include "miscellaneous/iconfactory.h" #include "miscellaneous/settings.h" #include "miscellaneous/textfactory.h" -#include "network-web/networkfactory.h" #include "services/abstract/recyclebin.h" #include "services/standard/definitions.h" #include "services/standard/gui/formstandardfeeddetails.h" @@ -42,7 +41,7 @@ StandardFeed::StandardFeed(RootItem* parent_item) : Feed(parent_item) { m_sourceType = SourceType::Url; m_encoding = m_postProcessScript = QString(); - m_protection = Protection::NoProtection; + m_protection = NetworkFactory::NetworkAuthentication::NoAuthentication; m_username = QString(); m_password = QString(); } @@ -95,11 +94,11 @@ bool StandardFeed::deleteViaGui() { } } -StandardFeed::Protection StandardFeed::protection() const { +NetworkFactory::NetworkAuthentication StandardFeed::protection() const { return m_protection; } -void StandardFeed::setProtection(Protection protect) { +void StandardFeed::setProtection(NetworkFactory::NetworkAuthentication protect) { m_protection = protect; } @@ -138,7 +137,7 @@ void StandardFeed::setCustomDatabaseData(const QVariantHash& data) { setType(Type(data[QSL("type")].toInt())); setEncoding(data[QSL("encoding")].toString()); setPostProcessScript(data[QSL("post_process")].toString()); - setProtection(Protection(data[QSL("protected")].toInt())); + setProtection(NetworkFactory::NetworkAuthentication(data[QSL("protected")].toInt())); setUsername(data[QSL("username")].toString()); setPassword(TextFactory::decrypt(data[QSL("password")].toString())); } @@ -231,7 +230,7 @@ void StandardFeed::setSourceType(SourceType source_type) { StandardFeed* StandardFeed::guessFeed(StandardFeed::SourceType source_type, const QString& source, const QString& post_process_script, - Feed::Protection protection, + NetworkFactory::NetworkFactory::NetworkAuthentication protection, const QString& username, const QString& password, const QNetworkProxy& custom_proxy) { diff --git a/src/librssguard/services/standard/standardfeed.h b/src/librssguard/services/standard/standardfeed.h index 0538af3e2..fb6ce3d0b 100644 --- a/src/librssguard/services/standard/standardfeed.h +++ b/src/librssguard/services/standard/standardfeed.h @@ -5,6 +5,8 @@ #include "services/abstract/feed.h" +#include "network-web/networkfactory.h" + #include #include #include @@ -58,8 +60,8 @@ class StandardFeed : public Feed { QString postProcessScript() const; void setPostProcessScript(const QString& post_process_script); - Protection protection() const; - void setProtection(Protection protect); + NetworkFactory::NetworkAuthentication protection() const; + void setProtection(NetworkFactory::NetworkAuthentication protect); QString username() const; void setUsername(const QString& username); @@ -75,7 +77,7 @@ class StandardFeed : public Feed { static StandardFeed* guessFeed(SourceType source_type, const QString& url, const QString& post_process_script, - Protection protection, + NetworkFactory::NetworkAuthentication protection, const QString& username = QString(), const QString& password = QString(), const QNetworkProxy& custom_proxy = QNetworkProxy::ProxyType::DefaultProxy); @@ -108,7 +110,7 @@ class StandardFeed : public Feed { Type m_type; QString m_postProcessScript; QString m_encoding; - Protection m_protection = Protection::NoProtection; + NetworkFactory::NetworkAuthentication m_protection = NetworkFactory::NetworkAuthentication::NoAuthentication; QString m_username; QString m_password; }; diff --git a/src/librssguard/services/standard/standardfeedsimportexportmodel.cpp b/src/librssguard/services/standard/standardfeedsimportexportmodel.cpp index bb9c0e1ad..bb0922efd 100644 --- a/src/librssguard/services/standard/standardfeedsimportexportmodel.cpp +++ b/src/librssguard/services/standard/standardfeedsimportexportmodel.cpp @@ -184,7 +184,7 @@ bool FeedsImportExportModel::produceFeed(const FeedLookup& feed_lookup) { new_feed = StandardFeed::guessFeed(StandardFeed::SourceType::Url, feed_lookup.url, feed_lookup.post_process_script, - Feed::Protection::NoProtection, + NetworkFactory::NetworkAuthentication::NoAuthentication, {}, {}, feed_lookup.custom_proxy); diff --git a/src/librssguard/services/tt-rss/gui/formttrssfeeddetails.cpp b/src/librssguard/services/tt-rss/gui/formttrssfeeddetails.cpp index b843a6ae7..9a75ddb8e 100644 --- a/src/librssguard/services/tt-rss/gui/formttrssfeeddetails.cpp +++ b/src/librssguard/services/tt-rss/gui/formttrssfeeddetails.cpp @@ -39,7 +39,7 @@ void FormTtRssFeedDetails::apply() { root->network()->subscribeToFeed(m_feedDetails->ui.m_txtUrl->lineEdit()->text(), category_id, m_serviceRoot->networkProxy(), - m_authDetails->authenticationType() == Feed::Protection::BasicProtection, + m_authDetails->authenticationType() == NetworkFactory::NetworkAuthentication::Basic, m_authDetails->m_txtUsername->lineEdit()->text(), m_authDetails->m_txtPassword->lineEdit()->text()); diff --git a/src/librssguard/services/tt-rss/ttrssnetworkfactory.cpp b/src/librssguard/services/tt-rss/ttrssnetworkfactory.cpp index ef52fb68f..7add822d7 100644 --- a/src/librssguard/services/tt-rss/ttrssnetworkfactory.cpp +++ b/src/librssguard/services/tt-rss/ttrssnetworkfactory.cpp @@ -87,7 +87,7 @@ TtRssLoginResponse TtRssNetworkFactory::login(const QNetworkProxy& proxy) { QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -126,7 +126,7 @@ TtRssResponse TtRssNetworkFactory::logout(const QNetworkProxy& proxy) { QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); @@ -173,7 +173,7 @@ TtRssGetLabelsResponse TtRssNetworkFactory::getLabels(const QNetworkProxy& proxy QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -224,7 +224,7 @@ TtRssResponse TtRssNetworkFactory::shareToPublished(const TtRssNoteToPublish& no QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -277,7 +277,7 @@ TtRssGetFeedsCategoriesResponse TtRssNetworkFactory::getFeedsCategories(const QN QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -337,7 +337,7 @@ TtRssGetCompactHeadlinesResponse TtRssNetworkFactory::getCompactHeadlines(int fe QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -399,7 +399,7 @@ TtRssGetHeadlinesResponse TtRssNetworkFactory::getArticle(const QStringList& art QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -466,7 +466,7 @@ TtRssGetHeadlinesResponse TtRssNetworkFactory::getHeadlines(int feed_id, QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -524,7 +524,7 @@ TtRssResponse TtRssNetworkFactory::setArticleLabel(const QStringList& article_id QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -583,7 +583,7 @@ TtRssUpdateArticleResponse TtRssNetworkFactory::updateArticles(const QStringList QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -647,7 +647,7 @@ TtRssSubscribeToFeedResponse TtRssNetworkFactory::subscribeToFeed(const QString& QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -699,7 +699,7 @@ TtRssUnsubscribeFeedResponse TtRssNetworkFactory::unsubscribeFeed(int feed_id, c QList> headers; headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON); - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, m_authUsername, m_authPassword); + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, m_authUsername, m_authPassword); NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, @@ -949,7 +949,7 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(TtRssNetworkFactory* QList> headers; if (network->authIsUsed()) { - headers << NetworkFactory::generateBasicAuthHeader(Feed::Protection::BasicProtection, + headers << NetworkFactory::generateBasicAuthHeader(NetworkFactory::NetworkAuthentication::Basic, network->authUsername(), network->authPassword()); }