Work on feeds & database.

This commit is contained in:
Martin Rotter 2013-12-15 21:32:02 +01:00
parent 09f3dbf6dc
commit d1814c8d10
4 changed files with 10 additions and 0 deletions

View File

@ -72,6 +72,9 @@ QSqlDatabase DatabaseFactory::initialize(const QString &connection_name) {
qPrintable(database.lastError().text()));
}
else {
// TODO: smazat QSQLDatabase::exec() všude
// a nahradit jej funkcí QSQLquery::exec()
database.exec("PRAGMA encoding = \"UTF-8\"");
database.exec("PRAGMA synchronous = OFF");
database.exec("PRAGMA journal_mode = MEMORY");

View File

@ -23,6 +23,9 @@ class FeedsModelCategory : public FeedsModelRootItem {
explicit FeedsModelCategory(FeedsModelRootItem *parent_item = NULL);
virtual ~FeedsModelCategory();
// Counts of messages.
// NOTE: Counts of messages in categories include
// counts of messages from all children.
int countOfAllMessages() const;
int countOfUnreadMessages() const;

View File

@ -24,6 +24,8 @@ class FeedsModelFeed : public FeedsModelRootItem {
int childCount() const;
// Getters/setters for count of messages.
// NOTE: For feeds, counts are stored internally
// and can be updated from the database.
int countOfAllMessages() const;
int countOfUnreadMessages() const;

View File

@ -18,11 +18,13 @@ class FeedsModelStandardCategory : public FeedsModelCategory {
explicit FeedsModelStandardCategory(FeedsModelRootItem *parent_item = NULL);
virtual ~FeedsModelStandardCategory();
// Returns the actual data representation of standard category.
QVariant data(int column, int role) const;
// Performs update on all children of this category.
void update();
// Loads particular "standard category" from given sql record.
static FeedsModelStandardCategory *loadFromRecord(const QSqlRecord &record);
};