Compare commits
85 Commits
v24.12.2
...
work/thiag
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67b54cc112 | ||
|
|
39046632aa | ||
|
|
fbb2afdb49 | ||
|
|
aff0402f71 | ||
|
|
cee9058c77 | ||
|
|
3f922b4c90 | ||
|
|
02d2d31cf3 | ||
|
|
240cf6a0ed | ||
|
|
dcd9ee93de | ||
|
|
2a8cd74ab1 | ||
|
|
63bc7055c2 | ||
|
|
1cca9733d6 | ||
|
|
1104da5e2c | ||
|
|
3a9718c09d | ||
|
|
55362c5573 | ||
|
|
0bba2299b3 | ||
|
|
45685af9e9 | ||
|
|
6c416a9338 | ||
|
|
1b0027e1d2 | ||
|
|
2409adf516 | ||
|
|
554801dfe4 | ||
|
|
20c23917e9 | ||
|
|
ef953b7574 | ||
|
|
6b79795229 | ||
|
|
9cb7ec2348 | ||
|
|
437c981d30 | ||
|
|
0334cae4c8 | ||
|
|
24c405d747 | ||
|
|
a3f5962809 | ||
|
|
0deb7495f0 | ||
|
|
d34f89fc4b | ||
|
|
a909ed498f | ||
|
|
16f4e17e8f | ||
|
|
0e9592a96c | ||
|
|
704ee6a53a | ||
|
|
5b9afbce9a | ||
|
|
396cc8e8ef | ||
|
|
bf776b5c06 | ||
|
|
be319f88d3 | ||
|
|
af40d555d4 | ||
|
|
f802dbe686 | ||
|
|
2379e3d83b | ||
|
|
9e90ac0412 | ||
|
|
c27948ca3c | ||
|
|
c3b9d664df | ||
|
|
31ef0a5223 | ||
|
|
14c58acea1 | ||
|
|
5dae20603e | ||
|
|
3f6fa94289 | ||
|
|
117615a8b0 | ||
|
|
4a52773c7d | ||
|
|
edfee495c6 | ||
|
|
7d112df7c6 | ||
|
|
9acaaade45 | ||
|
|
aaca28dbf6 | ||
|
|
d4ef5f9d4d | ||
|
|
2095dea801 | ||
|
|
a36f7ef10d | ||
|
|
9874962ee3 | ||
|
|
4b08022075 | ||
|
|
dc3db3aec4 | ||
|
|
0568c2a93d | ||
|
|
7ab0a6fc9e | ||
|
|
d6b780762e | ||
|
|
5ef66b5cf6 | ||
|
|
19e8cd5e48 | ||
|
|
df5117892f | ||
|
|
aaa4216f55 | ||
|
|
85ee5084b6 | ||
|
|
bb9ce117de | ||
|
|
00c5aa26bb | ||
|
|
bae4de227c | ||
|
|
253f891c5a | ||
|
|
6966159062 | ||
|
|
07d3b80c3e | ||
|
|
a41d0f3214 | ||
|
|
1ee15de78b | ||
|
|
b044358970 | ||
|
|
d2e11bb3bb | ||
|
|
a55bac899c | ||
|
|
c2380fb8df | ||
|
|
f31c644b13 | ||
|
|
26cd621d0e | ||
|
|
4c58512c54 | ||
|
|
04c1b47660 |
@@ -7,8 +7,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
# KDE Applications version, managed by release script.
|
# KDE Applications version, managed by release script.
|
||||||
set(RELEASE_SERVICE_VERSION_MAJOR "24")
|
set(RELEASE_SERVICE_VERSION_MAJOR "25")
|
||||||
set(RELEASE_SERVICE_VERSION_MINOR "11")
|
set(RELEASE_SERVICE_VERSION_MINOR "03")
|
||||||
set(RELEASE_SERVICE_VERSION_MICRO "70")
|
set(RELEASE_SERVICE_VERSION_MICRO "70")
|
||||||
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ A Qt/QML based Matrix client.
|
|||||||
|
|
||||||
<a href='https://matrix.org'><img src='https://matrix.org/docs/legacy/made-for-matrix.png' alt='Made for Matrix' height=64 target=_blank /></a>
|
<a href='https://matrix.org'><img src='https://matrix.org/docs/legacy/made-for-matrix.png' alt='Made for Matrix' height=64 target=_blank /></a>
|
||||||
<a href='https://flathub.org/apps/details/org.kde.neochat'><img width='190px' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-i-en.png'/></a>
|
<a href='https://flathub.org/apps/details/org.kde.neochat'><img width='190px' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-i-en.png'/></a>
|
||||||
<a href='https://snapcraft.io/neochat'><img width='190px' alt='Download on the Snap Store' src='https://snapcraft.io/static/images/badges/en/snap-store-black.svg'/></a>
|
<a href='https://snapcraft.io/neochat'><img width='190px' alt='Download on the Snap Store' src='https://apps.kde.org/store_badges/snapstore/en.svg'/></a>
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,26 @@
|
|||||||
"!room_id_1234:localhost:1234": {
|
"!room_id_1234:localhost:1234": {
|
||||||
"state": {
|
"state": {
|
||||||
"events": [
|
"events": [
|
||||||
|
{
|
||||||
|
"content": {
|
||||||
|
"m.federate": true,
|
||||||
|
"predecessor": {
|
||||||
|
"event_id": "$something:example.org",
|
||||||
|
"room_id": "!oldroom:example.org"
|
||||||
|
},
|
||||||
|
"room_version": "11"
|
||||||
|
},
|
||||||
|
"event_id": "$143273582443PhrSn:example.org",
|
||||||
|
"origin_server_ts": 1432735824653,
|
||||||
|
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
|
||||||
|
"sender": "@example:example.org",
|
||||||
|
"state_key": "",
|
||||||
|
"type": "m.room.create",
|
||||||
|
"unsigned": {
|
||||||
|
"age": 1234,
|
||||||
|
"membership": "join"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "m.room.member",
|
"type": "m.room.member",
|
||||||
"state_key": "@user:localhost:1234",
|
"state_key": "@user:localhost:1234",
|
||||||
@@ -26,6 +46,26 @@
|
|||||||
},
|
},
|
||||||
"timeline": {
|
"timeline": {
|
||||||
"events": [
|
"events": [
|
||||||
|
{
|
||||||
|
"content": {
|
||||||
|
"m.federate": true,
|
||||||
|
"predecessor": {
|
||||||
|
"event_id": "$something:example.org",
|
||||||
|
"room_id": "!oldroom:example.org"
|
||||||
|
},
|
||||||
|
"room_version": "11"
|
||||||
|
},
|
||||||
|
"event_id": "$143273582443PhrSn:example.org",
|
||||||
|
"origin_server_ts": 1432735824653,
|
||||||
|
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
|
||||||
|
"sender": "@example:example.org",
|
||||||
|
"state_key": "",
|
||||||
|
"type": "m.room.create",
|
||||||
|
"unsigned": {
|
||||||
|
"age": 1234,
|
||||||
|
"membership": "join"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "m.room.message",
|
"type": "m.room.message",
|
||||||
"sender": "@user:localhost:1234",
|
"sender": "@user:localhost:1234",
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ void TextHandlerTest::componentOutput_data()
|
|||||||
QVariantMap{{QStringLiteral("class"), QStringLiteral("html")}}}};
|
QVariantMap{{QStringLiteral("class"), QStringLiteral("html")}}}};
|
||||||
QTest::newRow("quote") << QStringLiteral("<p>Text</p>\n<blockquote>\n<p>blockquote</p>\n</blockquote>")
|
QTest::newRow("quote") << QStringLiteral("<p>Text</p>\n<blockquote>\n<p>blockquote</p>\n</blockquote>")
|
||||||
<< QList<MessageComponent>{MessageComponent{MessageComponentType::Text, QStringLiteral("Text"), {}},
|
<< QList<MessageComponent>{MessageComponent{MessageComponentType::Text, QStringLiteral("Text"), {}},
|
||||||
MessageComponent{MessageComponentType::Quote, QStringLiteral("\"blockquote\""), {}}};
|
MessageComponent{MessageComponentType::Quote, QStringLiteral("“blockquote”"), {}}};
|
||||||
QTest::newRow("no tag first paragraph") << QStringLiteral("Text\n<p>Text</p>")
|
QTest::newRow("no tag first paragraph") << QStringLiteral("Text\n<p>Text</p>")
|
||||||
<< QList<MessageComponent>{MessageComponent{MessageComponentType::Text, QStringLiteral("Text"), {}},
|
<< QList<MessageComponent>{MessageComponent{MessageComponentType::Text, QStringLiteral("Text"), {}},
|
||||||
MessageComponent{MessageComponentType::Text, QStringLiteral("Text"), {}}};
|
MessageComponent{MessageComponentType::Text, QStringLiteral("Text"), {}}};
|
||||||
|
|||||||
@@ -58,6 +58,8 @@
|
|||||||
<summary xml:lang="es">Charle en Matrix</summary>
|
<summary xml:lang="es">Charle en Matrix</summary>
|
||||||
<summary xml:lang="eu">Berriketa Matrix-en</summary>
|
<summary xml:lang="eu">Berriketa Matrix-en</summary>
|
||||||
<summary xml:lang="fr">Discuter sur Matrix</summary>
|
<summary xml:lang="fr">Discuter sur Matrix</summary>
|
||||||
|
<summary xml:lang="gl">Charlar en Matrix</summary>
|
||||||
|
<summary xml:lang="hu">Csevegés Matrixon</summary>
|
||||||
<summary xml:lang="ia">Conversation en ditecto sur Matrix</summary>
|
<summary xml:lang="ia">Conversation en ditecto sur Matrix</summary>
|
||||||
<summary xml:lang="it">Chat su Matrix</summary>
|
<summary xml:lang="it">Chat su Matrix</summary>
|
||||||
<summary xml:lang="ka">ისაუბრეთ Matrix-ზე</summary>
|
<summary xml:lang="ka">ისაუბრეთ Matrix-ზე</summary>
|
||||||
@@ -286,6 +288,7 @@
|
|||||||
<value key="KDE::windows_store::StoreLogoSquare">https://invent.kde.org/network/neochat/-/raw/master/icons/windows/storelogo-1080x1080.png</value>
|
<value key="KDE::windows_store::StoreLogoSquare">https://invent.kde.org/network/neochat/-/raw/master/icons/windows/storelogo-1080x1080.png</value>
|
||||||
<value key="KDE::windows_store::Icon">https://invent.kde.org/network/neochat/-/raw/master/icons/300-apps-neochat.png</value>
|
<value key="KDE::windows_store::Icon">https://invent.kde.org/network/neochat/-/raw/master/icons/300-apps-neochat.png</value>
|
||||||
<value key="KDE::windows_store::PromotionalArt16x9">https://invent.kde.org/network/neochat/-/raw/master/icons/windows/promoimage-1920x1080.png</value>
|
<value key="KDE::windows_store::PromotionalArt16x9">https://invent.kde.org/network/neochat/-/raw/master/icons/windows/promoimage-1920x1080.png</value>
|
||||||
|
<value key="KDE::supporters">Tanguy Fardet</value>
|
||||||
</custom>
|
</custom>
|
||||||
<launchable type="desktop-id">org.kde.neochat.desktop</launchable>
|
<launchable type="desktop-id">org.kde.neochat.desktop</launchable>
|
||||||
<screenshots>
|
<screenshots>
|
||||||
|
|||||||
@@ -87,47 +87,25 @@ GenericName[uk]=Клієнт Matrix
|
|||||||
GenericName[x-test]=xxMatrix Clientxx
|
GenericName[x-test]=xxMatrix Clientxx
|
||||||
GenericName[zh_CN]=Matrix 客户端
|
GenericName[zh_CN]=Matrix 客户端
|
||||||
GenericName[zh_TW]=Matrix 用戶端
|
GenericName[zh_TW]=Matrix 用戶端
|
||||||
Comment=Client for the Matrix protocol
|
Comment=Chat on Matrix
|
||||||
Comment[ar]=عميل لميفاق ماتركس
|
Comment[ca]=Xat a Matrix
|
||||||
Comment[az]=Matrix protokolu üçün müştəri
|
Comment[ca@valencia]=Xat a Matrix
|
||||||
Comment[ca]=Client per al protocol Matrix
|
Comment[en_GB]=Chat on Matrix
|
||||||
Comment[ca@valencia]=Client per al protocol Matrix
|
Comment[es]=Chat en Matrix
|
||||||
Comment[de]=Programm für das Matrix-Protokoll
|
Comment[eu]=Berriketa Matrix-en
|
||||||
Comment[el]=Πελάτης για το πρωτόκολλο Matrix
|
Comment[fr]=Clavarder sur Matrix
|
||||||
Comment[en_GB]=Client for the Matrix protocol
|
Comment[gl]=Charle en Matrix
|
||||||
Comment[eo]=Kliento por la Matrix-protokolo
|
Comment[hu]=Csevegés Matrixon
|
||||||
Comment[es]=Cliente para el protocolo Matrix
|
Comment[ia]=Conversation en ditecto sur Matrix
|
||||||
Comment[eu]=Matrix protokolorako bezeroa
|
Comment[it]= su Matrix
|
||||||
Comment[fi]=Asiakas Matrix-yhteyskäytännölle
|
Comment[ka]=ჩატი Matrix-ზე
|
||||||
Comment[fr]=Client pour le protocole « Matrix »
|
Comment[nl]=Chat op Matrix
|
||||||
Comment[gl]=Cliente para o protocolo Matrix.
|
Comment[pl]=Rozmawiaj na Matriksie
|
||||||
Comment[he]=לקוח לפרוטוקול Matrix
|
Comment[sl]=Klepet na Matrixu
|
||||||
Comment[hu]=Kliens a Matrix protokollhoz
|
Comment[ta]=மேட்ரிக்ஸில் உரையாட உதவும்
|
||||||
Comment[ia]=Cliente per le protocollo de Matrix
|
Comment[tr]=Matrix Üzerinde Sohbet Et
|
||||||
Comment[id]=Klien untuk protokol Matrix
|
Comment[uk]=Спілкування у Matrix
|
||||||
Comment[ie]=Un cliente del protocol Matrix
|
Comment[x-test]=xxChat on Matrixxx
|
||||||
Comment[it]=Client per il protocollo Matrix
|
|
||||||
Comment[ka]=კლიენტი Matrix-ის პროტოკოლისთვის
|
|
||||||
Comment[ko]=Matrix 프로토콜용 클라이언트
|
|
||||||
Comment[lt]=Matrix protokolo kliento programa
|
|
||||||
Comment[lv]=Klients „Matrix“ protokolam
|
|
||||||
Comment[nl]=Client voor het Matrix-protocol
|
|
||||||
Comment[nn]=Klient for Matrix-protokollen
|
|
||||||
Comment[pa]=ਮੈਟਰਿਕਸ ਪਰੋਟੋਕਾਲ ਲਈ ਕਲਾਈਂਟ ਹੈ
|
|
||||||
Comment[pl]=Program obsługi protokołu Matriksa
|
|
||||||
Comment[pt]=Cliente para o protocolo Matrix
|
|
||||||
Comment[pt_BR]=Cliente para o protocolo Matrix
|
|
||||||
Comment[ro]=Client pentru protocolul Matrix
|
|
||||||
Comment[ru]=Клиент для протокола Matrix
|
|
||||||
Comment[sk]=Klient protokolu Matrix
|
|
||||||
Comment[sl]=Odjemalec za protokol Matrix
|
|
||||||
Comment[sv]=Klient för protokollet Matrix
|
|
||||||
Comment[ta]=Matrix நெறிமுறைக்கான வாங்கி
|
|
||||||
Comment[tr]=Matrix protokolü için istemci
|
|
||||||
Comment[uk]=Клієнт протоколу Matrix
|
|
||||||
Comment[x-test]=xxClient for the Matrix protocolxx
|
|
||||||
Comment[zh_CN]=为 Matrix 协议打造的客户端
|
|
||||||
Comment[zh_TW]=Matrix 通訊協定的用戶端
|
|
||||||
MimeType=x-scheme-handler/matrix;
|
MimeType=x-scheme-handler/matrix;
|
||||||
Exec=neochat %u
|
Exec=neochat %u
|
||||||
Terminal=false
|
Terminal=false
|
||||||
|
|||||||
577
po/ar/neochat.po
577
po/ar/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
571
po/az/neochat.po
571
po/az/neochat.po
File diff suppressed because it is too large
Load Diff
554
po/ca/neochat.po
554
po/ca/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
575
po/cs/neochat.po
575
po/cs/neochat.po
File diff suppressed because it is too large
Load Diff
562
po/da/neochat.po
562
po/da/neochat.po
File diff suppressed because it is too large
Load Diff
577
po/de/neochat.po
577
po/de/neochat.po
File diff suppressed because it is too large
Load Diff
576
po/el/neochat.po
576
po/el/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
579
po/eo/neochat.po
579
po/eo/neochat.po
File diff suppressed because it is too large
Load Diff
576
po/es/neochat.po
576
po/es/neochat.po
File diff suppressed because it is too large
Load Diff
572
po/eu/neochat.po
572
po/eu/neochat.po
File diff suppressed because it is too large
Load Diff
578
po/fi/neochat.po
578
po/fi/neochat.po
File diff suppressed because it is too large
Load Diff
588
po/fr/neochat.po
588
po/fr/neochat.po
File diff suppressed because it is too large
Load Diff
641
po/gl/neochat.po
641
po/gl/neochat.po
File diff suppressed because it is too large
Load Diff
644
po/hu/neochat.po
644
po/hu/neochat.po
File diff suppressed because it is too large
Load Diff
583
po/ia/neochat.po
583
po/ia/neochat.po
File diff suppressed because it is too large
Load Diff
581
po/id/neochat.po
581
po/id/neochat.po
File diff suppressed because it is too large
Load Diff
569
po/ie/neochat.po
569
po/ie/neochat.po
File diff suppressed because it is too large
Load Diff
587
po/it/neochat.po
587
po/it/neochat.po
File diff suppressed because it is too large
Load Diff
522
po/ja/neochat.po
522
po/ja/neochat.po
File diff suppressed because it is too large
Load Diff
554
po/ka/neochat.po
554
po/ka/neochat.po
File diff suppressed because it is too large
Load Diff
580
po/ko/neochat.po
580
po/ko/neochat.po
File diff suppressed because it is too large
Load Diff
522
po/lt/neochat.po
522
po/lt/neochat.po
File diff suppressed because it is too large
Load Diff
577
po/lv/neochat.po
577
po/lv/neochat.po
File diff suppressed because it is too large
Load Diff
556
po/nl/neochat.po
556
po/nl/neochat.po
File diff suppressed because it is too large
Load Diff
576
po/nn/neochat.po
576
po/nn/neochat.po
File diff suppressed because it is too large
Load Diff
571
po/pa/neochat.po
571
po/pa/neochat.po
File diff suppressed because it is too large
Load Diff
596
po/pl/neochat.po
596
po/pl/neochat.po
File diff suppressed because it is too large
Load Diff
581
po/pt/neochat.po
581
po/pt/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
573
po/ru/neochat.po
573
po/ru/neochat.po
File diff suppressed because it is too large
Load Diff
1176
po/sk/neochat.po
1176
po/sk/neochat.po
File diff suppressed because it is too large
Load Diff
554
po/sl/neochat.po
554
po/sl/neochat.po
File diff suppressed because it is too large
Load Diff
577
po/sv/neochat.po
577
po/sv/neochat.po
File diff suppressed because it is too large
Load Diff
592
po/ta/neochat.po
592
po/ta/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
585
po/tr/neochat.po
585
po/tr/neochat.po
File diff suppressed because it is too large
Load Diff
558
po/uk/neochat.po
558
po/uk/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -176,13 +176,14 @@ QQC2.Control {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
QQC2.ScrollView {
|
QQC2.ScrollView {
|
||||||
id: chatBarScrollView
|
id: chatBarScrollView
|
||||||
|
Layout.topMargin: Kirigami.Units.smallSpacing
|
||||||
|
Layout.bottomMargin: Kirigami.Units.smallSpacing
|
||||||
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||||
|
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumHeight: Kirigami.Units.gridUnit * 8
|
Layout.maximumHeight: Kirigami.Units.gridUnit * 8
|
||||||
|
Layout.minimumHeight: Kirigami.Units.gridUnit * 3
|
||||||
Layout.topMargin: Kirigami.Units.smallSpacing
|
|
||||||
Layout.bottomMargin: Kirigami.Units.smallSpacing
|
|
||||||
Layout.minimumHeight: Kirigami.Units.gridUnit * 2
|
|
||||||
|
|
||||||
// HACK: This is to stop the ScrollBar flickering on and off as the height is increased
|
// HACK: This is to stop the ScrollBar flickering on and off as the height is increased
|
||||||
QQC2.ScrollBar.vertical.policy: chatBarHeightAnimation.running && implicitHeight <= height ? QQC2.ScrollBar.AlwaysOff : QQC2.ScrollBar.AsNeeded
|
QQC2.ScrollBar.vertical.policy: chatBarHeightAnimation.running && implicitHeight <= height ? QQC2.ScrollBar.AlwaysOff : QQC2.ScrollBar.AsNeeded
|
||||||
@@ -320,12 +321,11 @@ QQC2.Control {
|
|||||||
id: actionsRow
|
id: actionsRow
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
Layout.bottomMargin: Kirigami.Units.smallSpacing * 1.5
|
Layout.bottomMargin: Kirigami.Units.smallSpacing * 4
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.actions
|
model: root.actions
|
||||||
delegate: QQC2.ToolButton {
|
delegate: QQC2.ToolButton {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
icon.name: modelData.isBusy ? "" : (modelData.icon.name.length > 0 ? modelData.icon.name : modelData.icon.source)
|
icon.name: modelData.isBusy ? "" : (modelData.icon.name.length > 0 ? modelData.icon.name : modelData.icon.source)
|
||||||
onClicked: modelData.trigger()
|
onClicked: modelData.trigger()
|
||||||
|
|
||||||
@@ -342,7 +342,6 @@ QQC2.Control {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateSizeHelper {
|
DelegateSizeHelper {
|
||||||
id: chatBarSizeHelper
|
id: chatBarSizeHelper
|
||||||
startBreakpoint: Kirigami.Units.gridUnit * 46
|
startBreakpoint: Kirigami.Units.gridUnit * 46
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ QQC2.ItemDelegate {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: root.emoji.startsWith("mxc") || root.isImage
|
visible: root.emoji.startsWith("mxc") || root.isImage
|
||||||
source: visible ? root.emoji : ""
|
source: visible ? root.emoji : ""
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ QQC2.ScrollView {
|
|||||||
|
|
||||||
Kirigami.PlaceholderMessage {
|
Kirigami.PlaceholderMessage {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
icon.name: root.stickers ? "stickers" : "preferences-desktop-emoticons"
|
||||||
text: root.stickers ? i18n("No stickers") : i18n("No emojis")
|
text: root.stickers ? i18n("No stickers") : i18n("No emojis")
|
||||||
visible: emojis.count === 0
|
visible: emojis.count === 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: root.categoryIconSize + QQC2.ScrollBar.horizontal.height
|
Layout.preferredHeight: root.categoryIconSize + QQC2.ScrollBar.horizontal.height
|
||||||
QQC2.ScrollBar.horizontal.height: QQC2.ScrollBar.horizontal.visible ? QQC2.ScrollBar.horizontal.implicitHeight : 0
|
QQC2.ScrollBar.horizontal.height: QQC2.ScrollBar.horizontal.visible ? QQC2.ScrollBar.horizontal.implicitHeight : 0
|
||||||
|
visible: categories.count !== 0
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: categories
|
id: categories
|
||||||
@@ -201,8 +202,13 @@ ColumnLayout {
|
|||||||
width: root.categoryIconSize
|
width: root.categoryIconSize
|
||||||
height: width
|
height: width
|
||||||
checked: stickerModel.packIndex === model.index
|
checked: stickerModel.packIndex === model.index
|
||||||
|
padding: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
source: model.avatarUrl
|
source: model.avatarUrl
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
}
|
}
|
||||||
QQC2.ToolTip.text: model.name
|
QQC2.ToolTip.text: model.name
|
||||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
@@ -23,7 +24,7 @@ ColumnLayout {
|
|||||||
model: root.connection.accountDataEventTypes
|
model: root.connection.accountDataEventTypes
|
||||||
delegate: FormCard.FormButtonDelegate {
|
delegate: FormCard.FormButtonDelegate {
|
||||||
text: modelData
|
text: modelData
|
||||||
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
|
onClicked: root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
|
||||||
sourceText: root.connection.accountDataJsonString(modelData)
|
sourceText: root.connection.accountDataJsonString(modelData)
|
||||||
}, {
|
}, {
|
||||||
title: i18nc("@title:window", "Event Source"),
|
title: i18nc("@title:window", "Event Source"),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
@@ -47,7 +48,7 @@ ColumnLayout {
|
|||||||
model: root.room.accountDataEventTypes
|
model: root.room.accountDataEventTypes
|
||||||
delegate: FormCard.FormButtonDelegate {
|
delegate: FormCard.FormButtonDelegate {
|
||||||
text: modelData
|
text: modelData
|
||||||
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
|
onClicked: root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
|
||||||
sourceText: root.room.roomAcountDataJson(text)
|
sourceText: root.room.roomAcountDataJson(text)
|
||||||
}, {
|
}, {
|
||||||
title: i18n("Event Source"),
|
title: i18n("Event Source"),
|
||||||
@@ -77,7 +78,7 @@ ColumnLayout {
|
|||||||
if (model.eventCount === 1) {
|
if (model.eventCount === 1) {
|
||||||
openEventSource(model.type, model.stateKey);
|
openEventSource(model.type, model.stateKey);
|
||||||
} else {
|
} else {
|
||||||
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'StateKeys'), {
|
root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'StateKeys'), {
|
||||||
room: root.room,
|
room: root.room,
|
||||||
eventType: model.type
|
eventType: model.type
|
||||||
}, {
|
}, {
|
||||||
@@ -89,7 +90,7 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function openEventSource(type: string, stateKey: string): void {
|
function openEventSource(type: string, stateKey: string): void {
|
||||||
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
|
onClicked: root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
|
||||||
model: stateModel,
|
model: stateModel,
|
||||||
allowEdit: true,
|
allowEdit: true,
|
||||||
room: root.room,
|
room: root.room,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ LoginStep {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
FormCard.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
|
textItem.wrapMode: Text.Wrap
|
||||||
text: i18n("Please wait while your messages are loaded from the server. This might take a little while.")
|
text: i18n("Please wait while your messages are loaded from the server. This might take a little while.")
|
||||||
}
|
}
|
||||||
FormCard.AbstractFormDelegate {
|
FormCard.AbstractFormDelegate {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import QtQuick.Layouts
|
|||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
|
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
import org.kde.neochat.settings
|
import org.kde.neochat.settings
|
||||||
@@ -90,11 +91,27 @@ Kirigami.Page {
|
|||||||
id: loadedAccounts
|
id: loadedAccounts
|
||||||
model: AccountRegistry
|
model: AccountRegistry
|
||||||
delegate: FormCard.FormButtonDelegate {
|
delegate: FormCard.FormButtonDelegate {
|
||||||
text: model.userId
|
id: delegate
|
||||||
|
|
||||||
|
required property string userId
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
|
text: QmlUtils.escapeString(connection.localUser.displayName)
|
||||||
|
description: connection.localUser.id
|
||||||
|
leadingPadding: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Controller.activeConnection = model.connection;
|
Controller.activeConnection = delegate.connection;
|
||||||
root.connectionChosen();
|
root.connectionChosen();
|
||||||
}
|
}
|
||||||
|
leading: KirigamiComponents.Avatar {
|
||||||
|
id: avatar
|
||||||
|
name: delegate.text
|
||||||
|
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||||
|
source: delegate.connection.localUser.avatarUrl.toString().length > 0 ? delegate.connection.makeMediaUrl(delegate.connection.localUser.avatarUrl) : ""
|
||||||
|
implicitWidth: Kirigami.Units.iconSizes.medium
|
||||||
|
implicitHeight: Kirigami.Units.iconSizes.medium
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Repeater {
|
Repeater {
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
|
|||||||
KAboutData about(QStringLiteral("neochat"),
|
KAboutData about(QStringLiteral("neochat"),
|
||||||
i18n("NeoChat"),
|
i18n("NeoChat"),
|
||||||
QStringLiteral(NEOCHAT_VERSION_STRING),
|
QStringLiteral(NEOCHAT_VERSION_STRING),
|
||||||
i18n("Matrix client"),
|
i18n("Chat on Matrix"),
|
||||||
KAboutLicense::GPL_V3,
|
KAboutLicense::GPL_V3,
|
||||||
i18n("© 2018-2020 Black Hat, 2020-2024 KDE Community"));
|
i18n("© 2018-2020 Black Hat, 2020-2024 KDE Community"));
|
||||||
about.addAuthor(i18n("Carl Schwan"),
|
about.addAuthor(i18n("Carl Schwan"),
|
||||||
|
|||||||
@@ -600,14 +600,19 @@ bool ActionsModel::handleQuickEditAction(NeoChatRoom *room, const QString &messa
|
|||||||
} else {
|
} else {
|
||||||
originalString = event->plainBody();
|
originalString = event->plainBody();
|
||||||
}
|
}
|
||||||
|
QString replaceId = event->id();
|
||||||
|
const auto eventRelation = event->relatesTo();
|
||||||
|
if (eventRelation && eventRelation->type == "m.replace"_L1) {
|
||||||
|
replaceId = eventRelation->eventId;
|
||||||
|
}
|
||||||
if (flags == "/g"_L1) {
|
if (flags == "/g"_L1) {
|
||||||
room->postHtmlMessage(messageText, originalString.replace(regex, replacement), event->msgtype(), {}, event->id());
|
room->postHtmlMessage(messageText, originalString.replace(regex, replacement), event->msgtype(), {}, replaceId);
|
||||||
} else {
|
} else {
|
||||||
room->postHtmlMessage(messageText,
|
room->postHtmlMessage(messageText,
|
||||||
originalString.replace(originalString.indexOf(regex), regex.size(), replacement),
|
originalString.replace(originalString.indexOf(regex), regex.size(), replacement),
|
||||||
event->msgtype(),
|
event->msgtype(),
|
||||||
{},
|
{},
|
||||||
event->id());
|
replaceId);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,13 +85,7 @@ QVariant CompletionModel::data(const QModelIndex &index, int role) const
|
|||||||
return m_filterModel->data(filterIndex, RoomListModel::CanonicalAliasRole);
|
return m_filterModel->data(filterIndex, RoomListModel::CanonicalAliasRole);
|
||||||
}
|
}
|
||||||
if (role == IconNameRole) {
|
if (role == IconNameRole) {
|
||||||
auto mediaId = m_filterModel->data(filterIndex, RoomListModel::AvatarRole).toString();
|
return m_filterModel->data(filterIndex, RoomListModel::AvatarRole).toString();
|
||||||
if (mediaId.isEmpty()) {
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
if (m_room) {
|
|
||||||
return m_room->connection()->makeMediaUrl(QUrl(QStringLiteral("mxc://%1").arg(mediaId)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_autoCompletionType == Emoji) {
|
if (m_autoCompletionType == Emoji) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ MessageContentModel::MessageContentModel(NeoChatRoom *room, const QString &event
|
|||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, m_room(room)
|
, m_room(room)
|
||||||
, m_eventId(eventId)
|
, m_eventId(eventId)
|
||||||
, m_isPending(isPending)
|
, m_currentState(isPending ? Pending : Unknown)
|
||||||
, m_isReply(isReply)
|
, m_isReply(isReply)
|
||||||
{
|
{
|
||||||
initializeModel();
|
initializeModel();
|
||||||
@@ -45,19 +45,27 @@ void MessageContentModel::initializeModel()
|
|||||||
Q_ASSERT(m_room != nullptr);
|
Q_ASSERT(m_room != nullptr);
|
||||||
Q_ASSERT(!m_eventId.isEmpty());
|
Q_ASSERT(!m_eventId.isEmpty());
|
||||||
|
|
||||||
connect(this, &MessageContentModel::eventUnavailable, this, &MessageContentModel::getEvent);
|
connect(m_room, &NeoChatRoom::pendingEventAdded, this, [this]() {
|
||||||
|
if (m_room != nullptr && m_currentState == Unknown) {
|
||||||
|
initializeEvent();
|
||||||
|
updateReplyModel();
|
||||||
|
resetModel();
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(m_room, &NeoChatRoom::pendingEventAboutToMerge, this, [this](Quotient::RoomEvent *serverEvent) {
|
connect(m_room, &NeoChatRoom::pendingEventAboutToMerge, this, [this](Quotient::RoomEvent *serverEvent) {
|
||||||
if (m_room != nullptr) {
|
if (m_room != nullptr) {
|
||||||
if (m_eventId == serverEvent->id() || m_eventId == serverEvent->transactionId()) {
|
if (m_eventId == serverEvent->id() || m_eventId == serverEvent->transactionId()) {
|
||||||
beginResetModel();
|
|
||||||
m_isPending = false;
|
|
||||||
m_eventId = serverEvent->id();
|
m_eventId = serverEvent->id();
|
||||||
initializeEvent();
|
|
||||||
endResetModel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(m_room, &NeoChatRoom::pendingEventMerged, this, [this]() {
|
||||||
|
if (m_room != nullptr && m_currentState == Pending) {
|
||||||
|
initializeEvent();
|
||||||
|
updateReplyModel();
|
||||||
|
resetModel();
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(m_room, &NeoChatRoom::addedMessages, this, [this](int fromIndex, int toIndex) {
|
connect(m_room, &NeoChatRoom::addedMessages, this, [this](int fromIndex, int toIndex) {
|
||||||
if (m_room != nullptr) {
|
if (m_room != nullptr) {
|
||||||
for (int i = fromIndex; i <= toIndex; i++) {
|
for (int i = fromIndex; i <= toIndex; i++) {
|
||||||
@@ -143,20 +151,33 @@ void MessageContentModel::initializeModel()
|
|||||||
});
|
});
|
||||||
|
|
||||||
initializeEvent();
|
initializeEvent();
|
||||||
updateReplyModel();
|
if (m_currentState == Available || m_currentState == Pending) {
|
||||||
|
updateReplyModel();
|
||||||
|
}
|
||||||
resetModel();
|
resetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageContentModel::initializeEvent()
|
void MessageContentModel::initializeEvent()
|
||||||
{
|
{
|
||||||
const auto event = m_room->getEvent(m_eventId);
|
if (m_currentState == UnAvailable) {
|
||||||
if (event == nullptr) {
|
|
||||||
Q_EMIT eventUnavailable();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto eventResult = m_room->getEvent(m_eventId);
|
||||||
|
if (eventResult.first == nullptr) {
|
||||||
|
if (m_currentState != Pending) {
|
||||||
|
getEvent();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (eventResult.second) {
|
||||||
|
m_currentState = Pending;
|
||||||
|
} else {
|
||||||
|
m_currentState = Available;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_eventSenderObject == nullptr) {
|
if (m_eventSenderObject == nullptr) {
|
||||||
auto senderId = event->senderId();
|
auto senderId = eventResult.first->senderId();
|
||||||
// A pending event might not have a sender ID set yet but in that case it must
|
// A pending event might not have a sender ID set yet but in that case it must
|
||||||
// be the local member.
|
// be the local member.
|
||||||
if (senderId.isEmpty()) {
|
if (senderId.isEmpty()) {
|
||||||
@@ -172,7 +193,6 @@ void MessageContentModel::getEvent()
|
|||||||
Quotient::connectUntil(m_room.get(), &NeoChatRoom::extraEventLoaded, this, [this](const QString &eventId) {
|
Quotient::connectUntil(m_room.get(), &NeoChatRoom::extraEventLoaded, this, [this](const QString &eventId) {
|
||||||
if (m_room != nullptr) {
|
if (m_room != nullptr) {
|
||||||
if (eventId == m_eventId) {
|
if (eventId == m_eventId) {
|
||||||
m_notFound = false;
|
|
||||||
initializeEvent();
|
initializeEvent();
|
||||||
updateReplyModel();
|
updateReplyModel();
|
||||||
resetModel();
|
resetModel();
|
||||||
@@ -184,7 +204,7 @@ void MessageContentModel::getEvent()
|
|||||||
Quotient::connectUntil(m_room.get(), &NeoChatRoom::extraEventNotFound, this, [this](const QString &eventId) {
|
Quotient::connectUntil(m_room.get(), &NeoChatRoom::extraEventNotFound, this, [this](const QString &eventId) {
|
||||||
if (m_room != nullptr) {
|
if (m_room != nullptr) {
|
||||||
if (eventId == m_eventId) {
|
if (eventId == m_eventId) {
|
||||||
m_notFound = true;
|
m_currentState = UnAvailable;
|
||||||
resetModel();
|
resetModel();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -237,7 +257,7 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
|
|||||||
const auto component = m_components[index.row()];
|
const auto component = m_components[index.row()];
|
||||||
|
|
||||||
const auto event = m_room->getEvent(m_eventId);
|
const auto event = m_room->getEvent(m_eventId);
|
||||||
if (event == nullptr) {
|
if (event.first == nullptr) {
|
||||||
if (role == DisplayRole) {
|
if (role == DisplayRole) {
|
||||||
if (m_isReply) {
|
if (m_isReply) {
|
||||||
return i18n("Loading reply");
|
return i18n("Loading reply");
|
||||||
@@ -252,7 +272,7 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (role == DisplayRole) {
|
if (role == DisplayRole) {
|
||||||
if (m_notFound || m_room->connection()->isIgnored(m_eventSenderId)) {
|
if (m_currentState == UnAvailable || m_room->connection()->isIgnored(m_eventSenderId)) {
|
||||||
Kirigami::Platform::PlatformTheme *theme =
|
Kirigami::Platform::PlatformTheme *theme =
|
||||||
static_cast<Kirigami::Platform::PlatformTheme *>(qmlAttachedPropertiesObject<Kirigami::Platform::PlatformTheme>(this, true));
|
static_cast<Kirigami::Platform::PlatformTheme *>(qmlAttachedPropertiesObject<Kirigami::Platform::PlatformTheme>(this, true));
|
||||||
|
|
||||||
@@ -276,7 +296,7 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
|
|||||||
if (!component.content.isEmpty()) {
|
if (!component.content.isEmpty()) {
|
||||||
return component.content;
|
return component.content;
|
||||||
}
|
}
|
||||||
return EventHandler::richBody(m_room, event);
|
return EventHandler::richBody(m_room, event.first);
|
||||||
}
|
}
|
||||||
if (role == ComponentTypeRole) {
|
if (role == ComponentTypeRole) {
|
||||||
return component.type;
|
return component.type;
|
||||||
@@ -285,53 +305,53 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
|
|||||||
return component.attributes;
|
return component.attributes;
|
||||||
}
|
}
|
||||||
if (role == EventIdRole) {
|
if (role == EventIdRole) {
|
||||||
return EventHandler::id(event);
|
return EventHandler::id(event.first);
|
||||||
}
|
}
|
||||||
if (role == TimeRole) {
|
if (role == TimeRole) {
|
||||||
const auto pendingIt = std::find_if(m_room->pendingEvents().cbegin(), m_room->pendingEvents().cend(), [event](const PendingEventItem &pendingEvent) {
|
const auto pendingIt = std::find_if(m_room->pendingEvents().cbegin(), m_room->pendingEvents().cend(), [event](const PendingEventItem &pendingEvent) {
|
||||||
return event->transactionId() == pendingEvent->transactionId();
|
return event.first->transactionId() == pendingEvent->transactionId();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto lastUpdated = pendingIt == m_room->pendingEvents().cend() ? QDateTime() : pendingIt->lastUpdated();
|
auto lastUpdated = pendingIt == m_room->pendingEvents().cend() ? QDateTime() : pendingIt->lastUpdated();
|
||||||
return EventHandler::time(event, m_isPending, lastUpdated);
|
return EventHandler::time(event.first, m_currentState == Pending, lastUpdated);
|
||||||
}
|
}
|
||||||
if (role == TimeStringRole) {
|
if (role == TimeStringRole) {
|
||||||
const auto pendingIt = std::find_if(m_room->pendingEvents().cbegin(), m_room->pendingEvents().cend(), [event](const PendingEventItem &pendingEvent) {
|
const auto pendingIt = std::find_if(m_room->pendingEvents().cbegin(), m_room->pendingEvents().cend(), [event](const PendingEventItem &pendingEvent) {
|
||||||
return event->transactionId() == pendingEvent->transactionId();
|
return event.first->transactionId() == pendingEvent->transactionId();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto lastUpdated = pendingIt == m_room->pendingEvents().cend() ? QDateTime() : pendingIt->lastUpdated();
|
auto lastUpdated = pendingIt == m_room->pendingEvents().cend() ? QDateTime() : pendingIt->lastUpdated();
|
||||||
return EventHandler::timeString(event, QStringLiteral("hh:mm"), m_isPending, lastUpdated);
|
return EventHandler::timeString(event.first, QStringLiteral("hh:mm"), m_currentState == Pending, lastUpdated);
|
||||||
}
|
}
|
||||||
if (role == AuthorRole) {
|
if (role == AuthorRole) {
|
||||||
return QVariant::fromValue<NeochatRoomMember *>(m_eventSenderObject.get());
|
return QVariant::fromValue<NeochatRoomMember *>(m_eventSenderObject.get());
|
||||||
}
|
}
|
||||||
if (role == MediaInfoRole) {
|
if (role == MediaInfoRole) {
|
||||||
return EventHandler::mediaInfo(m_room, event);
|
return EventHandler::mediaInfo(m_room, event.first);
|
||||||
}
|
}
|
||||||
if (role == FileTransferInfoRole) {
|
if (role == FileTransferInfoRole) {
|
||||||
return QVariant::fromValue(m_room->cachedFileTransferInfo(event));
|
return QVariant::fromValue(m_room->cachedFileTransferInfo(event.first));
|
||||||
}
|
}
|
||||||
if (role == ItineraryModelRole) {
|
if (role == ItineraryModelRole) {
|
||||||
return QVariant::fromValue<ItineraryModel *>(m_itineraryModel);
|
return QVariant::fromValue<ItineraryModel *>(m_itineraryModel);
|
||||||
}
|
}
|
||||||
if (role == LatitudeRole) {
|
if (role == LatitudeRole) {
|
||||||
return EventHandler::latitude(event);
|
return EventHandler::latitude(event.first);
|
||||||
}
|
}
|
||||||
if (role == LongitudeRole) {
|
if (role == LongitudeRole) {
|
||||||
return EventHandler::longitude(event);
|
return EventHandler::longitude(event.first);
|
||||||
}
|
}
|
||||||
if (role == AssetRole) {
|
if (role == AssetRole) {
|
||||||
return EventHandler::locationAssetType(event);
|
return EventHandler::locationAssetType(event.first);
|
||||||
}
|
}
|
||||||
if (role == PollHandlerRole) {
|
if (role == PollHandlerRole) {
|
||||||
return QVariant::fromValue<PollHandler *>(m_room->poll(m_eventId));
|
return QVariant::fromValue<PollHandler *>(m_room->poll(m_eventId));
|
||||||
}
|
}
|
||||||
if (role == ReplyEventIdRole) {
|
if (role == ReplyEventIdRole) {
|
||||||
return EventHandler::replyId(event);
|
return EventHandler::replyId(event.first);
|
||||||
}
|
}
|
||||||
if (role == ReplyAuthorRole) {
|
if (role == ReplyAuthorRole) {
|
||||||
return QVariant::fromValue(EventHandler::replyAuthor(m_room, event));
|
return QVariant::fromValue(EventHandler::replyAuthor(m_room, event.first));
|
||||||
}
|
}
|
||||||
if (role == ReplyContentModelRole) {
|
if (role == ReplyContentModelRole) {
|
||||||
return QVariant::fromValue<MessageContentModel *>(m_replyModel);
|
return QVariant::fromValue<MessageContentModel *>(m_replyModel);
|
||||||
@@ -387,18 +407,17 @@ QHash<int, QByteArray> MessageContentModel::roleNames() const
|
|||||||
|
|
||||||
void MessageContentModel::resetModel()
|
void MessageContentModel::resetModel()
|
||||||
{
|
{
|
||||||
const auto event = m_room->getEvent(m_eventId);
|
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_components.clear();
|
m_components.clear();
|
||||||
|
|
||||||
if (m_room->connection()->isIgnored(m_eventSenderId) || m_notFound) {
|
if (m_room->connection()->isIgnored(m_eventSenderId) || m_currentState == UnAvailable) {
|
||||||
m_components += MessageComponent{MessageComponentType::Text, QString(), {}};
|
m_components += MessageComponent{MessageComponentType::Text, QString(), {}};
|
||||||
endResetModel();
|
endResetModel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event == nullptr) {
|
const auto event = m_room->getEvent(m_eventId);
|
||||||
|
if (event.first == nullptr) {
|
||||||
m_components += MessageComponent{MessageComponentType::Loading, QString(), {}};
|
m_components += MessageComponent{MessageComponentType::Loading, QString(), {}};
|
||||||
endResetModel();
|
endResetModel();
|
||||||
return;
|
return;
|
||||||
@@ -431,19 +450,19 @@ void MessageContentModel::resetContent(bool isEditing, bool isThreading)
|
|||||||
QList<MessageComponent> MessageContentModel::messageContentComponents(bool isEditing, bool isThreading)
|
QList<MessageComponent> MessageContentModel::messageContentComponents(bool isEditing, bool isThreading)
|
||||||
{
|
{
|
||||||
const auto event = m_room->getEvent(m_eventId);
|
const auto event = m_room->getEvent(m_eventId);
|
||||||
if (event == nullptr) {
|
if (event.first == nullptr) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<MessageComponent> newComponents;
|
QList<MessageComponent> newComponents;
|
||||||
|
|
||||||
if (eventCast<const Quotient::RoomMessageEvent>(event)
|
if (eventCast<const Quotient::RoomMessageEvent>(event.first)
|
||||||
&& eventCast<const Quotient::RoomMessageEvent>(event)->rawMsgtype() == QStringLiteral("m.key.verification.request")) {
|
&& eventCast<const Quotient::RoomMessageEvent>(event.first)->rawMsgtype() == QStringLiteral("m.key.verification.request")) {
|
||||||
newComponents += MessageComponent{MessageComponentType::Verification, QString(), {}};
|
newComponents += MessageComponent{MessageComponentType::Verification, QString(), {}};
|
||||||
return newComponents;
|
return newComponents;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->isRedacted()) {
|
if (event.first->isRedacted()) {
|
||||||
newComponents += MessageComponent{MessageComponentType::Text, QString(), {}};
|
newComponents += MessageComponent{MessageComponentType::Text, QString(), {}};
|
||||||
return newComponents;
|
return newComponents;
|
||||||
}
|
}
|
||||||
@@ -455,7 +474,7 @@ QList<MessageComponent> MessageContentModel::messageContentComponents(bool isEdi
|
|||||||
if (isEditing) {
|
if (isEditing) {
|
||||||
newComponents += MessageComponent{MessageComponentType::ChatBar, QString(), {}};
|
newComponents += MessageComponent{MessageComponentType::ChatBar, QString(), {}};
|
||||||
} else {
|
} else {
|
||||||
newComponents.append(componentsForType(MessageComponentType::typeForEvent(*event)));
|
newComponents.append(componentsForType(MessageComponentType::typeForEvent(*event.first)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_room->urlPreviewEnabled()) {
|
if (m_room->urlPreviewEnabled()) {
|
||||||
@@ -463,7 +482,7 @@ QList<MessageComponent> MessageContentModel::messageContentComponents(bool isEdi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the event is already threaded the ThreadModel will handle displaying a chat bar.
|
// If the event is already threaded the ThreadModel will handle displaying a chat bar.
|
||||||
if (isThreading && !EventHandler::isThreaded(event)) {
|
if (isThreading && !EventHandler::isThreaded(event.first)) {
|
||||||
newComponents += MessageComponent{MessageComponentType::ChatBar, QString(), {}};
|
newComponents += MessageComponent{MessageComponentType::ChatBar, QString(), {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,11 +492,11 @@ QList<MessageComponent> MessageContentModel::messageContentComponents(bool isEdi
|
|||||||
void MessageContentModel::updateReplyModel()
|
void MessageContentModel::updateReplyModel()
|
||||||
{
|
{
|
||||||
const auto event = m_room->getEvent(m_eventId);
|
const auto event = m_room->getEvent(m_eventId);
|
||||||
if (event == nullptr || m_isReply) {
|
if (event.first == nullptr || m_isReply) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EventHandler::hasReply(event) || (EventHandler::isThreaded(event) && NeoChatConfig::self()->threads())) {
|
if (!EventHandler::hasReply(event.first) || (EventHandler::isThreaded(event.first) && NeoChatConfig::self()->threads())) {
|
||||||
if (m_replyModel) {
|
if (m_replyModel) {
|
||||||
delete m_replyModel;
|
delete m_replyModel;
|
||||||
}
|
}
|
||||||
@@ -488,7 +507,7 @@ void MessageContentModel::updateReplyModel()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_replyModel = new MessageContentModel(m_room, EventHandler::replyId(event), true, false, this);
|
m_replyModel = new MessageContentModel(m_room, EventHandler::replyId(event.first), true, false, this);
|
||||||
|
|
||||||
connect(m_replyModel, &MessageContentModel::eventUpdated, this, [this]() {
|
connect(m_replyModel, &MessageContentModel::eventUpdated, this, [this]() {
|
||||||
Q_EMIT dataChanged(index(0), index(0), {ReplyAuthorRole});
|
Q_EMIT dataChanged(index(0), index(0), {ReplyAuthorRole});
|
||||||
@@ -498,13 +517,13 @@ void MessageContentModel::updateReplyModel()
|
|||||||
QList<MessageComponent> MessageContentModel::componentsForType(MessageComponentType::Type type)
|
QList<MessageComponent> MessageContentModel::componentsForType(MessageComponentType::Type type)
|
||||||
{
|
{
|
||||||
const auto event = m_room->getEvent(m_eventId);
|
const auto event = m_room->getEvent(m_eventId);
|
||||||
if (event == nullptr) {
|
if (event.first == nullptr) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MessageComponentType::Text: {
|
case MessageComponentType::Text: {
|
||||||
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event);
|
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
|
||||||
auto body = EventHandler::rawMessageBody(*roomMessageEvent);
|
auto body = EventHandler::rawMessageBody(*roomMessageEvent);
|
||||||
return TextHandler().textComponents(body,
|
return TextHandler().textComponents(body,
|
||||||
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
||||||
@@ -515,11 +534,11 @@ QList<MessageComponent> MessageContentModel::componentsForType(MessageComponentT
|
|||||||
case MessageComponentType::File: {
|
case MessageComponentType::File: {
|
||||||
QList<MessageComponent> components;
|
QList<MessageComponent> components;
|
||||||
components += MessageComponent{MessageComponentType::File, QString(), {}};
|
components += MessageComponent{MessageComponentType::File, QString(), {}};
|
||||||
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event);
|
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
|
||||||
|
|
||||||
if (m_emptyItinerary) {
|
if (m_emptyItinerary) {
|
||||||
if (!m_isReply) {
|
if (!m_isReply) {
|
||||||
auto fileTransferInfo = m_room->cachedFileTransferInfo(event);
|
auto fileTransferInfo = m_room->cachedFileTransferInfo(event.first);
|
||||||
|
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef Q_OS_ANDROID
|
||||||
Q_ASSERT(roomMessageEvent->content() != nullptr && roomMessageEvent->has<EventContent::FileContent>());
|
Q_ASSERT(roomMessageEvent->content() != nullptr && roomMessageEvent->has<EventContent::FileContent>());
|
||||||
@@ -567,17 +586,24 @@ QList<MessageComponent> MessageContentModel::componentsForType(MessageComponentT
|
|||||||
case MessageComponentType::Image:
|
case MessageComponentType::Image:
|
||||||
case MessageComponentType::Audio:
|
case MessageComponentType::Audio:
|
||||||
case MessageComponentType::Video: {
|
case MessageComponentType::Video: {
|
||||||
if (!event->is<StickerEvent>()) {
|
if (!event.first->is<StickerEvent>()) {
|
||||||
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event);
|
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
|
||||||
QList<MessageComponent> components;
|
const auto fileContent = roomMessageEvent->get<EventContent::FileContentBase>();
|
||||||
components += MessageComponent{type, QString(), {}};
|
if (fileContent != nullptr) {
|
||||||
auto body = EventHandler::rawMessageBody(*roomMessageEvent);
|
const auto fileInfo = fileContent->commonInfo();
|
||||||
components += TextHandler().textComponents(body,
|
const auto body = EventHandler::rawMessageBody(*roomMessageEvent);
|
||||||
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
// Do not attach the description to the image, if it's the same as the original filename.
|
||||||
m_room,
|
if (fileInfo.originalName != body) {
|
||||||
roomMessageEvent,
|
QList<MessageComponent> components;
|
||||||
roomMessageEvent->isReplaced());
|
components += MessageComponent{type, QString(), {}};
|
||||||
return components;
|
components += TextHandler().textComponents(body,
|
||||||
|
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
||||||
|
m_room,
|
||||||
|
roomMessageEvent,
|
||||||
|
roomMessageEvent->isReplaced());
|
||||||
|
return components;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -635,7 +661,7 @@ QList<MessageComponent> MessageContentModel::addLinkPreviews(QList<MessageCompon
|
|||||||
|
|
||||||
void MessageContentModel::closeLinkPreview(int row)
|
void MessageContentModel::closeLinkPreview(int row)
|
||||||
{
|
{
|
||||||
if (row < 0 || row > m_components.size()) {
|
if (row < 0 || row >= m_components.size()) {
|
||||||
qWarning() << "closeLinkPreview() called with row" << row << "which does not exist. m_components.size() =" << m_components.size();
|
qWarning() << "closeLinkPreview() called with row" << row << "which does not exist. m_components.size() =" << m_components.size();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -645,6 +671,7 @@ void MessageContentModel::closeLinkPreview(int row)
|
|||||||
m_removedLinkPreviews += m_components[row].attributes["link"_ls].toUrl();
|
m_removedLinkPreviews += m_components[row].attributes["link"_ls].toUrl();
|
||||||
m_components.remove(row);
|
m_components.remove(row);
|
||||||
m_components.squeeze();
|
m_components.squeeze();
|
||||||
|
endResetModel();
|
||||||
resetContent();
|
resetContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -652,13 +679,13 @@ void MessageContentModel::closeLinkPreview(int row)
|
|||||||
void MessageContentModel::updateItineraryModel()
|
void MessageContentModel::updateItineraryModel()
|
||||||
{
|
{
|
||||||
const auto event = m_room->getEvent(m_eventId);
|
const auto event = m_room->getEvent(m_eventId);
|
||||||
if (m_room == nullptr || event == nullptr) {
|
if (m_room == nullptr || event.first == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event)) {
|
if (auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first)) {
|
||||||
if (roomMessageEvent->has<EventContent::FileContent>()) {
|
if (roomMessageEvent->has<EventContent::FileContent>()) {
|
||||||
auto filePath = m_room->cachedFileTransferInfo(event).localPath;
|
auto filePath = m_room->cachedFileTransferInfo(event.first).localPath;
|
||||||
if (filePath.isEmpty() && m_itineraryModel != nullptr) {
|
if (filePath.isEmpty() && m_itineraryModel != nullptr) {
|
||||||
delete m_itineraryModel;
|
delete m_itineraryModel;
|
||||||
m_itineraryModel = nullptr;
|
m_itineraryModel = nullptr;
|
||||||
|
|||||||
@@ -31,6 +31,14 @@ class MessageContentModel : public QAbstractListModel
|
|||||||
Q_PROPERTY(bool showAuthor READ showAuthor WRITE setShowAuthor NOTIFY showAuthorChanged)
|
Q_PROPERTY(bool showAuthor READ showAuthor WRITE setShowAuthor NOTIFY showAuthorChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum MessageState {
|
||||||
|
Unknown, /**< The message state is unknown. */
|
||||||
|
Pending, /**< The message is a new pending message which the server has not yet acknowledged. */
|
||||||
|
Available, /**< The message is available and acknowledged by the server. */
|
||||||
|
UnAvailable, /**< The message can't be retrieved either because it doesn't exist or is blocked. */
|
||||||
|
};
|
||||||
|
Q_ENUM(MessageState)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines the model roles.
|
* @brief Defines the model roles.
|
||||||
*/
|
*/
|
||||||
@@ -98,7 +106,6 @@ public:
|
|||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void showAuthorChanged();
|
void showAuthorChanged();
|
||||||
void eventUnavailable();
|
|
||||||
void eventUpdated();
|
void eventUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -107,10 +114,9 @@ private:
|
|||||||
QString m_eventSenderId;
|
QString m_eventSenderId;
|
||||||
std::unique_ptr<NeochatRoomMember> m_eventSenderObject = nullptr;
|
std::unique_ptr<NeochatRoomMember> m_eventSenderObject = nullptr;
|
||||||
|
|
||||||
bool m_isPending;
|
MessageState m_currentState = Unknown;
|
||||||
bool m_showAuthor = true;
|
bool m_showAuthor = true;
|
||||||
bool m_isReply;
|
bool m_isReply;
|
||||||
bool m_notFound = false;
|
|
||||||
|
|
||||||
void initializeModel();
|
void initializeModel();
|
||||||
void initializeEvent();
|
void initializeEvent();
|
||||||
|
|||||||
@@ -160,12 +160,21 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
|
|||||||
refreshLastUserEvents(i);
|
refreshLastUserEvents(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 0)
|
||||||
|
connect(m_currentRoom, &Room::pendingEventAdded, this, [this](const Quotient::RoomEvent *event) {
|
||||||
|
m_initialized = true;
|
||||||
|
createEventObjects(event, true);
|
||||||
|
beginInsertRows({}, 0, 0);
|
||||||
|
endInsertRows();
|
||||||
|
});
|
||||||
|
#else
|
||||||
connect(m_currentRoom, &Room::pendingEventAboutToAdd, this, [this](Quotient::RoomEvent *event) {
|
connect(m_currentRoom, &Room::pendingEventAboutToAdd, this, [this](Quotient::RoomEvent *event) {
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
createEventObjects(event);
|
createEventObjects(event, true);
|
||||||
beginInsertRows({}, 0, 0);
|
beginInsertRows({}, 0, 0);
|
||||||
});
|
});
|
||||||
connect(m_currentRoom, &Room::pendingEventAdded, this, &MessageEventModel::endInsertRows);
|
connect(m_currentRoom, &Room::pendingEventAdded, this, &MessageEventModel::endInsertRows);
|
||||||
|
#endif
|
||||||
connect(m_currentRoom, &Room::pendingEventAboutToMerge, this, [this](RoomEvent *, int i) {
|
connect(m_currentRoom, &Room::pendingEventAboutToMerge, this, [this](RoomEvent *, int i) {
|
||||||
Q_EMIT dataChanged(index(i, 0), index(i, 0), {IsPendingRole});
|
Q_EMIT dataChanged(index(i, 0), index(i, 0), {IsPendingRole});
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@@ -618,7 +627,7 @@ int MessageEventModel::eventIdToRow(const QString &eventID) const
|
|||||||
return it - m_currentRoom->messageEvents().rbegin() + timelineBaseIndex();
|
return it - m_currentRoom->messageEvents().rbegin() + timelineBaseIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageEventModel::createEventObjects(const Quotient::RoomEvent *event)
|
void MessageEventModel::createEventObjects(const Quotient::RoomEvent *event, bool isPending)
|
||||||
{
|
{
|
||||||
if (event == nullptr) {
|
if (event == nullptr) {
|
||||||
return;
|
return;
|
||||||
@@ -641,7 +650,7 @@ void MessageEventModel::createEventObjects(const Quotient::RoomEvent *event)
|
|||||||
|
|
||||||
if (!m_contentModels.contains(eventId) && !m_contentModels.contains(event->transactionId())) {
|
if (!m_contentModels.contains(eventId) && !m_contentModels.contains(event->transactionId())) {
|
||||||
if (!event->isStateEvent() || event->matrixType() == QStringLiteral("org.matrix.msc3672.beacon_info")) {
|
if (!event->isStateEvent() || event->matrixType() == QStringLiteral("org.matrix.msc3672.beacon_info")) {
|
||||||
m_contentModels[eventId] = std::unique_ptr<MessageContentModel>(new MessageContentModel(m_currentRoom, eventId));
|
m_contentModels[eventId] = std::unique_ptr<MessageContentModel>(new MessageContentModel(m_currentRoom, eventId, false, isPending));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ private:
|
|||||||
int refreshEventRoles(const QString &eventId, const QList<int> &roles = {});
|
int refreshEventRoles(const QString &eventId, const QList<int> &roles = {});
|
||||||
void moveReadMarker(const QString &toEventId);
|
void moveReadMarker(const QString &toEventId);
|
||||||
|
|
||||||
void createEventObjects(const Quotient::RoomEvent *event);
|
void createEventObjects(const Quotient::RoomEvent *event, bool isPending = false);
|
||||||
// Hack to ensure that we don't call endInsertRows when we haven't called beginInsertRows
|
// Hack to ensure that we don't call endInsertRows when we haven't called beginInsertRows
|
||||||
bool m_initialized = false;
|
bool m_initialized = false;
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
|||||||
return room->displayName().toHtmlEscaped();
|
return room->displayName().toHtmlEscaped();
|
||||||
}
|
}
|
||||||
if (role == AvatarRole) {
|
if (role == AvatarRole) {
|
||||||
return room->avatarMediaId();
|
return room->avatarMediaUrl();
|
||||||
}
|
}
|
||||||
if (role == CanonicalAliasRole) {
|
if (role == CanonicalAliasRole) {
|
||||||
return room->canonicalAlias();
|
return room->canonicalAlias();
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ QHash<int, QByteArray> RoomTreeModel::roleNames() const
|
|||||||
roles[IconRole] = "icon";
|
roles[IconRole] = "icon";
|
||||||
roles[AttentionRole] = "attention";
|
roles[AttentionRole] = "attention";
|
||||||
roles[FavouriteRole] = "favourite";
|
roles[FavouriteRole] = "favourite";
|
||||||
|
roles[RoomTypeRole] = "roomType";
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +324,7 @@ QVariant RoomTreeModel::data(const QModelIndex &index, int role) const
|
|||||||
return room->displayName();
|
return room->displayName();
|
||||||
}
|
}
|
||||||
if (role == AvatarRole) {
|
if (role == AvatarRole) {
|
||||||
return room->avatarMediaId();
|
return room->avatarMediaUrl();
|
||||||
}
|
}
|
||||||
if (role == CanonicalAliasRole) {
|
if (role == CanonicalAliasRole) {
|
||||||
return room->canonicalAlias();
|
return room->canonicalAlias();
|
||||||
@@ -385,6 +386,11 @@ QVariant RoomTreeModel::data(const QModelIndex &index, int role) const
|
|||||||
if (role == FavouriteRole) {
|
if (role == FavouriteRole) {
|
||||||
return room->isFavourite();
|
return room->isFavourite();
|
||||||
}
|
}
|
||||||
|
if (role == RoomTypeRole) {
|
||||||
|
if (room->creation()) {
|
||||||
|
return room->creation()->contentPart<QString>("type"_L1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public:
|
|||||||
IconRole,
|
IconRole,
|
||||||
AttentionRole, /**< Whether there are any notifications. */
|
AttentionRole, /**< Whether there are any notifications. */
|
||||||
FavouriteRole, /**< Whether the room is favourited. */
|
FavouriteRole, /**< Whether the room is favourited. */
|
||||||
|
RoomTypeRole, /**< The room's type. */
|
||||||
};
|
};
|
||||||
Q_ENUM(EventRoles)
|
Q_ENUM(EventRoles)
|
||||||
explicit RoomTreeModel(QObject *parent = nullptr);
|
explicit RoomTreeModel(QObject *parent = nullptr);
|
||||||
|
|||||||
@@ -157,6 +157,11 @@ bool SortFilterRoomTreeModel::filterAcceptsRow(int source_row, const QModelIndex
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide rooms with defined types, assuming that data-holding rooms have a defined type
|
||||||
|
if (!sourceModel()->data(index, RoomTreeModel::RoomTypeRole).toString().isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static auto config = NeoChatConfig::self();
|
static auto config = NeoChatConfig::self();
|
||||||
if (config->allRoomsInHome() && RoomManager::instance().currentSpace().isEmpty()) {
|
if (config->allRoomsInHome() && RoomManager::instance().currentSpace().isEmpty()) {
|
||||||
return acceptRoom;
|
return acceptRoom;
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ Action=Popup
|
|||||||
Name=Share
|
Name=Share
|
||||||
Name[ar]=شارك
|
Name[ar]=شارك
|
||||||
Name[ca]=Compartició
|
Name[ca]=Compartició
|
||||||
Name[ca@valencia]=Compartició
|
Name[ca@valencia]=Compartiu
|
||||||
Name[cs]=Sdílet
|
Name[cs]=Sdílet
|
||||||
Name[de]=Teilen
|
Name[de]=Teilen
|
||||||
Name[el]=Κοινοποίηση
|
Name[el]=Κοινοποίηση
|
||||||
|
|||||||
@@ -431,9 +431,9 @@ QDateTime NeoChatRoom::lastActiveTime()
|
|||||||
return messageEvents().rbegin()->get()->originTimestamp();
|
return messageEvents().rbegin()->get()->originTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NeoChatRoom::avatarMediaId() const
|
QUrl NeoChatRoom::avatarMediaUrl() const
|
||||||
{
|
{
|
||||||
if (const auto avatar = Room::avatarMediaId(); !avatar.isEmpty()) {
|
if (const auto avatar = Room::avatarUrl(); !avatar.isEmpty()) {
|
||||||
return avatar;
|
return avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ QString NeoChatRoom::avatarMediaId() const
|
|||||||
const auto directChatMembers = this->directChatMembers();
|
const auto directChatMembers = this->directChatMembers();
|
||||||
for (const auto member : directChatMembers) {
|
for (const auto member : directChatMembers) {
|
||||||
if (member != localMember()) {
|
if (member != localMember()) {
|
||||||
return member.avatarMediaId();
|
return member.avatarUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1749,25 +1749,31 @@ void NeoChatRoom::downloadEventFromServer(const QString &eventId)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const RoomEvent *NeoChatRoom::getEvent(const QString &eventId) const
|
std::pair<const Quotient::RoomEvent *, bool> NeoChatRoom::getEvent(const QString &eventId) const
|
||||||
{
|
{
|
||||||
if (eventId.isEmpty()) {
|
if (eventId.isEmpty()) {
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
const auto timelineIt = findInTimeline(eventId);
|
const auto timelineIt = findInTimeline(eventId);
|
||||||
if (timelineIt != historyEdge()) {
|
if (timelineIt != historyEdge()) {
|
||||||
return timelineIt->get();
|
return std::make_pair(timelineIt->get(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto pendingIt = findPendingEvent(eventId);
|
auto pendingIt = findPendingEvent(eventId);
|
||||||
if (pendingIt != pendingEvents().end()) {
|
if (pendingIt != pendingEvents().end()) {
|
||||||
return pendingIt->event();
|
return std::make_pair(pendingIt->event(), true);
|
||||||
|
}
|
||||||
|
// findPendingEvent() searches by transaction ID, we also need to check event ID.
|
||||||
|
for (const auto &event : pendingEvents()) {
|
||||||
|
if (event->id() == eventId || event->transactionId() == eventId) {
|
||||||
|
return std::make_pair(event.event(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto extraIt = std::find_if(m_extraEvents.begin(), m_extraEvents.end(), [eventId](const Quotient::event_ptr_tt<Quotient::RoomEvent> &event) {
|
auto extraIt = std::find_if(m_extraEvents.begin(), m_extraEvents.end(), [eventId](const Quotient::event_ptr_tt<Quotient::RoomEvent> &event) {
|
||||||
return event->id() == eventId;
|
return event->id() == eventId;
|
||||||
});
|
});
|
||||||
return extraIt != m_extraEvents.end() ? extraIt->get() : nullptr;
|
return std::make_pair(extraIt != m_extraEvents.end() ? extraIt->get() : nullptr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RoomEvent *NeoChatRoom::getReplyForEvent(const RoomEvent &event) const
|
const RoomEvent *NeoChatRoom::getReplyForEvent(const RoomEvent &event) const
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ class NeoChatRoom : public Quotient::Room
|
|||||||
Q_PROPERTY(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
Q_PROPERTY(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The avatar image to be used for the room.
|
* @brief The avatar image to be used for the room, as a mxc:// URL.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(QString avatarMediaId READ avatarMediaId NOTIFY avatarChanged STORED false)
|
Q_PROPERTY(QUrl avatarMediaUrl READ avatarMediaUrl NOTIFY avatarChanged STORED false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a RoomMember object for the other person in a direct chat.
|
* @brief Get a RoomMember object for the other person in a direct chat.
|
||||||
@@ -320,7 +320,7 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] bool readMarkerLoaded() const;
|
[[nodiscard]] bool readMarkerLoaded() const;
|
||||||
|
|
||||||
[[nodiscard]] QString avatarMediaId() const;
|
[[nodiscard]] QUrl avatarMediaUrl() const;
|
||||||
|
|
||||||
NeochatRoomMember *directChatRemoteMember();
|
NeochatRoomMember *directChatRemoteMember();
|
||||||
|
|
||||||
@@ -570,7 +570,7 @@ public:
|
|||||||
*
|
*
|
||||||
* The result will be nullptr if not found so needs to be managed.
|
* The result will be nullptr if not found so needs to be managed.
|
||||||
*/
|
*/
|
||||||
const Quotient::RoomEvent *getEvent(const QString &eventId) const;
|
std::pair<const Quotient::RoomEvent *, bool> getEvent(const QString &eventId) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the event that is being replied to. This includes events that were manually loaded using NeoChatRoom::loadReply.
|
* @brief Returns the event that is being replied to. This includes events that were manually loaded using NeoChatRoom::loadReply.
|
||||||
|
|||||||
@@ -153,15 +153,6 @@ QColor NeochatRoomMember::color() const
|
|||||||
return m_room->member(m_memberId).color();
|
return m_room->member(m_memberId).color();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NeochatRoomMember::avatarMediaId() const
|
|
||||||
{
|
|
||||||
if (m_room == nullptr || m_memberId.isEmpty()) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_room->member(m_memberId).avatarMediaId();
|
|
||||||
}
|
|
||||||
|
|
||||||
QUrl NeochatRoomMember::avatarUrl() const
|
QUrl NeochatRoomMember::avatarUrl() const
|
||||||
{
|
{
|
||||||
if (m_room == nullptr || m_memberId.isEmpty()) {
|
if (m_room == nullptr || m_memberId.isEmpty()) {
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ public:
|
|||||||
int hue() const;
|
int hue() const;
|
||||||
qreal hueF() const;
|
qreal hueF() const;
|
||||||
QColor color() const;
|
QColor color() const;
|
||||||
QString avatarMediaId() const;
|
|
||||||
QUrl avatarUrl() const;
|
QUrl avatarUrl() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class PollHandler : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("Use NeoChatRoom::poll")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The question for the poll.
|
* @brief The question for the poll.
|
||||||
@@ -91,7 +92,7 @@ Q_SIGNALS:
|
|||||||
void hasEndedChanged();
|
void hasEndedChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Quotient::PollStartEvent *m_pollStartEvent;
|
const Quotient::PollStartEvent *m_pollStartEvent = nullptr;
|
||||||
|
|
||||||
void updatePoll(Quotient::RoomEventsRange events);
|
void updatePoll(Quotient::RoomEventsRange events);
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
"Name[nn]": "Tobias Fella",
|
"Name[nn]": "Tobias Fella",
|
||||||
"Name[pl]": "Tobias Fella",
|
"Name[pl]": "Tobias Fella",
|
||||||
"Name[ru]": "Tobias Fella",
|
"Name[ru]": "Tobias Fella",
|
||||||
|
"Name[sk]": "Tobias Fella",
|
||||||
"Name[sl]": "Tobias Fella",
|
"Name[sl]": "Tobias Fella",
|
||||||
"Name[sv]": "Tobias Fella",
|
"Name[sv]": "Tobias Fella",
|
||||||
"Name[ta]": "டோபியாஸ் ஃபெல்லா",
|
"Name[ta]": "டோபியாஸ் ஃபெல்லா",
|
||||||
@@ -93,6 +94,7 @@
|
|||||||
"Name[nn]": "NeoChat",
|
"Name[nn]": "NeoChat",
|
||||||
"Name[pl]": "NeoChat",
|
"Name[pl]": "NeoChat",
|
||||||
"Name[ru]": "NeoChat",
|
"Name[ru]": "NeoChat",
|
||||||
|
"Name[sk]": "NeoChat",
|
||||||
"Name[sl]": "NeoChat",
|
"Name[sl]": "NeoChat",
|
||||||
"Name[sv]": "NeoChat",
|
"Name[sv]": "NeoChat",
|
||||||
"Name[ta]": "நியோச்சாட்",
|
"Name[ta]": "நியோச்சாட்",
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ QQC2.Menu {
|
|||||||
text: "https://matrix.to/#/" + root.connection.localUser.id,
|
text: "https://matrix.to/#/" + root.connection.localUser.id,
|
||||||
title: root.connection.localUser.displayName,
|
title: root.connection.localUser.displayName,
|
||||||
subtitle: root.connection.localUser.id,
|
subtitle: root.connection.localUser.id,
|
||||||
avatarSource: root.connection.makeMediaUrl(root.connection.localUser.avatarUrl)
|
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||||
|
avatarSource: root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : ""
|
||||||
});
|
});
|
||||||
if (typeof root.closeDialog === "function") {
|
if (typeof root.closeDialog === "function") {
|
||||||
root.closeDialog();
|
root.closeDialog();
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ Kirigami.Dialog {
|
|||||||
width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
||||||
height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
||||||
}
|
}
|
||||||
source: userDelegate.connection.localUser.avatarMediaId ? userDelegate.connection.makeMediaUrl("mxc://" + userDelegate.connection.localUser.avatarMediaId) : ""
|
source: userDelegate.connection.localUser.avatarUrl.toString().length > 0 ? userDelegate.connection.makeMediaUrl(userDelegate.connection.localUser.avatarUrl) : ""
|
||||||
name: userDelegate.connection.localUser.displayName ?? userDelegate.connection.localUser.id
|
name: userDelegate.connection.localUser.displayName ?? userDelegate.connection.localUser.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ QQC2.ItemDelegate {
|
|||||||
required property NeoChatRoom currentRoom
|
required property NeoChatRoom currentRoom
|
||||||
required property bool categoryVisible
|
required property bool categoryVisible
|
||||||
required property string filterText
|
required property string filterText
|
||||||
required property string avatar
|
required property url avatar
|
||||||
required property string displayName
|
required property string displayName
|
||||||
|
|
||||||
topPadding: Kirigami.Units.largeSpacing
|
topPadding: Kirigami.Units.largeSpacing
|
||||||
@@ -32,7 +32,7 @@ QQC2.ItemDelegate {
|
|||||||
visible: root.categoryVisible || filterText.length > 0
|
visible: root.categoryVisible || filterText.length > 0
|
||||||
|
|
||||||
contentItem: KirigamiComponents.Avatar {
|
contentItem: KirigamiComponents.Avatar {
|
||||||
source: root.avatar ? root.currentRoom.connection.makeMediaUrl("mxc://" + root.avatar) : ""
|
source: root.avatar
|
||||||
name: root.displayName
|
name: root.displayName
|
||||||
|
|
||||||
sourceSize {
|
sourceSize {
|
||||||
|
|||||||
@@ -27,38 +27,17 @@ Loader {
|
|||||||
Component {
|
Component {
|
||||||
id: regularMenu
|
id: regularMenu
|
||||||
QQC2.Menu {
|
QQC2.Menu {
|
||||||
QQC2.MenuItem {
|
|
||||||
text: room.isFavourite ? i18n("Remove from Favorites") : i18n("Add to Favorites")
|
|
||||||
icon.name: room.isFavourite ? "bookmark-remove" : "bookmark-new"
|
|
||||||
onTriggered: room.isFavourite ? room.removeTag("m.favourite") : room.addTag("m.favourite", 1.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
QQC2.MenuItem {
|
|
||||||
text: room.isLowPriority ? i18n("Reprioritize") : i18n("Deprioritize")
|
|
||||||
icon.name: room.isLowPriority ? "arrow-up-symbolic" : "arrow-down-symbolic"
|
|
||||||
onTriggered: room.isLowPriority ? room.removeTag("m.lowpriority") : room.addTag("m.lowpriority", 1.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Mark as Read")
|
text: i18n("Mark as Read")
|
||||||
icon.name: "checkmark"
|
icon.name: "checkmark"
|
||||||
|
enabled: room.notificationCount > 0
|
||||||
onTriggered: room.markAllMessagesAsRead()
|
onTriggered: room.markAllMessagesAsRead()
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.MenuItem {
|
QQC2.MenuSeparator {}
|
||||||
text: room.isDirectChat() ? i18nc("@action:inmenu", "Copy user's Matrix ID to Clipboard") : i18nc("@action:inmenu", "Copy Address to Clipboard")
|
|
||||||
icon.name: "edit-copy"
|
|
||||||
onTriggered: if (room.isDirectChat()) {
|
|
||||||
Clipboard.saveText(room.directChatRemoteMember.id);
|
|
||||||
} else if (room.canonicalAlias.length === 0) {
|
|
||||||
Clipboard.saveText(room.id);
|
|
||||||
} else {
|
|
||||||
Clipboard.saveText(room.canonicalAlias);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QQC2.Menu {
|
QQC2.Menu {
|
||||||
title: i18n("Notification State")
|
title: i18nc("@action:inmenu", "Notifications")
|
||||||
icon.name: "notifications"
|
icon.name: "notifications"
|
||||||
|
|
||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
@@ -107,6 +86,32 @@ Loader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QQC2.MenuItem {
|
||||||
|
text: room.isFavourite ? i18n("Remove from Favorites") : i18n("Add to Favorites")
|
||||||
|
icon.name: room.isFavourite ? "rating" : "rating-unrated"
|
||||||
|
onTriggered: room.isFavourite ? room.removeTag("m.favourite") : room.addTag("m.favourite", 1.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.MenuItem {
|
||||||
|
text: room.isLowPriority ? i18n("Reprioritize") : i18n("Deprioritize")
|
||||||
|
icon.name: room.isLowPriority ? "arrow-up-symbolic" : "arrow-down-symbolic"
|
||||||
|
onTriggered: room.isLowPriority ? room.removeTag("m.lowpriority") : room.addTag("m.lowpriority", 1.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.MenuSeparator {}
|
||||||
|
|
||||||
|
QQC2.MenuItem {
|
||||||
|
text: room.isDirectChat() ? i18nc("@action:inmenu", "Copy user's Matrix ID to Clipboard") : i18nc("@action:inmenu", "Copy Address to Clipboard")
|
||||||
|
icon.name: "edit-copy"
|
||||||
|
onTriggered: if (room.isDirectChat()) {
|
||||||
|
Clipboard.saveText(room.directChatRemoteMember.id);
|
||||||
|
} else if (room.canonicalAlias.length === 0) {
|
||||||
|
Clipboard.saveText(room.id);
|
||||||
|
} else {
|
||||||
|
Clipboard.saveText(room.canonicalAlias);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18nc("@action:inmenu", "Room Settings")
|
text: i18nc("@action:inmenu", "Room Settings")
|
||||||
icon.name: 'settings-configure-symbolic'
|
icon.name: 'settings-configure-symbolic'
|
||||||
@@ -163,7 +168,7 @@ Loader {
|
|||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: Kirigami.Units.largeSpacing
|
||||||
KirigamiComponents.Avatar {
|
KirigamiComponents.Avatar {
|
||||||
id: avatar
|
id: avatar
|
||||||
source: room.avatarMediaId ? root.connection.makeMediaUrl("mxc://" + room.avatarMediaId) : ""
|
source: room.avatarMediaUrl
|
||||||
name: room.displayName
|
name: room.displayName
|
||||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
|
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
|
||||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import Qt.labs.qmlmodels
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.components as KirigamiComponents
|
import org.kde.kirigamiaddons.components as KirigamiComponents
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
@@ -177,10 +178,25 @@ Loader {
|
|||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.actions
|
model: root.actions
|
||||||
QQC2.MenuItem {
|
DelegateChooser {
|
||||||
visible: modelData.visible
|
role: "separator"
|
||||||
action: modelData
|
DelegateChoice {
|
||||||
onClicked: root.item.close()
|
roleValue: true
|
||||||
|
|
||||||
|
QQC2.MenuSeparator {
|
||||||
|
visible: modelData.visible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DelegateChoice {
|
||||||
|
roleValue: false
|
||||||
|
|
||||||
|
QQC2.MenuItem {
|
||||||
|
visible: modelData.visible
|
||||||
|
action: modelData
|
||||||
|
onClicked: root.item.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QQC2.Menu {
|
QQC2.Menu {
|
||||||
@@ -341,15 +357,30 @@ Loader {
|
|||||||
id: listViewAction
|
id: listViewAction
|
||||||
model: root.actions
|
model: root.actions
|
||||||
|
|
||||||
FormCard.FormButtonDelegate {
|
DelegateChooser {
|
||||||
icon.name: modelData.icon.name
|
role: "separator"
|
||||||
icon.color: modelData.icon.color ?? undefined
|
DelegateChoice {
|
||||||
enabled: modelData.enabled
|
roleValue: true
|
||||||
visible: modelData.visible
|
|
||||||
text: modelData.text
|
FormCard.FormDelegateSeparator {
|
||||||
onClicked: {
|
visible: modelData.visible
|
||||||
modelData.triggered();
|
}
|
||||||
root.item.close();
|
}
|
||||||
|
|
||||||
|
DelegateChoice {
|
||||||
|
roleValue: false
|
||||||
|
|
||||||
|
FormCard.FormButtonDelegate {
|
||||||
|
icon.name: modelData.icon.name
|
||||||
|
icon.color: modelData.icon.color ?? undefined
|
||||||
|
enabled: modelData.enabled
|
||||||
|
visible: modelData.visible
|
||||||
|
text: modelData.text
|
||||||
|
onClicked: {
|
||||||
|
modelData.triggered();
|
||||||
|
root.item.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
contentItem: KirigamiComponents.Avatar {
|
contentItem: KirigamiComponents.Avatar {
|
||||||
name: root.room ? root.room.displayName : ""
|
name: root.room ? root.room.displayName : ""
|
||||||
source: root.room ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : ""
|
source: root.room ? root.room.avatarMediaUrl : ""
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: root.room.usesEncryption
|
visible: root.room.usesEncryption
|
||||||
|
|||||||
@@ -42,30 +42,36 @@ DelegateContextMenu {
|
|||||||
* Each action will be instantiated as a single line in the menu.
|
* Each action will be instantiated as a single line in the menu.
|
||||||
*/
|
*/
|
||||||
property list<Kirigami.Action> actions: [
|
property list<Kirigami.Action> actions: [
|
||||||
|
DelegateContextMenu.ReplyMessageAction {},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Open Externally")
|
separator: true
|
||||||
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18nc("@action:inmenu", "Open Image")
|
||||||
icon.name: "document-open"
|
icon.name: "document-open"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
currentRoom.openEventMediaExternally(root.eventId);
|
currentRoom.openEventMediaExternally(root.eventId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Save As")
|
text: i18nc("@action:inmenu", "Save Image…")
|
||||||
icon.name: "document-save"
|
icon.name: "document-save"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
var dialog = saveAsDialog.createObject(QQC2.Overlay.overlay);
|
var dialog = saveAsDialog.createObject(QQC2.Overlay.overlay);
|
||||||
|
dialog.selectedFile = currentRoom.fileNameToDownload(eventId);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(eventId);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DelegateContextMenu.ReplyMessageAction {},
|
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Copy")
|
text: i18nc("@action:inmenu", "Copy Image")
|
||||||
icon.name: "edit-copy"
|
icon.name: "edit-copy"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
currentRoom.copyEventMedia(root.eventId);
|
currentRoom.copyEventMedia(root.eventId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
separator: true
|
||||||
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
visible: author.id === currentRoom.localMember.id || currentRoom.canSendState("redact")
|
visible: author.id === currentRoom.localMember.id || currentRoom.canSendState("redact")
|
||||||
text: i18n("Remove")
|
text: i18n("Remove")
|
||||||
@@ -88,7 +94,13 @@ DelegateContextMenu {
|
|||||||
},
|
},
|
||||||
DelegateContextMenu.ReportMessageAction {},
|
DelegateContextMenu.ReportMessageAction {},
|
||||||
DelegateContextMenu.ShowUserAction {},
|
DelegateContextMenu.ShowUserAction {},
|
||||||
DelegateContextMenu.ViewSourceAction {}
|
Kirigami.Action {
|
||||||
|
separator: true
|
||||||
|
visible: viewSourceAction.visible
|
||||||
|
},
|
||||||
|
DelegateContextMenu.ViewSourceAction {
|
||||||
|
id: viewSourceAction
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ Labs.MenuBar {
|
|||||||
}
|
}
|
||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
text: i18nc("menu", "About KDE")
|
text: i18nc("menu", "About KDE")
|
||||||
onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutKDE"))
|
onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutKDEPage"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ColumnLayout {
|
|||||||
Layout.preferredHeight: Kirigami.Units.iconSizes.large
|
Layout.preferredHeight: Kirigami.Units.iconSizes.large
|
||||||
|
|
||||||
name: root.room ? root.room.displayName : ""
|
name: root.room ? root.room.displayName : ""
|
||||||
source: root.room ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : ""
|
source: root.room ? root.room.avatarMediaUrl : ""
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: room.usesEncryption
|
visible: room.usesEncryption
|
||||||
@@ -75,6 +75,7 @@ ColumnLayout {
|
|||||||
textFormat: TextEdit.PlainText
|
textFormat: TextEdit.PlainText
|
||||||
visible: root.room && root.room.canonicalAlias
|
visible: root.room && root.room.canonicalAlias
|
||||||
text: root.room && root.room.canonicalAlias ? root.room.canonicalAlias : ""
|
text: root.room && root.room.canonicalAlias ? root.room.canonicalAlias : ""
|
||||||
|
color: Kirigami.Theme.disabledTextColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QQC2.AbstractButton {
|
QQC2.AbstractButton {
|
||||||
@@ -92,7 +93,7 @@ ColumnLayout {
|
|||||||
text: barcode.content,
|
text: barcode.content,
|
||||||
title: root.room ? root.room.displayName : "",
|
title: root.room ? root.room.displayName : "",
|
||||||
subtitle: root.room ? root.room.id : "",
|
subtitle: root.room ? root.room.id : "",
|
||||||
avatarSource: root.room && root.room.avatarMediaId ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : ""
|
avatarSource: root.room ? root.room.avatarMediaUrl : ""
|
||||||
});
|
});
|
||||||
map.open();
|
map.open();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import QtQuick.Layouts
|
|||||||
import QtCore as Core
|
import QtCore as Core
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
|
||||||
import org.kde.kquickimageeditor as KQuickImageEditor
|
import org.kde.kquickimageeditor as KQuickImageEditor
|
||||||
|
|
||||||
Kirigami.Page {
|
Kirigami.Page {
|
||||||
@@ -168,10 +167,11 @@ Kirigami.Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: KirigamiComponents.Banner {
|
footer: Kirigami.InlineMessage {
|
||||||
id: msg
|
id: msg
|
||||||
type: Kirigami.MessageType.Error
|
type: Kirigami.MessageType.Error
|
||||||
showCloseButton: true
|
showCloseButton: true
|
||||||
visible: false
|
visible: false
|
||||||
|
position: Kirigami.InlineMessage.Position.Header
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ DelegateContextMenu {
|
|||||||
},
|
},
|
||||||
DelegateContextMenu.ReplyMessageAction {},
|
DelegateContextMenu.ReplyMessageAction {},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18nc("@action:inmenu As in 'Forward this message'", "Forward")
|
text: i18nc("@action:inmenu As in 'Forward this message'", "Forward…")
|
||||||
icon.name: "mail-forward-symbolic"
|
icon.name: "mail-forward-symbolic"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let page = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ChooseRoomDialog'), {
|
let page = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ChooseRoomDialog'), {
|
||||||
@@ -59,21 +59,33 @@ DelegateContextMenu {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
separator: true
|
||||||
|
},
|
||||||
DelegateContextMenu.RemoveMessageAction {},
|
DelegateContextMenu.RemoveMessageAction {},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Copy")
|
text: i18nc("@action:inmenu", "Copy Text")
|
||||||
icon.name: "edit-copy"
|
icon.name: "edit-copy"
|
||||||
onTriggered: Clipboard.saveText(root.selectedText.length > 0 ? root.selectedText : root.plainText)
|
onTriggered: Clipboard.saveText(root.selectedText.length > 0 ? root.selectedText : root.plainText)
|
||||||
},
|
},
|
||||||
DelegateContextMenu.ReportMessageAction {},
|
|
||||||
DelegateContextMenu.ShowUserAction {},
|
|
||||||
DelegateContextMenu.ViewSourceAction {},
|
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Copy Link")
|
text: i18nc("@action:inmenu", "Copy Message Link")
|
||||||
icon.name: "edit-copy"
|
icon.name: "edit-copy"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
Clipboard.saveText("https://matrix.to/#/" + currentRoom.id + "/" + root.eventId);
|
Clipboard.saveText("https://matrix.to/#/" + currentRoom.id + "/" + root.eventId);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
separator: true
|
||||||
|
},
|
||||||
|
DelegateContextMenu.ReportMessageAction {},
|
||||||
|
DelegateContextMenu.ShowUserAction {},
|
||||||
|
Kirigami.Action {
|
||||||
|
separator: true
|
||||||
|
visible: viewSourceAction.visible
|
||||||
|
},
|
||||||
|
DelegateContextMenu.ViewSourceAction {
|
||||||
|
id: viewSourceAction
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,12 +104,14 @@ Components.AlbumMaximizeComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onOpened: forceActiveFocus()
|
||||||
|
|
||||||
onItemRightClicked: RoomManager.viewEventMenu(root.currentEventId, root.currentRoom)
|
onItemRightClicked: RoomManager.viewEventMenu(root.currentEventId, root.currentRoom)
|
||||||
|
|
||||||
onSaveItem: {
|
onSaveItem: {
|
||||||
var dialog = saveAsDialog.createObject(QQC2.Overlay.overlay);
|
var dialog = saveAsDialog.createObject(QQC2.Overlay.overlay);
|
||||||
|
dialog.selectedFile = currentRoom.fileNameToDownload(root.currentEventId);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(root.currentEventId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ Components.AbstractMaximizeComponent {
|
|||||||
|
|
||||||
required property string text
|
required property string text
|
||||||
property color avatarColor
|
property color avatarColor
|
||||||
required property string avatarSource
|
required property url avatarSource
|
||||||
|
|
||||||
|
onOpened: forceActiveFocus()
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequences: [StandardKey.Cancel]
|
sequences: [StandardKey.Cancel]
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ Kirigami.Dialog {
|
|||||||
FormCard.AbstractFormDelegate {
|
FormCard.AbstractFormDelegate {
|
||||||
background: null
|
background: null
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
spacing: Kirigami.Units.largeSpacing * 4
|
spacing: Kirigami.Units.largeSpacing
|
||||||
Avatar {
|
Avatar {
|
||||||
source: root.connection.makeMediaUrl(SpaceHierarchyCache.recommendedSpaceAvatar)
|
source: SpaceHierarchyCache.recommendedSpaceAvatar.toString().length > 0 ? root.connection.makeMediaUrl(SpaceHierarchyCache.recommendedSpaceAvatar) : 0
|
||||||
name: SpaceHierarchyCache.recommendedSpaceDisplayName
|
name: SpaceHierarchyCache.recommendedSpaceDisplayName
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
@@ -51,6 +51,7 @@ Kirigami.Dialog {
|
|||||||
FormCard.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
FormCard.FormButtonDelegate {
|
FormCard.FormButtonDelegate {
|
||||||
text: i18nc("@action:button", "Join")
|
text: i18nc("@action:button", "Join")
|
||||||
|
icon.name: "list-add-symbolic"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
SpaceHierarchyCache.recommendedSpaceHidden = true;
|
SpaceHierarchyCache.recommendedSpaceHidden = true;
|
||||||
RoomManager.resolveResource(SpaceHierarchyCache.recommendedSpaceId, "join");
|
RoomManager.resolveResource(SpaceHierarchyCache.recommendedSpaceId, "join");
|
||||||
@@ -58,6 +59,7 @@ Kirigami.Dialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FormCard.FormButtonDelegate {
|
FormCard.FormButtonDelegate {
|
||||||
|
icon.name: "mail-thread-ignored-symbolic"
|
||||||
text: i18nc("@action:button", "Ignore")
|
text: i18nc("@action:button", "Ignore")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
SpaceHierarchyCache.recommendedSpaceHidden = true;
|
SpaceHierarchyCache.recommendedSpaceHidden = true;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Delegates.RoundedItemDelegate {
|
|||||||
required property bool hasHighlightNotifications
|
required property bool hasHighlightNotifications
|
||||||
required property NeoChatRoom currentRoom
|
required property NeoChatRoom currentRoom
|
||||||
required property NeoChatConnection connection
|
required property NeoChatConnection connection
|
||||||
required property string avatar
|
required property url avatar
|
||||||
required property string subtitleText
|
required property string subtitleText
|
||||||
required property string displayName
|
required property string displayName
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ Delegates.RoundedItemDelegate {
|
|||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
AvatarNotification {
|
AvatarNotification {
|
||||||
source: root.avatar ? root.connection.makeMediaUrl("mxc://" + root.avatar) : ""
|
source: root.avatar
|
||||||
name: root.displayName
|
name: root.displayName
|
||||||
visible: NeoChatConfig.showAvatarInRoomDrawer
|
visible: NeoChatConfig.showAvatarInRoomDrawer
|
||||||
implicitHeight: Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2)
|
implicitHeight: Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2)
|
||||||
|
|||||||
@@ -99,8 +99,11 @@ Kirigami.OverlayDrawer {
|
|||||||
Layout.preferredHeight: pageStack.globalToolBar.preferredHeight
|
Layout.preferredHeight: pageStack.globalToolBar.preferredHeight
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
Kirigami.Heading {
|
Kirigami.Heading {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||||
text: drawerItemLoader.item ? drawerItemLoader.item.title : ""
|
text: drawerItemLoader.item ? drawerItemLoader.item.title : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,13 +39,16 @@ QQC2.ScrollView {
|
|||||||
/**
|
/**
|
||||||
* @brief The title that should be displayed for this component if available.
|
* @brief The title that should be displayed for this component if available.
|
||||||
*/
|
*/
|
||||||
readonly property string title: root.room.isSpace ? i18nc("@action:title", "Space Members") : i18nc("@action:title", "Room information")
|
readonly property string title: root.room.isSpace ? i18nc("@action:title", "Space Members") : i18nc("@action:title", "Room Information")
|
||||||
|
|
||||||
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
|
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
|
||||||
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: userList
|
id: userList
|
||||||
|
topMargin: Kirigami.Units.largeSpacing
|
||||||
|
leftMargin: Kirigami.Units.largeSpacing
|
||||||
|
rightMargin: Kirigami.Units.largeSpacing
|
||||||
header: ColumnLayout {
|
header: ColumnLayout {
|
||||||
id: columnLayout
|
id: columnLayout
|
||||||
|
|
||||||
@@ -57,7 +60,6 @@ QQC2.ScrollView {
|
|||||||
Loader {
|
Loader {
|
||||||
active: true
|
active: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Kirigami.Units.smallSpacing
|
|
||||||
visible: !root.room.isSpace
|
visible: !root.room.isSpace
|
||||||
sourceComponent: root.room.isDirectChat() ? directChatDrawerHeader : groupChatDrawerHeader
|
sourceComponent: root.room.isDirectChat() ? directChatDrawerHeader : groupChatDrawerHeader
|
||||||
onItemChanged: if (item) {
|
onItemChanged: if (item) {
|
||||||
@@ -133,7 +135,7 @@ QQC2.ScrollView {
|
|||||||
Delegates.RoundedItemDelegate {
|
Delegates.RoundedItemDelegate {
|
||||||
id: leaveButton
|
id: leaveButton
|
||||||
icon.name: "arrow-left-symbolic"
|
icon.name: "arrow-left-symbolic"
|
||||||
text: i18nc("@action:button", "Leave this room")
|
text: root.room.isSpace ? i18nc("@action:button", "Leave this space") : i18nc("@action:button", "Leave this room")
|
||||||
activeFocusOnTab: true
|
activeFocusOnTab: true
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -209,7 +211,7 @@ QQC2.ScrollView {
|
|||||||
section.delegate: Kirigami.ListSectionHeader {
|
section.delegate: Kirigami.ListSectionHeader {
|
||||||
required property string section
|
required property string section
|
||||||
|
|
||||||
width: ListView.view.width
|
width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
|
||||||
text: section
|
text: section
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,11 +221,12 @@ QQC2.ScrollView {
|
|||||||
required property int index
|
required property int index
|
||||||
required property string name
|
required property string name
|
||||||
required property string userId
|
required property string userId
|
||||||
required property string avatar
|
required property url avatar
|
||||||
required property int powerLevel
|
required property int powerLevel
|
||||||
required property string powerLevelString
|
required property string powerLevelString
|
||||||
|
|
||||||
implicitHeight: Kirigami.Units.gridUnit * 2
|
implicitHeight: Kirigami.Units.gridUnit * 2
|
||||||
|
width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
|
||||||
|
|
||||||
text: name
|
text: name
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import QtQuick.Controls as QQC2
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
|
|
||||||
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kitemmodels
|
import org.kde.kitemmodels
|
||||||
|
|
||||||
@@ -99,11 +98,12 @@ Kirigami.Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header: KirigamiComponents.Banner {
|
header: Kirigami.InlineMessage {
|
||||||
id: banner
|
id: banner
|
||||||
|
|
||||||
showCloseButton: true
|
showCloseButton: true
|
||||||
visible: false
|
visible: false
|
||||||
|
position: Kirigami.InlineMessage.Position.Header
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
@@ -253,7 +253,6 @@ Kirigami.Page {
|
|||||||
messageComponentType: messageComponentType,
|
messageComponentType: messageComponentType,
|
||||||
plainText: plainText,
|
plainText: plainText,
|
||||||
htmlText: htmlText,
|
htmlText: htmlText,
|
||||||
isThread: isThread
|
|
||||||
});
|
});
|
||||||
contextMenu.open();
|
contextMenu.open();
|
||||||
}
|
}
|
||||||
@@ -265,7 +264,6 @@ Kirigami.Page {
|
|||||||
plainText: plainText,
|
plainText: plainText,
|
||||||
mimeType: mimeType,
|
mimeType: mimeType,
|
||||||
progressInfo: progressInfo,
|
progressInfo: progressInfo,
|
||||||
isThread: isThread
|
|
||||||
});
|
});
|
||||||
contextMenu.open();
|
contextMenu.open();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ QQC2.Control {
|
|||||||
id: spaceDelegate
|
id: spaceDelegate
|
||||||
|
|
||||||
required property string displayName
|
required property string displayName
|
||||||
required property string avatar
|
required property url avatar
|
||||||
required property string roomId
|
required property string roomId
|
||||||
required property var currentRoom
|
required property var currentRoom
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ QQC2.Control {
|
|||||||
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
|
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
text: displayName
|
text: displayName
|
||||||
source: avatar ? root.connection.makeMediaUrl("mxc://" + avatar) : ""
|
source: avatar
|
||||||
|
|
||||||
notificationCount: spaceDelegate.currentRoom.childrenNotificationCount
|
notificationCount: spaceDelegate.currentRoom.childrenNotificationCount
|
||||||
notificationHighlight: spaceDelegate.currentRoom.childrenHaveHighlightNotifications
|
notificationHighlight: spaceDelegate.currentRoom.childrenHaveHighlightNotifications
|
||||||
@@ -219,7 +219,7 @@ QQC2.Control {
|
|||||||
visible: SpaceHierarchyCache.recommendedSpaceId.length > 0 && !root.connection.room(SpaceHierarchyCache.recommendedSpaceId) && !SpaceHierarchyCache.recommendedSpaceHidden
|
visible: SpaceHierarchyCache.recommendedSpaceId.length > 0 && !root.connection.room(SpaceHierarchyCache.recommendedSpaceId) && !SpaceHierarchyCache.recommendedSpaceHidden
|
||||||
|
|
||||||
text: i18nc("Join <name of a space>", "Join %1", SpaceHierarchyCache.recommendedSpaceDisplayName)
|
text: i18nc("Join <name of a space>", "Join %1", SpaceHierarchyCache.recommendedSpaceDisplayName)
|
||||||
source: SpaceHierarchyCache.recommendedSpaceAvatar.length > 0 ? root.connection.makeMediaUrl(SpaceHierarchyCache.recommendedSpaceAvatar) : ""
|
source: SpaceHierarchyCache.recommendedSpaceAvatar.toString().length > 0 ? root.connection.makeMediaUrl(SpaceHierarchyCache.recommendedSpaceAvatar) : ""
|
||||||
onSelected: {
|
onSelected: {
|
||||||
recommendedSpaceDialogComponent.createObject(QQC2.Overlay.overlay, {
|
recommendedSpaceDialogComponent.createObject(QQC2.Overlay.overlay, {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ ColumnLayout {
|
|||||||
onClicked: _private.createRoom(root.currentRoom.id)
|
onClicked: _private.createRoom(root.currentRoom.id)
|
||||||
}
|
}
|
||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
text: i18nc("@button", "Leave the space")
|
text: i18nc("@action:button", "Leave this space")
|
||||||
icon.name: "go-previous"
|
icon.name: "go-previous"
|
||||||
onClicked: RoomManager.leaveRoom(root.currentRoom)
|
onClicked: RoomManager.leaveRoom(root.currentRoom)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ Loader {
|
|||||||
|
|
||||||
KirigamiComponents.Avatar {
|
KirigamiComponents.Avatar {
|
||||||
id: avatar
|
id: avatar
|
||||||
source: room.avatarMediaId ? root.room.connection.makeMediaUrl("mxc://" + room.avatarMediaId) : ""
|
source: room.avatarMediaUrl
|
||||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
|
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
|
||||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import QtQuick.Layouts
|
|||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
@@ -20,11 +19,12 @@ FormCard.FormCardPage {
|
|||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
|
|
||||||
header: KirigamiComponents.Banner {
|
header: Kirigami.InlineMessage {
|
||||||
id: banner
|
id: banner
|
||||||
showCloseButton: true
|
showCloseButton: true
|
||||||
visible: false
|
visible: false
|
||||||
type: Kirigami.MessageType.Error
|
type: Kirigami.MessageType.Error
|
||||||
|
position: Kirigami.InlineMessage.Position.Header
|
||||||
}
|
}
|
||||||
|
|
||||||
property SSSSHandler ssssHandler: SSSSHandler {
|
property SSSSHandler ssssHandler: SSSSHandler {
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ Kirigami.Dialog {
|
|||||||
QQC2.AbstractButton {
|
QQC2.AbstractButton {
|
||||||
Layout.minimumHeight: avatar.height * 0.75
|
Layout.minimumHeight: avatar.height * 0.75
|
||||||
Layout.maximumHeight: avatar.height * 1.5
|
Layout.maximumHeight: avatar.height * 1.5
|
||||||
|
Layout.maximumWidth: avatar.height * 1.5
|
||||||
|
|
||||||
contentItem: Barcode {
|
contentItem: Barcode {
|
||||||
id: barcode
|
id: barcode
|
||||||
barcodeType: Barcode.QRCode
|
barcodeType: Barcode.QRCode
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ RowLayout {
|
|||||||
Layout.topMargin: Kirigami.Units.smallSpacing
|
Layout.topMargin: Kirigami.Units.smallSpacing
|
||||||
Layout.bottomMargin: Kirigami.Units.smallSpacing
|
Layout.bottomMargin: Kirigami.Units.smallSpacing
|
||||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||||
Layout.minimumHeight: bottomEdge ? Kirigami.Units.gridUnit * 2 : -1
|
Layout.minimumHeight: bottomEdge ? Kirigami.Units.gridUnit * 3 : -1
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
@@ -37,14 +37,15 @@ RowLayout {
|
|||||||
}
|
}
|
||||||
KirigamiComponents.AvatarButton {
|
KirigamiComponents.AvatarButton {
|
||||||
id: accountButton
|
id: accountButton
|
||||||
readonly property string mediaId: root.connection.localUser.avatarMediaId
|
readonly property url avatarUrl: root.connection.localUser.avatarUrl
|
||||||
|
|
||||||
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
||||||
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
||||||
Layout.leftMargin: Kirigami.Units.largeSpacing
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
text: i18n("Edit this account")
|
text: i18n("Edit this account")
|
||||||
source: mediaId ? root.connection.makeMediaUrl("mxc://" + mediaId) : ""
|
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||||
|
source: avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(avatarUrl) : ""
|
||||||
name: root.connection.localUser.displayName
|
name: root.connection.localUser.displayName
|
||||||
|
|
||||||
activeFocusOnTab: true
|
activeFocusOnTab: true
|
||||||
|
|||||||
@@ -134,16 +134,15 @@ void RoomManager::activateUserModel()
|
|||||||
m_userListModel->activate();
|
m_userListModel->activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
UriResolveResult RoomManager::resolveResource(const Uri &uri)
|
|
||||||
{
|
|
||||||
return UriResolverBase::visitResource(m_connection, uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RoomManager::resolveResource(const QString &idOrUri, const QString &action)
|
void RoomManager::resolveResource(const QString &idOrUri, const QString &action)
|
||||||
{
|
{
|
||||||
Uri uri{idOrUri};
|
resolveResource(Uri{idOrUri}, action);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RoomManager::resolveResource(Uri uri, const QString &action)
|
||||||
|
{
|
||||||
if (!uri.isValid()) {
|
if (!uri.isValid()) {
|
||||||
Q_EMIT showMessage(MessageType::Warning, i18n("Malformed or empty Matrix id<br />%1 is not a correct Matrix identifier", idOrUri));
|
Q_EMIT showMessage(MessageType::Warning, i18n("Malformed or empty Matrix id<br />%1 is not a correct Matrix identifier", uri.toDisplayString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +236,6 @@ void RoomManager::loadInitialRoom()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_isMobile) {
|
if (m_isMobile) {
|
||||||
// We still need to remember the last space on mobile
|
|
||||||
setCurrentSpace(m_lastSpaceConfig.readEntry(m_connection->userId(), QString()), false);
|
setCurrentSpace(m_lastSpaceConfig.readEntry(m_connection->userId(), QString()), false);
|
||||||
// We don't want to open a room on startup on mobile
|
// We don't want to open a room on startup on mobile
|
||||||
return;
|
return;
|
||||||
@@ -260,6 +258,7 @@ void RoomManager::openRoomForActiveConnection()
|
|||||||
setCurrentSpace({}, false);
|
setCurrentSpace({}, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setCurrentSpace(m_lastSpaceConfig.readEntry(m_connection->userId(), QString()), false);
|
||||||
const auto &lastRoom = m_lastRoomConfig.readEntry(m_connection->userId(), QString());
|
const auto &lastRoom = m_lastRoomConfig.readEntry(m_connection->userId(), QString());
|
||||||
if (lastRoom.isEmpty() || !m_connection->room(lastRoom)) {
|
if (lastRoom.isEmpty() || !m_connection->room(lastRoom)) {
|
||||||
setCurrentRoom({});
|
setCurrentRoom({});
|
||||||
@@ -267,7 +266,6 @@ void RoomManager::openRoomForActiveConnection()
|
|||||||
m_currentRoom = nullptr;
|
m_currentRoom = nullptr;
|
||||||
resolveResource(lastRoom);
|
resolveResource(lastRoom);
|
||||||
}
|
}
|
||||||
setCurrentSpace(m_lastSpaceConfig.readEntry(m_connection->userId(), QString()), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UriResolveResult RoomManager::visitUser(User *user, const QString &action)
|
UriResolveResult RoomManager::visitUser(User *user, const QString &action)
|
||||||
@@ -315,7 +313,9 @@ void RoomManager::visitRoom(Room *r, const QString &eventId)
|
|||||||
|
|
||||||
// It's important that we compare room *objects* here, not just room *ids*, since we need to deal with the object changing when going invite -> joined
|
// It's important that we compare room *objects* here, not just room *ids*, since we need to deal with the object changing when going invite -> joined
|
||||||
if (m_currentRoom && m_currentRoom == room) {
|
if (m_currentRoom && m_currentRoom == room) {
|
||||||
Q_EMIT goToEvent(eventId);
|
if (!eventId.isEmpty()) {
|
||||||
|
Q_EMIT goToEvent(eventId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setCurrentRoom(room->id());
|
setCurrentRoom(room->id());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,16 +168,6 @@ public:
|
|||||||
UserListModel *userListModel() const;
|
UserListModel *userListModel() const;
|
||||||
Q_INVOKABLE void activateUserModel();
|
Q_INVOKABLE void activateUserModel();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Resolve the given URI resource.
|
|
||||||
*
|
|
||||||
* @note It's actually Quotient::UriResolverBase::visitResource() but with Q_INVOKABLE
|
|
||||||
* and the connection grabbed from RoomManager.
|
|
||||||
*
|
|
||||||
* @sa Quotient::UriResolverBase::visitResource()
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE UriResolveResult resolveResource(const Uri &uri);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Resolve the given resource.
|
* @brief Resolve the given resource.
|
||||||
*
|
*
|
||||||
@@ -188,6 +178,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE void resolveResource(const QString &idOrUri, const QString &action = {});
|
Q_INVOKABLE void resolveResource(const QString &idOrUri, const QString &action = {});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Resolve the given resource URI.
|
||||||
|
*
|
||||||
|
* @note It's actually Quotient::UriResolverBase::visitResource() but with Q_INVOKABLE
|
||||||
|
* and the connection grabbed from RoomManager.
|
||||||
|
*
|
||||||
|
* @sa Quotient::UriResolverBase::visitResource()
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void resolveResource(Uri uri, const QString &action = {});
|
||||||
|
|
||||||
bool hasOpenRoom() const;
|
bool hasOpenRoom() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user