From: Camila Date: Mon, 3 Aug 2020 17:48:33 +0000 (+0200) Subject: Remove extra check for talk app on server in AccountState. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~34^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8f300ffe661ff79e644f49470132703e7b57aadc;p=nextcloud-desktop.git Remove extra check for talk app on server in AccountState. - Remove repeated hard coded "spreed" string. Signed-off-by: Camila --- diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index be7aa5832..3b56a8d7f 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -44,7 +44,6 @@ AccountState::AccountState(AccountPtr account) , _waitingForNewCredentials(false) , _maintenanceToConnectedDelay(60000 + (qrand() % (4 * 60000))) // 1-5min delay , _remoteWipe(new RemoteWipe(_account)) - , _hasTalk(false) { qRegisterMetaType("AccountState*"); @@ -74,11 +73,6 @@ AccountPtr AccountState::account() const return _account; } -bool AccountState::hasTalk() const -{ - return _hasTalk; -} - AccountState::ConnectionStatus AccountState::connectionStatus() const { return _connectionStatus; @@ -444,7 +438,6 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta qCWarning(lcAccountState) << "Status code " << statusCode << " Not Modified - No new navigation apps."; } else { _apps.clear(); - _hasTalk = false; if(!reply.isEmpty()){ auto element = reply.object().value("ocs").toObject().value("data"); @@ -458,9 +451,6 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta navLink.value("id").toString(), QUrl(navLink.value("icon").toString())); _apps << app; - - if(app->id() == QLatin1String("spreed")) - _hasTalk = true; } } } diff --git a/src/gui/accountstate.h b/src/gui/accountstate.h index 433fb5116..f1209a47a 100644 --- a/src/gui/accountstate.h +++ b/src/gui/accountstate.h @@ -103,8 +103,6 @@ public: bool isSignedOut() const; - bool hasTalk() const; - AccountAppList appList() const; AccountApp* findApp(const QString &appId) const; @@ -195,7 +193,6 @@ private: ConnectionStatus _connectionStatus; QStringList _connectionErrors; bool _waitingForNewCredentials; - bool _hasTalk; QElapsedTimer _timeSinceLastETagCheck; QPointer _connectionValidator; QByteArray _notificationsEtagResponseHeader; diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp index f7008c42c..386c7f762 100644 --- a/src/gui/tray/UserModel.cpp +++ b/src/gui/tray/UserModel.cpp @@ -483,7 +483,7 @@ bool User::hasLocalFolder() const bool User::serverHasTalk() const { - return _account->hasTalk(); + return talkApp() != nullptr; } AccountApp *User::talkApp() const @@ -602,14 +602,6 @@ Q_INVOKABLE QString UserModel::currentUserServer() return _users[_currentUserId]->server(); } -Q_INVOKABLE bool UserModel::currentServerHasTalk() -{ - if (_users.isEmpty()) - return false; - - return _users[_currentUserId]->serverHasTalk(); -} - void UserModel::addUser(AccountStatePtr &user, const bool &isCurrent) { bool containsUser = false; @@ -870,9 +862,10 @@ void UserAppsModel::buildAppList() } if (UserModel::instance()->appList().count() > 0) { + const auto talkApp = UserModel::instance()->currentUser()->talkApp(); foreach (AccountApp *app, UserModel::instance()->appList()) { // Filter out Talk because we have a dedicated button for it - if (app->id() == QLatin1String("spreed")) + if (talkApp && app->id() == talkApp->id()) continue; beginInsertRows(QModelIndex(), rowCount(), rowCount()); diff --git a/src/gui/tray/UserModel.h b/src/gui/tray/UserModel.h index 3057f0c28..10836dfd6 100644 --- a/src/gui/tray/UserModel.h +++ b/src/gui/tray/UserModel.h @@ -113,7 +113,6 @@ public: Q_INVOKABLE QString currentUserServer(); Q_INVOKABLE bool currentUserHasActivities(); Q_INVOKABLE bool currentUserHasLocalFolder(); - Q_INVOKABLE bool currentServerHasTalk(); Q_INVOKABLE int currentUserId() const; Q_INVOKABLE bool isUserConnected(const int &id); Q_INVOKABLE void switchCurrentUser(const int &id);