Take ints by value rather than reference in UserModel methods
authorClaudio Cambra <claudio.cambra@gmail.com>
Fri, 8 Jul 2022 15:44:50 +0000 (17:44 +0200)
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>
Fri, 15 Jul 2022 13:01:48 +0000 (15:01 +0200)
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
src/gui/tray/usermodel.cpp
src/gui/tray/usermodel.h

index 782de47a1b81aebd689dddfb46a92b50dca2413d..566d93cd075970d6c06a83032888d0f042b524dc 100644 (file)
@@ -905,7 +905,7 @@ Q_INVOKABLE int UserModel::currentUserId() const
     return _currentUserId;
 }
 
-Q_INVOKABLE bool UserModel::isUserConnected(const int &id)
+Q_INVOKABLE bool UserModel::isUserConnected(const int id)
 {
     if (id < 0 || id >= _users.size())
         return false;
@@ -913,7 +913,7 @@ Q_INVOKABLE bool UserModel::isUserConnected(const int &id)
     return _users[id]->isConnected();
 }
 
-QImage UserModel::avatarById(const int &id)
+QImage UserModel::avatarById(const int id)
 {
     if (id < 0 || id >= _users.size())
         return {};
@@ -1014,7 +1014,7 @@ Q_INVOKABLE void UserModel::openCurrentAccountServer()
     QDesktopServices::openUrl(url);
 }
 
-Q_INVOKABLE void UserModel::switchCurrentUser(const int &id)
+Q_INVOKABLE void UserModel::switchCurrentUser(const int id)
 {
     if (_currentUserId < 0 || _currentUserId >= _users.size())
         return;
@@ -1025,7 +1025,7 @@ Q_INVOKABLE void UserModel::switchCurrentUser(const int &id)
     emit newUserSelected();
 }
 
-Q_INVOKABLE void UserModel::login(const int &id)
+Q_INVOKABLE void UserModel::login(const int id)
 {
     if (id < 0 || id >= _users.size())
         return;
@@ -1033,7 +1033,7 @@ Q_INVOKABLE void UserModel::login(const int &id)
     _users[id]->login();
 }
 
-Q_INVOKABLE void UserModel::logout(const int &id)
+Q_INVOKABLE void UserModel::logout(const int id)
 {
     if (id < 0 || id >= _users.size())
         return;
@@ -1041,7 +1041,7 @@ Q_INVOKABLE void UserModel::logout(const int &id)
     _users[id]->logout();
 }
 
-Q_INVOKABLE void UserModel::removeAccount(const int &id)
+Q_INVOKABLE void UserModel::removeAccount(const int id)
 {
     if (id < 0 || id >= _users.size())
         return;
index afe7fe6d4b4d784a5bef75f94b814a4bea789c70..28a7eb9ac093401a7951224af6fd3ab73680f154 100644 (file)
@@ -160,7 +160,7 @@ public:
 
     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
 
-    QImage avatarById(const int &id);
+    QImage avatarById(const int id);
 
     User *currentUser() const;
 
@@ -173,11 +173,11 @@ public:
     Q_INVOKABLE int numUsers();
     Q_INVOKABLE QString currentUserServer();
     int currentUserId() const;
-    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);
-    Q_INVOKABLE void removeAccount(const int &id);
+    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);
+    Q_INVOKABLE void removeAccount(const int id);
 
     Q_INVOKABLE std::shared_ptr<OCC::UserStatusConnector> userStatusConnector(int id);