Compare commits
107 Commits
work/tobia
...
v25.11.80
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5baf4ab823 | ||
|
|
58a72a08f2 | ||
|
|
c9b97d4d0d | ||
|
|
2a7d61c73b | ||
|
|
f55bd28e10 | ||
|
|
2a67861099 | ||
|
|
273d962707 | ||
|
|
5e8b44fea6 | ||
|
|
be9e2ec7d0 | ||
|
|
ee042cc1a2 | ||
|
|
25c0bc131a | ||
|
|
7def8c066c | ||
|
|
1ddaf37e52 | ||
|
|
40694f502a | ||
|
|
d9f4a0a032 | ||
|
|
5e392f3101 | ||
|
|
ce1ac6128e | ||
|
|
a9d08a6ee2 | ||
|
|
24d4829ba9 | ||
|
|
a121c39b6e | ||
|
|
f009420c20 | ||
|
|
069e0d8f16 | ||
|
|
1f1db11197 | ||
|
|
be92e56c3a | ||
|
|
d1fc426513 | ||
|
|
c778ba8b24 | ||
|
|
07fb3160eb | ||
|
|
7444d68280 | ||
|
|
1d5536401d | ||
|
|
099e996f2f | ||
|
|
6d9974b2b1 | ||
|
|
f65e9f7599 | ||
|
|
4a39810923 | ||
|
|
6720e2dfaa | ||
|
|
eb1bf2ed2b | ||
|
|
cc26b1b62f | ||
|
|
59c2c88eb6 | ||
|
|
99e8fd16eb | ||
|
|
eaa4bdb0b7 | ||
|
|
892b61e6bb | ||
|
|
6d56b673c4 | ||
|
|
f59e5a4b3c | ||
|
|
16e3fd4476 | ||
|
|
82d0fdefd2 | ||
|
|
cbde14d58b | ||
|
|
f3c37e4304 | ||
|
|
369008cec3 | ||
|
|
1a2af57901 | ||
|
|
dbb41d061c | ||
|
|
d1d3c43c6f | ||
|
|
ba2b1529ea | ||
|
|
b5150f82f0 | ||
|
|
00c81de035 | ||
|
|
52d4451932 | ||
|
|
3efc11b9aa | ||
|
|
5fd9f07664 | ||
|
|
bec9f36bce | ||
|
|
a631acc0ac | ||
|
|
b729aaf6ee | ||
|
|
94b7fc5cdf | ||
|
|
ec5355d86e | ||
|
|
1a43d15c6d | ||
|
|
7356a68f4c | ||
|
|
1070427a0d | ||
|
|
196ef535ca | ||
|
|
88fd173829 | ||
|
|
8b0698c670 | ||
|
|
5b07a0ff45 | ||
|
|
ba1d175d67 | ||
|
|
36ce55e892 | ||
|
|
ba4a83d38c | ||
|
|
5c49c35b82 | ||
|
|
2b0251c593 | ||
|
|
3b08d0f382 | ||
|
|
f64e8a3192 | ||
|
|
eab45e761a | ||
|
|
0f03290c57 | ||
|
|
59f87bb2c2 | ||
|
|
9afc10160d | ||
|
|
cfc7f50a1f | ||
|
|
a2fc00365e | ||
|
|
466cfd971d | ||
|
|
8e83febb24 | ||
|
|
12072b0a73 | ||
|
|
83b1daac07 | ||
|
|
981ea053a6 | ||
|
|
e41fd7d986 | ||
|
|
a88a82ca08 | ||
|
|
23dc88df60 | ||
|
|
520b1daeec | ||
|
|
cbe7ace32d | ||
|
|
2b4471ea91 | ||
|
|
88e1e1dd2a | ||
|
|
94ea1305b2 | ||
|
|
960377838d | ||
|
|
a48e8662d6 | ||
|
|
9c90a38efc | ||
|
|
8696a24127 | ||
|
|
f2d1b4c1e1 | ||
|
|
4cdc2b5e58 | ||
|
|
e26f02d9e2 | ||
|
|
5d83fe9a1d | ||
|
|
6a506f237a | ||
|
|
3a5a0153d8 | ||
|
|
27519b8788 | ||
|
|
dd45fe16a5 | ||
|
|
161815acff |
@@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
# KDE Applications version, managed by release script.
|
||||
set(RELEASE_SERVICE_VERSION_MAJOR "25")
|
||||
set(RELEASE_SERVICE_VERSION_MINOR "11")
|
||||
set(RELEASE_SERVICE_VERSION_MICRO "70")
|
||||
set(RELEASE_SERVICE_VERSION_MICRO "80")
|
||||
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
||||
|
||||
project(NeoChat VERSION ${RELEASE_SERVICE_VERSION})
|
||||
@@ -24,7 +24,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(KDE_COMPILERSETTINGS_LEVEL 6.0)
|
||||
set(KDE_COMPILERSETTINGS_LEVEL 6.17)
|
||||
|
||||
include(FeatureSummary)
|
||||
include(ECMSetupVersion)
|
||||
@@ -39,6 +39,7 @@ include(ECMCheckOutboundLicense)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
include(ECMAddAndroidApk)
|
||||
include(ECMQmlModule)
|
||||
include(ECMDeprecationSettings)
|
||||
include(GenerateExportHeader)
|
||||
include(ECMGenerateHeaders)
|
||||
if (NOT ANDROID)
|
||||
@@ -51,6 +52,8 @@ endif()
|
||||
|
||||
set(QUOTIENT_FORCE_NAMESPACED_INCLUDES TRUE)
|
||||
|
||||
ecm_set_disabled_deprecation_versions(Qt 6.9.0 KF 6.17.0)
|
||||
|
||||
ecm_setup_version(${PROJECT_VERSION}
|
||||
VARIABLE_PREFIX NEOCHAT
|
||||
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/neochat-version.h
|
||||
@@ -75,7 +78,7 @@ set_package_properties(KF6Kirigami PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Kirigami application UI framework"
|
||||
)
|
||||
find_package(KF6KirigamiAddons 1.6.0 REQUIRED)
|
||||
find_package(KF6KirigamiAddons 1.10.0 REQUIRED)
|
||||
|
||||
if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT NEOCHAT_FLATPAK AND NOT NEOCHAT_APPIMAGE)
|
||||
find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS Purpose)
|
||||
|
||||
@@ -4,15 +4,12 @@
|
||||
#include "server.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QHttpServer>
|
||||
#include <QHttpServerResponder>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QNetworkReply>
|
||||
#include <QSslCertificate>
|
||||
#include <QSslKey>
|
||||
#include <QSslServer>
|
||||
#include <QUuid>
|
||||
|
||||
#include <Quotient/networkaccessmanager.h>
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<name xml:lang="pl">NeoChat</name>
|
||||
<name xml:lang="pt">NeoChat</name>
|
||||
<name xml:lang="pt-BR">NeoChat</name>
|
||||
<name xml:lang="ro">NeoChat</name>
|
||||
<name xml:lang="ru">NeoChat</name>
|
||||
<name xml:lang="sa">नवचैट्</name>
|
||||
<name xml:lang="sk">NeoChat</name>
|
||||
@@ -75,6 +76,7 @@
|
||||
<summary xml:lang="nn">Prat med via Matrix</summary>
|
||||
<summary xml:lang="pl">Rozmawiaj na Matriksie</summary>
|
||||
<summary xml:lang="pt-BR">Bate-papo na Matrix</summary>
|
||||
<summary xml:lang="ro">Discutați pe Matrix</summary>
|
||||
<summary xml:lang="ru">Общение в Matrix</summary>
|
||||
<summary xml:lang="sa">Matrix इत्यत्र गपशपं कुर्वन्तु</summary>
|
||||
<summary xml:lang="sl">Klepet na Matrixu</summary>
|
||||
@@ -109,6 +111,7 @@
|
||||
<p xml:lang="nn">NeoChat er ein prateapp som lèt deg bruka all funksjonalitet i Matrix-nettverket. Du kan utveksla tekst, lyd og videoar med vennar, familie og kollegaar på ein trygg måte.</p>
|
||||
<p xml:lang="pl">NoeChat to aplikacja do rozmów, która umożliwia wykorzystanie wszystkich możliwości Matriksa. Umożliwia wysyłanie wiadomości tekstowych, filmów i dźwięków w bezpieczny sposób do twojej rodziny, kolegów i przyjaciół.</p>
|
||||
<p xml:lang="pt-BR">O NeoChat é um aplicativo de bate-papo que permite que você aproveite ao máximo a rede Matrix. Ele oferece uma maneira segura de enviar mensagens de texto, vídeos e arquivos de áudio para sua família, colegas e amigos.</p>
|
||||
<p xml:lang="ro">NeoChat e o aplicație de discuții ce vă ajută să profitați din plin de rețeaua Matrix. Aceasta oferă o modalitate sigură de a trimite mesaje textuale, videoclipuri și fișiere audio familiei, colegilor și prietenilor.</p>
|
||||
<p xml:lang="ru">NeoChat — приложение для общения, предоставляющее все преимущества сети Matrix. С его помощью можно безопасно отправлять текстовые сообщения, видеозаписи и звуковые файлы родственникам, коллегам и друзьям.</p>
|
||||
<p xml:lang="sa">NeoChat इति एकं गपशप-अनुप्रयोगं यत् भवान् Matrix-जालस्य पूर्णं लाभं ग्रहीतुं शक्नोति । एतत् भवन्तं भवतः परिवाराय, सहकारिभ्यः, मित्रेभ्यः च पाठसन्देशान्, भिडियो, श्रव्यसञ्चिकाः च प्रेषयितुं सुरक्षितं मार्गं प्रदाति ।</p>
|
||||
<p xml:lang="sl">NeoChat je aplikacija za klepet, ki vam omogoča, da v celoti izkoristite omrežje Matrix. Zagotavlja vam varen način za pošiljanje besedilnih sporočil, videoposnetkov in zvočnih datotek vaši družini, sodelavcem in prijateljem.</p>
|
||||
@@ -142,6 +145,7 @@
|
||||
<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="pt">O NeoChat pretende ser uma aplicação completa para a especificação do Matrix. Como tal, tudo o que existe na especificação estável actual, com as notáveis excepções do VoIP, tópicos e alguns aspectos da Encriptação Ponto-a-Ponto, são suportados. Existem mais algumas omissões, devido ao facto que a norma do Matrix está em constante evolução, mas o objectivo continua a ser oferecer o suporte eventual para a norma por inteiro.</p>
|
||||
<p xml:lang="pt-BR">O NeoChat pretende ser um aplicativo completo para a especificação Matrix. Dessa forma, tudo na especificação estável atual, com as notáveis exceções de VoIP, tópicos e alguns aspectos da criptografia de ponta a ponta, é suportado. Há algumas outras pequenas omissões devido ao fato de a especificação Matrix estar em constante evolução, mas o objetivo continua sendo fornecer suporte eventual para toda a especificação.</p>
|
||||
<p xml:lang="ro">NeoChat vrea să fie o aplicație completă pentru specificațiile Matrix. Astfel, susține tot ce se găsește acum în specificațiile stabile cu excepția VoIP, a firelor de discuții, și a unor părți din criptarea punct-la-punct. Sunt și câteva omisiuni minore din cauza faptului că specificația Matrix evoluează continuu, dar scopul rămâne acela de a implementa întreaga specificație.</p>
|
||||
<p xml:lang="ru">Целью создания NeoChat является полноценная реализация программы для спецификации Matrix. Как следствие, реализовано всё в текущей стабильной спецификации (за исключением голосовой интернет-связи, потоков и некоторых аспектов сквозного шифрования). Есть также несколько других незначительных пробелов, обусловленных постоянными изменениями спецификации Matrix. Тем не менее, стоит задача в итоге предоставить полную поддержку спецификации.</p>
|
||||
<p xml:lang="sa">NeoChat इत्यस्य उद्देश्यं Matrix विनिर्देशस्य कृते पूर्णतया विशेषतायुक्तः अनुप्रयोगः भवितुम् अस्ति । यथा तथा वर्तमानस्थिरविनिर्देशे सर्वं VoIP इत्यस्य उल्लेखनीयअपवादैः सह, थ्रेड्स तथा च End-to-End Encryption इत्यस्य केचन पक्षाः समर्थिताः सन्ति । अन्ये कतिचन लघु लोपाः सन्ति यतोहि Matrix spec निरन्तरं विकसितः अस्ति परन्तु उद्देश्यं सम्पूर्ण spec कृते अन्ततः समर्थनं प्रदातुं अवशिष्टम् अस्ति</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>
|
||||
@@ -175,6 +179,7 @@
|
||||
<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="pt">Devido à natureza do desenvolvimento da especificação do Matrix, o NeoChat também suporta diversas funcionalidades instáveis. De momento são:</p>
|
||||
<p xml:lang="pt-BR">Devido à natureza do desenvolvimento da especificação Matrix, o NeoChat também suporta diversos recursos instáveis. Atualmente, são eles:</p>
|
||||
<p xml:lang="ro">Datorită modului de dezvoltare a specificațiilor Matrix, NeoChat susține și numeroase caracteristici nestabile. Acum, acestea sunt:</p>
|
||||
<p xml:lang="ru">В силу природы разработки спецификации Matrix в NeoChat тоже предусмотрена поддержка многочисленных нестабильных возможностей. В текущей версии это следующие возможности:</p>
|
||||
<p xml:lang="sa">Matrix विनिर्देशविकासस्य प्रकृतेः कारणात् NeoChat अपि अनेकानाम् अस्थिरविशेषतानां समर्थनं करोति । सम्प्रति एते सन्ति :</p>
|
||||
<p xml:lang="sl">Zaradi narave razvoja specifikacije Matrixa NeoChat podpira tudi številne nestabilne zmožnosti. Trenutno so to:</p>
|
||||
@@ -209,6 +214,7 @@
|
||||
<li xml:lang="pl">Ankiety - MSC3381</li>
|
||||
<li xml:lang="pt">Inquéritos - MSC3381</li>
|
||||
<li xml:lang="pt-BR">Enquetes - MSC3381</li>
|
||||
<li xml:lang="ro">Sondaje - MSC3381</li>
|
||||
<li xml:lang="ru">Голосования — MSC3381</li>
|
||||
<li xml:lang="sa">मतदान - MSC3381</li>
|
||||
<li xml:lang="sl">Polls - MSC3381</li>
|
||||
@@ -242,6 +248,7 @@
|
||||
<li xml:lang="pl">Paczki naklejek - MSC2545</li>
|
||||
<li xml:lang="pt">Pacotes de Autocolantes - MSC2545</li>
|
||||
<li xml:lang="pt-BR">Pacotes de Stickers - MSC2545</li>
|
||||
<li xml:lang="ro">Colecții de abțibilduri - MSC2545</li>
|
||||
<li xml:lang="ru">Наборы стикеров — MSC2545</li>
|
||||
<li xml:lang="sa">स्टिकर पैक - MSC2545</li>
|
||||
<li xml:lang="sl">Sticker Packs - MSC2545</li>
|
||||
@@ -275,6 +282,7 @@
|
||||
<li xml:lang="pl">Wydarzenia w miejscach - MSC3488</li>
|
||||
<li xml:lang="pt">Eventos com Localizações - MSC3488</li>
|
||||
<li xml:lang="pt-BR">Localização de eventos - MSC3488</li>
|
||||
<li xml:lang="ro">Evenimente de amplasare - MSC3488</li>
|
||||
<li xml:lang="ru">События местоположения — MSC3488</li>
|
||||
<li xml:lang="sa">स्थान घटनाएँ - MSC3488</li>
|
||||
<li xml:lang="sl">Location Events - MSC3488</li>
|
||||
@@ -312,7 +320,7 @@
|
||||
<value key="KDE::windows_store::StoreLogoSquare">https://invent.kde.org/network/neochat/-/raw/master/icons/windows/storelogo-1080x1080.png</value>
|
||||
<value key="KDE::windows_store::Icon">https://invent.kde.org/network/neochat/-/raw/master/icons/300-apps-neochat.png</value>
|
||||
<value key="KDE::windows_store::PromotionalArt16x9">https://invent.kde.org/network/neochat/-/raw/master/icons/windows/promoimage-1920x1080.png</value>
|
||||
<value key="KDE::supporters">Tanguy Fardet;[dabe](https://freeradical.zone/@dabe);[lengau](https://mastodon.world/@lengau);Joshua Strobl;Stuart Turton</value>
|
||||
<value key="KDE::supporters">Anonymous donor, Akseli</value>
|
||||
</custom>
|
||||
<launchable type="desktop-id">org.kde.neochat.desktop</launchable>
|
||||
<screenshots>
|
||||
@@ -344,6 +352,7 @@
|
||||
<caption xml:lang="pl">Główny widok z wykazem pokojów, rozmowami i szczegółami pokojów</caption>
|
||||
<caption xml:lang="pt">A área principal com a lista de salas e com informações sobre a conversa e a sala</caption>
|
||||
<caption xml:lang="pt-BR">Visão principal com lista de salas, bate-papo e informações sobre as salas</caption>
|
||||
<caption xml:lang="ro">Vederea principală cu lista de camere, discuție, și informații despre cameră</caption>
|
||||
<caption xml:lang="ru">Главное окно со списком комнат, чатом и информацией о комнате</caption>
|
||||
<caption xml:lang="sa">कक्षसूची, गपशपः, कक्षसूचना च सह मुख्यदृश्यम्</caption>
|
||||
<caption xml:lang="sl">Glavni pogled s seznamom sob, klepetom in informacijami o sobah</caption>
|
||||
@@ -380,6 +389,7 @@
|
||||
<caption xml:lang="nn">Oppdag nye fellesskap med Matrix Spaces</caption>
|
||||
<caption xml:lang="pl">Odkrywaj nowe społeczności w Przestrzeniach Matriksa</caption>
|
||||
<caption xml:lang="pt-BR">Descubra novas comunidades com os Espaços Matrix</caption>
|
||||
<caption xml:lang="ro">Descoperiți comunități noi cu Spații Matrix</caption>
|
||||
<caption xml:lang="ru">Поиск новых сообществ с помощью Matrix Spaces</caption>
|
||||
<caption xml:lang="sa">Matrix Spaces इत्यनेन सह नूतनानां समुदायानाम् अन्वेषणं कुर्वन्तु</caption>
|
||||
<caption xml:lang="sl">Odkrijte nove skupnosti z Matrix Spaces</caption>
|
||||
@@ -424,6 +434,7 @@
|
||||
<caption xml:lang="pl">Główny widok z wykazem pokojów, rozmowami i szczegółami pokojów</caption>
|
||||
<caption xml:lang="pt">A área principal com a lista de salas e com informações sobre a conversa e a sala</caption>
|
||||
<caption xml:lang="pt-BR">Visão principal com lista de salas, bate-papo e informações sobre as salas</caption>
|
||||
<caption xml:lang="ro">Vederea principală cu lista de camere, discuție, și informații despre cameră</caption>
|
||||
<caption xml:lang="ru">Главное окно со списком комнат, чатом и информацией о комнате</caption>
|
||||
<caption xml:lang="sa">कक्षसूची, गपशपः, कक्षसूचना च सह मुख्यदृश्यम्</caption>
|
||||
<caption xml:lang="sl">Glavni pogled s seznamom sob, klepetom in informacijami o sobah</caption>
|
||||
@@ -462,6 +473,7 @@
|
||||
<caption xml:lang="pl">Ekran logowania</caption>
|
||||
<caption xml:lang="pt">Ecrã de autenticação</caption>
|
||||
<caption xml:lang="pt-BR">Tela de login</caption>
|
||||
<caption xml:lang="ro">Ecran de autentificare</caption>
|
||||
<caption xml:lang="ru">Окно входа</caption>
|
||||
<caption xml:lang="sa">लॉगिन् स्क्रीन</caption>
|
||||
<caption xml:lang="sl">Prijavni zaslon</caption>
|
||||
@@ -476,6 +488,8 @@
|
||||
<content_attribute id="social-chat">intense</content_attribute>
|
||||
</content_rating>
|
||||
<releases>
|
||||
<release version="25.08.3" date="2025-11-06"/>
|
||||
<release version="25.08.2" date="2025-10-09"/>
|
||||
<release version="25.08.1" date="2025-09-11"/>
|
||||
<release version="25.08.0" date="2025-08-14"/>
|
||||
<release version="25.04.3" date="2025-07-03"/>
|
||||
|
||||
@@ -112,6 +112,7 @@ Comment[lv]=Tērzējiet „Matrix“ tīklā
|
||||
Comment[nl]=Chat op Matrix
|
||||
Comment[pl]=Rozmawiaj na Matriksie
|
||||
Comment[pt_BR]=Bate papo na Matrix
|
||||
Comment[ro]=Discutați pe Matrix
|
||||
Comment[ru]=Общение в Matrix
|
||||
Comment[sa]=Matrix इत्यत्र गपशपं कुर्वन्तु
|
||||
Comment[sl]=Klepet na Matrixu
|
||||
|
||||
1373
po/ar/neochat.po
1373
po/ar/neochat.po
File diff suppressed because it is too large
Load Diff
1169
po/ast/neochat.po
1169
po/ast/neochat.po
File diff suppressed because it is too large
Load Diff
1333
po/az/neochat.po
1333
po/az/neochat.po
File diff suppressed because it is too large
Load Diff
1283
po/ca/neochat.po
1283
po/ca/neochat.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1250
po/cs/neochat.po
1250
po/cs/neochat.po
File diff suppressed because it is too large
Load Diff
1278
po/da/neochat.po
1278
po/da/neochat.po
File diff suppressed because it is too large
Load Diff
1411
po/de/neochat.po
1411
po/de/neochat.po
File diff suppressed because it is too large
Load Diff
1375
po/el/neochat.po
1375
po/el/neochat.po
File diff suppressed because it is too large
Load Diff
1400
po/en_GB/neochat.po
1400
po/en_GB/neochat.po
File diff suppressed because it is too large
Load Diff
1391
po/eo/neochat.po
1391
po/eo/neochat.po
File diff suppressed because it is too large
Load Diff
1210
po/es/neochat.po
1210
po/es/neochat.po
File diff suppressed because it is too large
Load Diff
1398
po/eu/neochat.po
1398
po/eu/neochat.po
File diff suppressed because it is too large
Load Diff
1874
po/fi/neochat.po
1874
po/fi/neochat.po
File diff suppressed because it is too large
Load Diff
1340
po/fr/neochat.po
1340
po/fr/neochat.po
File diff suppressed because it is too large
Load Diff
1404
po/gl/neochat.po
1404
po/gl/neochat.po
File diff suppressed because it is too large
Load Diff
1315
po/he/neochat.po
1315
po/he/neochat.po
File diff suppressed because it is too large
Load Diff
1383
po/hi/neochat.po
1383
po/hi/neochat.po
File diff suppressed because it is too large
Load Diff
1704
po/hu/neochat.po
1704
po/hu/neochat.po
File diff suppressed because it is too large
Load Diff
1420
po/ia/neochat.po
1420
po/ia/neochat.po
File diff suppressed because it is too large
Load Diff
1374
po/id/neochat.po
1374
po/id/neochat.po
File diff suppressed because it is too large
Load Diff
1313
po/ie/neochat.po
1313
po/ie/neochat.po
File diff suppressed because it is too large
Load Diff
1332
po/it/neochat.po
1332
po/it/neochat.po
File diff suppressed because it is too large
Load Diff
1160
po/ja/neochat.po
1160
po/ja/neochat.po
File diff suppressed because it is too large
Load Diff
1304
po/ka/neochat.po
1304
po/ka/neochat.po
File diff suppressed because it is too large
Load Diff
1871
po/ko/neochat.po
1871
po/ko/neochat.po
File diff suppressed because it is too large
Load Diff
2050
po/lt/neochat.po
2050
po/lt/neochat.po
File diff suppressed because it is too large
Load Diff
1711
po/lv/neochat.po
1711
po/lv/neochat.po
File diff suppressed because it is too large
Load Diff
1309
po/nl/neochat.po
1309
po/nl/neochat.po
File diff suppressed because it is too large
Load Diff
1257
po/nn/neochat.po
1257
po/nn/neochat.po
File diff suppressed because it is too large
Load Diff
1330
po/pa/neochat.po
1330
po/pa/neochat.po
File diff suppressed because it is too large
Load Diff
1421
po/pl/neochat.po
1421
po/pl/neochat.po
File diff suppressed because it is too large
Load Diff
1363
po/pt/neochat.po
1363
po/pt/neochat.po
File diff suppressed because it is too large
Load Diff
1358
po/pt_BR/neochat.po
1358
po/pt_BR/neochat.po
File diff suppressed because it is too large
Load Diff
7049
po/ro/neochat.po
Normal file
7049
po/ro/neochat.po
Normal file
File diff suppressed because it is too large
Load Diff
1412
po/ru/neochat.po
1412
po/ru/neochat.po
File diff suppressed because it is too large
Load Diff
1383
po/sa/neochat.po
1383
po/sa/neochat.po
File diff suppressed because it is too large
Load Diff
1357
po/sk/neochat.po
1357
po/sk/neochat.po
File diff suppressed because it is too large
Load Diff
1299
po/sl/neochat.po
1299
po/sl/neochat.po
File diff suppressed because it is too large
Load Diff
1377
po/sv/neochat.po
1377
po/sv/neochat.po
File diff suppressed because it is too large
Load Diff
1641
po/ta/neochat.po
1641
po/ta/neochat.po
File diff suppressed because it is too large
Load Diff
1288
po/tok/neochat.po
1288
po/tok/neochat.po
File diff suppressed because it is too large
Load Diff
1299
po/tr/neochat.po
1299
po/tr/neochat.po
File diff suppressed because it is too large
Load Diff
1325
po/uk/neochat.po
1325
po/uk/neochat.po
File diff suppressed because it is too large
Load Diff
1406
po/zh_CN/neochat.po
1406
po/zh_CN/neochat.po
File diff suppressed because it is too large
Load Diff
1840
po/zh_TW/neochat.po
1840
po/zh_TW/neochat.po
File diff suppressed because it is too large
Load Diff
@@ -103,6 +103,7 @@ ecm_add_qml_module(neochat URI org.kde.neochat GENERATE_PLUGIN_SOURCE
|
||||
qml/ReasonDialog.qml
|
||||
qml/NewPollDialog.qml
|
||||
qml/UserMenu.qml
|
||||
qml/MeetingDialog.qml
|
||||
DEPENDENCIES
|
||||
QtCore
|
||||
QtQuick
|
||||
@@ -204,6 +205,8 @@ target_link_libraries(neochat PUBLIC
|
||||
KF6::SonnetCore
|
||||
KF6::IconThemes
|
||||
KF6::ItemModels
|
||||
KF6::I18nQml
|
||||
KirigamiApp
|
||||
QuotientQt6
|
||||
Login
|
||||
Rooms
|
||||
@@ -325,6 +328,7 @@ if(ANDROID)
|
||||
"kt-restore-defaults-symbolic"
|
||||
"user-symbolic"
|
||||
"mark-location-symbolic"
|
||||
"amarok_playcount"
|
||||
|
||||
${KIRIGAMI_ADDONS_ICONS}
|
||||
)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <Quotient/qt_connection_util.h>
|
||||
#include <Quotient/settings.h>
|
||||
|
||||
#include "accountmanager.h"
|
||||
#include "enums/roomsortparameter.h"
|
||||
#include "general_logging.h"
|
||||
#include "mediasizehelper.h"
|
||||
@@ -26,9 +25,7 @@
|
||||
#include "models/roomlistmodel.h"
|
||||
#include "models/roomtreemodel.h"
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatconnection.h"
|
||||
#include "neochatroom.h"
|
||||
#include "notificationsmanager.h"
|
||||
#include "proxycontroller.h"
|
||||
#include "roommanager.h"
|
||||
|
||||
@@ -309,8 +306,7 @@ void Controller::listenForNotifications()
|
||||
connect(timer, &QTimer::timeout, qGuiApp, &QGuiApplication::quit);
|
||||
|
||||
connect(connector, &KUnifiedPush::Connector::messageReceived, [timer](const QByteArray &data) {
|
||||
instance().m_notificationsManager.postPushNotification(data);
|
||||
timer->stop();
|
||||
NotificationsManager::postPushNotification(data);
|
||||
});
|
||||
|
||||
// Wait five seconds to see if we received any messages or this happened to be an erroneous activation.
|
||||
|
||||
@@ -33,13 +33,10 @@
|
||||
#include <KWindowSystem>
|
||||
#endif
|
||||
|
||||
#if __has_include("KCrash")
|
||||
#include <KCrash>
|
||||
#endif
|
||||
|
||||
#include <KIconTheme>
|
||||
#include <KLocalizedContext>
|
||||
#include <KLocalizedQmlContext>
|
||||
#include <KLocalizedString>
|
||||
#include <KirigamiApp>
|
||||
|
||||
#include "neochat-version.h"
|
||||
|
||||
@@ -104,7 +101,6 @@ Q_DECL_EXPORT
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KIconTheme::initTheme();
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
|
||||
#ifdef HAVE_WEBVIEW
|
||||
@@ -113,24 +109,10 @@ int main(int argc, char *argv[])
|
||||
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
QGuiApplication app(argc, argv);
|
||||
QQuickStyle::setStyle(u"org.kde.breeze"_s);
|
||||
#else
|
||||
QIcon::setFallbackThemeName("breeze"_L1);
|
||||
QApplication app(argc, argv);
|
||||
// Default to org.kde.desktop style unless the user forces another style
|
||||
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
|
||||
QQuickStyle::setStyle(u"org.kde.desktop"_s);
|
||||
}
|
||||
#endif
|
||||
KirigamiApp::App app(argc, argv);
|
||||
KirigamiApp kirigamiApp;
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
}
|
||||
|
||||
QApplication::setStyle(u"breeze"_s);
|
||||
QFont font(u"Segoe UI Emoji"_s);
|
||||
font.setPointSize(10);
|
||||
@@ -177,10 +159,6 @@ int main(int argc, char *argv[])
|
||||
KAboutData::setApplicationData(about);
|
||||
QGuiApplication::setWindowIcon(QIcon::fromTheme(u"org.kde.neochat"_s));
|
||||
|
||||
#if __has_include("KCrash")
|
||||
KCrash::initialize();
|
||||
#endif
|
||||
|
||||
Connection::setEncryptionDefault(true);
|
||||
Connection::setDirectChatEncryptionDefault(true);
|
||||
|
||||
@@ -205,7 +183,7 @@ int main(int argc, char *argv[])
|
||||
parser.addOption(testOption);
|
||||
|
||||
#ifdef HAVE_KUNIFIEDPUSH
|
||||
QCommandLineOption dbusActivatedOption(u"dbus-activated"_s, i18n("Internal usage only."));
|
||||
QCommandLineOption dbusActivatedOption(u"dbus-activated"_s);
|
||||
dbusActivatedOption.setFlags(QCommandLineOption::Flag::HiddenFromHelp);
|
||||
parser.addOption(dbusActivatedOption);
|
||||
#endif
|
||||
@@ -219,8 +197,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
#ifdef HAVE_KUNIFIEDPUSH
|
||||
if (parser.isSet(dbusActivatedOption)) {
|
||||
// We want to be replaceable by the main client
|
||||
KDBusService service(KDBusService::Replace);
|
||||
#ifdef HAVE_KDBUSADDONS
|
||||
// We *don't* want to use KDBusService here. I don't know why, but it makes activation super unreliable. We don't really need it anyway.
|
||||
if (!QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.neochat"))) {
|
||||
// Gracefully fail if NeoChat is already running
|
||||
qWarning() << "NeoChat already running, not sending push notifications.";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RUNNER
|
||||
// If we are built with KRunner and KUnifiedPush support, we need to do something special.
|
||||
@@ -279,7 +263,7 @@ int main(int argc, char *argv[])
|
||||
});
|
||||
#endif
|
||||
|
||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||
KLocalization::setupLocalizedContext(&engine);
|
||||
engine.setNetworkAccessManagerFactory(new NetworkAccessManagerFactory());
|
||||
|
||||
if (parser.isSet("ignore-ssl-errors"_L1)) {
|
||||
@@ -294,7 +278,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
engine.addImageProvider(u"blurhash"_s, new BlurhashImageProvider);
|
||||
|
||||
engine.loadFromModule("org.kde.neochat", "Main");
|
||||
if (!kirigamiApp.start("org.kde.neochat", "Main", &engine)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!parser.positionalArguments().isEmpty() && !parser.isSet("share"_L1)) {
|
||||
RoomManager::instance().setUrlArgument(parser.positionalArguments()[0]);
|
||||
|
||||
@@ -211,6 +211,7 @@ Name[pa]=ਨਵਾਂ ਸੱਦਾ
|
||||
Name[pl]=Nowe zaproszenie
|
||||
Name[pt]=Novo Convite
|
||||
Name[pt_BR]=Novo convite
|
||||
Name[ro]=Invitație nouă
|
||||
Name[ru]=Новое приглашение
|
||||
Name[sa]=नवीन आमन्त्रणम्
|
||||
Name[sl]=Novo povabilo
|
||||
@@ -252,6 +253,7 @@ Comment[pa]=ਰੂਮ ਲਈ ਨਵਾਂ ਸੱਦਾ ਹੈ
|
||||
Comment[pl]=Dostępna jest nowe zaproszenie do pokoju
|
||||
Comment[pt]=Existe um novo convite para uma sala
|
||||
Comment[pt_BR]=Existe um novo convite para uma sala
|
||||
Comment[ro]=E o nouă invitație la o cameră
|
||||
Comment[ru]=Доступно новое приглашение в комнату
|
||||
Comment[sa]=कक्षस्य नूतनं निमन्त्रणम् अस्ति
|
||||
Comment[sl]=Tam je novo povabilo v sobo
|
||||
@@ -290,6 +292,7 @@ Name[nl]=Gedeelde
|
||||
Name[nn]=Del
|
||||
Name[pl]=Udostępnij
|
||||
Name[pt_BR]=Compartilhar
|
||||
Name[ro]=Partajare
|
||||
Name[ru]=Публикация
|
||||
Name[sa]=संविभागः
|
||||
Name[sl]=Deli
|
||||
@@ -324,6 +327,7 @@ Comment[nl]=Het resultaat van het delen van een stukje inhoud
|
||||
Comment[nn]=Resultatet av deling av innhald
|
||||
Comment[pl]=Wynik udostępniania kawałka treści
|
||||
Comment[pt_BR]=O resultado de compartilhar um conteúdo
|
||||
Comment[ro]=Rezultatul partajării unei bucăți de conținut
|
||||
Comment[ru]=Результат публикации данных
|
||||
Comment[sa]=सामग्रीखण्डस्य साझाकरणस्य परिणामः
|
||||
Comment[sl]=Rezultat deljenega kosa vsebine
|
||||
|
||||
@@ -66,6 +66,10 @@
|
||||
</entry>
|
||||
</group>
|
||||
<group name="Timeline">
|
||||
<entry name="FontScale" type="double">
|
||||
<label>Scaling factor for font sizes</label>
|
||||
<default>1.0</default>
|
||||
</entry>
|
||||
<entry name="ShowAvatarInTimeline" type="bool">
|
||||
<label>Show avatar in the timeline</label>
|
||||
<default>true</default>
|
||||
|
||||
@@ -388,7 +388,7 @@ void NotificationsManager::postPushNotification(const QByteArray &message)
|
||||
|
||||
#ifdef HAVE_KIO
|
||||
auto openAction = notification->addAction(i18n("Open NeoChat"));
|
||||
connect(openAction, &KNotificationAction::activated, this, [=]() {
|
||||
connect(openAction, &KNotificationAction::activated, notification, [=]() {
|
||||
QString properId = roomId;
|
||||
properId = properId.replace(u"#"_s, QString());
|
||||
properId = properId.replace(u"!"_s, QString());
|
||||
@@ -402,8 +402,6 @@ void NotificationsManager::postPushNotification(const QByteArray &message)
|
||||
connect(notification, &KNotification::closed, qGuiApp, &QGuiApplication::quit);
|
||||
|
||||
notification->sendEvent();
|
||||
|
||||
m_notifications.insert(roomId, {json["ts"_L1].toVariant().toLongLong(), notification});
|
||||
} else {
|
||||
qWarning() << "Skipping unsupported push notification" << type;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
/**
|
||||
* @brief Display a native notification for the given push notification.
|
||||
*/
|
||||
void postPushNotification(const QByteArray &message);
|
||||
static void postPushNotification(const QByteArray &message);
|
||||
|
||||
/**
|
||||
* @brief Handle the notifications for the given connection.
|
||||
|
||||
@@ -75,6 +75,7 @@ Comment[nn]=Finn rom i NeoChat
|
||||
Comment[pl]=Znajdź pokoje w NeoChat
|
||||
Comment[pt]=Procurar salas no NeoChat
|
||||
Comment[pt_BR]=Encontrar salas no NeoChat
|
||||
Comment[ro]=Găsește camere în NeoChat
|
||||
Comment[ru]=Поиск комнат NeoChat
|
||||
Comment[sa]=NeoChat इत्यत्र कक्ष्याः अन्वेषणं कुर्वन्तु
|
||||
Comment[sl]=Najdi sobe v NeoChatu
|
||||
|
||||
@@ -91,6 +91,7 @@ Components.AbstractMaximizeComponent {
|
||||
color: Kirigami.Theme.textColor
|
||||
|
||||
font.family: "monospace"
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
|
||||
|
||||
Kirigami.SpellCheck.enabled: false
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ Labs.MenuBar {
|
||||
|
||||
Labs.MenuItem {
|
||||
icon.name: "list-add-user"
|
||||
text: i18nc("@action:inmenu", "Find your Friends")
|
||||
text: i18nc("@action:inmenu", "Find User")
|
||||
enabled: root.connection
|
||||
onTriggered: root.appWindow.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), {
|
||||
connection: root.connection
|
||||
}, {
|
||||
title: i18nc("@title", "Find your friends")
|
||||
title: i18nc("@title", "Find User")
|
||||
})
|
||||
}
|
||||
Labs.MenuItem {
|
||||
|
||||
@@ -100,7 +100,8 @@ Kirigami.ApplicationWindow {
|
||||
|
||||
function onCurrentRoomChanged() {
|
||||
if (RoomManager.currentRoom && root.pageStack.depth <= 1 && root.initialized && Kirigami.Settings.isMobile) {
|
||||
let roomPage = root.pageStack.layers.push(Qt.createComponent('org.kde.neochat', 'RoomPage'));
|
||||
let roomPage = pageStack.push(Qt.createComponent('org.kde.neochat', 'RoomPage'));
|
||||
roomPage.forceActiveFocus();
|
||||
roomPage.backRequested.connect(event => {
|
||||
RoomManager.clearCurrentRoom();
|
||||
});
|
||||
|
||||
22
src/app/qml/MeetingDialog.qml
Normal file
22
src/app/qml/MeetingDialog.qml
Normal file
@@ -0,0 +1,22 @@
|
||||
// SPDX-FileCopyrightText: 2025 Joshua Goins <josh@redstrate.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
import QtQuick
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
Kirigami.PromptDialog {
|
||||
id: root
|
||||
|
||||
required property bool hasExistingMeeting
|
||||
|
||||
title: hasExistingMeeting ? i18nc("@title", "Join Meeting") : i18nc("@title", "Start Meeting")
|
||||
subtitle: hasExistingMeeting ? i18nc("@info:label", "You are about to join a Jitsi meeting in your web browser.") : i18nc("@info:label", "You are about to start a new Jitsi meeting in your web browser.")
|
||||
standardButtons: Kirigami.Dialog.Cancel
|
||||
|
||||
customFooterActions: Kirigami.Action {
|
||||
icon.name: "camera-video-symbolic"
|
||||
text: hasExistingMeeting ? i18nc("@action:button Join the Jitsi meeting", "Join") : i18nc("@action:button Start a new Jitsi meeting", "Start")
|
||||
onTriggered: root.accept()
|
||||
}
|
||||
}
|
||||
@@ -59,11 +59,59 @@ Kirigami.Page {
|
||||
*/
|
||||
property MediaMessageFilterModel mediaMessageFilterModel: RoomManager.mediaMessageFilterModel
|
||||
|
||||
/**
|
||||
* @brief The WidgetModel to use.
|
||||
*
|
||||
* This model has the list of widgets available in the current room.
|
||||
*
|
||||
* @note For loading a room in a different window, override this with a new
|
||||
* WidgetModel.
|
||||
*
|
||||
* @sa WidgetModel
|
||||
*/
|
||||
property WidgetModel widgetModel: RoomManager.widgetModel
|
||||
|
||||
title: root.currentRoom ? root.currentRoom.displayName : ""
|
||||
focus: true
|
||||
padding: 0
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
id: jitsiMeetingAction
|
||||
|
||||
readonly property bool hasExistingMeeting: root.widgetModel.jitsiIndex >= 0
|
||||
readonly property bool canStartNewMeeting: root.currentRoom.canSendState("im.vector.modular.widgets")
|
||||
|
||||
tooltip: {
|
||||
if (hasExistingMeeting) {
|
||||
return i18nc("@action:button", "Join Jitsi meeting…");
|
||||
}
|
||||
|
||||
return canStartNewMeeting ? i18nc("@action:button", "Start Jitsi meeting…") : i18nc("@action:button", "You do not have permissions to start Jitsi meetings")
|
||||
}
|
||||
icon {
|
||||
name: "camera-video-symbolic"
|
||||
color: hasExistingMeeting ? Kirigami.Theme.highlightColor : "transparent"
|
||||
}
|
||||
enabled: hasExistingMeeting || canStartNewMeeting
|
||||
visible: root.currentRoom && !root.currentRoom.isSpace
|
||||
onTriggered: {
|
||||
const dialog = Qt.createComponent("org.kde.neochat", "MeetingDialog").createObject(QQC2.Overlay.overlay, { hasExistingMeeting });
|
||||
dialog.onAccepted.connect(doAction);
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
function doAction(): void {
|
||||
let url;
|
||||
if (!hasExistingMeeting) {
|
||||
url = root.widgetModel.addJitsiConference();
|
||||
} else {
|
||||
let idx = root.widgetModel.index(root.widgetModel.jitsiIndex, 0);
|
||||
url = root.widgetModel.data(idx, WidgetModel.UrlRole);
|
||||
}
|
||||
Qt.openUrlExternally(url);
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
visible: Kirigami.Settings.isMobile || !(root.Kirigami.PageStack.pageStack as Kirigami.PageRow).wideMode
|
||||
icon.name: "view-right-new"
|
||||
@@ -71,6 +119,18 @@ Kirigami.Page {
|
||||
}
|
||||
]
|
||||
|
||||
Kirigami.Action {
|
||||
enabled: root.currentRoom && !root.currentRoom.isSpace
|
||||
shortcut: "Ctrl+F"
|
||||
onTriggered: {
|
||||
((root.QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'RoomSearchPage'), {
|
||||
room: root.currentRoom
|
||||
}, {
|
||||
title: i18nc("@action:title", "Search")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
KeyNavigation.left: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).get(0)
|
||||
|
||||
onCurrentRoomChanged: {
|
||||
@@ -226,12 +286,6 @@ Kirigami.Page {
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||
Kirigami.Theme.inherit: false
|
||||
color: NeoChatConfig.compactLayout ? Kirigami.Theme.backgroundColor : "transparent"
|
||||
}
|
||||
|
||||
footer: Loader {
|
||||
id: chatBarLoader
|
||||
height: active ? (item as ChatBar).implicitHeight : 0
|
||||
|
||||
@@ -30,7 +30,7 @@ SearchPage {
|
||||
*/
|
||||
required property NeoChatConnection connection
|
||||
|
||||
title: i18nc("@action:title", "Find Your Friends")
|
||||
title: i18nc("@action:title", "Find User")
|
||||
|
||||
Component.onCompleted: focusSearch()
|
||||
|
||||
@@ -81,7 +81,7 @@ SearchPage {
|
||||
}
|
||||
QQC2.Label {
|
||||
visible: userDelegate.directChatExists
|
||||
text: i18nc("@info", "Friends")
|
||||
text: i18nc("@info", "Direct Messages")
|
||||
textFormat: Text.PlainText
|
||||
color: Kirigami.Theme.positiveTextColor
|
||||
}
|
||||
|
||||
@@ -11,7 +11,19 @@ VerificationMessage {
|
||||
|
||||
required property int reason
|
||||
|
||||
icon: "security-low"
|
||||
icon: {
|
||||
switch (root.reason) {
|
||||
case KeyVerificationSession.TIMEOUT:
|
||||
case KeyVerificationSession.REMOTE_TIMEOUT:
|
||||
case KeyVerificationSession.USER:
|
||||
case KeyVerificationSession.REMOTE_USER:
|
||||
case KeyVerificationSession.SESSION_ACCEPTED:
|
||||
case KeyVerificationSession.REMOTE_SESSION_ACCEPTED:
|
||||
return "dialog-information";
|
||||
default:
|
||||
return "security-low";
|
||||
}
|
||||
}
|
||||
text: {
|
||||
switch (root.reason) {
|
||||
case KeyVerificationSession.NONE:
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include "controller.h"
|
||||
#include "eventhandler.h"
|
||||
#include "models/actionsmodel.h"
|
||||
#include "models/messagefiltermodel.h"
|
||||
#include "models/sortfilterroomtreemodel.h"
|
||||
#include "neochatconfig.h"
|
||||
#include "neochatconnection.h"
|
||||
#include "neochatroom.h"
|
||||
@@ -43,6 +41,7 @@ RoomManager::RoomManager(QObject *parent)
|
||||
, m_messageFilterModel(new MessageFilterModel(this, m_timelineModel))
|
||||
, m_mediaMessageFilterModel(new MediaMessageFilterModel(this, m_messageFilterModel))
|
||||
, m_userListModel(new UserListModel(this))
|
||||
, m_widgetModel(new WidgetModel(this))
|
||||
{
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(UBUNTU_TOUCH)
|
||||
m_isMobile = true;
|
||||
@@ -55,6 +54,7 @@ RoomManager::RoomManager(QObject *parent)
|
||||
#endif
|
||||
|
||||
connect(this, &RoomManager::currentRoomChanged, this, [this]() {
|
||||
m_widgetModel->setRoom(m_currentRoom);
|
||||
m_userListModel->setRoom(m_currentRoom);
|
||||
m_timelineModel->setRoom(m_currentRoom);
|
||||
m_sortFilterRoomTreeModel->setCurrentRoom(m_currentRoom);
|
||||
@@ -197,6 +197,11 @@ void RoomManager::activateUserModel()
|
||||
m_userListModel->activate();
|
||||
}
|
||||
|
||||
WidgetModel *RoomManager::widgetModel() const
|
||||
{
|
||||
return m_widgetModel;
|
||||
}
|
||||
|
||||
void RoomManager::resolveResource(const QString &idOrUri, const QString &action)
|
||||
{
|
||||
resolveResource(Uri{idOrUri}, action);
|
||||
@@ -514,7 +519,14 @@ void RoomManager::setCurrentSpace(const QString &spaceId, bool setRoom)
|
||||
|
||||
// This need to happen before the signal so TreeView.expandRecursively() can work nicely.
|
||||
m_sortFilterRoomTreeModel->setActiveSpaceId(m_currentSpaceId);
|
||||
m_sortFilterRoomTreeModel->setMode(m_currentSpaceId == u"DM"_s ? SortFilterRoomTreeModel::DirectChats : SortFilterRoomTreeModel::Rooms);
|
||||
|
||||
if (m_currentSpaceId == u"DM") {
|
||||
m_sortFilterRoomTreeModel->setMode(SortFilterRoomTreeModel::DirectChats);
|
||||
} else if (m_currentSpaceId.isEmpty()) {
|
||||
m_sortFilterRoomTreeModel->setMode(SortFilterRoomTreeModel::Rooms);
|
||||
} else {
|
||||
m_sortFilterRoomTreeModel->setMode(SortFilterRoomTreeModel::All);
|
||||
}
|
||||
|
||||
Q_EMIT currentSpaceChanged();
|
||||
if (m_connection) {
|
||||
@@ -578,7 +590,8 @@ void RoomManager::setCurrentRoom(const QString &roomId)
|
||||
return;
|
||||
}
|
||||
if (m_currentRoom->isDirectChat()) {
|
||||
if (m_currentSpaceId != "DM"_L1) {
|
||||
const auto roomsInSpace = SpaceHierarchyCache::instance().getRoomListForSpace(m_currentSpaceId, false);
|
||||
if (!roomsInSpace.contains(m_currentRoom->id()) && m_currentSpaceId != "DM"_L1) {
|
||||
setCurrentSpace("DM"_L1, false);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "models/sortfilterspacelistmodel.h"
|
||||
#include "models/timelinemodel.h"
|
||||
#include "models/userlistmodel.h"
|
||||
#include "models/widgetmodel.h"
|
||||
#include "neochatroommember.h"
|
||||
|
||||
class NeoChatRoom;
|
||||
@@ -129,6 +130,14 @@ class RoomManager : public QObject, public UriResolverBase
|
||||
*/
|
||||
Q_PROPERTY(UserListModel *userListModel READ userListModel CONSTANT)
|
||||
|
||||
/**
|
||||
* @brief The WidgetModel that should be used for room widget visualisation.
|
||||
*
|
||||
* @note Available here so that the room page and drawer both have access to the
|
||||
* same model.
|
||||
*/
|
||||
Q_PROPERTY(WidgetModel *widgetModel READ widgetModel CONSTANT)
|
||||
|
||||
/**
|
||||
* @brief Whether a room is currently open in NeoChat.
|
||||
*
|
||||
@@ -160,6 +169,8 @@ public:
|
||||
UserListModel *userListModel() const;
|
||||
Q_INVOKABLE void activateUserModel();
|
||||
|
||||
WidgetModel *widgetModel() const;
|
||||
|
||||
/**
|
||||
* @brief Resolve the given resource.
|
||||
*
|
||||
@@ -356,6 +367,7 @@ private:
|
||||
MediaMessageFilterModel *m_mediaMessageFilterModel;
|
||||
|
||||
UserListModel *m_userListModel;
|
||||
WidgetModel *m_widgetModel;
|
||||
|
||||
QPointer<NeoChatConnection> m_connection;
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include <KWindowSystem>
|
||||
|
||||
#include "controller.h"
|
||||
#include "models/roomlistmodel.h"
|
||||
#include "models/sortfilterroomlistmodel.h"
|
||||
#include "roommanager.h"
|
||||
#include "windowcontroller.h"
|
||||
|
||||
|
||||
@@ -263,6 +263,7 @@ QQC2.Control {
|
||||
wrapMode: TextEdit.Wrap
|
||||
// This has to stay PlainText or else formatting starts breaking in strange ways
|
||||
textFormat: TextEdit.PlainText
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
|
||||
|
||||
Accessible.description: placeholderText
|
||||
|
||||
@@ -375,7 +376,9 @@ QQC2.Control {
|
||||
id: actionDelegate
|
||||
required property BusyAction modelData
|
||||
icon.name: modelData.isBusy ? "" : (modelData.icon.name.length > 0 ? modelData.icon.name : modelData.icon.source)
|
||||
onClicked: modelData.trigger()
|
||||
onClicked: if (!pieProgress.visible) {
|
||||
modelData.trigger()
|
||||
}
|
||||
|
||||
padding: Kirigami.Units.smallSpacing
|
||||
|
||||
@@ -383,7 +386,9 @@ QQC2.Control {
|
||||
QQC2.ToolTip.text: modelData.tooltip
|
||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
|
||||
contentItem: PieProgressBar {
|
||||
PieProgressBar {
|
||||
id: pieProgress
|
||||
anchors.fill: parent
|
||||
visible: actionDelegate.modelData.isBusy
|
||||
progress: root.currentRoom.fileUploadingProgress
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.neochat
|
||||
|
||||
QQC2.ItemDelegate {
|
||||
id: root
|
||||
@@ -29,6 +30,7 @@ QQC2.ItemDelegate {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.family: "emoji"
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
|
||||
|
||||
Kirigami.Icon {
|
||||
width: Kirigami.Units.gridUnit * 0.5
|
||||
|
||||
@@ -17,6 +17,7 @@ Kirigami.ScrollablePage {
|
||||
|
||||
property NeoChatRoom room
|
||||
required property NeoChatConnection connection
|
||||
property alias currentTabIndex: tabBar.currentIndex
|
||||
|
||||
title: i18nc("@title", "Developer Tools")
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ target_sources(LibNeoChat PRIVATE
|
||||
models/stickermodel.cpp
|
||||
models/userfiltermodel.cpp
|
||||
models/userlistmodel.cpp
|
||||
models/widgetmodel.cpp
|
||||
models/widgetmodel.h
|
||||
)
|
||||
|
||||
if (TARGET KF6::KIOWidgets)
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
ServerNotice, /**< Official messages from the server. */
|
||||
Deprioritized, /**< The room is set as low priority. */
|
||||
Space, /**< The room is a space. */
|
||||
AddDirect, /**< So we can show the add friend delegate. */
|
||||
AddDirect, /**< So we can show the add direct message delegate. */
|
||||
TypesCount, /**< Number of different types (this should always be last). */
|
||||
};
|
||||
Q_ENUM(Types);
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
case NeoChatRoomType::Favorite:
|
||||
return i18n("Favorite");
|
||||
case NeoChatRoomType::Direct:
|
||||
return i18n("Friends");
|
||||
return i18n("Direct Messages");
|
||||
case NeoChatRoomType::Normal:
|
||||
return i18n("Normal");
|
||||
case NeoChatRoomType::Deprioritized:
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
case Parameter::MostHighlights:
|
||||
return i18nc("@info", "Rooms with the most highlighted messages are higher");
|
||||
case Parameter::LastActive:
|
||||
return i18nc("@info", "Rooms with the newer messages are higher");
|
||||
return i18nc("@info", "Rooms with newer events are higher");
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <Quotient/events/encryptionevent.h>
|
||||
#include <Quotient/events/event.h>
|
||||
#include <Quotient/events/eventcontent.h>
|
||||
#include <Quotient/events/reactionevent.h>
|
||||
#include <Quotient/events/redactionevent.h>
|
||||
#include <Quotient/events/roomavatarevent.h>
|
||||
@@ -196,20 +195,25 @@ bool EventHandler::isHidden(const NeoChatRoom *room, const Quotient::RoomEvent *
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::TextFormat EventHandler::messageBodyInputFormat(const Quotient::RoomMessageEvent &event)
|
||||
Qt::TextFormat EventHandler::messageBodyInputFormat(const Quotient::RoomEvent &event)
|
||||
{
|
||||
if (event.isRedacted() && !event.isStateEvent()) {
|
||||
return Qt::RichText;
|
||||
}
|
||||
|
||||
if (event.mimeType().name() == "text/plain"_L1) {
|
||||
auto msgEvent = eventCast<const Quotient::RoomMessageEvent>(&event);
|
||||
if (!msgEvent) {
|
||||
return Qt::PlainText;
|
||||
}
|
||||
|
||||
if (msgEvent->mimeType().name() == "text/plain"_L1) {
|
||||
return Qt::PlainText;
|
||||
} else {
|
||||
return Qt::RichText;
|
||||
}
|
||||
}
|
||||
|
||||
QString EventHandler::rawMessageBody(const Quotient::RoomMessageEvent &event)
|
||||
QString EventHandler::rawMessageBody(const RoomEvent &event)
|
||||
{
|
||||
if (event.isRedacted() && !event.isStateEvent()) {
|
||||
auto reason = event.redactedBecause()->reason();
|
||||
@@ -218,21 +222,26 @@ QString EventHandler::rawMessageBody(const Quotient::RoomMessageEvent &event)
|
||||
|
||||
QString body;
|
||||
|
||||
if (event.has<EventContent::FileContent>()) {
|
||||
auto msgEvent = eventCast<const Quotient::RoomMessageEvent>(&event);
|
||||
if (!msgEvent) {
|
||||
return body;
|
||||
}
|
||||
|
||||
if (msgEvent->has<EventContent::FileContent>()) {
|
||||
// if filename is given or body is equal to filename,
|
||||
// then body is a caption
|
||||
QString filename = event.get<EventContent::FileContent>()->originalName;
|
||||
QString body = event.plainBody();
|
||||
QString filename = msgEvent->get<EventContent::FileContent>()->originalName;
|
||||
QString body = msgEvent->plainBody();
|
||||
if (filename.isEmpty() || filename == body) {
|
||||
return QString();
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
if (event.has<EventContent::TextContent>() && event.content()) {
|
||||
body = event.get<EventContent::TextContent>()->body;
|
||||
if (msgEvent->has<EventContent::TextContent>() && msgEvent->content()) {
|
||||
body = msgEvent->get<EventContent::TextContent>()->body;
|
||||
} else {
|
||||
body = event.plainBody();
|
||||
body = msgEvent->plainBody();
|
||||
}
|
||||
return body;
|
||||
}
|
||||
@@ -451,6 +460,9 @@ QString EventHandler::getBody(const NeoChatRoom *room, const Quotient::RoomEvent
|
||||
return i18nc("[User] joined a [voice/video] call", "joined a call");
|
||||
}
|
||||
}
|
||||
if (e.matrixType() == "io.element.integrations.installations"_L1) {
|
||||
return i18nc("[User] configured an extension", "configured an extension");
|
||||
}
|
||||
return e.stateKey().isEmpty() ? i18n("updated %1 state", e.matrixType())
|
||||
: i18n("updated %1 state for %2", e.matrixType(), prettyPrint ? e.stateKey().toHtmlEscaped() : e.stateKey());
|
||||
},
|
||||
@@ -664,6 +676,9 @@ QString EventHandler::genericBody(const NeoChatRoom *room, const Quotient::RoomE
|
||||
return i18nc("[User] joined a [voice/video] call", "%1 joined a call", senderString);
|
||||
}
|
||||
}
|
||||
if (e.matrixType() == "io.element.integrations.installations"_L1) {
|
||||
return i18nc("[User] configured an extension", "%1 configured an extension", senderString);
|
||||
}
|
||||
return i18n("%1 updated the state", senderString);
|
||||
},
|
||||
[senderString](const PollStartEvent &) {
|
||||
|
||||
@@ -122,15 +122,15 @@ public:
|
||||
* I.e. if the message has only a body the format will be Qt::PlainText, if it
|
||||
* has a formatted body it will be Qt::RichText.
|
||||
*/
|
||||
static Qt::TextFormat messageBodyInputFormat(const Quotient::RoomMessageEvent &event);
|
||||
static Qt::TextFormat messageBodyInputFormat(const Quotient::RoomEvent &event);
|
||||
|
||||
/**
|
||||
* @brief Output a string for the room message content without any formatting.
|
||||
* @brief Output a string for the message content without any formatting.
|
||||
*
|
||||
* This is the content of the formatted_body key if present or the body key if
|
||||
* not.
|
||||
*/
|
||||
static QString rawMessageBody(const Quotient::RoomMessageEvent &event);
|
||||
static QString rawMessageBody(const Quotient::RoomEvent &event);
|
||||
|
||||
/**
|
||||
* @brief Output a string for the message content ready for display in a rich text field.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
#include "pollevent.h"
|
||||
#include <Quotient/converters.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
|
||||
@@ -146,9 +146,13 @@ bool UserListModel::event(QEvent *event)
|
||||
|
||||
void UserListModel::memberJoined(const Quotient::RoomMember &member)
|
||||
{
|
||||
auto pos = findUserPos(member);
|
||||
beginInsertRows(QModelIndex(), pos, pos);
|
||||
m_members.insert(pos, member.id());
|
||||
if (m_members.contains(member.id())) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int row = m_members.size();
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
m_members.append(member.id());
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
@@ -168,8 +172,6 @@ void UserListModel::refreshMember(const Quotient::RoomMember &member, const QLis
|
||||
{
|
||||
auto pos = findUserPos(member);
|
||||
if (pos != m_members.size()) {
|
||||
// The update will have changed the state event so we need to insert the updated member object.
|
||||
m_members.insert(pos, member.id());
|
||||
Q_EMIT dataChanged(index(pos), index(pos), roles);
|
||||
} else {
|
||||
qWarning() << "Trying to access a room member not in the user list";
|
||||
|
||||
356
src/libneochat/models/widgetmodel.cpp
Normal file
356
src/libneochat/models/widgetmodel.cpp
Normal file
@@ -0,0 +1,356 @@
|
||||
// SPDX-FileCopyrightText: 2025 Arno Rehn <arno@arnorehn.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
#include "widgetmodel.h"
|
||||
|
||||
#include <Quotient/jobs/downloadfilejob.h>
|
||||
#include <Quotient/user.h>
|
||||
#include <widgetevent.h>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// This URL will take us to a jitsi room that is configured on a best effort basis.
|
||||
// Critically, it appears that we cannot pass avatars via the "fragment API".
|
||||
// The important stuff is working though: conference id, user name, subject.
|
||||
//
|
||||
// The alternative would be to rely on a Jitsi wrapper like https://app.element.io/jitsi.html.
|
||||
// This one parses the fragment and then uses the the actual Jitsi IFrame API to set
|
||||
// up the Jitsi meeting. Nice, but ties us to that external wrapper.
|
||||
//
|
||||
// Or we ship our own wrapper as a local HTML file and open that one?
|
||||
constexpr char JitsiMeetUrlTemplate[] =
|
||||
"https://$domain/$conferenceId"
|
||||
"#jitsi_meet_external_api_id=0"
|
||||
"&config.subject=\"$roomName\""
|
||||
"&config.startAudioOnly=$isAudioOnly"
|
||||
"&config.startWithAudioMuted=$startWithAudioMuted"
|
||||
"&config.startWithVideoMuted=$startWithVideoMuted"
|
||||
"&isVideoChannel=$isVideoChannel"
|
||||
"&userInfo.displayName=\"$matrix_display_name\"";
|
||||
|
||||
// Same thing with etherpad, as long as it's on scalar.vector.im
|
||||
constexpr char EtherpadScalarVectorImUrl[] = "https://scalar.vector.im/api/widgets/etherpad.html";
|
||||
constexpr char EtherpadUrlTemplate[] =
|
||||
"https://etherpad.integrations.element.io/p/"
|
||||
"$padName"
|
||||
"?showControls=true"
|
||||
"&showChat=false"
|
||||
"&chatAndUsers=false"
|
||||
"&alwaysShowChat=false"
|
||||
"&showLineNumbers=true"
|
||||
"&useMonospaceFont=false"
|
||||
"&userName=$matrix_user_id";
|
||||
|
||||
QUrl avatarUrl(NeoChatRoom *room)
|
||||
{
|
||||
const auto avatarUrl = room->member(room->connection()->userId()).avatarUrl();
|
||||
return room->connection()->getUrlForApi<DownloadFileJob>(avatarUrl);
|
||||
}
|
||||
|
||||
// Many widgets require proper interfacing with integration managers, but this needs authentication
|
||||
// with an integration manager: https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/1961-integrations-auth.md
|
||||
// Also requires accepting the terms: https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/2140-terms-of-service-2.md
|
||||
// Example:
|
||||
// curl -X POST "https://scalar.vector.im/_matrix/integrations/v1/register" \
|
||||
// -H "Content-Type: application/json" \
|
||||
// --data '<OpenIdCredentials>'
|
||||
// Then append the resulting json key-value pairs as query items to the widget url.
|
||||
QUrl buildWidgetUrl(QByteArray templateString, NeoChatRoom *room, const QJsonObject &data)
|
||||
{
|
||||
constexpr auto enc = [](const auto &s) {
|
||||
return QUrl::toPercentEncoding(s);
|
||||
};
|
||||
|
||||
templateString.replace("$matrix_user_id"_L1, enc(room->connection()->userId()))
|
||||
.replace("$matrix_room_id"_L1, enc(room->id()))
|
||||
.replace("$matrix_display_name"_L1, enc(room->member(room->connection()->userId()).displayName()))
|
||||
.replace("$matrix_avatar_url"_L1, avatarUrl(room).toEncoded());
|
||||
|
||||
for (auto it = data.begin(); it != data.end(); ++it) {
|
||||
const QByteArray key = '$' + it.key().toUtf8();
|
||||
templateString.replace(key, enc(it.value().toString()));
|
||||
}
|
||||
|
||||
return QUrl::fromEncoded(templateString);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class WidgetModelPrivate
|
||||
{
|
||||
Q_DISABLE_COPY(WidgetModelPrivate);
|
||||
|
||||
public:
|
||||
WidgetModelPrivate(WidgetModel *q)
|
||||
: q_ptr(q)
|
||||
{
|
||||
}
|
||||
|
||||
Q_DECLARE_PUBLIC(WidgetModel)
|
||||
WidgetModel *const q_ptr;
|
||||
|
||||
// clang-format off
|
||||
struct NoModelResetTag_t {};
|
||||
static constexpr NoModelResetTag_t NoModelReset {};
|
||||
// clang-format on
|
||||
|
||||
void reload();
|
||||
void reload(NoModelResetTag_t);
|
||||
void updateWidgets(Quotient::RoomEventsRange events);
|
||||
void handleEvent(const Quotient::RoomEvent *event);
|
||||
void handlePendingEvent(const Quotient::RoomEvent *event);
|
||||
void buildJitsiIndex();
|
||||
|
||||
NeoChatRoom *room = nullptr;
|
||||
QMap<QString, const WidgetEvent *> state;
|
||||
int jitsiIndex = -1;
|
||||
};
|
||||
|
||||
WidgetModel::WidgetModel(QObject *parent)
|
||||
: QAbstractListModel{parent}
|
||||
, d_ptr(std::make_unique<WidgetModelPrivate>(this))
|
||||
{
|
||||
}
|
||||
|
||||
WidgetModel::~WidgetModel()
|
||||
{
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> WidgetModel::roleNames() const
|
||||
{
|
||||
return {
|
||||
{TextRole, "text"},
|
||||
{UrlRole, "url"},
|
||||
{TypeRole, "type"},
|
||||
};
|
||||
}
|
||||
|
||||
QVariant WidgetModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
Q_D(const WidgetModel);
|
||||
|
||||
const int row = index.row();
|
||||
if (row < 0 || row >= d->state.count()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto *ev = std::next(d->state.begin(), row).value();
|
||||
const auto type = ev->contentPart<QString>("type"_L1);
|
||||
const auto url = ev->contentPart<QString>("url"_L1).toUtf8();
|
||||
|
||||
switch (role) {
|
||||
case TextRole:
|
||||
return ev->contentPart<QString>("name"_L1);
|
||||
case TypeRole:
|
||||
return type;
|
||||
case UrlRole: {
|
||||
QByteArray urlTemplate = url;
|
||||
if (type == "jitsi"_L1) {
|
||||
// Jitsi is special-cased even in Element. The URL that we get from the
|
||||
// widget is just "https://scalar.vector.im/api/widgets/jitsi.html" which
|
||||
// is not sufficient.
|
||||
urlTemplate = JitsiMeetUrlTemplate;
|
||||
} else if (type == "m.etherpad"_L1 && url.startsWith(EtherpadScalarVectorImUrl)) {
|
||||
// Etherpad is not special-cased, but the scalar.vector.im wrapper requires authentication
|
||||
// with the integration manager. We can just resolve this to the actual etherpad instance
|
||||
// to skip integration manager auth.
|
||||
urlTemplate = EtherpadUrlTemplate;
|
||||
}
|
||||
return buildWidgetUrl(urlTemplate, room(), ev->contentPart<QJsonObject>("data"_L1));
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
int WidgetModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_D(const WidgetModel);
|
||||
Q_UNUSED(parent);
|
||||
return d->state.count();
|
||||
}
|
||||
|
||||
void WidgetModelPrivate::reload(NoModelResetTag_t)
|
||||
{
|
||||
state.clear();
|
||||
|
||||
if (room) {
|
||||
const auto events = room->currentState().eventsOfType(Quotient::WidgetEvent::MetaType.matrixId);
|
||||
for (auto ev : events) {
|
||||
handleEvent(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WidgetModelPrivate::reload()
|
||||
{
|
||||
Q_Q(WidgetModel);
|
||||
|
||||
q->beginResetModel();
|
||||
|
||||
reload(NoModelReset);
|
||||
buildJitsiIndex();
|
||||
|
||||
q->endResetModel();
|
||||
}
|
||||
|
||||
void WidgetModelPrivate::updateWidgets(Quotient::RoomEventsRange events)
|
||||
{
|
||||
using namespace std::ranges;
|
||||
|
||||
constexpr auto isWidgetEvent = [](auto &&ev) {
|
||||
return ev->template is<WidgetEvent>();
|
||||
};
|
||||
|
||||
if (any_of(events, isWidgetEvent)) {
|
||||
reload();
|
||||
}
|
||||
}
|
||||
|
||||
void WidgetModelPrivate::handleEvent(const Quotient::RoomEvent *event)
|
||||
{
|
||||
const WidgetEvent *widgetEvent = eventCast<const WidgetEvent>(event);
|
||||
if (!widgetEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = state.find(widgetEvent->stateKey());
|
||||
if (it != state.end() && widgetEvent->replacedState() == it.value()->id()) {
|
||||
// we alrady have this and it should be...
|
||||
if (widgetEvent->contentJson().isEmpty()) {
|
||||
// ... removed because replacement is empty
|
||||
state.erase(it);
|
||||
} else {
|
||||
// replaced
|
||||
it.value() = widgetEvent;
|
||||
}
|
||||
} else if (!widgetEvent->contentJson().isEmpty()) {
|
||||
// insert if not empty
|
||||
it = state.insert(widgetEvent->stateKey(), widgetEvent);
|
||||
}
|
||||
}
|
||||
|
||||
void WidgetModelPrivate::handlePendingEvent(const RoomEvent *event)
|
||||
{
|
||||
Q_Q(WidgetModel);
|
||||
|
||||
if (!event->is<WidgetEvent>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
q->beginResetModel();
|
||||
|
||||
reload(NoModelReset);
|
||||
handleEvent(event);
|
||||
buildJitsiIndex();
|
||||
|
||||
q->endResetModel();
|
||||
}
|
||||
|
||||
void WidgetModelPrivate::buildJitsiIndex()
|
||||
{
|
||||
Q_Q(WidgetModel);
|
||||
|
||||
const auto newIndex = [&] -> int {
|
||||
auto it = std::find_if(state.cbegin(), state.cend(), [](const WidgetEvent *e) {
|
||||
return e->contentPart<QString>("type"_L1) == "jitsi"_L1;
|
||||
});
|
||||
|
||||
if (it == state.cend()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return std::distance(state.cbegin(), it);
|
||||
}();
|
||||
|
||||
if (newIndex != jitsiIndex) {
|
||||
jitsiIndex = newIndex;
|
||||
Q_EMIT q->jitsiIndexChanged();
|
||||
}
|
||||
}
|
||||
|
||||
NeoChatRoom *WidgetModel::room() const
|
||||
{
|
||||
Q_D(const WidgetModel);
|
||||
return d->room;
|
||||
}
|
||||
|
||||
void WidgetModel::setRoom(NeoChatRoom *newRoom)
|
||||
{
|
||||
Q_D(WidgetModel);
|
||||
|
||||
if (d->room == newRoom) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->room) {
|
||||
disconnect(d->room, &NeoChatRoom::baseStateLoaded, this, nullptr);
|
||||
disconnect(d->room, &NeoChatRoom::aboutToAddNewMessages, this, nullptr);
|
||||
disconnect(d->room, &NeoChatRoom::pendingEventAboutToAdd, this, nullptr);
|
||||
}
|
||||
|
||||
d->room = newRoom;
|
||||
|
||||
if (d->room) {
|
||||
connect(d->room, &NeoChatRoom::baseStateLoaded, this, [d] {
|
||||
d->reload();
|
||||
});
|
||||
connect(d->room, &NeoChatRoom::aboutToAddNewMessages, this, [d](Quotient::RoomEventsRange events) {
|
||||
d->updateWidgets(events);
|
||||
});
|
||||
connect(d->room, &NeoChatRoom::pendingEventAboutToAdd, this, [d](Quotient::RoomEvent *event) {
|
||||
d->handlePendingEvent(event);
|
||||
});
|
||||
}
|
||||
d->reload();
|
||||
|
||||
Q_EMIT roomChanged();
|
||||
}
|
||||
|
||||
int WidgetModel::jitsiIndex() const
|
||||
{
|
||||
Q_D(const WidgetModel);
|
||||
|
||||
return d->jitsiIndex;
|
||||
}
|
||||
|
||||
QUrl WidgetModel::addJitsiConference()
|
||||
{
|
||||
// URL is not spec-compliant, but this is what Element does as well.
|
||||
const auto conferenceId = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
||||
// clang-format off
|
||||
const QJsonObject content{
|
||||
{"name"_L1, "Jitsi Meet"_L1},
|
||||
{"type"_L1, "jitsi"_L1},
|
||||
{"url"_L1, "https://scalar.vector.im/api/widgets/jitsi.html"_L1},
|
||||
{"data"_L1, QJsonObject{
|
||||
{"conferenceId"_L1, conferenceId},
|
||||
{"domain"_L1, "meet.element.io"_L1}, // TODO: make domain configurable
|
||||
{"isAudioOnly"_L1, false},
|
||||
{"roomName"_L1, room()->displayName()},
|
||||
}},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// Re-use conferenceId as state_key
|
||||
room()->setState(WidgetEvent::MetaType.matrixId, conferenceId, content);
|
||||
|
||||
return buildWidgetUrl(JitsiMeetUrlTemplate, room(), content["data"_L1].toObject());
|
||||
}
|
||||
|
||||
bool WidgetModel::removeWidget(int index)
|
||||
{
|
||||
Q_D(const WidgetModel);
|
||||
|
||||
if (index < 0 || index >= rowCount()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto stateKey = std::next(d->state.begin(), index).value()->stateKey();
|
||||
room()->setState(WidgetEvent::MetaType.matrixId, stateKey, QJsonObject{});
|
||||
|
||||
return true;
|
||||
}
|
||||
74
src/libneochat/models/widgetmodel.h
Normal file
74
src/libneochat/models/widgetmodel.h
Normal file
@@ -0,0 +1,74 @@
|
||||
// SPDX-FileCopyrightText: 2025 Arno Rehn <arno@arnorehn.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
#ifndef WIDGETMODEL_H
|
||||
#define WIDGETMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include "neochatroom.h"
|
||||
|
||||
class WidgetModelPrivate;
|
||||
|
||||
/**
|
||||
* @class WidgetModel
|
||||
*
|
||||
* `WidgetModel` provides a list model of widgets for a given room.
|
||||
*
|
||||
* It also supports adding and removing widgets.
|
||||
*/
|
||||
class WidgetModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
|
||||
/**
|
||||
* @brief The room for which this model lists the widgets
|
||||
*/
|
||||
Q_PROPERTY(NeoChatRoom *room READ room WRITE setRoom NOTIFY roomChanged)
|
||||
/**
|
||||
* @brief The row index of the first Jitsi widget
|
||||
*/
|
||||
Q_PROPERTY(int jitsiIndex READ jitsiIndex NOTIFY jitsiIndexChanged)
|
||||
public:
|
||||
enum Roles {
|
||||
TextRole = Qt::DisplayRole,
|
||||
UrlRole = Qt::UserRole,
|
||||
TypeRole,
|
||||
};
|
||||
Q_ENUM(Roles)
|
||||
|
||||
explicit WidgetModel(QObject *parent = nullptr);
|
||||
~WidgetModel() override;
|
||||
|
||||
NeoChatRoom *room() const;
|
||||
void setRoom(NeoChatRoom *newRoom);
|
||||
|
||||
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
||||
[[nodiscard]] QVariant data(const QModelIndex &index, int roleName) const override;
|
||||
[[nodiscard]] int rowCount(const QModelIndex &parent = {}) const override;
|
||||
|
||||
int jitsiIndex() const;
|
||||
|
||||
/**
|
||||
* @brief Adds a new Jitsi widget
|
||||
* @return The URL of the newly added Jitsi conference
|
||||
*/
|
||||
Q_INVOKABLE QUrl addJitsiConference();
|
||||
/**
|
||||
* @brief Removes the widget at @p index
|
||||
* @return `true` on success, `false` otherwise
|
||||
*/
|
||||
Q_INVOKABLE bool removeWidget(int index);
|
||||
|
||||
Q_SIGNALS:
|
||||
void roomChanged();
|
||||
void jitsiIndexChanged();
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(WidgetModel)
|
||||
const std::unique_ptr<WidgetModelPrivate> d_ptr;
|
||||
};
|
||||
|
||||
#endif // WIDGETMODEL_H
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "neochatroom.h"
|
||||
#include "spacehierarchycache.h"
|
||||
|
||||
#include <Quotient/connection.h>
|
||||
#include <Quotient/jobs/basejob.h>
|
||||
#include <Quotient/quotient_common.h>
|
||||
#include <qt6keychain/keychain.h>
|
||||
@@ -96,6 +95,7 @@ void NeoChatConnection::connectSignals()
|
||||
Q_EMIT directChatsHaveHighlightNotificationsChanged();
|
||||
});
|
||||
}
|
||||
Q_EMIT roomInvitesChanged();
|
||||
connect(room, &Room::unreadStatsChanged, this, [this]() {
|
||||
refreshBadgeNotificationCount();
|
||||
Q_EMIT homeNotificationsChanged();
|
||||
@@ -453,15 +453,20 @@ bool NeoChatConnection::homeHaveHighlightNotifications() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NeoChatConnection::directChatInvites() const
|
||||
qsizetype NeoChatConnection::directChatInvites() const
|
||||
{
|
||||
auto inviteRooms = rooms(JoinState::Invite);
|
||||
for (const auto inviteRoom : inviteRooms) {
|
||||
if (inviteRoom->isDirectChat()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
const auto inviteRooms = rooms(JoinState::Invite);
|
||||
return std::ranges::count_if(inviteRooms, [](const auto room) {
|
||||
return room->isDirectChat();
|
||||
});
|
||||
}
|
||||
|
||||
qsizetype NeoChatConnection::roomInvites() const
|
||||
{
|
||||
const auto inviteRooms = rooms(JoinState::Invite);
|
||||
return std::ranges::count_if(inviteRooms, [](const auto room) {
|
||||
return !room->isDirectChat();
|
||||
});
|
||||
}
|
||||
|
||||
QCoro::Task<void> NeoChatConnection::setupPushNotifications(QString endpoint)
|
||||
|
||||
@@ -66,9 +66,14 @@ class NeoChatConnection : public Quotient::Connection
|
||||
Q_PROPERTY(bool homeHaveHighlightNotifications READ homeHaveHighlightNotifications NOTIFY homeHaveHighlightNotificationsChanged)
|
||||
|
||||
/**
|
||||
* @brief Whether there is at least one invite to a direct chat.
|
||||
* @brief The number of invites to 1-on-1 direct chats.
|
||||
*/
|
||||
Q_PROPERTY(bool directChatInvites READ directChatInvites NOTIFY directChatInvitesChanged)
|
||||
Q_PROPERTY(qsizetype directChatInvites READ directChatInvites NOTIFY directChatInvitesChanged)
|
||||
|
||||
/**
|
||||
* @brief The number of pending, normal room invites.
|
||||
*/
|
||||
Q_PROPERTY(qsizetype roomInvites READ roomInvites NOTIFY roomInvitesChanged)
|
||||
|
||||
/**
|
||||
* @brief Whether the server supports querying a user's mutual rooms.
|
||||
@@ -200,7 +205,8 @@ public:
|
||||
*/
|
||||
static void setKeywordPushRuleDefault(PushRuleAction::Action defaultAction);
|
||||
|
||||
bool directChatInvites() const;
|
||||
qsizetype directChatInvites() const;
|
||||
qsizetype roomInvites() const;
|
||||
|
||||
// note: this is intentionally a copied QString because
|
||||
// the reference could be destroyed before the task is finished
|
||||
@@ -225,6 +231,7 @@ Q_SIGNALS:
|
||||
void homeNotificationsChanged();
|
||||
void homeHaveHighlightNotificationsChanged();
|
||||
void directChatInvitesChanged();
|
||||
void roomInvitesChanged();
|
||||
void passwordStatus(NeoChatConnection::PasswordStatus status);
|
||||
void userConsentRequired(QUrl url);
|
||||
void badgeNotificationCountChanged(int count);
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "chatbarcache.h"
|
||||
#include "clipboard.h"
|
||||
#include "eventhandler.h"
|
||||
#include "events/pollevent.h"
|
||||
#include "filetransferpseudojob.h"
|
||||
#include "neochatconnection.h"
|
||||
#include "roomlastmessageprovider.h"
|
||||
@@ -1181,6 +1180,9 @@ void NeoChatRoom::loadPinnedMessage()
|
||||
const QString &mostRecentEventId = events.last();
|
||||
connection()->callApi<GetOneRoomEventJob>(id(), mostRecentEventId).then([this](const auto &job) {
|
||||
auto event = fromJson<event_ptr_tt<RoomEvent>>(job->jsonData());
|
||||
if (auto encEv = eventCast<EncryptedEvent>(event.get())) {
|
||||
event = decryptMessage(*encEv);
|
||||
}
|
||||
m_pinnedMessage = EventHandler::richBody(this, event.get());
|
||||
Q_EMIT pinnedMessageChanged();
|
||||
});
|
||||
|
||||
@@ -77,6 +77,7 @@ QQC2.Control {
|
||||
color: Kirigami.Theme.textColor
|
||||
|
||||
font.family: "monospace"
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
|
||||
|
||||
Kirigami.SpellCheck.enabled: false
|
||||
|
||||
|
||||
@@ -41,7 +41,12 @@ QQC2.Control {
|
||||
*/
|
||||
property var defaultHeight: Kirigami.Units.gridUnit * 3 + Kirigami.Units.largeSpacing * 2
|
||||
|
||||
property bool truncated: linkPreviewDescription.truncated || !linkPreviewDescription.visible
|
||||
/**
|
||||
* @brief Whether the link preview description is truncated.
|
||||
*
|
||||
* This is only applicable if there *is* a text description, and is never true for images.
|
||||
*/
|
||||
property bool truncated: linkPreviewDescription.truncated && linkPreviewDescription.visible
|
||||
|
||||
/**
|
||||
* @brief Request for this delegate to be removed.
|
||||
@@ -72,7 +77,7 @@ QQC2.Control {
|
||||
id: previewImage
|
||||
Layout.preferredWidth: root.defaultHeight
|
||||
Layout.preferredHeight: root.defaultHeight
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: root.defaultHeight
|
||||
Layout.fillHeight: true
|
||||
visible: root.linkPreviewer.imageSource.toString().length > 0
|
||||
source: root.linkPreviewer.imageSource
|
||||
@@ -82,9 +87,9 @@ QQC2.Control {
|
||||
}
|
||||
ColumnLayout {
|
||||
id: column
|
||||
implicitWidth: Math.max(linkPreviewTitle.implicitWidth, linkPreviewDescription.implicitWidth)
|
||||
Layout.preferredWidth: Math.max(linkPreviewTitle.implicitWidth, linkPreviewDescription.implicitWidth)
|
||||
Layout.fillWidth: true
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
visible: root.linkPreviewer.title.length > 0 || root.linkPreviewer.description.length > 0
|
||||
Kirigami.Heading {
|
||||
id: linkPreviewTitle
|
||||
Layout.fillWidth: true
|
||||
@@ -121,10 +126,11 @@ QQC2.Control {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onTapped: RoomManager.resolveResource(root.linkPreviewer.url, "join")
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
HoverHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onHoveredChanged: (root.QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = hovered ? root.linkPreviewer.url : ""
|
||||
}
|
||||
}
|
||||
|
||||
QQC2.Button {
|
||||
|
||||
@@ -92,23 +92,31 @@ ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
QQC2.CheckBox {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
enabled: !root.pollHandler.hasEnded
|
||||
checked: answerDelegate.localChoice
|
||||
|
||||
onClicked: answerDelegate.clicked()
|
||||
}
|
||||
QQC2.Label {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: answerDelegate.answerText
|
||||
wrapMode: QQC2.Label.WordWrap
|
||||
}
|
||||
Kirigami.Icon {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
implicitWidth: Kirigami.Units.iconSizes.small
|
||||
implicitHeight: implicitWidth
|
||||
visible: answerDelegate.isWinner
|
||||
source: "favorite-favorited"
|
||||
}
|
||||
QQC2.Label {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
visible: root.pollHandler.kind == PollKind.Disclosed || root.pollHandler.hasEnded
|
||||
horizontalAlignment: Text.AlignRight
|
||||
text: i18ncp("@info", "%1 Vote", "%1 Votes", answerDelegate.count)
|
||||
|
||||
@@ -58,6 +58,7 @@ QQC2.Control {
|
||||
selectionColor: Kirigami.Theme.highlightColor
|
||||
|
||||
font.italic: true
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
|
||||
|
||||
onSelectedTextChanged: root.selectedTextChanged(selectedText)
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ Flow {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: reactionDelegate.textContent
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
|
||||
background: null
|
||||
wrapMode: TextEdit.NoWrap
|
||||
textFormat: Text.RichText
|
||||
|
||||
@@ -67,7 +67,9 @@ TextEdit {
|
||||
selectedTextColor: Kirigami.Theme.highlightedTextColor
|
||||
selectionColor: Kirigami.Theme.highlightColor
|
||||
font {
|
||||
pointSize: !root.isReply && QmlUtils.isEmoji(display) ? Kirigami.Theme.defaultFont.pointSize * 4 : Kirigami.Theme.defaultFont.pointSize
|
||||
pointSize: !root.isReply && QmlUtils.isEmoji(display)
|
||||
? Kirigami.Theme.defaultFont.pointSize * 4 * NeoChatConfig.fontScale
|
||||
: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
|
||||
family: QmlUtils.isEmoji(display) ? 'emoji' : Kirigami.Theme.defaultFont.family
|
||||
}
|
||||
selectByMouse: !Kirigami.Settings.isMobile
|
||||
|
||||
@@ -366,55 +366,42 @@ void EventMessageContentModel::updateReplyModel()
|
||||
|
||||
QList<MessageComponent> EventMessageContentModel::componentsForType(MessageComponentType::Type type)
|
||||
{
|
||||
const auto event = m_room->getEvent(m_eventId);
|
||||
if (event.first == nullptr) {
|
||||
const auto [event, _] = m_room->getEvent(m_eventId);
|
||||
if (event == nullptr) {
|
||||
return {};
|
||||
}
|
||||
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event);
|
||||
|
||||
switch (type) {
|
||||
case MessageComponentType::Verification: {
|
||||
return {MessageComponent{MessageComponentType::Verification, QString(), {}}};
|
||||
}
|
||||
case MessageComponentType::Text: {
|
||||
if (const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first)) {
|
||||
return TextHandler().textComponents(EventHandler::rawMessageBody(*roomMessageEvent),
|
||||
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
||||
m_room,
|
||||
roomMessageEvent,
|
||||
roomMessageEvent->isReplaced());
|
||||
} else {
|
||||
return TextHandler().textComponents(EventHandler::plainBody(m_room, event.first), Qt::TextFormat::PlainText, m_room, event.first, false);
|
||||
}
|
||||
|
||||
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
|
||||
return TextHandler().textComponents(EventHandler::rawMessageBody(*roomMessageEvent),
|
||||
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
||||
return TextHandler().textComponents(EventHandler::rawMessageBody(*event),
|
||||
EventHandler::messageBodyInputFormat(*event),
|
||||
m_room,
|
||||
roomMessageEvent,
|
||||
roomMessageEvent->isReplaced());
|
||||
event,
|
||||
roomMessageEvent ? roomMessageEvent->isReplaced() : false);
|
||||
}
|
||||
case MessageComponentType::File: {
|
||||
QList<MessageComponent> components;
|
||||
components += MessageComponent{MessageComponentType::File, {}, EventHandler::mediaInfo(m_room, event.first)};
|
||||
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
|
||||
auto body = EventHandler::rawMessageBody(*roomMessageEvent);
|
||||
components += MessageComponent{MessageComponentType::File, {}, EventHandler::mediaInfo(m_room, event)};
|
||||
auto body = EventHandler::rawMessageBody(*event);
|
||||
if (!body.isEmpty()) {
|
||||
components += TextHandler().textComponents(body,
|
||||
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
||||
m_room,
|
||||
roomMessageEvent,
|
||||
roomMessageEvent->isReplaced());
|
||||
EventHandler::messageBodyInputFormat(*event),
|
||||
m_room,
|
||||
event,
|
||||
roomMessageEvent ? roomMessageEvent->isReplaced() : false);
|
||||
}
|
||||
return components;
|
||||
}
|
||||
case MessageComponentType::Image:
|
||||
case MessageComponentType::Audio:
|
||||
case MessageComponentType::Video: {
|
||||
QList<MessageComponent> components = {
|
||||
MessageComponent{type, EventHandler::richBody(m_room, event.first), EventHandler::mediaInfo(m_room, event.first)}};
|
||||
QList<MessageComponent> components = {MessageComponent{type, EventHandler::richBody(m_room, event), EventHandler::mediaInfo(m_room, event)}};
|
||||
|
||||
if (!event.first->is<StickerEvent>()) {
|
||||
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
|
||||
if (!event->is<StickerEvent>() && roomMessageEvent) {
|
||||
const auto fileContent = roomMessageEvent->get<EventContent::FileContentBase>();
|
||||
if (fileContent != nullptr) {
|
||||
const auto fileInfo = fileContent->commonInfo();
|
||||
@@ -433,11 +420,11 @@ QList<MessageComponent> EventMessageContentModel::componentsForType(MessageCompo
|
||||
}
|
||||
case MessageComponentType::Location:
|
||||
return {MessageComponent{type,
|
||||
EventHandler::plainBody(m_room, event.first),
|
||||
EventHandler::plainBody(m_room, event),
|
||||
{
|
||||
{u"latitude"_s, EventHandler::latitude(event.first)},
|
||||
{u"longitude"_s, EventHandler::longitude(event.first)},
|
||||
{u"asset"_s, EventHandler::locationAssetType(event.first)},
|
||||
{u"latitude"_s, EventHandler::latitude(event)},
|
||||
{u"longitude"_s, EventHandler::longitude(event)},
|
||||
{u"asset"_s, EventHandler::locationAssetType(event)},
|
||||
}}};
|
||||
default:
|
||||
return {MessageComponent{type, QString(), {}}};
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "chatbarcache.h"
|
||||
#include "contentprovider.h"
|
||||
#include "enums/messagecomponenttype.h"
|
||||
#include "neochatconnection.h"
|
||||
#include "texthandler.h"
|
||||
|
||||
@@ -119,6 +118,11 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!m_room) {
|
||||
qWarning() << "MessageContentModel::data called without room";
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto component = m_components[index.row()];
|
||||
|
||||
if (role == DisplayRole) {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "contentprovider.h"
|
||||
#include "enums/messagecomponenttype.h"
|
||||
#include "eventhandler.h"
|
||||
#include "messagecontentmodel.h"
|
||||
#include "neochatroom.h"
|
||||
|
||||
ThreadModel::ThreadModel(const QString &threadRootId, NeoChatRoom *room)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <KLocalization>
|
||||
|
||||
#include "events/pollevent.h"
|
||||
#include "neochatroom.h"
|
||||
|
||||
#include <Quotient/csapi/relations.h>
|
||||
@@ -42,22 +41,33 @@ void PollHandler::updatePoll(Quotient::RoomEventsRange events)
|
||||
}
|
||||
}
|
||||
|
||||
void PollHandler::checkLoadRelations()
|
||||
void PollHandler::checkLoadRelations(const QString &nextBatch)
|
||||
{
|
||||
const auto pollStartEvent = m_room->getEvent(m_pollStartId).first;
|
||||
if (pollStartEvent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_room->connection()->callApi<GetRelatingEventsJob>(m_room->id(), pollStartEvent->id()).onResult([this](const auto &job) {
|
||||
m_room->connection()->callApi<GetRelatingEventsJob>(m_room->id(), pollStartEvent->id(), nextBatch).onResult([this](const auto &job) {
|
||||
for (const auto &event : job->chunk()) {
|
||||
handleEvent(event.get());
|
||||
}
|
||||
|
||||
// This is paginated API. If it indicates that there's more data, run again starting from the supplied pagination token.
|
||||
if (!job->nextBatch().isEmpty()) {
|
||||
checkLoadRelations(job->nextBatch());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void PollHandler::handleEvent(Quotient::RoomEvent *event)
|
||||
{
|
||||
if (auto encEvent = eventCast<const EncryptedEvent>(event)) {
|
||||
const auto decrypted = room()->decryptMessage(*encEvent);
|
||||
handleEvent(decrypted.get());
|
||||
return;
|
||||
}
|
||||
|
||||
auto pollStartEvent = eventCast<const PollStartEvent>(m_room->getEvent(m_pollStartId).first);
|
||||
if (pollStartEvent == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
|
||||
void updatePoll(Quotient::RoomEventsRange events);
|
||||
|
||||
void checkLoadRelations();
|
||||
void checkLoadRelations(const QString &nextBatch = {});
|
||||
void handleEvent(Quotient::RoomEvent *event);
|
||||
void handleResponse(const Quotient::PollResponseEvent *event);
|
||||
QHash<QString, QDateTime> m_selectionTimestamps;
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
"Name[it]": "Tobias Fella",
|
||||
"Name[ka]": "Tobias Fella",
|
||||
"Name[ko]": "Tobias Fella",
|
||||
"Name[lt]": "Tobias Fella",
|
||||
"Name[lv]": "Tobias Fella",
|
||||
"Name[nl]": "Tobias Fella",
|
||||
"Name[nn]": "Tobias Fella",
|
||||
"Name[pl]": "Tobias Fella",
|
||||
"Name[pt_BR]": "Tobias Fella",
|
||||
"Name[ro]": "Tobias Fella",
|
||||
"Name[ru]": "Tobias Fella",
|
||||
"Name[sa]": "टोबियास फेला",
|
||||
"Name[sk]": "Tobias Fella",
|
||||
@@ -61,11 +63,13 @@
|
||||
"Description[it]": "Condividi tramite NeoChat",
|
||||
"Description[ka]": "გააზიარეთ NeoChat-ით",
|
||||
"Description[ko]": "NeoChat으로 공유",
|
||||
"Description[lt]": "Bendrinti per NeoChat",
|
||||
"Description[lv]": "Kopīgot ar „NeoChat“",
|
||||
"Description[nl]": "Delen via NeoChat",
|
||||
"Description[nn]": "Del via NeoChat",
|
||||
"Description[pl]": "Udostępnij przez NeoChat",
|
||||
"Description[pt_BR]": "Compartilhar via NeoChat",
|
||||
"Description[ro]": "Partajează prin NeoChat",
|
||||
"Description[ru]": "Опубликовать в NeoChat",
|
||||
"Description[sa]": "NeoChat मार्गेण साझां कुर्वन्तु",
|
||||
"Description[sl]": "Deli prek NeoChat",
|
||||
@@ -99,11 +103,13 @@
|
||||
"Name[it]": "NeoChat",
|
||||
"Name[ka]": "NeoChat",
|
||||
"Name[ko]": "NeoChat",
|
||||
"Name[lt]": "NeoChat",
|
||||
"Name[lv]": "NeoChat",
|
||||
"Name[nl]": "NeoChat",
|
||||
"Name[nn]": "NeoChat",
|
||||
"Name[pl]": "NeoChat",
|
||||
"Name[pt_BR]": "NeoChat",
|
||||
"Name[ro]": "NeoChat",
|
||||
"Name[ru]": "NeoChat",
|
||||
"Name[sa]": "नवचैट्",
|
||||
"Name[sk]": "NeoChat",
|
||||
|
||||
@@ -14,6 +14,7 @@ ecm_add_qml_module(RoomInfo GENERATE_PLUGIN_SOURCE
|
||||
LocationsPage.qml
|
||||
RoomPinnedMessagesPage.qml
|
||||
RoomSearchPage.qml
|
||||
WidgetsPage.qml
|
||||
SOURCES
|
||||
locationhelper.cpp
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ import QtPositioning
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import org.kde.neochat.libneochat
|
||||
import org.kde.neochat
|
||||
|
||||
Kirigami.Page {
|
||||
id: root
|
||||
|
||||
@@ -79,7 +79,7 @@ QQC2.ScrollView {
|
||||
id: searchButton
|
||||
visible: !root.room.isSpace
|
||||
icon.name: "search"
|
||||
text: i18n("Search in this room")
|
||||
text: i18nc("@action:button", "Search Messages")
|
||||
activeFocusOnTab: true
|
||||
|
||||
Layout.fillWidth: true
|
||||
@@ -107,7 +107,7 @@ QQC2.ScrollView {
|
||||
id: favouriteButton
|
||||
visible: !root.room.isSpace
|
||||
icon.name: root.room && root.room.isFavourite ? "rating" : "rating-unrated"
|
||||
text: root.room && root.room.isFavourite ? i18n("Remove room from favorites") : i18n("Favorite this room")
|
||||
text: root.room && root.room.isFavourite ? i18nc("@action:button", "Remove from Favorites") : i18nc("@action:button", "Add to Favorites")
|
||||
|
||||
onClicked: root.room.isFavourite ? root.room.removeTag("m.favourite") : root.room.addTag("m.favourite", 1.0)
|
||||
|
||||
@@ -116,11 +116,27 @@ QQC2.ScrollView {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Delegates.RoundedItemDelegate {
|
||||
id: widgetsButton
|
||||
visible: !root.room.isSpace
|
||||
icon.name: "extension-symbolic"
|
||||
text: i18nc("@action:button", "Extensions")
|
||||
activeFocusOnTab: true
|
||||
|
||||
onClicked: ((QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'WidgetsPage'), {
|
||||
room: root.room
|
||||
}, {
|
||||
title: i18nc("@title:window", "Extensions")
|
||||
})
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Delegates.RoundedItemDelegate {
|
||||
id: locationsButton
|
||||
visible: !root.room.isSpace
|
||||
icon.name: "map-flat"
|
||||
text: i18n("Show locations for this room")
|
||||
text: i18nc("@action:button", "Shared Locations")
|
||||
activeFocusOnTab: true
|
||||
|
||||
onClicked: ((QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'LocationsPage'), {
|
||||
@@ -136,7 +152,7 @@ QQC2.ScrollView {
|
||||
id: pinnedMessagesButton
|
||||
visible: !root.room.isSpace
|
||||
icon.name: "pin-symbolic"
|
||||
text: i18nc("@action:button", "Pinned messages")
|
||||
text: i18nc("@action:button", "Pinned Messages")
|
||||
activeFocusOnTab: true
|
||||
|
||||
Layout.fillWidth: true
|
||||
@@ -150,10 +166,29 @@ QQC2.ScrollView {
|
||||
}
|
||||
}
|
||||
|
||||
Delegates.RoundedItemDelegate {
|
||||
text: i18nc("@action:inmenu", "Inspect Room Data")
|
||||
icon.name: "tools"
|
||||
visible: NeoChatConfig.developerTools
|
||||
activeFocusOnTab: true
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
onClicked: ((QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), {
|
||||
connection: root.room.connection,
|
||||
currentTabIndex: 1, // Room data tab
|
||||
room: root.room
|
||||
}, {
|
||||
title: i18nc("@title:window", "Developer Tools"),
|
||||
width: Kirigami.Units.gridUnit * 50,
|
||||
height: Kirigami.Units.gridUnit * 42
|
||||
})
|
||||
}
|
||||
|
||||
Delegates.RoundedItemDelegate {
|
||||
id: leaveButton
|
||||
icon.name: "arrow-left-symbolic"
|
||||
text: root.room.isSpace ? i18nc("@action:button", "Leave this space…") : i18nc("@action:button", "Leave this room…")
|
||||
text: root.room.isSpace ? i18nc("@action:button", "Leave Space…") : i18nc("@action:button", "Leave Room…")
|
||||
activeFocusOnTab: true
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
75
src/roominfo/WidgetsPage.qml
Normal file
75
src/roominfo/WidgetsPage.qml
Normal file
@@ -0,0 +1,75 @@
|
||||
// SPDX-FileCopyrightText: 2025 Arno Rehn <arno@arnorehn.de>
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.delegates as Delegates
|
||||
|
||||
import org.kde.neochat.libneochat
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: root
|
||||
|
||||
required property NeoChatRoom room
|
||||
|
||||
title: i18nc("@title", "Extensions")
|
||||
|
||||
ListView {
|
||||
id: extView
|
||||
|
||||
currentIndex: -1
|
||||
|
||||
Kirigami.PlaceholderMessage {
|
||||
anchors.centerIn: parent
|
||||
text: i18nc("@placeholder", "This room does not use any extensions")
|
||||
visible: extView.count === 0
|
||||
}
|
||||
|
||||
model: WidgetModel {
|
||||
id: widgetModel
|
||||
room: root.room
|
||||
}
|
||||
|
||||
delegate: Delegates.RoundedItemDelegate {
|
||||
id: del
|
||||
|
||||
required text
|
||||
required property url url
|
||||
required property string type
|
||||
required property int index
|
||||
|
||||
// Can we actually use the jitsi logo without being infringing any
|
||||
// trademarks?
|
||||
icon.name: type === "jitsi" ? "meeting-attending"
|
||||
: type === "m.etherpad" ? "document-share"
|
||||
: ""
|
||||
icon.width: Kirigami.Units.iconSizes.smallMedium
|
||||
icon.height: Kirigami.Units.iconSizes.smallMedium
|
||||
|
||||
contentItem: RowLayout {
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
Delegates.SubtitleContentItem {
|
||||
Layout.fillWidth: true
|
||||
|
||||
iconItem.visible: true
|
||||
itemDelegate: del
|
||||
subtitle: del.url
|
||||
labelItem.textFormat: Text.PlainText
|
||||
}
|
||||
|
||||
QQC2.ToolButton {
|
||||
action: Kirigami.Action {
|
||||
icon.name: "delete-symbolic"
|
||||
tooltip: i18nc("@action:button", "Remove widget")
|
||||
onTriggered: widgetModel.removeWidget(del.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: Qt.openUrlExternally(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,10 +46,6 @@ RowLayout {
|
||||
onClicked: root.search();
|
||||
icon.name: "search"
|
||||
text: i18nc("@action", "Search Rooms")
|
||||
Shortcut {
|
||||
sequence: "Ctrl+F"
|
||||
onActivated: searchButton.clicked()
|
||||
}
|
||||
|
||||
QQC2.ToolTip.visible: hovered
|
||||
QQC2.ToolTip.text: text
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user