diff options
author | Jedi18 <targetakhil@gmail.com> | 2021-02-13 19:08:52 +0530 |
---|---|---|
committer | Jedi18 <targetakhil@gmail.com> | 2021-02-13 19:08:52 +0530 |
commit | f3596aed554feb848b3f3d09239e5cacf2155024 (patch) | |
tree | 71baceb309d04d096233354764e2d1c1c2136fc4 /src/ui/RoomSettings.cpp | |
parent | added changing of name through edit modal, removed old roomsettings (diff) | |
download | nheko-f3596aed554feb848b3f3d09239e5cacf2155024.tar.xz |
added room topic
Diffstat (limited to 'src/ui/RoomSettings.cpp')
-rw-r--r-- | src/ui/RoomSettings.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp index c7f388d4..d2b5a630 100644 --- a/src/ui/RoomSettings.cpp +++ b/src/ui/RoomSettings.cpp @@ -75,9 +75,10 @@ EditModal::EditModal(const QString &roomId, QWidget *parent) } void -EditModal::topicEventSent() +EditModal::topicEventSent(const QString &topic) { errorField_->hide(); + emit topicChanged(topic); close(); } @@ -141,14 +142,14 @@ EditModal::applyClicked() http::client()->send_state_event( roomId_.toStdString(), body, - [proxy](const mtx::responses::EventId &, mtx::http::RequestErr err) { + [proxy, newTopic](const mtx::responses::EventId &, mtx::http::RequestErr err) { if (err) { emit proxy->error( QString::fromStdString(err->matrix_error.error)); return; } - emit proxy->topicEventSent(); + emit proxy->topicEventSent(newTopic); }); } } @@ -222,7 +223,13 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent) QString RoomSettings::roomName() const { - return QString(info_.name.c_str()); + return QString::fromStdString(info_.name); +} + +QString +RoomSettings::roomTopic() const +{ + return QString::fromStdString(info_.topic); } QString @@ -382,6 +389,11 @@ RoomSettings::openEditModal() info_.name = newName.toStdString(); emit roomNameChanged(); }); + + connect(modal, &EditModal::topicChanged, this, [this](const QString &newTopic) { + info_.topic = newTopic.toStdString(); + emit roomTopicChanged(); + }); } void |