Refactoring.

This commit is contained in:
Martin Rotter 2016-05-03 08:57:56 +02:00
parent e1742d82e1
commit 9a0e17814e
3 changed files with 17 additions and 11 deletions

View file

@ -59,10 +59,7 @@ bool OwnCloudFeed::canBeDeleted() const {
}
bool OwnCloudFeed::deleteViaGui() {
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
if (serviceRoot()->network()->deleteFeed(customId()) &&
DatabaseQueries::deleteFeed(database, customId(), serviceRoot()->accountId())) {
if (removeItself()) {
serviceRoot()->requestItemRemoval(this);
return true;
}
@ -86,6 +83,14 @@ bool OwnCloudFeed::editItself(OwnCloudFeed *new_feed_data) {
}
}
bool OwnCloudFeed::removeItself() {
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
return
serviceRoot()->network()->deleteFeed(customId()) &&
DatabaseQueries::deleteFeed(database, customId(), serviceRoot()->accountId());
}
bool OwnCloudFeed::markAsReadUnread(RootItem::ReadStatus status) {
QStringList ids = getParentServiceRoot()->customIDSOfMessagesForItem(this);
QNetworkReply::NetworkError response = serviceRoot()->network()->markMessagesRead(status, ids);

View file

@ -37,6 +37,7 @@ class OwnCloudFeed : public Feed {
bool deleteViaGui();
bool editItself(OwnCloudFeed *new_feed_data);
bool removeItself();
bool markAsReadUnread(ReadStatus status);
bool cleanMessages(bool clear_only_read);