Make oauth2 process work universally, fix some fucked-up port information, remove internal oauth2 login gui and rely on system web browser.
This commit is contained in:
parent
7017aa9e66
commit
5ebad9060d
@ -230,11 +230,11 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>Removing starred messages...</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Tar bort stjärnmärkta meddelanden...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Starred messages purged...</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Stjärnmärkta meddelanden rensat...</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -275,7 +275,7 @@
|
||||
<message>
|
||||
<source>Unknown error: '%1'.</source>
|
||||
<extracomment>Unknown MySQL error arised.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Okänt fel: "%1"</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -1239,47 +1239,47 @@ att funktionen inte är implementerad än.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Download only unread messages</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Ladda bara ner olästa meddelanden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password for your Nextcloud account</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Lösenord för ditt NextCloud-konto</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Username for your Nextcloud account</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Användarnamn för ditt NextCloud-konto</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>URL of your Nextcloud server, without any API path</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>URL för din NextCloud-server, utan API-sökväg</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add new Nextcloud News account</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Lägg till nytt NextCloud News-konto</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit existing Nextcloud News account</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Redigera befintligt NextCloud News-konto</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Selected Nextcloud News server is running unsupported version (%1). At least version %2 is required.</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Den valda NextCloud News-servern kör en version (%1) som inte stöds. Lägst version %2 är ett krav.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Selected Nextcloud News server is running unsupported version.</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Den valda NextCloud News-servern kör en version som inte stöds.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Nextcloud News server is okay, running with version %1, while at least version %2 is required.</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>NextClouds nyhetsserver fungerar med version %1, då minst version %2 krävs.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Nextcloud News server is okay.</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>NextClouds nyhetsserver är okay.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Network error, have you entered correct Nextcloud endpoint and password?</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Nätverksfel! Har du angett korrekt NextCloud-slutpunkt och lösenord?</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -1450,7 +1450,7 @@ att funktionen inte är implementerad än.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Download only unread messages</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Ladda bara ner olästa meddelanden.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -2122,7 +2122,7 @@ att funktionen inte är implementerad än.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show only &unread messages</source>
|
||||
<translation type="unfinished"/>
|
||||
<translation>Visa endast &olästa meddelanden</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#define ARGUMENTS_LIST_SEPARATOR "\n"
|
||||
|
||||
#define LOCALHOST_ADDRESS "http://localhost"
|
||||
#define ADBLOCK_ADBLOCKED_PAGE "adblockedpage"
|
||||
#define ADBLOCK_HOWTO_FILTERS "http://adblockplus.org/en/filters"
|
||||
#define ADBLOCK_UPDATE_DAYS_INTERVAL 5
|
||||
@ -51,6 +50,8 @@
|
||||
#define ELLIPSIS_LENGTH 3
|
||||
#define MIN_CATEGORY_NAME_LENGTH 1
|
||||
#define DEFAULT_AUTO_UPDATE_INTERVAL 15
|
||||
#define OAUTH_REDIRECT_URI_PORT 13377
|
||||
#define OAUTH_REDIRECT_URI "http://localhost:13377"
|
||||
#define AUTO_UPDATE_INTERVAL 60000
|
||||
#define STARTUP_UPDATE_DELAY 15.0 // In seconds.
|
||||
#define TIMEZONE_OFFSET_LIMIT 6
|
||||
|
@ -1,48 +0,0 @@
|
||||
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||
|
||||
#include "gui/dialogs/oauthlogin.h"
|
||||
|
||||
#include "gui/guiutilities.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
|
||||
#include <QUrlQuery>
|
||||
#include <QWebEngineCookieStore>
|
||||
#include <QWebEngineProfile>
|
||||
|
||||
OAuthLogin::OAuthLogin(QWidget* parent) : QDialog(parent) {
|
||||
m_ui.setupUi(this);
|
||||
|
||||
GuiUtilities::applyDialogProperties(*this);
|
||||
|
||||
connect(this, &OAuthLogin::rejected, this, &OAuthLogin::authRejected);
|
||||
connect(m_ui.m_loginPage, &WebViewer::urlChanged, this, &OAuthLogin::urlChanged);
|
||||
}
|
||||
|
||||
void OAuthLogin::login(const QString& consentPageUrl, const QString& redirect_uri) {
|
||||
m_ui.m_loginPage->page()->profile()->clearHttpCache();
|
||||
m_ui.m_loginPage->page()->profile()->cookieStore()->deleteAllCookies();
|
||||
|
||||
m_redirectUri = redirect_uri;
|
||||
m_ui.m_loginPage->setUrl(QUrl(consentPageUrl));
|
||||
m_ui.m_buttonBox->setFocus();
|
||||
exec();
|
||||
}
|
||||
|
||||
void OAuthLogin::urlChanged(QUrl url) {
|
||||
QString redirected_uri = url.toString();
|
||||
QUrlQuery query(QUrl(redirected_uri).query());
|
||||
|
||||
if (redirected_uri.startsWith(m_redirectUri)) {
|
||||
if (query.hasQueryItem(QSL("code"))) {
|
||||
emit authGranted(query.queryItemValue(QSL("code")));
|
||||
|
||||
accept();
|
||||
}
|
||||
else {
|
||||
emit authRejected();
|
||||
|
||||
reject();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||
|
||||
#ifndef OAUTHLOGIN_H
|
||||
#define OAUTHLOGIN_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_oauthlogin.h"
|
||||
|
||||
namespace Ui {
|
||||
class OAuthLogin;
|
||||
}
|
||||
|
||||
class OAuthLogin : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OAuthLogin(QWidget* parent = 0);
|
||||
|
||||
void login(const QString& consentPageUrl, const QString& redirect_uri);
|
||||
|
||||
private slots:
|
||||
void urlChanged(QUrl url);
|
||||
|
||||
signals:
|
||||
void authRejected();
|
||||
void authGranted(QString authCode);
|
||||
|
||||
private:
|
||||
Ui::OAuthLogin m_ui;
|
||||
QString m_redirectUri;
|
||||
};
|
||||
|
||||
#endif // OAUTHLOGIN_H
|
@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OAuthLogin</class>
|
||||
<widget class="QDialog" name="OAuthLogin">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>577</width>
|
||||
<height>412</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Access authorization to service is requested</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="WebViewer" name="m_loginPage" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>WebViewer</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>webviewer.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>OAuthLogin</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -171,7 +171,8 @@ HEADERS += core/feeddownloader.h \
|
||||
network-web/httpresponse.h \
|
||||
services/gmail/gui/formdownloadattachment.h \
|
||||
services/gmail/gui/formaddeditemail.h \
|
||||
gui/searchtextwidget.h
|
||||
gui/searchtextwidget.h \
|
||||
network-web/oauthhttphandler.h
|
||||
|
||||
SOURCES += core/feeddownloader.cpp \
|
||||
core/feedsmodel.cpp \
|
||||
@ -309,7 +310,8 @@ SOURCES += core/feeddownloader.cpp \
|
||||
network-web/httpresponse.cpp \
|
||||
services/gmail/gui/formdownloadattachment.cpp \
|
||||
services/gmail/gui/formaddeditemail.cpp \
|
||||
gui/searchtextwidget.cpp
|
||||
gui/searchtextwidget.cpp \
|
||||
network-web/oauthhttphandler.cpp
|
||||
|
||||
mac {
|
||||
OBJECTIVE_SOURCES += miscellaneous/disablewindowtabbing.mm
|
||||
@ -352,8 +354,7 @@ equals(USE_WEBENGINE, true) {
|
||||
gui/discoverfeedsbutton.h \
|
||||
network-web/googlesuggest.h \
|
||||
network-web/webpage.h \
|
||||
network-web/rssguardschemehandler.h \
|
||||
gui/dialogs/oauthlogin.h
|
||||
network-web/rssguardschemehandler.h
|
||||
|
||||
SOURCES += gui/locationlineedit.cpp \
|
||||
gui/webviewer.cpp \
|
||||
@ -361,8 +362,7 @@ equals(USE_WEBENGINE, true) {
|
||||
gui/discoverfeedsbutton.cpp \
|
||||
network-web/googlesuggest.cpp \
|
||||
network-web/webpage.cpp \
|
||||
network-web/rssguardschemehandler.cpp \
|
||||
gui/dialogs/oauthlogin.cpp
|
||||
network-web/rssguardschemehandler.cpp
|
||||
|
||||
# Add AdBlock sources.
|
||||
HEADERS += network-web/adblock/adblockaddsubscriptiondialog.h \
|
||||
@ -393,19 +393,16 @@ equals(USE_WEBENGINE, true) {
|
||||
gui/treewidget.cpp
|
||||
|
||||
FORMS += network-web/adblock/adblockaddsubscriptiondialog.ui \
|
||||
network-web/adblock/adblockdialog.ui \
|
||||
gui/dialogs/oauthlogin.ui
|
||||
network-web/adblock/adblockdialog.ui
|
||||
}
|
||||
else {
|
||||
HEADERS += gui/messagepreviewer.h \
|
||||
gui/messagetextbrowser.h \
|
||||
gui/newspaperpreviewer.h \
|
||||
network-web/oauthhttphandler.h
|
||||
gui/newspaperpreviewer.h
|
||||
|
||||
SOURCES += gui/messagepreviewer.cpp \
|
||||
gui/messagetextbrowser.cpp \
|
||||
gui/newspaperpreviewer.cpp \
|
||||
network-web/oauthhttphandler.cpp
|
||||
gui/newspaperpreviewer.cpp
|
||||
|
||||
FORMS += gui/messagepreviewer.ui \
|
||||
gui/newspaperpreviewer.ui
|
||||
|
@ -27,30 +27,26 @@
|
||||
#include "definitions/definitions.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "network-web/networkfactory.h"
|
||||
#include "network-web/oauthhttphandler.h"
|
||||
#include "network-web/webfactory.h"
|
||||
#include "services/inoreader/definitions.h"
|
||||
|
||||
#if defined(USE_WEBENGINE)
|
||||
#include "gui/dialogs/oauthlogin.h"
|
||||
#else
|
||||
#include "network-web/oauthhttphandler.h"
|
||||
|
||||
Q_GLOBAL_STATIC(OAuthHttpHandler, qz_silent_acmanager)
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QInputDialog>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
|
||||
Q_GLOBAL_STATIC(OAuthHttpHandler, qz_silent_acmanager)
|
||||
|
||||
OAuth2Service::OAuth2Service(const QString& auth_url, const QString& token_url, const QString& client_id,
|
||||
const QString& client_secret, const QString& scope, QObject* parent)
|
||||
: QObject(parent), m_id(QString::number(std::rand())), m_timerId(-1) {
|
||||
m_redirectUrl = QSL(LOCALHOST_ADDRESS);
|
||||
m_redirectUrl = QSL(OAUTH_REDIRECT_URI);
|
||||
m_tokenGrantType = QSL("authorization_code");
|
||||
m_tokenUrl = QUrl(token_url);
|
||||
m_authUrl = auth_url;
|
||||
@ -60,8 +56,6 @@ OAuth2Service::OAuth2Service(const QString& auth_url, const QString& token_url,
|
||||
m_scope = scope;
|
||||
|
||||
connect(&m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(tokenRequestFinished(QNetworkReply*)));
|
||||
|
||||
#if !defined(USE_WEBENGINE)
|
||||
connect(handler(), &OAuthHttpHandler::authGranted, [this](const QString& auth_code, const QString& id) {
|
||||
if (id.isEmpty() || id == m_id) {
|
||||
// We process this further only if handler (static singleton) responded to our original request.
|
||||
@ -76,7 +70,6 @@ OAuth2Service::OAuth2Service(const QString& auth_url, const QString& token_url,
|
||||
emit authFailed();
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
QString OAuth2Service::bearer() {
|
||||
@ -137,13 +130,10 @@ void OAuth2Service::setId(const QString& id) {
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
#if !defined(USE_WEBENGINE)
|
||||
OAuthHttpHandler* OAuth2Service::handler() {
|
||||
return qz_silent_acmanager();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void OAuth2Service::retrieveAccessToken(const QString& auth_code) {
|
||||
QNetworkRequest networkRequest;
|
||||
|
||||
@ -270,7 +260,7 @@ void OAuth2Service::setRefreshToken(const QString& refresh_token) {
|
||||
}
|
||||
|
||||
bool OAuth2Service::login() {
|
||||
bool did_token_expire = tokensExpireIn().isNull() || tokensExpireIn() < QDateTime::currentDateTime();
|
||||
bool did_token_expire = tokensExpireIn().isNull() || tokensExpireIn() < QDateTime::currentDateTime().addSecs(-120);
|
||||
bool does_token_exist = !refreshToken().isEmpty();
|
||||
|
||||
// We refresh current tokens only if:
|
||||
@ -309,30 +299,20 @@ void OAuth2Service::killRefreshTimer() {
|
||||
}
|
||||
|
||||
void OAuth2Service::retrieveAuthCode() {
|
||||
QString auth_url = m_authUrl + QString("?client_id=%1&scope=%2&"
|
||||
"redirect_uri=%3&response_type=code&state=%4&"
|
||||
"prompt=consent&access_type=offline").arg(m_clientId,
|
||||
m_scope,
|
||||
m_redirectUrl,
|
||||
m_id);
|
||||
|
||||
#if defined(USE_WEBENGINE)
|
||||
OAuthLogin login_page(qApp->mainFormWidget());
|
||||
|
||||
connect(&login_page, &OAuthLogin::authGranted, this, &OAuth2Service::retrieveAccessToken);
|
||||
connect(&login_page, &OAuthLogin::authRejected, this, [this]() {
|
||||
logout();
|
||||
emit authFailed();
|
||||
});
|
||||
|
||||
qApp->showGuiMessage(tr("Logging in via OAuth 2.0..."),
|
||||
tr("Requesting access authorization for '%1'...").arg(m_authUrl),
|
||||
QSystemTrayIcon::MessageIcon::Information);
|
||||
|
||||
login_page.login(auth_url, m_redirectUrl);
|
||||
#else
|
||||
QString auth_url = m_authUrl + QString("?client_id=%1&"
|
||||
"scope=%2&"
|
||||
"redirect_uri=%3&"
|
||||
"response_type=code&"
|
||||
"state=%4&"
|
||||
"prompt=consent&"
|
||||
"access_type=offline").arg(m_clientId, m_scope, m_redirectUrl, m_id);
|
||||
|
||||
// We run login URL in external browser, response is caught by light HTTP server.
|
||||
qApp->web()->openUrlInExternalBrowser(auth_url);
|
||||
#endif
|
||||
if (qApp->web()->openUrlInExternalBrowser(auth_url)) {
|
||||
QInputDialog::getText(qApp->mainFormWidget(),
|
||||
tr("Navigate to website"),
|
||||
tr("To login, you need to navigate to this website:"),
|
||||
QLineEdit::EchoMode::Normal,
|
||||
auth_url);
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,8 @@
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include "network-web/silentnetworkaccessmanager.h"
|
||||
|
||||
#if !defined(USE_WEBENGINE)
|
||||
#include "network-web/oauthhttphandler.h"
|
||||
#endif
|
||||
#include "network-web/silentnetworkaccessmanager.h"
|
||||
|
||||
class OAuth2Service : public QObject {
|
||||
Q_OBJECT
|
||||
@ -43,10 +40,9 @@ class OAuth2Service : public QObject {
|
||||
const QString& scope, QObject* parent = nullptr);
|
||||
|
||||
// Returns bearer HTTP header value.
|
||||
// NOTE: Only call this if isFullyLoggedIn()
|
||||
// returns true. If isFullyLoggedIn() returns
|
||||
// false, then you must call login() on
|
||||
// main GUI thread.
|
||||
// NOTE: If on working thread, then call this only if isFullyLoggedIn()
|
||||
// returns true. If isFullyLoggedIn() returns false, then you must call login() on
|
||||
// main GUI thread first.
|
||||
QString bearer();
|
||||
bool isFullyLoggedIn() const;
|
||||
|
||||
@ -89,6 +85,7 @@ class OAuth2Service : public QObject {
|
||||
// Performs login if needed. If some refresh token is set, then
|
||||
// the initial "auth" step is skipped and attempt to refresh
|
||||
// access token is made.
|
||||
//
|
||||
// Returns true, if user is already logged in (final state).
|
||||
// Returns false, if user is NOT logged in (asynchronous flow).
|
||||
//
|
||||
@ -119,12 +116,7 @@ class OAuth2Service : public QObject {
|
||||
QString m_authUrl;
|
||||
QString m_scope;
|
||||
SilentNetworkAccessManager m_networkManager;
|
||||
|
||||
#if !defined(USE_WEBENGINE)
|
||||
|
||||
// Returns pointer to global silent network manager
|
||||
static OAuthHttpHandler* handler();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // OAUTH2SERVICE_H
|
||||
|
@ -15,8 +15,8 @@ OAuthHttpHandler::OAuthHttpHandler(QObject* parent) : QObject(parent) {
|
||||
|
||||
connect(&m_httpServer, &QTcpServer::newConnection, this, &OAuthHttpHandler::clientConnected);
|
||||
|
||||
if (!m_httpServer.listen(m_listenAddress, 13377)) {
|
||||
qCritical("OAuth HTTP handler: Failed to start listening.");
|
||||
if (!m_httpServer.listen(m_listenAddress, OAUTH_REDIRECT_URI_PORT)) {
|
||||
qCritical("OAuth HTTP handler: Failed to start listening on port '%d'.", OAUTH_REDIRECT_URI_PORT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ void OAuthHttpHandler::answerClient(QTcpSocket* socket, const QUrl& url) {
|
||||
const QUrlQuery query(url.query());
|
||||
const auto items = query.queryItems();
|
||||
|
||||
for (const auto & item : items) {
|
||||
for (const auto& item : items) {
|
||||
received_data.insert(item.first, item.second);
|
||||
}
|
||||
|
||||
|
@ -15,15 +15,11 @@ FormEditGmailAccount::FormEditGmailAccount(QWidget* parent) : QDialog(parent),
|
||||
m_ui.setupUi(this);
|
||||
|
||||
GuiUtilities::setLabelAsNotice(*m_ui.m_lblAuthInfo, true);
|
||||
|
||||
#if !defined(USE_WEBENGINE)
|
||||
m_ui.m_lblAuthInfo->setText(tr("You must use \"%1\" as base redirect URL. You can use custom port to make sure "
|
||||
"that no local service occupies it. Make sure that this redirect URL matches redirect "
|
||||
"URL of used \"application\".").arg(LOCALHOST_ADDRESS));
|
||||
#endif
|
||||
|
||||
GuiUtilities::applyDialogProperties(*this, qApp->icons()->miscIcon(QSL("gmail")));
|
||||
|
||||
m_ui.m_lblAuthInfo->setText(tr("You must use \"%1\" as redirect URL. It is important to leave this "
|
||||
"URL intact, because %2 is waiting on specified port for "
|
||||
"service tokens.").arg(OAUTH_REDIRECT_URI, APP_NAME));
|
||||
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Information,
|
||||
tr("Not tested yet."),
|
||||
tr("Not tested yet."));
|
||||
@ -150,7 +146,7 @@ GmailServiceRoot* FormEditGmailAccount::execForCreate() {
|
||||
|
||||
m_ui.m_txtAppId->lineEdit()->clear();
|
||||
m_ui.m_txtAppKey->lineEdit()->clear();
|
||||
m_ui.m_txtRedirectUrl->lineEdit()->setText(LOCALHOST_ADDRESS);
|
||||
m_ui.m_txtRedirectUrl->lineEdit()->setText(OAUTH_REDIRECT_URI);
|
||||
|
||||
exec();
|
||||
|
||||
|
@ -10,119 +10,115 @@
|
||||
<height>363</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtUsername" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>OAuth 2.0 settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_2">
|
||||
<property name="text">
|
||||
<string>Application ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtAppId" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_3">
|
||||
<property name="text">
|
||||
<string>Application key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtAppKey" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_4">
|
||||
<property name="text">
|
||||
<string>Redirect URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtRedirectUrl" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblAuthInfo">
|
||||
<property name="text">
|
||||
<string>Predefined settings DO NOT have to be changed from their default values. Change these values only of you are advanced user and you know what you are doing!</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
<string>Only download newest X messages per feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtUsername" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>OAuth 2.0 settings</string>
|
||||
<widget class="QSpinBox" name="m_spinLimitMessages">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> message(s)</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_2">
|
||||
<property name="text">
|
||||
<string>Application ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtAppId" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_3">
|
||||
<property name="text">
|
||||
<string>Application key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtAppKey" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_4">
|
||||
<property name="text">
|
||||
<string>Redirect URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtRedirectUrl" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblAuthInfo">
|
||||
<property name="text">
|
||||
<string>Predefined settings DO NOT have to be changed from their default values. Change these values only of you are advanced user and you know what you are doing!</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Only download newest X messages per feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="m_spinLimitMessages">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> message(s)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="m_btnTestSetup">
|
||||
<property name="text">
|
||||
<string>&Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LabelWithStatus" name="m_lblTestResult" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="m_btnTestSetup">
|
||||
<property name="text">
|
||||
<string>&Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LabelWithStatus" name="m_lblTestResult" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -132,6 +128,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
@ -17,12 +17,9 @@ FormEditInoreaderAccount::FormEditInoreaderAccount(QWidget* parent) : QDialog(pa
|
||||
GuiUtilities::setLabelAsNotice(*m_ui.m_lblAuthInfo, true);
|
||||
GuiUtilities::applyDialogProperties(*this, qApp->icons()->miscIcon(QSL("inoreader")));
|
||||
|
||||
#if !defined(USE_WEBENGINE)
|
||||
m_ui.m_lblAuthInfo->setText(tr("You must use \"%1\" as base redirect URL. You can use custom port to make sure "
|
||||
"that no local service occupies it. Make sure that this redirect URL matches redirect "
|
||||
"URL of used \"application\".").arg(LOCALHOST_ADDRESS));
|
||||
#endif
|
||||
|
||||
m_ui.m_lblAuthInfo->setText(tr("You must use \"%1\" as redirect URL. It is important to leave this "
|
||||
"URL intact, because %2 is waiting on specified port for "
|
||||
"service tokens.").arg(OAUTH_REDIRECT_URI, APP_NAME));
|
||||
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Information,
|
||||
tr("Not tested yet."),
|
||||
tr("Not tested yet."));
|
||||
@ -147,7 +144,7 @@ InoreaderServiceRoot* FormEditInoreaderAccount::execForCreate() {
|
||||
|
||||
m_ui.m_txtAppId->lineEdit()->setText(INOREADER_OAUTH_CLI_ID);
|
||||
m_ui.m_txtAppKey->lineEdit()->setText(INOREADER_OAUTH_CLI_KEY);
|
||||
m_ui.m_txtRedirectUrl->lineEdit()->setText(LOCALHOST_ADDRESS);
|
||||
m_ui.m_txtRedirectUrl->lineEdit()->setText(OAUTH_REDIRECT_URI);
|
||||
|
||||
exec();
|
||||
|
||||
|
@ -10,119 +10,115 @@
|
||||
<height>363</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtUsername" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>OAuth 2.0 settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_2">
|
||||
<property name="text">
|
||||
<string>Application ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtAppId" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_3">
|
||||
<property name="text">
|
||||
<string>Application key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtAppKey" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_4">
|
||||
<property name="text">
|
||||
<string>Redirect URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtRedirectUrl" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblAuthInfo">
|
||||
<property name="text">
|
||||
<string>These settings DO NOT have to be changed from their default values. Change these values only of you are advanced user and you know what you are doing!</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
<string>Only download newest X messages per feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtUsername" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>OAuth 2.0 settings</string>
|
||||
<widget class="QSpinBox" name="m_spinLimitMessages">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> message(s)</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_2">
|
||||
<property name="text">
|
||||
<string>Application ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtAppId" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_3">
|
||||
<property name="text">
|
||||
<string>Application key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtAppKey" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_lblUsername_4">
|
||||
<property name="text">
|
||||
<string>Redirect URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtRedirectUrl" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblAuthInfo">
|
||||
<property name="text">
|
||||
<string>These settings DO NOT have to be changed from their default values. Change these values only of you are advanced user and you know what you are doing!</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Only download newest X messages per feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="m_spinLimitMessages">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> message(s)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="m_btnTestSetup">
|
||||
<property name="text">
|
||||
<string>&Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LabelWithStatus" name="m_lblTestResult" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="m_btnTestSetup">
|
||||
<property name="text">
|
||||
<string>&Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LabelWithStatus" name="m_lblTestResult" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -132,6 +128,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
Loading…
x
Reference in New Issue
Block a user