summary refs log tree commit diff
path: root/src/ui/RoomSettings.cpp
diff options
context:
space:
mode:
authorJedi18 <targetakhil@gmail.com>2021-02-13 19:08:52 +0530
committerJedi18 <targetakhil@gmail.com>2021-02-13 19:08:52 +0530
commitf3596aed554feb848b3f3d09239e5cacf2155024 (patch)
tree71baceb309d04d096233354764e2d1c1c2136fc4 /src/ui/RoomSettings.cpp
parentadded changing of name through edit modal, removed old roomsettings (diff)
downloadnheko-f3596aed554feb848b3f3d09239e5cacf2155024.tar.xz
added room topic
Diffstat (limited to 'src/ui/RoomSettings.cpp')
-rw-r--r--src/ui/RoomSettings.cpp20
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