Generalized connection check, now working for every user in account menu

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
This commit is contained in:
Dominique Fuchs 2020-01-12 08:50:13 +01:00
parent 578a3b4ef4
commit bc8f64bb98
3 changed files with 5 additions and 5 deletions

View File

@ -105,9 +105,9 @@ MenuItem {
}
MenuItem {
text: userModelBackend.isCurrentUserConnected() ? "Log out" : "Log in"
text: userModelBackend.isUserConnected(index) ? "Log out" : "Log in"
onClicked: {
userModelBackend.isCurrentUserConnected() ? userModelBackend.logout(index) : userModelBackend.logout(index)
userModelBackend.isUserConnected(index) ? userModelBackend.logout(index) : userModelBackend.logout(index)
}
}

View File

@ -163,9 +163,9 @@ Q_INVOKABLE int UserModel::numUsers()
return _users.size();
}
Q_INVOKABLE bool UserModel::isCurrentUserConnected()
Q_INVOKABLE bool UserModel::isUserConnected(const int &id)
{
return _users[_currentUserId].isConnected();
return _users[id].isConnected();
}
Q_INVOKABLE QImage UserModel::currentUserAvatar()

View File

@ -62,11 +62,11 @@ public:
Q_INVOKABLE void openCurrentAccountServer();
Q_INVOKABLE QImage currentUserAvatar();
Q_INVOKABLE int numUsers();
Q_INVOKABLE bool isCurrentUserConnected();
Q_INVOKABLE QString currentUserName();
Q_INVOKABLE QString currentUserServer();
Q_INVOKABLE bool currentUserHasActivities();
Q_INVOKABLE bool currentServerHasTalk();
Q_INVOKABLE bool isUserConnected(const int &id);
Q_INVOKABLE void switchCurrentUser(const int &id);
Q_INVOKABLE void login(const int &id);
Q_INVOKABLE void logout(const int &id);