Some cosmetic fixes.
This commit is contained in:
parent
900793d0b1
commit
41c239ff03
@ -25,6 +25,7 @@
|
||||
|
||||
class FeedsModelFeed;
|
||||
|
||||
// Represents results of batch feed updates.
|
||||
struct FeedDownloadResults {
|
||||
explicit FeedDownloadResults() : m_updatedFeeds(QList<QPair<QString,int> >()) {
|
||||
}
|
||||
@ -35,13 +36,11 @@ struct FeedDownloadResults {
|
||||
return lhs.second > rhs.second;
|
||||
}
|
||||
|
||||
// QString represents title if the feed, int represents
|
||||
// count of newly downloaded messages.
|
||||
// QString represents title if the feed, int represents count of newly downloaded messages.
|
||||
QList<QPair<QString,int> > m_updatedFeeds;
|
||||
};
|
||||
|
||||
// This class offers means to "update" feeds
|
||||
// and "special" categories.
|
||||
// This class offers means to "update" feeds and "special" categories.
|
||||
// NOTE: This class is used within separate thread.
|
||||
class FeedDownloader : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -121,28 +121,28 @@ QVariant FeedsModelCategory::data(int column, int role) const {
|
||||
}
|
||||
|
||||
bool FeedsModelCategory::removeItself() {
|
||||
bool result = true;
|
||||
bool children_removed = true;
|
||||
|
||||
// Remove all child items (feeds, categories.)
|
||||
foreach (FeedsModelRootItem *child, m_childItems) {
|
||||
result &= child->removeItself();
|
||||
children_removed &= child->removeItself();
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
return result;
|
||||
if (children_removed) {
|
||||
// Children are removed, remove this standard category too.
|
||||
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelCategory"), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_remove(database);
|
||||
|
||||
// Remove this category from database.
|
||||
query_remove.setForwardOnly(true);
|
||||
query_remove.prepare(QSL("DELETE FROM Categories WHERE id = :category;"));
|
||||
query_remove.bindValue(QSL(":category"), id());
|
||||
|
||||
return query_remove.exec();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Children are removed, remove this standard category too.
|
||||
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelCategory"), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_remove(database);
|
||||
|
||||
query_remove.setForwardOnly(true);
|
||||
|
||||
// Remove all messages from this standard feed.
|
||||
query_remove.prepare(QSL("DELETE FROM Categories WHERE id = :category;"));
|
||||
query_remove.bindValue(QSL(":category"), id());
|
||||
|
||||
return query_remove.exec();
|
||||
}
|
||||
|
||||
FeedsModelCategory::FeedsModelCategory(const QSqlRecord &record) : FeedsModelRootItem(NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user