Refactoring.
This commit is contained in:
parent
e1742d82e1
commit
9a0e17814e
3 changed files with 17 additions and 11 deletions
|
@ -59,10 +59,7 @@ bool OwnCloudFeed::canBeDeleted() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OwnCloudFeed::deleteViaGui() {
|
bool OwnCloudFeed::deleteViaGui() {
|
||||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
if (removeItself()) {
|
||||||
|
|
||||||
if (serviceRoot()->network()->deleteFeed(customId()) &&
|
|
||||||
DatabaseQueries::deleteFeed(database, customId(), serviceRoot()->accountId())) {
|
|
||||||
serviceRoot()->requestItemRemoval(this);
|
serviceRoot()->requestItemRemoval(this);
|
||||||
return true;
|
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) {
|
bool OwnCloudFeed::markAsReadUnread(RootItem::ReadStatus status) {
|
||||||
QStringList ids = getParentServiceRoot()->customIDSOfMessagesForItem(this);
|
QStringList ids = getParentServiceRoot()->customIDSOfMessagesForItem(this);
|
||||||
QNetworkReply::NetworkError response = serviceRoot()->network()->markMessagesRead(status, ids);
|
QNetworkReply::NetworkError response = serviceRoot()->network()->markMessagesRead(status, ids);
|
||||||
|
|
|
@ -37,6 +37,7 @@ class OwnCloudFeed : public Feed {
|
||||||
bool deleteViaGui();
|
bool deleteViaGui();
|
||||||
|
|
||||||
bool editItself(OwnCloudFeed *new_feed_data);
|
bool editItself(OwnCloudFeed *new_feed_data);
|
||||||
|
bool removeItself();
|
||||||
|
|
||||||
bool markAsReadUnread(ReadStatus status);
|
bool markAsReadUnread(ReadStatus status);
|
||||||
bool cleanMessages(bool clear_only_read);
|
bool cleanMessages(bool clear_only_read);
|
||||||
|
|
Loading…
Add table
Reference in a new issue