Commit 101f310c authored by Stepan Salenikovich's avatar Stepan Salenikovich Committed by Guillaume Roguez

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
parent 16cc8bd1
...@@ -192,8 +192,11 @@ account_active_toggled(GtkCellRendererToggle *renderer, gchar *path, AccountView ...@@ -192,8 +192,11 @@ account_active_toggled(GtkCellRendererToggle *renderer, gchar *path, AccountView
if (idx.isValid()) { if (idx.isValid()) {
/* check if it is the IP2IP account, as we don't want to be able to disable it */ /* 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)); 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); 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);
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment