gnome: save account immediately when toggling state
When toggling the account enabled checkbox in the account
settings, the change in state is applied immediately by
saving the account.
Refs #71834
Change-Id: Iebe9afd43e318bf5f94f2f90997fc0215a71719a
diff --git a/src/accountview.cpp b/src/accountview.cpp
index 95565f8..715b2e8 100644
--- a/src/accountview.cpp
+++ b/src/accountview.cpp
@@ -192,8 +192,11 @@
if (idx.isValid()) {
/* check if it is the IP2IP account, as we don't want to be able to disable it */
QVariant alias = idx.data(static_cast<int>(Account::Role::Alias));
- if (strcmp(alias.value<QString>().toLocal8Bit().constData(), "IP2IP") != 0)
+ if (strcmp(alias.value<QString>().toLocal8Bit().constData(), "IP2IP") != 0) {
AccountModel::instance()->setData(idx, QVariant(toggle), Qt::CheckStateRole);
+ /* save the account to apply the changed state right away */
+ AccountModel::instance()->getAccountByModelIndex(idx)->performAction(Account::EditAction::SAVE);
+ }
}
}