Compare commits
89 Commits
work/yeetk
...
v23.04.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a829b6c991 | ||
|
|
05a6d055b4 | ||
|
|
64f8df4dd2 | ||
|
|
8dcc231bdc | ||
|
|
5efe5cbb88 | ||
|
|
d2f8392ea2 | ||
|
|
57d79bf3fa | ||
|
|
13a573c7f6 | ||
|
|
64a1de8729 | ||
|
|
669ad9f6e2 | ||
|
|
269e29244a | ||
|
|
0b6da7b799 | ||
|
|
6eee09a560 | ||
|
|
2ad5a593b4 | ||
|
|
970ff95fd0 | ||
|
|
5a1a3fbd06 | ||
|
|
9493530b9c | ||
|
|
ec76df5e47 | ||
|
|
095c1fa4c3 | ||
|
|
41874701e6 | ||
|
|
58de466ad5 | ||
|
|
5800180836 | ||
|
|
2b2a864041 | ||
|
|
90399930ec | ||
|
|
8c4ac46a69 | ||
|
|
31951db498 | ||
|
|
fd593bb483 | ||
|
|
1243aef243 | ||
|
|
41ce874f77 | ||
|
|
4d69b70e02 | ||
|
|
b5a46b35f8 | ||
|
|
33ab3fd921 | ||
|
|
357d418cb4 | ||
|
|
76d3484a1e | ||
|
|
aef86017b2 | ||
|
|
40358cba85 | ||
|
|
3ee6877b15 | ||
|
|
e7a0d90746 | ||
|
|
484188c4e1 | ||
|
|
3e967e53bf | ||
|
|
c2f1e0de53 | ||
|
|
69a1d5477e | ||
|
|
a8f29de87a | ||
|
|
275a4f9222 | ||
|
|
95f4c5b9e1 | ||
|
|
d7412c965c | ||
|
|
a94dfde7f7 | ||
|
|
6c7e12c471 | ||
|
|
9949ba8f6d | ||
|
|
2c3ce1e88b | ||
|
|
33533a75bd | ||
|
|
8c6671265c | ||
|
|
bfa643557d | ||
|
|
2b0f6a1d4d | ||
|
|
0e8deee005 | ||
|
|
fe60d11ba3 | ||
|
|
e9d3862537 | ||
|
|
e03b2e9adf | ||
|
|
566743bc19 | ||
|
|
a3b4f05e2c | ||
|
|
977e9bbf99 | ||
|
|
ad11a509aa | ||
|
|
abbe68f9ab | ||
|
|
b7b0749cd8 | ||
|
|
f8ae06f8a7 | ||
|
|
9946ba008b | ||
|
|
376916212d | ||
|
|
1ea6ffe416 | ||
|
|
2d99ae0404 | ||
|
|
88eeed74da | ||
|
|
0032d417ac | ||
|
|
bd9fb097e3 | ||
|
|
ecd7a5edff | ||
|
|
d3f0902835 | ||
|
|
6eb258f8a3 | ||
|
|
dff908edd2 | ||
|
|
7e06606cbd | ||
|
|
f78f92cd0f | ||
|
|
c4fdfa22d9 | ||
|
|
3e5d1429f7 | ||
|
|
76b5463dac | ||
|
|
8b26a9f45f | ||
|
|
da1c664f94 | ||
|
|
498cfedfea | ||
|
|
8983129520 | ||
|
|
1c8acb2acd | ||
|
|
53fa4be4d8 | ||
|
|
bf30152e33 | ||
|
|
d86c61ac8a |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,4 +10,3 @@ kate.project.ctags.*
|
||||
*.user
|
||||
.flatpak-builder/
|
||||
.idea/
|
||||
cmake-build-*
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
include:
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/reuse-lint.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android-qt6.yml
|
||||
# - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android-qt6.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows.yml
|
||||
|
||||
@@ -11,7 +11,6 @@ Dependencies:
|
||||
'frameworks/kconfig': '@stable'
|
||||
'frameworks/syntax-highlighting': '@stable'
|
||||
'frameworks/kitemmodels': '@stable'
|
||||
'frameworks/kquickcharts': '@stable'
|
||||
'frameworks/knotifications': '@stable'
|
||||
'libraries/kquickimageeditor': '@stable'
|
||||
'frameworks/sonnet': '@stable'
|
||||
@@ -39,7 +38,6 @@ Dependencies:
|
||||
'frameworks/kconfig': '@latest-kf6'
|
||||
'frameworks/syntax-highlighting': '@latest-kf6'
|
||||
'frameworks/kitemmodels': '@latest-kf6'
|
||||
'frameworks/kquickcharts': '@latest-kf6'
|
||||
'frameworks/knotifications': '@latest-kf6'
|
||||
'libraries/kquickimageeditor': '@latest-kf6'
|
||||
'frameworks/sonnet': '@latest-kf6'
|
||||
@@ -59,4 +57,4 @@ Dependencies:
|
||||
'frameworks/kdbusaddons': '@latest-kf6'
|
||||
|
||||
Options:
|
||||
require-passing-tests-on: [ 'Linux/Qt5', 'FreeBSD', 'Windows' ]
|
||||
require-passing-tests-on: [ 'Linux/Qt5', 'FreeBSD', 'Windows/Qt5' ]
|
||||
|
||||
@@ -8,8 +8,8 @@ cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# KDE Applications version, managed by release script.
|
||||
set(RELEASE_SERVICE_VERSION_MAJOR "23")
|
||||
set(RELEASE_SERVICE_VERSION_MINOR "07")
|
||||
set(RELEASE_SERVICE_VERSION_MICRO "70")
|
||||
set(RELEASE_SERVICE_VERSION_MINOR "04")
|
||||
set(RELEASE_SERVICE_VERSION_MICRO "2")
|
||||
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
||||
|
||||
project(NeoChat VERSION ${RELEASE_SERVICE_VERSION})
|
||||
@@ -68,6 +68,12 @@ set_package_properties(KF${QT_MAJOR_VERSION}Kirigami2 PROPERTIES
|
||||
)
|
||||
find_package(KF${QT_MAJOR_VERSION}KirigamiAddons 0.7.2 REQUIRED)
|
||||
|
||||
find_package(Qt${QT_MAJOR_VERSION}Keychain)
|
||||
set_package_properties(Qt${QT_MAJOR_VERSION}Keychain PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Secure storage of account secrets"
|
||||
)
|
||||
|
||||
if(ANDROID)
|
||||
find_package(OpenSSL)
|
||||
set_package_properties(OpenSSL PROPERTIES
|
||||
@@ -87,7 +93,7 @@ if (NOT ANDROID AND NOT WIN32 AND NOT APPLE)
|
||||
find_package(KF${QT_MAJOR_VERSION}DBusAddons ${KF_MIN_VERSION} REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Quotient 0.7)
|
||||
find_package(Quotient 0.6)
|
||||
set_package_properties(Quotient PROPERTIES
|
||||
TYPE REQUIRED
|
||||
DESCRIPTION "Qt wrapper around Matrix API"
|
||||
@@ -105,7 +111,6 @@ set_package_properties(cmark PROPERTIES
|
||||
|
||||
ecm_find_qmlmodule(org.kde.kquickimageeditor 1.0)
|
||||
ecm_find_qmlmodule(org.kde.kitemmodels 1.0)
|
||||
ecm_find_qmlmodule(org.kde.quickcharts 1.0)
|
||||
|
||||
find_package(KQuickImageEditor COMPONENTS)
|
||||
set_package_properties(KQuickImageEditor PROPERTIES
|
||||
@@ -125,9 +130,13 @@ set_package_properties(KF${QT_MAJOR_VERSION}DocTools PROPERTIES DESCRIPTION
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
|
||||
find_package(Sqlite3)
|
||||
|
||||
if(NOT Quotient_VERSION_MINOR GREATER 6)
|
||||
cmake_policy(SET CMP0063 OLD)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
find_package(Sqlite3)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/version.gradle.in ${CMAKE_BINARY_DIR}/version.gradle)
|
||||
endif()
|
||||
|
||||
@@ -141,7 +150,7 @@ install(FILES org.kde.neochat.tray.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/h
|
||||
add_definitions(-DQT_NO_FOREACH)
|
||||
|
||||
add_subdirectory(src)
|
||||
if (BUILD_TESTING)
|
||||
if (BUILD_TESTING AND Quotient_VERSION_MINOR GREATER 6)
|
||||
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} NO_MODULE COMPONENTS Test)
|
||||
add_subdirectory(autotests)
|
||||
endif()
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "texthandler.h"
|
||||
|
||||
#include <qnamespace.h>
|
||||
#include <connection.h>
|
||||
#include <quotient_common.h>
|
||||
#include <syncdata.h>
|
||||
|
||||
@@ -49,8 +49,7 @@ private Q_SLOTS:
|
||||
void receiveStripReply();
|
||||
void receivePlainTextIn();
|
||||
|
||||
void receiveRichInPlainOut_data();
|
||||
void receiveRichInPlainOut();
|
||||
void recieveRichInPlainOut();
|
||||
void receivePlainStripHtml();
|
||||
void receivePlainStripMarkup();
|
||||
void receiveStripNewlines();
|
||||
@@ -60,11 +59,11 @@ private Q_SLOTS:
|
||||
void receiveRichtextIn();
|
||||
void receiveRichMxcUrl();
|
||||
void receiveRichPlainUrl();
|
||||
void receiveRichEmote();
|
||||
void receiveRichEdited_data();
|
||||
void receiveRichEdited();
|
||||
|
||||
void receiveLineSeparator();
|
||||
};
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
void TextHandlerTest::initTestCase()
|
||||
{
|
||||
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
||||
@@ -149,44 +148,7 @@ void TextHandlerTest::initTestCase()
|
||||
"sender": "@example:example.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 1232
|
||||
}
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"body": "/me This is an emote.",
|
||||
"format": "org.matrix.custom.html",
|
||||
"formatted_body": "This is an emote.",
|
||||
"msgtype": "m.emote"
|
||||
},
|
||||
"event_id": "$153273582443PhrSn:example.org",
|
||||
"origin_server_ts": 1532735824654,
|
||||
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
|
||||
"sender": "@example:example.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 1231
|
||||
}
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"body": "tested",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"event_id": "$zrCiBxBnqqTn0Z5FY78qSZAszno_w8nJJXzfBULG-3E",
|
||||
"origin_server_ts": 1680948575928,
|
||||
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
|
||||
"sender": "@example:example.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 1747776,
|
||||
"m.relations": {
|
||||
"m.replace": {
|
||||
"event_id": "$UX0PlpyI7vYO32iHMuuYEP7ECMh4sX3XLGiB2SwM4mQ",
|
||||
"origin_server_ts": 1680948580992,
|
||||
"sender": "@example:example.org"
|
||||
}
|
||||
}
|
||||
"age": 1235
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -197,6 +159,7 @@ void TextHandlerTest::initTestCase()
|
||||
SyncRoomData roomData(QStringLiteral("@bob:kde.org"), JoinState::Join, json.object());
|
||||
room->update(std::move(roomData));
|
||||
}
|
||||
#endif
|
||||
|
||||
void TextHandlerTest::allowedAttributes()
|
||||
{
|
||||
@@ -348,24 +311,15 @@ void TextHandlerTest::receiveStripReply()
|
||||
QCOMPARE(testTextHandler.handleRecievePlainText(), testOutputString);
|
||||
}
|
||||
|
||||
void TextHandlerTest::receiveRichInPlainOut_data()
|
||||
void TextHandlerTest::recieveRichInPlainOut()
|
||||
{
|
||||
QTest::addColumn<QString>("testInputString");
|
||||
QTest::addColumn<QString>("testOutputString");
|
||||
|
||||
QTest::newRow("ampersand") << QStringLiteral("a & b") << QStringLiteral("a & b");
|
||||
QTest::newRow("quote") << QStringLiteral(""a and b"") << QStringLiteral("\"a and b\"");
|
||||
}
|
||||
|
||||
void TextHandlerTest::receiveRichInPlainOut()
|
||||
{
|
||||
QFETCH(QString, testInputString);
|
||||
QFETCH(QString, testOutputString);
|
||||
const QString testInputString = QStringLiteral("a & b");
|
||||
const QString testOutputString = QStringLiteral("a & b");
|
||||
|
||||
TextHandler testTextHandler;
|
||||
testTextHandler.setData(testInputString);
|
||||
|
||||
QCOMPARE(testTextHandler.handleRecievePlainText(Qt::RichText), testOutputString);
|
||||
QCOMPARE(testTextHandler.handleRecievePlainText(), testOutputString);
|
||||
}
|
||||
|
||||
void TextHandlerTest::receivePlainTextIn()
|
||||
@@ -471,6 +425,7 @@ void TextHandlerTest::receiveRichtextIn()
|
||||
QCOMPARE(testTextHandler.handleRecieveRichText(), testOutputString);
|
||||
}
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
void TextHandlerTest::receiveRichMxcUrl()
|
||||
{
|
||||
const QString testInputString = QStringLiteral(
|
||||
@@ -486,8 +441,9 @@ void TextHandlerTest::receiveRichMxcUrl()
|
||||
TextHandler testTextHandler;
|
||||
testTextHandler.setData(testInputString);
|
||||
|
||||
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::RichText, room, room->messageEvents().at(0).get()), testOutputString);
|
||||
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::RichText, room, room->messageEvents().back().get()), testOutputString);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For when your rich input string has a plain text url left in.
|
||||
@@ -544,43 +500,12 @@ void TextHandlerTest::receiveRichPlainUrl()
|
||||
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::RichText), testOutputStringMxId);
|
||||
}
|
||||
|
||||
// Test that user pill is add to an emote message.
|
||||
// N.B. The second message in the test timeline is marked as an emote.
|
||||
void TextHandlerTest::receiveRichEmote()
|
||||
void TextHandlerTest::receiveLineSeparator()
|
||||
{
|
||||
auto event = room->messageEvents().at(1).get();
|
||||
auto author = static_cast<NeoChatUser *>(room->user(event->senderId()));
|
||||
const QString testInputString = QStringLiteral("This is an emote.");
|
||||
const QString testOutputString = QStringLiteral("* <a href=\"https://matrix.to/#/@example:example.org\" style=\"color:") + author->color().name()
|
||||
+ QStringLiteral("\">@example:example.org</a> This is an emote.");
|
||||
|
||||
TextHandler testTextHandler;
|
||||
testTextHandler.setData(testInputString);
|
||||
|
||||
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::RichText, room, event), testOutputString);
|
||||
}
|
||||
|
||||
void TextHandlerTest::receiveRichEdited_data()
|
||||
{
|
||||
QTest::addColumn<QString>("testInputString");
|
||||
QTest::addColumn<QString>("testOutputString");
|
||||
|
||||
QTest::newRow("basic") << QStringLiteral("Edited") << QStringLiteral("Edited <span style=\"color:#000000\">(edited)</span>");
|
||||
QTest::newRow("multiple paragraphs") << QStringLiteral("<p>Edited</p>\n<p>Edited</p>")
|
||||
<< QStringLiteral("<p>Edited</p>\n<p>Edited <span style=\"color:#000000\">(edited)</span></p>");
|
||||
QTest::newRow("blockquote") << QStringLiteral("<blockquote>Edited</blockquote>")
|
||||
<< QStringLiteral("<blockquote>Edited</blockquote><p> <span style=\"color:#000000\">(edited)</span></p>");
|
||||
}
|
||||
|
||||
void TextHandlerTest::receiveRichEdited()
|
||||
{
|
||||
QFETCH(QString, testInputString);
|
||||
QFETCH(QString, testOutputString);
|
||||
|
||||
TextHandler testTextHandler;
|
||||
testTextHandler.setData(testInputString);
|
||||
|
||||
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::RichText, room, room->messageEvents().at(2).get()), testOutputString);
|
||||
auto text = QStringLiteral("foo\u2028bar");
|
||||
TextHandler textHandler;
|
||||
textHandler.setData(text);
|
||||
QCOMPARE(textHandler.handleRecievePlainText(Qt::PlainText, true), QStringLiteral("foo bar"));
|
||||
}
|
||||
|
||||
QTEST_MAIN(TextHandlerTest)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<name xml:lang="eu">NeoChat</name>
|
||||
<name xml:lang="fi">NeoChat</name>
|
||||
<name xml:lang="fr">NeoChat</name>
|
||||
<name xml:lang="gl">NeoChat</name>
|
||||
<name xml:lang="hu">NeoChat</name>
|
||||
<name xml:lang="ia">Neochat</name>
|
||||
<name xml:lang="id">NeoChat</name>
|
||||
@@ -47,8 +48,8 @@
|
||||
<summary>A client for matrix, the decentralized communication protocol</summary>
|
||||
<summary xml:lang="ar">عميل لماتركس، ميفاق الاتصال اللامركزي</summary>
|
||||
<summary xml:lang="az">Matrix üçün müştəri, mərkəzləşməmiş kommunikasiya protokolu</summary>
|
||||
<summary xml:lang="ca">Un client per al Matrix, el protocol de comunicacions descentralitzat</summary>
|
||||
<summary xml:lang="ca-valencia">Un client per a Matrix, el protocol de comunicacions descentralitzat</summary>
|
||||
<summary xml:lang="ca">Un client de Matrix, el protocol de comunicacions descentralitzat</summary>
|
||||
<summary xml:lang="ca-valencia">Un client de Matrix, el protocol de comunicacions descentralitzat</summary>
|
||||
<summary xml:lang="cs">Klient pro decentralizovaný komunikační protokol matrix</summary>
|
||||
<summary xml:lang="de">Ein Programm für Matrix, das dezentrale Kommunikationsprotokoll</summary>
|
||||
<summary xml:lang="el">Ένας πελάτης για το Matrix, το αποκεντρωμένο πρωτόκολλο επικοινωνίας</summary>
|
||||
@@ -57,6 +58,7 @@
|
||||
<summary xml:lang="eu">Matrix, deszentralizatutako komunikazio protokolorako bezero bat</summary>
|
||||
<summary xml:lang="fi">Asiakas Matrixille, hajautetulle viestintäyhteyskäytännölle</summary>
|
||||
<summary xml:lang="fr">Un client pour « Matrix », le protocole décentralisé de communications.</summary>
|
||||
<summary xml:lang="gl">Un cliente para Matrix, o protocolo de comunicación descentralizada</summary>
|
||||
<summary xml:lang="hu">Kliens a matrixhoz, a decentralizált kommunikációs protokollhoz</summary>
|
||||
<summary xml:lang="ia">Un cliente per Matrix, le protocollo de communication decentralisate</summary>
|
||||
<summary xml:lang="id">Klien untuk matrix, protokol komunikasi terdesentralisasi</summary>
|
||||
@@ -74,104 +76,79 @@
|
||||
<summary xml:lang="sk">Klient pre matrix, decentralizovaný komunikačný protokol</summary>
|
||||
<summary xml:lang="sl">Odjemalec za matrix, decentralizirani komunikacijski protokol</summary>
|
||||
<summary xml:lang="sv">En klient för Matrix, det decentraliserade kommunikationsprotokollet</summary>
|
||||
<summary xml:lang="ta">மையமில்லா தகவல் பரிமாற்ற நெறிமுறையான மேட்ரிக்ஸுக்கான செயலி</summary>
|
||||
<summary xml:lang="tr">Merkezi olmayan iletişim protokolü Matrix için bir istemci</summary>
|
||||
<summary xml:lang="uk">Клієнт matrix, децентралізованого протоколу обміну даними</summary>
|
||||
<summary xml:lang="x-test">xxA client for matrix, the decentralized communication protocolxx</summary>
|
||||
<summary xml:lang="zh-CN">分布式通讯协议 Matrix 的客户端</summary>
|
||||
<description>
|
||||
<p>NeoChat is a Matrix client. It allows you to send text messages, videos and audio files to your family, colleagues and friends using the Matrix protocol.</p>
|
||||
<p xml:lang="ar">نيوتشات هو عميل ماتركس Matrix. يتيح لك إرسال رسائل نصية ومقاطع فيديو وملفات صوتية إلى عائلتك وزملائك وأصدقائك باستخدام بروتوكول ماتركس</p>
|
||||
<p xml:lang="az">NeoChat Mtrix müştərisidir. O, Matrix protokolundan istifadə edərək, ailənizə, dostlarınıza, iş yoldaşlarınıza mətn, səsli və görüntülü ismarıclar göndərməyə imkan verir.</p>
|
||||
<p xml:lang="ca">El NeoChat és un client de Matrix. Permet enviar missatges de text, fitxers de vídeo i d'àudio a la família, col·legues i amics usant el protocol Matrix.</p>
|
||||
<p xml:lang="ca-valencia">NeoChat és un client de Matrix. Permet enviar missatges de text, fitxers de vídeo i d'àudio a la família, col·legues i amics utilitzant el protocol Matrix.</p>
|
||||
<p xml:lang="de">NeoChat ist ein Matrix-Client. Er ermöglicht Ihnen das Senden von Textnachrichten, Videos und Audiodateien an Ihre Familie, Kollegen und Freunde unter Verwendung des Matrix-Protokolls.</p>
|
||||
<p xml:lang="el">Το NeoChat είναι μια εφαρμογή του Matrix. Σας επιτρέπει να στέλνετε μηνύματα κειμένου, βίντεο και ήχο στην οικογένειά σας, σε συναδέλφους και φίλους με το πρωτόκολλο Matrix.</p>
|
||||
<p xml:lang="en-GB">NeoChat is a Matrix client. It allows you to send text messages, videos and audio files to your family, colleagues and friends using the Matrix protocol.</p>
|
||||
<p xml:lang="es">NeoChat es un cliente para Matrix. Le permite enviar mensajes de texto, vídeos y archivos de sonido a su familia, compañeros de trabajo y amigos usando el protocolo Matrix.</p>
|
||||
<p xml:lang="eu">NeoChat Matrix bezero bat da. Familiari, lankideei eta lagunei testu-mezuak, bideoak eta audio-fitxategiak bidaltzeko aukera ematen du, Matrix protokoloa erabiliz.</p>
|
||||
<p xml:lang="fi">NeoChat on Matrix-asiakas. Sillä voi lähettää perheelle, tuttaville ja kavereille tekstiviestejä sekä video- ja äänitiedostoja Matrix-yhteyskäytännöllä.</p>
|
||||
<p xml:lang="fr">NeoChat est un client Matrix. Il vous permet d'envoyer des messages de texte, des vidéos et des fichiers audio à votre famille, vos collègues et vos amis en utilisant le protocole Matrix.</p>
|
||||
<p xml:lang="hu">A NeoChat egy Matrix kliens. Szöveges üzeneteket, videókat ésaudio fájlokat küldhet családjának, kollégáinak és barátainak a Matrix protokoll használatával.</p>
|
||||
<p xml:lang="ia">NeoChat es un cliente de Matrix. Illo te permitte inviar messager de texto, files de video e audio a tu familia, collegas e amicos usante le protocollo de Matrix.</p>
|
||||
<p xml:lang="id">NeoChat adalah sebuah klien Matrix. Memungkinkan Anda untuk mengirim pesan teks, file video dan audio ke keluarga, kolega dan teman Anda menggunakan protokol Matrix.</p>
|
||||
<p xml:lang="ie">NeoChat es un cliente de Matrix. On posse usar it por inviar missages textual, video- e audiofiles a su familie, colegos e amics med li protocol Matrix.</p>
|
||||
<p xml:lang="it">NeoChat è un client Matrix. Ti consente di inviare messaggi di testo, file video e audio a familiari, colleghi e amici utilizzando il protocollo Matrix.</p>
|
||||
<p xml:lang="ka">NeoChat არის Matrix კლიენტი. ის საშუალებას გაძლევთ გაგზავნოთ ტექსტური შეტყობინებები, ვიდეოები და აუდიო ფაილები თქვენს ოჯახს, კოლეგებსა და მეგობრებს მატრიქსის პროტოკოლის გამოყენებით.</p>
|
||||
<p xml:lang="ko">NeoChat은 Matrix 클라이언트입니다. Matrix 프로토콜을 사용하여 가족, 동료, 친구에게 텍스트 메시지, 동영상, 오디오 파일을 전송할 수 있습니다.</p>
|
||||
<p xml:lang="nl">NeoChat is een Matrix-client. Het biedt u het verzenden van tekstberichten, video's en geluidsbestanden naar uw familie, collega's en vrienden met het Matrix-protocol.</p>
|
||||
<p xml:lang="pl">NeoChat jest programem do Matrisa. Umożliwia wysyłanie wiadomości tekstowych, filmów oraz dźwięku do twojej rodziny, znajomych oraz przyjaciół poprzez protokół Matriksa.</p>
|
||||
<p xml:lang="pt">O NeoChat é um cliente do Matrix. O mesmo permite-lhe enviar mensagens de texto, ficheiros de vídeo e áudio para a sua família, colegas e amigos com o protocolo Matrix.</p>
|
||||
<p xml:lang="pt-BR">O NeoChat é um cliente Matrix. Ele permite a você enviar mensagens de texto, arquivos de vídeo e áudio para seus familiares, colegas e amigos usando o protocolo Matrix.</p>
|
||||
<p xml:lang="ru">NeoChat — это клиент, поддерживающий работу с протоколом Matrix. Он позволяет отправлять текстовые сообщения, видео и аудиофайлы.</p>
|
||||
<p xml:lang="sk">NeoChat je Matrix klient. Umožňuje vám posielať textové správy, videá a zvukové súbory rodine, kolegom a priateľom pomocou protokolu Matrix.</p>
|
||||
<p xml:lang="sl">NeoChat je odjemalec Matrixa. Dovoljuje vam pošiljanje besedilnih sporočil, videoposnetkov in zvočnih datotek vaši družini, kolegom in prijateljem z uporabo protokola Matrix.</p>
|
||||
<p xml:lang="sv">NeoChat är en Matrix-klient. Den låter dig skicka textmeddelanden, videor och ljudfiler till din familj, kollegor och vänner med användning av Matrix-protokollet.</p>
|
||||
<p xml:lang="tr">NeoChat, bir Matrix istemcisidir. Matrix protokolünü kullanarak ailenize, iş arkadaşlarınıza, arkadaşlarınıza ve başkalarına metin iletileri, video ve ses dosyaların göndermenize olanak verir.</p>
|
||||
<p xml:lang="uk">NeoChat — клієнт мережі обміну повідомленнями Matrix. За допомогою цієї програми ви зможете надсилати текстові повідомлення, відео та звукові файли вашій родині, колегам та друзям за допомогою протоколу Matrix.</p>
|
||||
<p xml:lang="x-test">xxNeoChat is a Matrix client. It allows you to send text messages, videos and audio files to your family, colleagues and friends using the Matrix protocol.xx</p>
|
||||
<p xml:lang="zh-CN">NeoChat 是一个 Matrix 客户端。 它允许您使用 Matrix 协议向您的家人、同事和朋友发送文本消息、视频和音频文件。</p>
|
||||
<p>Matrix is a decentralized communication protocol, putting the user back in control. Currently NeoChat implements large part of the protocol with the exception of encrypted chats and video chat.</p>
|
||||
<p xml:lang="ar">ماتريكس هو بروتوكول اتصال لامركزي ، يعيد المستخدم إلى السيطرة. يطبق نيوتشات حاليًا جزءًا كبيرًا من الميفاق باستثناء الدردشات المشفرة ودردشة الفيديو.</p>
|
||||
<p xml:lang="az">Matrix, istifadəçini nəzarətdə saxlayan, mərkəzləşməmişi rabitə protokoludur. NeoChat, söhbətin və video əlaqəsinin şifrələnməsindən başqa bir çox protokolları həyata keçirə bilir.</p>
|
||||
<p xml:lang="ca">Matrix és un protocol de comunicacions descentralitzat, que retorna el control a l'usuari. Actualment el NeoChat implementa una gran part del protocol amb l'excepció dels xats encriptats i els xats de vídeo.</p>
|
||||
<p xml:lang="ca-valencia">Matrix és un protocol de comunicacions descentralitzat, que retorna el control a l'usuari. Actualment NeoChat implementa una gran part del protocol amb l'excepció dels xats encriptats i els xats de vídeo.</p>
|
||||
<p xml:lang="de">Matrix ist ein dezentralisiertes Kommunikationsprotokoll, das dem Benutzer wieder die Kontrolle zurückgibt. Derzeit implementiert NeoChat einen großen Teil des Protokolls mit der Ausnahme von verschlüsselten Chats und Video-Chat.</p>
|
||||
<p xml:lang="el">Το Matrix είναι ένα αποκεντρωμένο πρωτόκολλο επικοινωνίας, δίνοντας πίσω στον χρήστη τον έλεγχο. Προς το παρόν το NeoChat υλοποιεί ένα μεγάλο μέρος του πρωτοκόλλου με εξαίρεση τις κρυπτογραφημένες συνομιλίες και τη συνομιλία με βίντεο.</p>
|
||||
<p xml:lang="en-GB">Matrix is a decentralised communication protocol, putting the user back in control. Currently NeoChat implements large part of the protocol with the exception of encrypted chats and video chat.</p>
|
||||
<p xml:lang="es">Matrix es un protocolo de comunicaciones descentralizado, que devuelve el control al usuario. En la actualidad, NeoChat implementa gran parte del protocolo con la excepción de chats cifrados y chats de vídeo.</p>
|
||||
<p xml:lang="eu">Matrix komunikazio-protokolo deszentralizatu bat da, erabiltzaileari kontrola itzultzen diona. Gaur egun, NeoChat-ek protokoloaren zati handi bat inplementatzen du, berriketa zifratuak eta bideo berriketak izan ezik.</p>
|
||||
<p xml:lang="fi">Matrix on hajautettu viestintäyhteyskäytäntö, joka antaa hallinnan takaisin käyttäjille. NeoChat tarjoaa nykyisellään valtaosan yhteyskäytännöstä salattuja keskustelu- ja videokeskusteluja lukuun ottamatta.</p>
|
||||
<p xml:lang="fr">Matrix est un protocole de communication décentralisé, donnant le contrôle à l'utilisateur. Actuellement, NeoChat met en œuvre une grande partie du protocole, à l'exception des discussions chiffrées et du chat vidéo.</p>
|
||||
<p xml:lang="hu">A Matrix egy decentralizált kommunikációs protokoll, amely a felhasználók kezébe adja az irányítást.</p>
|
||||
<p xml:lang="ia">Matrix es un protocollo de communication decentrate, ponente le usator in le controlo. Currentemente NeoChat implementa un grande parte del protocollo con le exception de conversationes cryptate e conversationes video.</p>
|
||||
<p xml:lang="id">Matrix adalah protokol komunikasi terdesentralisasi, menempatkan pengguna kembali dalam kendali. Saat ini NeoChat mengimplementasikan sebagian besar protokol dengan pengecualian obrolan terenkripsi dan obrolan video.</p>
|
||||
<p xml:lang="ie">Matrix es un decentralisat protocol de communication quel retroda li control a un usator. Actualmen, NeoChat implementa un grand parte del protocol except ciffrat conversationes e videotelefonada.</p>
|
||||
<p xml:lang="it">Matrix è un protocollo di comunicazione decentralizzato, che restituisce all'utente il controllo. Attualmente NeoChat implementa gran parte del protocollo ad eccezione delle chat cifrate e delle chat video.</p>
|
||||
<p xml:lang="ka">Matrix -ი დეცენტრალიზებული კომუნიკაციის პროტოკოლია, რომელიც მომხმარებელს კონტროლის უფლებას უბრუნებს. ამჟამად NeoChat-ს პროტოკოლის ძირითადი ნაწილის მხარდაჭერა გააჩნია, დაშიფვრისა და ვიდეოჩატის გამოკლებით.</p>
|
||||
<p xml:lang="ko">Matrix는 사용자에게 제어권을 돌려 주는 분산 통신 프로토콜입니다. NeoChat은 암호화된 대화 및 영상 통화를 제외한 프로토콜의 대부분 기능을 구현합니다.</p>
|
||||
<p xml:lang="nl">Matrix is een gedecentraliseerd communicatieprotocol, dat de gebruiker de controle teruggeeft. Op dit moment implementeert NeoChat grote delen van het protocol met de uitzondering van versleutelde chats en video-chat.</p>
|
||||
<p xml:lang="pl">Matrix jest protokołem rozproszonego porozumiewania się oddający użytkownikowi jego władzę. Obecnie NeoChat obsługuje dużą część protokołu poza szyfrowanymi rozmowami tekstowymi i z obrazem.</p>
|
||||
<p xml:lang="pt">O Matrix é um protocolo de comunicações descentralizado, colocando de novo o utilizador no poder. De momento, o NeoChat implementa uma boa parte do protocolo, com a excepção das conversas encriptadas e as conversas de vídeo.</p>
|
||||
<p xml:lang="pt-BR">O Matrix é um protocolo de comunicação descentralizado, colocando o usuário de volta no controle. Atualmente o NeoChat implementa grande parte do protocolo com a exceção de bate-papos criptografados e bate-papo por vídeo.</p>
|
||||
<p xml:lang="ru">Matrix — это децентрализованный коммуникационный протокол, возвращающий пользователю контроль над своими данными. В настоящее время в приложении NeoChat реализована поддержка большей части протокола, за исключением зашифрованных чатов и видеочата.</p>
|
||||
<p xml:lang="sk">Matrix je decentralizovaný komunikačný protokol, ktorý používateľovi vracia kontrolu. V súčasnosti NeoChat implementuje veľkú časť protokolu s výnimkou šifrovaných chatov a videohovorov.</p>
|
||||
<p xml:lang="sl">Matrix je decentraliziran komunikacijski protokol, kjer ima uporabnik uporabnik kontrolo rabe. Trenutno ima NeoChat izveden velik del protokola z izjemo šifriranih klepetov in video klepetov.</p>
|
||||
<p xml:lang="sv">Matrix är ett decentraliserat kommunikationsprotokoll, som ger tillbaka kontrollen till användaren. För närvarande implementerar NeoChat en stor del av protokollet, med undantag för krypterad chatt och videochatt.</p>
|
||||
<p xml:lang="tr">Matrix; tam denetimi kullanıcıya bırakan, merkezi olmayan bir iletişim protokolüdür. Şu anda NeoChat, uçtan uca şifrelenmiş metin ve video sohbetleri dışında protokolün büyük bir bölümünü bünyesinde bulundurur.</p>
|
||||
<p xml:lang="uk">Matrix — протокол децентралізованого спілкування, який передає контроль над даними користувачеві. У поточній версії NeoChat реалізовано більшу частину протоколу, окрім зашифрованого спілкування та відеоспілкування.</p>
|
||||
<p xml:lang="x-test">xxMatrix is a decentralized communication protocol, putting the user back in control. Currently NeoChat implements large part of the protocol with the exception of encrypted chats and video chat.xx</p>
|
||||
<p xml:lang="zh-CN">Matrix 是一个分布式通讯协议,使用户重新得到控制权。 目前,NeoChat 实现了协议的大部分,除了加密聊天和视频聊天。</p>
|
||||
<p>NeoChat works both on mobile and desktop while providing a consistent user experience.</p>
|
||||
<p xml:lang="ar">يعمل نيوتشات على كل من الأجهزة المحمولة وسطح المكتب مع توفير تجربة مستخدم متسقة.</p>
|
||||
<p xml:lang="az">Vahid istifadəçi interfeysi ilə təmin olunan NeoChat, həm mobil telefonda həm də kompyuterlərdə işləyir.</p>
|
||||
<p xml:lang="ca">El NeoChat funciona en els mòbils i a l'escriptori, proporcionant una experiència d'usuari coherent.</p>
|
||||
<p xml:lang="ca-valencia">NeoChat funciona en els mòbils i en l'escriptori, proporcionant una experiència d'usuari coherent.</p>
|
||||
<p xml:lang="de">NeoChat funktioniert sowohl auf Mobilgeräten als auch auf dem PC und bietet ein einheitliches Benutzererlebnis.</p>
|
||||
<p xml:lang="el">Το NeoChat λειτουργεί και στα κινητά και στους υπολογιστές γραφείου παρέχοντας μια αδιάλειπτη εμπειρία χρήσης.</p>
|
||||
<p xml:lang="en-GB">NeoChat works both on mobile and desktop while providing a consistent user experience.</p>
|
||||
<p xml:lang="es">NeoChat funciona en móviles y en el escritorio a la vez que proporciona una experiencia de usuario consistente.</p>
|
||||
<p xml:lang="eu">NeoChat mugikorretan eta mahaigainean dabil, erabiltzaile esperientzia koherentea eskainiz.</p>
|
||||
<p xml:lang="fi">NeoChat toimii sekä mobiili- että työpöytäalustoilla tarjoten yhdenmukaisen käyttökokemuksen.</p>
|
||||
<p xml:lang="fr">NeoChat fonctionne aussi bien sur les mobiles que sur les ordinateurs de bureau, tout en offrant une expérience utilisateur cohérente.</p>
|
||||
<p xml:lang="hu">A NeoChat mobilon és asztali számítógépen is működik, egységes felhasználói élményt nyújtva.</p>
|
||||
<p xml:lang="ia">NeoChat functiona sia sur mobile que ur scriptorio durante que forni un experientia de usator consistente.</p>
|
||||
<p xml:lang="id">NeoChat berfungsi baik di ponsel dan desktop sambil memberikan pengalaman pengguna yang konsisten.</p>
|
||||
<p xml:lang="ie">NeoChat supporta amb computatores e aparates mobil, ancor providente un consistent experientie de usator.</p>
|
||||
<p xml:lang="it">NeoChat funziona sia su dispositivi mobili che desktop, fornendo un'esperienza utente coerente.</p>
|
||||
<p xml:lang="ka">NeoChat მუშაობს როგორც მობილურ, ისე ჩვეულებრივ კომპიუტერებზე იმ დროს, როცა მომხმარებლის ინტერფეისი არ იცვლება.</p>
|
||||
<p xml:lang="ko">NeoChat은 모바일과 데스크톱 모두에서 일관된 사용자 경험을 제공합니다.</p>
|
||||
<p xml:lang="nl">NeoChat werkt zowel op de mobiel en het bureaublad met het leveren van een consistente gebruikerservaring.</p>
|
||||
<p xml:lang="pl">NeoChat działa zarówno na urządzeniach przenośnych jak i biurkowych, zapewniając spójne wrażenia użytkownika</p>
|
||||
<p xml:lang="pt">O NeoChat funciona tanto em dispositivos móveis como no computador, fornecendo uma experiência de utilizador consistente.</p>
|
||||
<p xml:lang="pt-BR">O NeoChat funciona tanto no celular como no computador enquanto fornece uma experiência consistente ao usuário.</p>
|
||||
<p xml:lang="ru">NeoChat работает как на мобильных устройствах, так и на настольных компьютерах, обеспечивая единый пользовательский интерфейс.</p>
|
||||
<p xml:lang="sk">NeoChat funguje na mobilných aj stolových počítačoch a poskytuje konzistentný používateľský zážitok.</p>
|
||||
<p xml:lang="sl">NeoChat deluje tako na mobilnih kot na namiznih platformah z zagotavljanjem konsistentne uporabniške izkušnje.</p>
|
||||
<p xml:lang="sv">NeoChat fungerar både på mobil och skrivbord och tillhandahåller en konsekvent användarupplevelse.</p>
|
||||
<p xml:lang="tr">NeoChat, hem masaüstü hem de taşınabilir ortamlarda çalışarak tutarlı bir kullanıcı deneyimi sunar.</p>
|
||||
<p xml:lang="uk">NeoChat працює на мобільних пристроях та звичайних комп'ютерах, маючи однорідний інтерфейс на усіх підтримуваних пристроях.</p>
|
||||
<p xml:lang="x-test">xxNeoChat works both on mobile and desktop while providing a consistent user experience.xx</p>
|
||||
<p xml:lang="zh-CN">NeoChat 在移动设备和桌面上均可用,并提供一致的用户体验。</p>
|
||||
<p>NeoChat is a client for Matrix, the decentralized communication protocol for instant messaging. It allows you to send text messages, videos and audio files to your family, colleagues and friends. It uses KDE frameworks and most notably Kirigami
|
||||
to provide a convergent experience across multiple platforms.</p>
|
||||
<p xml:lang="ar">نيوتشات هو عميل ماتركس Matrix، (ميفاق الاتصال اللامركزي للمراسلة الفورية). يتيح لك نيوتشات إرسال رسائل نصية ومقاطع فيديو وملفات صوتية إلى عائلتك وزملائك وأصدقائك. يستخدم أطر عمل كيدي وأبرزها Kirigami لتوفير تجربة متقاربة عبر منصات متعددة.</p>
|
||||
<p xml:lang="ca">El NeoChat és un client de Matrix, el protocol descentralitzat de comunicacions de missatgeria instantània. Permet enviar missatges de text, fitxers de vídeo i d'àudio a la família, col·legues i amics. Fa servir els Frameworks de KDE i, sobretot, el Kirigami per a proporcionar una experiència convergent a través de diverses plataformes.</p>
|
||||
<p xml:lang="ca-valencia">NeoChat és un client de Matrix, el protocol descentralitzat de comunicacions de missatgeria instantània. Permet enviar missatges de text, fitxers de vídeo i d'àudio a la família, col·legues i amics. Utilitza els Frameworks de KDE i, sobretot, Kirigami per a proporcionar una experiència convergent a través de diverses plataformes.</p>
|
||||
<p xml:lang="en-GB">NeoChat is a client for Matrix, the decentralised communication protocol for instant messaging. It allows you to send text messages, videos and audio files to your family, colleagues and friends. It uses KDE frameworks and most notably Kirigami to provide a convergent experience across multiple platforms.</p>
|
||||
<p xml:lang="es">NeoChat es un cliente para Matrix, el protocolo de comunicaciones descentralizado para mensajería instantánea. Le permite enviar mensajes de texto, vídeos y archivos de sonido a su familia, compañeros de trabajo y amigos. Usa la infraestructura de KDE y, en particular, Kirigami para proporcionar una experiencia convergente en muchas plataformas.</p>
|
||||
<p xml:lang="fr">NeoChat est un client pour le protocole Matrix, un protocole décentralisé de communications pour messagerie instantané. Il vous permet d'envoyer des messages de texte, des vidéos et des fichiers audio à votre famille, vos collègues et vos amis. Il utilise les environnements de développement et plus précisément Kirigami pour fournir une expérience convergente sur plusieurs plate-formes. </p>
|
||||
<p xml:lang="gl">NeoChat é un cliente para Matrix, o protocolo de comunicación descentralizada para mensaxería instantánea. Podes enviar mensaxes de texto, vídeos e ficheiros de son á túa familia, colegas e amizades. Usas infraestruturas de KDE e principalmente Kirigami para proporcionar unha experiencia de uso converxente para varias plataformas.</p>
|
||||
<p xml:lang="ia">NeoChat es un cliente per Matrix, le protocollo de communication decentralisate per messager instantanee. Illo te permitte inviar messager de texto, files de video e audio a tu familia, collegas e amicos usante. Illo usa KDE frameworks e super toto Kirigamii forni un experientia convergente trans platteforme multiple.</p>
|
||||
<p xml:lang="it">NeoChat è un client per Matrix, il protocollo di comunicazione decentralizzato per la messaggistica istantanea. Ti consente di inviare messaggi di testo, video e file audio a familiari, colleghi e amici. Utilizza i framework KDE e in particolare Kirigami per fornire un'esperienza convergente su più piattaforme.</p>
|
||||
<p xml:lang="ka">NeoChat არის Matrix კლიენტი. ის საშუალებას გაძლევთ გაგზავნოთ ტექსტური შეტყობინებები, ვიდეოები და აუდიო ფაილები თქვენს ოჯახს, კოლეგებსა და მეგობრებს მატრიქსის პროტოკოლის გამოყენებით. ის იყენებს KDE-ის შესაძლებლობებს და განსაკუთრებით კი Kirigami-ის, რათა პლატფორმებს შორის თავსებადობა უზრუნველყოს.</p>
|
||||
<p xml:lang="nl">NeoChat is een client voor Matrix, het gedecentraliseerde communicatieprotocol voor instant messages. Het biedt u het verzenden van tekstberichten, video's en geluidsbestanden naar uw familie, collega's en vrienden. Het gebruik KDE frameworks en het meest opmerkelijk Kirigami om een convergente ervaring te leveren op meerdere platforms.</p>
|
||||
<p xml:lang="pl">NeoChat jest programem do Matriksa, protokołu rozproszonego porozumiewania się w czasie rzeczywistym. Umożliwia wysyłanie wiadomości tekstowych, filmów oraz dźwięku do twojej rodziny, znajomych oraz przyjaciół. Używa szkieletów KDE i głównie Kirigami, aby zapewnić spójne wrażenia na wielu platformach</p>
|
||||
<p xml:lang="sl">Neochat je odjemalec za Matrix, decentralizirani komunikacijski protokol za takojšnje sporočanje. Omogoča vam pošiljanje besedilnih sporočil, videoposnetkov in zvočnih datotek svoji družini, sodelavcem in prijateljem. Uporablja okvire KDE in predvsem Kirigami, da zagotavlja konvergentno izkušnjo na več platformah.</p>
|
||||
<p xml:lang="tr">NeoChat, anlık iletileşme için merkezi olmayan iletişim protokolü olan Matrix için bir istemcidir. Ailenize, iş arkadaşlarınıza ve arkadaşlarınıza metin iletiler, videolar ve ses dosyaları göndermenize olanak tanır. Birden çok platformda yakınsak bir deneyim sağlamak için KDE Frameworks ve en önemlilerinden Kirigami'yi kullanır.</p>
|
||||
<p xml:lang="uk">NeoChat — клієнт Matrix, децентралізованого протоколу спілкування для миттєвого обміну повідомленнями. За його допомогою ви можете надсилати текстові повідомлення, відео та звукові файли вашій родин, колегами та друзям. У програмі використано бібліотеки KDE, зокрема Kirigami, для надання однорідного середовища на декількох програмних та апаратних платформах.</p>
|
||||
<p xml:lang="x-test">xxNeoChat is a client for Matrix, the decentralized communication protocol for instant messaging. It allows you to send text messages, videos and audio files to your family, colleagues and friends. It uses KDE frameworks and most notably Kirigami to provide a convergent experience across multiple platforms.xx</p>
|
||||
<p>NeoChat aims to be a fully featured application for the Matrix specification. As such everything in the current stable specification with the notable exceptions of VoIP, threads and some aspects of End-to-End Encryption are supported. There are a few other smaller omissions due to the fact that the Matrix spec is constantly evolving but the aim remains to provide eventual support for the entire spec.</p>
|
||||
<p xml:lang="ar">يهدف نيوتشات إلى أن يكون تطبيقًا كامل الميزات لمواصفات ماتركس. على هذا النحو يتم دعم كل شيء في المواصفات المستقرة الحالية مع الاستثناءات الملحوظة لـ VoIP والخيوط وبعض جوانب التشفير من طرف إلى طرف. هناك عدد قليل من الإغفالات الصغيرة الأخرى بسبب حقيقة أن مواصفات ماتركس تتطور باستمرار ، ولكن يبقى الهدف توفير الدعم النهائي للمواصفات بأكملها.</p>
|
||||
<p xml:lang="ca">NeoChat pretén ser una aplicació amb totes les característiques per a l'especificació de Matrix. Com a tal, s'ha implementat tota l'especificació actual estable amb les notables excepcions de la VoIP, fils i alguns aspectes de l'encriptatge d'extrem a extrem. Hi ha algunes altres omissions més petites a causa del fet que l'especificació de Matrix està evolucionant constantment, però l'objectiu segueix sent proporcionar suport eventual per a tota l'especificació.</p>
|
||||
<p xml:lang="ca-valencia">NeoChat pretén ser una aplicació amb totes les característiques per a l'especificació de Matrix. Com a tal, s'ha implementat tota l'especificació actual estable amb les notables excepcions de VoIP, fils i alguns aspectes de l'encriptació d'extrem a extrem. Hi ha algunes altres omissions més xicotetes a causa del fet que l'especificació de Matrix està evolucionant constantment, però l'objectiu seguix sent proporcionar suport eventual per a tota l'especificació.</p>
|
||||
<p xml:lang="en-GB">NeoChat aims to be a fully featured application for the Matrix specification. As such everything in the current stable specification with the notable exceptions of VoIP, threads and some aspects of End-to-End Encryption are supported. There are a few other smaller omissions due to the fact that the Matrix spec is constantly evolving but the aim remains to provide eventual support for the entire spec.</p>
|
||||
<p xml:lang="es">NeoChat pretende ser una aplicación con todas las funciones para la especificación de Matrix. Como tal, admite todo en la especificación estable actual, con las notables excepciones de VoIP, subprocesos y algunas funciones de cifrado de extremo a extremo. Existen algunas omisiones menos importantes debido al hecho de que la especificación de Matrix está en constante evolución, pero el objetivo sigue siendo brindar compatibilidad final con toda la especificación.</p>
|
||||
<p xml:lang="fr">L'objectif de NeoChat est d'être une application complète pour le protocole Matrix. En tant que tel, tout dans la spécification stable actuelle avec les exceptions notables de VoIP, les processus et certains aspects du chiffrement de bout en bout sont pris en charge. Il y a quelques autres petites omissions en raison du fait que la spécification du protocole Matrix est en constante évolution. Cependant, l'objectif reste de fournir un soutien éventuel pour l'ensemble de la spécification.</p>
|
||||
<p xml:lang="gl">NeoChat pretende ser unha aplicación completa para a especificación de Matrix. Coas excepcións de VoIP, conversas fiadas e algúns aspectos da cifraxe de extremo a extremo, a versión estábel segue as especificacións. Existen algunhas outras pequenas omisións debido ao feito de que Matrix está en continua evolución pero a intención é implementar a especificación completa.</p>
|
||||
<p xml:lang="ia">NeoChat aspira a esser un application plenemente eminente per le specification de Matrix. Tal como omne cosas in le specification currentemente stabile con le exceptiones notabile de VOIP, threads e alcun aspectos del cryptation End-to-End es supportate. Il ha ltere pauc omissiones, debite al facto que le specification de Matrix es in evolution constante ma le aspiration remane a fornir supporto eventual per le integre specification.</p>
|
||||
<p xml:lang="it">NeoChat mira ad essere un'applicazione completa per le specifiche Matrix. Pertanto, sono supportati tutti gli elementi dell'attuale specifica stabile con le notevoli eccezioni di VoIP, conversazioni e alcuni aspetti della cifratura end-to-end. Ci sono alcune altre piccole omissioni dovute al fatto che le specifiche Matrix sono in continua evoluzione, ma l'obiettivo rimane quello di fornire un eventuale supporto per l'intera specifica.</p>
|
||||
<p xml:lang="ka">NeoChat-ი მიზნად ისახავს Matrix სპეციფიკაციის სრული განხორციელება ჰქონდეს. როგორც ასეთი, ყველაფერი მიმდინარე სპეციფიკაციიდან, VoIP-ის, ძაფებისა და გამჭოლი დაშიფვრის ზოგიერთი ასპექტის გარდა, მხარდაჭერილია. შეძლება ასევე იყოს მცირე ლაფსუსებიც იმის გამო, რომ Matrix-ის სპეციფიკაცია მუდმივად ვითარგდება, მაგრამ ჩვენი მიზანი მისი სრული მხარდაჭერაა.</p>
|
||||
<p xml:lang="nl">NeoChat richt zich op het volledig bieden van alle mogelijkheden van de Matrix-specificatie. Alles in de huidige stabiele specificatie met merkbare uitzondering van VoIP, gekoppelde discussies en sommige aspecten van eind-tot-eind versleuteling worden ondersteund. Er zijn een paar andere kleinere omissies vanwege het feit dat de Matrix specificatie constant evolueert maar het doel blijft het eventueel bieden van ondersteuning van de gehele specificatie.</p>
|
||||
<p xml:lang="pl">NeoChat w zamyśle ma być pełnowartościową aplikacją wg wytycznych Matriksa. Z tego powodu, wszystko, co jest obecnie w stabilnych wytycznych z pominięciem VoIP, wątków i niektórych części szyfrowania Użytkownik-do-Użytkownika są obecnie obsługiwane. Pominięto też kilka mniejszych rzeczy ze względu na ciągły rozwój wytycznych Matriksa, lecz celem nadal jest zapewnienie obsługi wszystkich wytycznych.</p>
|
||||
<p xml:lang="sl">Neochat cilja, da bi bila popolna aplikacija po specifikaciji Matrixa. Kot takšna vsebuje vse v trenutni stabilni specifikaciji z pomembnimi izjemami pri VoIP, nitih in nekaterih vidikov šifriranja od konca do konca. Obstaja nekaj drugih manjših opustitev zaradi dejstva, da se specifikacija Matrix nenehno razvija, vendar cilj ostaja zagotoviti morebitno podporo celotni specifikaciji.</p>
|
||||
<p xml:lang="tr">NeoChat, Matrix belirtimi için tam özellikli bir uygulama olmayı hedefler. Bu nedenle; VoIP, ileti zincirleri ve Uçtan Uca Şifreleme'nin bazı yönleri gibi dikkate değer istisnalar dışında var olan kararlı belirtimdeki her şey desteklenir. Matrix belirtiminin sürekli gelişmesi nedeniyle birkaç küçük eksiklik daha var; ancak amaç tüm belirtim için nihai destek sağlamak olmayı sürdürüyor.</p>
|
||||
<p xml:lang="uk">Метою створення NeoChat є повноцінна реалізація програми для специфікації Matrix. Як наслідок, реалізовано усе у поточній стабільній специфікації, окрім голосового інтернет-зв'язку, потоків та деяких аспектів міжвузлового шифрування. Є також декілька інших незначних прогалин через те, що специфікація Matrix постійно змінюється, але метою лишається повна підтримка специфікації.</p>
|
||||
<p xml:lang="x-test">xxNeoChat aims to be a fully featured application for the Matrix specification. As such everything in the current stable specification with the notable exceptions of VoIP, threads and some aspects of End-to-End Encryption are supported. There are a few other smaller omissions due to the fact that the Matrix spec is constantly evolving but the aim remains to provide eventual support for the entire spec.xx</p>
|
||||
<p>Due to the nature of the Matrix specification development NeoChat also supports numerous unstable features. Currently these are:</p>
|
||||
<p xml:lang="ar">نظرًا لطبيعة تطوير مواصفات ماتركس، يدعم نيوتشات أيضًا العديد من الميزات غير المستقرة وهي:</p>
|
||||
<p xml:lang="ca">A causa de la naturalesa del desenvolupament de l'especificació de Matrix, el NeoChat també implementa nombroses característiques inestables. Actualment són:</p>
|
||||
<p xml:lang="ca-valencia">A causa de la naturalea del desenvolupament de l'especificació de Matrix, NeoChat també implementa nombroses característiques inestables. Actualment són:</p>
|
||||
<p xml:lang="en-GB">Due to the nature of the Matrix specification development NeoChat also supports numerous unstable features. Currently these are:</p>
|
||||
<p xml:lang="es">Debido a la naturaleza del desarrollo de la especificación de Matrix, NeoChat también permite numerosas funciones no estables, como:</p>
|
||||
<p xml:lang="fr">En raison de la nature du développement des spécifications du protocole Matrix, NeoChat prend également en charge de nombreuses fonctionnalités instables. Actuellement, ce sont :</p>
|
||||
<p xml:lang="gl">Debido á natureza do desenvolvemento da especificación de Matrix, NeoChat tamén inclúe varias funcionalidades non estábeis:</p>
|
||||
<p xml:lang="ia">Debite al natura del disveloppamento de specification de Matrix NeoChat tamben supporta numerose characteristicas instabile. Currentemente istes es:</p>
|
||||
<p xml:lang="it">A causa della natura dello sviluppo delle specifiche Matrix, NeoChat supporta anche numerose funzionalità instabili. Attualmente queste sono:</p>
|
||||
<p xml:lang="ka">Matrix-ის სპეციფიკაციის განვითარების ბუნების გამო NeoChat-ს ასევე აქვს უამრავი არასტაბილური ფუნქციაც. ახლა ისინია:</p>
|
||||
<p xml:lang="nl">Vanwege de aard van de ontwikkeling van de Matrix specificatie ondersteunt NeoChat ook talloze onstabiele mogelijkheden. Dit zijn nu:</p>
|
||||
<p xml:lang="pl">Ze względu na sposób rozwoju Matriksa, NeoChat obsługuje także kilka niestabilnych możliwości. Obecnie są to:</p>
|
||||
<p xml:lang="sl">Zaradi narave razvoja specifikacije Matrixa NeoChat podpira tudi številne nestabilne zmožnosti. Trenutno so to:</p>
|
||||
<p xml:lang="tr">NeoChat, Matrix belirtimi geliştirmesinin doğası gereği çok sayıda kararsız özelliği de destekler. Şu anda bunlar:</p>
|
||||
<p xml:lang="uk">Через природу розробки специфікації Matrix, у NeoChat також передбачено підтримку численних нестабільних можливостей. У поточній версії цими можливостями є:</p>
|
||||
<p xml:lang="x-test">xxDue to the nature of the Matrix specification development NeoChat also supports numerous unstable features. Currently these are:xx</p>
|
||||
<ul>>
|
||||
</ul>
|
||||
<ul xml:lang="ca">></ul>
|
||||
<ul xml:lang="ca-valencia">></ul>
|
||||
<ul xml:lang="en-GB">></ul>
|
||||
<ul xml:lang="es">></ul>
|
||||
<ul xml:lang="fr">></ul>
|
||||
<ul xml:lang="ia">></ul>
|
||||
<ul xml:lang="it">></ul>
|
||||
<ul xml:lang="ka">></ul>
|
||||
<ul xml:lang="nl">></ul>
|
||||
<ul xml:lang="pl">></ul>
|
||||
<ul xml:lang="sl">></ul>
|
||||
<ul xml:lang="uk">></ul>
|
||||
<ul xml:lang="x-test">xx>xx</ul>
|
||||
</description>
|
||||
<url type="homepage">https://apps.kde.org/neochat/</url>
|
||||
<url type="bugtracker">https://bugs.kde.org/buglist.cgi?component=General&product=NeoChat</url>
|
||||
@@ -191,6 +168,7 @@
|
||||
<developer_name xml:lang="eu">KDE komunitatea</developer_name>
|
||||
<developer_name xml:lang="fi">KDE-yhteisö</developer_name>
|
||||
<developer_name xml:lang="fr">La communauté de KDE</developer_name>
|
||||
<developer_name xml:lang="gl">A comunidade KDE</developer_name>
|
||||
<developer_name xml:lang="hu">A KDE Közösség</developer_name>
|
||||
<developer_name xml:lang="ia">Le communitate de KDE</developer_name>
|
||||
<developer_name xml:lang="id">Komunitas KDE</developer_name>
|
||||
@@ -208,6 +186,7 @@
|
||||
<developer_name xml:lang="sk">KDE Komunita</developer_name>
|
||||
<developer_name xml:lang="sl">Skupnost KDE</developer_name>
|
||||
<developer_name xml:lang="sv">KDE-gemenskapen</developer_name>
|
||||
<developer_name xml:lang="ta">கே.டீ.யீ. சமூகம்</developer_name>
|
||||
<developer_name xml:lang="tr">KDE Topluluğu</developer_name>
|
||||
<developer_name xml:lang="uk">Спільнота KDE</developer_name>
|
||||
<developer_name xml:lang="x-test">xxThe KDE Communityxx</developer_name>
|
||||
@@ -231,6 +210,9 @@
|
||||
<content_attribute id="social-chat">intense</content_attribute>
|
||||
</content_rating>
|
||||
<releases>
|
||||
<release version="23.04.2" date="2023-06-08"/>
|
||||
<release version="23.04.1" date="2023-05-11"/>
|
||||
<release version="23.04.0" date="2023-04-20"/>
|
||||
<release version="23.01" date="2023-01-30">
|
||||
<url>https://plasma-mobile.org/2023/01/30/january-blog-post/</url>
|
||||
<description>
|
||||
|
||||
@@ -15,6 +15,7 @@ Name[es]=NeoChat
|
||||
Name[eu]=NeoChat
|
||||
Name[fi]=NeoChat
|
||||
Name[fr]=NeoChat
|
||||
Name[gl]=NeoChat
|
||||
Name[hu]=NeoChat
|
||||
Name[ia]=Neochat
|
||||
Name[id]=NeoChat
|
||||
@@ -52,6 +53,7 @@ GenericName[es]=Cliente para Matrix
|
||||
GenericName[eu]=Matrix bezeroa
|
||||
GenericName[fi]=Matrix-asiakas
|
||||
GenericName[fr]=Client « Matrix »
|
||||
GenericName[gl]=Cliente de Matrix
|
||||
GenericName[hu]=Matrix kliens
|
||||
GenericName[ia]=Cliente de Matrice
|
||||
GenericName[id]=Klien Matrix
|
||||
@@ -88,6 +90,7 @@ Comment[es]=Cliente para el protocolo Matrix
|
||||
Comment[eu]=Matrix protokolorako bezeroa
|
||||
Comment[fi]=Asiakas Matrix-yhteyskäytännölle
|
||||
Comment[fr]=Client pour le protocole « Matrix »
|
||||
Comment[gl]=Cliente para o protocolo Matrix
|
||||
Comment[hu]=Kliens a Matrix protokollhoz
|
||||
Comment[ia]=Cliente per le protocollo de Matrix
|
||||
Comment[id]=Klien untuk protokol Matrix
|
||||
|
||||
990
po/ar/neochat.po
990
po/ar/neochat.po
File diff suppressed because it is too large
Load Diff
1046
po/az/neochat.po
1046
po/az/neochat.po
File diff suppressed because it is too large
Load Diff
1085
po/ca/neochat.po
1085
po/ca/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
987
po/cs/neochat.po
987
po/cs/neochat.po
File diff suppressed because it is too large
Load Diff
1007
po/da/neochat.po
1007
po/da/neochat.po
File diff suppressed because it is too large
Load Diff
1343
po/de/neochat.po
1343
po/de/neochat.po
File diff suppressed because it is too large
Load Diff
1002
po/el/neochat.po
1002
po/el/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
992
po/es/neochat.po
992
po/es/neochat.po
File diff suppressed because it is too large
Load Diff
1086
po/eu/neochat.po
1086
po/eu/neochat.po
File diff suppressed because it is too large
Load Diff
1024
po/fi/neochat.po
1024
po/fi/neochat.po
File diff suppressed because it is too large
Load Diff
1008
po/fr/neochat.po
1008
po/fr/neochat.po
File diff suppressed because it is too large
Load Diff
1048
po/hu/neochat.po
1048
po/hu/neochat.po
File diff suppressed because it is too large
Load Diff
1067
po/ia/neochat.po
1067
po/ia/neochat.po
File diff suppressed because it is too large
Load Diff
1099
po/id/neochat.po
1099
po/id/neochat.po
File diff suppressed because it is too large
Load Diff
1007
po/ie/neochat.po
1007
po/ie/neochat.po
File diff suppressed because it is too large
Load Diff
997
po/it/neochat.po
997
po/it/neochat.po
File diff suppressed because it is too large
Load Diff
974
po/ja/neochat.po
974
po/ja/neochat.po
File diff suppressed because it is too large
Load Diff
990
po/ka/neochat.po
990
po/ka/neochat.po
File diff suppressed because it is too large
Load Diff
1046
po/ko/neochat.po
1046
po/ko/neochat.po
File diff suppressed because it is too large
Load Diff
965
po/lt/neochat.po
965
po/lt/neochat.po
File diff suppressed because it is too large
Load Diff
994
po/nl/neochat.po
994
po/nl/neochat.po
File diff suppressed because it is too large
Load Diff
167
po/nn/neochat.po
167
po/nn/neochat.po
@@ -6,7 +6,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: neochat\n"
|
||||
"Report-Msgid-Bugs-To: https://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2023-03-31 00:47+0000\n"
|
||||
"POT-Creation-Date: 2023-05-20 02:32+0000\n"
|
||||
"PO-Revision-Date: 2021-12-15 11:17+0100\n"
|
||||
"Last-Translator: Øystein Steffensen-Alværvik <oysteins.omsetting@protonmail."
|
||||
"com>\n"
|
||||
@@ -125,90 +125,90 @@ msgstr ""
|
||||
msgid "Network Error"
|
||||
msgstr "Nettverksfeil"
|
||||
|
||||
#: src/main.cpp:153
|
||||
#: src/main.cpp:154
|
||||
#, kde-format
|
||||
msgid "NeoChat"
|
||||
msgstr "NeoChat"
|
||||
|
||||
#: src/main.cpp:155
|
||||
#: src/main.cpp:156
|
||||
#, kde-format
|
||||
msgid "Matrix client"
|
||||
msgstr "Matrix-klient"
|
||||
|
||||
#: src/main.cpp:157
|
||||
#: src/main.cpp:158
|
||||
#, kde-format
|
||||
msgid "© 2018-2020 Black Hat, 2020-2022 KDE Community"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:158
|
||||
#: src/main.cpp:159
|
||||
#, kde-format
|
||||
msgid "Carl Schwan"
|
||||
msgstr "Carl Schwan"
|
||||
|
||||
#: src/main.cpp:158 src/main.cpp:159 src/main.cpp:160
|
||||
#: src/main.cpp:159 src/main.cpp:160 src/main.cpp:161
|
||||
#, kde-format
|
||||
msgid "Maintainer"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:159
|
||||
#: src/main.cpp:160
|
||||
#, kde-format
|
||||
msgid "Tobias Fella"
|
||||
msgstr "Tobias Fella"
|
||||
|
||||
#: src/main.cpp:160
|
||||
#: src/main.cpp:161
|
||||
#, kde-format
|
||||
msgid "James Graham"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:161
|
||||
#: src/main.cpp:162
|
||||
#, kde-format
|
||||
msgid "Black Hat"
|
||||
msgstr "Black Hat"
|
||||
|
||||
#: src/main.cpp:161
|
||||
#: src/main.cpp:162
|
||||
#, kde-format
|
||||
msgid "Original author of Spectral"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:162
|
||||
#: src/main.cpp:163
|
||||
#, kde-format
|
||||
msgid "Alexey Rusakov"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:162
|
||||
#: src/main.cpp:163
|
||||
#, kde-format
|
||||
msgid "Maintainer of Quotient"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:163
|
||||
#: src/main.cpp:164
|
||||
#, kde-format
|
||||
msgctxt "NAME OF TRANSLATORS"
|
||||
msgid "Your names"
|
||||
msgstr "Karl Ove Hufthammer"
|
||||
|
||||
#: src/main.cpp:163
|
||||
#: src/main.cpp:164
|
||||
#, kde-format
|
||||
msgctxt "EMAIL OF TRANSLATORS"
|
||||
msgid "Your emails"
|
||||
msgstr "karl@huftis.org"
|
||||
|
||||
#: src/main.cpp:167
|
||||
#: src/main.cpp:168
|
||||
#, kde-format
|
||||
msgid "A Qt5 library to write cross-platform clients for Matrix"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:170
|
||||
#: src/main.cpp:171
|
||||
#, kde-format
|
||||
msgctxt "<version number> (built against <possibly different version number>)"
|
||||
msgid "%1 (built against %2)"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:306
|
||||
#: src/main.cpp:307
|
||||
#, kde-format
|
||||
msgid "Client for the matrix communication protocol"
|
||||
msgstr "Lynmeldingsklient for Matrix-protokollen"
|
||||
|
||||
#: src/main.cpp:307
|
||||
#: src/main.cpp:308
|
||||
#, kde-format
|
||||
msgid "Supports matrix: url scheme"
|
||||
msgstr ""
|
||||
@@ -631,50 +631,50 @@ msgctxt "'Custom' is a category of emoji"
|
||||
msgid "Custom"
|
||||
msgstr ""
|
||||
|
||||
#: src/models/messageeventmodel.cpp:362 src/models/searchmodel.cpp:156
|
||||
#: src/models/messageeventmodel.cpp:359 src/models/searchmodel.cpp:156
|
||||
#, kde-format
|
||||
msgid "Today"
|
||||
msgstr "I dag"
|
||||
|
||||
#: src/models/messageeventmodel.cpp:365 src/models/searchmodel.cpp:159
|
||||
#: src/models/messageeventmodel.cpp:362 src/models/searchmodel.cpp:159
|
||||
#, kde-format
|
||||
msgid "Yesterday"
|
||||
msgstr "I går"
|
||||
|
||||
#: src/models/messageeventmodel.cpp:368 src/models/searchmodel.cpp:162
|
||||
#: src/models/messageeventmodel.cpp:365 src/models/searchmodel.cpp:162
|
||||
#, kde-format
|
||||
msgid "The day before yesterday"
|
||||
msgstr "I forgårs"
|
||||
|
||||
#: src/models/messageeventmodel.cpp:470 src/models/messageeventmodel.cpp:479
|
||||
#: src/models/messageeventmodel.cpp:467 src/models/messageeventmodel.cpp:476
|
||||
#, kde-format
|
||||
msgid "<i>[This message was deleted]</i>"
|
||||
msgstr "<i>[Denne meldinga er sletta]</i>"
|
||||
|
||||
#: src/models/messageeventmodel.cpp:471
|
||||
#: src/models/messageeventmodel.cpp:468
|
||||
#, kde-format
|
||||
msgid "<i>[This message was deleted: %1]</i>"
|
||||
msgstr "<i>[Denne meldinga er sletta: %1]</i>"
|
||||
|
||||
# Eller «SENSURERT»?
|
||||
#: src/models/messageeventmodel.cpp:568
|
||||
#: src/models/messageeventmodel.cpp:563
|
||||
#, kde-format
|
||||
msgid "[REDACTED]"
|
||||
msgstr "[TREKT TILBAKE]"
|
||||
|
||||
#: src/models/messageeventmodel.cpp:568
|
||||
#: src/models/messageeventmodel.cpp:563
|
||||
#, kde-format
|
||||
msgid "[REDACTED: %1]"
|
||||
msgstr "[TREKT TILBAKE: %1]"
|
||||
|
||||
#: src/models/messageeventmodel.cpp:882
|
||||
#: src/models/messageeventmodel.cpp:848
|
||||
#, kde-format
|
||||
msgid "1 user: "
|
||||
msgid_plural "%1 users: "
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: src/models/messageeventmodel.cpp:889
|
||||
#: src/models/messageeventmodel.cpp:855
|
||||
#, kde-format
|
||||
msgctxt "list separator"
|
||||
msgid ", "
|
||||
@@ -1138,7 +1138,7 @@ msgstr ""
|
||||
msgid "Send a message…"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ChatBox/ChatBar.qml:308
|
||||
#: src/qml/Component/ChatBox/ChatBar.qml:273
|
||||
#, kde-format
|
||||
msgctxt "@action:button"
|
||||
msgid "Cancel reply"
|
||||
@@ -1149,36 +1149,6 @@ msgstr ""
|
||||
msgid "NeoChat is offline. Please check your network connection."
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ChatBox/QuickFormatBar.qml:23
|
||||
#, kde-format
|
||||
msgid "Bold"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ChatBox/QuickFormatBar.qml:42
|
||||
#, kde-format
|
||||
msgid "Italic"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ChatBox/QuickFormatBar.qml:61
|
||||
#, kde-format
|
||||
msgid "Strikethrough"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ChatBox/QuickFormatBar.qml:80
|
||||
#, kde-format
|
||||
msgid "Code block"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ChatBox/QuickFormatBar.qml:99
|
||||
#, kde-format
|
||||
msgid "Quote"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ChatBox/QuickFormatBar.qml:118
|
||||
#, kde-format
|
||||
msgid "Insert link"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ChatBox/ReplyPane.qml:32
|
||||
#, kde-format
|
||||
msgid "Replying to:"
|
||||
@@ -1189,7 +1159,7 @@ msgstr ""
|
||||
msgid "No emojis"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/ExploreComponent.qml:19 src/qml/Page/RoomListPage.qml:221
|
||||
#: src/qml/Component/ExploreComponent.qml:19 src/qml/Page/RoomListPage.qml:224
|
||||
#, kde-format
|
||||
msgid "Explore rooms"
|
||||
msgstr "Utforsk rom"
|
||||
@@ -1292,6 +1262,7 @@ msgid "Matrix ID:"
|
||||
msgstr "Matrix-ID:"
|
||||
|
||||
#: src/qml/Component/Login/Login.qml:52 src/qml/Component/Login/Sso.qml:45
|
||||
#: src/qml/Page/LoadingPage.qml:9
|
||||
#, kde-format
|
||||
msgid "Loading…"
|
||||
msgstr ""
|
||||
@@ -1500,34 +1471,32 @@ msgctxt "@title:window"
|
||||
msgid "Login"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/UserInfo.qml:145 src/qml/Menu/AccountMenu.qml:17
|
||||
#: src/qml/Component/UserInfo.qml:145
|
||||
#, kde-format
|
||||
msgid "Edit this account"
|
||||
msgstr "Rediger kontoen"
|
||||
|
||||
#: src/qml/Component/UserInfo.qml:150 src/qml/Menu/AccountMenu.qml:22
|
||||
#: src/qml/Settings/AccountsPage.qml:36
|
||||
#: src/qml/Component/UserInfo.qml:150 src/qml/Settings/AccountsPage.qml:36
|
||||
#, kde-format
|
||||
msgid "Account editor"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/UserInfo.qml:183
|
||||
#: src/qml/Component/UserInfo.qml:178
|
||||
#, kde-format
|
||||
msgid "Switch User"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/UserInfo.qml:199 src/qml/Page/InviteUserPage.qml:42
|
||||
#: src/qml/Component/UserInfo.qml:194 src/qml/Page/InviteUserPage.qml:42
|
||||
#, kde-format
|
||||
msgid "Add"
|
||||
msgstr "Legg til"
|
||||
|
||||
#: src/qml/Component/UserInfo.qml:210 src/qml/Menu/AccountMenu.qml:28
|
||||
#: src/qml/Menu/AccountMenu.qml:33 src/qml/Menu/GlobalMenu.qml:28
|
||||
#: src/qml/Component/UserInfo.qml:205 src/qml/Menu/GlobalMenu.qml:28
|
||||
#, kde-format
|
||||
msgid "Configure"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Component/UserInfo.qml:211
|
||||
#: src/qml/Component/UserInfo.qml:206
|
||||
#, kde-format
|
||||
msgid "Open Settings"
|
||||
msgstr ""
|
||||
@@ -1925,22 +1894,6 @@ msgstr ""
|
||||
msgid "Do you want to start a chat with %1?"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Menu/AccountMenu.qml:26
|
||||
#, kde-format
|
||||
msgid "Notification settings"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Menu/AccountMenu.qml:31 src/qml/Settings/DevicesPage.qml:14
|
||||
#: src/qml/Settings/DevicesPage.qml:26 src/qml/Settings/SettingsPage.qml:56
|
||||
#, kde-format
|
||||
msgid "Devices"
|
||||
msgstr "Einingar"
|
||||
|
||||
#: src/qml/Menu/AccountMenu.qml:36
|
||||
#, kde-format
|
||||
msgid "Logout"
|
||||
msgstr "Logg ut"
|
||||
|
||||
#: src/qml/Menu/EditMenu.qml:17
|
||||
#, kde-format
|
||||
msgctxt "text editing menu action"
|
||||
@@ -2504,38 +2457,38 @@ msgstr ""
|
||||
msgid "Joined"
|
||||
msgstr "Vart med"
|
||||
|
||||
#: src/qml/Page/RoomListPage.qml:55
|
||||
#: src/qml/Page/RoomListPage.qml:58
|
||||
#, kde-format
|
||||
msgctxt "@action:button"
|
||||
msgid "Show All Rooms"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Page/RoomListPage.qml:218
|
||||
#: src/qml/Page/RoomListPage.qml:221
|
||||
#, kde-format
|
||||
msgid "No rooms found"
|
||||
msgstr "Fann ingen rom"
|
||||
|
||||
#: src/qml/Page/RoomListPage.qml:218
|
||||
#: src/qml/Page/RoomListPage.qml:221
|
||||
#, kde-format
|
||||
msgid "Join some rooms to get started"
|
||||
msgstr "Start ved å verta med i nokre rom"
|
||||
|
||||
#: src/qml/Page/RoomListPage.qml:221
|
||||
#: src/qml/Page/RoomListPage.qml:224
|
||||
#, kde-format
|
||||
msgid "Search in room directory"
|
||||
msgstr "Søk i romkatalogen"
|
||||
|
||||
#: src/qml/Page/RoomListPage.qml:319 src/qml/Page/RoomListPage.qml:371
|
||||
#: src/qml/Page/RoomListPage.qml:322 src/qml/Page/RoomListPage.qml:374
|
||||
#, kde-format
|
||||
msgid "No Name"
|
||||
msgstr "Namnlaus"
|
||||
|
||||
#: src/qml/Page/RoomListPage.qml:386
|
||||
#: src/qml/Page/RoomListPage.qml:389
|
||||
#, kde-format
|
||||
msgid "Muted room"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Page/RoomListPage.qml:413
|
||||
#: src/qml/Page/RoomListPage.qml:416
|
||||
#, kde-format
|
||||
msgid "Configure room"
|
||||
msgstr "Set opp rommet"
|
||||
@@ -2599,12 +2552,12 @@ msgctxt "@action:title"
|
||||
msgid "Search Messages"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Page/SearchPage.qml:58
|
||||
#: src/qml/Page/SearchPage.qml:59
|
||||
#, kde-format
|
||||
msgid "Enter a text to start searching"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Page/SearchPage.qml:64
|
||||
#: src/qml/Page/SearchPage.qml:65
|
||||
#, kde-format
|
||||
msgid "No results found"
|
||||
msgstr ""
|
||||
@@ -2707,23 +2660,23 @@ msgstr[1] "%1 medlemmar"
|
||||
msgid "No Member Count"
|
||||
msgstr "Manglar medlemstal"
|
||||
|
||||
#: src/qml/RoomSettings/Categories.qml:16 src/qml/RoomSettings/General.qml:20
|
||||
#: src/qml/Settings/SettingsPage.qml:13
|
||||
#: src/qml/RoomSettings/Categories.qml:15 src/qml/RoomSettings/General.qml:20
|
||||
#: src/qml/Settings/SettingsPage.qml:12
|
||||
#, kde-format
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/RoomSettings/Categories.qml:27 src/qml/RoomSettings/Security.qml:19
|
||||
#: src/qml/RoomSettings/Categories.qml:25 src/qml/RoomSettings/Security.qml:19
|
||||
#, kde-format
|
||||
msgid "Security"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/RoomSettings/Categories.qml:38
|
||||
#: src/qml/RoomSettings/Categories.qml:35
|
||||
#, kde-format
|
||||
msgid "Permissions"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/RoomSettings/Categories.qml:49 src/qml/Settings/SettingsPage.qml:25
|
||||
#: src/qml/RoomSettings/Categories.qml:45 src/qml/Settings/SettingsPage.qml:22
|
||||
#, kde-format
|
||||
msgid "Notifications"
|
||||
msgstr ""
|
||||
@@ -3224,7 +3177,7 @@ msgid "Homeserver url"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Settings/AccountsPage.qml:15 src/qml/Settings/AccountsPage.qml:26
|
||||
#: src/qml/Settings/SettingsPage.qml:31
|
||||
#: src/qml/Settings/SettingsPage.qml:27
|
||||
#, kde-format
|
||||
msgid "Accounts"
|
||||
msgstr "Kontoar"
|
||||
@@ -3320,6 +3273,12 @@ msgstr ""
|
||||
msgid "Color theme"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Settings/DevicesPage.qml:14 src/qml/Settings/DevicesPage.qml:26
|
||||
#: src/qml/Settings/SettingsPage.qml:48
|
||||
#, kde-format
|
||||
msgid "Devices"
|
||||
msgstr "Einingar"
|
||||
|
||||
#: src/qml/Settings/DevicesPage.qml:86
|
||||
#, kde-format
|
||||
msgid "New device name"
|
||||
@@ -3586,7 +3545,7 @@ msgid "Call invitation"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Settings/NetworkProxyPage.qml:27
|
||||
#: src/qml/Settings/SettingsPage.qml:50
|
||||
#: src/qml/Settings/SettingsPage.qml:43
|
||||
#, kde-format
|
||||
msgid "Network Proxy"
|
||||
msgstr ""
|
||||
@@ -3667,27 +3626,27 @@ msgstr ""
|
||||
msgid "Delete keyword"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Settings/SettingsPage.qml:19
|
||||
#: src/qml/Settings/SettingsPage.qml:17
|
||||
#, kde-format
|
||||
msgid "Appearance"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Settings/SettingsPage.qml:37
|
||||
#: src/qml/Settings/SettingsPage.qml:32
|
||||
#, kde-format
|
||||
msgid "Custom Emojis"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Settings/SettingsPage.qml:43
|
||||
#: src/qml/Settings/SettingsPage.qml:37
|
||||
#, kde-format
|
||||
msgid "Spell Checking"
|
||||
msgstr ""
|
||||
|
||||
#: src/qml/Settings/SettingsPage.qml:62
|
||||
#: src/qml/Settings/SettingsPage.qml:53
|
||||
#, kde-format
|
||||
msgid "About NeoChat"
|
||||
msgstr "Om Neochat"
|
||||
|
||||
#: src/qml/Settings/SettingsPage.qml:68
|
||||
#: src/qml/Settings/SettingsPage.qml:58
|
||||
#, kde-format
|
||||
msgid "About KDE"
|
||||
msgstr ""
|
||||
|
||||
1048
po/pa/neochat.po
1048
po/pa/neochat.po
File diff suppressed because it is too large
Load Diff
990
po/pl/neochat.po
990
po/pl/neochat.po
File diff suppressed because it is too large
Load Diff
1193
po/pt/neochat.po
1193
po/pt/neochat.po
File diff suppressed because it is too large
Load Diff
1046
po/pt_BR/neochat.po
1046
po/pt_BR/neochat.po
File diff suppressed because it is too large
Load Diff
1469
po/ru/neochat.po
1469
po/ru/neochat.po
File diff suppressed because it is too large
Load Diff
1038
po/sk/neochat.po
1038
po/sk/neochat.po
File diff suppressed because it is too large
Load Diff
992
po/sl/neochat.po
992
po/sl/neochat.po
File diff suppressed because it is too large
Load Diff
1032
po/sv/neochat.po
1032
po/sv/neochat.po
File diff suppressed because it is too large
Load Diff
992
po/ta/neochat.po
992
po/ta/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1000
po/tr/neochat.po
1000
po/tr/neochat.po
File diff suppressed because it is too large
Load Diff
990
po/uk/neochat.po
990
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
@@ -30,6 +30,7 @@ add_library(neochat STATIC
|
||||
models/devicesmodel.cpp
|
||||
filetypesingleton.cpp
|
||||
login.cpp
|
||||
stickerevent.cpp
|
||||
models/webshortcutmodel.cpp
|
||||
blurhash.cpp
|
||||
blurhashimageprovider.cpp
|
||||
@@ -46,12 +47,8 @@ add_library(neochat STATIC
|
||||
filetransferpseudojob.cpp
|
||||
models/searchmodel.cpp
|
||||
texthandler.cpp
|
||||
pollevent.cpp
|
||||
pollhandler.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(neochat PUBLIC "-DQT_NO_KEYWORDS")
|
||||
|
||||
add_executable(neochat-app
|
||||
main.cpp
|
||||
res.qrc
|
||||
@@ -63,6 +60,14 @@ target_link_libraries(neochat-app PRIVATE
|
||||
neochat
|
||||
)
|
||||
|
||||
if(Quotient_VERSION_MINOR GREATER 6)
|
||||
target_compile_definitions(neochat PUBLIC QUOTIENT_07)
|
||||
target_sources(neochat PRIVATE pollevent.cpp pollhandler.cpp)
|
||||
else()
|
||||
target_compile_definitions(neochat PUBLIC QUOTIENT_VERSION=\"${Quotient_VERSION}\")
|
||||
target_sources(neochat PRIVATE neochataccountregistry.cpp)
|
||||
endif()
|
||||
|
||||
ecm_add_app_icon(NEOCHAT_ICON ICONS ${CMAKE_SOURCE_DIR}/128-logo.png)
|
||||
|
||||
target_sources(neochat-app PRIVATE ${NEOCHAT_ICON})
|
||||
@@ -90,7 +95,6 @@ endif()
|
||||
|
||||
target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR})
|
||||
target_link_libraries(neochat PUBLIC Qt::Core Qt::Quick Qt::Qml Qt::Gui Qt::Multimedia Qt::Network Qt::QuickControls2 KF${QT_MAJOR_VERSION}::I18n KF${QT_MAJOR_VERSION}::Kirigami2 KF${QT_MAJOR_VERSION}::Notifications KF${QT_MAJOR_VERSION}::ConfigCore KF${QT_MAJOR_VERSION}::ConfigGui KF${QT_MAJOR_VERSION}::CoreAddons KF${QT_MAJOR_VERSION}::SonnetCore KF${QT_MAJOR_VERSION}::ItemModels Quotient cmark::cmark ${QTKEYCHAIN_LIBRARIES} QCoro::Core)
|
||||
|
||||
kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc)
|
||||
|
||||
if(NEOCHAT_FLATPAK)
|
||||
@@ -171,10 +175,6 @@ if(ANDROID)
|
||||
"window-new"
|
||||
"globe"
|
||||
"visibility"
|
||||
"home"
|
||||
"preferences-desktop-notification"
|
||||
"computer-symbolic"
|
||||
"gps"
|
||||
)
|
||||
else()
|
||||
target_link_libraries(neochat PUBLIC Qt::Widgets KF${QT_MAJOR_VERSION}::KIOWidgets)
|
||||
|
||||
@@ -138,13 +138,12 @@ int ChatDocumentHandler::completionStartIndex() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_ANDROID) && QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
|
||||
const long long cursor = cursorPosition();
|
||||
#else
|
||||
const auto cursor = cursorPosition();
|
||||
#endif
|
||||
const auto &text = getText();
|
||||
|
||||
auto start = std::min(cursor, text.size()) - 1;
|
||||
while (start > -1) {
|
||||
if (text.at(start) == QLatin1Char(' ')) {
|
||||
@@ -325,35 +324,3 @@ void ChatDocumentHandler::pushMention(const Mention mention) const
|
||||
m_room->mentions()->push_back(mention);
|
||||
}
|
||||
}
|
||||
|
||||
QColor ChatDocumentHandler::mentionColor() const
|
||||
{
|
||||
return m_mentionColor;
|
||||
}
|
||||
|
||||
void ChatDocumentHandler::setMentionColor(const QColor &color)
|
||||
{
|
||||
if (m_mentionColor == color) {
|
||||
return;
|
||||
}
|
||||
m_mentionColor = color;
|
||||
m_highlighter->mentionFormat.setForeground(m_mentionColor);
|
||||
m_highlighter->rehighlight();
|
||||
Q_EMIT mentionColorChanged();
|
||||
}
|
||||
|
||||
QColor ChatDocumentHandler::errorColor() const
|
||||
{
|
||||
return m_errorColor;
|
||||
}
|
||||
|
||||
void ChatDocumentHandler::setErrorColor(const QColor &color)
|
||||
{
|
||||
if (m_errorColor == color) {
|
||||
return;
|
||||
}
|
||||
m_errorColor = color;
|
||||
m_highlighter->errorFormat.setForeground(m_errorColor);
|
||||
m_highlighter->rehighlight();
|
||||
Q_EMIT errorColorChanged();
|
||||
}
|
||||
|
||||
@@ -35,9 +35,6 @@ class ChatDocumentHandler : public QObject
|
||||
|
||||
Q_PROPERTY(NeoChatRoom *room READ room WRITE setRoom NOTIFY roomChanged)
|
||||
|
||||
Q_PROPERTY(QColor mentionColor READ mentionColor WRITE setMentionColor NOTIFY mentionColorChanged);
|
||||
Q_PROPERTY(QColor errorColor READ errorColor WRITE setErrorColor NOTIFY errorColorChanged);
|
||||
|
||||
public:
|
||||
explicit ChatDocumentHandler(QObject *parent = nullptr);
|
||||
|
||||
@@ -63,13 +60,6 @@ public:
|
||||
|
||||
void updateCompletions();
|
||||
CompletionModel *completionModel() const;
|
||||
|
||||
[[nodiscard]] QColor mentionColor() const;
|
||||
void setMentionColor(const QColor &color);
|
||||
|
||||
[[nodiscard]] QColor errorColor() const;
|
||||
void setErrorColor(const QColor &color);
|
||||
|
||||
Q_SIGNALS:
|
||||
void isEditChanged();
|
||||
void documentChanged();
|
||||
@@ -78,8 +68,6 @@ Q_SIGNALS:
|
||||
void completionModelChanged();
|
||||
void selectionStartChanged();
|
||||
void selectionEndChanged();
|
||||
void errorColorChanged();
|
||||
void mentionColorChanged();
|
||||
|
||||
private:
|
||||
int completionStartIndex() const;
|
||||
@@ -88,12 +76,9 @@ private:
|
||||
|
||||
QQuickTextDocument *m_document;
|
||||
|
||||
NeoChatRoom *m_room = nullptr;
|
||||
QPointer<NeoChatRoom> m_room;
|
||||
bool completionVisible = false;
|
||||
|
||||
QColor m_mentionColor;
|
||||
QColor m_errorColor;
|
||||
|
||||
int m_cursorPosition;
|
||||
int m_selectionStart;
|
||||
int m_selectionEnd;
|
||||
|
||||
@@ -31,7 +31,11 @@
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <accountregistry.h>
|
||||
#ifdef QUOTIENT_07
|
||||
#include "accountregistry.h"
|
||||
#else
|
||||
#include "neochataccountregistry.h"
|
||||
#endif
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/content-repo.h>
|
||||
@@ -39,8 +43,11 @@
|
||||
#include <csapi/profile.h>
|
||||
#include <jobs/downloadfilejob.h>
|
||||
#include <qt_connection_util.h>
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
#include <csapi/notifications.h>
|
||||
#include <eventstats.h>
|
||||
#endif
|
||||
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatroom.h"
|
||||
@@ -49,8 +56,6 @@
|
||||
#include "roommanager.h"
|
||||
#include "windowcontroller.h"
|
||||
|
||||
#include <accountregistry.h>
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
#include "trayicon.h"
|
||||
#elif !defined(Q_OS_ANDROID)
|
||||
@@ -88,28 +93,10 @@ Controller::Controller(QObject *parent)
|
||||
});
|
||||
#endif
|
||||
|
||||
connectUntil(&Accounts, &AccountRegistry::rowsInserted, this, [this]() {
|
||||
if (auto *connection = Accounts.get(NeoChatConfig::self()->activeConnection())) {
|
||||
connectSingleShot(connection, &Connection::loadedRoomState, this, [this, connection]() {
|
||||
setActiveConnection(connection);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
QTimer::singleShot(0, this, [this] {
|
||||
invokeLogin();
|
||||
});
|
||||
|
||||
connect(&Accounts, &AccountRegistry::rowsRemoved, this, [this]() {
|
||||
if (!Accounts.isLoggedIn(NeoChatConfig::self()->activeConnection())) {
|
||||
if (Accounts.size() > 0) {
|
||||
setActiveConnection(Accounts.accounts().at(0));
|
||||
} else {
|
||||
setActiveConnection(nullptr);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
QMetaObject::invokeMethod(&Accounts, &AccountRegistry::invokeLogin);
|
||||
|
||||
QObject::connect(QGuiApplication::instance(), &QCoreApplication::aboutToQuit, QGuiApplication::instance(), [] {
|
||||
NeoChatConfig::self()->save();
|
||||
});
|
||||
@@ -138,29 +125,23 @@ Controller::Controller(QObject *parent)
|
||||
}
|
||||
#endif
|
||||
|
||||
connect(&Accounts, &AccountRegistry::accountCountChanged, this, &Controller::activeConnectionIndexChanged);
|
||||
connect(&AccountRegistry::instance(), &AccountRegistry::accountCountChanged, this, &Controller::activeConnectionIndexChanged);
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
static int oldAccountCount = 0;
|
||||
connect(&Accounts, &AccountRegistry::accountCountChanged, this, [this]() {
|
||||
if (Accounts.size() > oldAccountCount) {
|
||||
auto connection = Accounts.accounts()[Accounts.size() - 1];
|
||||
connect(connection, &Connection::syncDone, this, [this, connection]() {
|
||||
bool changes = false;
|
||||
for (const auto &room : connection->allRooms()) {
|
||||
if (m_notificationCounts[room] != room->unreadStats().notableCount) {
|
||||
m_notificationCounts[room] = room->unreadStats().notableCount;
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
if (changes) {
|
||||
handleNotifications(connection);
|
||||
}
|
||||
connect(&AccountRegistry::instance(), &AccountRegistry::accountCountChanged, this, [=]() {
|
||||
if (AccountRegistry::instance().size() > oldAccountCount) {
|
||||
auto connection = AccountRegistry::instance().accounts()[AccountRegistry::instance().size() - 1];
|
||||
connect(connection, &Connection::syncDone, this, [=]() {
|
||||
handleNotifications(connection);
|
||||
});
|
||||
}
|
||||
oldAccountCount = Accounts.size();
|
||||
oldAccountCount = AccountRegistry::instance().size();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
void Controller::handleNotifications(QPointer<Quotient::Connection> connection)
|
||||
{
|
||||
static QStringList initial;
|
||||
@@ -234,6 +215,7 @@ void Controller::handleNotifications(QPointer<Quotient::Connection> connection)
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
Controller &Controller::instance()
|
||||
{
|
||||
@@ -246,10 +228,239 @@ void Controller::showWindow()
|
||||
WindowController::instance().showAndRaiseWindow(QString());
|
||||
}
|
||||
|
||||
void Controller::loginWithAccessToken(const QString &serverAddr, const QString &user, const QString &token, const QString &deviceName)
|
||||
{
|
||||
if (user.isEmpty() || token.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QUrl serverUrl(serverAddr);
|
||||
|
||||
auto conn = new Connection();
|
||||
if (serverUrl.isValid()) {
|
||||
conn->setHomeserver(serverUrl);
|
||||
}
|
||||
|
||||
connect(conn, &Connection::connected, this, [this, conn, deviceName] {
|
||||
AccountSettings account(conn->userId());
|
||||
account.setKeepLoggedIn(true);
|
||||
account.setHomeserver(conn->homeserver());
|
||||
account.setDeviceId(conn->deviceId());
|
||||
account.setDeviceName(deviceName);
|
||||
if (!saveAccessTokenToKeyChain(account, conn->accessToken())) {
|
||||
qWarning() << "Couldn't save access token";
|
||||
}
|
||||
account.sync();
|
||||
addConnection(conn);
|
||||
setActiveConnection(conn);
|
||||
});
|
||||
connect(conn, &Connection::networkError, this, [this](QString error, const QString &, int, int) {
|
||||
Q_EMIT errorOccured(i18n("Network Error: %1", error));
|
||||
});
|
||||
conn->assumeIdentity(user, token, deviceName);
|
||||
}
|
||||
|
||||
void Controller::logout(Connection *conn, bool serverSideLogout)
|
||||
{
|
||||
if (!conn) {
|
||||
qCritical() << "Attempt to logout null connection";
|
||||
return;
|
||||
}
|
||||
|
||||
SettingsGroup("Accounts").remove(conn->userId());
|
||||
|
||||
QKeychain::DeletePasswordJob job(qAppName());
|
||||
job.setAutoDelete(true);
|
||||
job.setKey(conn->userId());
|
||||
QEventLoop loop;
|
||||
QKeychain::DeletePasswordJob::connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
|
||||
job.start();
|
||||
loop.exec();
|
||||
|
||||
if (AccountRegistry::instance().count() > 1) {
|
||||
// Only set the connection if the the account being logged out is currently active
|
||||
if (conn == activeConnection()) {
|
||||
setActiveConnection(AccountRegistry::instance().accounts()[0]);
|
||||
}
|
||||
} else {
|
||||
setActiveConnection(nullptr);
|
||||
}
|
||||
if (!serverSideLogout) {
|
||||
return;
|
||||
}
|
||||
conn->logout();
|
||||
}
|
||||
|
||||
void Controller::addConnection(Connection *c)
|
||||
{
|
||||
Q_ASSERT_X(c, __FUNCTION__, "Attempt to add a null connection");
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
AccountRegistry::instance().add(c);
|
||||
#endif
|
||||
|
||||
c->setLazyLoading(true);
|
||||
|
||||
connect(c, &Connection::syncDone, this, [this, c] {
|
||||
setBusy(false);
|
||||
|
||||
Q_EMIT syncDone();
|
||||
|
||||
c->sync(30000);
|
||||
c->saveState();
|
||||
});
|
||||
connect(c, &Connection::loggedOut, this, [this, c] {
|
||||
dropConnection(c);
|
||||
});
|
||||
|
||||
connect(c, &Connection::requestFailed, this, [this](BaseJob *job) {
|
||||
if (job->error() == BaseJob::UserConsentRequiredError) {
|
||||
Q_EMIT userConsentRequired(job->errorUrl());
|
||||
}
|
||||
});
|
||||
|
||||
setBusy(true);
|
||||
|
||||
c->sync();
|
||||
|
||||
Q_EMIT connectionAdded(c);
|
||||
Q_EMIT accountCountChanged();
|
||||
}
|
||||
|
||||
void Controller::dropConnection(Connection *c)
|
||||
{
|
||||
Q_ASSERT_X(c, __FUNCTION__, "Attempt to drop a null connection");
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
AccountRegistry::instance().drop(c);
|
||||
#endif
|
||||
|
||||
Q_EMIT connectionDropped(c);
|
||||
Q_EMIT accountCountChanged();
|
||||
#ifndef QUOTIENT_07
|
||||
c->deleteLater();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Controller::invokeLogin()
|
||||
{
|
||||
const auto accounts = SettingsGroup("Accounts").childGroups();
|
||||
QString id = NeoChatConfig::self()->activeConnection();
|
||||
for (const auto &accountId : accounts) {
|
||||
AccountSettings account{accountId};
|
||||
if (id.isEmpty()) {
|
||||
// handle case where the account config is empty
|
||||
id = accountId;
|
||||
}
|
||||
if (!account.homeserver().isEmpty()) {
|
||||
auto accessTokenLoadingJob = loadAccessTokenFromKeyChain(account);
|
||||
connect(accessTokenLoadingJob, &QKeychain::Job::finished, this, [accountId, id, this, accessTokenLoadingJob](QKeychain::Job *) {
|
||||
AccountSettings account{accountId};
|
||||
QString accessToken;
|
||||
if (accessTokenLoadingJob->error() == QKeychain::Error::NoError) {
|
||||
accessToken = accessTokenLoadingJob->binaryData();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
auto connection = new Connection(account.homeserver());
|
||||
connect(connection, &Connection::connected, this, [this, connection, id] {
|
||||
connection->loadState();
|
||||
addConnection(connection);
|
||||
if (connection->userId() == id) {
|
||||
setActiveConnection(connection);
|
||||
connectSingleShot(connection, &Connection::syncDone, this, &Controller::initiated);
|
||||
}
|
||||
});
|
||||
connect(connection, &Connection::loginError, this, [this, connection](const QString &error, const QString &) {
|
||||
if (error == "Unrecognised access token") {
|
||||
Q_EMIT errorOccured(i18n("Login Failed: Access Token invalid or revoked"));
|
||||
logout(connection, false);
|
||||
} else if (error == "Connection closed") {
|
||||
Q_EMIT errorOccured(i18n("Login Failed: %1", error));
|
||||
// Failed due to network connection issue. This might happen when the homeserver is
|
||||
// temporary down, or the user trying to re-launch NeoChat in a network that cannot
|
||||
// connect to the homeserver. In this case, we don't want to do logout().
|
||||
} else {
|
||||
Q_EMIT errorOccured(i18n("Login Failed: %1", error));
|
||||
logout(connection, true);
|
||||
}
|
||||
Q_EMIT initiated();
|
||||
});
|
||||
connect(connection, &Connection::networkError, this, [this](const QString &error, const QString &, int, int) {
|
||||
Q_EMIT errorOccured(i18n("Network Error: %1", error));
|
||||
});
|
||||
connection->assumeIdentity(account.userId(), accessToken, account.deviceId());
|
||||
});
|
||||
}
|
||||
}
|
||||
if (accounts.isEmpty()) {
|
||||
Q_EMIT initiated();
|
||||
}
|
||||
}
|
||||
|
||||
QKeychain::ReadPasswordJob *Controller::loadAccessTokenFromKeyChain(const AccountSettings &account)
|
||||
{
|
||||
qDebug() << "Reading access token from the keychain for" << account.userId();
|
||||
auto job = new QKeychain::ReadPasswordJob(qAppName(), this);
|
||||
job->setKey(account.userId());
|
||||
|
||||
// Handling of errors
|
||||
connect(job, &QKeychain::Job::finished, this, [this, &account, job]() {
|
||||
if (job->error() == QKeychain::Error::NoError) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (job->error()) {
|
||||
case QKeychain::EntryNotFound:
|
||||
Q_EMIT globalErrorOccured(i18n("Access token wasn't found"), i18n("Maybe it was deleted?"));
|
||||
break;
|
||||
case QKeychain::AccessDeniedByUser:
|
||||
case QKeychain::AccessDenied:
|
||||
Q_EMIT globalErrorOccured(i18n("Access to keychain was denied."), i18n("Please allow NeoChat to read the access token"));
|
||||
break;
|
||||
case QKeychain::NoBackendAvailable:
|
||||
Q_EMIT globalErrorOccured(i18n("No keychain available."), i18n("Please install a keychain, e.g. KWallet or GNOME keyring on Linux"));
|
||||
break;
|
||||
case QKeychain::OtherError:
|
||||
Q_EMIT globalErrorOccured(i18n("Unable to read access token"), job->errorString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
job->start();
|
||||
|
||||
return job;
|
||||
}
|
||||
|
||||
bool Controller::saveAccessTokenToKeyChain(const AccountSettings &account, const QByteArray &accessToken)
|
||||
{
|
||||
qDebug() << "Save the access token to the keychain for " << account.userId();
|
||||
QKeychain::WritePasswordJob job(qAppName());
|
||||
job.setAutoDelete(false);
|
||||
job.setKey(account.userId());
|
||||
job.setBinaryData(accessToken);
|
||||
QEventLoop loop;
|
||||
QKeychain::WritePasswordJob::connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
|
||||
job.start();
|
||||
loop.exec();
|
||||
|
||||
if (job.error()) {
|
||||
qWarning() << "Could not save access token to the keychain: " << qPrintable(job.errorString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Controller::changeAvatar(Connection *conn, const QUrl &localFile)
|
||||
{
|
||||
auto job = conn->uploadFile(localFile.toLocalFile());
|
||||
#ifdef QUOTIENT_07
|
||||
if (isJobPending(job)) {
|
||||
#else
|
||||
if (isJobRunning(job)) {
|
||||
#endif
|
||||
connect(job, &BaseJob::success, this, [conn, job] {
|
||||
conn->callApi<SetAvatarUrlJob>(conn->userId(), job->contentUri());
|
||||
});
|
||||
@@ -276,7 +487,7 @@ bool Controller::supportSystemTray() const
|
||||
|
||||
void Controller::changePassword(Connection *connection, const QString ¤tPassword, const QString &newPassword)
|
||||
{
|
||||
auto *job = connection->callApi<NeochatChangePasswordJob>(newPassword, false);
|
||||
NeochatChangePasswordJob *job = connection->callApi<NeochatChangePasswordJob>(newPassword, false);
|
||||
connect(job, &BaseJob::result, this, [this, job, currentPassword, newPassword, connection] {
|
||||
if (job->error() == 103) {
|
||||
QJsonObject replyData = job->jsonData();
|
||||
@@ -287,7 +498,7 @@ void Controller::changePassword(Connection *connection, const QString ¤tPa
|
||||
authData["user"] = connection->user()->id();
|
||||
QJsonObject identifier = {{"type", "m.id.user"}, {"user", connection->user()->id()}};
|
||||
authData["identifier"] = identifier;
|
||||
auto *innerJob = connection->callApi<NeochatChangePasswordJob>(newPassword, false, authData);
|
||||
NeochatChangePasswordJob *innerJob = connection->callApi<NeochatChangePasswordJob>(newPassword, false, authData);
|
||||
connect(innerJob, &BaseJob::success, this, [this]() {
|
||||
Q_EMIT passwordStatus(PasswordStatus::Success);
|
||||
});
|
||||
@@ -307,7 +518,11 @@ bool Controller::setAvatar(Connection *connection, const QUrl &avatarSource)
|
||||
User *localUser = connection->user();
|
||||
QString decoded = avatarSource.path();
|
||||
if (decoded.isEmpty()) {
|
||||
#ifdef QUOTIENT_07
|
||||
connection->callApi<SetAvatarUrlJob>(localUser->id(), avatarSource);
|
||||
#else
|
||||
connection->callApi<SetAvatarUrlJob>(localUser->id(), QString());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
if (QImageReader(decoded).read().isNull()) {
|
||||
@@ -318,7 +533,11 @@ bool Controller::setAvatar(Connection *connection, const QUrl &avatarSource)
|
||||
}
|
||||
|
||||
NeochatChangePasswordJob::NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Omittable<QJsonObject> &auth)
|
||||
#ifdef QUOTIENT_07
|
||||
: BaseJob(HttpVerb::Post, QStringLiteral("ChangePasswordJob"), "/_matrix/client/r0/account/password")
|
||||
#else
|
||||
: BaseJob(HttpVerb::Post, QStringLiteral("ChangePasswordJob"), QStringLiteral("/_matrix/client/r0/account/password"))
|
||||
#endif
|
||||
{
|
||||
QJsonObject _data;
|
||||
addParam<>(_data, QStringLiteral("new_password"), newPassword);
|
||||
@@ -327,12 +546,9 @@ NeochatChangePasswordJob::NeochatChangePasswordJob(const QString &newPassword, b
|
||||
setRequestData(_data);
|
||||
}
|
||||
|
||||
NeochatDeleteDeviceJob::NeochatDeleteDeviceJob(const QString &deviceId, const Omittable<QJsonObject> &auth)
|
||||
: Quotient::BaseJob(HttpVerb::Delete, QStringLiteral("DeleteDeviceJob"), QStringLiteral("/matrix/client/r0/devices/%1").arg(deviceId).toLatin1())
|
||||
int Controller::accountCount() const
|
||||
{
|
||||
QJsonObject _data;
|
||||
addParam<IfNotEmpty>(_data, QStringLiteral("auth"), auth);
|
||||
setRequestData(std::move(_data));
|
||||
return AccountRegistry::instance().count();
|
||||
}
|
||||
|
||||
bool Controller::quitOnLastWindowClosed()
|
||||
@@ -413,6 +629,18 @@ void Controller::saveWindowGeometry()
|
||||
WindowController::instance().saveGeometry();
|
||||
}
|
||||
|
||||
NeochatDeleteDeviceJob::NeochatDeleteDeviceJob(const QString &deviceId, const Omittable<QJsonObject> &auth)
|
||||
#ifdef QUOTIENT_07
|
||||
: Quotient::BaseJob(HttpVerb::Delete, QStringLiteral("DeleteDeviceJob"), QStringLiteral("/_matrix/client/r0/devices/%1").arg(deviceId).toLatin1())
|
||||
#else
|
||||
: Quotient::BaseJob(HttpVerb::Delete, QStringLiteral("DeleteDeviceJob"), QStringLiteral("/_matrix/client/r0/devices/%1").arg(deviceId))
|
||||
#endif
|
||||
{
|
||||
QJsonObject _data;
|
||||
addParam<IfNotEmpty>(_data, QStringLiteral("auth"), auth);
|
||||
setRequestData(std::move(_data));
|
||||
}
|
||||
|
||||
void Controller::createRoom(const QString &name, const QString &topic)
|
||||
{
|
||||
auto createRoomJob = m_connection->createRoom(Connection::PublishRoom, "", name, topic, QStringList());
|
||||
@@ -423,7 +651,7 @@ void Controller::createRoom(const QString &name, const QString &topic)
|
||||
this,
|
||||
&Controller::roomAdded,
|
||||
this,
|
||||
[](NeoChatRoom *room) {
|
||||
[this](NeoChatRoom *room) {
|
||||
RoomManager::instance().enterRoom(room);
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
@@ -503,7 +731,11 @@ QString Controller::plainText(QQuickTextDocument *document) const
|
||||
|
||||
bool Controller::encryptionSupported() const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
return Quotient::encryptionSupported();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Controller::forceRefreshTextDocument(QQuickTextDocument *textDocument, QQuickItem *item)
|
||||
@@ -544,10 +776,29 @@ void Controller::setApplicationProxy()
|
||||
|
||||
int Controller::activeConnectionIndex() const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
auto result = std::find_if(Accounts.accounts().begin(), Accounts.accounts().end(), [this](const auto &it) {
|
||||
return it == m_connection;
|
||||
});
|
||||
return result - Accounts.accounts().begin();
|
||||
#else
|
||||
for (int i = 0; i < AccountRegistry::instance().rowCount(); i++) {
|
||||
if (AccountRegistry::instance().data(AccountRegistry::instance().index(i, 0), AccountRegistry::UserIdRole).toString() == m_connection->userId()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int Controller::quotientMinorVersion() const
|
||||
{
|
||||
// TODO libQuotient 0.7: Replace with version function from libQuotient
|
||||
#ifdef QUOTIENT_07
|
||||
return 7;
|
||||
#else
|
||||
return 6;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Controller::isFlatpak() const
|
||||
|
||||
@@ -23,9 +23,15 @@ class Connection;
|
||||
class Room;
|
||||
}
|
||||
|
||||
namespace QKeychain
|
||||
{
|
||||
class ReadPasswordJob;
|
||||
}
|
||||
|
||||
class Controller : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int accountCount READ accountCount NOTIFY accountCountChanged)
|
||||
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed NOTIFY quitOnLastWindowClosedChanged)
|
||||
Q_PROPERTY(Quotient::Connection *activeConnection READ activeConnection WRITE setActiveConnection NOTIFY activeConnectionChanged)
|
||||
Q_PROPERTY(bool busy READ busy WRITE setBusy NOTIFY busyChanged)
|
||||
@@ -34,6 +40,7 @@ class Controller : public QObject
|
||||
Q_PROPERTY(bool isOnline READ isOnline NOTIFY isOnlineChanged)
|
||||
Q_PROPERTY(bool encryptionSupported READ encryptionSupported CONSTANT)
|
||||
Q_PROPERTY(int activeConnectionIndex READ activeConnectionIndex NOTIFY activeConnectionIndexChanged)
|
||||
Q_PROPERTY(int quotientMinorVersion READ quotientMinorVersion CONSTANT)
|
||||
Q_PROPERTY(bool isFlatpak READ isFlatpak CONSTANT)
|
||||
|
||||
public:
|
||||
@@ -42,10 +49,17 @@ public:
|
||||
void setActiveConnection(Quotient::Connection *connection);
|
||||
[[nodiscard]] Quotient::Connection *activeConnection() const;
|
||||
|
||||
void addConnection(Quotient::Connection *c);
|
||||
void dropConnection(Quotient::Connection *c);
|
||||
|
||||
Q_INVOKABLE void loginWithAccessToken(const QString &, const QString &, const QString &, const QString &);
|
||||
|
||||
Q_INVOKABLE void changePassword(Quotient::Connection *connection, const QString ¤tPassword, const QString &newPassword);
|
||||
|
||||
Q_INVOKABLE bool setAvatar(Quotient::Connection *connection, const QUrl &avatarSource);
|
||||
|
||||
[[nodiscard]] int accountCount() const;
|
||||
|
||||
[[nodiscard]] static bool quitOnLastWindowClosed();
|
||||
void setQuitOnLastWindowClosed(bool value);
|
||||
|
||||
@@ -54,6 +68,8 @@ public:
|
||||
|
||||
[[nodiscard]] bool supportSystemTray() const;
|
||||
|
||||
bool saveAccessTokenToKeyChain(const Quotient::AccountSettings &account, const QByteArray &accessToken);
|
||||
|
||||
int activeConnectionIndex() const;
|
||||
|
||||
enum PasswordStatus {
|
||||
@@ -84,6 +100,7 @@ public:
|
||||
|
||||
Q_INVOKABLE void setApplicationProxy();
|
||||
|
||||
int quotientMinorVersion() const;
|
||||
bool isFlatpak() const;
|
||||
|
||||
private:
|
||||
@@ -93,15 +110,20 @@ private:
|
||||
bool m_busy = false;
|
||||
TrayIcon *m_trayIcon = nullptr;
|
||||
|
||||
QKeychain::ReadPasswordJob *loadAccessTokenFromKeyChain(const Quotient::AccountSettings &account);
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings() const;
|
||||
bool m_isOnline = true;
|
||||
QMap<Quotient::Room *, int> m_notificationCounts;
|
||||
|
||||
bool hasWindowSystem() const;
|
||||
#ifdef QUOTIENT_07
|
||||
void handleNotifications(QPointer<Quotient::Connection> connection);
|
||||
#endif
|
||||
|
||||
private Q_SLOTS:
|
||||
void invokeLogin();
|
||||
void showWindow();
|
||||
|
||||
Q_SIGNALS:
|
||||
@@ -114,6 +136,7 @@ Q_SIGNALS:
|
||||
void syncDone();
|
||||
void connectionAdded(Quotient::Connection *_t1);
|
||||
void connectionDropped(Quotient::Connection *_t1);
|
||||
void accountCountChanged();
|
||||
void initiated();
|
||||
void notificationClicked(const QString &_t1, const QString &_t2);
|
||||
void quitOnLastWindowClosedChanged();
|
||||
@@ -131,12 +154,13 @@ Q_SIGNALS:
|
||||
void roomAdded(NeoChatRoom *room);
|
||||
|
||||
public Q_SLOTS:
|
||||
void logout(Quotient::Connection *conn, bool serverSideLogout);
|
||||
void changeAvatar(Quotient::Connection *conn, const QUrl &localFile);
|
||||
static void markAllMessagesAsRead(Quotient::Connection *conn);
|
||||
void saveWindowGeometry();
|
||||
};
|
||||
|
||||
// TODO libQuotient 0.?: Drop
|
||||
// TODO libQuotient 0.7: Drop
|
||||
class NeochatChangePasswordJob : public Quotient::BaseJob
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -25,7 +25,6 @@ void FileTransferPseudoJob::fileTransferProgress(QString id, qint64 progress, qi
|
||||
|
||||
void FileTransferPseudoJob::fileTransferCompleted(QString id, QUrl localFile)
|
||||
{
|
||||
Q_UNUSED(localFile);
|
||||
if (id != m_eventId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,17 +7,30 @@
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
class JoinRulesEvent : public StateEvent
|
||||
#else
|
||||
class JoinRulesEvent : public StateEventBase
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
#ifdef QUOTIENT_07
|
||||
QUO_EVENT(JoinRulesEvent, "m.room.join_rules")
|
||||
#else
|
||||
DEFINE_EVENT_TYPEID("m.room.join_rules", JoinRulesEvent)
|
||||
#endif
|
||||
|
||||
explicit JoinRulesEvent(const QJsonObject &obj)
|
||||
#ifdef QUOTIENT_07
|
||||
: StateEvent(obj)
|
||||
#else
|
||||
: StateEventBase(typeId(), obj)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
QString joinRule() const;
|
||||
QJsonArray allow() const;
|
||||
};
|
||||
REGISTER_EVENT_TYPE(JoinRulesEvent)
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@
|
||||
|
||||
#include "login.h"
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
#include <accountregistry.h>
|
||||
#else
|
||||
#include "neochataccountregistry.h"
|
||||
#endif
|
||||
|
||||
#include <connection.h>
|
||||
#include <qt_connection_util.h>
|
||||
|
||||
#include "controller.h"
|
||||
#include "neochatroom.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
@@ -40,7 +43,7 @@ void Login::init()
|
||||
return;
|
||||
}
|
||||
|
||||
m_isLoggedIn = Accounts.isLoggedIn(m_matrixId);
|
||||
m_isLoggedIn = AccountRegistry::instance().isLoggedIn(m_matrixId);
|
||||
Q_EMIT isLoggedInChanged();
|
||||
if (m_isLoggedIn) {
|
||||
return;
|
||||
@@ -71,7 +74,11 @@ void Login::init()
|
||||
account.setHomeserver(m_connection->homeserver());
|
||||
account.setDeviceId(m_connection->deviceId());
|
||||
account.setDeviceName(m_deviceName);
|
||||
if (!Controller::instance().saveAccessTokenToKeyChain(account, m_connection->accessToken())) {
|
||||
qWarning() << "Couldn't save access token";
|
||||
}
|
||||
account.sync();
|
||||
Controller::instance().addConnection(m_connection);
|
||||
Controller::instance().setActiveConnection(m_connection);
|
||||
m_connection = nullptr;
|
||||
});
|
||||
@@ -90,9 +97,8 @@ void Login::init()
|
||||
Q_EMIT Controller::instance().globalErrorOccured(i18n("Network Error"), std::move(error));
|
||||
});
|
||||
|
||||
connectSingleShot(m_connection, &Connection::loadedRoomState, this, [this]() {
|
||||
Controller::instance().setActiveConnection(m_connection);
|
||||
// TODO close settings window
|
||||
connectSingleShot(m_connection, &Connection::syncDone, this, [this]() {
|
||||
Q_EMIT Controller::instance().initiated();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
31
src/main.cpp
31
src/main.cpp
@@ -28,14 +28,15 @@
|
||||
|
||||
#include "neochat-version.h"
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
#include <accountregistry.h>
|
||||
#else
|
||||
#include "neochataccountregistry.h"
|
||||
#endif
|
||||
|
||||
#include <networkaccessmanager.h>
|
||||
#include <room.h>
|
||||
#include <util.h>
|
||||
#include <keyverificationsession.h>
|
||||
#include <accountregistry.h>
|
||||
#include <room.h>
|
||||
#include <networkaccessmanager.h>
|
||||
|
||||
#include "actionshandler.h"
|
||||
#include "blurhashimageprovider.h"
|
||||
@@ -43,6 +44,7 @@
|
||||
#include "clipboard.h"
|
||||
#include "controller.h"
|
||||
#include "filetypesingleton.h"
|
||||
#include "joinrulesevent.h"
|
||||
#include "linkpreviewer.h"
|
||||
#include "login.h"
|
||||
#include "matriximageprovider.h"
|
||||
@@ -67,11 +69,16 @@
|
||||
#include "neochatroom.h"
|
||||
#include "neochatuser.h"
|
||||
#include "notificationsmanager.h"
|
||||
#ifdef QUOTIENT_07
|
||||
#include "pollhandler.h"
|
||||
#endif
|
||||
#include "roommanager.h"
|
||||
#include "spacehierarchycache.h"
|
||||
#include "urlhelper.h"
|
||||
#include "windowcontroller.h"
|
||||
#ifdef QUOTIENT_07
|
||||
#include <keyverificationsession.h>
|
||||
#endif
|
||||
#ifdef HAVE_COLORSCHEME
|
||||
#include "colorschemer.h"
|
||||
#endif
|
||||
@@ -79,7 +86,6 @@
|
||||
#include "models/statemodel.h"
|
||||
#include "neochatuser.h"
|
||||
|
||||
|
||||
#ifdef HAVE_RUNNER
|
||||
#include "runner.h"
|
||||
#include <QDBusConnection>
|
||||
@@ -160,10 +166,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
about.addComponent(QStringLiteral("libQuotient"),
|
||||
i18n("A Qt5 library to write cross-platform clients for Matrix"),
|
||||
#ifdef QUOTIENT_07
|
||||
i18nc("<version number> (built against <possibly different version number>)",
|
||||
"%1 (built against %2)",
|
||||
Quotient::versionString(),
|
||||
QStringLiteral(Quotient_VERSION_STRING)),
|
||||
#else
|
||||
QStringLiteral(QUOTIENT_VERSION),
|
||||
#endif
|
||||
QStringLiteral("https://github.com/quotient-im/libquotient"),
|
||||
KAboutLicense::LGPL_V2_1);
|
||||
|
||||
@@ -200,8 +210,11 @@ int main(int argc, char *argv[])
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "LoginHelper", login);
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "UrlHelper", &urlHelper);
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "EmojiModel", &EmojiModel::instance());
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Accounts", &Quotient::Accounts);
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Accounts", &Quotient::Accounts);
|
||||
#ifdef QUOTIENT_07
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "AccountRegistry", &Quotient::Accounts);
|
||||
#else
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "AccountRegistry", &Quotient::AccountRegistry::instance());
|
||||
#endif
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "SpaceHierarchyCache", &SpaceHierarchyCache::instance());
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "CustomEmojiModel", &CustomEmojiModel::instance());
|
||||
qmlRegisterType<ActionsHandler>("org.kde.neochat", 1, 0, "ActionsHandler");
|
||||
@@ -223,7 +236,9 @@ int main(int argc, char *argv[])
|
||||
qmlRegisterType<CompletionModel>("org.kde.neochat", 1, 0, "CompletionModel");
|
||||
qmlRegisterType<StateModel>("org.kde.neochat", 1, 0, "StateModel");
|
||||
qmlRegisterType<SearchModel>("org.kde.neochat", 1, 0, "SearchModel");
|
||||
#ifdef QUOTIENT_07
|
||||
qmlRegisterType<PollHandler>("org.kde.neochat", 1, 0, "PollHandler");
|
||||
#endif
|
||||
qmlRegisterType<KeywordNotificationRuleModel>("org.kde.neochat", 1, 0, "KeywordNotificationRuleModel");
|
||||
qmlRegisterUncreatableType<RoomMessageEvent>("org.kde.neochat", 1, 0, "RoomMessageEvent", "ENUM");
|
||||
qmlRegisterUncreatableType<PushNotificationState>("org.kde.neochat", 1, 0, "PushNotificationState", "ENUM");
|
||||
@@ -242,10 +257,12 @@ int main(int argc, char *argv[])
|
||||
qRegisterMetaType<NeoChatUser *>("NeoChatUser*");
|
||||
qRegisterMetaType<GetRoomEventsJob *>("GetRoomEventsJob*");
|
||||
qRegisterMetaType<QMimeType>("QMimeType");
|
||||
#ifdef QUOTIENT_07
|
||||
#ifdef Quotient_E2EE_ENABLED
|
||||
qRegisterMetaType<KeyVerificationSession *>("KeyVerificationSession*");
|
||||
qmlRegisterUncreatableType<KeyVerificationSession>("org.kde.neochat", 1, 0, "KeyVerificationSession", {});
|
||||
qRegisterMetaType<QVector<EmojiEntry>>("QVector<EmojiEntry>");
|
||||
#endif
|
||||
#endif
|
||||
qmlRegisterSingletonType("org.kde.neochat", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue {
|
||||
return engine->toScriptValue(KAboutData::applicationData());
|
||||
|
||||
@@ -19,41 +19,6 @@ QStringList rainbowColors{"#ff2b00", "#ff5500", "#ff8000", "#ffaa00", "#ffd500",
|
||||
"#00ff2b", "#00ff55", "#00ff80", "#00ffaa", "#00ffd5", "#00ffff", "#00d4ff", "#00aaff", "#007fff", "#0055ff", "#002bff", "#0000ff",
|
||||
"#2a00ff", "#5500ff", "#7f00ff", "#aa00ff", "#d400ff", "#ff00ff", "#ff00d4", "#ff00aa", "#ff0080", "#ff0055", "#ff002b", "#ff0000"};
|
||||
|
||||
auto leaveRoomLambda = [](const QString &text, NeoChatRoom *room) {
|
||||
if (text.isEmpty()) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18n("Leaving this room."));
|
||||
room->connection()->leaveRoom(room);
|
||||
} else {
|
||||
QRegularExpression roomRegex(QStringLiteral(R"(^[#!][^:]+:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?)"));
|
||||
auto regexMatch = roomRegex.match(text);
|
||||
if (!regexMatch.hasMatch()) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error,
|
||||
i18nc("'<text>' does not look like a room id or alias.", "'%1' does not look like a room id or alias.", text));
|
||||
return QString();
|
||||
}
|
||||
auto leaving = room->connection()->room(text);
|
||||
if (!leaving) {
|
||||
leaving = room->connection()->roomByAlias(text);
|
||||
}
|
||||
if (leaving) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Leaving room <roomname>.", "Leaving room %1.", text));
|
||||
room->connection()->leaveRoom(leaving);
|
||||
} else {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Room <roomname> not found", "Room %1 not found.", text));
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
};
|
||||
|
||||
auto roomNickLambda = [](const QString &text, NeoChatRoom *room) {
|
||||
if (text.isEmpty()) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18n("No new nickname provided, no changes will happen."));
|
||||
} else {
|
||||
room->connection()->user()->rename(text, room);
|
||||
}
|
||||
return QString();
|
||||
};
|
||||
|
||||
QVector<ActionsModel::Action> actions{
|
||||
Action{
|
||||
QStringLiteral("shrug"),
|
||||
@@ -192,6 +157,7 @@ QVector<ActionsModel::Action> actions{
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18nc("'<text>' does not look like a matrix id.", "'%1' does not look like a matrix id.", text));
|
||||
return QString();
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
const RoomMemberEvent *roomMemberEvent = room->currentState().get<RoomMemberEvent>(text);
|
||||
if (roomMemberEvent && roomMemberEvent->membership() == Membership::Invite) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("<user> is already invited to this room.", "%1 is already invited to this room.", text));
|
||||
@@ -201,6 +167,7 @@ QVector<ActionsModel::Action> actions{
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("<user> is banned from this room.", "%1 is banned from this room.", text));
|
||||
return QString();
|
||||
}
|
||||
#endif
|
||||
if (room->localUser()->id() == text) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Positive, i18n("You are already in this room."));
|
||||
return QString();
|
||||
@@ -242,6 +209,7 @@ QVector<ActionsModel::Action> actions{
|
||||
kli18n("<room alias or id>"),
|
||||
kli18n("Joins the given room"),
|
||||
},
|
||||
#ifdef QUOTIENT_07
|
||||
Action{
|
||||
QStringLiteral("knock"),
|
||||
[](const QString &text, NeoChatRoom *room) {
|
||||
@@ -274,6 +242,7 @@ QVector<ActionsModel::Action> actions{
|
||||
kli18n("<room alias or id> [<reason>]"),
|
||||
kli18n("Requests to join the given room"),
|
||||
},
|
||||
#endif
|
||||
Action{
|
||||
QStringLiteral("j"),
|
||||
[](const QString &text, NeoChatRoom *room) {
|
||||
@@ -299,7 +268,31 @@ QVector<ActionsModel::Action> actions{
|
||||
},
|
||||
Action{
|
||||
QStringLiteral("part"),
|
||||
leaveRoomLambda,
|
||||
[](const QString &text, NeoChatRoom *room) {
|
||||
if (text.isEmpty()) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18n("Leaving this room."));
|
||||
room->connection()->leaveRoom(room);
|
||||
} else {
|
||||
QRegularExpression roomRegex(QStringLiteral(R"(^[#!][^:]+:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?)"));
|
||||
auto regexMatch = roomRegex.match(text);
|
||||
if (!regexMatch.hasMatch()) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error,
|
||||
i18nc("'<text>' does not look like a room id or alias.", "'%1' does not look like a room id or alias.", text));
|
||||
return QString();
|
||||
}
|
||||
auto leaving = room->connection()->room(text);
|
||||
if (!leaving) {
|
||||
leaving = room->connection()->roomByAlias(text);
|
||||
}
|
||||
if (leaving) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Leaving room <roomname>.", "Leaving room %1.", text));
|
||||
room->connection()->leaveRoom(leaving);
|
||||
} else {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Room <roomname> not found", "Room %1 not found.", text));
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
},
|
||||
false,
|
||||
std::nullopt,
|
||||
kli18n("[<room alias or id>]"),
|
||||
@@ -307,7 +300,31 @@ QVector<ActionsModel::Action> actions{
|
||||
},
|
||||
Action{
|
||||
QStringLiteral("leave"),
|
||||
leaveRoomLambda,
|
||||
[](const QString &text, NeoChatRoom *room) {
|
||||
if (text.isEmpty()) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18n("Leaving this room."));
|
||||
room->connection()->leaveRoom(room);
|
||||
} else {
|
||||
QRegularExpression roomRegex(QStringLiteral(R"(^[#!][^:]+:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?)"));
|
||||
auto regexMatch = roomRegex.match(text);
|
||||
if (!regexMatch.hasMatch()) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error,
|
||||
i18nc("'<text>' does not look like a room id or alias.", "'%1' does not look like a room id or alias.", text));
|
||||
return QString();
|
||||
}
|
||||
auto leaving = room->connection()->room(text);
|
||||
if (!leaving) {
|
||||
leaving = room->connection()->roomByAlias(text);
|
||||
}
|
||||
if (leaving) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Leaving room <roomname>.", "Leaving room %1.", text));
|
||||
room->connection()->leaveRoom(leaving);
|
||||
} else {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Room <roomname> not found", "Room %1 not found.", text));
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
},
|
||||
false,
|
||||
std::nullopt,
|
||||
kli18n("[<room alias or id>]"),
|
||||
@@ -330,15 +347,14 @@ QVector<ActionsModel::Action> actions{
|
||||
},
|
||||
Action{
|
||||
QStringLiteral("roomnick"),
|
||||
roomNickLambda,
|
||||
false,
|
||||
std::nullopt,
|
||||
kli18n("<display name>"),
|
||||
kli18n("Changes your display name in this room"),
|
||||
},
|
||||
Action{
|
||||
QStringLiteral("myroomnick"),
|
||||
roomNickLambda,
|
||||
[](const QString &text, NeoChatRoom *room) {
|
||||
if (text.isEmpty()) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18n("No new nickname provided, no changes will happen."));
|
||||
} else {
|
||||
room->connection()->user()->rename(text, room);
|
||||
}
|
||||
return QString();
|
||||
},
|
||||
false,
|
||||
std::nullopt,
|
||||
kli18n("<display name>"),
|
||||
@@ -432,12 +448,14 @@ QVector<ActionsModel::Action> actions{
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18nc("'<text>' does not look like a matrix id.", "'%1' does not look like a matrix id.", text));
|
||||
return QString();
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
auto state = room->currentState().get<RoomMemberEvent>(parts[0]);
|
||||
if (state && state->membership() == Membership::Ban) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("<user> is already banned from this room.", "%1 is already banned from this room.", text));
|
||||
return QString();
|
||||
}
|
||||
auto plEvent = room->currentState().get<RoomPowerLevelsEvent>();
|
||||
#endif
|
||||
auto plEvent = room->getCurrentState<RoomPowerLevelsEvent>();
|
||||
if (plEvent->ban() > plEvent->powerLevelForUser(room->localUser()->id())) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18n("You are not allowed to ban users from this room."));
|
||||
return QString();
|
||||
@@ -467,16 +485,18 @@ QVector<ActionsModel::Action> actions{
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18nc("'<text>' does not look like a matrix id.", "'%1' does not look like a matrix id.", text));
|
||||
return QString();
|
||||
}
|
||||
auto plEvent = room->currentState().get<RoomPowerLevelsEvent>();
|
||||
auto plEvent = room->getCurrentState<RoomPowerLevelsEvent>();
|
||||
if (plEvent->ban() > plEvent->powerLevelForUser(room->localUser()->id())) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18n("You are not allowed to unban users from this room."));
|
||||
return QString();
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
auto state = room->currentState().get<RoomMemberEvent>(text);
|
||||
if (state && state->membership() != Membership::Ban) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("<user> is not banned from this room.", "%1 is not banned from this room.", text));
|
||||
return QString();
|
||||
}
|
||||
#endif
|
||||
room->unban(text);
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Positive, i18nc("<username> was unbanned from this room.", "%1 was unbanned from this room.", text));
|
||||
|
||||
@@ -503,11 +523,13 @@ QVector<ActionsModel::Action> actions{
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18n("You cannot kick yourself from the room."));
|
||||
return QString();
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
if (!room->isMember(parts[0])) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18nc("<username> is not in this room", "%1 is not in this room.", parts[0]));
|
||||
return QString();
|
||||
}
|
||||
auto plEvent = room->currentState().get<RoomPowerLevelsEvent>();
|
||||
#endif
|
||||
auto plEvent = room->getCurrentState<RoomPowerLevelsEvent>();
|
||||
auto kick = plEvent->kick();
|
||||
if (plEvent->powerLevelForUser(room->localUser()->id()) < kick) {
|
||||
Q_EMIT room->showMessage(NeoChatRoom::Error, i18n("You are not allowed to kick users from this room."));
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
bool CollapseStateProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
Q_UNUSED(source_parent);
|
||||
return sourceModel()->data(sourceModel()->index(source_row, 0), MessageEventModel::DelegateTypeRole)
|
||||
return sourceModel()->data(sourceModel()->index(source_row, 0), MessageEventModel::EventTypeRole)
|
||||
!= MessageEventModel::DelegateType::State // If this is not a state, show it
|
||||
|| sourceModel()->data(sourceModel()->index(source_row + 1, 0), MessageEventModel::DelegateTypeRole)
|
||||
|| sourceModel()->data(sourceModel()->index(source_row + 1, 0), MessageEventModel::EventTypeRole)
|
||||
!= MessageEventModel::DelegateType::State // If this is the first state in a block, show it. TODO hidden events?
|
||||
|| sourceModel()->data(sourceModel()->index(source_row, 0), MessageEventModel::ShowSectionRole).toBool(); // If it's a new day, show it
|
||||
}
|
||||
@@ -47,7 +47,7 @@ QString CollapseStateProxyModel::aggregateEventToString(int sourceRow) const
|
||||
if (!uniqueAuthors.contains(nextAuthor)) {
|
||||
uniqueAuthors.append(nextAuthor);
|
||||
}
|
||||
if (sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::DelegateTypeRole)
|
||||
if (sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::EventTypeRole)
|
||||
!= MessageEventModel::DelegateType::State // If it's not a state event
|
||||
|| sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::ShowSectionRole).toBool() // or the section needs to be visible
|
||||
) {
|
||||
@@ -105,7 +105,7 @@ QVariantList CollapseStateProxyModel::stateEventsList(int sourceRow) const
|
||||
{"text", sourceModel()->data(sourceModel()->index(i, 0), Qt::DisplayRole).toString()},
|
||||
};
|
||||
stateEvents.append(nextState);
|
||||
if (sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::DelegateTypeRole)
|
||||
if (sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::EventTypeRole)
|
||||
!= MessageEventModel::DelegateType::State // If it's not a state event
|
||||
|| sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::ShowSectionRole).toBool() // or the section needs to be visible
|
||||
) {
|
||||
@@ -123,7 +123,7 @@ QVariantList CollapseStateProxyModel::authorList(int sourceRow) const
|
||||
if (!uniqueAuthors.contains(nextAvatar)) {
|
||||
uniqueAuthors.append(nextAvatar);
|
||||
}
|
||||
if (sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::DelegateTypeRole)
|
||||
if (sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::EventTypeRole)
|
||||
!= MessageEventModel::DelegateType::State // If it's not a state event
|
||||
|| sourceModel()->data(sourceModel()->index(i - 1, 0), MessageEventModel::ShowSectionRole).toBool() // or the section needs to be visible
|
||||
) {
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
#define running isJobPending
|
||||
#else
|
||||
#define running isJobRunning
|
||||
#endif
|
||||
|
||||
void CustomEmojiModel::fetchEmojis()
|
||||
{
|
||||
if (!Controller::instance().activeConnection()) {
|
||||
@@ -51,12 +57,18 @@ void CustomEmojiModel::addEmoji(const QString &name, const QUrl &location)
|
||||
|
||||
auto job = Controller::instance().activeConnection()->uploadFile(location.toLocalFile());
|
||||
|
||||
if (isJobPending(job)) {
|
||||
connect(job, &BaseJob::success, this, [name, job] {
|
||||
if (running(job)) {
|
||||
connect(job, &BaseJob::success, this, [this, name, job] {
|
||||
const auto &data = Controller::instance().activeConnection()->accountData("im.ponies.user_emotes");
|
||||
auto json = data != nullptr ? data->contentJson() : QJsonObject();
|
||||
auto emojiData = json["images"].toObject();
|
||||
emojiData[QStringLiteral("%1").arg(name)] = QJsonObject({{QStringLiteral("url"), job->contentUri().toString()}});
|
||||
emojiData[QStringLiteral("%1").arg(name)] = QJsonObject({
|
||||
#ifdef QUOTIENT_07
|
||||
{QStringLiteral("url"), job->contentUri().toString()}
|
||||
#else
|
||||
{QStringLiteral("url"), job->contentUri()}
|
||||
#endif
|
||||
});
|
||||
json["images"] = emojiData;
|
||||
Controller::instance().activeConnection()->setAccountData("im.ponies.user_emotes", json);
|
||||
});
|
||||
@@ -129,9 +141,8 @@ QVariant CustomEmojiModel::data(const QModelIndex &idx, int role) const
|
||||
return QUrl(QStringLiteral("image://mxc/") + data.url.mid(6));
|
||||
case Roles::MxcUrl:
|
||||
return data.url.mid(6);
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ QHash<int, QByteArray> DevicesModel::roleNames() const
|
||||
|
||||
void DevicesModel::logout(int index, const QString &password)
|
||||
{
|
||||
auto job = Controller::instance().activeConnection()->callApi<DeleteDeviceJob>(m_devices[index].deviceId);
|
||||
auto job = Controller::instance().activeConnection()->callApi<NeochatDeleteDeviceJob>(m_devices[index].deviceId);
|
||||
|
||||
connect(job, &BaseJob::result, this, [this, job, password, index] {
|
||||
auto onSuccess = [this, index]() {
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
#include <events/roomavatarevent.h>
|
||||
#include <events/roommemberevent.h>
|
||||
#include <events/simplestateevents.h>
|
||||
#include <events/stickerevent.h>
|
||||
#include <user.h>
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
#include "pollevent.h"
|
||||
#endif
|
||||
#include "stickerevent.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
@@ -31,7 +33,7 @@ using namespace Quotient;
|
||||
QHash<int, QByteArray> MessageEventModel::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
|
||||
roles[DelegateTypeRole] = "delegateType";
|
||||
roles[EventTypeRole] = "eventType";
|
||||
roles[MessageRole] = "message";
|
||||
roles[EventIdRole] = "eventId";
|
||||
roles[TimeRole] = "time";
|
||||
@@ -43,16 +45,19 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const
|
||||
roles[SpecialMarksRole] = "marks";
|
||||
roles[LongOperationRole] = "progressInfo";
|
||||
roles[FileMimetypeIcon] = "fileMimetypeIcon";
|
||||
roles[AnnotationRole] = "annotation";
|
||||
roles[EventResolvedTypeRole] = "eventResolvedType";
|
||||
roles[IsReplyRole] = "isReply";
|
||||
roles[ReplyRole] = "reply";
|
||||
roles[ReplyIdRole] = "replyId";
|
||||
roles[UserMarkerRole] = "userMarker";
|
||||
roles[ShowAuthorRole] = "showAuthor";
|
||||
roles[ShowSectionRole] = "showSection";
|
||||
roles[ReadMarkersRole] = "readMarkers";
|
||||
roles[ReadMarkersStringRole] = "readMarkersString";
|
||||
roles[ShowReadMarkersRole] = "showReadMarkers";
|
||||
roles[ReactionRole] = "reaction";
|
||||
roles[IsEditedRole] = "isEdited";
|
||||
roles[SourceRole] = "source";
|
||||
roles[MimeTypeRole] = "mimeType";
|
||||
roles[FormattedBodyRole] = "formattedBody";
|
||||
@@ -64,14 +69,12 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const
|
||||
roles[IsRedactedRole] = "isRedacted";
|
||||
roles[GenericDisplayRole] = "genericDisplay";
|
||||
roles[IsPendingRole] = "isPending";
|
||||
roles[LatitudeRole] = "latitude";
|
||||
roles[LongitudeRole] = "longitude";
|
||||
roles[AssetRole] = "asset";
|
||||
return roles;
|
||||
}
|
||||
|
||||
MessageEventModel::MessageEventModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
, m_currentRoom(nullptr)
|
||||
{
|
||||
using namespace Quotient;
|
||||
qmlRegisterAnonymousType<FileTransferInfo>("org.kde.neochat", 1);
|
||||
@@ -84,11 +87,6 @@ MessageEventModel::MessageEventModel(QObject *parent)
|
||||
|
||||
MessageEventModel::~MessageEventModel() = default;
|
||||
|
||||
NeoChatRoom *MessageEventModel::room() const
|
||||
{
|
||||
return m_currentRoom;
|
||||
}
|
||||
|
||||
void MessageEventModel::setRoom(NeoChatRoom *room)
|
||||
{
|
||||
if (room == m_currentRoom) {
|
||||
@@ -107,7 +105,11 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
|
||||
if (m_currentRoom->timelineSize() < 10 && !room->allHistoryLoaded()) {
|
||||
room->getPreviousContent(50);
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
lastReadEventId = room->lastFullyReadEventId();
|
||||
#else
|
||||
lastReadEventId = room->readMarkerEventId();
|
||||
#endif
|
||||
|
||||
using namespace Quotient;
|
||||
connect(m_currentRoom, &Room::aboutToAddNewMessages, this, [this](RoomEventsRange events) {
|
||||
@@ -156,7 +158,11 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
|
||||
endInsertRows();
|
||||
if (!m_lastReadEventIndex.isValid()) {
|
||||
// no read marker, so see if we need to create one.
|
||||
#ifdef QUOTIENT_07
|
||||
moveReadMarker(m_currentRoom->lastFullyReadEventId());
|
||||
#else
|
||||
moveReadMarker(m_currentRoom->readMarkerEventId());
|
||||
#endif
|
||||
}
|
||||
if (biggest < m_currentRoom->maxTimelineIndex()) {
|
||||
auto rowBelowInserted = m_currentRoom->maxTimelineIndex() - biggest + timelineBaseIndex() - 1;
|
||||
@@ -197,7 +203,7 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
|
||||
beginRemoveRows({}, i, i);
|
||||
});
|
||||
connect(m_currentRoom, &Room::pendingEventDiscarded, this, &MessageEventModel::endRemoveRows);
|
||||
connect(m_currentRoom, &Room::fullyReadMarkerMoved, this, [this](const QString &fromEventId, const QString &toEventId) {
|
||||
connect(m_currentRoom, &Room::readMarkerMoved, this, [this](const QString &fromEventId, const QString &toEventId) {
|
||||
Q_UNUSED(fromEventId);
|
||||
moveReadMarker(toEventId);
|
||||
});
|
||||
@@ -220,6 +226,9 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
|
||||
connect(m_currentRoom, &Room::fileTransferProgress, this, &MessageEventModel::refreshEvent);
|
||||
connect(m_currentRoom, &Room::fileTransferCompleted, this, &MessageEventModel::refreshEvent);
|
||||
connect(m_currentRoom, &Room::fileTransferFailed, this, &MessageEventModel::refreshEvent);
|
||||
#ifndef QUOTIENT_07
|
||||
connect(m_currentRoom, &Room::fileTransferCancelled, this, &MessageEventModel::refreshEvent);
|
||||
#endif
|
||||
connect(m_currentRoom->connection(), &Connection::ignoredUsersListChanged, this, [this] {
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
@@ -305,7 +314,7 @@ int MessageEventModel::refreshEventRoles(const QString &id, const QVector<int> &
|
||||
return -1;
|
||||
}
|
||||
row = int(timelineIt - m_currentRoom->messageEvents().rbegin()) + timelineBaseIndex();
|
||||
if (data(index(row, 0), DelegateTypeRole).toInt() == ReadMarker || data(index(row, 0), DelegateTypeRole).toInt() == Other) {
|
||||
if (data(index(row, 0), EventTypeRole).toInt() == ReadMarker || data(index(row, 0), EventTypeRole).toInt() == Other) {
|
||||
row++;
|
||||
}
|
||||
}
|
||||
@@ -436,7 +445,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
|
||||
if (m_lastReadEventIndex.row() == row) {
|
||||
switch (role) {
|
||||
case DelegateTypeRole:
|
||||
case EventTypeRole:
|
||||
return DelegateType::ReadMarker;
|
||||
case TimeRole: {
|
||||
const QDateTime eventDate = data(index(m_lastReadEventIndex.row() + 1, 0), TimeRole).toDateTime().toLocalTime();
|
||||
@@ -485,10 +494,10 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (role == SourceRole) {
|
||||
return QJsonDocument(evt.fullJson()).toJson();
|
||||
return evt.originalJson();
|
||||
}
|
||||
|
||||
if (role == DelegateTypeRole) {
|
||||
if (role == EventTypeRole) {
|
||||
if (auto e = eventCast<const RoomMessageEvent>(&evt)) {
|
||||
switch (e->msgtype()) {
|
||||
case MessageEventType::Emote:
|
||||
@@ -501,8 +510,6 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
return DelegateType::Audio;
|
||||
case MessageEventType::Video:
|
||||
return DelegateType::Video;
|
||||
case MessageEventType::Location:
|
||||
return DelegateType::Location;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -521,18 +528,20 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
if (is<const EncryptedEvent>(evt)) {
|
||||
return DelegateType::Encrypted;
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
if (is<PollStartEvent>(evt)) {
|
||||
if (evt.isRedacted()) {
|
||||
return DelegateType::Message;
|
||||
}
|
||||
return DelegateType::Poll;
|
||||
}
|
||||
#endif
|
||||
|
||||
return DelegateType::Other;
|
||||
}
|
||||
|
||||
if (role == EventResolvedTypeRole) {
|
||||
return evt.type();
|
||||
return EventTypeRegistry::getMatrixType(evt.type());
|
||||
}
|
||||
|
||||
if (role == AuthorRole) {
|
||||
@@ -555,9 +564,6 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (auto e = eventCast<const RoomMessageEvent>(&evt)) {
|
||||
if (e->msgtype() == Quotient::MessageEventType::Location) {
|
||||
return e->contentJson();
|
||||
}
|
||||
// Cannot use e.contentJson() here because some
|
||||
// EventContent classes inject values into the copy of the
|
||||
// content JSON stored in EventContent::Base
|
||||
@@ -631,7 +637,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
return EventStatus::Hidden;
|
||||
}
|
||||
|
||||
if (evt.isStateEvent() && static_cast<const StateEvent &>(evt).repeatsState()) {
|
||||
if (evt.isStateEvent() && static_cast<const StateEventBase &>(evt).repeatsState()) {
|
||||
return EventStatus::Hidden;
|
||||
}
|
||||
|
||||
@@ -648,6 +654,14 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
return EventStatus::Normal;
|
||||
}
|
||||
|
||||
if (role == IsEditedRole) {
|
||||
if (auto e = eventCast<const RoomMessageEvent>(&evt)) {
|
||||
return !e->unsignedJson().isEmpty() && e->unsignedJson().contains("m.relations")
|
||||
&& e->unsignedJson()["m.relations"].toObject().contains("m.replace");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (role == EventIdRole) {
|
||||
return !evt.id().isEmpty() ? evt.id() : evt.transactionId();
|
||||
}
|
||||
@@ -663,11 +677,29 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
}
|
||||
|
||||
if (role == AnnotationRole) {
|
||||
if (isPending) {
|
||||
return pendingIt->annotation();
|
||||
}
|
||||
}
|
||||
|
||||
if (role == TimeRole || role == SectionRole) {
|
||||
auto ts = isPending ? pendingIt->lastUpdated() : makeMessageTimestamp(timelineIt);
|
||||
return role == TimeRole ? QVariant(ts) : renderDate(ts);
|
||||
}
|
||||
|
||||
if (role == UserMarkerRole) {
|
||||
QVariantList variantList;
|
||||
const auto users = m_currentRoom->usersAtEventId(evt.id());
|
||||
for (User *user : users) {
|
||||
if (user == m_currentRoom->localUser()) {
|
||||
continue;
|
||||
}
|
||||
variantList.append(QVariant::fromValue(user));
|
||||
}
|
||||
return variantList;
|
||||
}
|
||||
|
||||
if (role == IsReplyRole) {
|
||||
return !evt.contentJson()["m.relates_to"].toObject()["m.in_reply_to"].toObject()["event_id"].toString().isEmpty();
|
||||
}
|
||||
@@ -753,7 +785,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
// While the row is removed the subsequent row indexes are not changed so we need to skip over the removed index.
|
||||
// See - https://doc.qt.io/qt-5/qabstractitemmodel.html#beginRemoveRows
|
||||
if (data(i, SpecialMarksRole) != EventStatus::Hidden && !itemData(i).empty()) {
|
||||
return data(i, AuthorRole) != data(idx, AuthorRole) || data(i, DelegateTypeRole) == MessageEventModel::State
|
||||
return data(i, AuthorRole) != data(idx, AuthorRole) || data(i, EventTypeRole) == MessageEventModel::State
|
||||
|| data(i, TimeRole).toDateTime().msecsTo(data(idx, TimeRole).toDateTime()) > 600000
|
||||
|| data(i, TimeRole).toDateTime().toLocalTime().date().day() != data(idx, TimeRole).toDateTime().toLocalTime().date().day();
|
||||
}
|
||||
@@ -778,40 +810,23 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (role == LatitudeRole) {
|
||||
const auto geoUri = evt.contentJson()["geo_uri"_ls].toString();
|
||||
if (geoUri.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
const auto latitude = geoUri.split(u';')[0].split(u':')[1].split(u',')[0];
|
||||
return latitude.toFloat();
|
||||
}
|
||||
|
||||
if (role == LongitudeRole) {
|
||||
const auto geoUri = evt.contentJson()["geo_uri"_ls].toString();
|
||||
if (geoUri.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
const auto latitude = geoUri.split(u';')[0].split(u':')[1].split(u',')[1];
|
||||
return latitude.toFloat();
|
||||
}
|
||||
|
||||
if (role == AssetRole) {
|
||||
const auto assetType = evt.contentJson()["org.matrix.msc3488.asset"].toObject()["type"].toString();
|
||||
if (assetType.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
return assetType;
|
||||
}
|
||||
|
||||
if (role == ReadMarkersRole) {
|
||||
#ifdef QUOTIENT_07
|
||||
auto userIds = room()->userIdsAtEvent(evt.id());
|
||||
userIds.remove(m_currentRoom->localUser()->id());
|
||||
#else
|
||||
auto userIds = room()->usersAtEventId(evt.id());
|
||||
userIds.removeAll(m_currentRoom->localUser());
|
||||
#endif
|
||||
|
||||
QVariantList users;
|
||||
users.reserve(userIds.size());
|
||||
for (const auto &userId : userIds) {
|
||||
#ifdef QUOTIENT_07
|
||||
auto user = static_cast<NeoChatUser *>(m_currentRoom->user(userId));
|
||||
#else
|
||||
auto user = static_cast<NeoChatUser *>(userId);
|
||||
#endif
|
||||
users += userAtEvent(user, m_currentRoom, evt);
|
||||
}
|
||||
|
||||
@@ -819,15 +834,24 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (role == ReadMarkersStringRole) {
|
||||
#ifdef QUOTIENT_07
|
||||
auto userIds = room()->userIdsAtEvent(evt.id());
|
||||
userIds.remove(m_currentRoom->localUser()->id());
|
||||
#else
|
||||
auto userIds = room()->usersAtEventId(evt.id());
|
||||
userIds.removeAll(m_currentRoom->localUser());
|
||||
#endif
|
||||
/**
|
||||
* The string ends up in the form
|
||||
* "x users: user1DisplayName, user2DisplayName, etc."
|
||||
*/
|
||||
QString readMarkersString = i18np("1 user: ", "%1 users: ", userIds.size());
|
||||
for (const auto &userId : userIds) {
|
||||
#ifdef QUOTIENT_07
|
||||
auto user = static_cast<NeoChatUser *>(m_currentRoom->user(userId));
|
||||
#else
|
||||
auto user = static_cast<NeoChatUser *>(userId);
|
||||
#endif
|
||||
readMarkersString += user->displayname(m_currentRoom) + i18nc("list separator", ", ");
|
||||
}
|
||||
readMarkersString.chop(2);
|
||||
@@ -835,13 +859,18 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (role == ShowReadMarkersRole) {
|
||||
#ifdef QUOTIENT_07
|
||||
auto userIds = room()->userIdsAtEvent(evt.id());
|
||||
userIds.remove(m_currentRoom->localUser()->id());
|
||||
#else
|
||||
auto userIds = room()->usersAtEventId(evt.id());
|
||||
userIds.removeAll(m_currentRoom->localUser());
|
||||
#endif
|
||||
return userIds.size() > 0;
|
||||
}
|
||||
|
||||
if (role == ReactionRole) {
|
||||
const auto &annotations = m_currentRoom->relatedEvents(evt, EventRelation::AnnotationType);
|
||||
const auto &annotations = m_currentRoom->relatedEvents(evt, EventRelation::Annotation());
|
||||
if (annotations.isEmpty()) {
|
||||
return {};
|
||||
};
|
||||
@@ -851,7 +880,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
continue;
|
||||
}
|
||||
if (auto e = eventCast<const ReactionEvent>(a)) {
|
||||
reactions[e->eventId()].append(static_cast<NeoChatUser *>(m_currentRoom->user(e->senderId())));
|
||||
reactions[e->relation().key].append(static_cast<NeoChatUser *>(m_currentRoom->user(e->senderId())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,6 +907,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (role == MediaUrlRole) {
|
||||
#ifdef QUOTIENT_07
|
||||
if (auto e = eventCast<const RoomMessageEvent>(&evt)) {
|
||||
if (!e->hasFileContent()) {
|
||||
return QVariant();
|
||||
@@ -894,6 +924,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
// if (auto e = eventCast<const StickerEvent>(&evt)) {
|
||||
// return m_currentRoom->makeMediaUrl(e->id(), e->url());
|
||||
// }
|
||||
#endif
|
||||
|
||||
// Construct link in the same form as urlToDownload as that function doesn't work for stickers
|
||||
if (auto e = eventCast<const StickerEvent>(&evt)) {
|
||||
@@ -908,12 +939,14 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (role == VerifiedRole) {
|
||||
#ifdef QUOTIENT_07
|
||||
#ifdef Quotient_E2EE_ENABLED
|
||||
if (evt.originalEvent()) {
|
||||
auto encrypted = dynamic_cast<const EncryptedEvent *>(evt.originalEvent());
|
||||
Q_ASSERT(encrypted);
|
||||
return m_currentRoom->connection()->isVerifiedSession(encrypted->sessionId().toLatin1());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -941,13 +974,13 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (role == IsPendingRole) {
|
||||
return row < static_cast<int>(m_currentRoom->pendingEvents().size());
|
||||
return row < m_currentRoom->pendingEvents().size();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
int MessageEventModel::eventIdToRow(const QString &eventID) const
|
||||
int MessageEventModel::eventIDToIndex(const QString &eventID) const
|
||||
{
|
||||
const auto it = m_currentRoom->findInTimeline(eventID);
|
||||
if (it == m_currentRoom->historyEdge()) {
|
||||
@@ -989,7 +1022,7 @@ QVariant MessageEventModel::getLastLocalUserMessageEventId()
|
||||
targetMessage.insert("event_id", eventId);
|
||||
targetMessage.insert("formattedBody", content["formatted_body"].toString());
|
||||
// Need to get the message from the original eventId or body will have * on the front
|
||||
QModelIndex idx = index(eventIdToRow(eventId), 0);
|
||||
QModelIndex idx = index(eventIDToIndex(eventId), 0);
|
||||
targetMessage.insert("message", idx.data(Qt::UserRole + 2));
|
||||
|
||||
return targetMessage;
|
||||
@@ -999,14 +1032,14 @@ QVariant MessageEventModel::getLastLocalUserMessageEventId()
|
||||
return targetMessage;
|
||||
}
|
||||
|
||||
QVariant MessageEventModel::getLatestMessageFromRow(const int startRow)
|
||||
QVariant MessageEventModel::getLatestMessageFromIndex(const int baseline)
|
||||
{
|
||||
QVariantMap replyResponse;
|
||||
const auto &timelineBottom = m_currentRoom->messageEvents().rbegin() + startRow;
|
||||
const auto &timelineBottom = m_currentRoom->messageEvents().rbegin() + baseline;
|
||||
|
||||
// set a cap limit of startRow + 35 messages, to prevent loading a lot of messages
|
||||
// set a cap limit of baseline + 35 messages, to prevent loading a lot of messages
|
||||
// in rooms where the user has not sent many messages
|
||||
const auto limit = timelineBottom + std::min(startRow + 35, m_currentRoom->timelineSize());
|
||||
const auto limit = timelineBottom + std::min(baseline + 35, m_currentRoom->timelineSize());
|
||||
|
||||
for (auto it = timelineBottom; it != limit; ++it) {
|
||||
auto evt = it->event();
|
||||
@@ -1028,7 +1061,7 @@ QVariant MessageEventModel::getLatestMessageFromRow(const int startRow)
|
||||
}
|
||||
replyResponse.insert("event_id", eventId);
|
||||
// Need to get the message from the original eventId or body will have * on the front
|
||||
QModelIndex idx = index(eventIdToRow(eventId), 0);
|
||||
QModelIndex idx = index(eventIDToIndex(eventId), 0);
|
||||
replyResponse.insert("message", idx.data(Qt::UserRole + 2));
|
||||
replyResponse.insert("sender_id", QVariant::fromValue(m_currentRoom->getUser((*it)->senderId())));
|
||||
replyResponse.insert("at", -it->index());
|
||||
|
||||
@@ -7,99 +7,74 @@
|
||||
|
||||
#include "neochatroom.h"
|
||||
|
||||
/**
|
||||
* @class MessageEventModel
|
||||
*
|
||||
* This class defines the model for visualising the room timeline.
|
||||
*
|
||||
* This model covers all event types in the timeline with many of the roles being
|
||||
* specific to a subset of events. This means the user needs to understand which
|
||||
* roles will return useful information for a given event type.
|
||||
*
|
||||
* @sa NeoChatRoom
|
||||
*/
|
||||
class MessageEventModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/**
|
||||
* @brief The current room that the model is getting its messages from.
|
||||
*/
|
||||
Q_PROPERTY(NeoChatRoom *room READ room WRITE setRoom NOTIFY roomChanged)
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief The type of delegate that is needed for the event.
|
||||
*
|
||||
* @note While similar this is not the matrix event or message type. This is
|
||||
* to tell a QML ListView what delegate to show for each event. So while
|
||||
* similar to the spec it is not the same.
|
||||
*/
|
||||
enum DelegateType {
|
||||
Emote, /**< A message that begins with /me. */
|
||||
Notice, /**< A notice event. */
|
||||
Image, /**< A message that is an image. */
|
||||
Audio, /**< A message that is an audio recording. */
|
||||
Video, /**< A message that is a video. */
|
||||
File, /**< A message that is a file. */
|
||||
Message, /**< A text message. */
|
||||
Sticker, /**< A message that is a sticker. */
|
||||
State, /**< A state event in the room. */
|
||||
Encrypted, /**< An encrypted message that cannot be decrypted. */
|
||||
ReadMarker, /**< The local user read marker. */
|
||||
Poll, /**< The initial event for a poll. */
|
||||
Location, /**< A location event. */
|
||||
Other, /**< Anything that cannot be classified as another type. */
|
||||
Emote,
|
||||
Notice,
|
||||
Image,
|
||||
Audio,
|
||||
Video,
|
||||
File,
|
||||
Message,
|
||||
Sticker,
|
||||
State,
|
||||
Encrypted,
|
||||
ReadMarker,
|
||||
Poll,
|
||||
Other,
|
||||
};
|
||||
Q_ENUM(DelegateType);
|
||||
|
||||
/**
|
||||
* @brief Defines the model roles.
|
||||
*/
|
||||
enum EventRoles {
|
||||
DelegateTypeRole = Qt::UserRole + 1, /**< The delegate type of the message. */
|
||||
MessageRole, /**< Plain text representation of the message. */
|
||||
EventIdRole, /**< The matrix event ID of the event. */
|
||||
TimeRole, /**< The timestamp for when the event was sent. */
|
||||
SectionRole, /**< The date of the event as a string. */
|
||||
AuthorRole, /**< The author of the event. */
|
||||
ContentRole, /**< The full message content. */
|
||||
ContentTypeRole, /**< The content mime type. */
|
||||
HighlightRole, /**< Whether the event should be highlighted. */
|
||||
SpecialMarksRole, /**< Whether the event is hidden or not. */
|
||||
LongOperationRole, /**< Progress info when downloading files. */
|
||||
FormattedBodyRole, /**< The formatted body of a rich message. */
|
||||
GenericDisplayRole, /**< A generic string based upon the message type. */
|
||||
EventTypeRole = Qt::UserRole + 1,
|
||||
MessageRole,
|
||||
EventIdRole,
|
||||
TimeRole,
|
||||
SectionRole,
|
||||
AuthorRole,
|
||||
ContentRole,
|
||||
ContentTypeRole,
|
||||
HighlightRole,
|
||||
SpecialMarksRole,
|
||||
LongOperationRole,
|
||||
AnnotationRole,
|
||||
UserMarkerRole,
|
||||
FormattedBodyRole,
|
||||
GenericDisplayRole,
|
||||
|
||||
MimeTypeRole, /**< The mime type of the message's file or media. */
|
||||
FileMimetypeIcon, /**< The icon name for the mime type of a file. */
|
||||
MimeTypeRole,
|
||||
FileMimetypeIcon,
|
||||
|
||||
IsReplyRole, /**< Is the message a reply to another event. */
|
||||
ReplyRole, /**< The content data of the message that was replied to. */
|
||||
ReplyIdRole, /**< The matrix ID of the message that was replied to. */
|
||||
IsReplyRole,
|
||||
ReplyRole,
|
||||
ReplyIdRole,
|
||||
|
||||
ShowAuthorRole, /**< Whether the author's name should be shown. */
|
||||
ShowSectionRole, /**< Whether the section header should be shown. */
|
||||
ShowAuthorRole,
|
||||
ShowSectionRole,
|
||||
|
||||
ReadMarkersRole, /**< Other users at the event for read marker tracking. */
|
||||
ReadMarkersStringRole, /**< String with the display name and mxID of the users at the event. */
|
||||
ShowReadMarkersRole, /**< Whether there are any other user read markers to be shown. */
|
||||
ReactionRole, /**< List of reactions to this event. */
|
||||
SourceRole, /**< The full message source JSON. */
|
||||
MediaUrlRole, /**< The source URL for any media in the message. */
|
||||
ReadMarkersRole, /**< QVariantList of users at the event for read marker tracking. */
|
||||
ReadMarkersStringRole, /**< QString with the display name and mxID of the users at the event. */
|
||||
ShowReadMarkersRole, /**< bool with whether there are any other user read markers to be shown. */
|
||||
ReactionRole,
|
||||
|
||||
IsEditedRole,
|
||||
SourceRole,
|
||||
MediaUrlRole,
|
||||
// For debugging
|
||||
EventResolvedTypeRole, /**< The event type the message. */
|
||||
AuthorIdRole, /**< Matrix ID of the message author. */
|
||||
|
||||
VerifiedRole, /**< Whether an encrypted message is sent in a verified session. */
|
||||
DisplayNameForInitialsRole, /**< Sender's displayname, always without the matrix id. */
|
||||
AuthorDisplayNameRole, /**< The displayname for the event's sender; for name change events, the old displayname. */
|
||||
IsRedactedRole, /**< Whether an event has been deleted. */
|
||||
IsPendingRole, /**< Whether an event is waiting to be accepted by the server. */
|
||||
LatitudeRole, /**< Latitude for a location event. */
|
||||
LongitudeRole, /**< Longitude for a location event. */
|
||||
AssetRole, /**< Type of location event, e.g. self pin of the user location. */
|
||||
EventResolvedTypeRole,
|
||||
AuthorIdRole,
|
||||
VerifiedRole,
|
||||
// Sender's displayname, always without the matrix id
|
||||
DisplayNameForInitialsRole,
|
||||
// The displayname for the event's sender; for name change events, the old displayname
|
||||
AuthorDisplayNameRole,
|
||||
IsRedactedRole,
|
||||
IsPendingRole,
|
||||
LastRole, // Keep this last
|
||||
};
|
||||
Q_ENUM(EventRoles)
|
||||
@@ -107,67 +82,20 @@ public:
|
||||
explicit MessageEventModel(QObject *parent = nullptr);
|
||||
~MessageEventModel() override;
|
||||
|
||||
[[nodiscard]] NeoChatRoom *room() const;
|
||||
[[nodiscard]] NeoChatRoom *room() const
|
||||
{
|
||||
return m_currentRoom;
|
||||
}
|
||||
void setRoom(NeoChatRoom *room);
|
||||
|
||||
/**
|
||||
* @brief Get the given role value at the given index.
|
||||
*
|
||||
* @sa QAbstractItemModel::data
|
||||
*/
|
||||
[[nodiscard]] QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
|
||||
|
||||
/**
|
||||
* @brief Number of rows in the model.
|
||||
*
|
||||
* @sa QAbstractItemModel::rowCount
|
||||
*/
|
||||
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
/**
|
||||
* @brief Returns a mapping from Role enum values to role names.
|
||||
*
|
||||
* @sa EventRoles, QAbstractItemModel::roleNames()
|
||||
*/
|
||||
[[nodiscard]] QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
|
||||
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
/**
|
||||
* @brief Get the row number of the given event ID in the model.
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] int eventIdToRow(const QString &eventID) const;
|
||||
|
||||
/**
|
||||
* @brief Get the last message sent by the local user.
|
||||
*
|
||||
* @note This checks a maximum of the previous 35 message for performance reasons.
|
||||
*
|
||||
* @return a QVariantMap for the event with the following parameters:
|
||||
* - eventId - The event ID.
|
||||
* - formattedBody - The message text formatted as Qt::RichText.
|
||||
* - message - The message text formatted as Qt::PlainText.
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] int eventIDToIndex(const QString &eventID) const;
|
||||
Q_INVOKABLE [[nodiscard]] QVariant getLastLocalUserMessageEventId();
|
||||
|
||||
/**
|
||||
* @brief Get the last message sent earlier than the given row.
|
||||
*
|
||||
* @note This checks a maximum of the previous 35 message for performance reasons.
|
||||
*
|
||||
* @return a QVariantMap for the event with the following parameters:
|
||||
* - eventId - The event ID.
|
||||
* - message - The message text formatted as Qt::PlainText.
|
||||
* - sender_id - The matrix ID of the sender.
|
||||
* - at - The QModelIndex of the message.
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] QVariant getLatestMessageFromRow(const int startRow);
|
||||
|
||||
/**
|
||||
* @brief Load the event that the item at the given index replied to.
|
||||
*
|
||||
* This is used to ensure that the reply data is available when the message that
|
||||
* was replied to is outside the currently loaded timeline.
|
||||
*/
|
||||
Q_INVOKABLE void loadReply(const QModelIndex &index);
|
||||
Q_INVOKABLE [[nodiscard]] QVariant getLatestMessageFromIndex(const int baseline);
|
||||
Q_INVOKABLE void loadReply(const QModelIndex &row);
|
||||
|
||||
private Q_SLOTS:
|
||||
int refreshEvent(const QString &eventId);
|
||||
|
||||
@@ -41,7 +41,7 @@ bool MessageFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sour
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto eventType = index.data(MessageEventModel::DelegateTypeRole).toInt();
|
||||
const auto eventType = index.data(MessageEventModel::EventTypeRole).toInt();
|
||||
|
||||
if (eventType == MessageEventModel::Other) {
|
||||
return false;
|
||||
|
||||
@@ -117,7 +117,11 @@ void PublicRoomListModel::next(int count)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
job = m_connection->callApi<QueryPublicRoomsJob>(m_server, count, nextBatch, QueryPublicRoomsJob::Filter{m_keyword, {}});
|
||||
#else
|
||||
job = m_connection->callApi<QueryPublicRoomsJob>(m_server, count, nextBatch, QueryPublicRoomsJob::Filter{m_keyword});
|
||||
#endif
|
||||
|
||||
connect(job, &BaseJob::finished, this, [this] {
|
||||
attempted = true;
|
||||
@@ -173,7 +177,11 @@ QVariant PublicRoomListModel::data(const QModelIndex &index, int role) const
|
||||
if (avatarUrl.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
return avatarUrl.url().remove(0, 6);
|
||||
#else
|
||||
return avatarUrl.remove(0, 6);
|
||||
#endif
|
||||
}
|
||||
if (role == TopicRole) {
|
||||
return room.topic;
|
||||
|
||||
@@ -8,25 +8,36 @@
|
||||
#include "neochatroom.h"
|
||||
#include "roommanager.h"
|
||||
#include "user.h"
|
||||
#include <eventstats.h>
|
||||
|
||||
#include <QDebug>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
|
||||
#ifndef Q_OS_ANDROID
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusMessage>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <QGuiApplication>
|
||||
#include <utility>
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
#include "notificationsmanager.h"
|
||||
#include <csapi/notifications.h>
|
||||
#endif
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
Q_DECLARE_METATYPE(Quotient::JoinState)
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
bool useUnityCounter()
|
||||
{
|
||||
static const auto Result = QDBusInterface("com.canonical.Unity", "/").isValid();
|
||||
|
||||
return Result;
|
||||
}
|
||||
#endif
|
||||
|
||||
RoomListModel::RoomListModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
@@ -35,32 +46,30 @@ RoomListModel::RoomListModel(QObject *parent)
|
||||
m_categoryVisibility[collapsedSection] = false;
|
||||
}
|
||||
|
||||
connect(this, &RoomListModel::notificationCountChanged, this, [this]() {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
|
||||
#ifndef Q_OS_ANDROID
|
||||
// copied from Telegram desktop
|
||||
const auto launcherUrl = "application://org.kde.neochat.desktop";
|
||||
// Gnome requires that count is a 64bit integer
|
||||
const qint64 counterSlice = std::min(m_notificationCount, 9999);
|
||||
QVariantMap dbusUnityProperties;
|
||||
connect(this, &RoomListModel::notificationCountChanged, this, [this]() {
|
||||
if (useUnityCounter()) {
|
||||
// copied from Telegram desktop
|
||||
const auto launcherUrl = "application://org.kde.neochat.desktop";
|
||||
// Gnome requires that count is a 64bit integer
|
||||
const qint64 counterSlice = std::min(m_notificationCount, 9999);
|
||||
QVariantMap dbusUnityProperties;
|
||||
|
||||
if (counterSlice > 0) {
|
||||
dbusUnityProperties["count"] = counterSlice;
|
||||
dbusUnityProperties["count-visible"] = true;
|
||||
} else {
|
||||
dbusUnityProperties["count-visible"] = false;
|
||||
if (counterSlice > 0) {
|
||||
dbusUnityProperties["count"] = counterSlice;
|
||||
dbusUnityProperties["count-visible"] = true;
|
||||
} else {
|
||||
dbusUnityProperties["count-visible"] = false;
|
||||
}
|
||||
|
||||
auto signal = QDBusMessage::createSignal("/com/canonical/unity/launcherentry/neochat", "com.canonical.Unity.LauncherEntry", "Update");
|
||||
|
||||
signal.setArguments({launcherUrl, dbusUnityProperties});
|
||||
|
||||
QDBusConnection::sessionBus().send(signal);
|
||||
}
|
||||
|
||||
auto signal = QDBusMessage::createSignal("/com/canonical/unity/launcherentry/neochat", "com.canonical.Unity.LauncherEntry", "Update");
|
||||
|
||||
signal.setArguments({launcherUrl, dbusUnityProperties});
|
||||
|
||||
QDBusConnection::sessionBus().send(signal);
|
||||
#endif // Q_OS_ANDROID
|
||||
#else
|
||||
qGuiApp->setBadgeNumber(m_notificationCount);
|
||||
#endif // QT_VERSION_CHECK(6, 6, 0)
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
RoomListModel::~RoomListModel() = default;
|
||||
@@ -145,10 +154,10 @@ void RoomListModel::doAddRoom(Room *r)
|
||||
void RoomListModel::connectRoomSignals(NeoChatRoom *room)
|
||||
{
|
||||
connect(room, &Room::displaynameChanged, this, [this, room] {
|
||||
refresh(room, {DisplayNameRole, NameRole});
|
||||
refresh(room);
|
||||
});
|
||||
connect(room, &Room::unreadStatsChanged, this, [this, room] {
|
||||
refresh(room, {UnreadCountRole, NotificationCountRole, HighlightCountRole});
|
||||
connect(room, &Room::unreadMessagesChanged, this, [this, room] {
|
||||
refresh(room);
|
||||
});
|
||||
connect(room, &Room::notificationCountChanged, this, [this, room] {
|
||||
refresh(room);
|
||||
@@ -163,14 +172,76 @@ void RoomListModel::connectRoomSignals(NeoChatRoom *room)
|
||||
refresh(room);
|
||||
});
|
||||
connect(room, &Room::addedMessages, this, [this, room] {
|
||||
refresh(room, {LastEventRole, SubtitleTextRole, LastActiveTimeRole});
|
||||
refresh(room, {LastEventRole, SubtitleTextRole});
|
||||
});
|
||||
connect(room, &Room::pendingEventMerged, this, [this, room] {
|
||||
refresh(room, {LastEventRole, SubtitleTextRole});
|
||||
});
|
||||
#ifndef QUOTIENT_07
|
||||
connect(room, &Room::notificationCountChanged, this, &RoomListModel::handleNotifications);
|
||||
#endif
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
connect(room, &Room::notificationCountChanged, this, &RoomListModel::refreshNotificationCount);
|
||||
#else
|
||||
connect(room, &Room::unreadStatsChanged, this, &RoomListModel::refreshNotificationCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
void RoomListModel::handleNotifications()
|
||||
{
|
||||
static bool initial = true;
|
||||
static QStringList oldNotifications;
|
||||
auto job = m_connection->callApi<GetNotificationsJob>();
|
||||
|
||||
connect(job, &BaseJob::success, this, [this, job]() {
|
||||
const auto notifications = job->jsonData()["notifications"].toArray();
|
||||
if (initial) {
|
||||
initial = false;
|
||||
for (const auto &n : notifications) {
|
||||
oldNotifications += n.toObject()["event"].toObject()["event_id"].toString();
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (const auto &n : notifications) {
|
||||
const auto notification = n.toObject();
|
||||
if (notification["read"].toBool()) {
|
||||
oldNotifications.removeOne(notification["event"].toObject()["event_id"].toString());
|
||||
continue;
|
||||
}
|
||||
if (oldNotifications.contains(notification["event"].toObject()["event_id"].toString())) {
|
||||
continue;
|
||||
}
|
||||
oldNotifications += notification["event"].toObject()["event_id"].toString();
|
||||
|
||||
auto room = m_connection->room(notification["room_id"].toString());
|
||||
auto currentRoom = RoomManager::instance().currentRoom();
|
||||
bool roomIsActive = currentRoom && room->id() == currentRoom->id();
|
||||
|
||||
// If room exists, room is NOT active OR the application is NOT active, show notification
|
||||
if (room && !(roomIsActive && QGuiApplication::applicationState() == Qt::ApplicationActive)) {
|
||||
// The room might have been deleted (for example rejected invitation).
|
||||
auto sender = room->user(notification["event"].toObject()["sender"].toString());
|
||||
|
||||
QImage avatar_image;
|
||||
if (!sender->avatarUrl(room).isEmpty()) {
|
||||
avatar_image = sender->avatar(128, room);
|
||||
} else {
|
||||
avatar_image = room->avatar(128);
|
||||
}
|
||||
NotificationsManager::instance().postNotification(dynamic_cast<NeoChatRoom *>(room),
|
||||
sender->displayname(room),
|
||||
notification["event"].toObject()["content"].toObject()["body"].toString(),
|
||||
avatar_image,
|
||||
notification["event"].toObject()["event_id"].toString(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
void RoomListModel::refreshNotificationCount()
|
||||
{
|
||||
int count = 0;
|
||||
@@ -295,7 +366,7 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
||||
return NeoChatRoomType::Normal;
|
||||
}
|
||||
if (role == UnreadCountRole) {
|
||||
return room->unreadStats().notableCount;
|
||||
return room->unreadCount();
|
||||
}
|
||||
if (role == NotificationCountRole) {
|
||||
return room->notificationCount();
|
||||
|
||||
@@ -107,6 +107,9 @@ private:
|
||||
QString m_activeSpaceId = "";
|
||||
|
||||
void connectRoomSignals(NeoChatRoom *room);
|
||||
#ifndef QUOTIENT_07
|
||||
void handleNotifications();
|
||||
#endif
|
||||
|
||||
Q_SIGNALS:
|
||||
void connectionChanged();
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#include <KLocalizedString>
|
||||
#include <connection.h>
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
#include <csapi/search.h>
|
||||
#endif
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
@@ -32,6 +34,7 @@ void SearchModel::setSearchText(const QString &searchText)
|
||||
|
||||
void SearchModel::search()
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
Q_ASSERT(m_connection);
|
||||
setSearching(true);
|
||||
if (m_job) {
|
||||
@@ -40,26 +43,20 @@ void SearchModel::search()
|
||||
}
|
||||
|
||||
SearchJob::RoomEventsCriteria criteria{
|
||||
.searchTerm = m_searchText,
|
||||
.keys = {},
|
||||
.filter =
|
||||
RoomEventFilter{
|
||||
.unreadThreadNotifications = none,
|
||||
.lazyLoadMembers = true,
|
||||
.includeRedundantMembers = false,
|
||||
.notRooms = {},
|
||||
.rooms = {m_room->id()},
|
||||
.containsUrl = false,
|
||||
},
|
||||
.orderBy = "recent",
|
||||
.eventContext = SearchJob::IncludeEventContext{3, 3, true},
|
||||
.includeState = false,
|
||||
.groupings = none,
|
||||
m_searchText,
|
||||
{},
|
||||
RoomEventFilter{
|
||||
.rooms = {m_room->id()},
|
||||
},
|
||||
"recent",
|
||||
SearchJob::IncludeEventContext{3, 3, true},
|
||||
false,
|
||||
none,
|
||||
};
|
||||
|
||||
auto job = m_connection->callApi<SearchJob>(SearchJob::Categories{criteria});
|
||||
m_job = job;
|
||||
connect(job, &BaseJob::finished, this, [this, job] {
|
||||
connect(job, &BaseJob::finished, this, [=] {
|
||||
beginResetModel();
|
||||
m_result = job->searchCategories().roomEvents;
|
||||
endResetModel();
|
||||
@@ -67,6 +64,7 @@ void SearchModel::search()
|
||||
m_job = nullptr;
|
||||
// TODO error handling
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
Connection *SearchModel::connection() const
|
||||
@@ -82,6 +80,7 @@ void SearchModel::setConnection(Connection *connection)
|
||||
|
||||
QVariant SearchModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
auto row = index.row();
|
||||
const auto &event = *m_result->results[row].result;
|
||||
switch (role) {
|
||||
@@ -111,14 +110,17 @@ QVariant SearchModel::data(const QModelIndex &index, int role) const
|
||||
return event.originTimestamp();
|
||||
}
|
||||
return MessageEventModel::DelegateType::Message;
|
||||
#endif
|
||||
return {};
|
||||
}
|
||||
|
||||
int SearchModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
#ifdef QUOTIENT_07
|
||||
if (m_result.has_value()) {
|
||||
return m_result->results.size();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
#include <QAbstractListModel>
|
||||
#include <QString>
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
#include <csapi/search.h>
|
||||
#endif
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
@@ -66,8 +68,10 @@ private:
|
||||
QString m_searchText;
|
||||
Quotient::Connection *m_connection = nullptr;
|
||||
NeoChatRoom *m_room = nullptr;
|
||||
#ifdef QUOTIENT_07
|
||||
Quotient::Omittable<Quotient::SearchJob::ResultRoomEvents> m_result = Quotient::none;
|
||||
Quotient::SearchJob *m_job = nullptr;
|
||||
#endif
|
||||
bool m_searching = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -95,7 +95,11 @@ void ServerListModel::checkServer(const QString &url)
|
||||
KConfigGroup serverGroup(&dataResource, "Servers");
|
||||
|
||||
if (!serverGroup.hasKey(url)) {
|
||||
#ifdef QUOTIENT_07
|
||||
if (Quotient::isJobPending(m_checkServerJob)) {
|
||||
#else
|
||||
if (Quotient::isJobRunning(m_checkServerJob)) {
|
||||
#endif
|
||||
m_checkServerJob->abandon();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ QHash<int, QByteArray> StateModel::roleNames() const
|
||||
}
|
||||
QVariant StateModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
auto row = index.row();
|
||||
switch (role) {
|
||||
case TypeRole:
|
||||
@@ -23,13 +24,18 @@ QVariant StateModel::data(const QModelIndex &index, int role) const
|
||||
case SourceRole:
|
||||
return QJsonDocument(m_room->currentState().events()[m_room->currentState().events().keys()[row]]->fullJson()).toJson();
|
||||
}
|
||||
#endif
|
||||
return {};
|
||||
}
|
||||
|
||||
int StateModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
#ifdef QUOTIENT_07
|
||||
return m_room->currentState().events().size();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
NeoChatRoom *StateModel::room() const
|
||||
@@ -43,7 +49,7 @@ void StateModel::setRoom(NeoChatRoom *room)
|
||||
Q_EMIT roomChanged();
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
connect(room, &NeoChatRoom::changed, this, [this] {
|
||||
connect(room, &NeoChatRoom::changed, this, [=] {
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
});
|
||||
|
||||
@@ -131,7 +131,11 @@ QVariant UserDirectoryListModel::data(const QModelIndex &index, int role) const
|
||||
if (avatarUrl.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
return avatarUrl.url().remove(0, 6);
|
||||
#else
|
||||
return avatarUrl.remove(0, 6);
|
||||
#endif
|
||||
}
|
||||
if (role == UserIDRole) {
|
||||
return user.userId;
|
||||
|
||||
@@ -44,9 +44,13 @@ void UserListModel::setRoom(NeoChatRoom *room)
|
||||
std::sort(m_users.begin(), m_users.end(), room->memberSorter());
|
||||
}
|
||||
for (User *user : std::as_const(m_users)) {
|
||||
#ifdef QUOTIENT_07
|
||||
connect(user, &User::defaultAvatarChanged, this, [this, user]() {
|
||||
avatarChanged(user, m_currentRoom);
|
||||
});
|
||||
#else
|
||||
connect(user, &User::avatarChanged, this, &UserListModel::avatarChanged);
|
||||
#endif
|
||||
}
|
||||
connect(m_currentRoom->connection(), &Connection::loggedOut, this, [this]() {
|
||||
setRoom(nullptr);
|
||||
@@ -92,14 +96,15 @@ QVariant UserListModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant::fromValue(user);
|
||||
}
|
||||
if (role == PowerLevelRole) {
|
||||
auto pl = m_currentRoom->currentState().get<RoomPowerLevelsEvent>();
|
||||
if (!pl) {
|
||||
return 0;
|
||||
}
|
||||
auto pl = m_currentRoom->getCurrentState<RoomPowerLevelsEvent>();
|
||||
return pl->powerLevelForUser(user->id());
|
||||
}
|
||||
if (role == PowerLevelStringRole) {
|
||||
#ifdef QUOTIENT_07
|
||||
auto pl = m_currentRoom->currentState().get<RoomPowerLevelsEvent>();
|
||||
#else
|
||||
auto pl = m_currentRoom->getCurrentState<RoomPowerLevelsEvent>();
|
||||
#endif
|
||||
// User might not in the room yet, in this case pl can be nullptr.
|
||||
// e.g. When invited but user not accepted or denied the invitation.
|
||||
if (!pl) {
|
||||
@@ -138,9 +143,13 @@ void UserListModel::userAdded(Quotient::User *user)
|
||||
beginInsertRows(QModelIndex(), pos, pos);
|
||||
m_users.insert(pos, user);
|
||||
endInsertRows();
|
||||
#ifdef QUOTIENT_07
|
||||
connect(user, &User::defaultAvatarChanged, this, [this, user]() {
|
||||
avatarChanged(user, m_currentRoom);
|
||||
});
|
||||
#else
|
||||
connect(user, &Quotient::User::avatarChanged, this, &UserListModel::avatarChanged);
|
||||
#endif
|
||||
}
|
||||
|
||||
void UserListModel::userRemoved(Quotient::User *user)
|
||||
@@ -179,9 +188,13 @@ void UserListModel::refreshAll()
|
||||
std::sort(m_users.begin(), m_users.end(), m_currentRoom->memberSorter());
|
||||
}
|
||||
for (User *user : std::as_const(m_users)) {
|
||||
#ifdef QUOTIENT_07
|
||||
connect(user, &User::defaultAvatarChanged, this, [this, user]() {
|
||||
avatarChanged(user, m_currentRoom);
|
||||
});
|
||||
#else
|
||||
connect(user, &User::avatarChanged, this, &UserListModel::avatarChanged);
|
||||
#endif
|
||||
}
|
||||
connect(m_currentRoom->connection(), &Connection::loggedOut, this, [this]() {
|
||||
setRoom(nullptr);
|
||||
@@ -204,9 +217,6 @@ int UserListModel::findUserPos(Quotient::User *user) const
|
||||
|
||||
int UserListModel::findUserPos(const QString &username) const
|
||||
{
|
||||
if (!m_currentRoom) {
|
||||
return 0;
|
||||
}
|
||||
return m_currentRoom->memberSorter().lowerBoundIndex(m_users, username);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ Name[es]=NeoChat
|
||||
Name[eu]=NeoChat
|
||||
Name[fi]=NeoChat
|
||||
Name[fr]=NeoChat
|
||||
Name[gl]=NeoChat
|
||||
Name[hu]=NeoChat
|
||||
Name[ia]=Neochat
|
||||
Name[id]=NeoChat
|
||||
@@ -51,6 +52,7 @@ Comment[es]=Un cliente para Matrix, el protocolo de comunicaciones descentraliza
|
||||
Comment[eu]=Matrix, deszentralizatutako komunikazio protokolorako, bezero bat
|
||||
Comment[fi]=Hajautetun Matrix-viestintäyhteyskäytännön asiakasohjelma
|
||||
Comment[fr]=Un client pour « Matrix », le protocole décentralisé de communications.
|
||||
Comment[gl]=Un cliente para Matrix, o protocolo de comunicación descentralizada
|
||||
Comment[hu]=Kliens a matrixhoz, a decentralizált kommunikációs protokollhoz
|
||||
Comment[ia]=Un cliente per Matrix, le protocollo de communication decentralisate
|
||||
Comment[id]=Sebuah klien untuk matrix, protokol komunikasi terdecentralisasi
|
||||
@@ -90,6 +92,7 @@ Name[es]=Nuevo mensaje
|
||||
Name[eu]=Mezu berria
|
||||
Name[fi]=Uusi viesti
|
||||
Name[fr]=Nouveau message
|
||||
Name[gl]=Nova mensaxe
|
||||
Name[hu]=Új üzenet
|
||||
Name[ia]=Nove message
|
||||
Name[id]=Pesan baru
|
||||
@@ -126,6 +129,7 @@ Comment[es]=Hay un mensaje nuevo
|
||||
Comment[eu]=Mezu berri bat dago
|
||||
Comment[fi]=Saapui uusi viesti
|
||||
Comment[fr]=Il y a un nouveau message
|
||||
Comment[gl]=Hai unha nova mensaxe
|
||||
Comment[hu]=Új üzenet érkezett
|
||||
Comment[ia]=Il ha un nove message
|
||||
Comment[id]=Ada pesan baru
|
||||
@@ -166,6 +170,7 @@ Name[es]=Nueva invitación
|
||||
Name[eu]=Gonbidapen berria
|
||||
Name[fi]=Uusi kutsu
|
||||
Name[fr]=Nouvelle invitation
|
||||
Name[gl]=Novo convite
|
||||
Name[ia]=Nove invitation
|
||||
Name[id]=Undangan Baru
|
||||
Name[ie]=Nov invitation
|
||||
@@ -197,6 +202,7 @@ Comment[es]=Hay una nueva invitación a una sala
|
||||
Comment[eu]=Gela baterako gonbidapen berri bat dago
|
||||
Comment[fi]=Uusi kutsu huoneeseen
|
||||
Comment[fr]=Il y a une nouvelle invitation dans un salon.
|
||||
Comment[gl]=Tes un novo convite para unha sala
|
||||
Comment[ia]=Il ha un nove invitation a un sala
|
||||
Comment[id]=Ada undangan baru ke sebuah ruangan
|
||||
Comment[ie]=Vu have un nov invitation a un chambre
|
||||
|
||||
105
src/neochataccountregistry.cpp
Normal file
105
src/neochataccountregistry.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
// SPDX-FileCopyrightText: Kitsune Ral <Kitsune-Ral@users.sf.net>
|
||||
// SPDX-FileCopyrightText: Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
#include "neochataccountregistry.h"
|
||||
|
||||
#include <connection.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
void AccountRegistry::add(Connection *c)
|
||||
{
|
||||
if (m_accounts.contains(c))
|
||||
return;
|
||||
beginInsertRows(QModelIndex(), m_accounts.size(), m_accounts.size());
|
||||
m_accounts += c;
|
||||
endInsertRows();
|
||||
emit accountCountChanged();
|
||||
}
|
||||
|
||||
void AccountRegistry::drop(Connection *c)
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), m_accounts.indexOf(c), m_accounts.indexOf(c));
|
||||
m_accounts.removeOne(c);
|
||||
endRemoveRows();
|
||||
Q_ASSERT(!m_accounts.contains(c));
|
||||
emit accountCountChanged();
|
||||
}
|
||||
|
||||
bool AccountRegistry::isLoggedIn(const QString &userId) const
|
||||
{
|
||||
return std::any_of(m_accounts.cbegin(), m_accounts.cend(), [&userId](Connection *a) {
|
||||
return a->userId() == userId;
|
||||
});
|
||||
}
|
||||
|
||||
bool AccountRegistry::contains(Connection *c) const
|
||||
{
|
||||
return m_accounts.contains(c);
|
||||
}
|
||||
|
||||
AccountRegistry::AccountRegistry() = default;
|
||||
|
||||
QVariant AccountRegistry::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (index.row() >= m_accounts.count()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto account = m_accounts[index.row()];
|
||||
|
||||
switch (role) {
|
||||
case ConnectionRole:
|
||||
return QVariant::fromValue(account);
|
||||
case UserIdRole:
|
||||
return QVariant::fromValue(account->userId());
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
int AccountRegistry::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_accounts.count();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> AccountRegistry::roleNames() const
|
||||
{
|
||||
return {{ConnectionRole, "connection"}, {UserIdRole, "userId"}};
|
||||
}
|
||||
|
||||
bool AccountRegistry::isEmpty() const
|
||||
{
|
||||
return m_accounts.isEmpty();
|
||||
}
|
||||
|
||||
int AccountRegistry::count() const
|
||||
{
|
||||
return m_accounts.count();
|
||||
}
|
||||
|
||||
const QVector<Connection *> AccountRegistry::accounts() const
|
||||
{
|
||||
return m_accounts;
|
||||
}
|
||||
|
||||
Connection *AccountRegistry::get(const QString &userId)
|
||||
{
|
||||
for (const auto &connection : m_accounts) {
|
||||
if (connection->userId() == userId) {
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
54
src/neochataccountregistry.h
Normal file
54
src/neochataccountregistry.h
Normal file
@@ -0,0 +1,54 @@
|
||||
// SPDX-FileCopyrightText: 2020 Kitsune Ral <Kitsune-Ral@users.sf.net>
|
||||
// SPDX-FileCopyrightText: Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
|
||||
namespace Quotient
|
||||
{
|
||||
class Connection;
|
||||
|
||||
class AccountRegistry : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int accountCount READ count NOTIFY accountCountChanged);
|
||||
|
||||
public:
|
||||
enum EventRoles {
|
||||
ConnectionRole = Qt::UserRole + 1,
|
||||
UserIdRole = Qt::DisplayRole,
|
||||
};
|
||||
|
||||
static AccountRegistry &instance()
|
||||
{
|
||||
static AccountRegistry _instance;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
const QVector<Connection *> accounts() const;
|
||||
void add(Connection *a);
|
||||
void drop(Connection *a);
|
||||
bool isLoggedIn(const QString &userId) const;
|
||||
bool isEmpty() const;
|
||||
int count() const;
|
||||
bool contains(Connection *) const;
|
||||
Connection *get(const QString &userId);
|
||||
|
||||
[[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void accountCountChanged();
|
||||
|
||||
private:
|
||||
AccountRegistry();
|
||||
|
||||
QVector<Connection *> m_accounts;
|
||||
};
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <QMimeDatabase>
|
||||
#include <QTemporaryFile>
|
||||
#include <QTextDocument>
|
||||
#include <functional>
|
||||
|
||||
#include <QMediaMetaData>
|
||||
#include <QMediaPlayer>
|
||||
@@ -24,7 +25,6 @@
|
||||
#include <csapi/room_state.h>
|
||||
#include <csapi/typing.h>
|
||||
#include <events/encryptionevent.h>
|
||||
#include <events/eventrelation.h>
|
||||
#include <events/reactionevent.h>
|
||||
#include <events/redactionevent.h>
|
||||
#include <events/roomavatarevent.h>
|
||||
@@ -32,19 +32,23 @@
|
||||
#include <events/roommemberevent.h>
|
||||
#include <events/roompowerlevelsevent.h>
|
||||
#include <events/simplestateevents.h>
|
||||
#include <events/stickerevent.h>
|
||||
#include <eventstats.h>
|
||||
#include <jobs/downloadfilejob.h>
|
||||
#ifndef QUOTIENT_07
|
||||
#include <joinstate.h>
|
||||
#endif
|
||||
#include <qt_connection_util.h>
|
||||
|
||||
#include "controller.h"
|
||||
#include "filetransferpseudojob.h"
|
||||
#include "joinrulesevent.h"
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatuser.h"
|
||||
#include "notificationsmanager.h"
|
||||
#ifdef QUOTIENT_07
|
||||
#include "pollevent.h"
|
||||
#include "pollhandler.h"
|
||||
#endif
|
||||
#include "filetransferpseudojob.h"
|
||||
#include "stickerevent.h"
|
||||
#include "texthandler.h"
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
@@ -82,7 +86,7 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
|
||||
if (this->joinState() != JoinState::Invite) {
|
||||
return;
|
||||
}
|
||||
const QString senderId = currentState().get<RoomMemberEvent>(localUser()->id())->senderId();
|
||||
const QString senderId = getCurrentState<RoomMemberEvent>(localUser()->id())->senderId();
|
||||
QImage avatar_image;
|
||||
if (!user(senderId)->avatarUrl(this).isEmpty()) {
|
||||
avatar_image = user(senderId)->avatar(128, this);
|
||||
@@ -106,34 +110,6 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
|
||||
});
|
||||
}
|
||||
|
||||
bool NeoChatRoom::hasFileUploading() const
|
||||
{
|
||||
return m_hasFileUploading;
|
||||
}
|
||||
|
||||
void NeoChatRoom::setHasFileUploading(bool value)
|
||||
{
|
||||
if (value == m_hasFileUploading) {
|
||||
return;
|
||||
}
|
||||
m_hasFileUploading = value;
|
||||
Q_EMIT hasFileUploadingChanged();
|
||||
}
|
||||
|
||||
int NeoChatRoom::fileUploadingProgress() const
|
||||
{
|
||||
return m_fileUploadingProgress;
|
||||
}
|
||||
|
||||
void NeoChatRoom::setFileUploadingProgress(int value)
|
||||
{
|
||||
if (m_fileUploadingProgress == value) {
|
||||
return;
|
||||
}
|
||||
m_fileUploadingProgress = value;
|
||||
Q_EMIT fileUploadingProgressChanged();
|
||||
}
|
||||
|
||||
void NeoChatRoom::uploadFile(const QUrl &url, const QString &body)
|
||||
{
|
||||
doUploadFile(url, body);
|
||||
@@ -171,9 +147,17 @@ QCoro::Task<void> NeoChatRoom::doUploadFile(QUrl url, QString body)
|
||||
} else {
|
||||
content = new EventContent::FileContent(url, fileInfo.size(), mime, fileInfo.fileName());
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
QString txnId = postFile(body.isEmpty() ? url.fileName() : body, content);
|
||||
#else
|
||||
QString txnId = postFile(body.isEmpty() ? url.fileName() : body, url, false);
|
||||
#endif
|
||||
setHasFileUploading(true);
|
||||
#ifdef QUOTIENT_07
|
||||
connect(this, &Room::fileTransferCompleted, [this, txnId](const QString &id, FileSourceInfo) {
|
||||
#else
|
||||
connect(this, &Room::fileTransferCompleted, [this, txnId](const QString &id, const QUrl & /*localFile*/, const QUrl & /*mxcUrl*/) {
|
||||
#endif
|
||||
if (id == txnId) {
|
||||
setFileUploadingProgress(0);
|
||||
setHasFileUploading(false);
|
||||
@@ -243,20 +227,21 @@ const RoomEvent *NeoChatRoom::lastEvent() const
|
||||
continue;
|
||||
}
|
||||
|
||||
if (event->isStateEvent() && !NeoChatConfig::showStateEvent()) {
|
||||
if (event->isStateEvent() && !NeoChatConfig::self()->showStateEvent()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto roomMemberEvent = eventCast<const RoomMemberEvent>(event)) {
|
||||
if ((roomMemberEvent->isJoin() || roomMemberEvent->isLeave()) && !NeoChatConfig::showLeaveJoinEvent()) {
|
||||
if ((roomMemberEvent->isJoin() || roomMemberEvent->isLeave()) && !NeoChatConfig::self()->showLeaveJoinEvent()) {
|
||||
continue;
|
||||
} else if (roomMemberEvent->isRename() && !roomMemberEvent->isJoin() && !roomMemberEvent->isLeave() && !NeoChatConfig::showRename()) {
|
||||
} else if (roomMemberEvent->isRename() && !roomMemberEvent->isJoin() && !roomMemberEvent->isLeave() && !NeoChatConfig::self()->showRename()) {
|
||||
continue;
|
||||
} else if (roomMemberEvent->isAvatarUpdate() && !roomMemberEvent->isJoin() && !roomMemberEvent->isLeave() && !NeoChatConfig::showAvatarUpdate()) {
|
||||
} else if (roomMemberEvent->isAvatarUpdate() && !roomMemberEvent->isJoin() && !roomMemberEvent->isLeave()
|
||||
&& !NeoChatConfig::self()->showAvatarUpdate()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (event->isStateEvent() && static_cast<const StateEvent &>(*event).repeatsState()) {
|
||||
if (event->isStateEvent() && static_cast<const StateEventBase &>(*event).repeatsState()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -281,9 +266,11 @@ const RoomEvent *NeoChatRoom::lastEvent() const
|
||||
if (auto lastEvent = eventCast<const RoomMessageEvent>(event)) {
|
||||
return lastEvent;
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
if (auto lastEvent = eventCast<const PollStartEvent>(event)) {
|
||||
return lastEvent;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -304,9 +291,10 @@ bool NeoChatRoom::lastEventIsSpoiler() const
|
||||
QString NeoChatRoom::lastEventToString(Qt::TextFormat format, bool stripNewlines) const
|
||||
{
|
||||
if (auto event = lastEvent()) {
|
||||
return safeMemberName(event->senderId()) + (event->isStateEvent() ? " " : ": ") + eventToString(*event, format, stripNewlines);
|
||||
return roomMembername(event->senderId()) + (event->isStateEvent() ? QLatin1String(" ") : QLatin1String(": "))
|
||||
+ eventToString(*event, format, stripNewlines);
|
||||
}
|
||||
return {};
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
bool NeoChatRoom::isEventHighlighted(const RoomEvent *e) const
|
||||
@@ -322,7 +310,7 @@ void NeoChatRoom::checkForHighlights(const Quotient::TimelineItem &ti)
|
||||
}
|
||||
if (auto *e = ti.viewAs<RoomMessageEvent>()) {
|
||||
const auto &text = e->plainBody();
|
||||
if (text.contains(localUserId) || text.contains(safeMemberName(localUserId))) {
|
||||
if (text.contains(localUserId) || text.contains(roomMembername(localUserId))) {
|
||||
highlights.insert(e);
|
||||
}
|
||||
}
|
||||
@@ -345,7 +333,7 @@ void NeoChatRoom::onAddHistoricalTimelineEvents(rev_iter_t from)
|
||||
void NeoChatRoom::onRedaction(const RoomEvent &prevEvent, const RoomEvent & /*after*/)
|
||||
{
|
||||
if (const auto &e = eventCast<const ReactionEvent>(&prevEvent)) {
|
||||
if (auto relatedEventId = e->eventId(); !relatedEventId.isEmpty()) {
|
||||
if (auto relatedEventId = e->relation().eventId; !relatedEventId.isEmpty()) {
|
||||
Q_EMIT updatedEvent(relatedEventId);
|
||||
}
|
||||
}
|
||||
@@ -353,8 +341,9 @@ void NeoChatRoom::onRedaction(const RoomEvent &prevEvent, const RoomEvent & /*af
|
||||
|
||||
void NeoChatRoom::countChanged()
|
||||
{
|
||||
if (displayed() && unreadStats().empty()) {
|
||||
setReadReceipt(lastEvent()->id());
|
||||
if (displayed() && !hasUnreadMessages()) {
|
||||
resetNotificationCount();
|
||||
resetHighlightCount();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,6 +361,30 @@ QDateTime NeoChatRoom::lastActiveTime()
|
||||
return messageEvents().rbegin()->get()->originTimestamp();
|
||||
}
|
||||
|
||||
int NeoChatRoom::savedTopVisibleIndex() const
|
||||
{
|
||||
return firstDisplayedMarker() == historyEdge() ? 0 : int(firstDisplayedMarker() - messageEvents().rbegin());
|
||||
}
|
||||
|
||||
int NeoChatRoom::savedBottomVisibleIndex() const
|
||||
{
|
||||
return lastDisplayedMarker() == historyEdge() ? 0 : int(lastDisplayedMarker() - messageEvents().rbegin());
|
||||
}
|
||||
|
||||
void NeoChatRoom::saveViewport(int topIndex, int bottomIndex)
|
||||
{
|
||||
if (topIndex == -1 || bottomIndex == -1 || (bottomIndex == savedBottomVisibleIndex() && (bottomIndex == 0 || topIndex == savedTopVisibleIndex()))) {
|
||||
return;
|
||||
}
|
||||
if (bottomIndex == 0) {
|
||||
setFirstDisplayedEventId({});
|
||||
setLastDisplayedEventId({});
|
||||
return;
|
||||
}
|
||||
setFirstDisplayedEvent(maxTimelineIndex() - topIndex);
|
||||
setLastDisplayedEvent(maxTimelineIndex() - bottomIndex);
|
||||
}
|
||||
|
||||
QVariantList NeoChatRoom::getUsers(const QString &keyword, int limit) const
|
||||
{
|
||||
const auto userList = users();
|
||||
@@ -405,6 +418,15 @@ QVariantMap NeoChatRoom::getUser(const QString &userID) const
|
||||
{QStringLiteral("color"), user.color()}};
|
||||
}
|
||||
|
||||
QUrl NeoChatRoom::urlToMxcUrl(const QUrl &mxcUrl)
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
return connection()->makeMediaUrl(mxcUrl);
|
||||
#else
|
||||
return DownloadFileJob::makeRequestUrl(connection()->homeserver(), mxcUrl);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString NeoChatRoom::avatarMediaId() const
|
||||
{
|
||||
if (const auto avatar = Room::avatarMediaId(); !avatar.isEmpty()) {
|
||||
@@ -427,7 +449,11 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
const bool prettyPrint = (format == Qt::RichText);
|
||||
|
||||
using namespace Quotient;
|
||||
#ifdef QUOTIENT_07
|
||||
return switchOnType(
|
||||
#else
|
||||
return visit(
|
||||
#endif
|
||||
evt,
|
||||
[this, format, stripNewlines](const RoomMessageEvent &e) {
|
||||
using namespace MessageEventContent;
|
||||
@@ -473,9 +499,14 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
[this, prettyPrint](const RoomMemberEvent &e) {
|
||||
// FIXME: Rewind to the name that was at the time of this event
|
||||
auto subjectName = this->htmlSafeMemberName(e.userId());
|
||||
if (e.membership() == Membership::Leave) {
|
||||
if (e.membership() == MembershipType::Leave) {
|
||||
#ifdef QUOTIENT_07
|
||||
if (e.prevContent() && e.prevContent()->displayName) {
|
||||
subjectName = sanitized(*e.prevContent()->displayName).toHtmlEscaped();
|
||||
#else
|
||||
if (e.prevContent() && e.prevContent()->displayName.isEmpty()) {
|
||||
subjectName = sanitized(e.prevContent()->displayName).toHtmlEscaped();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +517,7 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
|
||||
// The below code assumes senderName output in AuthorRole
|
||||
switch (e.membership()) {
|
||||
case Membership::Invite:
|
||||
case MembershipType::Invite:
|
||||
if (e.repeatsState()) {
|
||||
auto text = i18n("reinvited %1 to the room", subjectName);
|
||||
if (!e.reason().isEmpty()) {
|
||||
@@ -495,13 +526,13 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
return text;
|
||||
}
|
||||
Q_FALLTHROUGH();
|
||||
case Membership::Join: {
|
||||
case MembershipType::Join: {
|
||||
QString text{};
|
||||
// Part 1: invites and joins
|
||||
if (e.repeatsState()) {
|
||||
text = i18n("joined the room (repeated)");
|
||||
} else if (e.changesMembership()) {
|
||||
text = e.membership() == Membership::Invite ? i18n("invited %1 to the room", subjectName) : i18n("joined the room");
|
||||
text = e.membership() == MembershipType::Invite ? i18n("invited %1 to the room", subjectName) : i18n("joined the room");
|
||||
}
|
||||
if (!text.isEmpty()) {
|
||||
if (!e.reason().isEmpty()) {
|
||||
@@ -511,19 +542,23 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
}
|
||||
// Part 2: profile changes of joined members
|
||||
if (e.isRename()) {
|
||||
if (e.newDisplayName()) {
|
||||
if (e.displayName().isEmpty()) {
|
||||
text = i18nc("their refers to a singular user", "cleared their display name");
|
||||
} else {
|
||||
text = i18nc("their refers to a singular user", "changed their display name to %1", e.newDisplayName()->toHtmlEscaped());
|
||||
text = i18nc("their refers to a singular user", "changed their display name to %1", e.displayName().toHtmlEscaped());
|
||||
}
|
||||
}
|
||||
if (e.isAvatarUpdate()) {
|
||||
if (!text.isEmpty()) {
|
||||
text += i18n(" and ");
|
||||
}
|
||||
if (e.newAvatarUrl()) {
|
||||
if (e.avatarUrl().isEmpty()) {
|
||||
text += i18nc("their refers to a singular user", "cleared their avatar");
|
||||
#ifdef QUOTIENT_07
|
||||
} else if (!e.prevContent()->avatarUrl) {
|
||||
#else
|
||||
} else if (e.prevContent()->avatarUrl.isEmpty()) {
|
||||
#endif
|
||||
text += i18n("set an avatar");
|
||||
} else {
|
||||
text += i18nc("their refers to a singular user", "updated their avatar");
|
||||
@@ -534,18 +569,18 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case Membership::Leave:
|
||||
if (e.prevContent() && e.prevContent()->membership == Membership::Invite) {
|
||||
case MembershipType::Leave:
|
||||
if (e.prevContent() && e.prevContent()->membership == MembershipType::Invite) {
|
||||
return (e.senderId() != e.userId()) ? i18n("withdrew %1's invitation", subjectName) : i18n("rejected the invitation");
|
||||
}
|
||||
|
||||
if (e.prevContent() && e.prevContent()->membership == Membership::Ban) {
|
||||
if (e.prevContent() && e.prevContent()->membership == MembershipType::Ban) {
|
||||
return (e.senderId() != e.userId()) ? i18n("unbanned %1", subjectName) : i18n("self-unbanned");
|
||||
}
|
||||
return (e.senderId() != e.userId())
|
||||
? i18n("has put %1 out of the room: %2", subjectName, e.contentJson()["reason"_ls].toString().toHtmlEscaped())
|
||||
: i18n("left the room");
|
||||
case Membership::Ban:
|
||||
case MembershipType::Ban:
|
||||
if (e.senderId() != e.userId()) {
|
||||
if (e.reason().isEmpty()) {
|
||||
return i18n("banned %1 from the room", subjectName);
|
||||
@@ -555,7 +590,7 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
} else {
|
||||
return i18n("self-banned from the room");
|
||||
}
|
||||
case Membership::Knock: {
|
||||
case MembershipType::Knock: {
|
||||
QString reason(e.contentJson()["reason"_ls].toString().toHtmlEscaped());
|
||||
return reason.isEmpty() ? i18n("requested an invite") : i18n("requested an invite with reason: %1", reason);
|
||||
}
|
||||
@@ -589,7 +624,7 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
[](const RoomPowerLevelsEvent &) {
|
||||
return i18nc("'power level' means permission level", "changed the power levels for this room");
|
||||
},
|
||||
[](const StateEvent &e) {
|
||||
[](const StateEventBase &e) {
|
||||
if (e.matrixType() == QLatin1String("m.room.server_acl")) {
|
||||
return i18n("changed the server access control lists for this room");
|
||||
}
|
||||
@@ -605,15 +640,21 @@ QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
return e.stateKey().isEmpty() ? i18n("updated %1 state", e.matrixType())
|
||||
: i18n("updated %1 state for %2", e.matrixType(), e.stateKey().toHtmlEscaped());
|
||||
},
|
||||
#ifdef QUOTIENT_07
|
||||
[](const PollStartEvent &e) {
|
||||
return e.question();
|
||||
},
|
||||
#endif
|
||||
i18n("Unknown event"));
|
||||
}
|
||||
|
||||
QString NeoChatRoom::eventToGenericString(const RoomEvent &evt) const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
return switchOnType(
|
||||
#else
|
||||
return visit(
|
||||
#endif
|
||||
evt,
|
||||
[](const RoomMessageEvent &e) {
|
||||
Q_UNUSED(e)
|
||||
@@ -625,25 +666,25 @@ QString NeoChatRoom::eventToGenericString(const RoomEvent &evt) const
|
||||
},
|
||||
[](const RoomMemberEvent &e) {
|
||||
switch (e.membership()) {
|
||||
case Membership::Invite:
|
||||
case MembershipType::Invite:
|
||||
if (e.repeatsState()) {
|
||||
return i18n("reinvited someone to the room");
|
||||
}
|
||||
Q_FALLTHROUGH();
|
||||
case Membership::Join: {
|
||||
case MembershipType::Join: {
|
||||
QString text{};
|
||||
// Part 1: invites and joins
|
||||
if (e.repeatsState()) {
|
||||
text = i18n("joined the room (repeated)");
|
||||
} else if (e.changesMembership()) {
|
||||
text = e.membership() == Membership::Invite ? i18n("invited someone to the room") : i18n("joined the room");
|
||||
text = e.membership() == MembershipType::Invite ? i18n("invited someone to the room") : i18n("joined the room");
|
||||
}
|
||||
if (!text.isEmpty()) {
|
||||
return text;
|
||||
}
|
||||
// Part 2: profile changes of joined members
|
||||
if (e.isRename()) {
|
||||
if (e.newDisplayName()) {
|
||||
if (e.displayName().isEmpty()) {
|
||||
text = i18nc("their refers to a singular user", "cleared their display name");
|
||||
} else {
|
||||
text = i18nc("their refers to a singular user", "changed their display name");
|
||||
@@ -653,9 +694,13 @@ QString NeoChatRoom::eventToGenericString(const RoomEvent &evt) const
|
||||
if (!text.isEmpty()) {
|
||||
text += i18n(" and ");
|
||||
}
|
||||
if (e.newAvatarUrl()) {
|
||||
if (e.avatarUrl().isEmpty()) {
|
||||
text += i18nc("their refers to a singular user", "cleared their avatar");
|
||||
#ifdef QUOTIENT_07
|
||||
} else if (!e.prevContent()->avatarUrl) {
|
||||
#else
|
||||
} else if (e.prevContent()->avatarUrl.isEmpty()) {
|
||||
#endif
|
||||
text += i18n("set an avatar");
|
||||
} else {
|
||||
text += i18nc("their refers to a singular user", "updated their avatar");
|
||||
@@ -666,22 +711,22 @@ QString NeoChatRoom::eventToGenericString(const RoomEvent &evt) const
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case Membership::Leave:
|
||||
if (e.prevContent() && e.prevContent()->membership == Membership::Invite) {
|
||||
case MembershipType::Leave:
|
||||
if (e.prevContent() && e.prevContent()->membership == MembershipType::Invite) {
|
||||
return (e.senderId() != e.userId()) ? i18n("withdrew a user's invitation") : i18n("rejected the invitation");
|
||||
}
|
||||
|
||||
if (e.prevContent() && e.prevContent()->membership == Membership::Ban) {
|
||||
if (e.prevContent() && e.prevContent()->membership == MembershipType::Ban) {
|
||||
return (e.senderId() != e.userId()) ? i18n("unbanned a user") : i18n("self-unbanned");
|
||||
}
|
||||
return (e.senderId() != e.userId()) ? i18n("put a user out of the room") : i18n("left the room");
|
||||
case Membership::Ban:
|
||||
case MembershipType::Ban:
|
||||
if (e.senderId() != e.userId()) {
|
||||
return i18n("banned a user from the room");
|
||||
} else {
|
||||
return i18n("self-banned from the room");
|
||||
}
|
||||
case Membership::Knock: {
|
||||
case MembershipType::Knock: {
|
||||
return i18n("requested an invite");
|
||||
}
|
||||
default:;
|
||||
@@ -709,7 +754,7 @@ QString NeoChatRoom::eventToGenericString(const RoomEvent &evt) const
|
||||
[](const RoomPowerLevelsEvent &) {
|
||||
return i18nc("'power level' means permission level", "changed the power levels for this room");
|
||||
},
|
||||
[](const StateEvent &e) {
|
||||
[](const StateEventBase &e) {
|
||||
if (e.matrixType() == QLatin1String("m.room.server_acl")) {
|
||||
return i18n("changed the server access control lists for this room");
|
||||
}
|
||||
@@ -724,23 +769,56 @@ QString NeoChatRoom::eventToGenericString(const RoomEvent &evt) const
|
||||
}
|
||||
return i18n("updated the state");
|
||||
},
|
||||
#ifdef QUOTIENT_07
|
||||
[](const PollStartEvent &e) {
|
||||
Q_UNUSED(e);
|
||||
return i18n("started a poll");
|
||||
},
|
||||
#endif
|
||||
i18n("Unknown event"));
|
||||
}
|
||||
|
||||
void NeoChatRoom::changeAvatar(const QUrl &localFile)
|
||||
{
|
||||
const auto job = connection()->uploadFile(localFile.toLocalFile());
|
||||
#ifdef QUOTIENT_07
|
||||
if (isJobPending(job)) {
|
||||
#else
|
||||
if (isJobRunning(job)) {
|
||||
#endif
|
||||
connect(job, &BaseJob::success, this, [this, job] {
|
||||
#ifdef QUOTIENT_07
|
||||
connection()->callApi<SetRoomStateWithKeyJob>(id(), "m.room.avatar", QString(), QJsonObject{{"url", job->contentUri().toString()}});
|
||||
#else
|
||||
connection()->callApi<SetRoomStateWithKeyJob>(id(), "m.room.avatar", QString(), QJsonObject{{"url", job->contentUri()}});
|
||||
#endif
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void NeoChatRoom::addLocalAlias(const QString &alias)
|
||||
{
|
||||
auto a = aliases();
|
||||
if (a.contains(alias)) {
|
||||
return;
|
||||
}
|
||||
|
||||
a += alias;
|
||||
|
||||
setLocalAliases(a);
|
||||
}
|
||||
|
||||
void NeoChatRoom::removeLocalAlias(const QString &alias)
|
||||
{
|
||||
auto a = aliases();
|
||||
if (!a.contains(alias)) {
|
||||
return;
|
||||
}
|
||||
|
||||
a.removeAll(alias);
|
||||
|
||||
setLocalAliases(a);
|
||||
}
|
||||
|
||||
QString msgTypeToString(MessageEventType msgType)
|
||||
{
|
||||
switch (msgType) {
|
||||
@@ -845,11 +923,11 @@ void NeoChatRoom::toggleReaction(const QString &eventId, const QString &reaction
|
||||
|
||||
QStringList redactEventIds; // What if there are multiple reaction events?
|
||||
|
||||
const auto &annotations = relatedEvents(evt, EventRelation::AnnotationType);
|
||||
const auto &annotations = relatedEvents(evt, EventRelation::Annotation());
|
||||
if (!annotations.isEmpty()) {
|
||||
for (const auto &a : annotations) {
|
||||
if (auto e = eventCast<const ReactionEvent>(a)) {
|
||||
if (e->key() != reaction) {
|
||||
if (e->relation().key != reaction) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -872,15 +950,18 @@ void NeoChatRoom::toggleReaction(const QString &eventId, const QString &reaction
|
||||
|
||||
bool NeoChatRoom::containsUser(const QString &userID) const
|
||||
{
|
||||
return !isMember(userID);
|
||||
auto u = Room::user(userID);
|
||||
|
||||
if (!u) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Room::memberJoinState(u) != JoinState::Leave;
|
||||
}
|
||||
|
||||
bool NeoChatRoom::canSendEvent(const QString &eventType) const
|
||||
{
|
||||
auto plEvent = currentState().get<RoomPowerLevelsEvent>();
|
||||
if (!plEvent) {
|
||||
return true;
|
||||
}
|
||||
auto plEvent = getCurrentState<RoomPowerLevelsEvent>();
|
||||
auto pl = plEvent->powerLevelForEvent(eventType);
|
||||
auto currentPl = plEvent->powerLevelForUser(localUser()->id());
|
||||
|
||||
@@ -889,19 +970,28 @@ bool NeoChatRoom::canSendEvent(const QString &eventType) const
|
||||
|
||||
bool NeoChatRoom::canSendState(const QString &eventType) const
|
||||
{
|
||||
auto plEvent = currentState().get<RoomPowerLevelsEvent>();
|
||||
if (!plEvent) {
|
||||
return false;
|
||||
}
|
||||
auto plEvent = getCurrentState<RoomPowerLevelsEvent>();
|
||||
auto pl = plEvent->powerLevelForState(eventType);
|
||||
auto currentPl = plEvent->powerLevelForUser(localUser()->id());
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
if (eventType == "m.room.history_visibility" || eventType == "org.matrix.room.preview_urls") {
|
||||
return false;
|
||||
} else {
|
||||
return currentPl >= pl;
|
||||
}
|
||||
#else
|
||||
return currentPl >= pl;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NeoChatRoom::readMarkerLoaded() const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
const auto it = findInTimeline(lastFullyReadEventId());
|
||||
#else
|
||||
const auto it = findInTimeline(readMarkerEventId());
|
||||
#endif
|
||||
return it != historyEdge();
|
||||
}
|
||||
|
||||
@@ -912,7 +1002,12 @@ bool NeoChatRoom::isInvite() const
|
||||
|
||||
bool NeoChatRoom::isUserBanned(const QString &user) const
|
||||
{
|
||||
return currentState().get<RoomMemberEvent>(user)->membership() == Membership::Ban;
|
||||
return getCurrentState<RoomMemberEvent>(user)->membership() == MembershipType::Ban;
|
||||
}
|
||||
|
||||
QString NeoChatRoom::htmlSafeName() const
|
||||
{
|
||||
return name().toHtmlEscaped();
|
||||
}
|
||||
|
||||
QString NeoChatRoom::htmlSafeDisplayName() const
|
||||
@@ -927,7 +1022,7 @@ void NeoChatRoom::deleteMessagesByUser(const QString &user, const QString &reaso
|
||||
|
||||
QString NeoChatRoom::joinRule() const
|
||||
{
|
||||
return currentState().get<JoinRulesEvent>()->joinRule();
|
||||
return getCurrentState<JoinRulesEvent>()->joinRule();
|
||||
}
|
||||
|
||||
void NeoChatRoom::setJoinRule(const QString &joinRule)
|
||||
@@ -936,13 +1031,21 @@ void NeoChatRoom::setJoinRule(const QString &joinRule)
|
||||
qWarning() << "Power level too low to set join rules";
|
||||
return;
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
setState("m.room.join_rules", "", QJsonObject{{"join_rule", joinRule}});
|
||||
#else
|
||||
setState<JoinRulesEvent>(QJsonObject{{"type", "m.room.join_rules"}, {"state_key", ""}, {"content", QJsonObject{{"join_rule", joinRule}}}});
|
||||
#endif
|
||||
// Not emitting joinRuleChanged() here, since that would override the change in the UI with the *current* value, which is not the *new* value.
|
||||
}
|
||||
|
||||
QString NeoChatRoom::historyVisibility() const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
return currentState().get("m.room.history_visibility")->contentJson()["history_visibility"_ls].toString();
|
||||
#else
|
||||
return getCurrentState("m.room.history_visibility")->contentJson()["history_visibility"_ls].toString();
|
||||
#endif
|
||||
}
|
||||
|
||||
void NeoChatRoom::setHistoryVisibility(const QString &historyVisibilityRule)
|
||||
@@ -952,14 +1055,23 @@ void NeoChatRoom::setHistoryVisibility(const QString &historyVisibilityRule)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
setState("m.room.history_visibility", "", QJsonObject{{"history_visibility", historyVisibilityRule}});
|
||||
#else
|
||||
qWarning() << "Quotient 0.7 required to set history visibility";
|
||||
return;
|
||||
#endif
|
||||
|
||||
// Not emitting historyVisibilityChanged() here, since that would override the change in the UI with the *current* value, which is not the *new* value.
|
||||
}
|
||||
|
||||
bool NeoChatRoom::defaultUrlPreviewState() const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
auto urlPreviewsDisabled = currentState().get("org.matrix.room.preview_urls");
|
||||
#else
|
||||
auto urlPreviewsDisabled = getCurrentState("org.matrix.room.preview_urls");
|
||||
#endif
|
||||
|
||||
// Some rooms will not have this state event set so check for a nullptr return.
|
||||
if (urlPreviewsDisabled != nullptr) {
|
||||
@@ -1005,7 +1117,12 @@ void NeoChatRoom::setDefaultUrlPreviewState(const bool &defaultUrlPreviewState)
|
||||
*
|
||||
* You just have to set disable to true to disable URL previews by default.
|
||||
*/
|
||||
#ifdef QUOTIENT_07
|
||||
setState("org.matrix.room.preview_urls", "", QJsonObject{{"disable", !defaultUrlPreviewState}});
|
||||
#else
|
||||
qWarning() << "Quotient 0.7 required to set room default url preview setting";
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NeoChatRoom::urlPreviewEnabled() const
|
||||
@@ -1043,20 +1160,32 @@ void NeoChatRoom::setUserPowerLevel(const QString &userID, const int &powerLevel
|
||||
qWarning() << "Power level too low to set user power levels";
|
||||
return;
|
||||
}
|
||||
#ifdef QUOTIENT_07
|
||||
if (!isMember(userID)) {
|
||||
#else
|
||||
if (memberJoinState(user(userID)) == JoinState::Join) {
|
||||
#endif
|
||||
qWarning() << "User is not a member of this room so power level cannot be set";
|
||||
return;
|
||||
}
|
||||
int clampPowerLevel = std::clamp(powerLevel, 0, 100);
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
auto powerLevelContent = currentState().get("m.room.power_levels")->contentJson();
|
||||
#else
|
||||
auto powerLevelContent = getCurrentState<RoomPowerLevelsEvent>()->contentJson();
|
||||
#endif
|
||||
auto powerLevelUserOverrides = powerLevelContent["users"].toObject();
|
||||
|
||||
if (powerLevelUserOverrides[userID] != clampPowerLevel) {
|
||||
powerLevelUserOverrides[userID] = clampPowerLevel;
|
||||
powerLevelContent["users"] = powerLevelUserOverrides;
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
setState("m.room.power_levels", "", powerLevelContent);
|
||||
#else
|
||||
setState<RoomPowerLevelsEvent>(QJsonObject{{"type", "m.room.power_levels"}, {"state_key", ""}, {"content", powerLevelContent}});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1068,7 +1197,11 @@ int NeoChatRoom::getUserPowerLevel(const QString &userId) const
|
||||
|
||||
int NeoChatRoom::powerLevel(const QString &eventName, const bool &isStateEvent) const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
const auto powerLevelEvent = currentState().get<RoomPowerLevelsEvent>();
|
||||
#else
|
||||
const auto powerLevelEvent = getCurrentState<RoomPowerLevelsEvent>();
|
||||
#endif
|
||||
if (eventName == "ban") {
|
||||
return powerLevelEvent->ban();
|
||||
} else if (eventName == "kick") {
|
||||
@@ -1092,7 +1225,11 @@ int NeoChatRoom::powerLevel(const QString &eventName, const bool &isStateEvent)
|
||||
|
||||
void NeoChatRoom::setPowerLevel(const QString &eventName, const int &newPowerLevel, const bool &isStateEvent)
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
auto powerLevelContent = currentState().get("m.room.power_levels")->contentJson();
|
||||
#else
|
||||
auto powerLevelContent = getCurrentState<RoomPowerLevelsEvent>()->contentJson();
|
||||
#endif
|
||||
int clampPowerLevel = std::clamp(newPowerLevel, 0, 100);
|
||||
int powerLevel = 0;
|
||||
|
||||
@@ -1121,7 +1258,11 @@ void NeoChatRoom::setPowerLevel(const QString &eventName, const int &newPowerLev
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
setState("m.room.power_levels", "", powerLevelContent);
|
||||
#else
|
||||
setState<RoomPowerLevelsEvent>(QJsonObject{{"type", "m.room.power_levels"}, {"state_key", ""}, {"content", powerLevelContent}});
|
||||
#endif
|
||||
}
|
||||
|
||||
int NeoChatRoom::defaultUserPowerLevel() const
|
||||
@@ -1344,12 +1485,11 @@ bool NeoChatRoom::isSpace()
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
return creationEvent->roomType() == RoomType::Space;
|
||||
}
|
||||
|
||||
PushNotificationState::State NeoChatRoom::pushNotificationState() const
|
||||
{
|
||||
return m_currentPushNotificationState;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
|
||||
@@ -1671,9 +1811,15 @@ void NeoChatRoom::setSavedText(const QString &savedText)
|
||||
|
||||
bool NeoChatRoom::canEncryptRoom() const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
#ifdef Quotient_E2EE_ENABLED
|
||||
return !usesEncryption() && canSendState("m.room.encryption");
|
||||
#endif
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
PollHandler *NeoChatRoom::poll(const QString &eventId)
|
||||
{
|
||||
if (!m_polls.contains(eventId)) {
|
||||
@@ -1684,6 +1830,7 @@ PollHandler *NeoChatRoom::poll(const QString &eventId)
|
||||
}
|
||||
return m_polls[eventId];
|
||||
}
|
||||
#endif
|
||||
|
||||
bool NeoChatRoom::downloadTempFile(const QString &eventId)
|
||||
{
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <qobjectdefs.h>
|
||||
#include <room.h>
|
||||
|
||||
#include <QCache>
|
||||
#include <QObject>
|
||||
#include <QTextCursor>
|
||||
|
||||
#include <QCoroTask>
|
||||
#include <qcoro/task.h>
|
||||
|
||||
#include "neochatuser.h"
|
||||
#include "pollhandler.h"
|
||||
@@ -19,150 +20,36 @@ class PushNotificationState : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Describes the push notification state for the room.
|
||||
*/
|
||||
enum State {
|
||||
Unknown, /**< The state has not yet been obtained from the server. */
|
||||
Default, /**< The room follows the globally configured rules for the local user. */
|
||||
Mute, /**< No notifications for messages in the room. */
|
||||
MentionKeyword, /**< Notifications only for local user mentions and keywords. */
|
||||
All, /**< Notifications for all messages. */
|
||||
Unknown,
|
||||
Default,
|
||||
Mute,
|
||||
MentionKeyword,
|
||||
All,
|
||||
};
|
||||
Q_ENUM(State);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Defines a user mention in the current chat or edit text.
|
||||
*/
|
||||
struct Mention {
|
||||
QTextCursor cursor; /**< Contains the mention's text and position in the text. */
|
||||
QString text; /**< The inserted text of the mention. */
|
||||
int start = 0; /**< Start position of the mention. */
|
||||
int position = 0; /**< End position of the mention. */
|
||||
QString id; /**< The id the mention (used to create link when sending the message). */
|
||||
QTextCursor cursor;
|
||||
QString text;
|
||||
int start = 0;
|
||||
int position = 0;
|
||||
QString id;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class NeoChatRoom
|
||||
*
|
||||
* This class is designed to act as a wrapper over Quotient::Room to provide API and
|
||||
* functionality not available in Quotient::Room.
|
||||
*
|
||||
* The functions fall into two main categories:
|
||||
* - Helper functions to make functionality easily accessible in QML.
|
||||
* - Implement functions not yet available in Quotient::Room.
|
||||
*
|
||||
* @sa Quotient::Room
|
||||
*/
|
||||
class NeoChatRoom : public Quotient::Room
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/**
|
||||
* @brief A list of users currently typing in the room.
|
||||
*
|
||||
* The list does not include the local user.
|
||||
*
|
||||
* This is different to getting a list of NeoChatUser objects or Quotient::User objects
|
||||
* as neither of those can provide details like the displayName or avatarMediaId
|
||||
* without the room context as these can vary from room to room. This function
|
||||
* provides the room context and puts the result as a list of QVariantMap objects.
|
||||
*
|
||||
* @return a QVariantMap for the user with the following
|
||||
* parameters:
|
||||
* - id - User ID.
|
||||
* - avatarMediaId - Avatar id in the context of this room.
|
||||
* - displayName - Display name in the context of this room.
|
||||
* - display - Name in the context of this room.
|
||||
*
|
||||
* @sa Quotient::User, NeoChatUser
|
||||
*/
|
||||
Q_PROPERTY(QVariantList usersTyping READ getUsersTyping NOTIFY typingChanged)
|
||||
|
||||
/**
|
||||
* @brief Convenience function to get the QDateTime of the last event.
|
||||
*
|
||||
* @sa lastEvent()
|
||||
*/
|
||||
Q_PROPERTY(QDateTime lastActiveTime READ lastActiveTime NOTIFY lastActiveTimeChanged)
|
||||
|
||||
/**
|
||||
* @brief Whether a file is being uploaded to the server.
|
||||
*/
|
||||
Q_PROPERTY(bool hasFileUploading READ hasFileUploading WRITE setHasFileUploading NOTIFY hasFileUploadingChanged)
|
||||
|
||||
/**
|
||||
* @brief Progress of a file upload as a percentage 0 - 100%.
|
||||
*
|
||||
* The value will be 0 if no file is uploading.
|
||||
*
|
||||
* @sa hasFileUploading
|
||||
*/
|
||||
Q_PROPERTY(int fileUploadingProgress READ fileUploadingProgress NOTIFY fileUploadingProgressChanged)
|
||||
|
||||
/**
|
||||
* @brief Whether the read marker should be shown.
|
||||
*/
|
||||
Q_PROPERTY(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
||||
|
||||
/**
|
||||
* @brief Display name with any html special characters escaped.
|
||||
*/
|
||||
Q_PROPERTY(QString htmlSafeDisplayName READ htmlSafeDisplayName NOTIFY displayNameChanged)
|
||||
|
||||
/**
|
||||
* @brief The avatar image to be used for the room.
|
||||
*/
|
||||
Q_PROPERTY(QString avatarMediaId READ avatarMediaId NOTIFY avatarChanged STORED false)
|
||||
|
||||
/**
|
||||
* @brief Get a user object for the other person in a direct chat.
|
||||
*/
|
||||
Q_PROPERTY(NeoChatUser *directChatRemoteUser READ directChatRemoteUser CONSTANT)
|
||||
|
||||
/**
|
||||
* @brief If the room is a space.
|
||||
*/
|
||||
Q_PROPERTY(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
||||
Q_PROPERTY(QDateTime lastActiveTime READ lastActiveTime NOTIFY lastActiveTimeChanged)
|
||||
Q_PROPERTY(bool isSpace READ isSpace CONSTANT)
|
||||
|
||||
/**
|
||||
* @brief Whether the local user has an invite to the room.
|
||||
*
|
||||
* False for any other state including if the local user is a member.
|
||||
*/
|
||||
Q_PROPERTY(bool isInvite READ isInvite NOTIFY isInviteChanged)
|
||||
|
||||
/**
|
||||
* @brief The current join rule for the room as a QString.
|
||||
*
|
||||
* Possible values are [public, knock, invite, private, restricted].
|
||||
*
|
||||
* @sa https://spec.matrix.org/v1.5/client-server-api/#mroomjoin_rules
|
||||
*/
|
||||
Q_PROPERTY(QString joinRule READ joinRule WRITE setJoinRule NOTIFY joinRuleChanged)
|
||||
|
||||
/**
|
||||
* @brief Get the maximum room version that the server supports.
|
||||
*
|
||||
* Only returns main integer room versions (i.e. no msc room versions).
|
||||
*/
|
||||
Q_PROPERTY(int maxRoomVersion READ maxRoomVersion NOTIFY maxRoomVersionChanged)
|
||||
|
||||
/**
|
||||
* @brief The rule for which messages should generate notifications for the room.
|
||||
*
|
||||
* @sa PushNotificationState::State
|
||||
*/
|
||||
Q_PROPERTY(PushNotificationState::State pushNotificationState READ pushNotificationState WRITE setPushNotificationState NOTIFY pushNotificationStateChanged)
|
||||
|
||||
/**
|
||||
* @brief The current history visibilty setting for the room.
|
||||
*
|
||||
* Possible values are [invited, joined, shared, world_readable].
|
||||
*
|
||||
* @sa https://spec.matrix.org/v1.5/client-server-api/#room-history-visibility
|
||||
*/
|
||||
Q_PROPERTY(QString historyVisibility READ historyVisibility WRITE setHistoryVisibility NOTIFY historyVisibilityChanged)
|
||||
|
||||
/**
|
||||
@@ -178,441 +65,98 @@ class NeoChatRoom : public Quotient::Room
|
||||
*/
|
||||
Q_PROPERTY(bool urlPreviewEnabled READ urlPreviewEnabled WRITE setUrlPreviewEnabled NOTIFY urlPreviewEnabledChanged)
|
||||
|
||||
/**
|
||||
* @brief Whether the local user can encrypt the room.
|
||||
*
|
||||
* Requires libQuotient 0.7 compiled with the Quotient_E2EE_ENABLED parameter to
|
||||
* be able to return true.
|
||||
*
|
||||
* A local user can encrypt a room if they have permission to send the m.room.encryption
|
||||
* state event.
|
||||
*
|
||||
* @sa https://spec.matrix.org/v1.5/client-server-api/#mroomencryption
|
||||
*/
|
||||
Q_PROPERTY(bool canEncryptRoom READ canEncryptRoom NOTIFY canEncryptRoomChanged)
|
||||
|
||||
/**
|
||||
* @brief The default power level in the room for new users.
|
||||
*/
|
||||
// Properties for the various permission levels for the room
|
||||
Q_PROPERTY(int defaultUserPowerLevel READ defaultUserPowerLevel WRITE setDefaultUserPowerLevel NOTIFY defaultUserPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to invite users to the room.
|
||||
*/
|
||||
Q_PROPERTY(int invitePowerLevel READ invitePowerLevel WRITE setInvitePowerLevel NOTIFY invitePowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to kick users from the room.
|
||||
*/
|
||||
Q_PROPERTY(int kickPowerLevel READ kickPowerLevel WRITE setKickPowerLevel NOTIFY kickPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to ban users from the room.
|
||||
*/
|
||||
Q_PROPERTY(int banPowerLevel READ banPowerLevel WRITE setBanPowerLevel NOTIFY banPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to delete other user messages.
|
||||
*/
|
||||
Q_PROPERTY(int redactPowerLevel READ redactPowerLevel WRITE setRedactPowerLevel NOTIFY redactPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The default power level for state events that are not explicitly specified.
|
||||
*/
|
||||
Q_PROPERTY(int statePowerLevel READ statePowerLevel WRITE setStatePowerLevel NOTIFY statePowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The default power level for event that are not explicitly specified.
|
||||
*/
|
||||
Q_PROPERTY(int defaultEventPowerLevel READ defaultEventPowerLevel WRITE setDefaultEventPowerLevel NOTIFY defaultEventPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to change power levels for the room.
|
||||
*/
|
||||
Q_PROPERTY(int powerLevelPowerLevel READ powerLevelPowerLevel WRITE setPowerLevelPowerLevel NOTIFY powerLevelPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to change the room name.
|
||||
*/
|
||||
Q_PROPERTY(int namePowerLevel READ namePowerLevel WRITE setNamePowerLevel NOTIFY namePowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to change the room avatar.
|
||||
*/
|
||||
Q_PROPERTY(int avatarPowerLevel READ avatarPowerLevel WRITE setAvatarPowerLevel NOTIFY avatarPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to change the room aliases.
|
||||
*/
|
||||
Q_PROPERTY(int canonicalAliasPowerLevel READ canonicalAliasPowerLevel WRITE setCanonicalAliasPowerLevel NOTIFY canonicalAliasPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to change the room topic.
|
||||
*/
|
||||
Q_PROPERTY(int topicPowerLevel READ topicPowerLevel WRITE setTopicPowerLevel NOTIFY topicPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to encrypt the room.
|
||||
*/
|
||||
Q_PROPERTY(int encryptionPowerLevel READ encryptionPowerLevel WRITE setEncryptionPowerLevel NOTIFY encryptionPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to change the room history visibility.
|
||||
*/
|
||||
Q_PROPERTY(int historyVisibilityPowerLevel READ historyVisibilityPowerLevel WRITE setHistoryVisibilityPowerLevel NOTIFY historyVisibilityPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to pin events in the room.
|
||||
*/
|
||||
Q_PROPERTY(int pinnedEventsPowerLevel READ pinnedEventsPowerLevel WRITE setPinnedEventsPowerLevel NOTIFY pinnedEventsPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to upgrade the room.
|
||||
*/
|
||||
Q_PROPERTY(int tombstonePowerLevel READ tombstonePowerLevel WRITE setTombstonePowerLevel NOTIFY tombstonePowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to set the room server access control list (ACL).
|
||||
*/
|
||||
Q_PROPERTY(int serverAclPowerLevel READ serverAclPowerLevel WRITE setServerAclPowerLevel NOTIFY serverAclPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to add children to a space.
|
||||
*/
|
||||
Q_PROPERTY(int spaceChildPowerLevel READ spaceChildPowerLevel WRITE setSpaceChildPowerLevel NOTIFY spaceChildPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The power level required to set the room parent space.
|
||||
*/
|
||||
Q_PROPERTY(int spaceParentPowerLevel READ spaceParentPowerLevel WRITE setSpaceParentPowerLevel NOTIFY spaceParentPowerLevelChanged)
|
||||
|
||||
/**
|
||||
* @brief The current text in the chatbox for the room.
|
||||
*
|
||||
* Due to problems with QTextDocument, unlike the other properties here,
|
||||
* chatBoxText is *not* used to store the text when switching rooms.
|
||||
*/
|
||||
Q_PROPERTY(QString htmlSafeDisplayName READ htmlSafeDisplayName NOTIFY displayNameChanged)
|
||||
Q_PROPERTY(PushNotificationState::State pushNotificationState MEMBER m_currentPushNotificationState WRITE setPushNotificationState NOTIFY
|
||||
pushNotificationStateChanged)
|
||||
|
||||
// Due to problems with QTextDocument, unlike the other properties here, chatBoxText is *not* used to store the text when switching rooms
|
||||
Q_PROPERTY(QString chatBoxText READ chatBoxText WRITE setChatBoxText NOTIFY chatBoxTextChanged)
|
||||
|
||||
/**
|
||||
* @brief The text for any message currently being edited in the room.
|
||||
*/
|
||||
Q_PROPERTY(QString editText READ editText WRITE setEditText NOTIFY editTextChanged)
|
||||
|
||||
/**
|
||||
* @brief The event id of a message being replied to.
|
||||
*
|
||||
* Will be QString() if not replying to a message.
|
||||
*/
|
||||
Q_PROPERTY(QString chatBoxReplyId READ chatBoxReplyId WRITE setChatBoxReplyId NOTIFY chatBoxReplyIdChanged)
|
||||
|
||||
/**
|
||||
* @brief The event id of a message being edited.
|
||||
*
|
||||
* Will be QString() if not editing to a message.
|
||||
*/
|
||||
Q_PROPERTY(QString chatBoxEditId READ chatBoxEditId WRITE setChatBoxEditId NOTIFY chatBoxEditIdChanged)
|
||||
|
||||
/**
|
||||
* @brief Get the user object for the message being replied to.
|
||||
*
|
||||
* Returns a nullptr if not replying to a message.
|
||||
*/
|
||||
Q_PROPERTY(NeoChatUser *chatBoxReplyUser READ chatBoxReplyUser NOTIFY chatBoxReplyIdChanged)
|
||||
|
||||
/**
|
||||
* @brief The content of the message being replied to.
|
||||
*
|
||||
* Will be QString() if not replying to a message.
|
||||
*/
|
||||
Q_PROPERTY(QString chatBoxReplyMessage READ chatBoxReplyMessage NOTIFY chatBoxReplyIdChanged)
|
||||
|
||||
/**
|
||||
* @brief Get the user object for the message being edited.
|
||||
*
|
||||
* Returns a nullptr if not editing a message.
|
||||
*/
|
||||
Q_PROPERTY(NeoChatUser *chatBoxEditUser READ chatBoxEditUser NOTIFY chatBoxEditIdChanged)
|
||||
|
||||
/**
|
||||
* @brief The content of the message being edited.
|
||||
*
|
||||
* Will be QString() if not editing a message.
|
||||
*/
|
||||
Q_PROPERTY(QString chatBoxEditMessage READ chatBoxEditMessage NOTIFY chatBoxEditIdChanged)
|
||||
Q_PROPERTY(QString chatBoxAttachmentPath READ chatBoxAttachmentPath WRITE setChatBoxAttachmentPath NOTIFY chatBoxAttachmentPathChanged)
|
||||
Q_PROPERTY(bool canEncryptRoom READ canEncryptRoom NOTIFY canEncryptRoomChanged)
|
||||
|
||||
/**
|
||||
* @brief The file path of the attachment to be sent.
|
||||
* @brief Get the maximum room version that the server supports.
|
||||
*
|
||||
* Only returns main integer room versions (i.e. no msc room versions).
|
||||
*/
|
||||
Q_PROPERTY(QString chatBoxAttachmentPath READ chatBoxAttachmentPath WRITE setChatBoxAttachmentPath NOTIFY chatBoxAttachmentPathChanged)
|
||||
Q_PROPERTY(int maxRoomVersion READ maxRoomVersion NOTIFY maxRoomVersionChanged)
|
||||
Q_PROPERTY(NeoChatUser *directChatRemoteUser READ directChatRemoteUser CONSTANT)
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Define the types on inline messages that can be shown.
|
||||
*/
|
||||
enum MessageType {
|
||||
Positive, /**< Positive message, typically green. */
|
||||
Info, /**< Info message, typically highlight color. */
|
||||
Error, /**< Error message, typically red. */
|
||||
Positive,
|
||||
Info,
|
||||
Error,
|
||||
};
|
||||
Q_ENUM(MessageType);
|
||||
|
||||
explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {});
|
||||
|
||||
/**
|
||||
* @brief Get a list of users in the context of this room.
|
||||
*
|
||||
* This is different to getting a list of NeoChatUser objects or Quotient::User objects
|
||||
* as neither of those can provide details like the displayName or avatarMediaId
|
||||
* without the room context as these can vary from room to room. This function
|
||||
* provides the room context and returns the result as a list of QVariantMap objects.
|
||||
*
|
||||
* @param keyword filters the users based on the displayname containing keyword.
|
||||
* @param limit max number of user returned, -1 is infinite.
|
||||
*
|
||||
* @return a QVariantList containing a QVariantMap for each user with the following
|
||||
* properties:
|
||||
* - id - User ID.
|
||||
* - displayName - Display name in the context of this room.
|
||||
* - avatarMediaId - Avatar id in the context of this room.
|
||||
* - color - Color for the user.
|
||||
*
|
||||
* @sa Quotient::User, NeoChatUser
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] QVariantList getUsers(const QString &keyword, int limit = -1) const;
|
||||
|
||||
/**
|
||||
* @brief Get a user in the context of this room.
|
||||
*
|
||||
* This is different to getting a NeoChatUser object or Quotient::User object
|
||||
* as neither of those can provide details like the displayName or avatarMediaId
|
||||
* without the room context as these can vary from room to room. This function
|
||||
* provides the room context and outputs the result as QVariantMap.
|
||||
*
|
||||
* @param userID the ID of the user to output.
|
||||
*
|
||||
* @return a QVariantMap for the user with the following properties:
|
||||
* - id - User ID.
|
||||
* - displayName - Display name in the context of this room.
|
||||
* - avatarMediaId - Avatar id in the context of this room.
|
||||
* - color - Color for the user.
|
||||
*
|
||||
* @sa Quotient::User, NeoChatUser
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] QVariantMap getUser(const QString &userID) const;
|
||||
|
||||
[[nodiscard]] QVariantList getUsersTyping() const;
|
||||
|
||||
[[nodiscard]] QDateTime lastActiveTime();
|
||||
|
||||
/**
|
||||
* @brief Get the last interesting event.
|
||||
*
|
||||
* This function respects the user's state event setting and discards
|
||||
* other not interesting events.
|
||||
*
|
||||
* @warning This function can return an empty pointer if the room does not have
|
||||
* any RoomMessageEvents loaded.
|
||||
*/
|
||||
/// Get the interesting last event.
|
||||
///
|
||||
/// This function respect the showLeaveJoinEvent setting and discard
|
||||
/// other not interesting events. This function can return an empty pointer
|
||||
/// when the room is empty of RoomMessageEvent.
|
||||
[[nodiscard]] const Quotient::RoomEvent *lastEvent() const;
|
||||
|
||||
/**
|
||||
* @brief Output a string for the message content ready for display.
|
||||
*
|
||||
* The output string is dependant upon the event type and the desired output format.
|
||||
*
|
||||
* For most messages this is the body content of the message. For media messages
|
||||
* This will be the caption and for state events it will be a string specific
|
||||
* to that event with some dynamic details about the event added.
|
||||
*
|
||||
* E.g. For a room topic state event the text will be:
|
||||
* "set the topic to: <new topic text>"
|
||||
*
|
||||
* @param evt the event for which a string is desired.
|
||||
* @param format the output format, usually Qt::PlainText or Qt::RichText.
|
||||
* @param stripNewlines whether the output should have new lines in it.
|
||||
*/
|
||||
[[nodiscard]] QString eventToString(const Quotient::RoomEvent &evt, Qt::TextFormat format = Qt::PlainText, bool stripNewlines = false) const;
|
||||
|
||||
/**
|
||||
* @brief Output a generic string for the message content ready for display.
|
||||
*
|
||||
* The output string is dependant upon the event type.
|
||||
*
|
||||
* Unlike NeoChatRoom::eventToString the string is the same for all events of
|
||||
* the same type
|
||||
*
|
||||
* E.g. For a message the text will be:
|
||||
* "sent a message"
|
||||
*
|
||||
* @sa eventToString()
|
||||
*/
|
||||
[[nodiscard]] QString eventToGenericString(const Quotient::RoomEvent &evt) const;
|
||||
|
||||
/**
|
||||
* @brief Convenient way to call eventToString on the last event.
|
||||
*
|
||||
* @sa lastEvent()
|
||||
* @sa eventToString()
|
||||
*/
|
||||
/// Convenient way to get the last event but in a string format.
|
||||
///
|
||||
/// \see lastEvent
|
||||
/// \see lastEventIsSpoiler
|
||||
[[nodiscard]] QString lastEventToString(Qt::TextFormat format = Qt::PlainText, bool stripNewlines = false) const;
|
||||
|
||||
/**
|
||||
* @brief Convenient way to check if the last event looks like it has spoilers.
|
||||
*
|
||||
* This does a basic check to see if the message contains a data-mx-spoiler
|
||||
* attribute within the text which makes it likely that the message has a spoiler
|
||||
* section. However this is not 100% reliable as during parsing it may be
|
||||
* removed if used within an illegal tag or on a tag for which data-mx-spoiler
|
||||
* is not a valid attribute.
|
||||
*
|
||||
* @sa lastEvent()
|
||||
*/
|
||||
/// Convenient way to check if the last event looks like it has spoilers.
|
||||
///
|
||||
/// \see lastEvent
|
||||
/// \see lastEventToString
|
||||
[[nodiscard]] bool lastEventIsSpoiler() const;
|
||||
|
||||
[[nodiscard]] bool hasFileUploading() const;
|
||||
void setHasFileUploading(bool value);
|
||||
|
||||
[[nodiscard]] int fileUploadingProgress() const;
|
||||
void setFileUploadingProgress(int value);
|
||||
|
||||
/**
|
||||
* @brief Download a file for the given event to a local file location.
|
||||
*/
|
||||
Q_INVOKABLE void download(const QString &eventId, const QUrl &localFilename = {});
|
||||
|
||||
/**
|
||||
* @brief Download a file for the given event as a temporary file.
|
||||
*/
|
||||
Q_INVOKABLE bool downloadTempFile(const QString &eventId);
|
||||
|
||||
/**
|
||||
* @brief Check if the given event is highlighted.
|
||||
*
|
||||
* An event is highlighted if it contains the local user's id but was not sent by the
|
||||
* local user.
|
||||
*/
|
||||
bool isEventHighlighted(const Quotient::RoomEvent *e) const;
|
||||
|
||||
/**
|
||||
* @brief Convenience function to find out if the room contains the given user.
|
||||
*
|
||||
* A room contains the user if the user can be found and their JoinState is
|
||||
* not JoinState::Leave.
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] bool containsUser(const QString &userID) const;
|
||||
|
||||
/**
|
||||
* @brief True if the given user ID is banned from the room.
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] bool isUserBanned(const QString &user) const;
|
||||
|
||||
/**
|
||||
* @brief True if the local user can send the given event type.
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] bool canSendEvent(const QString &eventType) const;
|
||||
|
||||
/**
|
||||
* @brief True if the local user can send the given state event type.
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] bool canSendState(const QString &eventType) const;
|
||||
|
||||
/**
|
||||
* @brief Send a report to the server for an event.
|
||||
*
|
||||
* @param eventId the ID of the event being reported.
|
||||
* @param reason the reason given for reporting the event.
|
||||
*/
|
||||
Q_INVOKABLE void reportEvent(const QString &eventId, const QString &reason);
|
||||
|
||||
[[nodiscard]] bool readMarkerLoaded() const;
|
||||
|
||||
QString htmlSafeDisplayName() const;
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
/**
|
||||
* @brief Get a display name for the user with html escaped.
|
||||
*/
|
||||
Q_INVOKABLE QString htmlSafeMemberName(const QString &userId) const
|
||||
{
|
||||
return safeMemberName(userId).toHtmlEscaped();
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get subtitle text for room
|
||||
*
|
||||
* Fetches last event and removes markdown formatting
|
||||
*
|
||||
* @see lastEventToString()
|
||||
*/
|
||||
[[nodiscard]] QString subtitleText();
|
||||
|
||||
[[nodiscard]] QString avatarMediaId() const;
|
||||
|
||||
NeoChatUser *directChatRemoteUser() const;
|
||||
/// Convenient way to get the QDateTime of the last event.
|
||||
///
|
||||
/// \see lastEvent
|
||||
[[nodiscard]] QDateTime lastActiveTime();
|
||||
|
||||
[[nodiscard]] bool isSpace();
|
||||
|
||||
bool isInvite() const;
|
||||
|
||||
Q_INVOKABLE void clearInvitationNotification();
|
||||
bool isEventHighlighted(const Quotient::RoomEvent *e) const;
|
||||
|
||||
[[nodiscard]] QString joinRule() const;
|
||||
void setJoinRule(const QString &joinRule);
|
||||
|
||||
int maxRoomVersion() const;
|
||||
|
||||
/**
|
||||
* @brief Map an alias to the room and publish.
|
||||
*
|
||||
* The alias is first mapped to the room and then published as an
|
||||
* alternate alias. Publishing the alias will fail if the user does not have
|
||||
* permission to send m.room.canonical_alias event messages.
|
||||
*
|
||||
* @note This is different to Quotient::Room::setLocalAliases() as that can only
|
||||
* get the room to publish an alias that is already mapped.
|
||||
*
|
||||
* @property alias QString in the form #new_alias:server.org
|
||||
*
|
||||
* @sa Quotient::Room::setLocalAliases()
|
||||
*/
|
||||
Q_INVOKABLE void mapAlias(const QString &alias);
|
||||
|
||||
/**
|
||||
* @brief Unmap an alias from the room.
|
||||
*
|
||||
* An unmapped alias is also removed as either the canonical alias or an alternate
|
||||
* alias.
|
||||
*
|
||||
* @note This is different to Quotient::Room::setLocalAliases() as that can only
|
||||
* get the room to un-publish an alias, while the mapping still exists.
|
||||
*
|
||||
* @property alias QString in the form #mapped_alias:server.org
|
||||
*
|
||||
* @sa Quotient::Room::setLocalAliases()
|
||||
*/
|
||||
Q_INVOKABLE void unmapAlias(const QString &alias);
|
||||
|
||||
/**
|
||||
* @brief Set the canonical alias of the room to an available mapped alias.
|
||||
*
|
||||
* If the new alias was already published as an alternate alias it will be removed
|
||||
* from that list.
|
||||
*
|
||||
* @note This is an overload of the function Quotient::Room::setCanonicalAlias().
|
||||
* This is to provide the functionality to remove the new canonical alias as a
|
||||
* published alt alias when set.
|
||||
*
|
||||
* @property newAlias QString in the form #new_alias:server.org
|
||||
*
|
||||
* @sa Quotient::Room::setCanonicalAlias()
|
||||
* */
|
||||
Q_INVOKABLE void setCanonicalAlias(const QString &newAlias);
|
||||
|
||||
PushNotificationState::State pushNotificationState() const;
|
||||
void setPushNotificationState(PushNotificationState::State state);
|
||||
|
||||
[[nodiscard]] QString historyVisibility() const;
|
||||
void setHistoryVisibility(const QString &historyVisibilityRule);
|
||||
|
||||
@@ -622,8 +166,6 @@ public:
|
||||
[[nodiscard]] bool urlPreviewEnabled() const;
|
||||
void setUrlPreviewEnabled(const bool &urlPreviewEnabled);
|
||||
|
||||
bool canEncryptRoom() const;
|
||||
|
||||
/**
|
||||
* @brief Get the power level for the given user ID in the room.
|
||||
*
|
||||
@@ -694,6 +236,65 @@ public:
|
||||
[[nodiscard]] int spaceParentPowerLevel() const;
|
||||
void setSpaceParentPowerLevel(const int &newPowerLevel);
|
||||
|
||||
[[nodiscard]] bool hasFileUploading() const
|
||||
{
|
||||
return m_hasFileUploading;
|
||||
}
|
||||
void setHasFileUploading(bool value)
|
||||
{
|
||||
if (value == m_hasFileUploading) {
|
||||
return;
|
||||
}
|
||||
m_hasFileUploading = value;
|
||||
Q_EMIT hasFileUploadingChanged();
|
||||
}
|
||||
|
||||
[[nodiscard]] int fileUploadingProgress() const
|
||||
{
|
||||
return m_fileUploadingProgress;
|
||||
}
|
||||
void setFileUploadingProgress(int value)
|
||||
{
|
||||
if (m_fileUploadingProgress == value) {
|
||||
return;
|
||||
}
|
||||
m_fileUploadingProgress = value;
|
||||
Q_EMIT fileUploadingProgressChanged();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool readMarkerLoaded() const;
|
||||
|
||||
Q_INVOKABLE [[nodiscard]] int savedTopVisibleIndex() const;
|
||||
Q_INVOKABLE [[nodiscard]] int savedBottomVisibleIndex() const;
|
||||
Q_INVOKABLE void saveViewport(int topIndex, int bottomIndex);
|
||||
|
||||
Q_INVOKABLE [[nodiscard]] QVariantList getUsers(const QString &keyword, int limit = -1) const;
|
||||
Q_INVOKABLE [[nodiscard]] QVariantMap getUser(const QString &userID) const;
|
||||
|
||||
Q_INVOKABLE QUrl urlToMxcUrl(const QUrl &mxcUrl);
|
||||
|
||||
[[nodiscard]] QString avatarMediaId() const;
|
||||
|
||||
[[nodiscard]] QString eventToString(const Quotient::RoomEvent &evt, Qt::TextFormat format = Qt::PlainText, bool stripNewlines = false) const;
|
||||
[[nodiscard]] QString eventToGenericString(const Quotient::RoomEvent &evt) const;
|
||||
|
||||
Q_INVOKABLE [[nodiscard]] bool containsUser(const QString &userID) const;
|
||||
Q_INVOKABLE [[nodiscard]] bool isUserBanned(const QString &user) const;
|
||||
|
||||
Q_INVOKABLE [[nodiscard]] bool canSendEvent(const QString &eventType) const;
|
||||
Q_INVOKABLE [[nodiscard]] bool canSendState(const QString &eventType) const;
|
||||
|
||||
bool isInvite() const;
|
||||
|
||||
Q_INVOKABLE QString htmlSafeName() const;
|
||||
Q_INVOKABLE QString htmlSafeDisplayName() const;
|
||||
Q_INVOKABLE void clearInvitationNotification();
|
||||
Q_INVOKABLE void reportEvent(const QString &eventId, const QString &reason);
|
||||
|
||||
Q_INVOKABLE void setPushNotificationState(PushNotificationState::State state);
|
||||
|
||||
Q_INVOKABLE void download(const QString &eventId, const QUrl &localFilename = {});
|
||||
|
||||
QString chatBoxText() const;
|
||||
void setChatBoxText(const QString &text);
|
||||
|
||||
@@ -715,37 +316,43 @@ public:
|
||||
QString chatBoxAttachmentPath() const;
|
||||
void setChatBoxAttachmentPath(const QString &attachmentPath);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the mentions for the current chatbox text.
|
||||
*/
|
||||
QVector<Mention> *mentions();
|
||||
|
||||
/**
|
||||
* @brief Retrieve the mentions for the current edit text.
|
||||
* @brief Vector of mentions in the current edit text.
|
||||
*/
|
||||
QVector<Mention> *editMentions();
|
||||
|
||||
/**
|
||||
* @brief Get the saved chatbox text for the room.
|
||||
*/
|
||||
QString savedText() const;
|
||||
|
||||
/**
|
||||
* @brief Save the chatbox text for the room.
|
||||
*/
|
||||
void setSavedText(const QString &savedText);
|
||||
|
||||
/**
|
||||
* @brief Get a PollHandler object for the given event Id.
|
||||
bool canEncryptRoom() const;
|
||||
|
||||
Q_INVOKABLE bool downloadTempFile(const QString &eventId);
|
||||
|
||||
/*
|
||||
* Map an alias to the room
|
||||
*
|
||||
* Will return an existing PollHandler if one already exists for the event ID.
|
||||
* A new PollHandler will be created if one doesn't exist.
|
||||
*
|
||||
* @note Requires libQuotient 0.7.
|
||||
*
|
||||
* @sa PollHandler
|
||||
* Note: this is different to setLocalAliases as that can only
|
||||
* get the room to publish and alias that is already mapped.
|
||||
*/
|
||||
Q_INVOKABLE void mapAlias(const QString &alias);
|
||||
Q_INVOKABLE void unmapAlias(const QString &alias);
|
||||
Q_INVOKABLE void setCanonicalAlias(const QString &newAlias);
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
Q_INVOKABLE PollHandler *poll(const QString &eventId);
|
||||
#endif
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
Q_INVOKABLE QString htmlSafeMemberName(const QString &userId) const
|
||||
{
|
||||
return safeMemberName(userId).toHtmlEscaped();
|
||||
}
|
||||
#endif
|
||||
|
||||
int maxRoomVersion() const;
|
||||
NeoChatUser *directChatRemoteUser() const;
|
||||
|
||||
private:
|
||||
QSet<const Quotient::RoomEvent *> highlights;
|
||||
@@ -773,7 +380,9 @@ private:
|
||||
QVector<Mention> m_mentions;
|
||||
QVector<Mention> m_editMentions;
|
||||
QString m_savedText;
|
||||
#ifdef QUOTIENT_07
|
||||
QCache<QString, PollHandler> m_polls;
|
||||
#endif
|
||||
|
||||
private Q_SLOTS:
|
||||
void countChanged();
|
||||
@@ -823,78 +432,26 @@ Q_SIGNALS:
|
||||
void spaceParentPowerLevelChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* @brief Upload a file to the matrix server and post the file to the room.
|
||||
*
|
||||
* @param url the location of the file to be uploaded.
|
||||
* @param body the caption that is to be given to the file.
|
||||
*/
|
||||
void uploadFile(const QUrl &url, const QString &body = QString());
|
||||
|
||||
/**
|
||||
* @brief Accept an invitation for the local user to join the room.
|
||||
*/
|
||||
void acceptInvitation();
|
||||
|
||||
/**
|
||||
* @brief Leave and forget the room for the local user.
|
||||
*
|
||||
* @note This means that not only will the user no longer receive events in
|
||||
* the room but the will forget any history up to this point.
|
||||
*
|
||||
* @sa https://spec.matrix.org/latest/client-server-api/#leaving-rooms
|
||||
*/
|
||||
void forget();
|
||||
|
||||
/**
|
||||
* @brief Set the typing notification state on the room for the local user.
|
||||
*/
|
||||
void sendTypingNotification(bool isTyping);
|
||||
|
||||
/**
|
||||
* @brief Send a message to the room.
|
||||
*
|
||||
* @param rawText the text as it was typed.
|
||||
* @param cleanedText the text marked up as html.
|
||||
* @param type the type of message being sent.
|
||||
* @param replyEventId the id of the message being replied to if a reply.
|
||||
* @param relateToEventId the id of the message being edited if an edit.
|
||||
*/
|
||||
/// @param rawText The text as it was typed.
|
||||
/// @param cleanedText The text with link to the users.
|
||||
void postMessage(const QString &rawText,
|
||||
const QString &cleanedText,
|
||||
Quotient::MessageEventType type = Quotient::MessageEventType::Text,
|
||||
const QString &replyEventId = QString(),
|
||||
const QString &relateToEventId = QString());
|
||||
|
||||
/**
|
||||
* @brief Send an html message to the room.
|
||||
*
|
||||
* @param text the text as it was typed.
|
||||
* @param html the text marked up as html.
|
||||
* @param type the type of message being sent.
|
||||
* @param replyEventId the id of the message being replied to if a reply.
|
||||
* @param relateToEventId the id of the message being edited if an edit.
|
||||
*/
|
||||
void postHtmlMessage(const QString &text,
|
||||
const QString &html,
|
||||
Quotient::MessageEventType type = Quotient::MessageEventType::Text,
|
||||
const QString &replyEventId = QString(),
|
||||
const QString &relateToEventId = QString());
|
||||
|
||||
/**
|
||||
* @brief Set the room avatar.
|
||||
*/
|
||||
void changeAvatar(const QUrl &localFile);
|
||||
|
||||
/**
|
||||
* @brief Toggle the reaction state of the given reaction for the local user.
|
||||
*/
|
||||
void addLocalAlias(const QString &alias);
|
||||
void removeLocalAlias(const QString &alias);
|
||||
void toggleReaction(const QString &eventId, const QString &reaction);
|
||||
|
||||
/**
|
||||
* @brief Delete recent messages by the given user.
|
||||
*
|
||||
* This will delete all messages by that user in this room that are currently loaded.
|
||||
*/
|
||||
void deleteMessagesByUser(const QString &user, const QString &reason);
|
||||
};
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
#include <KNotification>
|
||||
#include <KNotificationReplyAction>
|
||||
|
||||
#ifdef QUOTIENT_07
|
||||
#include <accountregistry.h>
|
||||
#else
|
||||
#include "neochataccountregistry.h"
|
||||
#endif
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/pushrules.h>
|
||||
@@ -68,7 +72,11 @@ void NotificationsManager::postNotification(NeoChatRoom *room,
|
||||
connect(notification, &KNotification::defaultActivated, this, [=]() {
|
||||
WindowController::instance().showAndRaiseWindow(notification->xdgActivationToken());
|
||||
if (room->localUser()->id() != Controller::instance().activeConnection()->userId()) {
|
||||
#ifdef QUOTIENT_07
|
||||
Controller::instance().setActiveConnection(Accounts.get(room->localUser()->id()));
|
||||
#else
|
||||
Controller::instance().setActiveConnection(AccountRegistry::instance().get(room->localUser()->id()));
|
||||
#endif
|
||||
}
|
||||
RoomManager::instance().enterRoom(room);
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ Name[es]=NeoChat
|
||||
Name[eu]=NeoChat
|
||||
Name[fi]=NeoChat
|
||||
Name[fr]=NeoChat
|
||||
Name[gl]=NeoChat
|
||||
Name[hu]=NeoChat
|
||||
Name[ia]=Neochat
|
||||
Name[id]=NeoChat
|
||||
@@ -50,6 +51,7 @@ Comment[es]=Buscar salas en NeoChat
|
||||
Comment[eu]=Bilatu gelak NeoChat-en
|
||||
Comment[fi]=Etsi huoneita NeoChatissä
|
||||
Comment[fr]=Trouver des salons dans NeoChat
|
||||
Comment[gl]=Atopa salas en NeoChat
|
||||
Comment[ia]=Trova salas in NeoChat
|
||||
Comment[id]=Cari ruangan di NeoChat
|
||||
Comment[ie]=Trovar chambres in NeoChat
|
||||
|
||||
@@ -34,7 +34,7 @@ void PollHandler::setRoom(NeoChatRoom *room)
|
||||
connect(room, &NeoChatRoom::aboutToAddNewMessages, this, [this](Quotient::RoomEventsRange events) {
|
||||
for (const auto &event : events) {
|
||||
if (event->is<PollEndEvent>()) {
|
||||
auto pl = m_room->currentState().get<RoomPowerLevelsEvent>();
|
||||
auto pl = m_room->getCurrentState<RoomPowerLevelsEvent>();
|
||||
auto userPl = pl->powerLevelForUser(event->senderId());
|
||||
if (event->senderId() == (*m_room->findInTimeline(m_pollStartEventId))->senderId() || userPl >= pl->redact()) {
|
||||
m_hasEnded = true;
|
||||
@@ -75,7 +75,7 @@ void PollHandler::checkLoadRelations()
|
||||
connect(job, &BaseJob::success, this, [this, job]() {
|
||||
for (const auto &event : job->chunk()) {
|
||||
if (event->is<PollEndEvent>()) {
|
||||
auto pl = m_room->currentState().get<RoomPowerLevelsEvent>();
|
||||
auto pl = m_room->getCurrentState<RoomPowerLevelsEvent>();
|
||||
auto userPl = pl->powerLevelForUser(event->senderId());
|
||||
if (event->senderId() == (*m_room->findInTimeline(m_pollStartEventId))->senderId() || userPl >= pl->redact()) {
|
||||
m_hasEnded = true;
|
||||
|
||||
@@ -139,37 +139,7 @@ QQC2.Control {
|
||||
currentRoom.chatBoxText = text
|
||||
}
|
||||
onCursorRectangleChanged: chatBarScrollView.ensureVisible(cursorRectangle)
|
||||
onSelectedTextChanged: {
|
||||
if (selectedText.length > 0) {
|
||||
quickFormatBar.selectionStart = selectionStart
|
||||
quickFormatBar.selectionEnd = selectionEnd
|
||||
quickFormatBar.open()
|
||||
}
|
||||
}
|
||||
|
||||
QuickFormatBar {
|
||||
id: quickFormatBar
|
||||
|
||||
x: textField.cursorRectangle.x
|
||||
y: textField.cursorRectangle.y - height
|
||||
|
||||
onFormattingSelected: chatBar.formatText(format, selectionStart, selectionEnd)
|
||||
}
|
||||
|
||||
Keys.onDeletePressed: {
|
||||
if (selectedText.length > 0) {
|
||||
remove(selectionStart, selectionEnd)
|
||||
} else {
|
||||
remove(cursorPosition, cursorPosition + 1)
|
||||
}
|
||||
if (textField.text == selectedText || textField.text.length <= 1) {
|
||||
currentRoom.sendTypingNotification(false)
|
||||
repeatTimer.stop()
|
||||
}
|
||||
if (quickFormatBar.visible) {
|
||||
quickFormatBar.close()
|
||||
}
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
if (completionMenu.visible) {
|
||||
completionMenu.complete()
|
||||
@@ -197,7 +167,7 @@ QQC2.Control {
|
||||
if (event.key === Qt.Key_V && event.modifiers & Qt.ControlModifier) {
|
||||
chatBar.pasteImage();
|
||||
} else if (event.key === Qt.Key_Up && event.modifiers & Qt.ControlModifier) {
|
||||
let replyEvent = messageEventModel.getLatestMessageFromRow(0)
|
||||
let replyEvent = messageEventModel.getLatestMessageFromIndex(0)
|
||||
if (replyEvent && replyEvent["event_id"]) {
|
||||
currentRoom.chatBoxReplyId = replyEvent["event_id"]
|
||||
}
|
||||
@@ -210,14 +180,9 @@ QQC2.Control {
|
||||
completionMenu.decrementIndex()
|
||||
} else if (event.key === Qt.Key_Down && completionMenu.visible) {
|
||||
completionMenu.incrementIndex()
|
||||
} else if (event.key === Qt.Key_Backspace) {
|
||||
if (textField.text == selectedText || textField.text.length <= 1) {
|
||||
currentRoom.sendTypingNotification(false)
|
||||
repeatTimer.stop()
|
||||
}
|
||||
if (quickFormatBar.visible && selectedText.length > 0) {
|
||||
quickFormatBar.close()
|
||||
}
|
||||
} else if (event.key === Qt.Key_Backspace && textField.text.length <= 1) {
|
||||
currentRoom.sendTypingNotification(false)
|
||||
repeatTimer.stop()
|
||||
}
|
||||
}
|
||||
Keys.onShortcutOverride: {
|
||||
@@ -348,9 +313,14 @@ QQC2.Control {
|
||||
QQC2.ToolTip.text: modelData.tooltip
|
||||
HoverHandler { id: hoverHandler }
|
||||
|
||||
PieProgressBar {
|
||||
visible: modelData.isBusy
|
||||
progress: currentRoom.fileUploadingProgress
|
||||
QQC2.BusyIndicator {
|
||||
anchors.fill: parent
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
visible: running
|
||||
running: modelData.isBusy
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,8 +364,6 @@ QQC2.Control {
|
||||
cursorPosition: textField.cursorPosition
|
||||
selectionStart: textField.selectionStart
|
||||
selectionEnd: textField.selectionEnd
|
||||
mentionColor: Kirigami.Theme.linkColor
|
||||
errorColor: Kirigami.Theme.negativeTextColor
|
||||
Component.onCompleted: {
|
||||
RoomManager.chatDocumentHandler = documentHandler;
|
||||
}
|
||||
@@ -430,47 +398,4 @@ QQC2.Control {
|
||||
currentRoom.chatBoxReplyId = "";
|
||||
messageSent()
|
||||
}
|
||||
|
||||
function formatText(format, selectionStart, selectionEnd) {
|
||||
let index = textField.cursorPosition;
|
||||
|
||||
/*
|
||||
* There cannot be white space at the beginning or end of the string for the
|
||||
* formatting to work so move the sectionStart and sectionEnd markers past any whitespace.
|
||||
*/
|
||||
let innerText = textField.text.substr(selectionStart, selectionEnd - selectionStart);
|
||||
if (innerText.charAt(innerText.length - 1) === " ") {
|
||||
let trimmedRightString = innerText.replace(/\s*$/,"");
|
||||
let trimDifference = innerText.length - trimmedRightString.length;
|
||||
selectionEnd -= trimDifference;
|
||||
}
|
||||
if (innerText.charAt(0) === " ") {
|
||||
let trimmedLeftString = innerText.replace(/^\s*/,"");
|
||||
let trimDifference = innerText.length - trimmedLeftString.length;
|
||||
selectionStart = selectionStart + trimDifference;
|
||||
}
|
||||
|
||||
let startText = textField.text.substr(0, selectionStart);
|
||||
// Needs updating with the new selectionStart and selectionEnd with white space trimmed.
|
||||
innerText = textField.text.substr(selectionStart, selectionEnd - selectionStart);
|
||||
let endText = textField.text.substr(selectionEnd);
|
||||
|
||||
textField.text = "";
|
||||
textField.text = startText + format.start + innerText + format.end + format.extra + endText;
|
||||
|
||||
/*
|
||||
* Put the cursor where it was when the popup was opened accounting for the
|
||||
* new markup.
|
||||
*
|
||||
* The exception is for a hyperlink where it is placed ready to start typing
|
||||
* the url.
|
||||
*/
|
||||
if (format.extra !== "") {
|
||||
textField.cursorPosition = selectionEnd + format.start.length + format.end.length;
|
||||
} else if (index == selectionStart) {
|
||||
textField.cursorPosition = index;
|
||||
} else {
|
||||
textField.cursorPosition = index + format.start.length + format.end.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
import QtQuick 2.15
|
||||
|
||||
import org.kde.kirigami 2.18 as Kirigami
|
||||
import org.kde.quickcharts 1.0 as Charts
|
||||
|
||||
/**
|
||||
* @brief A circular progress bar that fills an arc as progress goes up.
|
||||
*/
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
/**
|
||||
* @brief Progress of the circle as a percentage.
|
||||
*
|
||||
* Range - 0% to 100%.
|
||||
*/
|
||||
property int progress: 0
|
||||
|
||||
/**
|
||||
* @brief Offset angle for the start of the pie fill arc.
|
||||
*
|
||||
* This defaults to 0, i.e. an upward vertical line from the center. This rotates
|
||||
* that start point by the desired number of degrees.
|
||||
*
|
||||
* Range - 0 degrees to 360 degrees
|
||||
*/
|
||||
property int startOffset: 0
|
||||
|
||||
/**
|
||||
* @brief Fill color of the pie.
|
||||
*/
|
||||
property color pieColor: Kirigami.Theme.highlightColor
|
||||
|
||||
width: Kirigami.Units.iconSizes.smallMedium
|
||||
height: Kirigami.Units.iconSizes.smallMedium
|
||||
radius: width / 2
|
||||
color: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.15)
|
||||
|
||||
Charts.PieChart {
|
||||
id: chart
|
||||
anchors.fill: parent
|
||||
anchors.margins: 1
|
||||
|
||||
filled: true
|
||||
// Set chart background color so the parent filled rectangle looks like
|
||||
// an outline.
|
||||
backgroundColor: Kirigami.Theme.backgroundColor
|
||||
fromAngle: root.startOffset
|
||||
toAngle: 360 + root.startOffset
|
||||
range {
|
||||
from: 0
|
||||
to: 100
|
||||
automatic: false
|
||||
}
|
||||
valueSources: Charts.SingleValueSource {
|
||||
value: root.progress
|
||||
}
|
||||
colorSource: Charts.SingleValueSource {
|
||||
value: Kirigami.Theme.highlightColor
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
|
||||
QQC2.Popup {
|
||||
id: root
|
||||
|
||||
property var selectionStart
|
||||
property var selectionEnd
|
||||
|
||||
signal formattingSelected(var format, int selectionStart, int selectionEnd)
|
||||
|
||||
padding: 1
|
||||
|
||||
contentItem: Flow {
|
||||
QQC2.ToolButton {
|
||||
icon.name: "format-text-bold"
|
||||
text: i18n("Bold")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
const format = {
|
||||
start: "**",
|
||||
end: "**",
|
||||
extra: "",
|
||||
}
|
||||
formattingSelected(format, selectionStart, selectionEnd)
|
||||
root.close()
|
||||
}
|
||||
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
icon.name: "format-text-italic"
|
||||
text: i18n("Italic")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
const format = {
|
||||
start: "*",
|
||||
end: "*",
|
||||
extra: "",
|
||||
}
|
||||
formattingSelected(format, selectionStart, selectionEnd)
|
||||
root.close()
|
||||
}
|
||||
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
icon.name: "format-text-strikethrough"
|
||||
text: i18n("Strikethrough")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
const format = {
|
||||
start: "<del>",
|
||||
end: "</del>",
|
||||
extra: "",
|
||||
}
|
||||
formattingSelected(format, selectionStart, selectionEnd)
|
||||
root.close()
|
||||
}
|
||||
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
icon.name: "format-text-code"
|
||||
text: i18n("Code block")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
const format = {
|
||||
start: "`",
|
||||
end: "`",
|
||||
extra: "",
|
||||
}
|
||||
formattingSelected(format, selectionStart, selectionEnd)
|
||||
root.close()
|
||||
}
|
||||
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
icon.name: "format-text-blockquote"
|
||||
text: i18n("Quote")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
const format = {
|
||||
start: selectionStart == 0 ? ">" : "\n>",
|
||||
end: "\n\n",
|
||||
extra: "",
|
||||
}
|
||||
formattingSelected(format, selectionStart, selectionEnd)
|
||||
root.close()
|
||||
}
|
||||
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
icon.name: "link"
|
||||
text: i18n("Insert link")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
|
||||
onClicked: {
|
||||
const format = {
|
||||
start: "[",
|
||||
end: "](",
|
||||
extra: ")",
|
||||
}
|
||||
formattingSelected(format, selectionStart, selectionEnd)
|
||||
root.close()
|
||||
}
|
||||
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,132 +1,115 @@
|
||||
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// SPDX-FileCopyrightText: 2021 Carson Black <uhhadd@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import QtQuick.Layouts 1.10
|
||||
import QtQuick.Controls 2.12 as QQC2
|
||||
import org.kde.kirigami 2.14 as Kirigami
|
||||
import org.kde.kitemmodels 1.0
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
QQC2.Dialog {
|
||||
id: root
|
||||
|
||||
parent: applicationWindow().overlay
|
||||
width: Math.min(700, parent.width)
|
||||
height: 400
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
bottomPadding: 0
|
||||
topPadding: 0
|
||||
|
||||
anchors.centerIn: applicationWindow().overlay
|
||||
|
||||
Keys.forwardTo: searchField
|
||||
QQC2.Popup {
|
||||
id: _popup
|
||||
|
||||
Shortcut {
|
||||
sequence: "Ctrl+K"
|
||||
onActivated: root.open()
|
||||
enabled: !Kirigami.Settings.hasPlatformMenuBar
|
||||
onActivated: _popup.open()
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible) {
|
||||
return
|
||||
}
|
||||
searchField.forceActiveFocus()
|
||||
searchField.text = ""
|
||||
roomList.currentIndex = 0
|
||||
quickSearch.forceActiveFocus()
|
||||
quickSearch.text = ""
|
||||
}
|
||||
|
||||
header: Kirigami.SearchField {
|
||||
id: searchField
|
||||
Keys.onDownPressed: {
|
||||
roomList.forceActiveFocus()
|
||||
if (roomList.currentIndex < roomList.count - 1) {
|
||||
roomList.currentIndex++
|
||||
} else {
|
||||
roomList.currentIndex = 0
|
||||
}
|
||||
}
|
||||
Keys.onUpPressed: {
|
||||
if (roomList.currentIndex === 0) {
|
||||
roomList.currentIndex = roomList.count - 1
|
||||
} else {
|
||||
roomList.currentIndex--
|
||||
}
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
RoomManager.enterRoom(roomList.currentItem.currentRoom);
|
||||
root.close();
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
RoomManager.enterRoom(roomList.currentItem.currentRoom);
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
anchors.centerIn: QQC2.Overlay.overlay
|
||||
background: Kirigami.Card {}
|
||||
height: 2 * Math.round(implicitHeight / 2)
|
||||
padding: Kirigami.Units.largeSpacing * 2
|
||||
|
||||
QQC2.ScrollView {
|
||||
anchors.fill: parent
|
||||
contentItem: ColumnLayout {
|
||||
spacing: Kirigami.Units.largeSpacing * 2
|
||||
|
||||
Kirigami.SearchField {
|
||||
id: quickSearch
|
||||
|
||||
// TODO: get this broken property removed/disabled by default in Kirigami,
|
||||
// we used to be able to expect that the text field wouldn't attempt to
|
||||
// perform a mini-DDOS attack using signals.
|
||||
autoAccept: false
|
||||
/**
|
||||
* The focus is manged by the popup and we don't want to use the standard
|
||||
* shortcut as it could block other SearchFields from using it.
|
||||
*/
|
||||
focusSequence: ""
|
||||
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 21 // 3 * 7 = 21, roughly 7 avatars on screen
|
||||
Keys.onLeftPressed: cView.decrementCurrentIndex()
|
||||
Keys.onRightPressed: cView.incrementCurrentIndex()
|
||||
onAccepted: {
|
||||
const item = cView.itemAtIndex(cView.currentIndex)
|
||||
|
||||
RoomManager.enterRoom(item.currentRoom)
|
||||
|
||||
_popup.close()
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: roomList
|
||||
id: cView
|
||||
|
||||
orientation: Qt.Horizontal
|
||||
spacing: Kirigami.Units.largeSpacing
|
||||
|
||||
currentIndex: 0
|
||||
highlightMoveDuration: 200
|
||||
Keys.forwardTo: searchField
|
||||
keyNavigationEnabled: true
|
||||
model: SortFilterRoomListModel {
|
||||
filterText: searchField.text
|
||||
id: sortFilterRoomListModel
|
||||
sourceModel: RoomListModel {
|
||||
id: roomListModel
|
||||
connection: Controller.activeConnection
|
||||
}
|
||||
filterText: quickSearch.text
|
||||
roomSortOrder: SortFilterRoomListModel.LastActivity
|
||||
}
|
||||
delegate: Kirigami.BasicListItem {
|
||||
id: roomListItem
|
||||
|
||||
required property var currentRoom
|
||||
required property string name
|
||||
required property int index
|
||||
required property int unreadCount
|
||||
required property string subtitleText
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
||||
Layout.fillWidth: true
|
||||
|
||||
delegate: Kirigami.Avatar {
|
||||
id: del
|
||||
|
||||
implicitHeight: Kirigami.Units.gridUnit * 3
|
||||
implicitWidth: Kirigami.Units.gridUnit * 3
|
||||
|
||||
required property string avatar
|
||||
required property var currentRoom
|
||||
required property int index
|
||||
|
||||
topPadding: Kirigami.Units.largeSpacing
|
||||
bottomPadding: Kirigami.Units.largeSpacing
|
||||
highlighted: roomList.currentIndex === roomListItem.index
|
||||
focus: true
|
||||
icon: undefined
|
||||
onClicked: {
|
||||
RoomManager.enterRoom(roomListItem.currentRoom);
|
||||
root.close()
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
RoomManager.enterRoom(roomListItem.currentRoom);
|
||||
root.close();
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
RoomManager.enterRoom(roomListItem.currentRoom);
|
||||
root.close();
|
||||
}
|
||||
bold: roomListItem.unreadCount > 0
|
||||
label: roomListItem.name ?? ""
|
||||
labelItem.textFormat: Text.PlainText
|
||||
subtitle: roomListItem.subtitleText
|
||||
subtitleItem.textFormat: Text.PlainText
|
||||
onPressAndHold: {
|
||||
createRoomListContextMenu()
|
||||
name: currentRoom.displayName
|
||||
|
||||
// When an item is hovered set the currentIndex of listview to it so that it is highlighted
|
||||
onHoveredChanged: {
|
||||
if (!hovered) {
|
||||
return
|
||||
}
|
||||
cView.currentIndex = index
|
||||
}
|
||||
|
||||
leading: Kirigami.Avatar {
|
||||
source: roomListItem.avatar ? "image://mxc/" + roomListItem.avatar : ""
|
||||
name: roomListItem.name || i18n("No Name")
|
||||
implicitWidth: height
|
||||
sourceSize.width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
|
||||
sourceSize.height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
|
||||
actions.main: Kirigami.Action {
|
||||
id: enterRoomAction
|
||||
onTriggered: {
|
||||
RoomManager.enterRoom(currentRoom);
|
||||
|
||||
_popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
source: avatar != "" ? "image://mxc/" + avatar : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
modal: true
|
||||
focus: true
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.kde.kirigami 2.15 as Kirigami
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
DelegateChooser {
|
||||
role: "delegateType"
|
||||
role: "eventType"
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: MessageEventModel.State
|
||||
@@ -20,7 +20,9 @@ DelegateChooser {
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: MessageEventModel.Emote
|
||||
delegate: MessageDelegate {}
|
||||
delegate: MessageDelegate {
|
||||
isEmote: true
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
@@ -73,11 +75,6 @@ DelegateChooser {
|
||||
delegate: PollDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: MessageEventModel.Location
|
||||
delegate: LocationDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: MessageEventModel.Other
|
||||
delegate: Item {}
|
||||
|
||||
@@ -110,18 +110,14 @@ TimelineContainer {
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
QQC2.Label {
|
||||
Layout.fillWidth: true
|
||||
text: model.display
|
||||
wrapMode: Text.Wrap
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
QQC2.Label {
|
||||
id: sizeLabel
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: Controller.formatByteSize(content.info ? content.info.size : 0)
|
||||
opacity: 0.7
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtLocation 5.15
|
||||
import QtPositioning 5.15
|
||||
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
TimelineContainer {
|
||||
id: locationDelegate
|
||||
|
||||
ColumnLayout {
|
||||
Layout.maximumWidth: locationDelegate.contentMaxWidth
|
||||
Layout.preferredWidth: locationDelegate.contentMaxWidth
|
||||
Map {
|
||||
id: map
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: locationDelegate.contentMaxWidth / 16 * 9
|
||||
|
||||
center: QtPositioning.coordinate(model.latitude, model.longitude)
|
||||
zoomLevel: 15
|
||||
plugin: Plugin {
|
||||
name: "osm"
|
||||
PluginParameter {
|
||||
name: "osm.useragent"
|
||||
value: Application.name + "/" + Application.version + " (kde-devel@kde.org)"
|
||||
}
|
||||
PluginParameter {
|
||||
name: "osm.mapping.providersrepository.address"
|
||||
value: "https://autoconfig.kde.org/qtlocation/"
|
||||
}
|
||||
}
|
||||
|
||||
onCopyrightLinkActivated: Qt.openUrlExternally(link)
|
||||
|
||||
|
||||
MapQuickItem {
|
||||
id: point
|
||||
|
||||
anchorPoint.x: sourceItem.width / 2
|
||||
anchorPoint.y: sourceItem.height
|
||||
coordinate: QtPositioning.coordinate(model.latitude, model.longitude)
|
||||
autoFadeIn: false
|
||||
|
||||
sourceItem: Kirigami.Icon {
|
||||
width: height
|
||||
height: Kirigami.Units.iconSizes.huge
|
||||
source: "gps"
|
||||
isMask: true
|
||||
color: Kirigami.Theme.highlightColor
|
||||
|
||||
Kirigami.Icon {
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: -parent.height / 8
|
||||
visible: model.asset === "m.pin"
|
||||
width: height
|
||||
height: parent.height / 3 + 1
|
||||
source: "pin"
|
||||
isMask: true
|
||||
color: Kirigami.Theme.highlightColor
|
||||
}
|
||||
Kirigami.Avatar {
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: -parent.height / 8
|
||||
visible: model.asset === "m.self"
|
||||
width: height
|
||||
height: parent.height / 3 + 1
|
||||
name: model.author.name ?? model.author.displayName
|
||||
source: model.author.avatarMediaId ? ("image://mxc/" + model.author.avatarMediaId) : ""
|
||||
color: model.author.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onLongPressed: openMessageContext(model, "", model.message)
|
||||
}
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onTapped: openMessageContext(model, "", model.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import org.kde.neochat 1.0
|
||||
TimelineContainer {
|
||||
id: messageDelegate
|
||||
|
||||
property bool isEmote: false
|
||||
onOpenContextMenu: openMessageContext(model, label.selectedText, Controller.plainText(label.textDocument))
|
||||
|
||||
innerObject: ColumnLayout {
|
||||
@@ -21,6 +22,7 @@ TimelineContainer {
|
||||
id: label
|
||||
Layout.fillWidth: true
|
||||
visible: currentRoom.chatBoxEditId !== model.eventId
|
||||
isEmote: messageDelegate.isEmote
|
||||
}
|
||||
Loader {
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -119,8 +119,6 @@ QQC2.TextArea {
|
||||
selectionStart: root.selectionStart
|
||||
selectionEnd: root.selectionEnd
|
||||
room: root.room // We don't care about saving for edits so this is OK.
|
||||
mentionColor: Kirigami.Theme.linkColor
|
||||
errorColor: Kirigami.Theme.negativeTextColor
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
|
||||
@@ -96,6 +96,7 @@ Item {
|
||||
RichLabel {
|
||||
textMessage: reply.display
|
||||
textFormat: Text.RichText
|
||||
isReplyLabel: true
|
||||
|
||||
HoverHandler {
|
||||
enabled: !hoveredLink
|
||||
|
||||
@@ -14,6 +14,8 @@ TextEdit {
|
||||
readonly property var isEmoji: /^(<span style='.*'>)?(\u00a9|\u00ae|[\u20D0-\u2fff]|[\u3190-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])+(<\/span>)?$/
|
||||
readonly property var hasSpoiler: /data-mx-spoiler/g
|
||||
|
||||
property bool isEmote: false
|
||||
property bool isReplyLabel: false
|
||||
property string textMessage: model.display
|
||||
property bool spoilerRevealed: !hasSpoiler.test(textMessage)
|
||||
|
||||
@@ -33,9 +35,6 @@ table {
|
||||
border-collapse: collapse;
|
||||
border-style: solid;
|
||||
}
|
||||
code {
|
||||
background-color:" + Kirigami.Theme.alternateBackgroundColor + ";
|
||||
}
|
||||
table th,
|
||||
table td {
|
||||
border: 1px solid black;
|
||||
@@ -58,7 +57,7 @@ a{
|
||||
background: " + Kirigami.Theme.textColor + ";
|
||||
}
|
||||
" : "") + "
|
||||
</style>" + textMessage
|
||||
</style>" + (isEmote ? "* <a href='https://matrix.to/#/" + author.id + "' style='color: " + author.color + "'>" + author.displayName + "</a> " : "") + textMessage + (isEdited && !contentLabel.isReplyLabel ? (" <span style=\"color: " + Kirigami.Theme.disabledTextColor + "\">" + "<span style='font-size: " + Kirigami.Theme.defaultFont.pixelSize +"px'>" + i18n(" (edited)") + "</span>") : "")
|
||||
|
||||
color: Kirigami.Theme.textColor
|
||||
selectedTextColor: Kirigami.Theme.highlightedTextColor
|
||||
|
||||
@@ -42,6 +42,6 @@ QQC2.ItemDelegate {
|
||||
background: Rectangle {
|
||||
color: Config.blur ? "transparent" : Kirigami.Theme.backgroundColor
|
||||
Kirigami.Theme.inherit: false
|
||||
Kirigami.Theme.colorSet: Config.compactLayout ? Kirigami.Theme.View : Kirigami.Theme.Window
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ ColumnLayout {
|
||||
default property alias innerObject : column.children
|
||||
|
||||
property Item hoverComponent: hoverActions ?? null
|
||||
property bool isEmote: false
|
||||
property bool cardBackground: true
|
||||
property bool showUserMessageOnRight: Config.showLocalMessagesOnRight && model.author.isLocalUser && !Config.compactLayout
|
||||
property bool isHighlighted: model.isHighlighted || isTemporaryHighlighted
|
||||
@@ -211,7 +212,7 @@ ColumnLayout {
|
||||
id: rowLayout
|
||||
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
visible: model.showAuthor
|
||||
visible: model.showAuthor && !isEmote
|
||||
|
||||
QQC2.Label {
|
||||
id: nameLabel
|
||||
@@ -305,7 +306,6 @@ ColumnLayout {
|
||||
border.width: 1
|
||||
|
||||
Behavior on color {
|
||||
enabled: isTemporaryHighlighted
|
||||
ColorAnimation {target: bubbleBackground; duration: Kirigami.Units.veryLongDuration; easing.type: Easing.InOutCubic}
|
||||
}
|
||||
}
|
||||
@@ -336,7 +336,7 @@ ColumnLayout {
|
||||
Layout.leftMargin: showUserMessageOnRight ? 0 : bubble.x + bubble.anchors.leftMargin
|
||||
Layout.rightMargin: showUserMessageOnRight ? Kirigami.Units.largeSpacing : 0
|
||||
|
||||
visible: delegateType !== MessageEventModel.State && delegateType !== MessageEventModel.Notice && reaction != undefined && reaction.length > 0
|
||||
visible: eventType !== MessageEventModel.State && eventType !== MessageEventModel.Notice && reaction != undefined && reaction.length > 0
|
||||
}
|
||||
AvatarFlow {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
@@ -76,7 +76,7 @@ QQC2.ToolBar {
|
||||
visible: switchUserButton.checked
|
||||
onVisibleChanged: if (visible) accounts.forceActiveFocus()
|
||||
clip: true
|
||||
model: Accounts
|
||||
model: AccountRegistry
|
||||
|
||||
keyNavigationEnabled: false
|
||||
Keys.onDownPressed: {
|
||||
@@ -144,17 +144,12 @@ QQC2.ToolBar {
|
||||
actions.main: Kirigami.Action {
|
||||
text: i18n("Edit this account")
|
||||
icon.name: "document-edit"
|
||||
onTriggered: pageStack.pushDialogLayer(Qt.resolvedUrl('qrc:/AccountEditorPage.qml'), {
|
||||
onTriggered: pageStack.pushDialogLayer(Qt.resolvedUrl('./AccountEditorPage.qml'), {
|
||||
connection: Controller.activeConnection
|
||||
}, {
|
||||
title: i18n("Account editor")
|
||||
});
|
||||
}
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
acceptedDevices: PointerDevice.Mouse
|
||||
onTapped: accountMenu.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
@@ -219,11 +214,6 @@ QQC2.ToolBar {
|
||||
Item {
|
||||
width: 1
|
||||
}
|
||||
|
||||
AccountMenu {
|
||||
id: accountMenu
|
||||
y: -height
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,8 @@ QQC2.Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
x: parent ? Math.round((parent.width - width) / 2) : 0
|
||||
y: parent ? Math.round((parent.height - height) / 2) : 0
|
||||
x: Math.round((parent.width - width) / 2)
|
||||
y: Math.round((parent.height - height) / 2)
|
||||
modal: true
|
||||
|
||||
footer: QQC2.DialogButtonBox {
|
||||
@@ -35,7 +35,7 @@ QQC2.Dialog {
|
||||
text: i18n("Sign out")
|
||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
|
||||
onClicked: {
|
||||
Controller.activeConnection.logout();
|
||||
Controller.logout(Controller.activeConnection, true);
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
@@ -18,13 +18,13 @@ Kirigami.OverlaySheet {
|
||||
contentItem: Kirigami.FormLayout {
|
||||
QQC2.TextField {
|
||||
id: roomNameField
|
||||
Kirigami.FormData.label: i18n("Room name:")
|
||||
Kirigami.FormData.label: i18n("Room Name")
|
||||
onAccepted: roomTopicField.forceActiveFocus();
|
||||
}
|
||||
|
||||
QQC2.TextField {
|
||||
id: roomTopicField
|
||||
Kirigami.FormData.label: i18n("Room topic:")
|
||||
Kirigami.FormData.label: i18n("Room Topic")
|
||||
onAccepted: okButton.forceActiveFocus();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,12 +40,12 @@ Labs.MenuBar {
|
||||
|
||||
Labs.MenuItem {
|
||||
text: i18nc("menu", "New Private Chat…")
|
||||
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && Controller.activeConnection
|
||||
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && Controller.accountCount > 0
|
||||
onTriggered: pushReplaceLayer("qrc:/StartChatPage.qml", {connection: Controller.activeConnection})
|
||||
}
|
||||
Labs.MenuItem {
|
||||
text: i18nc("menu", "New Group…")
|
||||
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && Controller.activeConnection
|
||||
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && Controller.accountCount > 0
|
||||
shortcut: StandardKey.New
|
||||
onTriggered: {
|
||||
const dialog = createRoomDialog.createObject(root.overlay)
|
||||
|
||||
@@ -6,6 +6,7 @@ import QtQuick.Controls 2.12 as QQC2
|
||||
import org.kde.kirigami 2.19 as Kirigami
|
||||
|
||||
Kirigami.Page {
|
||||
title: i18n("Loading…")
|
||||
Kirigami.LoadingPlaceholder {
|
||||
id: loadingIndicator
|
||||
anchors.centerIn: parent
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.kde.kirigami 2.19 as Kirigami
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
import '../Dialog' as Dialog
|
||||
|
||||
QQC2.Menu {
|
||||
id: root
|
||||
margins: Kirigami.Units.smallSpacing
|
||||
|
||||
QQC2.MenuItem {
|
||||
text: i18n("Edit this account")
|
||||
icon.name: "document-edit"
|
||||
onTriggered: pageStack.pushDialogLayer("qrc:/AccountEditorPage.qml", {
|
||||
connection: Controller.activeConnection
|
||||
}, {
|
||||
title: i18n("Account editor")
|
||||
});
|
||||
}
|
||||
QQC2.MenuItem {
|
||||
text: i18n("Notification settings")
|
||||
icon.name: "notifications"
|
||||
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {defaultPage: "notifications"}, { title: i18n("Configure")})
|
||||
}
|
||||
QQC2.MenuItem {
|
||||
text: i18n("Devices")
|
||||
icon.name: "computer-symbolic"
|
||||
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {defaultPage: "devices"}, { title: i18n("Configure")})
|
||||
}
|
||||
QQC2.MenuItem {
|
||||
text: i18n("Logout")
|
||||
icon.name: "list-remove-user"
|
||||
onTriggered: confirmLogoutDialog.open()
|
||||
}
|
||||
|
||||
Dialog.ConfirmLogout {
|
||||
id: confirmLogoutDialog
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user