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:
authorCamila <hello@camila.codes>2020-08-03 20:00:45 +0300
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>2020-08-04 19:28:19 +0300
commit6d6cc3852bab3566d7e0641f70a9ea05800bb95b (patch)
treee9f9cd786983c703e167366a7a0c713cf6261a63 /src/gui/tray
parent0516db5e10a2418659342d399d9bb36a0cc01669 (diff)
Fix #2243: use server url instead of hard coded string.
Signed-off-by: Camila <hello@camila.codes>
Diffstat (limited to 'src/gui/tray')
-rw-r--r--src/gui/tray/UserModel.cpp16
-rw-r--r--src/gui/tray/UserModel.h1
2 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp
index 77c5e3991..f7008c42c 100644
--- a/src/gui/tray/UserModel.cpp
+++ b/src/gui/tray/UserModel.cpp
@@ -486,6 +486,11 @@ bool User::serverHasTalk() const
return _account->hasTalk();
}
+AccountApp *User::talkApp() const
+{
+ return _account->findApp(QStringLiteral("spreed"));
+}
+
bool User::hasActivities() const
{
return _account->account()->capabilities().hasActivities();
@@ -643,14 +648,15 @@ Q_INVOKABLE void UserModel::openCurrentAccountLocalFolder()
Q_INVOKABLE void UserModel::openCurrentAccountTalk()
{
- if (_users.isEmpty())
+ if (!currentUser())
return;
- QString url = _users[_currentUserId]->server(false) + "/apps/spreed";
- if (!(url.contains("http://") || url.contains("https://"))) {
- url = "https://" + _users[_currentUserId]->server(false) + "/apps/spreed";
+ const auto talkApp = currentUser()->talkApp();
+ if (talkApp) {
+ QDesktopServices::openUrl(talkApp->url());
+ } else {
+ qCWarning(lcActivity) << "The Talk app is not enabled on" << currentUser()->server();
}
- QDesktopServices::openUrl(QUrl(url));
}
Q_INVOKABLE void UserModel::openCurrentAccountServer()
diff --git a/src/gui/tray/UserModel.h b/src/gui/tray/UserModel.h
index 3a28e65e3..3057f0c28 100644
--- a/src/gui/tray/UserModel.h
+++ b/src/gui/tray/UserModel.h
@@ -36,6 +36,7 @@ public:
QString server(bool shortened = true) const;
bool hasLocalFolder() const;
bool serverHasTalk() const;
+ AccountApp *talkApp() const;
bool hasActivities() const;
AccountAppList appList() const;
QImage avatar(bool whiteBg = false) const;