Fixed account IDs.
This commit is contained in:
parent
94dfc7c346
commit
27d8f5b04f
8 changed files with 31 additions and 26 deletions
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
Added:
|
Added:
|
||||||
<ul>
|
<ul>
|
||||||
<li style="color: red;">Brand new "service plugin system" - HIGHLY EXPERIMENTAL and REWRITTEN from scratch. Expect bugs and misunderstandings now! Major parts of RSS Guard were completely rewritten.</li>
|
<li style="color: red;">Brand new "service plugin system" - HIGHLY EXPERIMENTAL and REWRITTEN from scratch. Expect bugs and misunderstandings now! Major parts of RSS Guard were completely rewritten. Note that some functionality was TEMPORARILY removed, this includes "newspaper view".</li>
|
||||||
<li>Added ability to completely disable notifications (bug #128).</li>
|
<li>Added ability to completely disable notifications (bug #128).</li>
|
||||||
<li>Added ability to go to next <font style="font-weight: bold;">unread</font> message. (partially bug #112)</li>
|
<li>Added ability to go to next <font style="font-weight: bold;">unread</font> message. (partially bug #112)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "core/feedsmodel.h"
|
#include "core/feedsmodel.h"
|
||||||
|
|
||||||
|
|
||||||
ServiceRoot::ServiceRoot(RootItem *parent) : RootItem(parent) {
|
ServiceRoot::ServiceRoot(RootItem *parent) : RootItem(parent), m_accountId(NO_PARENT_CATEGORY) {
|
||||||
setKind(RootItemKind::ServiceRoot);
|
setKind(RootItemKind::ServiceRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,3 +46,11 @@ void ServiceRoot::requestItemReassignment(RootItem *item, RootItem *new_parent)
|
||||||
void ServiceRoot::requestItemRemoval(RootItem *item) {
|
void ServiceRoot::requestItemRemoval(RootItem *item) {
|
||||||
emit itemRemovalRequested(item);
|
emit itemRemovalRequested(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ServiceRoot::accountId() const {
|
||||||
|
return m_accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServiceRoot::setAccountId(int account_id) {
|
||||||
|
m_accountId = account_id;
|
||||||
|
}
|
||||||
|
|
|
@ -135,6 +135,9 @@ class ServiceRoot : public RootItem {
|
||||||
void requestItemReassignment(RootItem *item, RootItem *new_parent);
|
void requestItemReassignment(RootItem *item, RootItem *new_parent);
|
||||||
void requestItemRemoval(RootItem *item);
|
void requestItemRemoval(RootItem *item);
|
||||||
|
|
||||||
|
int accountId() const;
|
||||||
|
void setAccountId(int account_id);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Emitted if data in any item belonging to this root are changed.
|
// Emitted if data in any item belonging to this root are changed.
|
||||||
void dataChanged(QList<RootItem*> items);
|
void dataChanged(QList<RootItem*> items);
|
||||||
|
@ -143,6 +146,9 @@ class ServiceRoot : public RootItem {
|
||||||
|
|
||||||
void itemReassignmentRequested(RootItem *item, RootItem *new_parent);
|
void itemReassignmentRequested(RootItem *item, RootItem *new_parent);
|
||||||
void itemRemovalRequested(RootItem *item);
|
void itemRemovalRequested(RootItem *item);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_accountId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SERVICEROOT_H
|
#endif // SERVICEROOT_H
|
||||||
|
|
|
@ -74,7 +74,7 @@ ServiceRoot *StandardServiceEntryPoint::createNewRoot() {
|
||||||
if (query.exec(QString("INSERT INTO Accounts (id, type) VALUES (%1, '%2');").arg(QString::number(id_to_assing),
|
if (query.exec(QString("INSERT INTO Accounts (id, type) VALUES (%1, '%2');").arg(QString::number(id_to_assing),
|
||||||
SERVICE_CODE_STD_RSS))) {
|
SERVICE_CODE_STD_RSS))) {
|
||||||
StandardServiceRoot *root = new StandardServiceRoot(true);
|
StandardServiceRoot *root = new StandardServiceRoot(true);
|
||||||
root->setId(id_to_assing);
|
root->setAccountId(id_to_assing);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -91,7 +91,7 @@ QList<ServiceRoot*> StandardServiceEntryPoint::initializeSubtree() {
|
||||||
if (query.exec(QString("SELECT id FROM Accounts WHERE type = '%1';").arg(SERVICE_CODE_STD_RSS))) {
|
if (query.exec(QString("SELECT id FROM Accounts WHERE type = '%1';").arg(SERVICE_CODE_STD_RSS))) {
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
StandardServiceRoot *root = new StandardServiceRoot(true);
|
StandardServiceRoot *root = new StandardServiceRoot(true);
|
||||||
root->setId(query.value(0).toInt());
|
root->setAccountId(query.value(0).toInt());
|
||||||
roots.append(root);
|
roots.append(root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ QVariant StandardServiceRoot::data(int column, int role) const {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
if (column == FDS_MODEL_TITLE_INDEX) {
|
if (column == FDS_MODEL_TITLE_INDEX) {
|
||||||
return tr("This is service account for standard RSS/RDF/ATOM feeds.");
|
return tr("This is service account for standard RSS/RDF/ATOM feeds.\n\nAccount ID: %1").arg(accountId());
|
||||||
}
|
}
|
||||||
else if (column == FDS_MODEL_COUNTS_INDEX) {
|
else if (column == FDS_MODEL_COUNTS_INDEX) {
|
||||||
//: Tooltip for "unread" column of feed list.
|
//: Tooltip for "unread" column of feed list.
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
#define MINIMAL_API_LEVEL 10
|
#define MINIMAL_API_LEVEL 10
|
||||||
#define CONTENT_TYPE "application/json; charset=utf-8"
|
#define CONTENT_TYPE "application/json; charset=utf-8"
|
||||||
|
|
||||||
// Error when user needs to login before making an operation.
|
///
|
||||||
#define NOT_LOGGED_IN "NOT_LOGGED_IN"
|
/// Errors.
|
||||||
|
///
|
||||||
|
#define NOT_LOGGED_IN "NOT_LOGGED_IN" // Error when user needs to login before making an operation.
|
||||||
|
#define UNKNOWN_METHOD "UNKNOWN_METHOD" // Given "op" is not recognized.
|
||||||
|
#define INCORRECT_USAGE "INCORRECT_USAGE" // Given "op" was used with bad parameters.
|
||||||
|
|
||||||
// General return status codes.
|
// General return status codes.
|
||||||
#define API_STATUS_OK 0
|
#define API_STATUS_OK 0
|
||||||
|
@ -19,21 +23,4 @@
|
||||||
// Logout.
|
// Logout.
|
||||||
#define LOGOUT_OK "OK"
|
#define LOGOUT_OK "OK"
|
||||||
|
|
||||||
|
|
||||||
/* //login
|
|
||||||
* QtJson::JsonObject obj;
|
|
||||||
obj["op"] = "login";
|
|
||||||
obj["user"] = "admin";
|
|
||||||
obj["password"] = "Zy69tKWF";
|
|
||||||
|
|
||||||
QByteArray arr;
|
|
||||||
NetworkResult res = NetworkFactory::uploadData("http://rss.rotterovi.eu/api/",
|
|
||||||
15000,
|
|
||||||
QtJson::serialize(obj),
|
|
||||||
"application/json; charset=utf-8",
|
|
||||||
arr);
|
|
||||||
|
|
||||||
obj = QtJson::parse(QString::fromUtf8(arr)).toMap();*/
|
|
||||||
|
|
||||||
#endif // DEFINITIONS_H
|
#endif // DEFINITIONS_H
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#include "network-web/networkfactory.h"
|
#include "network-web/networkfactory.h"
|
||||||
|
|
||||||
|
|
||||||
TtRssNetworkFactory::TtRssNetworkFactory() : m_url(QString()) {
|
TtRssNetworkFactory::TtRssNetworkFactory()
|
||||||
|
: m_url(QString()), m_username(QString()), m_password(QString()), m_session_Id(QString()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TtRssNetworkFactory::~TtRssNetworkFactory() {
|
TtRssNetworkFactory::~TtRssNetworkFactory() {
|
||||||
|
@ -65,7 +66,9 @@ LoginResult TtRssNetworkFactory::login() {
|
||||||
return LoginResult(res.first, TtRssLoginResponse());
|
return LoginResult(res.first, TtRssLoginResponse());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return LoginResult(res.first, TtRssLoginResponse(QString::fromUtf8(result)));
|
LoginResult result(res.first, TtRssLoginResponse(QString::fromUtf8(result)));
|
||||||
|
m_session_Id = result.second.sessionId();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ class TtRssNetworkFactory {
|
||||||
QString m_url;
|
QString m_url;
|
||||||
QString m_username;
|
QString m_username;
|
||||||
QString m_password;
|
QString m_password;
|
||||||
|
QString m_session_Id;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TTRSSNETWORKFACTORY_H
|
#endif // TTRSSNETWORKFACTORY_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue