sql for feedly - not tested
This commit is contained in:
parent
bc15a34d94
commit
36d631f67c
@ -20,6 +20,7 @@
|
|||||||
<file>sql/db_update_mysql_17_18.sql</file>
|
<file>sql/db_update_mysql_17_18.sql</file>
|
||||||
<file>sql/db_update_mysql_18_19.sql</file>
|
<file>sql/db_update_mysql_18_19.sql</file>
|
||||||
<file>sql/db_update_mysql_19_20.sql</file>
|
<file>sql/db_update_mysql_19_20.sql</file>
|
||||||
|
<file>sql/db_update_mysql_20_21.sql</file>
|
||||||
|
|
||||||
<file>sql/db_init_sqlite.sql</file>
|
<file>sql/db_init_sqlite.sql</file>
|
||||||
<file>sql/db_update_sqlite_1_2.sql</file>
|
<file>sql/db_update_sqlite_1_2.sql</file>
|
||||||
@ -41,5 +42,6 @@
|
|||||||
<file>sql/db_update_sqlite_17_18.sql</file>
|
<file>sql/db_update_sqlite_17_18.sql</file>
|
||||||
<file>sql/db_update_sqlite_18_19.sql</file>
|
<file>sql/db_update_sqlite_18_19.sql</file>
|
||||||
<file>sql/db_update_sqlite_19_20.sql</file>
|
<file>sql/db_update_sqlite_19_20.sql</file>
|
||||||
|
<file>sql/db_update_sqlite_20_21.sql</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Information (
|
|||||||
inf_value TEXT NOT NULL
|
inf_value TEXT NOT NULL
|
||||||
);
|
);
|
||||||
-- !
|
-- !
|
||||||
INSERT INTO Information VALUES (1, 'schema_version', '20');
|
INSERT INTO Information VALUES (1, 'schema_version', '21');
|
||||||
-- !
|
-- !
|
||||||
CREATE TABLE IF NOT EXISTS Accounts (
|
CREATE TABLE IF NOT EXISTS Accounts (
|
||||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||||
@ -85,6 +85,16 @@ CREATE TABLE IF NOT EXISTS GoogleReaderApiAccounts (
|
|||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||||
);
|
);
|
||||||
-- !
|
-- !
|
||||||
|
CREATE TABLE IF NOT EXISTS FeedlyAccounts (
|
||||||
|
id INTEGER,
|
||||||
|
username TEXT NOT NULL,
|
||||||
|
developer_access_token TEXT,
|
||||||
|
refresh_token TEXT,
|
||||||
|
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
|
||||||
|
|
||||||
|
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||||
|
);
|
||||||
|
-- !
|
||||||
DROP TABLE IF EXISTS Categories;
|
DROP TABLE IF EXISTS Categories;
|
||||||
-- !
|
-- !
|
||||||
CREATE TABLE IF NOT EXISTS Categories (
|
CREATE TABLE IF NOT EXISTS Categories (
|
||||||
|
@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS Information (
|
|||||||
inf_value TEXT NOT NULL
|
inf_value TEXT NOT NULL
|
||||||
);
|
);
|
||||||
-- !
|
-- !
|
||||||
INSERT INTO Information VALUES (1, 'schema_version', '20');
|
INSERT INTO Information VALUES (1, 'schema_version', '21');
|
||||||
-- !
|
-- !
|
||||||
CREATE TABLE IF NOT EXISTS Accounts (
|
CREATE TABLE IF NOT EXISTS Accounts (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
@ -79,6 +79,16 @@ CREATE TABLE IF NOT EXISTS GoogleReaderApiAccounts (
|
|||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||||
);
|
);
|
||||||
-- !
|
-- !
|
||||||
|
CREATE TABLE IF NOT EXISTS FeedlyAccounts (
|
||||||
|
id INTEGER,
|
||||||
|
username TEXT NOT NULL,
|
||||||
|
developer_access_token TEXT,
|
||||||
|
refresh_token TEXT,
|
||||||
|
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
|
||||||
|
|
||||||
|
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||||
|
);
|
||||||
|
-- !
|
||||||
DROP TABLE IF EXISTS Categories;
|
DROP TABLE IF EXISTS Categories;
|
||||||
-- !
|
-- !
|
||||||
CREATE TABLE IF NOT EXISTS Categories (
|
CREATE TABLE IF NOT EXISTS Categories (
|
||||||
|
11
resources/sql/db_update_mysql_20_21.sql
Executable file
11
resources/sql/db_update_mysql_20_21.sql
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS FeedlyAccounts (
|
||||||
|
id INTEGER,
|
||||||
|
username TEXT NOT NULL,
|
||||||
|
developer_access_token TEXT,
|
||||||
|
refresh_token TEXT,
|
||||||
|
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
|
||||||
|
|
||||||
|
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||||
|
);
|
||||||
|
-- !
|
||||||
|
UPDATE Information SET inf_value = '21' WHERE inf_key = 'schema_version';
|
11
resources/sql/db_update_sqlite_20_21.sql
Executable file
11
resources/sql/db_update_sqlite_20_21.sql
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS FeedlyAccounts (
|
||||||
|
id INTEGER,
|
||||||
|
username TEXT NOT NULL,
|
||||||
|
developer_access_token TEXT,
|
||||||
|
refresh_token TEXT,
|
||||||
|
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
|
||||||
|
|
||||||
|
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||||
|
);
|
||||||
|
-- !
|
||||||
|
UPDATE Information SET inf_value = '21' WHERE inf_key = 'schema_version';
|
@ -152,7 +152,7 @@
|
|||||||
#define APP_DB_SQLITE_FILE "database.db"
|
#define APP_DB_SQLITE_FILE "database.db"
|
||||||
|
|
||||||
// Keep this in sync with schema versions declared in SQL initialization code.
|
// Keep this in sync with schema versions declared in SQL initialization code.
|
||||||
#define APP_DB_SCHEMA_VERSION "20"
|
#define APP_DB_SCHEMA_VERSION "21"
|
||||||
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
|
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
|
||||||
#define APP_DB_COMMENT_SPLIT "-- !\n"
|
#define APP_DB_COMMENT_SPLIT "-- !\n"
|
||||||
#define APP_DB_NAME_PLACEHOLDER "##"
|
#define APP_DB_NAME_PLACEHOLDER "##"
|
||||||
|
@ -453,11 +453,10 @@ bool DatabaseFactory::sqliteUpdateDatabaseSchema(const QSqlDatabase& database, c
|
|||||||
|
|
||||||
// Increment the version.
|
// Increment the version.
|
||||||
qDebugNN << LOGSEC_DB
|
qDebugNN << LOGSEC_DB
|
||||||
<< "Updating database schema: '"
|
<< "Updating database schema:"
|
||||||
<< working_version
|
<< QUOTE_W_SPACE(working_version)
|
||||||
<< "' -> '"
|
<< "->"
|
||||||
<< working_version + 1
|
<< QUOTE_W_SPACE_DOT(working_version + 1);
|
||||||
<< "'.";
|
|
||||||
|
|
||||||
working_version++;
|
working_version++;
|
||||||
}
|
}
|
||||||
|
@ -290,13 +290,15 @@ bool OAuth2Service::login() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OAuth2Service::logout() {
|
void OAuth2Service::logout(bool stop_redirection_handler) {
|
||||||
setTokensExpireIn(QDateTime());
|
setTokensExpireIn(QDateTime());
|
||||||
setAccessToken(QString());
|
setAccessToken(QString());
|
||||||
setRefreshToken(QString());
|
setRefreshToken(QString());
|
||||||
|
|
||||||
|
if (stop_redirection_handler) {
|
||||||
m_redirectionHandler->stop();
|
m_redirectionHandler->stop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OAuth2Service::startRefreshTimer() {
|
void OAuth2Service::startRefreshTimer() {
|
||||||
if (!refreshToken().isEmpty()) {
|
if (!refreshToken().isEmpty()) {
|
||||||
|
@ -94,7 +94,7 @@ class OAuth2Service : public QObject {
|
|||||||
bool login();
|
bool login();
|
||||||
|
|
||||||
// Removes all state data and stops redirection handler.
|
// Removes all state data and stops redirection handler.
|
||||||
void logout();
|
void logout(bool stop_redirection_handler = true);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void startRefreshTimer();
|
void startRefreshTimer();
|
||||||
|
@ -7,7 +7,12 @@
|
|||||||
#define FEEDLY_API_REDIRECT_URI_PORT 8080
|
#define FEEDLY_API_REDIRECT_URI_PORT 8080
|
||||||
#define FEEDLY_API_SCOPE "https://cloud.feedly.com/subscriptions"
|
#define FEEDLY_API_SCOPE "https://cloud.feedly.com/subscriptions"
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
#define FEEDLY_API_URL_BASE "https://sandbox7.feedly.com/v3/"
|
||||||
|
#else
|
||||||
#define FEEDLY_API_URL_BASE "https://cloud.feedly.com/v3/"
|
#define FEEDLY_API_URL_BASE "https://cloud.feedly.com/v3/"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FEEDLY_API_URL_AUTH "auth/auth"
|
#define FEEDLY_API_URL_AUTH "auth/auth"
|
||||||
#define FEEDLY_API_URL_TOKEN "auth/token"
|
#define FEEDLY_API_URL_TOKEN "auth/token"
|
||||||
#define FEEDLY_API_URL_PROFILE "profile"
|
#define FEEDLY_API_URL_PROFILE "profile"
|
||||||
|
@ -152,6 +152,9 @@ QString FeedlyNetwork::fullUrl(FeedlyNetwork::Service service) const {
|
|||||||
switch (service) {
|
switch (service) {
|
||||||
case FeedlyNetwork::Service::Profile:
|
case FeedlyNetwork::Service::Profile:
|
||||||
return QSL(FEEDLY_API_URL_BASE) + FEEDLY_API_URL_PROFILE;
|
return QSL(FEEDLY_API_URL_BASE) + FEEDLY_API_URL_PROFILE;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FEEDLY_API_URL_BASE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void FeedlyAccountDetails::onAuthGranted() {
|
|||||||
void FeedlyAccountDetails::performTest(const QNetworkProxy& custom_proxy) {
|
void FeedlyAccountDetails::performTest(const QNetworkProxy& custom_proxy) {
|
||||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||||
if (m_ui.m_txtDeveloperAccessToken->lineEdit()->text().simplified().isEmpty()) {
|
if (m_ui.m_txtDeveloperAccessToken->lineEdit()->text().simplified().isEmpty()) {
|
||||||
m_oauth->logout();
|
m_oauth->logout(false);
|
||||||
|
|
||||||
if (m_oauth->login()) {
|
if (m_oauth->login()) {
|
||||||
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
|
@ -35,6 +35,9 @@ void FormEditFeedlyAccount::apply() {
|
|||||||
account<FeedlyServiceRoot>()->network()->oauth()->setTokensExpireIn(m_details->m_oauth->tokensExpireIn());
|
account<FeedlyServiceRoot>()->network()->oauth()->setTokensExpireIn(m_details->m_oauth->tokensExpireIn());
|
||||||
m_details->m_oauth->logout();
|
m_details->m_oauth->logout();
|
||||||
m_details->m_oauth->deleteLater();
|
m_details->m_oauth->deleteLater();
|
||||||
|
|
||||||
|
// Force live OAuth object to re-start it's
|
||||||
|
account<FeedlyServiceRoot>()->network()->oauth()->setRedirectUrl(account<FeedlyServiceRoot>()->network()->oauth()->redirectUrl());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -66,6 +66,6 @@ void FormEditInoreaderAccount::setEditableAccount(ServiceRoot* editable_account)
|
|||||||
m_details->m_ui.m_txtAppKey->lineEdit()->setText(m_details->m_oauth->clientSecret());
|
m_details->m_ui.m_txtAppKey->lineEdit()->setText(m_details->m_oauth->clientSecret());
|
||||||
m_details->m_ui.m_txtRedirectUrl->lineEdit()->setText(m_details->m_oauth->redirectUrl());
|
m_details->m_ui.m_txtRedirectUrl->lineEdit()->setText(m_details->m_oauth->redirectUrl());
|
||||||
|
|
||||||
m_details->m_ui.m_txtUsername->lineEdit()->setText(account<InoreaderServiceRoot>()->network()->userName());
|
m_details->m_ui.m_txtUsername->lineEdit()->setText(account<InoreaderServiceRoot>()->network()->username());
|
||||||
m_details->m_ui.m_spinLimitMessages->setValue(account<InoreaderServiceRoot>()->network()->batchSize());
|
m_details->m_ui.m_spinLimitMessages->setValue(account<InoreaderServiceRoot>()->network()->batchSize());
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ InoreaderServiceRoot::InoreaderServiceRoot(RootItem* parent)
|
|||||||
InoreaderServiceRoot::~InoreaderServiceRoot() = default;
|
InoreaderServiceRoot::~InoreaderServiceRoot() = default;
|
||||||
|
|
||||||
void InoreaderServiceRoot::updateTitle() {
|
void InoreaderServiceRoot::updateTitle() {
|
||||||
setTitle(m_network->userName() + QSL(" (Inoreader)"));
|
setTitle(TextFactory::extractUsernameFromEmail(m_network->username()) + QSL(" (Inoreader)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InoreaderServiceRoot::loadFromDatabase() {
|
void InoreaderServiceRoot::loadFromDatabase() {
|
||||||
@ -41,7 +41,7 @@ void InoreaderServiceRoot::saveAccountDataToDatabase(bool creating_new) {
|
|||||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className());
|
QSqlDatabase database = qApp->database()->connection(metaObject()->className());
|
||||||
|
|
||||||
if (!creating_new) {
|
if (!creating_new) {
|
||||||
if (DatabaseQueries::overwriteInoreaderAccount(database, m_network->userName(),
|
if (DatabaseQueries::overwriteInoreaderAccount(database, m_network->username(),
|
||||||
m_network->oauth()->clientId(),
|
m_network->oauth()->clientId(),
|
||||||
m_network->oauth()->clientSecret(),
|
m_network->oauth()->clientSecret(),
|
||||||
m_network->oauth()->redirectUrl(),
|
m_network->oauth()->redirectUrl(),
|
||||||
@ -55,7 +55,7 @@ void InoreaderServiceRoot::saveAccountDataToDatabase(bool creating_new) {
|
|||||||
else {
|
else {
|
||||||
if (DatabaseQueries::createInoreaderAccount(database,
|
if (DatabaseQueries::createInoreaderAccount(database,
|
||||||
accountId(),
|
accountId(),
|
||||||
m_network->userName(),
|
m_network->username(),
|
||||||
m_network->oauth()->clientId(),
|
m_network->oauth()->clientId(),
|
||||||
m_network->oauth()->clientSecret(),
|
m_network->oauth()->clientSecret(),
|
||||||
m_network->oauth()->redirectUrl(),
|
m_network->oauth()->redirectUrl(),
|
||||||
|
@ -40,7 +40,7 @@ OAuth2Service* InoreaderNetworkFactory::oauth() const {
|
|||||||
return m_oauth2;
|
return m_oauth2;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString InoreaderNetworkFactory::userName() const {
|
QString InoreaderNetworkFactory::username() const {
|
||||||
return m_username;
|
return m_username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class InoreaderNetworkFactory : public QObject {
|
|||||||
OAuth2Service* oauth() const;
|
OAuth2Service* oauth() const;
|
||||||
void setOauth(OAuth2Service* oauth);
|
void setOauth(OAuth2Service* oauth);
|
||||||
|
|
||||||
QString userName() const;
|
QString username() const;
|
||||||
void setUsername(const QString& username);
|
void setUsername(const QString& username);
|
||||||
|
|
||||||
// Gets/sets the amount of messages to obtain during single feed update.
|
// Gets/sets the amount of messages to obtain during single feed update.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user