Last edits today.
This commit is contained in:
parent
f7b818cae3
commit
1178787bc1
2 changed files with 33 additions and 1 deletions
|
@ -106,9 +106,39 @@ bool StandardServiceRoot::canBeEdited() {
|
|||
}
|
||||
|
||||
bool StandardServiceRoot::canBeDeleted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StandardServiceRoot::deleteViaGui() {
|
||||
QSqlDatabase connection = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
|
||||
// Remove all messages.
|
||||
if (!QSqlQuery(connection).exec(QSL("DELETE FROM Messages;"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove all feeds.
|
||||
if (!QSqlQuery(connection).exec(QSL("DELETE FROM Feeds;"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove all categories.
|
||||
if (!QSqlQuery(connection).exec(QSL("DELETE FROM Categories;"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Switch "existence" flag.
|
||||
bool data_removed = QSqlQuery(connection).exec(QSL("UPDATE Information SET inf_value = 0 WHERE inf_key = 'standard_account_enabled';"));
|
||||
|
||||
// TODO: pokračovat
|
||||
|
||||
if (data_removed) {
|
||||
feedsModel()->removeItem(this);
|
||||
}
|
||||
|
||||
return data_removed;
|
||||
}
|
||||
|
||||
QVariant StandardServiceRoot::data(int column, int role) const {
|
||||
switch (role) {
|
||||
case Qt::ToolTipRole:
|
||||
|
|
|
@ -49,6 +49,8 @@ class StandardServiceRoot : public ServiceRoot {
|
|||
|
||||
bool canBeEdited();
|
||||
bool canBeDeleted();
|
||||
bool deleteViaGui();
|
||||
|
||||
QVariant data(int column, int role) const;
|
||||
Qt::ItemFlags additionalFlags() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue