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)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Fri, 15 Jul 2022 13:49:29 +0000 (13:49 +0000)
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
src/gui/tray/usermodel.cpp
src/gui/tray/usermodel.h

index 8c65468e361f12bd5b0509ae8d8f8a96b0b34cea..436fb42e4512093ff33cd768bd6dffaf4d0dd844 100644 (file)
@@ -872,7 +872,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;
@@ -880,7 +880,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 {};
@@ -981,7 +981,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;
@@ -992,7 +992,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;
@@ -1000,7 +1000,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;
@@ -1008,7 +1008,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);