Fixed #112.
This commit is contained in:
parent
531474b3b6
commit
3fe83047e5
@ -2,6 +2,7 @@
|
||||
—————
|
||||
|
||||
Added:
|
||||
▪ NextCloud plugin now allows to persistently set max number of messages to get downloaded per feed.
|
||||
▪ Added support for arbitrary external tools (settings category "Web browser & e-mail & proxy") which can open URLs of selected messages. (#136)
|
||||
▪ Standard account is now automatically added if RSS Guard is started with empty database.
|
||||
▪ Menu action "Select next unread message" in "Messages" menu now works across all feeds, so user can navigate through all unread messages with a sigle keyboard shortcut. (#132, #6)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
#include "miscellaneous/textfactory.h"
|
||||
#include "services/abstract/category.h"
|
||||
#include "services/owncloud/definitions.h"
|
||||
#include "services/owncloud/network/owncloudnetworkfactory.h"
|
||||
#include "services/owncloud/owncloudfeed.h"
|
||||
#include "services/owncloud/owncloudserviceroot.h"
|
||||
@ -891,6 +892,7 @@ QList<ServiceRoot*> DatabaseQueries::getOwnCloudAccounts(QSqlDatabase db, bool*
|
||||
root->network()->setAuthPassword(TextFactory::decrypt(query.value(2).toString()));
|
||||
root->network()->setUrl(query.value(3).toString());
|
||||
root->network()->setForceServerSideUpdate(query.value(4).toBool());
|
||||
root->network()->setBatchSize(query.value(5).toInt());
|
||||
root->updateTitle();
|
||||
roots.append(root);
|
||||
}
|
||||
@ -957,17 +959,18 @@ bool DatabaseQueries::deleteOwnCloudAccount(QSqlDatabase db, int account_id) {
|
||||
}
|
||||
|
||||
bool DatabaseQueries::overwriteOwnCloudAccount(QSqlDatabase db, const QString& username, const QString& password,
|
||||
const QString& url, bool force_server_side_feed_update, int account_id) {
|
||||
const QString& url, bool force_server_side_feed_update, int batch_size, int account_id) {
|
||||
QSqlQuery query(db);
|
||||
|
||||
query.prepare("UPDATE OwnCloudAccounts "
|
||||
"SET username = :username, password = :password, url = :url, force_update = :force_update "
|
||||
"SET username = :username, password = :password, url = :url, force_update = :force_update, msg_limit = :msg_limit "
|
||||
"WHERE id = :id;");
|
||||
query.bindValue(QSL(":username"), username);
|
||||
query.bindValue(QSL(":password"), TextFactory::encrypt(password));
|
||||
query.bindValue(QSL(":url"), url);
|
||||
query.bindValue(QSL(":force_update"), force_server_side_feed_update ? 1 : 0);
|
||||
query.bindValue(QSL(":id"), account_id);
|
||||
query.bindValue(QSL(":msg_limit"), batch_size <= 0 ? UNLIMITED_BATCH_SIZE : batch_size);
|
||||
|
||||
if (query.exec()) {
|
||||
return true;
|
||||
@ -980,16 +983,17 @@ bool DatabaseQueries::overwriteOwnCloudAccount(QSqlDatabase db, const QString& u
|
||||
|
||||
bool DatabaseQueries::createOwnCloudAccount(QSqlDatabase db, int id_to_assign, const QString& username,
|
||||
const QString& password, const QString& url,
|
||||
bool force_server_side_feed_update) {
|
||||
bool force_server_side_feed_update, int batch_size) {
|
||||
QSqlQuery q(db);
|
||||
|
||||
q.prepare("INSERT INTO OwnCloudAccounts (id, username, password, url, force_update) "
|
||||
"VALUES (:id, :username, :password, :url, :force_update);");
|
||||
q.prepare("INSERT INTO OwnCloudAccounts (id, username, password, url, force_update, msg_limit) "
|
||||
"VALUES (:id, :username, :password, :url, :force_update, :msg_limit);");
|
||||
q.bindValue(QSL(":id"), id_to_assign);
|
||||
q.bindValue(QSL(":username"), username);
|
||||
q.bindValue(QSL(":password"), TextFactory::encrypt(password));
|
||||
q.bindValue(QSL(":url"), url);
|
||||
q.bindValue(QSL(":force_update"), force_server_side_feed_update ? 1 : 0);
|
||||
q.bindValue(QSL(":msg_limit"), batch_size <= 0 ? UNLIMITED_BATCH_SIZE : batch_size);
|
||||
|
||||
if (q.exec()) {
|
||||
return true;
|
||||
|
@ -82,9 +82,9 @@ class DatabaseQueries {
|
||||
static QList<ServiceRoot*> getOwnCloudAccounts(QSqlDatabase db, bool* ok = nullptr);
|
||||
static bool deleteOwnCloudAccount(QSqlDatabase db, int account_id);
|
||||
static bool overwriteOwnCloudAccount(QSqlDatabase db, const QString& username, const QString& password,
|
||||
const QString& url, bool force_server_side_feed_update, int account_id);
|
||||
const QString& url, bool force_server_side_feed_update, int batch_size, int account_id);
|
||||
static bool createOwnCloudAccount(QSqlDatabase db, int id_to_assign, const QString& username, const QString& password,
|
||||
const QString& url, bool force_server_side_feed_update);
|
||||
const QString& url, bool force_server_side_feed_update, int batch_size);
|
||||
static int createAccount(QSqlDatabase db, const QString& code, bool* ok = nullptr);
|
||||
static Assignment getOwnCloudFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
|
||||
|
@ -23,5 +23,6 @@
|
||||
#define API_VERSION "1.2"
|
||||
#define API_PATH "index.php/apps/news/api/v1-2/"
|
||||
#define MINIMAL_OC_VERSION "6.0.5"
|
||||
#define UNLIMITED_BATCH_SIZE -1
|
||||
|
||||
#endif // OWNCLOUD_DEFINITIONS_H
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
OwnCloudNetworkFactory::OwnCloudNetworkFactory()
|
||||
: m_url(QString()), m_fixedUrl(QString()), m_forceServerSideUpdate(false),
|
||||
m_authUsername(QString()), m_authPassword(QString()), m_batchSize(-1), m_urlUser(QString()), m_urlStatus(QString()),
|
||||
m_authUsername(QString()), m_authPassword(QString()), m_batchSize(UNLIMITED_BATCH_SIZE), m_urlUser(QString()), m_urlStatus(QString()),
|
||||
m_urlFolders(QString()), m_urlFeeds(QString()), m_urlMessages(QString()), m_urlFeedsUpdate(QString()),
|
||||
m_urlDeleteFeed(QString()), m_urlRenameFeed(QString()), m_userId(QString()) {}
|
||||
|
||||
|
@ -195,7 +195,8 @@ void OwnCloudServiceRoot::saveAccountDataToDatabase() {
|
||||
if (accountId() != NO_PARENT_CATEGORY) {
|
||||
if (DatabaseQueries::overwriteOwnCloudAccount(database, m_network->authUsername(),
|
||||
m_network->authPassword(), m_network->url(),
|
||||
m_network->forceServerSideUpdate(), accountId())) {
|
||||
m_network->forceServerSideUpdate(), m_network->batchSize(),
|
||||
accountId())) {
|
||||
updateTitle();
|
||||
itemChanged(QList<RootItem*>() << this);
|
||||
}
|
||||
@ -207,7 +208,8 @@ void OwnCloudServiceRoot::saveAccountDataToDatabase() {
|
||||
if (saved) {
|
||||
if (DatabaseQueries::createOwnCloudAccount(database, id_to_assign, m_network->authUsername(),
|
||||
m_network->authPassword(), m_network->url(),
|
||||
m_network->forceServerSideUpdate())) {
|
||||
m_network->forceServerSideUpdate(),
|
||||
m_network->batchSize())) {
|
||||
setId(id_to_assign);
|
||||
setAccountId(id_to_assign);
|
||||
updateTitle();
|
||||
|
Loading…
x
Reference in New Issue
Block a user