summary refs log tree commit diff
path: root/src/ui/UserProfile.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2021-06-13 01:44:25 +0000
committerGitHub <noreply@github.com>2021-06-13 01:44:25 +0000
commit5b4566d3f959e13b34d34a4156a0646b26c7fd08 (patch)
tree11d1b42e1d9f92977c48670605bb8a2e26ddd43c /src/ui/UserProfile.cpp
parentTranslated using Weblate (Esperanto) (diff)
parentFix button spacing (diff)
downloadnheko-5b4566d3f959e13b34d34a4156a0646b26c7fd08.tar.xz
Merge pull request #605 from Nheko-Reborn/qml-roomlist
Qml roomlist and stuff
Diffstat (limited to 'src/ui/UserProfile.cpp')
-rw-r--r--src/ui/UserProfile.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/ui/UserProfile.cpp b/src/ui/UserProfile.cpp

index 0f330964..3d9c4b6a 100644 --- a/src/ui/UserProfile.cpp +++ b/src/ui/UserProfile.cpp
@@ -27,9 +27,22 @@ UserProfile::UserProfile(QString roomid, , manager(manager_) , model(parent) { - fetchDeviceList(this->userid_); globalAvatarUrl = ""; + connect(this, + &UserProfile::globalUsernameRetrieved, + this, + &UserProfile::setGlobalUsername, + Qt::QueuedConnection); + + if (isGlobalUserProfile()) { + getGlobalProfileData(); + } + + if (!cache::client() || !cache::client()->isDatabaseReady() || + !ChatPage::instance()->timelineManager()) + return; + connect(cache::client(), &Cache::verificationStatusChanged, this, @@ -53,17 +66,9 @@ UserProfile::UserProfile(QString roomid, : verification::VERIFIED; } deviceList_.reset(deviceList_.deviceList_); + emit devicesChanged(); }); - - connect(this, - &UserProfile::globalUsernameRetrieved, - this, - &UserProfile::setGlobalUsername, - Qt::QueuedConnection); - - if (isGlobalUserProfile()) { - getGlobalProfileData(); - } + fetchDeviceList(this->userid_); } QHash<int, QByteArray> @@ -123,10 +128,7 @@ UserProfile::displayName() QString UserProfile::avatarUrl() { - return (isGlobalUserProfile() && globalAvatarUrl != "") - ? globalAvatarUrl - : cache::avatarUrl(roomid_, userid_); - ; + return isGlobalUserProfile() ? globalAvatarUrl : cache::avatarUrl(roomid_, userid_); } bool @@ -157,6 +159,9 @@ UserProfile::fetchDeviceList(const QString &userID) { auto localUser = utils::localUser(); + if (!cache::client() || !cache::client()->isDatabaseReady()) + return; + cache::client()->query_keys( userID.toStdString(), [other_user_id = userID.toStdString(), this](const UserKeyCache &other_user_keys, @@ -217,6 +222,7 @@ UserProfile::fetchDeviceList(const QString &userID) } this->deviceList_.queueReset(std::move(deviceInfo)); + emit devicesChanged(); }); }); }