mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
Fix device list not showing up and UserProfile blocking the window
This commit is contained in:
parent
d307f24adf
commit
f2bc184550
8 changed files with 35 additions and 24 deletions
|
@ -212,6 +212,16 @@ Page {
|
||||||
Layout.preferredHeight: userInfoGrid.implicitHeight + 2 * Nheko.paddingMedium
|
Layout.preferredHeight: userInfoGrid.implicitHeight + 2 * Nheko.paddingMedium
|
||||||
Layout.minimumHeight: 40
|
Layout.minimumHeight: 40
|
||||||
|
|
||||||
|
TapHandler {
|
||||||
|
onSingleTapped: {
|
||||||
|
Nheko.updateUserProfile();
|
||||||
|
var userProfile = userProfileComponent.createObject(timelineRoot, {
|
||||||
|
"profile": Nheko.currentUser
|
||||||
|
});
|
||||||
|
userProfile.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: userInfoGrid
|
id: userInfoGrid
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ ApplicationWindow {
|
||||||
minimumHeight: 650
|
minimumHeight: 650
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
modality: Qt.WindowModal
|
modality: Qt.NonModal
|
||||||
flags: Qt.Dialog
|
flags: Qt.Dialog
|
||||||
title: qsTr("Room Settings")
|
title: qsTr("Room Settings")
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ ApplicationWindow {
|
||||||
title: qsTr("End-to-End Encryption")
|
title: qsTr("End-to-End Encryption")
|
||||||
text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br>
|
text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br>
|
||||||
Please take note that it can't be disabled afterwards.")
|
Please take note that it can't be disabled afterwards.")
|
||||||
modality: Qt.WindowModal
|
modality: Qt.NonModal
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (roomSettings.isEncryptionEnabled)
|
if (roomSettings.isEncryptionEnabled)
|
||||||
return ;
|
return ;
|
||||||
|
|
|
@ -22,7 +22,7 @@ ApplicationWindow {
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
title: profile.isGlobalUserProfile ? qsTr("Global User Profile") : qsTr("Room User Profile")
|
title: profile.isGlobalUserProfile ? qsTr("Global User Profile") : qsTr("Room User Profile")
|
||||||
modality: Qt.WindowModal
|
modality: Qt.NonModal
|
||||||
flags: Qt.Dialog
|
flags: Qt.Dialog
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
|
|
|
@ -15,7 +15,7 @@ ApplicationWindow {
|
||||||
onClosing: TimelineManager.removeVerificationFlow(flow)
|
onClosing: TimelineManager.removeVerificationFlow(flow)
|
||||||
title: stack.currentItem.title
|
title: stack.currentItem.title
|
||||||
flags: Qt.Dialog
|
flags: Qt.Dialog
|
||||||
modality: Qt.WindowModal
|
modality: Qt.NonModal
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
height: stack.implicitHeight
|
height: stack.implicitHeight
|
||||||
width: stack.implicitWidth
|
width: stack.implicitWidth
|
||||||
|
|
|
@ -3469,6 +3469,7 @@ Cache::updateUserKeys(const std::string &sync_token, const mtx::responses::Query
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &[user_id, update] : updates) {
|
for (auto &[user_id, update] : updates) {
|
||||||
(void)update;
|
(void)update;
|
||||||
if (user_id == local_user) {
|
if (user_id == local_user) {
|
||||||
|
@ -3476,9 +3477,8 @@ Cache::updateUserKeys(const std::string &sync_token, const mtx::responses::Query
|
||||||
(void)status;
|
(void)status;
|
||||||
emit verificationStatusChanged(user);
|
emit verificationStatusChanged(user);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
emit verificationStatusChanged(user_id);
|
|
||||||
}
|
}
|
||||||
|
emit verificationStatusChanged(user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3552,6 +3552,19 @@ Cache::query_keys(const std::string &user_id,
|
||||||
last_changed = cache_->last_changed;
|
last_changed = cache_->last_changed;
|
||||||
req.token = last_changed;
|
req.token = last_changed;
|
||||||
|
|
||||||
|
// use context object so that we can disconnect again
|
||||||
|
QObject *context{new QObject(this)};
|
||||||
|
QObject::connect(this,
|
||||||
|
&Cache::verificationStatusChanged,
|
||||||
|
context,
|
||||||
|
[cb, user_id, context_ = context](std::string updated_user) mutable {
|
||||||
|
if (user_id == updated_user) {
|
||||||
|
context_->deleteLater();
|
||||||
|
auto keys = cache::userKeys(user_id);
|
||||||
|
cb(keys.value_or(UserKeyCache{}), {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
http::client()->query_keys(
|
http::client()->query_keys(
|
||||||
req,
|
req,
|
||||||
[cb, user_id, last_changed, this](const mtx::responses::QueryKeys &res,
|
[cb, user_id, last_changed, this](const mtx::responses::QueryKeys &res,
|
||||||
|
@ -3565,21 +3578,6 @@ Cache::query_keys(const std::string &user_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
emit userKeysUpdate(last_changed, res);
|
emit userKeysUpdate(last_changed, res);
|
||||||
|
|
||||||
// use context object so that we can disconnect again
|
|
||||||
std::unique_ptr<QObject> context{new QObject};
|
|
||||||
QObject *pcontext = context.get();
|
|
||||||
QObject::connect(
|
|
||||||
this,
|
|
||||||
&Cache::verificationStatusChanged,
|
|
||||||
pcontext,
|
|
||||||
[cb, user_id, context_ = std::move(context)](std::string updated_user) mutable {
|
|
||||||
if (user_id == updated_user) {
|
|
||||||
context_.release();
|
|
||||||
auto keys = cache::userKeys(user_id);
|
|
||||||
cb(keys.value_or(UserKeyCache{}), {});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void openLink(QString link) const;
|
Q_INVOKABLE void openLink(QString link) const;
|
||||||
|
|
||||||
private slots:
|
public slots:
|
||||||
void updateUserProfile();
|
void updateUserProfile();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -42,7 +42,6 @@ UserProfile::UserProfile(QString roomid,
|
||||||
if (!cache::client() || !cache::client()->isDatabaseReady())
|
if (!cache::client() || !cache::client()->isDatabaseReady())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fetchDeviceList(this->userid_);
|
|
||||||
connect(cache::client(),
|
connect(cache::client(),
|
||||||
&Cache::verificationStatusChanged,
|
&Cache::verificationStatusChanged,
|
||||||
this,
|
this,
|
||||||
|
@ -66,7 +65,9 @@ UserProfile::UserProfile(QString roomid,
|
||||||
: verification::VERIFIED;
|
: verification::VERIFIED;
|
||||||
}
|
}
|
||||||
deviceList_.reset(deviceList_.deviceList_);
|
deviceList_.reset(deviceList_.deviceList_);
|
||||||
|
emit devicesChanged();
|
||||||
});
|
});
|
||||||
|
fetchDeviceList(this->userid_);
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray>
|
QHash<int, QByteArray>
|
||||||
|
@ -223,6 +224,7 @@ UserProfile::fetchDeviceList(const QString &userID)
|
||||||
}
|
}
|
||||||
|
|
||||||
this->deviceList_.queueReset(std::move(deviceInfo));
|
this->deviceList_.queueReset(std::move(deviceInfo));
|
||||||
|
emit devicesChanged();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ class UserProfile : public QObject
|
||||||
Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged)
|
Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged)
|
||||||
Q_PROPERTY(QString userid READ userid CONSTANT)
|
Q_PROPERTY(QString userid READ userid CONSTANT)
|
||||||
Q_PROPERTY(QString avatarUrl READ avatarUrl NOTIFY avatarUrlChanged)
|
Q_PROPERTY(QString avatarUrl READ avatarUrl NOTIFY avatarUrlChanged)
|
||||||
Q_PROPERTY(DeviceInfoModel *deviceList READ deviceList CONSTANT)
|
Q_PROPERTY(DeviceInfoModel *deviceList READ deviceList NOTIFY devicesChanged)
|
||||||
Q_PROPERTY(bool isGlobalUserProfile READ isGlobalUserProfile CONSTANT)
|
Q_PROPERTY(bool isGlobalUserProfile READ isGlobalUserProfile CONSTANT)
|
||||||
Q_PROPERTY(int userVerified READ getUserStatus NOTIFY userStatusChanged)
|
Q_PROPERTY(int userVerified READ getUserStatus NOTIFY userStatusChanged)
|
||||||
Q_PROPERTY(bool isLoading READ isLoading NOTIFY loadingChanged)
|
Q_PROPERTY(bool isLoading READ isLoading NOTIFY loadingChanged)
|
||||||
|
@ -133,6 +133,7 @@ signals:
|
||||||
void avatarUrlChanged();
|
void avatarUrlChanged();
|
||||||
void displayError(const QString &errorMessage);
|
void displayError(const QString &errorMessage);
|
||||||
void globalUsernameRetrieved(const QString &globalUser);
|
void globalUsernameRetrieved(const QString &globalUser);
|
||||||
|
void devicesChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateAvatarUrl();
|
void updateAvatarUrl();
|
||||||
|
|
Loading…
Reference in a new issue