better dialog when cannot open url, ability to delete feedly accounts
This commit is contained in:
parent
016a0f9a3a
commit
1fb64ae544
|
@ -2510,6 +2510,15 @@ QList<ServiceRoot*> DatabaseQueries::getStandardAccounts(const QSqlDatabase& db,
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DatabaseQueries::deleteFeedlyAccount(const QSqlDatabase& db, int account_id) {
|
||||||
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
q.setForwardOnly(true);
|
||||||
|
q.prepare(QSL("DELETE FROM FeedlyAccounts WHERE id = :id;"));
|
||||||
|
q.bindValue(QSL(":id"), account_id);
|
||||||
|
return q.exec();
|
||||||
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteGreaderAccount(const QSqlDatabase& db, int account_id) {
|
bool DatabaseQueries::deleteGreaderAccount(const QSqlDatabase& db, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,7 @@ class DatabaseQueries {
|
||||||
static void fillFeedData(T* feed, const QSqlRecord& sql_record);
|
static void fillFeedData(T* feed, const QSqlRecord& sql_record);
|
||||||
|
|
||||||
// Feedly account.
|
// Feedly account.
|
||||||
|
static bool deleteFeedlyAccount(const QSqlDatabase& db, int account_id);
|
||||||
static QList<ServiceRoot*> getFeedlyAccounts(const QSqlDatabase& db, bool* ok = nullptr);
|
static QList<ServiceRoot*> getFeedlyAccounts(const QSqlDatabase& db, bool* ok = nullptr);
|
||||||
static bool createFeedlyAccount(const QSqlDatabase& db,
|
static bool createFeedlyAccount(const QSqlDatabase& db,
|
||||||
const QString& username,
|
const QString& username,
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "network-web/oauth2service.h"
|
#include "network-web/oauth2service.h"
|
||||||
|
|
||||||
#include "definitions/definitions.h"
|
#include "definitions/definitions.h"
|
||||||
|
#include "gui/messagebox.h"
|
||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
#include "network-web/networkfactory.h"
|
#include "network-web/networkfactory.h"
|
||||||
#include "network-web/oauthhttphandler.h"
|
#include "network-web/oauthhttphandler.h"
|
||||||
|
@ -331,11 +332,13 @@ void OAuth2Service::retrieveAuthCode() {
|
||||||
m_id);
|
m_id);
|
||||||
|
|
||||||
// We run login URL in external browser, response is caught by light HTTP server.
|
// We run login URL in external browser, response is caught by light HTTP server.
|
||||||
if (!qApp->web()->openUrlInExternalBrowser(auth_url)) {
|
if (qApp->web()->openUrlInExternalBrowser(auth_url)) {
|
||||||
QInputDialog::getText(qApp->mainFormWidget(),
|
MessageBox::show(qApp->mainFormWidget(),
|
||||||
tr("Navigate to website"),
|
QMessageBox::Icon::Question,
|
||||||
tr("To login, you need to navigate to this website:"),
|
tr("Navigate to website"),
|
||||||
QLineEdit::EchoMode::Normal,
|
tr("To login, you need to navigate to the below website."),
|
||||||
auth_url);
|
{},
|
||||||
|
auth_url,
|
||||||
|
QMessageBox::StandardButton::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ bool FeedlyServiceRoot::editViaGui() {
|
||||||
bool FeedlyServiceRoot::deleteViaGui() {
|
bool FeedlyServiceRoot::deleteViaGui() {
|
||||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className());
|
QSqlDatabase database = qApp->database()->connection(metaObject()->className());
|
||||||
|
|
||||||
if (DatabaseQueries::deleteGreaderAccount(database, accountId())) {
|
if (DatabaseQueries::deleteFeedlyAccount(database, accountId())) {
|
||||||
return ServiceRoot::deleteViaGui();
|
return ServiceRoot::deleteViaGui();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue