diff options
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 |