зеркало из https://github.com/nextcloud/desktop.git
Implemented account removal
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
This commit is contained in:
Родитель
a021f62e96
Коммит
3da982f073
|
@ -113,6 +113,9 @@ MenuItem {
|
|||
|
||||
MenuItem {
|
||||
text: "Remove Account"
|
||||
onClicked: {
|
||||
userModelBackend.removeAccount(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,10 +109,15 @@ bool User::isCurrentUser() const
|
|||
|
||||
bool User::isConnected() const
|
||||
{
|
||||
bool test = (_account->connectionStatus() == AccountState::ConnectionStatus::Connected);
|
||||
return (_account->connectionStatus() == AccountState::ConnectionStatus::Connected);
|
||||
}
|
||||
|
||||
void User::removeAccount() const
|
||||
{
|
||||
AccountManager::instance()->deleteAccount(_account.data());
|
||||
AccountManager::instance()->save();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------*/
|
||||
|
||||
UserModel *UserModel::_instance = nullptr;
|
||||
|
@ -239,6 +244,11 @@ Q_INVOKABLE void UserModel::logout(const int &id)
|
|||
Q_INVOKABLE void UserModel::removeAccount(const int &id)
|
||||
{
|
||||
_users[id].logout();
|
||||
_users[id].removeAccount();
|
||||
if (_users.count() > 1) {
|
||||
id == 0 ? switchCurrentUser(1) : switchCurrentUser(0);
|
||||
}
|
||||
_users.removeAt(id);
|
||||
}
|
||||
|
||||
int UserModel::rowCount(const QModelIndex &parent) const
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
QString id() const;
|
||||
void login() const;
|
||||
void logout() const;
|
||||
void removeAccount() const;
|
||||
|
||||
private:
|
||||
AccountStatePtr _account;
|
||||
|
|
Загрузка…
Ссылка в новой задаче