summary refs log tree commit diff
path: root/src/ChatPage.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-11-17 02:37:43 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-11-25 19:05:12 +0100
commit921379a4cc3bc6381c4562bfdb9ce0dcde6b1f2c (patch)
treed81f85f20a62f5cd642e787f7ec891a60feec7f2 /src/ChatPage.cpp
parentMove emoji picker to qml (diff)
downloadnheko-921379a4cc3bc6381c4562bfdb9ce0dcde6b1f2c.tar.xz
Send typing updates from QML
Diffstat (limited to 'src/ChatPage.cpp')
-rw-r--r--src/ChatPage.cpp47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index c703d95f..1b235a95 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -141,9 +141,6 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
         text_input_ = new TextInputWidget(this);
         contentLayout_->addWidget(text_input_);
 
-        typingRefresher_ = new QTimer(this);
-        typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT);
-
         connect(this, &ChatPage::connectionLost, this, [this]() {
                 nhlog::net()->info("connectivity lost");
                 isConnected_ = false;
@@ -221,9 +218,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
         connect(room_list_, &RoomList::roomChanged, this, [this](QString room_id) {
                 this->current_room_ = room_id;
         });
-        connect(room_list_, &RoomList::roomChanged, text_input_, &TextInputWidget::stopTyping);
         connect(room_list_, &RoomList::roomChanged, splitter, &Splitter::showChatView);
-        connect(room_list_, &RoomList::roomChanged, text_input_, &TextInputWidget::focusLineEdit);
         connect(
           room_list_, &RoomList::roomChanged, view_manager_, &TimelineViewManager::setHistoryView);
 
@@ -237,27 +232,6 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
                 room_list_->removeRoom(room_id, currentRoom() == room_id);
         });
 
-        connect(
-          text_input_, &TextInputWidget::startedTyping, this, &ChatPage::sendTypingNotifications);
-        connect(typingRefresher_, &QTimer::timeout, this, &ChatPage::sendTypingNotifications);
-        connect(text_input_, &TextInputWidget::stoppedTyping, this, [this]() {
-                if (!userSettings_->typingNotifications())
-                        return;
-
-                typingRefresher_->stop();
-
-                if (current_room_.isEmpty())
-                        return;
-
-                http::client()->stop_typing(
-                  current_room_.toStdString(), [](mtx::http::RequestErr err) {
-                          if (err) {
-                                  nhlog::net()->warn("failed to stop typing notifications: {}",
-                                                     err->matrix_error.error);
-                          }
-                  });
-        });
-
         connect(view_manager_,
                 &TimelineViewManager::updateRoomsLastMessage,
                 room_list_,
@@ -436,12 +410,6 @@ ChatPage::resetUI()
 }
 
 void
-ChatPage::focusMessageInput()
-{
-        this->text_input_->focusLineEdit();
-}
-
-void
 ChatPage::deleteConfigs()
 {
         QSettings settings;
@@ -1099,21 +1067,6 @@ ChatPage::receivedSessionKey(const std::string &room_id, const std::string &sess
         view_manager_->receivedSessionKey(room_id, session_id);
 }
 
-void
-ChatPage::sendTypingNotifications()
-{
-        if (!userSettings_->typingNotifications())
-                return;
-
-        http::client()->start_typing(
-          current_room_.toStdString(), 10'000, [](mtx::http::RequestErr err) {
-                  if (err) {
-                          nhlog::net()->warn("failed to send typing notification: {}",
-                                             err->matrix_error.error);
-                  }
-          });
-}
-
 QString
 ChatPage::status() const
 {