Work on feeds & database.
This commit is contained in:
parent
09f3dbf6dc
commit
d1814c8d10
@ -72,6 +72,9 @@ QSqlDatabase DatabaseFactory::initialize(const QString &connection_name) {
|
|||||||
qPrintable(database.lastError().text()));
|
qPrintable(database.lastError().text()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// TODO: smazat QSQLDatabase::exec() všude
|
||||||
|
// a nahradit jej funkcí QSQLquery::exec()
|
||||||
|
|
||||||
database.exec("PRAGMA encoding = \"UTF-8\"");
|
database.exec("PRAGMA encoding = \"UTF-8\"");
|
||||||
database.exec("PRAGMA synchronous = OFF");
|
database.exec("PRAGMA synchronous = OFF");
|
||||||
database.exec("PRAGMA journal_mode = MEMORY");
|
database.exec("PRAGMA journal_mode = MEMORY");
|
||||||
|
@ -23,6 +23,9 @@ class FeedsModelCategory : public FeedsModelRootItem {
|
|||||||
explicit FeedsModelCategory(FeedsModelRootItem *parent_item = NULL);
|
explicit FeedsModelCategory(FeedsModelRootItem *parent_item = NULL);
|
||||||
virtual ~FeedsModelCategory();
|
virtual ~FeedsModelCategory();
|
||||||
|
|
||||||
|
// Counts of messages.
|
||||||
|
// NOTE: Counts of messages in categories include
|
||||||
|
// counts of messages from all children.
|
||||||
int countOfAllMessages() const;
|
int countOfAllMessages() const;
|
||||||
int countOfUnreadMessages() const;
|
int countOfUnreadMessages() const;
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ class FeedsModelFeed : public FeedsModelRootItem {
|
|||||||
int childCount() const;
|
int childCount() const;
|
||||||
|
|
||||||
// Getters/setters for count of messages.
|
// Getters/setters for count of messages.
|
||||||
|
// NOTE: For feeds, counts are stored internally
|
||||||
|
// and can be updated from the database.
|
||||||
int countOfAllMessages() const;
|
int countOfAllMessages() const;
|
||||||
int countOfUnreadMessages() const;
|
int countOfUnreadMessages() const;
|
||||||
|
|
||||||
|
@ -18,11 +18,13 @@ class FeedsModelStandardCategory : public FeedsModelCategory {
|
|||||||
explicit FeedsModelStandardCategory(FeedsModelRootItem *parent_item = NULL);
|
explicit FeedsModelStandardCategory(FeedsModelRootItem *parent_item = NULL);
|
||||||
virtual ~FeedsModelStandardCategory();
|
virtual ~FeedsModelStandardCategory();
|
||||||
|
|
||||||
|
// Returns the actual data representation of standard category.
|
||||||
QVariant data(int column, int role) const;
|
QVariant data(int column, int role) const;
|
||||||
|
|
||||||
// Performs update on all children of this category.
|
// Performs update on all children of this category.
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
// Loads particular "standard category" from given sql record.
|
||||||
static FeedsModelStandardCategory *loadFromRecord(const QSqlRecord &record);
|
static FeedsModelStandardCategory *loadFromRecord(const QSqlRecord &record);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user