Some tiny cleanups before 3.0.2.
This commit is contained in:
parent
04d2b1392d
commit
4ccbcbe394
9 changed files with 14 additions and 20 deletions
|
@ -98,8 +98,6 @@ QList<Message> RecycleBin::undeletedMessages() const {
|
|||
"WHERE is_deleted = 1 AND is_pdeleted = 0 AND account_id = :account_id;");
|
||||
query_read_msg.bindValue(QSL(":account_id"), account_id);
|
||||
|
||||
// FIXME: Fix those const functions, this is fucking ugly.
|
||||
|
||||
if (query_read_msg.exec()) {
|
||||
while (query_read_msg.next()) {
|
||||
bool decoded;
|
||||
|
|
|
@ -54,8 +54,8 @@ StandardCategory::~StandardCategory() {
|
|||
qDebug("Destroying Category instance.");
|
||||
}
|
||||
|
||||
StandardServiceRoot *StandardCategory::serviceRoot() {
|
||||
return static_cast<StandardServiceRoot*>(getParentServiceRoot());
|
||||
StandardServiceRoot *StandardCategory::serviceRoot() const {
|
||||
return qobject_cast<StandardServiceRoot*>(getParentServiceRoot());
|
||||
}
|
||||
|
||||
QVariant StandardCategory::data(int column, int role) const {
|
||||
|
|
|
@ -40,7 +40,7 @@ class StandardCategory : public Category {
|
|||
explicit StandardCategory(const QSqlRecord &record);
|
||||
virtual ~StandardCategory();
|
||||
|
||||
StandardServiceRoot *serviceRoot();
|
||||
StandardServiceRoot *serviceRoot() const;
|
||||
|
||||
// Returns the actual data representation of standard category.
|
||||
QVariant data(int column, int role) const;
|
||||
|
|
|
@ -98,8 +98,8 @@ QList<QAction*> StandardFeed::contextMenu() {
|
|||
return serviceRoot()->getContextMenuForFeed(this);
|
||||
}
|
||||
|
||||
StandardServiceRoot *StandardFeed::serviceRoot() {
|
||||
return static_cast<StandardServiceRoot*>(getParentServiceRoot());
|
||||
StandardServiceRoot *StandardFeed::serviceRoot() const {
|
||||
return qobject_cast<StandardServiceRoot*>(getParentServiceRoot());
|
||||
}
|
||||
|
||||
bool StandardFeed::editViaGui() {
|
||||
|
@ -138,9 +138,7 @@ QList<Message> StandardFeed::undeletedMessages() const {
|
|||
"WHERE is_deleted = 0 AND feed = :feed AND account_id = :account_id;");
|
||||
|
||||
query_read_msg.bindValue(QSL(":feed"), id());
|
||||
query_read_msg.bindValue(QSL(":account_id"), const_cast<StandardFeed*>(this)->serviceRoot()->accountId());
|
||||
|
||||
// FIXME: Fix those const functions, this is fucking ugly.
|
||||
query_read_msg.bindValue(QSL(":account_id"), serviceRoot()->accountId());
|
||||
|
||||
if (query_read_msg.exec()) {
|
||||
while (query_read_msg.next()) {
|
||||
|
|
|
@ -53,7 +53,7 @@ class StandardFeed : public Feed {
|
|||
explicit StandardFeed(const QSqlRecord &record);
|
||||
virtual ~StandardFeed();
|
||||
|
||||
StandardServiceRoot *serviceRoot();
|
||||
StandardServiceRoot *serviceRoot() const;
|
||||
|
||||
// Getters/setters for count of messages.
|
||||
// NOTE: For feeds, counts are stored internally
|
||||
|
|
|
@ -44,11 +44,11 @@ TtRssCategory::~TtRssCategory() {
|
|||
QString TtRssCategory::hashCode() const {
|
||||
return
|
||||
QString::number(kind()) + QL1S("-") +
|
||||
QString::number(const_cast<TtRssCategory*>(this)->getParentServiceRoot()->accountId()) + QL1S("-") +
|
||||
QString::number(getParentServiceRoot()->accountId()) + QL1S("-") +
|
||||
QString::number(customId());
|
||||
}
|
||||
|
||||
TtRssServiceRoot *TtRssCategory::serviceRoot() {
|
||||
TtRssServiceRoot *TtRssCategory::serviceRoot() const {
|
||||
return qobject_cast<TtRssServiceRoot*>(getParentServiceRoot());
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class TtRssCategory : public Category {
|
|||
|
||||
QString hashCode() const;
|
||||
|
||||
TtRssServiceRoot *serviceRoot();
|
||||
TtRssServiceRoot *serviceRoot() const;
|
||||
|
||||
bool markAsReadUnread(ReadStatus status);
|
||||
bool cleanMessages(bool clear_only_read);
|
||||
|
|
|
@ -53,11 +53,11 @@ TtRssFeed::~TtRssFeed() {
|
|||
QString TtRssFeed::hashCode() const {
|
||||
return
|
||||
QString::number(kind()) + QL1S("-") +
|
||||
QString::number(const_cast<TtRssFeed*>(this)->getParentServiceRoot()->accountId()) + QL1S("-") +
|
||||
QString::number(getParentServiceRoot()->accountId()) + QL1S("-") +
|
||||
QString::number(customId());
|
||||
}
|
||||
|
||||
TtRssServiceRoot *TtRssFeed::serviceRoot() {
|
||||
TtRssServiceRoot *TtRssFeed::serviceRoot() const {
|
||||
return qobject_cast<TtRssServiceRoot*>(getParentServiceRoot());
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ int TtRssFeed::update() {
|
|||
|
||||
QList<Message> TtRssFeed::undeletedMessages() const {
|
||||
QList<Message> messages;
|
||||
int account_id = const_cast<TtRssFeed*>(this)->serviceRoot()->accountId();
|
||||
int account_id = serviceRoot()->accountId();
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_read_msg(database);
|
||||
|
||||
|
@ -200,8 +200,6 @@ QList<Message> TtRssFeed::undeletedMessages() const {
|
|||
query_read_msg.bindValue(QSL(":feed"), customId());
|
||||
query_read_msg.bindValue(QSL(":account_id"), account_id);
|
||||
|
||||
// FIXME: Fix those const functions, this is fucking ugly.
|
||||
|
||||
if (query_read_msg.exec()) {
|
||||
while (query_read_msg.next()) {
|
||||
bool decoded;
|
||||
|
|
|
@ -35,7 +35,7 @@ class TtRssFeed : public Feed {
|
|||
|
||||
QString hashCode() const;
|
||||
|
||||
TtRssServiceRoot *serviceRoot();
|
||||
TtRssServiceRoot *serviceRoot() const;
|
||||
|
||||
QVariant data(int column, int role) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue