Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schuster <michael@schuster.ms>2020-01-15 18:30:05 +0300
committerMichael Schuster <michael@schuster.ms>2020-01-15 18:30:05 +0300
commit7b740f5e9a91fb6c814fae6946b3f8ca4260855e (patch)
tree42c6e56e8632148d594d59eacf8c97c666b1ed9b /src/gui/accountstate.cpp
parentcb328d6cea33186110068eb1d5293d9f7721b261 (diff)
Remove setTalkCapability() from AccountState and filter for Talk upon App list building
Since the per Account App list is now being built in AccountState's slotNavigationAppsFetched it's easy to filter for the availability of the Talk app on the server by its ID property upon App list building, thus eliminating the need for an extra fetch job. Signed-off-by: Michael Schuster <michael@schuster.ms>
Diffstat (limited to 'src/gui/accountstate.cpp')
-rw-r--r--src/gui/accountstate.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp
index b9b42eca5..5651e623f 100644
--- a/src/gui/accountstate.cpp
+++ b/src/gui/accountstate.cpp
@@ -45,6 +45,7 @@ AccountState::AccountState(AccountPtr account)
, _notificationsEtagResponseHeader("*")
, _maintenanceToConnectedDelay(60000 + (qrand() % (4 * 60000))) // 1-5min delay
, _remoteWipe(new RemoteWipe(_account))
+ , _hasTalk(false)
{
qRegisterMetaType<AccountState *>("AccountState*");
@@ -96,23 +97,6 @@ AccountState::State AccountState::state() const
return _state;
}
-void AccountState::setTalkCapability()
-{
- QNetworkAccessManager *manager = new QNetworkAccessManager(this);
- connect(manager, &QNetworkAccessManager::finished,
- this, [=](QNetworkReply *reply) {
- if (reply->error()) {
- return;
- }
- //TODO: This is **** dirty, but atm I don't see a capability-way to determine talk integration
- _hasTalk = (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 303) ? true : false;
- });
- QNetworkRequest request;
- QString url = this->account()->url().toString() + "/apps/spreed";
- request.setUrl(QUrl(url));
- manager->get(request);
-}
-
void AccountState::setState(State state)
{
if (_state != state) {
@@ -320,7 +304,6 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta
case ConnectionValidator::Connected:
if (_state != Connected) {
setState(Connected);
- setTalkCapability();
// Get the Apps available on the server.
fetchNavigationApps();
@@ -479,6 +462,9 @@ 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;
}
}
}