Some more advancements, stored TT-RSS accounts are now correctly loaded w/o feeds/categories so far.
This commit is contained in:
parent
441e0e8632
commit
4f2a370901
@ -81,7 +81,7 @@ void MessagesModel::loadMessages(RootItem *item) {
|
|||||||
if (!item->getParentServiceRoot()->loadMessagesForItem(item, this)) {
|
if (!item->getParentServiceRoot()->loadMessagesForItem(item, this)) {
|
||||||
setFilter("true != true");
|
setFilter("true != true");
|
||||||
qWarning("Loading of messages from item '%s' failed.", qPrintable(item->title()));
|
qWarning("Loading of messages from item '%s' failed.", qPrintable(item->title()));
|
||||||
qApp->showGuiMessage(tr("Loading of messages from item '%s' failed.").arg(item->title()),
|
qApp->showGuiMessage(tr("Loading of messages from item '%1' failed.").arg(item->title()),
|
||||||
tr("Loading of messages failed, maybe messages could not be downloaded."),
|
tr("Loading of messages failed, maybe messages could not be downloaded."),
|
||||||
QSystemTrayIcon::Critical,
|
QSystemTrayIcon::Critical,
|
||||||
qApp->mainForm(),
|
qApp->mainForm(),
|
||||||
|
@ -23,8 +23,10 @@
|
|||||||
#include "gui/dialogs/formmain.h"
|
#include "gui/dialogs/formmain.h"
|
||||||
#include "services/tt-rss/gui/formeditaccount.h"
|
#include "services/tt-rss/gui/formeditaccount.h"
|
||||||
#include "services/tt-rss/ttrssserviceroot.h"
|
#include "services/tt-rss/ttrssserviceroot.h"
|
||||||
|
#include "services/tt-rss/network/ttrssnetworkfactory.h"
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QSqlQuery>
|
||||||
|
|
||||||
|
|
||||||
TtRssServiceEntryPoint::TtRssServiceEntryPoint(){
|
TtRssServiceEntryPoint::TtRssServiceEntryPoint(){
|
||||||
@ -72,5 +74,23 @@ ServiceRoot *TtRssServiceEntryPoint::createNewRoot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<ServiceRoot*> TtRssServiceEntryPoint::initializeSubtree() {
|
QList<ServiceRoot*> TtRssServiceEntryPoint::initializeSubtree() {
|
||||||
return QList<ServiceRoot*>();
|
// Check DB if standard account is enabled.
|
||||||
|
QSqlDatabase database = qApp->database()->connection(QSL("TtRssServiceEntryPoint"), DatabaseFactory::FromSettings);
|
||||||
|
QSqlQuery query(database);
|
||||||
|
QList<ServiceRoot*> roots;
|
||||||
|
|
||||||
|
if (query.exec("SELECT id, username, password, url FROM TtRssAccounts;")) {
|
||||||
|
while (query.next()) {
|
||||||
|
TtRssServiceRoot *root = new TtRssServiceRoot();
|
||||||
|
root->setAccountId(query.value(0).toInt());
|
||||||
|
root->network()->setUsername(query.value(1).toString());
|
||||||
|
root->network()->setPassword(query.value(2).toString());
|
||||||
|
root->network()->setUrl(query.value(3).toString());
|
||||||
|
root->updateTitle();
|
||||||
|
root->loadFromDatabase();
|
||||||
|
roots.append(root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return roots;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ void TtRssServiceRoot::saveToDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TtRssServiceRoot::loadFromDatabase() {
|
void TtRssServiceRoot::loadFromDatabase() {
|
||||||
// Account ID is set, load connection data from DB.
|
// TODO: Load feeds/categories from DB.
|
||||||
}
|
}
|
||||||
|
|
||||||
void TtRssServiceRoot::updateTitle() {
|
void TtRssServiceRoot::updateTitle() {
|
||||||
|
@ -67,10 +67,9 @@ class TtRssServiceRoot : public ServiceRoot {
|
|||||||
|
|
||||||
void saveToDatabase();
|
void saveToDatabase();
|
||||||
void loadFromDatabase();
|
void loadFromDatabase();
|
||||||
|
|
||||||
private:
|
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
|
private:
|
||||||
TtRssNetworkFactory *m_network;
|
TtRssNetworkFactory *m_network;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user