Fixed expanding when importing, newer readme.
This commit is contained in:
parent
11dfe67b4a
commit
04028ef6bb
@ -66,6 +66,8 @@ RSS Guard is simple (yet powerful) feed reader. It is able to fetch the most kno
|
||||
|
||||
RSS Guard is written in C++. It is pretty fast even with tons of messages loaded. The core features are:
|
||||
|
||||
* support for online feed synchronization via plugins,
|
||||
* Tiny Tiny RSS (from RSS Guard 3.0.0).
|
||||
* multiplatformity,
|
||||
* support for all feed formats,
|
||||
* simplicity,
|
||||
|
@ -80,6 +80,8 @@ FormMain::FormMain(QWidget *parent, Qt::WindowFlags f)
|
||||
setupIcons();
|
||||
loadSize();
|
||||
|
||||
statusBar()->setVisible(false);
|
||||
|
||||
// Initialize the web factory.
|
||||
WebFactory::instance()->loadState();
|
||||
}
|
||||
|
@ -233,6 +233,7 @@ void FormStandardImportExport::importFeeds() {
|
||||
QString output_message;
|
||||
|
||||
if (m_serviceRoot->mergeImportExportModel(m_model, output_message)) {
|
||||
m_serviceRoot->requestItemExpand(m_serviceRoot->getSubTree(), true);
|
||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Ok, output_message, output_message);
|
||||
}
|
||||
else {
|
||||
|
@ -85,7 +85,10 @@ void StandardServiceRoot::start() {
|
||||
try {
|
||||
model.importAsOPML20(IOFactory::readTextFile(file_to_load));
|
||||
model.checkAllItems();
|
||||
mergeImportExportModel(&model, output_msg);
|
||||
|
||||
if (mergeImportExportModel(&model, output_msg)) {
|
||||
requestItemExpand(getSubTree(), true);
|
||||
}
|
||||
}
|
||||
catch (ApplicationException &ex) {
|
||||
MessageBox::show(qApp->mainForm(), QMessageBox::Critical, tr("Error when loading initial feeds"), ex.message());
|
||||
|
46
src/services/tt-rss/ttrssfeed.cpp
Normal file → Executable file
46
src/services/tt-rss/ttrssfeed.cpp
Normal file → Executable file
@ -18,14 +18,58 @@
|
||||
#include "services/tt-rss/ttrssfeed.h"
|
||||
|
||||
#include "definitions/definitions.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/databasefactory.h"
|
||||
#include "services/tt-rss/ttrssserviceroot.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
|
||||
TtRssFeed::TtRssFeed(RootItem *parent) : Feed(parent), m_customId(NO_PARENT_CATEGORY) {
|
||||
TtRssFeed::TtRssFeed(RootItem *parent)
|
||||
: Feed(parent), m_customId(NO_PARENT_CATEGORY), m_totalCount(0), m_unreadCount(0) {
|
||||
}
|
||||
|
||||
TtRssFeed::~TtRssFeed() {
|
||||
}
|
||||
|
||||
TtRssServiceRoot *TtRssFeed::serviceRoot() {
|
||||
return qobject_cast<TtRssServiceRoot*>(getParentServiceRoot());
|
||||
}
|
||||
|
||||
void TtRssFeed::updateCounts(bool including_total_count) {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_all(database);
|
||||
|
||||
query_all.setForwardOnly(true);
|
||||
|
||||
if (including_total_count) {
|
||||
if (query_all.exec(QString("SELECT count(*) FROM Messages WHERE feed = '%1' AND is_deleted = 0 AND account_id = %2;").arg(QString::number(customId()),
|
||||
QString::number(serviceRoot()->accountId()))) && query_all.next()) {
|
||||
m_totalCount = query_all.value(0).toInt();
|
||||
}
|
||||
}
|
||||
|
||||
// Obtain count of unread messages.
|
||||
if (query_all.exec(QString("SELECT count(*) FROM Messages WHERE feed = '%1' AND is_deleted = 0 AND is_read = 0 AND account_id = %2;").arg(QString::number(customId()),
|
||||
QString::number(serviceRoot()->accountId()))) && query_all.next()) {
|
||||
int new_unread_count = query_all.value(0).toInt();
|
||||
|
||||
if (status() == NewMessages && new_unread_count < m_unreadCount) {
|
||||
setStatus(Normal);
|
||||
}
|
||||
|
||||
m_unreadCount = new_unread_count;
|
||||
}
|
||||
}
|
||||
|
||||
int TtRssFeed::countOfAllMessages() {
|
||||
return m_totalCount;
|
||||
}
|
||||
|
||||
int TtRssFeed::countOfUnreadMessages() {
|
||||
return m_unreadCount;
|
||||
}
|
||||
|
||||
int TtRssFeed::update() {
|
||||
return 0;
|
||||
}
|
||||
|
11
src/services/tt-rss/ttrssfeed.h
Normal file → Executable file
11
src/services/tt-rss/ttrssfeed.h
Normal file → Executable file
@ -21,11 +21,20 @@
|
||||
#include "services/abstract/feed.h"
|
||||
|
||||
|
||||
class TtRssServiceRoot;
|
||||
|
||||
class TtRssFeed : public Feed {
|
||||
public:
|
||||
explicit TtRssFeed(RootItem *parent = NULL);
|
||||
virtual ~TtRssFeed();
|
||||
|
||||
TtRssServiceRoot *serviceRoot();
|
||||
|
||||
void updateCounts(bool including_total_count);
|
||||
|
||||
int countOfAllMessages();
|
||||
int countOfUnreadMessages();
|
||||
|
||||
int update();
|
||||
QList<Message> undeletedMessages() const;
|
||||
|
||||
@ -34,6 +43,8 @@ class TtRssFeed : public Feed {
|
||||
|
||||
private:
|
||||
int m_customId;
|
||||
int m_totalCount;
|
||||
int m_unreadCount;
|
||||
};
|
||||
|
||||
#endif // TTRSSFEED_H
|
||||
|
@ -254,8 +254,11 @@ void TtRssServiceRoot::syncIn() {
|
||||
appendChild(top_level_item);
|
||||
}
|
||||
|
||||
updateCounts(true);
|
||||
|
||||
new_tree->clearChildren();
|
||||
new_tree->deleteLater();
|
||||
|
||||
itemChanged(QList<RootItem*>() << this);
|
||||
requestFeedReadFilterReload();
|
||||
requestReloadMessageList(true);
|
||||
@ -322,8 +325,6 @@ void TtRssServiceRoot::storeNewFeedTree(RootItem *root) {
|
||||
|
||||
if (query_feed.exec()) {
|
||||
feed->setId(query_feed.lastInsertId().toInt());
|
||||
|
||||
// TODO: updatecounts;
|
||||
}
|
||||
else {
|
||||
// TODO: logovat.
|
||||
|
Loading…
x
Reference in New Issue
Block a user