mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 06:55:59 +03:00
commit
662df54371
4 changed files with 15 additions and 29 deletions
|
@ -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 *>("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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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> _connectionValidator;
|
||||
QByteArray _notificationsEtagResponseHeader;
|
||||
|
|
|
@ -483,7 +483,12 @@ bool User::hasLocalFolder() const
|
|||
|
||||
bool User::serverHasTalk() const
|
||||
{
|
||||
return _account->hasTalk();
|
||||
return talkApp() != nullptr;
|
||||
}
|
||||
|
||||
AccountApp *User::talkApp() const
|
||||
{
|
||||
return _account->findApp(QStringLiteral("spreed"));
|
||||
}
|
||||
|
||||
bool User::hasActivities() const
|
||||
|
@ -597,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;
|
||||
|
@ -643,14 +640,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()
|
||||
|
@ -864,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());
|
||||
|
|
|
@ -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;
|
||||
|
@ -112,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);
|
||||
|
|
Loading…
Reference in a new issue