Page MenuHomePhorge

No OneTemporary

Size
6 KB
Referenced Files
None
Subscribers
None
diff --git a/src/contents/ui/RoomPage.qml b/src/contents/ui/RoomPage.qml
index 3f1fce6..051ce15 100644
--- a/src/contents/ui/RoomPage.qml
+++ b/src/contents/ui/RoomPage.qml
@@ -1,37 +1,42 @@
/*
* Copyright (C) 2020 Tusooa Zhu <tusooa@vista.aero>
*
* This file is part of kazv.
*
* kazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* kazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with kazv. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.2
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import org.kde.kirigami 2.13 as Kirigami
import '.' as Kazv
Kirigami.ScrollablePage {
+ id: roomPage
property string roomId: ''
property var room: root.roomList.room(roomId)
title: room.name || roomId
RoomTimelineView {
timeline: room.timeline()
}
+
+ footer: Kazv.SendMessageBox {
+ room: roomPage.room
+ }
}
diff --git a/src/contents/ui/RoomPage.qml b/src/contents/ui/SendMessageBox.qml
similarity index 69%
copy from src/contents/ui/RoomPage.qml
copy to src/contents/ui/SendMessageBox.qml
index 3f1fce6..a4179c0 100644
--- a/src/contents/ui/RoomPage.qml
+++ b/src/contents/ui/SendMessageBox.qml
@@ -1,37 +1,45 @@
/*
* Copyright (C) 2020 Tusooa Zhu <tusooa@vista.aero>
*
* This file is part of kazv.
*
* kazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* kazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with kazv. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.2
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import org.kde.kirigami 2.13 as Kirigami
import '.' as Kazv
-Kirigami.ScrollablePage {
- property string roomId: ''
- property var room: root.roomList.room(roomId)
-
- title: room.name || roomId
-
- RoomTimelineView {
- timeline: room.timeline()
+RowLayout {
+ property var room
+ TextArea {
+ id: textArea
+ placeholderText: i18n("Type your message here...")
+ Layout.fillWidth: true
+ wrapMode: TextEdit.Wrap
+ }
+ Kirigami.Action {
+ id: sendAction
+ iconName: "document-send"
+ onTriggered: room.sendTextMessage(textArea.text)
+ }
+ ToolButton {
+ icon.name: "document-send"
+ onClicked: sendAction.trigger()
}
}
diff --git a/src/matrix-room.cpp b/src/matrix-room.cpp
index 30a0968..dacbe4c 100644
--- a/src/matrix-room.cpp
+++ b/src/matrix-room.cpp
@@ -1,40 +1,45 @@
/*
* Copyright (C) 2020 Tusooa Zhu <tusooa@vista.aero>
*
* This file is part of kazv.
*
* kazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* kazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with kazv. If not, see <https://www.gnu.org/licenses/>.
*/
#include <immer/config.hpp> // https://github.com/arximboldi/immer/issues/168
#include "matrix-room.hpp"
#include "matrix-room-timeline.hpp"
#include "helper.hpp"
MatrixRoom::MatrixRoom(Kazv::Room room, QObject *parent)
: QObject(parent)
, m_room(room)
, LAGER_QT(roomId)(m_room.roomId().xform(strToQt))
, LAGER_QT(name)(m_room.name().xform(strToQt))
{
}
MatrixRoom::~MatrixRoom() = default;
MatrixRoomTimeline *MatrixRoom::timeline() const
{
return new MatrixRoomTimeline(m_room);
}
+
+void MatrixRoom::sendTextMessage(QString text) const
+{
+ m_room.sendTextMessage(text.toStdString());
+}
diff --git a/src/matrix-room.hpp b/src/matrix-room.hpp
index 95ebbe9..134d5c1 100644
--- a/src/matrix-room.hpp
+++ b/src/matrix-room.hpp
@@ -1,49 +1,51 @@
/*
* Copyright (C) 2020 Tusooa Zhu <tusooa@vista.aero>
*
* This file is part of kazv.
*
* kazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* kazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with kazv. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <immer/config.hpp> // https://github.com/arximboldi/immer/issues/168
#include <QObject>
#include <QQmlEngine>
#include <lager/extra/qt.hpp>
#include <client/room/room.hpp>
class MatrixRoomTimeline;
class MatrixRoom : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("")
Kazv::Room m_room;
public:
explicit MatrixRoom(Kazv::Room room, QObject *parent = 0);
~MatrixRoom() override;
LAGER_QT_READER(QString, roomId);
LAGER_QT_READER(QString, name);
Q_INVOKABLE MatrixRoomTimeline *timeline() const;
+
+ Q_INVOKABLE void sendTextMessage(QString text) const;
};
diff --git a/src/resources.qrc b/src/resources.qrc
index 15ff16f..373d80e 100644
--- a/src/resources.qrc
+++ b/src/resources.qrc
@@ -1,12 +1,13 @@
<RCC>
<qresource prefix="/">
<file alias="main.qml">contents/ui/main.qml</file>
<file alias="LoginPage.qml">contents/ui/LoginPage.qml</file>
<file alias="MainPage.qml">contents/ui/MainPage.qml</file>
<file alias="TabView.qml">contents/ui/TabView.qml</file>
<file alias="Tab.qml">contents/ui/Tab.qml</file>
<file alias="RoomListView.qml">contents/ui/RoomListView.qml</file>
<file alias="RoomPage.qml">contents/ui/RoomPage.qml</file>
<file alias="RoomTimelineView.qml">contents/ui/RoomTimelineView.qml</file>
+ <file alias="SendMessageBox.qml">contents/ui/SendMessageBox.qml</file>
</qresource>
</RCC>

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 4:26 PM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
55322
Default Alt Text
(6 KB)

Event Timeline