Compare commits

...

67 Commits

Author SHA1 Message Date
l10n daemon script
ebd38fb435 GIT_SILENT Sync po/docbooks with svn 2024-11-14 03:10:10 +00:00
l10n daemon script
a5b999e682 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-11-14 03:06:40 +00:00
l10n daemon script
41d34fc0e4 GIT_SILENT Sync po/docbooks with svn 2024-11-13 03:08:49 +00:00
l10n daemon script
b51194f90f SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-11-13 03:05:22 +00:00
l10n daemon script
80ac9e1ba7 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-11-12 03:11:52 +00:00
l10n daemon script
e3874c824a GIT_SILENT Sync po/docbooks with svn 2024-11-11 03:23:01 +00:00
l10n daemon script
6599c6b609 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-11-11 03:15:47 +00:00
l10n daemon script
13d522221c GIT_SILENT made messages (after extraction) 2024-11-11 02:40:16 +00:00
Joshua Goins
dd8f926f32 PollHandler: Make sure it's not constructible from QML
(cherry picked from commit d6b780762e)
2024-11-10 10:29:26 -05:00
Joshua Goins
258312e798 PollHandler: Ensure that m_pollStartEvent is always initialized to null
Otherwise it may be undefined, and we DO create default-constructed
PollHandler. For example, one is used as a fallback poll object
in NeoChatRoom::poll.

This is blind fix for a pretty nasty poll-related crash we saw a few
months ago.

BUG: 493649
(cherry picked from commit 5ef66b5cf6)
2024-11-10 10:29:17 -05:00
Joshua Goins
43d40c7e75 Add m.room.create state events to sync_response
In case we need to access the creation state in an appium test in the
future.

(cherry picked from commit 85ee5084b6)
2024-11-10 07:40:41 -05:00
Joshua Goins
cbcc9a6514 Hide rooms that have a defined room type
I have a room with a custom type that's only for holding data, and
doesn't need to be shown in the room list. Currently the spec is a bit
vague about what clients should do, but hiding them is probably fine
for now.

(cherry picked from commit bb9ce117de)
2024-11-10 07:40:41 -05:00
l10n daemon script
625048610b GIT_SILENT Sync po/docbooks with svn 2024-11-10 03:30:48 +00:00
l10n daemon script
fa47b67e3d SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-11-10 03:16:42 +00:00
Carl Schwan
9347a66acf RoomGeneralPage: Add missing separator
And some other minor fixes

(cherry picked from commit 00c5aa26bb)
2024-11-09 18:12:25 -05:00
Joshua Goins
317df56ffa Make closing link previews instant, as it should be
We were missing a endResetModel() call, now with it added the removal
happens instantly.

(cherry picked from commit bae4de227c)
2024-11-09 18:12:25 -05:00
Joshua Goins
fed9197716 Stop being able to crash NeoChat by pressing a button repeatedly
If you spam click the "Close link preview" button, it's possible to
crash NeoChat. This is because the index check is wrong for the array
size.

It's possible to even do this due to a bug causing the removal to be
reflected visually too slowly, that's fixed in the next commit.

(cherry picked from commit 253f891c5a)
2024-11-09 18:12:25 -05:00
Joshua Goins
1e892599e9 Improve clicking link previews
First of all, clicking on them actually works - because we were missing
an import for RoomManager. Secondly, we use a dedicated TapHandler
since onLinkActivated sucks. We want to be able to click anywhere on the
preview to go to the website/room anyway.

(cherry picked from commit 6966159062)
2024-11-09 18:12:25 -05:00
Joshua Goins
b7229ca0cf Don't set isThread on the message and file delegate context menus
It doesn't have a property called isThread, and I don't know where it
went - if it ever existed?

(cherry picked from commit 07d3b80c3e)
2024-11-09 18:12:25 -05:00
Joshua Goins
953b711823 Make fullscreen images focused when they're opened
Otherwise keyboard shortcuts don't work until you tap the image, which
makes no sense.

BUG: 484322
(cherry picked from commit a41d0f3214)
2024-11-09 18:12:25 -05:00
Joshua Goins
01d903efd3 Fix viewing any kind of data in developer tools
Fix pageStack being undefined, so we're able to view event data again.

(cherry picked from commit 1ee15de78b)
2024-11-09 18:12:25 -05:00
Carl Schwan
241dd81932 Update checkbox of PollComponent
Use FormCheckDelegate instead of a CheckBox inside a RowLayout. This
increase the click area particularly on mobile.

(cherry picked from commit b044358970)
2024-11-09 18:12:24 -05:00
Oliver Beard
f6dfe0cbcf timeline: Round separators for replies and link previews
(cherry picked from commit d2e11bb3bb)
2024-11-09 18:12:24 -05:00
Joshua Goins
f10b97139c README: Change snap store badge to the one from apps.kde.org
It seems CORS is blocking access to the badge, but we have rehosted on
apps.kde.org.

(cherry picked from commit a55bac899c)
2024-11-09 18:12:24 -05:00
Joshua Goins
385c5b3405 Update network proxy page with the improved version from Tokodon
This functions the same, but looks a bit nicer.

(cherry picked from commit c2380fb8df)
2024-11-09 16:28:47 -05:00
Joshua Goins
7bc6f906f8 Update desktop file and app description to match AppStream data
This was updated to "Chat on Matrix" but in other places it was never
switched from "Matrix client" and the like. Now it should be more
consistent.

(cherry picked from commit f31c644b13)
2024-11-09 16:28:47 -05:00
Joshua Goins
b8b1434a95 Clarify that sorting rooms by activity isn't the only thing it does
Recently, it also sorts rooms based on unread notification count and
importance. This adds a clarification to the setting so users (like me)
aren't confused why it isn't sorting only by activity.

(cherry picked from commit 26cd621d0e)
2024-11-09 16:28:47 -05:00
l10n daemon script
85c7a4bcb3 GIT_SILENT Sync po/docbooks with svn 2024-11-09 03:10:22 +00:00
Albert Astals Cid
84b698a7e8 GIT_SILENT Upgrade release service version to 24.11.80. 2024-11-08 19:06:28 +01:00
l10n daemon script
7b249e9fa6 GIT_SILENT Sync po/docbooks with svn 2024-11-08 01:30:13 +00:00
l10n daemon script
46593ef68f GIT_SILENT Sync po/docbooks with svn 2024-11-07 01:31:11 +00:00
Eren Karakas
b70f73c7d6 Make send message and insert newline shortcuts configurable
Currently both Enter and Ctrl+Enter send the message in ChatBar on
desktop. This might be unexpected behavior to users coming from other
chat applications (eg. WhatsApp, Telegram, Element) as those send
with Enter only by default. They allow changing send to Ctrl+Enter
in settings and other option is used to insert a newline.

BUG: 476758
2024-11-06 21:09:58 +00:00
l10n daemon script
ece5e34fa2 GIT_SILENT Sync po/docbooks with svn 2024-11-06 01:31:11 +00:00
Joshua Goins
74b400288d ManualRoomDialog: Use Window.window attached property
This fixes a runtime error since applicationWindow is undefined.
2024-11-05 16:45:37 +00:00
Joshua Goins
83f19b0631 ExploreRoomsPage: Fix "Enter a room address" button not working
This was due to an undefined applicationWindow singleton, but we don't
actually need it and can use Overlay.overlay directly.
2024-11-05 16:45:37 +00:00
l10n daemon script
c905d2d6fb GIT_SILENT Sync po/docbooks with svn 2024-11-05 01:30:46 +00:00
l10n daemon script
d0c1eb2f04 GIT_SILENT Sync po/docbooks with svn 2024-11-04 01:28:25 +00:00
Tobias Fella
d7d9d29c1d Remove no longer needed ifdefs 2024-11-03 18:42:56 +01:00
Tobias Fella
2a3f019ec6 Port away from Quotient::Omittable 2024-11-03 18:26:46 +01:00
Tobias Fella
d384d50b0d Remove olm target check
Olm isn't option in libQuotient anymore, there's no point in checking
2024-11-03 18:21:19 +01:00
Tobias Fella
be8cb12bba Require libQuotient 0.9 2024-11-03 17:48:40 +01:00
l10n daemon script
a1aa2918be GIT_SILENT Sync po/docbooks with svn 2024-11-03 01:27:04 +00:00
l10n daemon script
d7536bccb3 GIT_SILENT Sync po/docbooks with svn 2024-11-02 01:29:54 +00:00
l10n daemon script
6b677355e1 GIT_SILENT made messages (after extraction) 2024-11-02 00:39:52 +00:00
James Graham
85d625f6ac Delete ActionsHandler
Move the fucntionality of ActionsHandler into ChatbarCache and ActionsModel.

At this stage there wasn't much left that is was doing and the functionality could easily move.
2024-11-01 17:00:08 +00:00
l10n daemon script
f5d6f87afe GIT_SILENT Sync po/docbooks with svn 2024-11-01 01:29:19 +00:00
Joshua Goins
31d755f407 ManualRoomDialog: Change title of the dialog to reduce duplication
"Room ID or Alias" is duplicated twice here, once in the dialog title
and a second time as the label for the text field. Let's change it to a
more suitable name "Manually Enter a Room".
2024-10-30 22:25:53 -04:00
Joshua Goins
ebfc20d4b4 ExploreRoomsPage: Add better text to the "Enter a room address" button
This adds a short explanatory label to the "Enter a room address" button
in this list, in case the user does not know where to find their room
address.

Also changes the name of the button to "Enter a Room Manually" to refer
that you can enter aliases here as well.
2024-10-30 22:24:20 -04:00
l10n daemon script
b83d42103f GIT_SILENT Sync po/docbooks with svn 2024-10-31 01:30:42 +00:00
Heiko Becker
c9856347fe GIT_SILENT Update Appstream for new release
(cherry picked from commit 4b7011fe14)
2024-10-31 01:14:26 +01:00
l10n daemon script
7224c92caf SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-10-30 01:23:46 +00:00
l10n daemon script
a84f98c96f GIT_SILENT made messages (after extraction) 2024-10-30 00:39:47 +00:00
l10n daemon script
a40bccc29d GIT_SILENT Sync po/docbooks with svn 2024-10-28 01:33:27 +00:00
l10n daemon script
171897161c GIT_SILENT made messages (after extraction) 2024-10-28 00:40:09 +00:00
l10n daemon script
013ad49e2b GIT_SILENT Sync po/docbooks with svn 2024-10-27 01:34:19 +00:00
l10n daemon script
b357586164 GIT_SILENT made messages (after extraction) 2024-10-27 00:40:08 +00:00
James Graham
5642f3416a Pester Network Error Messages
Stop sending a pester message using showPassiveNotification every time there is a network error. There is already a proper handling with `isOnline` in `NeochatConnection`. This just causes issues overlapping content.

BUG: 488572
2024-10-26 12:28:28 +00:00
l10n daemon script
9bbb1710df GIT_SILENT made messages (after extraction) 2024-10-26 00:40:19 +00:00
l10n daemon script
e2b7679252 GIT_SILENT Sync po/docbooks with svn 2024-10-25 01:30:33 +00:00
l10n daemon script
5c353cd4b5 GIT_SILENT made messages (after extraction) 2024-10-25 00:40:01 +00:00
l10n daemon script
cba6dc994f GIT_SILENT Sync po/docbooks with svn 2024-10-24 01:29:20 +00:00
l10n daemon script
b0c4b7fc2a GIT_SILENT made messages (after extraction) 2024-10-24 00:39:47 +00:00
James Graham
ed7aff1f24 Updates for further event content changes
Adapt to https://github.com/quotient-im/libQuotient/pull/812
2024-10-23 16:38:51 +00:00
l10n daemon script
33f4be0d88 GIT_SILENT made messages (after extraction) 2024-10-23 00:40:25 +00:00
l10n daemon script
1178cafef0 GIT_SILENT made messages (after extraction) 2024-10-22 00:39:47 +00:00
l10n daemon script
1be97e65b4 GIT_SILENT Sync po/docbooks with svn 2024-10-21 01:30:29 +00:00
Carl Schwan
634cefc694 Simplify appstream summary
- matrix -> Matrix
- Remove "with your friends" as NeoChat is not only about chatting with
  your friend

CCBUG: 480167
2024-10-20 23:33:48 +00:00
112 changed files with 14428 additions and 14278 deletions

View File

@@ -110,7 +110,7 @@
{ {
"type": "git", "type": "git",
"url": "https://github.com/quotient-im/libQuotient.git", "url": "https://github.com/quotient-im/libQuotient.git",
"branch": "0.8.x", "branch": "dev",
"disable-submodules": true "disable-submodules": true
} }
], ],

View File

@@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.16)
# KDE Applications version, managed by release script. # KDE Applications version, managed by release script.
set(RELEASE_SERVICE_VERSION_MAJOR "24") set(RELEASE_SERVICE_VERSION_MAJOR "24")
set(RELEASE_SERVICE_VERSION_MINOR "11") 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}") set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
project(NeoChat VERSION ${RELEASE_SERVICE_VERSION}) project(NeoChat VERSION ${RELEASE_SERVICE_VERSION})
@@ -107,7 +107,7 @@ if (NOT ANDROID AND NOT WIN32 AND NOT APPLE AND NOT HAIKU)
find_package(KF6DBusAddons ${KF_MIN_VERSION} REQUIRED) find_package(KF6DBusAddons ${KF_MIN_VERSION} REQUIRED)
endif() endif()
find_package(QuotientQt6 0.8.2) find_package(QuotientQt6 0.9)
set_package_properties(QuotientQt6 PROPERTIES set_package_properties(QuotientQt6 PROPERTIES
TYPE REQUIRED TYPE REQUIRED
DESCRIPTION "Qt wrapper around Matrix API" DESCRIPTION "Qt wrapper around Matrix API"
@@ -115,11 +115,6 @@ set_package_properties(QuotientQt6 PROPERTIES
PURPOSE "Talk with matrix server" PURPOSE "Talk with matrix server"
) )
if (NOT TARGET Olm::Olm)
message(FATAL_ERROR "NeoChat requires Quotient with the E2EE feature enabled")
endif()
find_package(cmark) find_package(cmark)
set_package_properties(cmark PROPERTIES set_package_properties(cmark PROPERTIES
TYPE REQUIRED TYPE REQUIRED

View File

@@ -11,7 +11,7 @@ A Qt/QML based Matrix client.
<a href='https://matrix.org'><img src='https://matrix.org/docs/legacy/made-for-matrix.png' alt='Made for Matrix' height=64 target=_blank /></a> <a href='https://matrix.org'><img src='https://matrix.org/docs/legacy/made-for-matrix.png' alt='Made for Matrix' height=64 target=_blank /></a>
<a href='https://flathub.org/apps/details/org.kde.neochat'><img width='190px' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-i-en.png'/></a> <a href='https://flathub.org/apps/details/org.kde.neochat'><img width='190px' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-i-en.png'/></a>
<a href='https://snapcraft.io/neochat'><img width='190px' alt='Download on the Snap Store' src='https://snapcraft.io/static/images/badges/en/snap-store-black.svg'/></a> <a href='https://snapcraft.io/neochat'><img width='190px' alt='Download on the Snap Store' src='https://apps.kde.org/store_badges/snapstore/en.svg'/></a>
## Introduction ## Introduction

View File

@@ -5,6 +5,26 @@
"!room_id_1234:localhost:1234": { "!room_id_1234:localhost:1234": {
"state": { "state": {
"events": [ "events": [
{
"content": {
"m.federate": true,
"predecessor": {
"event_id": "$something:example.org",
"room_id": "!oldroom:example.org"
},
"room_version": "11"
},
"event_id": "$143273582443PhrSn:example.org",
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
"sender": "@example:example.org",
"state_key": "",
"type": "m.room.create",
"unsigned": {
"age": 1234,
"membership": "join"
}
},
{ {
"type": "m.room.member", "type": "m.room.member",
"state_key": "@user:localhost:1234", "state_key": "@user:localhost:1234",
@@ -26,6 +46,26 @@
}, },
"timeline": { "timeline": {
"events": [ "events": [
{
"content": {
"m.federate": true,
"predecessor": {
"event_id": "$something:example.org",
"room_id": "!oldroom:example.org"
},
"room_version": "11"
},
"event_id": "$143273582443PhrSn:example.org",
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
"sender": "@example:example.org",
"state_key": "",
"type": "m.room.create",
"unsigned": {
"age": 1234,
"membership": "join"
}
},
{ {
"type": "m.room.message", "type": "m.room.message",
"sender": "@user:localhost:1234", "sender": "@user:localhost:1234",

View File

@@ -53,12 +53,6 @@ ecm_add_test(
TEST_NAME messageeventmodeltest TEST_NAME messageeventmodeltest
) )
ecm_add_test(
actionshandlertest.cpp
LINK_LIBRARIES neochat Qt::Test
TEST_NAME actionshandlertest
)
ecm_add_test( ecm_add_test(
windowcontrollertest.cpp windowcontrollertest.cpp
LINK_LIBRARIES neochat Qt::Test LINK_LIBRARIES neochat Qt::Test

View File

@@ -1,41 +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
#include <QTest>
#include "actionshandler.h"
#include "chatbarcache.h"
#include "testutils.h"
class ActionsHandlerTest : public QObject
{
Q_OBJECT
private:
Quotient::Connection *connection = Quotient::Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
private Q_SLOTS:
void nullObject();
};
void ActionsHandlerTest::nullObject()
{
QTest::ignoreMessage(QtWarningMsg, "ActionsHandler::handleMessageEvent - called with m_room and/or chatBarCache set to nullptr.");
ActionsHandler::handleMessageEvent(nullptr, nullptr);
auto chatBarCache = new ChatBarCache(this);
QTest::ignoreMessage(QtWarningMsg, "ActionsHandler::handleMessageEvent - called with m_room and/or chatBarCache set to nullptr.");
ActionsHandler::handleMessageEvent(nullptr, chatBarCache);
auto room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"));
QTest::ignoreMessage(QtWarningMsg, "ActionsHandler::handleMessageEvent - called with m_room and/or chatBarCache set to nullptr.");
ActionsHandler::handleMessageEvent(room, nullptr);
// The final one should throw no warning so we make sure.
QTest::failOnWarning("ActionsHandler::handleMessageEvent - called with m_room and/or chatBarCache set to nullptr.");
ActionsHandler::handleMessageEvent(room, chatBarCache);
}
QTEST_GUILESS_MAIN(ActionsHandlerTest)
#include "actionshandlertest.moc"

View File

@@ -50,38 +50,27 @@
<name xml:lang="x-test">xxNeoChatxx</name> <name xml:lang="x-test">xxNeoChatxx</name>
<name xml:lang="zh-CN">NeoChat</name> <name xml:lang="zh-CN">NeoChat</name>
<name xml:lang="zh-TW">NeoChat</name> <name xml:lang="zh-TW">NeoChat</name>
<summary>Chat with your friends on matrix</summary> <summary>Chat on Matrix</summary>
<summary xml:lang="ar">دردش مع أصدقائك على ماتركس</summary> <summary xml:lang="ar">دردش على ماتركس</summary>
<summary xml:lang="ca">Xategeu amb els vostres amics a Matrix</summary> <summary xml:lang="ca">Xat a Matrix</summary>
<summary xml:lang="ca-valencia">Xategeu amb els vostres amics a Matrix</summary> <summary xml:lang="ca-valencia">Xat a Matrix</summary>
<summary xml:lang="cs">Mluvte se svými přáteli na Matrixu</summary> <summary xml:lang="en-GB">Chat on Matrix</summary>
<summary xml:lang="de">Mit den Freunden auf Matrix unterhalten</summary> <summary xml:lang="es">Charle en Matrix</summary>
<summary xml:lang="el">Συνομιλήστε με τους φίλους σας στο matrix</summary> <summary xml:lang="eu">Berriketa Matrix-en</summary>
<summary xml:lang="en-GB">Chat with your friends on matrix</summary> <summary xml:lang="fr">Discuter sur Matrix</summary>
<summary xml:lang="eo">Babilu kun viaj amikoj sur matrix</summary> <summary xml:lang="gl">Charlar en Matrix</summary>
<summary xml:lang="es">Charle con sus amigos en matrix</summary> <summary xml:lang="ia">Conversation en ditecto sur Matrix</summary>
<summary xml:lang="eu">Berriketan jardun zure lagunekin «Matrix»en</summary> <summary xml:lang="it">Chat su Matrix</summary>
<summary xml:lang="fi">Keskustelu ystäviesi kanssa Matrixissa</summary> <summary xml:lang="ka">ისაუბრეთ Matrix-ზე</summary>
<summary xml:lang="fr">Discuter avec vos ami(e)s sur le réseau Matrix</summary> <summary xml:lang="nl">Chat op Matrix</summary>
<summary xml:lang="gl">Charle coas súas amizades en Matrix.</summary> <summary xml:lang="nn">Prat med via Matrix</summary>
<summary xml:lang="he">התכתבות עם החברים שלך ב־matrix</summary> <summary xml:lang="pl">Rozmawiaj na Matriksie</summary>
<summary xml:lang="hu">Csevegjen barátaival a matrixon</summary> <summary xml:lang="sl">Klepet na Matrixu</summary>
<summary xml:lang="ia">Starta Conversation con tu amicos sur matrix</summary> <summary xml:lang="ta">மேட்ரிக்ஸுக்கான உரையாடல் செயலி</summary>
<summary xml:lang="it">Conversa con i tuoi contatti su matrix</summary> <summary xml:lang="tr">Matrix Üzerinde Sohbet</summary>
<summary xml:lang="ka">ესაუბრეთ მეგობრებს Matrix-ზე</summary> <summary xml:lang="uk">Спілкування у Matrix</summary>
<summary xml:lang="ko">Matrix를 사용하여 친구들과 대화하기</summary> <summary xml:lang="x-test">xxChat on Matrixxx</summary>
<summary xml:lang="lv">Tērzējiet ar saviem draugiem „Matrix“ tīklā</summary> <summary xml:lang="zh-TW">在 Matrix 上聊天</summary>
<summary xml:lang="nl">Met uw vrienden chatten op matrix</summary>
<summary xml:lang="nn">Prat med vennar på Matrix</summary>
<summary xml:lang="pl">Rozmawiaj ze swoimi znajomymi w Matriksie</summary>
<summary xml:lang="sl">Klepet z vašimi prijatelji na matrixu</summary>
<summary xml:lang="sv">Chatta med dina vänner på Matrix</summary>
<summary xml:lang="ta">மேட்ரிக்ஸு மூலம் உங்கள் நண்பர்களிடம் பேசலாம்</summary>
<summary xml:lang="tr">Matrixte arkadaşlarınızla sohbet edin</summary>
<summary xml:lang="uk">Спілкуйтеся з вашими друзями у matrix</summary>
<summary xml:lang="x-test">xxChat with your friends on matrixxx</summary>
<summary xml:lang="zh-CN">在 Matrix 上与朋友聊天</summary>
<summary xml:lang="zh-TW">在 Matrix 上與您的朋友聊天</summary>
<description> <description>
<p>NeoChat is a chat app that lets you take full advantage of the Matrix network. It provides you with a secure way to send text messages, videos and audio files to your family, colleagues and friends.</p> <p>NeoChat is a chat app that lets you take full advantage of the Matrix network. It provides you with a secure way to send text messages, videos and audio files to your family, colleagues and friends.</p>
<p xml:lang="ar">نيوتشات هو تطبيق دردشة يتيح لك الاستفادة الكاملة من شبكة Matrix. فهو يوفر لك طريقة آمنة لإرسال الرسائل النصية ومقاطع الفيديو والملفات الصوتية إلى عائلتك وزملائك وأصدقائك.</p> <p xml:lang="ar">نيوتشات هو تطبيق دردشة يتيح لك الاستفادة الكاملة من شبكة Matrix. فهو يوفر لك طريقة آمنة لإرسال الرسائل النصية ومقاطع الفيديو والملفات الصوتية إلى عائلتك وزملائك وأصدقائك.</p>
@@ -105,6 +94,7 @@
<p xml:lang="nl">NeoChat is een chat-toepassing die u het volledige voordeel van het Matrix-netwerk laat genieten. Het levert u op een veilige manier tekstberichten, video's en geluidsbestanden naar uw familie, collega's en vrienden te verzenden.</p> <p xml:lang="nl">NeoChat is een chat-toepassing die u het volledige voordeel van het Matrix-netwerk laat genieten. Het levert u op een veilige manier tekstberichten, video's en geluidsbestanden naar uw familie, collega's en vrienden te verzenden.</p>
<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="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="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="ru">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> <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>
<p xml:lang="sv">NeoChat är ett chattprogram som låter dig dra full nytta av Matrix-nätverket. Det ger dig ett säkert sätt att skicka textmeddelanden, videor och ljudfiler till din familj, kollegor och vänner.</p> <p xml:lang="sv">NeoChat är ett chattprogram som låter dig dra full nytta av Matrix-nätverket. Det ger dig ett säkert sätt att skicka textmeddelanden, videor och ljudfiler till din familj, kollegor och vänner.</p>
<p xml:lang="tr">NeoChat, Matrix ağının tüm özelliklerini kullanan bir sohbet uygulamasıdır. Ailenize, arkadaşlarınıza ve iş arkadaşlarınıza metin iletileri, ses ve video dosyaları göndermenin kolay bir yolunu sunar.</p> <p xml:lang="tr">NeoChat, Matrix ağının tüm özelliklerini kullanan bir sohbet uygulamasıdır. Ailenize, arkadaşlarınıza ve iş arkadaşlarınıza metin iletileri, ses ve video dosyaları göndermenin kolay bir yolunu sunar.</p>
@@ -198,6 +188,7 @@
<li xml:lang="nn">Avstemmingar  MSC3381</li> <li xml:lang="nn">Avstemmingar  MSC3381</li>
<li xml:lang="pl">Ankiety - MSC3381</li> <li xml:lang="pl">Ankiety - MSC3381</li>
<li xml:lang="pt">Inquéritos - MSC3381</li> <li xml:lang="pt">Inquéritos - MSC3381</li>
<li xml:lang="ru">Голосования — MSC3381</li>
<li xml:lang="sl">Polls - MSC3381</li> <li xml:lang="sl">Polls - MSC3381</li>
<li xml:lang="sv">Polls - MSC3381</li> <li xml:lang="sv">Polls - MSC3381</li>
<li xml:lang="ta">வாக்கெடுப்புகள் - MSC3381</li> <li xml:lang="ta">வாக்கெடுப்புகள் - MSC3381</li>
@@ -358,8 +349,10 @@
<caption xml:lang="nl">Ontdek nieuwe gemeenschappen met Matrix-ruimten</caption> <caption xml:lang="nl">Ontdek nieuwe gemeenschappen met Matrix-ruimten</caption>
<caption xml:lang="nn">Oppdag nye fellesskap med Matrix Spaces</caption> <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="pl">Odkrywaj nowe społeczności w Przestrzeniach Matriksa</caption>
<caption xml:lang="ru">Поиск новых сообществ с помощью Matrix Spaces</caption>
<caption xml:lang="sl">Odkrijte nove skupnosti z Matrix Spaces</caption> <caption xml:lang="sl">Odkrijte nove skupnosti z Matrix Spaces</caption>
<caption xml:lang="sv">Upptäck nya gemenskaper med Matrix Spaces</caption> <caption xml:lang="sv">Upptäck nya gemenskaper med Matrix Spaces</caption>
<caption xml:lang="ta">மேட்ரிக்ஸு இடங்களின் மூலம் புதிய சமூகங்களைக் கண்டுபிடிக்கலாம்</caption>
<caption xml:lang="tr">Matrix Alanlar ile yeni topluluklar keşfedin</caption> <caption xml:lang="tr">Matrix Alanlar ile yeni topluluklar keşfedin</caption>
<caption xml:lang="uk">Пошук нових спільнот за допомогою Matrix Spaces</caption> <caption xml:lang="uk">Пошук нових спільнот за допомогою Matrix Spaces</caption>
<caption xml:lang="x-test">xxDiscover new communities with Matrix Spacesxx</caption> <caption xml:lang="x-test">xxDiscover new communities with Matrix Spacesxx</caption>
@@ -448,6 +441,7 @@
<content_attribute id="social-chat">intense</content_attribute> <content_attribute id="social-chat">intense</content_attribute>
</content_rating> </content_rating>
<releases> <releases>
<release version="24.08.3" date="2024-11-07"/>
<release version="24.08.2" date="2024-10-10"/> <release version="24.08.2" date="2024-10-10"/>
<release version="24.08.1" date="2024-09-12"/> <release version="24.08.1" date="2024-09-12"/>
<release version="24.08.0" date="2024-08-22"/> <release version="24.08.0" date="2024-08-22"/>

View File

@@ -87,47 +87,19 @@ GenericName[uk]=Клієнт Matrix
GenericName[x-test]=xxMatrix Clientxx GenericName[x-test]=xxMatrix Clientxx
GenericName[zh_CN]=Matrix 客户端 GenericName[zh_CN]=Matrix 客户端
GenericName[zh_TW]=Matrix 用戶端 GenericName[zh_TW]=Matrix 用戶端
Comment=Client for the Matrix protocol Comment=Chat on Matrix
Comment[ar]=عميل لميفاق ماتركس Comment[ca]=Xat a Matrix
Comment[az]=Matrix protokolu üçün müştəri Comment[ca@valencia]=Xat a Matrix
Comment[ca]=Client per al protocol Matrix Comment[es]=Chat en Matrix
Comment[ca@valencia]=Client per al protocol Matrix Comment[eu]=Berriketa Matrix-en
Comment[de]=Programm für das Matrix-Protokoll Comment[fr]=Clavarder sur Matrix
Comment[el]=Πελάτης για το πρωτόκολλο Matrix Comment[gl]=Charle en Matrix
Comment[en_GB]=Client for the Matrix protocol Comment[hu]=Csevegés Matrixon
Comment[eo]=Kliento por la Matrix-protokolo Comment[it]= su Matrix
Comment[es]=Cliente para el protocolo Matrix Comment[pl]=Rozmawiaj na Matriksie
Comment[eu]=Matrix protokolorako bezeroa Comment[sl]=Klepet na Matrixu
Comment[fi]=Asiakas Matrix-yhteyskäytännölle Comment[tr]=Matrix Üzerinde Sohbet Et
Comment[fr]=Client pour le protocole « Matrix » Comment[uk]=Спілкування у Matrix
Comment[gl]=Cliente para o protocolo Matrix.
Comment[he]=לקוח לפרוטוקול Matrix
Comment[hu]=Kliens a Matrix protokollhoz
Comment[ia]=Cliente per le protocollo de Matrix
Comment[id]=Klien untuk protokol Matrix
Comment[ie]=Un cliente del protocol Matrix
Comment[it]=Client per il protocollo Matrix
Comment[ka]=კლიენტი Matrix-ის პროტოკოლისთვის
Comment[ko]=Matrix 프로토콜용 클라이언트
Comment[lt]=Matrix protokolo kliento programa
Comment[lv]=Klients „Matrix“ protokolam
Comment[nl]=Client voor het Matrix-protocol
Comment[nn]=Klient for Matrix-protokollen
Comment[pa]=ਮੈਟਰਿਕਸ ਪਰੋਟੋਕਾਲ ਲਈ ਕਲਾਈਂਟ ਹੈ
Comment[pl]=Program obsługi protokołu Matriksa
Comment[pt]=Cliente para o protocolo Matrix
Comment[pt_BR]=Cliente para o protocolo Matrix
Comment[ro]=Client pentru protocolul Matrix
Comment[ru]=Клиент для протокола Matrix
Comment[sk]=Klient protokolu Matrix
Comment[sl]=Odjemalec za protokol Matrix
Comment[sv]=Klient för protokollet Matrix
Comment[ta]=Matrix நெறிமுறைக்கான வாங்கி
Comment[tr]=Matrix protokolü için istemci
Comment[uk]=Клієнт протоколу Matrix
Comment[x-test]=xxClient for the Matrix protocolxx
Comment[zh_CN]=为 Matrix 协议打造的客户端
Comment[zh_TW]=Matrix 通訊協定的用戶端
MimeType=x-scheme-handler/matrix; MimeType=x-scheme-handler/matrix;
Exec=neochat %u Exec=neochat %u
Terminal=false Terminal=false

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

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

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

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

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

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

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

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

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

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

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

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

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

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

View File

@@ -92,7 +92,7 @@ parts:
- olm - olm
- qtkeychain - qtkeychain
source: https://github.com/quotient-im/libQuotient.git source: https://github.com/quotient-im/libQuotient.git
source-tag: 0.8.2 source-tag: 0.9.0
source-depth: 1 source-depth: 1
plugin: cmake plugin: cmake
build-packages: build-packages:

View File

@@ -10,8 +10,6 @@ endif()
add_library(neochat STATIC add_library(neochat STATIC
controller.cpp controller.cpp
controller.h controller.h
actionshandler.cpp
actionshandler.h
models/emojimodel.cpp models/emojimodel.cpp
models/emojimodel.h models/emojimodel.h
emojitones.cpp emojitones.cpp

View File

@@ -1,140 +0,0 @@
// SPDX-FileCopyrightText: 2020 Carl Schwan <carlschwan@kde.org>
// SPDX-FileCopyrightText: 2024 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#include "actionshandler.h"
#include "chatbarcache.h"
#include "models/actionsmodel.h"
#include "neochatconfig.h"
#include "texthandler.h"
using namespace Quotient;
using namespace Qt::StringLiterals;
void ActionsHandler::handleMessageEvent(NeoChatRoom *room, ChatBarCache *chatBarCache)
{
if (room == nullptr || chatBarCache == nullptr) {
qWarning() << "ActionsHandler::handleMessageEvent - called with m_room and/or chatBarCache set to nullptr.";
return;
}
if (!chatBarCache->attachmentPath().isEmpty()) {
QUrl url(chatBarCache->attachmentPath());
auto path = url.isLocalFile() ? url.toLocalFile() : url.toString();
room->uploadFile(QUrl(path), chatBarCache->text().isEmpty() ? path.mid(path.lastIndexOf(u'/') + 1) : chatBarCache->text());
chatBarCache->setAttachmentPath({});
chatBarCache->setText({});
return;
}
const auto handledText = handleMentions(chatBarCache);
const auto result = handleQuickEdit(room, handledText);
if (!result) {
handleMessage(room, handledText, chatBarCache);
}
}
QString ActionsHandler::handleMentions(ChatBarCache *chatBarCache)
{
const auto mentions = chatBarCache->mentions();
std::sort(mentions->begin(), mentions->end(), [](const auto &a, const auto &b) -> bool {
return a.cursor.anchor() > b.cursor.anchor();
});
auto handledText = chatBarCache->text();
for (const auto &mention : *mentions) {
if (mention.text.isEmpty() || mention.id.isEmpty()) {
continue;
}
handledText = handledText.replace(mention.cursor.anchor(),
mention.cursor.position() - mention.cursor.anchor(),
QStringLiteral("[%1](https://matrix.to/#/%2)").arg(mention.text.toHtmlEscaped(), mention.id));
}
mentions->clear();
return handledText;
}
bool ActionsHandler::handleQuickEdit(NeoChatRoom *room, const QString &handledText)
{
if (room == nullptr) {
return false;
}
if (NeoChatConfig::allowQuickEdit()) {
QRegularExpression sed(QStringLiteral("^s/([^/]*)/([^/]*)(/g)?$"));
auto match = sed.match(handledText);
if (match.hasMatch()) {
const QString regex = match.captured(1);
const QString replacement = match.captured(2).toHtmlEscaped();
const QString flags = match.captured(3);
for (auto it = room->messageEvents().crbegin(); it != room->messageEvents().crend(); it++) {
if (const auto event = eventCast<const RoomMessageEvent>(&**it)) {
if (event->senderId() == room->localMember().id() && event->hasTextContent()) {
QString originalString;
if (event->content()) {
#if Quotient_VERSION_MINOR > 8
originalString = static_cast<const Quotient::EventContent::TextContent *>(event->content().get())->body;
#else
originalString = static_cast<const Quotient::EventContent::TextContent *>(event->content())->body;
#endif
} else {
originalString = event->plainBody();
}
if (flags == "/g"_L1) {
room->postHtmlMessage(handledText, originalString.replace(regex, replacement), event->msgtype(), {}, event->id());
} else {
room->postHtmlMessage(handledText,
originalString.replace(originalString.indexOf(regex), regex.size(), replacement),
event->msgtype(),
{},
event->id());
}
return true;
}
}
}
}
}
return false;
}
void ActionsHandler::handleMessage(NeoChatRoom *room, QString handledText, ChatBarCache *chatBarCache)
{
if (room == nullptr) {
return;
}
auto messageType = RoomMessageEvent::MsgType::Text;
if (handledText.startsWith(QLatin1Char('/'))) {
for (const auto &action : ActionsModel::instance().allActions()) {
if (handledText.indexOf(action.prefix) == 1
&& (handledText.indexOf(" "_ls) == action.prefix.length() + 1 || handledText.length() == action.prefix.length() + 1)) {
handledText = action.handle(handledText.mid(action.prefix.length() + 1).trimmed(), room, chatBarCache);
if (action.messageType.has_value()) {
messageType = *action.messageType;
}
if (action.messageAction) {
break;
} else {
return;
}
}
}
}
TextHandler textHandler;
textHandler.setData(handledText);
handledText = textHandler.handleSendText();
if (handledText.length() == 0) {
return;
}
room->postMessage(chatBarCache->text(), handledText, messageType, chatBarCache->replyId(), chatBarCache->editId(), chatBarCache->threadId());
}
#include "moc_actionshandler.cpp"

View File

@@ -1,43 +0,0 @@
// SPDX-FileCopyrightText: 2020 Carl Schwan <carlschwan@kde.org>
// SPDX-FileCopyrightText: 2024 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QString>
class ChatBarCache;
class NeoChatRoom;
/**
* @class ActionsHandler
*
* This class contains functions to handle chat messages ready for posting to a room.
*
* Everything that needs to be done to prepare the message for posting in a room
* including:
* - File handling
* - User mentions
* - Quick edits
* - Chat actions
* - Custom emojis
*
* @note A chat action is a message starting with /, resulting in something other
* than a normal message being sent (e.g. /me, /join).
*
* @sa ActionsModel, NeoChatRoom
*/
class ActionsHandler
{
public:
/**
* @brief Pre-process text and send message event.
*/
static void handleMessageEvent(NeoChatRoom *room, ChatBarCache *chatBarCache);
private:
static QString handleMentions(ChatBarCache *chatBarCache);
static bool handleQuickEdit(NeoChatRoom *room, const QString &handledText);
static void handleMessage(NeoChatRoom *room, QString handledText, ChatBarCache *chatBarCache);
};

View File

@@ -251,20 +251,22 @@ QQC2.Control {
} }
} }
Keys.onEnterPressed: event => { Keys.onEnterPressed: event => {
const controlIsPressed = event.modifiers & Qt.ControlModifier;
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.complete(); completionMenu.complete();
} else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile) { } else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile || NeoChatConfig.sendMessageWith === 1 && !controlIsPressed || NeoChatConfig.sendMessageWith === 0 && controlIsPressed) {
textField.insert(cursorPosition, "\n"); textField.insert(cursorPosition, "\n");
} else { } else if (NeoChatConfig.sendMessageWith === 0 && !controlIsPressed || NeoChatConfig.sendMessageWith === 1 && controlIsPressed) {
_private.postMessage(); _private.postMessage();
} }
} }
Keys.onReturnPressed: event => { Keys.onReturnPressed: event => {
const controlIsPressed = event.modifiers & Qt.ControlModifier;
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.complete(); completionMenu.complete();
} else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile) { } else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile || NeoChatConfig.sendMessageWith === 1 && !controlIsPressed || NeoChatConfig.sendMessageWith === 0 && controlIsPressed) {
textField.insert(cursorPosition, "\n"); textField.insert(cursorPosition, "\n");
} else { } else if (NeoChatConfig.sendMessageWith === 0 && !controlIsPressed || NeoChatConfig.sendMessageWith === 1 && controlIsPressed) {
_private.postMessage(); _private.postMessage();
} }
} }
@@ -405,7 +407,6 @@ QQC2.Control {
repeatTimer.stop(); repeatTimer.stop();
root.currentRoom.markAllMessagesAsRead(); root.currentRoom.markAllMessagesAsRead();
textField.clear(); textField.clear();
_private.chatBarCache.clearRelations();
messageSent(); messageSent();
} }

View File

@@ -5,10 +5,11 @@
#include <Quotient/roommember.h> #include <Quotient/roommember.h>
#include "actionshandler.h"
#include "chatdocumenthandler.h" #include "chatdocumenthandler.h"
#include "eventhandler.h" #include "eventhandler.h"
#include "models/actionsmodel.h"
#include "neochatroom.h" #include "neochatroom.h"
#include "texthandler.h"
ChatBarCache::ChatBarCache(QObject *parent) ChatBarCache::ChatBarCache(QObject *parent)
: QObject(parent) : QObject(parent)
@@ -29,6 +30,37 @@ void ChatBarCache::setText(const QString &text)
Q_EMIT textChanged(); Q_EMIT textChanged();
} }
QString ChatBarCache::sendText() const
{
if (!attachmentPath().isEmpty()) {
QUrl url(attachmentPath());
auto path = url.isLocalFile() ? url.toLocalFile() : url.toString();
return text().isEmpty() ? path.mid(path.lastIndexOf(u'/') + 1) : text();
}
return formatMentions();
}
QString ChatBarCache::formatMentions() const
{
auto mentions = m_mentions;
std::sort(mentions.begin(), mentions.end(), [](const auto &a, const auto &b) {
return a.cursor.anchor() > b.cursor.anchor();
});
auto formattedText = text();
for (const auto &mention : mentions) {
if (mention.text.isEmpty() || mention.id.isEmpty()) {
continue;
}
formattedText = formattedText.replace(mention.cursor.anchor(),
mention.cursor.position() - mention.cursor.anchor(),
QStringLiteral("[%1](https://matrix.to/#/%2)").arg(mention.text.toHtmlEscaped(), mention.id));
}
return formattedText;
}
bool ChatBarCache::isReplying() const bool ChatBarCache::isReplying() const
{ {
return m_relationType == Reply && !m_relationId.isEmpty(); return m_relationType == Reply && !m_relationId.isEmpty();
@@ -268,7 +300,35 @@ void ChatBarCache::postMessage()
return; return;
} }
ActionsHandler::handleMessageEvent(room, this); if (!attachmentPath().isEmpty()) {
room->uploadFile(QUrl(attachmentPath()), sendText());
clearCache();
return;
}
const auto result = ActionsModel::handleAction(room, this);
if (!result.first.has_value()) {
return;
}
TextHandler textHandler;
textHandler.setData(*std::get<std::optional<QString>>(result));
const auto sendText = textHandler.handleSendText();
if (sendText.length() == 0) {
return;
}
room->postMessage(text(), sendText, *std::get<std::optional<Quotient::RoomMessageEvent::MsgType>>(result), replyId(), editId(), threadId());
clearCache();
}
void ChatBarCache::clearCache()
{
setText({});
m_mentions.clear();
m_savedText = QString();
clearRelations();
} }
#include "moc_chatbarcache.cpp" #include "moc_chatbarcache.cpp"

View File

@@ -153,6 +153,7 @@ public:
explicit ChatBarCache(QObject *parent = nullptr); explicit ChatBarCache(QObject *parent = nullptr);
QString text() const; QString text() const;
QString sendText() const;
void setText(const QString &text); void setText(const QString &text);
bool isReplying() const; bool isReplying() const;
@@ -215,6 +216,8 @@ Q_SIGNALS:
private: private:
QString m_text = QString(); QString m_text = QString();
QString formatMentions() const;
QString m_relationId = QString(); QString m_relationId = QString();
RelationType m_relationType = RelationType::None; RelationType m_relationType = RelationType::None;
QString m_threadId = QString(); QString m_threadId = QString();
@@ -223,4 +226,6 @@ private:
QString m_savedText; QString m_savedText;
QPointer<MessageContentModel> m_relationContentModel; QPointer<MessageContentModel> m_relationContentModel;
void clearCache();
}; };

View File

@@ -63,11 +63,7 @@ Controller::Controller(QObject *parent)
}); });
} else { } else {
auto c = new NeoChatConnection(this); auto c = new NeoChatConnection(this);
#if Quotient_VERSION_MINOR > 8
c->assumeIdentity(QStringLiteral("@user:localhost:1234"), QStringLiteral("device_1234"), QStringLiteral("token_1234")); c->assumeIdentity(QStringLiteral("@user:localhost:1234"), QStringLiteral("device_1234"), QStringLiteral("token_1234"));
#else
c->assumeIdentity(QStringLiteral("@user:localhost:1234"), QStringLiteral("token_1234"));
#endif
connect(c, &Connection::connected, this, [c, this]() { connect(c, &Connection::connected, this, [c, this]() {
m_accountRegistry.add(c); m_accountRegistry.add(c);
c->syncLoop(); c->syncLoop();
@@ -230,14 +226,7 @@ void Controller::invokeLogin()
Qt::SingleShotConnection); Qt::SingleShotConnection);
} }
}); });
connect(connection, &NeoChatConnection::networkError, this, [this](const QString &error, const QString &, int, int) {
Q_EMIT errorOccured(i18n("Network Error: %1", error));
});
#if Quotient_VERSION_MINOR > 8
connection->assumeIdentity(account.userId(), account.deviceId(), accessToken); connection->assumeIdentity(account.userId(), account.deviceId(), accessToken);
#else
connection->assumeIdentity(account.userId(), accessToken);
#endif
}); });
} }
} }
@@ -444,11 +433,7 @@ void Controller::removeConnection(const QString &userId)
bool Controller::csSupported() const bool Controller::csSupported() const
{ {
#if Quotient_VERSION_MINOR > 8
return true; return true;
#else
return false;
#endif
} }
void Controller::revertToDefaultConfig() void Controller::revertToDefaultConfig()

View File

@@ -4,6 +4,7 @@
import QtQuick import QtQuick
import QtQuick.Controls as QQC2 import QtQuick.Controls as QQC2
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard import org.kde.kirigamiaddons.formcard as FormCard
@@ -23,7 +24,7 @@ ColumnLayout {
model: root.connection.accountDataEventTypes model: root.connection.accountDataEventTypes
delegate: FormCard.FormButtonDelegate { delegate: FormCard.FormButtonDelegate {
text: modelData text: modelData
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), { onClicked: root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
sourceText: root.connection.accountDataJsonString(modelData) sourceText: root.connection.accountDataJsonString(modelData)
}, { }, {
title: i18nc("@title:window", "Event Source"), title: i18nc("@title:window", "Event Source"),

View File

@@ -3,6 +3,7 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard import org.kde.kirigamiaddons.formcard as FormCard
@@ -47,7 +48,7 @@ ColumnLayout {
model: root.room.accountDataEventTypes model: root.room.accountDataEventTypes
delegate: FormCard.FormButtonDelegate { delegate: FormCard.FormButtonDelegate {
text: modelData text: modelData
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), { onClicked: root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
sourceText: root.room.roomAcountDataJson(text) sourceText: root.room.roomAcountDataJson(text)
}, { }, {
title: i18n("Event Source"), title: i18n("Event Source"),
@@ -77,7 +78,7 @@ ColumnLayout {
if (model.eventCount === 1) { if (model.eventCount === 1) {
openEventSource(model.type, model.stateKey); openEventSource(model.type, model.stateKey);
} else { } else {
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'StateKeys'), { root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'StateKeys'), {
room: root.room, room: root.room,
eventType: model.type eventType: model.type
}, { }, {
@@ -89,7 +90,7 @@ ColumnLayout {
} }
} }
function openEventSource(type: string, stateKey: string): void { function openEventSource(type: string, stateKey: string): void {
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), { onClicked: root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
model: stateModel, model: stateModel,
allowEdit: true, allowEdit: true,
room: root.room, room: root.room,

View File

@@ -225,14 +225,10 @@ QString EventHandler::rawMessageBody(const Quotient::RoomMessageEvent &event)
{ {
QString body; QString body;
if (event.hasFileContent()) { if (event.has<EventContent::FileContent>()) {
// if filename is given or body is equal to filename, // if filename is given or body is equal to filename,
// then body is a caption // then body is a caption
#if Quotient_VERSION_MINOR > 8 QString filename = event.get<EventContent::FileContent>()->originalName;
QString filename = event.fileContent()->originalName;
#else
QString filename = event.content()->fileInfo()->originalName;
#endif
QString body = event.plainBody(); QString body = event.plainBody();
if (filename.isEmpty() || filename == body) { if (filename.isEmpty() || filename == body) {
return QString(); return QString();
@@ -240,12 +236,8 @@ QString EventHandler::rawMessageBody(const Quotient::RoomMessageEvent &event)
return body; return body;
} }
if (event.hasTextContent() && event.content()) { if (event.has<EventContent::TextContent>() && event.content()) {
#if Quotient_VERSION_MINOR > 8 body = event.get<EventContent::TextContent>()->body;
body = event.richTextContent()->body;
#else
body = static_cast<const EventContent::TextContent *>(event.content())->body;
#endif
} else { } else {
body = event.plainBody(); body = event.plainBody();
} }
@@ -472,12 +464,8 @@ QString EventHandler::getMessageBody(const NeoChatRoom *room, const RoomMessageE
{ {
TextHandler textHandler; TextHandler textHandler;
if (event.hasFileContent()) { if (event.has<EventContent::FileContent>()) {
#if Quotient_VERSION_MINOR > 8 QString fileCaption = event.get<EventContent::FileContent>()->originalName;
QString fileCaption = event.fileContent()->originalName;
#else
QString fileCaption = event.content()->fileInfo()->originalName;
#endif
if (fileCaption.isEmpty()) { if (fileCaption.isEmpty()) {
fileCaption = event.plainBody(); fileCaption = event.plainBody();
} else if (fileCaption != event.plainBody()) { } else if (fileCaption != event.plainBody()) {
@@ -488,12 +476,8 @@ QString EventHandler::getMessageBody(const NeoChatRoom *room, const RoomMessageE
} }
QString body; QString body;
if (event.hasTextContent() && event.content()) { if (event.has<EventContent::TextContent>() && event.content()) {
#if Quotient_VERSION_MINOR > 8 body = event.get<EventContent::TextContent>()->body;
body = event.richTextContent()->body;
#else
body = static_cast<const EventContent::TextContent *>(event.content())->body;
#endif
} else { } else {
body = event.plainBody(); body = event.plainBody();
} }
@@ -708,25 +692,15 @@ QVariantMap EventHandler::getMediaInfoForEvent(const NeoChatRoom *room, const Qu
// Get the file info for the event. // Get the file info for the event.
if (event->is<RoomMessageEvent>()) { if (event->is<RoomMessageEvent>()) {
auto roomMessageEvent = eventCast<const RoomMessageEvent>(event); auto roomMessageEvent = eventCast<const RoomMessageEvent>(event);
if (!roomMessageEvent->hasFileContent()) { if (!roomMessageEvent->has<EventContent::FileContentBase>()) {
return {}; return {};
} }
#if Quotient_VERSION_MINOR > 8 const auto content = roomMessageEvent->get<EventContent::FileContentBase>();
const auto content = roomMessageEvent->content(); QVariantMap mediaInfo = getMediaInfoFromFileInfo(room, content.get(), eventId, false, false);
QVariantMap mediaInfo = getMediaInfoFromFileInfo(room, static_cast<EventContent::FileContent *>(content.get()), eventId, false, false);
#else
const auto content = static_cast<const EventContent::FileContent *>(roomMessageEvent->content());
QVariantMap mediaInfo = getMediaInfoFromFileInfo(room, content, eventId, false, false);
#endif
// if filename isn't specifically given, it is in body // if filename isn't specifically given, it is in body
// https://spec.matrix.org/latest/client-server-api/#mfile // https://spec.matrix.org/latest/client-server-api/#mfile
#if Quotient_VERSION_MINOR > 8 mediaInfo["filename"_ls] = content->commonInfo().originalName.isEmpty() ? roomMessageEvent->plainBody() : content->commonInfo().originalName;
mediaInfo["filename"_ls] =
(roomMessageEvent->fileContent()->originalName.isEmpty()) ? roomMessageEvent->plainBody() : roomMessageEvent->fileContent()->originalName;
#else
mediaInfo["filename"_ls] = (content->fileInfo()->originalName.isEmpty()) ? roomMessageEvent->plainBody() : content->fileInfo()->originalName;
#endif
return mediaInfo; return mediaInfo;
} else if (event->is<StickerEvent>()) { } else if (event->is<StickerEvent>()) {
@@ -740,11 +714,7 @@ QVariantMap EventHandler::getMediaInfoForEvent(const NeoChatRoom *room, const Qu
} }
QVariantMap EventHandler::getMediaInfoFromFileInfo(const NeoChatRoom *room, QVariantMap EventHandler::getMediaInfoFromFileInfo(const NeoChatRoom *room,
#if Quotient_VERSION_MINOR > 8
const Quotient::EventContent::FileContentBase *fileContent, const Quotient::EventContent::FileContentBase *fileContent,
#else
const Quotient::EventContent::TypedBase *fileContent,
#endif
const QString &eventId, const QString &eventId,
bool isThumbnail, bool isThumbnail,
bool isSticker) bool isSticker)
@@ -752,18 +722,10 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const NeoChatRoom *room,
QVariantMap mediaInfo; QVariantMap mediaInfo;
// Get the mxc URL for the media. // Get the mxc URL for the media.
#if Quotient_VERSION_MINOR > 8
if (!fileContent->url().isValid() || fileContent->url().scheme() != QStringLiteral("mxc") || eventId.isEmpty()) { if (!fileContent->url().isValid() || fileContent->url().scheme() != QStringLiteral("mxc") || eventId.isEmpty()) {
#else
if (!fileContent->fileInfo()->url().isValid() || fileContent->fileInfo()->url().scheme() != QStringLiteral("mxc") || eventId.isEmpty()) {
#endif
mediaInfo["source"_ls] = QUrl(); mediaInfo["source"_ls] = QUrl();
} else { } else {
#if Quotient_VERSION_MINOR > 8
QUrl source = room->makeMediaUrl(eventId, fileContent->url()); QUrl source = room->makeMediaUrl(eventId, fileContent->url());
#else
QUrl source = room->makeMediaUrl(eventId, fileContent->fileInfo()->url());
#endif
if (source.isValid()) { if (source.isValid()) {
mediaInfo["source"_ls] = source; mediaInfo["source"_ls] = source;
@@ -780,25 +742,15 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const NeoChatRoom *room,
mediaInfo["mimeIcon"_ls] = mimeType.iconName(); mediaInfo["mimeIcon"_ls] = mimeType.iconName();
// Add media size if available. // Add media size if available.
#if Quotient_VERSION_MINOR > 8 mediaInfo["size"_ls] = fileContent->commonInfo().payloadSize;
mediaInfo["size"_ls] = static_cast<const EventContent::FileContent *>(fileContent)->payloadSize;
#else
mediaInfo["size"_ls] = static_cast<const EventContent::FileContent *>(fileContent)->fileInfo()->payloadSize;
#endif
mediaInfo["isSticker"_ls] = isSticker; mediaInfo["isSticker"_ls] = isSticker;
// Add parameter depending on media type. // Add parameter depending on media type.
if (mimeType.name().contains(QStringLiteral("image"))) { if (mimeType.name().contains(QStringLiteral("image"))) {
if (auto castInfo = static_cast<const EventContent::ImageContent *>(fileContent)) { if (auto castInfo = static_cast<const EventContent::ImageContent *>(fileContent)) {
#if Quotient_VERSION_MINOR > 8
mediaInfo["width"_ls] = castInfo->imageSize.width(); mediaInfo["width"_ls] = castInfo->imageSize.width();
mediaInfo["height"_ls] = castInfo->imageSize.height(); mediaInfo["height"_ls] = castInfo->imageSize.height();
#else
const auto imageInfo = static_cast<const EventContent::ImageInfo *>(castInfo->fileInfo());
mediaInfo["width"_ls] = imageInfo->imageSize.width();
mediaInfo["height"_ls] = imageInfo->imageSize.height();
#endif
// TODO: Images in certain formats (e.g. WebP) will be erroneously marked as animated, even if they are static. // TODO: Images in certain formats (e.g. WebP) will be erroneously marked as animated, even if they are static.
mediaInfo["animated"_ls] = QMovie::supportedFormats().contains(mimeType.preferredSuffix().toUtf8()); mediaInfo["animated"_ls] = QMovie::supportedFormats().contains(mimeType.preferredSuffix().toUtf8());

View File

@@ -290,11 +290,7 @@ private:
static QVariantMap getMediaInfoForEvent(const NeoChatRoom *room, const Quotient::RoomEvent *event); static QVariantMap getMediaInfoForEvent(const NeoChatRoom *room, const Quotient::RoomEvent *event);
QVariantMap static getMediaInfoFromFileInfo(const NeoChatRoom *room, QVariantMap static getMediaInfoFromFileInfo(const NeoChatRoom *room,
#if Quotient_VERSION_MINOR > 8
const Quotient::EventContent::FileContentBase *fileContent, const Quotient::EventContent::FileContentBase *fileContent,
#else
const Quotient::EventContent::TypedBase *fileContent,
#endif
const QString &eventId, const QString &eventId,
bool isThumbnail = false, bool isThumbnail = false,
bool isSticker = false); bool isSticker = false);

View File

@@ -3,7 +3,6 @@
#include "imagepackevent.h" #include "imagepackevent.h"
#include <QJsonObject> #include <QJsonObject>
#include <Quotient/omittable.h>
using namespace Quotient; using namespace Quotient;
@@ -11,10 +10,10 @@ ImagePackEventContent::ImagePackEventContent(const QJsonObject &json)
{ {
if (json.contains(QStringLiteral("pack"))) { if (json.contains(QStringLiteral("pack"))) {
pack = ImagePackEventContent::Pack{ pack = ImagePackEventContent::Pack{
fromJson<Omittable<QString>>(json["pack"_ls].toObject()["display_name"_ls]), fromJson<std::optional<QString>>(json["pack"_ls].toObject()["display_name"_ls]),
fromJson<Omittable<QUrl>>(json["pack"_ls].toObject()["avatar_url"_ls]), fromJson<std::optional<QUrl>>(json["pack"_ls].toObject()["avatar_url"_ls]),
fromJson<Omittable<QStringList>>(json["pack"_ls].toObject()["usage"_ls]), fromJson<std::optional<QStringList>>(json["pack"_ls].toObject()["usage"_ls]),
fromJson<Omittable<QString>>(json["pack"_ls].toObject()["attribution"_ls]), fromJson<std::optional<QString>>(json["pack"_ls].toObject()["attribution"_ls]),
}; };
} else { } else {
pack = std::nullopt; pack = std::nullopt;
@@ -31,9 +30,9 @@ ImagePackEventContent::ImagePackEventContent(const QJsonObject &json)
images += ImagePackImage{ images += ImagePackImage{
k, k,
fromJson<QUrl>(json["images"_ls][k]["url"_ls].toString()), fromJson<QUrl>(json["images"_ls][k]["url"_ls].toString()),
fromJson<Omittable<QString>>(json["images"_ls][k]["body"_ls]), fromJson<std::optional<QString>>(json["images"_ls][k]["body"_ls]),
info, info,
fromJson<Omittable<QStringList>>(json["images"_ls][k]["usage"_ls]), fromJson<std::optional<QStringList>>(json["images"_ls][k]["usage"_ls]),
}; };
} }
} }

View File

@@ -7,13 +7,10 @@
#include <Quotient/accountregistry.h> #include <Quotient/accountregistry.h>
#include <Quotient/e2ee/sssshandler.h> #include <Quotient/e2ee/sssshandler.h>
#include <Quotient/keyimport.h>
#include <Quotient/keyverificationsession.h> #include <Quotient/keyverificationsession.h>
#include <Quotient/roommember.h> #include <Quotient/roommember.h>
#if Quotient_VERSION_MINOR > 8
#include <Quotient/keyimport.h>
#endif
#include "controller.h" #include "controller.h"
#include "neochatconfig.h" #include "neochatconfig.h"
@@ -43,11 +40,9 @@ struct ForeignSSSSHandler {
QML_NAMED_ELEMENT(SSSSHandler) QML_NAMED_ELEMENT(SSSSHandler)
}; };
#if Quotient_VERSION_MINOR > 8
struct ForeignKeyImport { struct ForeignKeyImport {
Q_GADGET Q_GADGET
QML_SINGLETON QML_SINGLETON
QML_FOREIGN(Quotient::KeyImport) QML_FOREIGN(Quotient::KeyImport)
QML_NAMED_ELEMENT(KeyImport) QML_NAMED_ELEMENT(KeyImport)
}; };
#endif

View File

@@ -5,7 +5,7 @@
using namespace Quotient; using namespace Quotient;
NeochatAdd3PIdJob::NeochatAdd3PIdJob(const QString &clientSecret, const QString &sid, const Omittable<QJsonObject> &auth) NeochatAdd3PIdJob::NeochatAdd3PIdJob(const QString &clientSecret, const QString &sid, const std::optional<QJsonObject> &auth)
: BaseJob(HttpVerb::Post, QStringLiteral("Add3PIDJob"), makePath("/_matrix/client/v3", "/account/3pid/add")) : BaseJob(HttpVerb::Post, QStringLiteral("Add3PIDJob"), makePath("/_matrix/client/v3", "/account/3pid/add"))
{ {
QJsonObject _dataJson; QJsonObject _dataJson;

View File

@@ -4,10 +4,9 @@
#pragma once #pragma once
#include <Quotient/jobs/basejob.h> #include <Quotient/jobs/basejob.h>
#include <Quotient/omittable.h>
class NeochatAdd3PIdJob : public Quotient::BaseJob class NeochatAdd3PIdJob : public Quotient::BaseJob
{ {
public: public:
explicit NeochatAdd3PIdJob(const QString &clientSecret, const QString &sid, const Quotient::Omittable<QJsonObject> &auth = {}); explicit NeochatAdd3PIdJob(const QString &clientSecret, const QString &sid, const std::optional<QJsonObject> &auth = {});
}; };

View File

@@ -5,7 +5,7 @@
using namespace Quotient; using namespace Quotient;
NeochatChangePasswordJob::NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Omittable<QJsonObject> &auth) NeochatChangePasswordJob::NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const std::optional<QJsonObject> &auth)
: BaseJob(HttpVerb::Post, QStringLiteral("ChangePasswordJob"), "/_matrix/client/r0/account/password") : BaseJob(HttpVerb::Post, QStringLiteral("ChangePasswordJob"), "/_matrix/client/r0/account/password")
{ {
QJsonObject _data; QJsonObject _data;

View File

@@ -5,10 +5,8 @@
#include <Quotient/jobs/basejob.h> #include <Quotient/jobs/basejob.h>
#include <Quotient/omittable.h>
class NeochatChangePasswordJob : public Quotient::BaseJob class NeochatChangePasswordJob : public Quotient::BaseJob
{ {
public: public:
explicit NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const Quotient::Omittable<QJsonObject> &auth = {}); explicit NeochatChangePasswordJob(const QString &newPassword, bool logoutDevices, const std::optional<QJsonObject> &auth = {});
}; };

View File

@@ -5,7 +5,7 @@
using namespace Quotient; using namespace Quotient;
NeoChatDeactivateAccountJob::NeoChatDeactivateAccountJob(const Omittable<QJsonObject> &auth) NeoChatDeactivateAccountJob::NeoChatDeactivateAccountJob(const std::optional<QJsonObject> &auth)
: BaseJob(HttpVerb::Post, QStringLiteral("DisableDeviceJob"), "_matrix/client/v3/account/deactivate") : BaseJob(HttpVerb::Post, QStringLiteral("DisableDeviceJob"), "_matrix/client/v3/account/deactivate")
{ {
QJsonObject data; QJsonObject data;

View File

@@ -4,10 +4,9 @@
#pragma once #pragma once
#include <Quotient/jobs/basejob.h> #include <Quotient/jobs/basejob.h>
#include <Quotient/omittable.h>
class NeoChatDeactivateAccountJob : public Quotient::BaseJob class NeoChatDeactivateAccountJob : public Quotient::BaseJob
{ {
public: public:
explicit NeoChatDeactivateAccountJob(const Quotient::Omittable<QJsonObject> &auth = {}); explicit NeoChatDeactivateAccountJob(const std::optional<QJsonObject> &auth = {});
}; };

View File

@@ -5,7 +5,7 @@
using namespace Quotient; using namespace Quotient;
NeochatDeleteDeviceJob::NeochatDeleteDeviceJob(const QString &deviceId, const Omittable<QJsonObject> &auth) NeochatDeleteDeviceJob::NeochatDeleteDeviceJob(const QString &deviceId, const std::optional<QJsonObject> &auth)
: BaseJob(HttpVerb::Delete, QStringLiteral("DeleteDeviceJob"), QStringLiteral("/_matrix/client/r0/devices/%1").arg(deviceId).toLatin1()) : BaseJob(HttpVerb::Delete, QStringLiteral("DeleteDeviceJob"), QStringLiteral("/_matrix/client/r0/devices/%1").arg(deviceId).toLatin1())
{ {
QJsonObject _data; QJsonObject _data;

View File

@@ -4,10 +4,9 @@
#pragma once #pragma once
#include <Quotient/jobs/basejob.h> #include <Quotient/jobs/basejob.h>
#include <Quotient/omittable.h>
class NeochatDeleteDeviceJob : public Quotient::BaseJob class NeochatDeleteDeviceJob : public Quotient::BaseJob
{ {
public: public:
explicit NeochatDeleteDeviceJob(const QString &deviceId, const Quotient::Omittable<QJsonObject> &auth = {}); explicit NeochatDeleteDeviceJob(const QString &deviceId, const std::optional<QJsonObject> &auth = {});
}; };

View File

@@ -4,7 +4,6 @@
#pragma once #pragma once
#include <Quotient/jobs/basejob.h> #include <Quotient/jobs/basejob.h>
#include <Quotient/omittable.h>
// TODO: Upstream to libQuotient // TODO: Upstream to libQuotient
class NeochatGetCommonRoomsJob : public Quotient::BaseJob class NeochatGetCommonRoomsJob : public Quotient::BaseJob

View File

@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
KAboutData about(QStringLiteral("neochat"), KAboutData about(QStringLiteral("neochat"),
i18n("NeoChat"), i18n("NeoChat"),
QStringLiteral(NEOCHAT_VERSION_STRING), QStringLiteral(NEOCHAT_VERSION_STRING),
i18n("Matrix client"), i18n("Chat on Matrix"),
KAboutLicense::GPL_V3, KAboutLicense::GPL_V3,
i18n("© 2018-2020 Black Hat, 2020-2024 KDE Community")); i18n("© 2018-2020 Black Hat, 2020-2024 KDE Community"));
about.addAuthor(i18n("Carl Schwan"), about.addAuthor(i18n("Carl Schwan"),

View File

@@ -163,11 +163,7 @@ void AccountEmoticonModel::setEmoticonImage(int index, const QUrl &source)
QCoro::Task<void> AccountEmoticonModel::doSetEmoticonImage(int index, QUrl source) QCoro::Task<void> AccountEmoticonModel::doSetEmoticonImage(int index, QUrl source)
{ {
auto job = m_connection->uploadFile(source.isLocalFile() ? source.toLocalFile() : source.toString()); auto job = m_connection->uploadFile(source.isLocalFile() ? source.toLocalFile() : source.toString());
#if Quotient_VERSION_MINOR > 8
co_await qCoro(job.get(), &BaseJob::finished); co_await qCoro(job.get(), &BaseJob::finished);
#else
co_await qCoro(job, &BaseJob::finished);
#endif
if (job->error() != BaseJob::NoError) { if (job->error() != BaseJob::NoError) {
co_return; co_return;
} }
@@ -189,11 +185,7 @@ QCoro::Task<void> AccountEmoticonModel::doSetEmoticonImage(int index, QUrl sourc
QCoro::Task<void> AccountEmoticonModel::doAddEmoticon(QUrl source, QString shortcode, QString description, QString type) QCoro::Task<void> AccountEmoticonModel::doAddEmoticon(QUrl source, QString shortcode, QString description, QString type)
{ {
auto job = m_connection->uploadFile(source.isLocalFile() ? source.toLocalFile() : source.toString()); auto job = m_connection->uploadFile(source.isLocalFile() ? source.toLocalFile() : source.toString());
#if Quotient_VERSION_MINOR > 8
co_await qCoro(job.get(), &BaseJob::finished); co_await qCoro(job.get(), &BaseJob::finished);
#else
co_await qCoro(job, &BaseJob::finished);
#endif
if (job->error() != BaseJob::NoError) { if (job->error() != BaseJob::NoError) {
co_return; co_return;
} }

View File

@@ -5,9 +5,11 @@
#include "chatbarcache.h" #include "chatbarcache.h"
#include "enums/messagetype.h" #include "enums/messagetype.h"
#include "neochatconfig.h"
#include "neochatconnection.h" #include "neochatconnection.h"
#include "neochatroom.h" #include "neochatroom.h"
#include "roommanager.h" #include "roommanager.h"
#include <Quotient/events/eventcontent.h>
#include <Quotient/events/roommemberevent.h> #include <Quotient/events/roommemberevent.h>
#include <Quotient/events/roompowerlevelsevent.h> #include <Quotient/events/roompowerlevelsevent.h>
#include <Quotient/user.h> #include <Quotient/user.h>
@@ -16,6 +18,7 @@
using Action = ActionsModel::Action; using Action = ActionsModel::Action;
using namespace Quotient; using namespace Quotient;
using namespace Qt::StringLiterals;
QStringList rainbowColors{"#ff2b00"_ls, "#ff5500"_ls, "#ff8000"_ls, "#ffaa00"_ls, "#ffd500"_ls, "#ffff00"_ls, "#d4ff00"_ls, "#aaff00"_ls, "#80ff00"_ls, QStringList rainbowColors{"#ff2b00"_ls, "#ff5500"_ls, "#ff8000"_ls, "#ffaa00"_ls, "#ffd500"_ls, "#ffff00"_ls, "#d4ff00"_ls, "#aaff00"_ls, "#80ff00"_ls,
"#55ff00"_ls, "#2bff00"_ls, "#00ff00"_ls, "#00ff2b"_ls, "#00ff55"_ls, "#00ff80"_ls, "#00ffaa"_ls, "#00ffd5"_ls, "#00ffff"_ls, "#55ff00"_ls, "#2bff00"_ls, "#00ff00"_ls, "#00ff2b"_ls, "#00ff55"_ls, "#00ff80"_ls, "#00ffaa"_ls, "#00ffd5"_ls, "#00ffff"_ls,
@@ -573,3 +576,73 @@ QList<Action> &ActionsModel::allActions() const
{ {
return actions; return actions;
} }
bool ActionsModel::handleQuickEditAction(NeoChatRoom *room, const QString &messageText)
{
if (room == nullptr) {
return false;
}
if (NeoChatConfig::allowQuickEdit()) {
QRegularExpression sed(QStringLiteral("^s/([^/]*)/([^/]*)(/g)?$"));
auto match = sed.match(messageText);
if (match.hasMatch()) {
const QString regex = match.captured(1);
const QString replacement = match.captured(2).toHtmlEscaped();
const QString flags = match.captured(3);
for (auto it = room->messageEvents().crbegin(); it != room->messageEvents().crend(); it++) {
if (const auto event = eventCast<const RoomMessageEvent>(&**it)) {
if (event->senderId() == room->localMember().id() && event->has<EventContent::TextContent>()) {
QString originalString;
if (event->content()) {
originalString = static_cast<const Quotient::EventContent::TextContent *>(event->content().get())->body;
} else {
originalString = event->plainBody();
}
if (flags == "/g"_L1) {
room->postHtmlMessage(messageText, originalString.replace(regex, replacement), event->msgtype(), {}, event->id());
} else {
room->postHtmlMessage(messageText,
originalString.replace(originalString.indexOf(regex), regex.size(), replacement),
event->msgtype(),
{},
event->id());
}
return true;
}
}
}
}
}
return false;
}
std::pair<std::optional<QString>, std::optional<Quotient::RoomMessageEvent::MsgType>> ActionsModel::handleAction(NeoChatRoom *room, ChatBarCache *chatBarCache)
{
auto sendText = chatBarCache->sendText();
const auto edited = handleQuickEditAction(room, sendText);
if (edited) {
return std::make_pair(std::nullopt, std::nullopt);
}
std::optional<Quotient::RoomMessageEvent::MsgType> messageType = std::nullopt;
if (sendText.startsWith(QLatin1Char('/'))) {
for (const auto &action : ActionsModel::instance().allActions()) {
if (sendText.indexOf(action.prefix) == 1
&& (sendText.indexOf(" "_ls) == action.prefix.length() + 1 || sendText.length() == action.prefix.length() + 1)) {
sendText = action.handle(sendText.mid(action.prefix.length() + 1).trimmed(), room, chatBarCache);
if (action.messageType.has_value()) {
messageType = action.messageType;
}
if (action.messageAction) {
break;
} else {
return std::make_pair(std::nullopt, std::nullopt);
}
}
}
}
return std::make_pair(sendText, messageType);
}

View File

@@ -90,6 +90,21 @@ public:
*/ */
QList<Action> &allActions() const; QList<Action> &allActions() const;
/**
* @brief Handle special sed style edit action.
*
* @return True if the message has a sed edit which was actioned. False otherwise.
*/
static bool handleQuickEditAction(NeoChatRoom *room, const QString &messageText);
/**
* @brief Handle any action within the message contained in the given ChatBarCache.
*
* @return A modified or unmodified string that needs to be sent or an empty string if
* the handled action replaces sending a normal message.
*/
static std::pair<std::optional<QString>, std::optional<Quotient::RoomMessageEvent::MsgType>> handleAction(NeoChatRoom *room, ChatBarCache *chatBarCache);
private: private:
ActionsModel() = default; ActionsModel() = default;
}; };

View File

@@ -129,11 +129,7 @@ void DevicesModel::logout(const QString &deviceId, const QString &password)
QJsonObject identifier = {{"type"_ls, "m.id.user"_ls}, {"user"_ls, m_connection->user()->id()}}; QJsonObject identifier = {{"type"_ls, "m.id.user"_ls}, {"user"_ls, m_connection->user()->id()}};
authData["identifier"_ls] = identifier; authData["identifier"_ls] = identifier;
auto innerJob = m_connection->callApi<NeochatDeleteDeviceJob>(m_devices[index].deviceId, authData); auto innerJob = m_connection->callApi<NeochatDeleteDeviceJob>(m_devices[index].deviceId, authData);
#if Quotient_VERSION_MINOR > 8
connect(innerJob.get(), &BaseJob::success, this, onSuccess); connect(innerJob.get(), &BaseJob::success, this, onSuccess);
#else
connect(innerJob, &BaseJob::success, this, onSuccess);
#endif
} else { } else {
onSuccess(); onSuccess();
} }

View File

@@ -7,6 +7,7 @@
#include <QImageReader> #include <QImageReader>
#include <Quotient/events/eventcontent.h>
#include <Quotient/events/redactionevent.h> #include <Quotient/events/redactionevent.h>
#include <Quotient/events/roommessageevent.h> #include <Quotient/events/roommessageevent.h>
#include <Quotient/events/stickerevent.h> #include <Quotient/events/stickerevent.h>
@@ -521,18 +522,10 @@ QList<MessageComponent> MessageContentModel::componentsForType(MessageComponentT
auto fileTransferInfo = m_room->cachedFileTransferInfo(event); auto fileTransferInfo = m_room->cachedFileTransferInfo(event);
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
Q_ASSERT(roomMessageEvent->content() != nullptr && roomMessageEvent->hasFileContent()); Q_ASSERT(roomMessageEvent->content() != nullptr && roomMessageEvent->has<EventContent::FileContent>());
#if Quotient_VERSION_MINOR > 8 const QMimeType mimeType = roomMessageEvent->get<EventContent::FileContent>()->mimeType;
const QMimeType mimeType = roomMessageEvent->fileContent()->mimeType;
#else
const QMimeType mimeType = roomMessageEvent->content()->fileInfo()->mimeType;
#endif
if (mimeType.name() == QStringLiteral("text/plain") || mimeType.parentMimeTypes().contains(QStringLiteral("text/plain"))) { if (mimeType.name() == QStringLiteral("text/plain") || mimeType.parentMimeTypes().contains(QStringLiteral("text/plain"))) {
#if Quotient_VERSION_MINOR > 8 QString originalName = roomMessageEvent->get<EventContent::FileContent>()->originalName;
QString originalName = roomMessageEvent->fileContent()->originalName;
#else
QString originalName = roomMessageEvent->content()->fileInfo()->originalName;
#endif
if (originalName.isEmpty()) { if (originalName.isEmpty()) {
originalName = roomMessageEvent->plainBody(); originalName = roomMessageEvent->plainBody();
} }
@@ -642,7 +635,7 @@ QList<MessageComponent> MessageContentModel::addLinkPreviews(QList<MessageCompon
void MessageContentModel::closeLinkPreview(int row) void MessageContentModel::closeLinkPreview(int row)
{ {
if (row < 0 || row > m_components.size()) { if (row < 0 || row >= m_components.size()) {
qWarning() << "closeLinkPreview() called with row" << row << "which does not exist. m_components.size() =" << m_components.size(); qWarning() << "closeLinkPreview() called with row" << row << "which does not exist. m_components.size() =" << m_components.size();
return; return;
} }
@@ -652,6 +645,7 @@ void MessageContentModel::closeLinkPreview(int row)
m_removedLinkPreviews += m_components[row].attributes["link"_ls].toUrl(); m_removedLinkPreviews += m_components[row].attributes["link"_ls].toUrl();
m_components.remove(row); m_components.remove(row);
m_components.squeeze(); m_components.squeeze();
endResetModel();
resetContent(); resetContent();
} }
} }
@@ -664,7 +658,7 @@ void MessageContentModel::updateItineraryModel()
} }
if (auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event)) { if (auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event)) {
if (roomMessageEvent->hasFileContent()) { if (roomMessageEvent->has<EventContent::FileContent>()) {
auto filePath = m_room->cachedFileTransferInfo(event).localPath; auto filePath = m_room->cachedFileTransferInfo(event).localPath;
if (filePath.isEmpty() && m_itineraryModel != nullptr) { if (filePath.isEmpty() && m_itineraryModel != nullptr) {
delete m_itineraryModel; delete m_itineraryModel;

View File

@@ -8,6 +8,7 @@
#include "neochatconfig.h" #include "neochatconfig.h"
#include <Quotient/csapi/rooms.h> #include <Quotient/csapi/rooms.h>
#include <Quotient/events/eventcontent.h>
#include <Quotient/events/redactionevent.h> #include <Quotient/events/redactionevent.h>
#include <Quotient/events/roommessageevent.h> #include <Quotient/events/roommessageevent.h>
#include <Quotient/events/stickerevent.h> #include <Quotient/events/stickerevent.h>
@@ -504,7 +505,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
if (role == ProgressInfoRole) { if (role == ProgressInfoRole) {
if (auto e = eventCast<const RoomMessageEvent>(&evt)) { if (auto e = eventCast<const RoomMessageEvent>(&evt)) {
if (e->hasFileContent()) { if (e->has<EventContent::FileContent>()) {
return QVariant::fromValue(m_currentRoom->cachedFileTransferInfo(&evt)); return QVariant::fromValue(m_currentRoom->cachedFileTransferInfo(&evt));
} }
} }

View File

@@ -311,12 +311,7 @@ void PushRuleModel::addKeyword(const QString &keyword, const QString &roomId)
pushConditions.append(keywordCondition); pushConditions.append(keywordCondition);
} }
#if Quotient_VERSION_MINOR > 8
auto job = m_connection->callApi<Quotient::SetPushRuleJob>(PushRuleKind::kindString(kind), auto job = m_connection->callApi<Quotient::SetPushRuleJob>(PushRuleKind::kindString(kind),
#else
auto job = m_connection->callApi<Quotient::SetPushRuleJob>(QLatin1String("global"),
PushRuleKind::kindString(kind),
#endif
keyword, keyword,
actions, actions,
QString(), QString(),
@@ -341,11 +336,7 @@ void PushRuleModel::removeKeyword(const QString &keyword)
} }
auto kind = PushRuleKind::kindString(m_rules[index].kind); auto kind = PushRuleKind::kindString(m_rules[index].kind);
#if Quotient_VERSION_MINOR > 8
auto job = m_connection->callApi<Quotient::DeletePushRuleJob>(kind, m_rules[index].id); auto job = m_connection->callApi<Quotient::DeletePushRuleJob>(kind, m_rules[index].id);
#else
auto job = m_connection->callApi<Quotient::DeletePushRuleJob>(QStringLiteral("global"), kind, m_rules[index].id);
#endif
connect(job, &Quotient::BaseJob::failure, this, [this, job, index]() { connect(job, &Quotient::BaseJob::failure, this, [this, job, index]() {
qWarning() << QLatin1String("Unable to remove push rule for keyword %1: ").arg(m_rules[index].id) << job->errorString(); qWarning() << QLatin1String("Unable to remove push rule for keyword %1: ").arg(m_rules[index].id) << job->errorString();
}); });
@@ -353,18 +344,10 @@ void PushRuleModel::removeKeyword(const QString &keyword)
void PushRuleModel::setNotificationRuleEnabled(const QString &kind, const QString &ruleId, bool enabled) void PushRuleModel::setNotificationRuleEnabled(const QString &kind, const QString &ruleId, bool enabled)
{ {
#if Quotient_VERSION_MINOR > 8
auto job = m_connection->callApi<Quotient::IsPushRuleEnabledJob>(kind, ruleId); auto job = m_connection->callApi<Quotient::IsPushRuleEnabledJob>(kind, ruleId);
#else
auto job = m_connection->callApi<Quotient::IsPushRuleEnabledJob>(QStringLiteral("global"), kind, ruleId);
#endif
connect(job, &Quotient::BaseJob::success, this, [job, kind, ruleId, enabled, this]() { connect(job, &Quotient::BaseJob::success, this, [job, kind, ruleId, enabled, this]() {
if (job->enabled() != enabled) { if (job->enabled() != enabled) {
#if Quotient_VERSION_MINOR > 8
m_connection->callApi<Quotient::SetPushRuleEnabledJob>(kind, ruleId, enabled); m_connection->callApi<Quotient::SetPushRuleEnabledJob>(kind, ruleId, enabled);
#else
m_connection->callApi<Quotient::SetPushRuleEnabledJob>(QStringLiteral("global"), kind, ruleId, enabled);
#endif
} }
}); });
} }
@@ -378,11 +361,7 @@ void PushRuleModel::setNotificationRuleActions(const QString &kind, const QStrin
actions = actionToVariant(action); actions = actionToVariant(action);
} }
#if Quotient_VERSION_MINOR > 8
m_connection->callApi<Quotient::SetPushRuleActionsJob>(kind, ruleId, actions); m_connection->callApi<Quotient::SetPushRuleActionsJob>(kind, ruleId, actions);
#else
m_connection->callApi<Quotient::SetPushRuleActionsJob>(QStringLiteral("global"), kind, ruleId, actions);
#endif
} }
PushRuleAction::Action PushRuleModel::variantToAction(const QList<QVariant> &actions, bool enabled) PushRuleAction::Action PushRuleModel::variantToAction(const QList<QVariant> &actions, bool enabled)

View File

@@ -286,6 +286,7 @@ QHash<int, QByteArray> RoomTreeModel::roleNames() const
roles[IconRole] = "icon"; roles[IconRole] = "icon";
roles[AttentionRole] = "attention"; roles[AttentionRole] = "attention";
roles[FavouriteRole] = "favourite"; roles[FavouriteRole] = "favourite";
roles[RoomTypeRole] = "roomType";
return roles; return roles;
} }
@@ -385,6 +386,11 @@ QVariant RoomTreeModel::data(const QModelIndex &index, int role) const
if (role == FavouriteRole) { if (role == FavouriteRole) {
return room->isFavourite(); return room->isFavourite();
} }
if (role == RoomTypeRole) {
if (room->creation()) {
return room->creation()->contentPart<QString>("type"_L1);
}
}
return {}; return {};
} }

View File

@@ -50,6 +50,7 @@ public:
IconRole, IconRole,
AttentionRole, /**< Whether there are any notifications. */ AttentionRole, /**< Whether there are any notifications. */
FavouriteRole, /**< Whether the room is favourited. */ FavouriteRole, /**< Whether the room is favourited. */
RoomTypeRole, /**< The room's type. */
}; };
Q_ENUM(EventRoles) Q_ENUM(EventRoles)
explicit RoomTreeModel(QObject *parent = nullptr); explicit RoomTreeModel(QObject *parent = nullptr);

View File

@@ -157,6 +157,11 @@ bool SortFilterRoomTreeModel::filterAcceptsRow(int source_row, const QModelIndex
return false; return false;
} }
// Hide rooms with defined types, assuming that data-holding rooms have a defined type
if (!sourceModel()->data(index, RoomTreeModel::RoomTypeRole).toString().isEmpty()) {
return false;
}
static auto config = NeoChatConfig::self(); static auto config = NeoChatConfig::self();
if (config->allRoomsInHome() && RoomManager::instance().currentSpace().isEmpty()) { if (config->allRoomsInHome() && RoomManager::instance().currentSpace().isEmpty()) {
return acceptRoom; return acceptRoom;

View File

@@ -93,11 +93,7 @@ void SpaceChildrenModel::refreshModel()
}); });
} }
#if Quotient_VERSION_MINOR >= 9
void SpaceChildrenModel::insertChildren(std::vector<Quotient::GetSpaceHierarchyJob::SpaceHierarchyRoomsChunk> children, const QModelIndex &parent) void SpaceChildrenModel::insertChildren(std::vector<Quotient::GetSpaceHierarchyJob::SpaceHierarchyRoomsChunk> children, const QModelIndex &parent)
#else
void SpaceChildrenModel::insertChildren(std::vector<Quotient::GetSpaceHierarchyJob::ChildRoomsChunk> children, const QModelIndex &parent)
#endif
{ {
SpaceTreeItem *parentItem = getItem(parent); SpaceTreeItem *parentItem = getItem(parent);

View File

@@ -144,9 +144,5 @@ private:
void refreshModel(); void refreshModel();
#if Quotient_VERSION_MINOR >= 9
void insertChildren(std::vector<Quotient::GetSpaceHierarchyJob::SpaceHierarchyRoomsChunk> children, const QModelIndex &parent = QModelIndex()); void insertChildren(std::vector<Quotient::GetSpaceHierarchyJob::SpaceHierarchyRoomsChunk> children, const QModelIndex &parent = QModelIndex());
#else
void insertChildren(std::vector<Quotient::GetSpaceHierarchyJob::ChildRoomsChunk> children, const QModelIndex &parent = QModelIndex());
#endif
}; };

View File

@@ -6,7 +6,6 @@
#include <Quotient/events/event.h> #include <Quotient/events/event.h>
#include <Quotient/events/stickerevent.h> #include <Quotient/events/stickerevent.h>
#include <Quotient/jobs/basejob.h> #include <Quotient/jobs/basejob.h>
#include <Quotient/omittable.h>
#include <memory> #include <memory>
#include "chatbarcache.h" #include "chatbarcache.h"

View File

@@ -87,11 +87,7 @@ QVariant UserListModel::data(const QModelIndex &index, int role) const
return memberId; return memberId;
} }
if (role == AvatarRole) { if (role == AvatarRole) {
#if Quotient_VERSION_MINOR > 8
return m_currentRoom->member(memberId).avatarUrl(); return m_currentRoom->member(memberId).avatarUrl();
#else
return m_currentRoom->memberAvatar(memberId).url();
#endif
} }
if (role == ObjectRole) { if (role == ObjectRole) {
return QVariant::fromValue(memberId); return QVariant::fromValue(memberId);
@@ -176,11 +172,7 @@ void UserListModel::refreshAllMembers()
if (m_currentRoom != nullptr) { if (m_currentRoom != nullptr) {
m_members = m_currentRoom->joinedMemberIds(); m_members = m_currentRoom->joinedMemberIds();
#if Quotient_VERSION_MINOR > 8
MemberSorter sorter; MemberSorter sorter;
#else
MemberSorter sorter(m_currentRoom);
#endif
std::sort(m_members.begin(), m_members.end(), [&sorter, this](const auto &left, const auto &right) { std::sort(m_members.begin(), m_members.end(), [&sorter, this](const auto &left, const auto &right) {
const auto leftPl = m_currentRoom->getUserPowerLevel(left); const auto leftPl = m_currentRoom->getUserPowerLevel(left);
const auto rightPl = m_currentRoom->getUserPowerLevel(right); const auto rightPl = m_currentRoom->getUserPowerLevel(right);

View File

@@ -261,7 +261,7 @@ Action=Popup
Name=Share Name=Share
Name[ar]=شارك Name[ar]=شارك
Name[ca]=Compartició Name[ca]=Compartició
Name[ca@valencia]=Compartició Name[ca@valencia]=Compartiu
Name[cs]=Sdílet Name[cs]=Sdílet
Name[de]=Teilen Name[de]=Teilen
Name[el]=Κοινοποίηση Name[el]=Κοινοποίηση
@@ -282,6 +282,7 @@ Name[nl]=Gedeelde
Name[nn]=Del Name[nn]=Del
Name[pl]=Udostępnij Name[pl]=Udostępnij
Name[pt_BR]=Compartilhar Name[pt_BR]=Compartilhar
Name[ru]=Публикация
Name[sl]=Deli Name[sl]=Deli
Name[sv]=Dela Name[sv]=Dela
Name[ta]=பகிர் Name[ta]=பகிர்
@@ -312,6 +313,7 @@ Comment[nl]=Het resultaat van het delen van een stukje inhoud
Comment[nn]=Resultatet av deling av innhald Comment[nn]=Resultatet av deling av innhald
Comment[pl]=Wynik udostępniania kawałka treści Comment[pl]=Wynik udostępniania kawałka treści
Comment[pt_BR]=O resultado de compartilhar um conteúdo Comment[pt_BR]=O resultado de compartilhar um conteúdo
Comment[ru]=Результат публикации данных
Comment[sl]=Rezultat deljenega kosa vsebine Comment[sl]=Rezultat deljenega kosa vsebine
Comment[sv]=Resultatet av att dela innehåll Comment[sv]=Resultatet av att dela innehåll
Comment[ta]=எதையோ பகிர்ந்த‍தன் விளைவு Comment[ta]=எதையோ பகிர்ந்த‍தன் விளைவு

View File

@@ -27,6 +27,18 @@
<label>Use s/text/replacement syntax to edit your last message.</label> <label>Use s/text/replacement syntax to edit your last message.</label>
<default>false</default> <default>false</default>
</entry> </entry>
<entry name="SendMessageWith" type="Enum">
<label>Key combination to send a message</label>
<choices>
<choice name="Enter">
<label>Enter</label>
</choice>
<choice name="CtrlEnter">
<label>Ctrl+Enter</label>
</choice>
<default>Enter</default>
</choices>
</entry>
<entry name="ShowLocalMessagesOnRight" type="bool"> <entry name="ShowLocalMessagesOnRight" type="bool">
<label>"Show your messages on the right</label> <label>"Show your messages on the right</label>
<default>true</default> <default>true</default>

View File

@@ -533,7 +533,6 @@ LinkPreviewer *NeoChatConnection::previewerForLink(const QUrl &link)
return previewer; return previewer;
} }
#if Quotient_VERSION_MINOR > 8
KeyImport::Error NeoChatConnection::exportMegolmSessions(const QString &passphrase, const QString &path) KeyImport::Error NeoChatConnection::exportMegolmSessions(const QString &passphrase, const QString &path)
{ {
KeyImport keyImport; KeyImport keyImport;
@@ -548,6 +547,5 @@ KeyImport::Error NeoChatConnection::exportMegolmSessions(const QString &passphra
file.close(); file.close();
return KeyImport::Success; return KeyImport::Success;
} }
#endif
#include "moc_neochatconnection.cpp" #include "moc_neochatconnection.cpp"

View File

@@ -10,9 +10,7 @@
#include <QCoroTask> #include <QCoroTask>
#include <Quotient/connection.h> #include <Quotient/connection.h>
#if Quotient_VERSION_MINOR > 8
#include <Quotient/keyimport.h> #include <Quotient/keyimport.h>
#endif
#include "enums/messagetype.h" #include "enums/messagetype.h"
#include "linkpreviewer.h" #include "linkpreviewer.h"
@@ -160,9 +158,7 @@ public:
*/ */
Q_INVOKABLE QString accountDataJsonString(const QString &type) const; Q_INVOKABLE QString accountDataJsonString(const QString &type) const;
#if Quotient_VERSION_MINOR > 8
Q_INVOKABLE Quotient::KeyImport::Error exportMegolmSessions(const QString &passphrase, const QString &path); Q_INVOKABLE Quotient::KeyImport::Error exportMegolmSessions(const QString &passphrase, const QString &path);
#endif
qsizetype directChatNotifications() const; qsizetype directChatNotifications() const;
bool directChatsHaveHighlightNotifications() const; bool directChatsHaveHighlightNotifications() const;

View File

@@ -74,12 +74,8 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
const auto m_event = evtIt->viewAs<RoomEvent>(); const auto m_event = evtIt->viewAs<RoomEvent>();
QString mxcUrl; QString mxcUrl;
if (auto event = eventCast<const Quotient::RoomMessageEvent>(m_event)) { if (auto event = eventCast<const Quotient::RoomMessageEvent>(m_event)) {
if (event->hasFileContent()) { if (event->has<EventContent::FileContentBase>()) {
#if Quotient_VERSION_MINOR > 8 mxcUrl = event->get<EventContent::FileContentBase>()->url().toString();
mxcUrl = event->fileContent()->url().toString();
#else
mxcUrl = event->content()->fileInfo()->url().toString();
#endif
} }
} else if (auto event = eventCast<const Quotient::StickerEvent>(m_event)) { } else if (auto event = eventCast<const Quotient::StickerEvent>(m_event)) {
mxcUrl = event->image().url().toString(); mxcUrl = event->image().url().toString();
@@ -220,11 +216,7 @@ QCoro::Task<void> NeoChatRoom::doUploadFile(QUrl url, QString body)
auto mime = QMimeDatabase().mimeTypeForUrl(url); auto mime = QMimeDatabase().mimeTypeForUrl(url);
url.setScheme("file"_ls); url.setScheme("file"_ls);
QFileInfo fileInfo(url.isLocalFile() ? url.toLocalFile() : url.toString()); QFileInfo fileInfo(url.isLocalFile() ? url.toLocalFile() : url.toString());
#if Quotient_VERSION_MINOR > 8 EventContent::FileContentBase *content;
EventContent::Base *content;
#else
EventContent::TypedBase *content;
#endif
if (mime.name().startsWith("image/"_ls)) { if (mime.name().startsWith("image/"_ls)) {
QImage image(url.toLocalFile()); QImage image(url.toLocalFile());
content = new EventContent::ImageContent(url, fileInfo.size(), mime, image.size(), fileInfo.fileName()); content = new EventContent::ImageContent(url, fileInfo.size(), mime, image.size(), fileInfo.fileName());
@@ -239,12 +231,7 @@ QCoro::Task<void> NeoChatRoom::doUploadFile(QUrl url, QString body)
} else { } else {
content = new EventContent::FileContent(url, fileInfo.size(), mime, fileInfo.fileName()); content = new EventContent::FileContent(url, fileInfo.size(), mime, fileInfo.fileName());
} }
#if Quotient_VERSION_MINOR > 8 QString txnId = postFile(body.isEmpty() ? url.fileName() : body, std::unique_ptr<EventContent::FileContentBase>(content));
QString txnId =
postFile(body.isEmpty() ? url.fileName() : body, std::unique_ptr<EventContent::FileContent>(static_cast<EventContent::FileContent *>(content)));
#else
QString txnId = postFile(body.isEmpty() ? url.fileName() : body, content);
#endif
setHasFileUploading(true); setHasFileUploading(true);
connect(this, &Room::fileTransferCompleted, [this, txnId](const QString &id, FileSourceInfo) { connect(this, &Room::fileTransferCompleted, [this, txnId](const QString &id, FileSourceInfo) {
if (id == txnId) { if (id == txnId) {
@@ -376,12 +363,8 @@ bool NeoChatRoom::lastEventIsSpoiler() const
{ {
if (auto event = lastEvent()) { if (auto event = lastEvent()) {
if (auto e = eventCast<const RoomMessageEvent>(event)) { if (auto e = eventCast<const RoomMessageEvent>(event)) {
if (e->hasTextContent() && e->content() && e->mimeType().name() == "text/html"_ls) { if (e->has<EventContent::TextContent>() && e->content() && e->mimeType().name() == "text/html"_ls) {
#if Quotient_VERSION_MINOR > 8 auto htmlBody = e->get<EventContent::TextContent>()->body;
auto htmlBody = static_cast<const Quotient::EventContent::TextContent *>(e->content().get())->body;
#else
auto htmlBody = static_cast<const Quotient::EventContent::TextContent *>(e->content())->body;
#endif
return htmlBody.contains("data-mx-spoiler"_ls); return htmlBody.contains("data-mx-spoiler"_ls);
} }
} }
@@ -913,11 +896,7 @@ QCoro::Task<void> NeoChatRoom::doDeleteMessagesByUser(const QString &user, QStri
} }
for (const auto &e : events) { for (const auto &e : events) {
auto job = connection()->callApi<RedactEventJob>(id(), QString::fromLatin1(QUrl::toPercentEncoding(e)), connection()->generateTxnId(), reason); auto job = connection()->callApi<RedactEventJob>(id(), QString::fromLatin1(QUrl::toPercentEncoding(e)), connection()->generateTxnId(), reason);
#if Quotient_VERSION_MINOR > 8
co_await qCoro(job.get(), &BaseJob::finished); co_await qCoro(job.get(), &BaseJob::finished);
#else
co_await qCoro(job, &BaseJob::finished);
#endif
if (job->error() != BaseJob::Success) { if (job->error() != BaseJob::Success) {
qWarning() << "Error: \"" << job->error() << "\" while deleting messages. Aborting"; qWarning() << "Error: \"" << job->error() << "\" while deleting messages. Aborting";
break; break;
@@ -1216,11 +1195,7 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
for (const auto &i : roomRuleArray) { for (const auto &i : roomRuleArray) {
QJsonObject roomRule = i.toObject(); QJsonObject roomRule = i.toObject();
if (roomRule["rule_id"_ls] == id()) { if (roomRule["rule_id"_ls] == id()) {
#if Quotient_VERSION_MINOR > 8
connection()->callApi<DeletePushRuleJob>("room"_ls, id()); connection()->callApi<DeletePushRuleJob>("room"_ls, id());
#else
connection()->callApi<DeletePushRuleJob>(QLatin1String("global"), "room"_ls, id());
#endif
} }
} }
} }
@@ -1231,11 +1206,7 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
for (const auto &i : overrideRuleArray) { for (const auto &i : overrideRuleArray) {
QJsonObject overrideRule = i.toObject(); QJsonObject overrideRule = i.toObject();
if (overrideRule["rule_id"_ls] == id()) { if (overrideRule["rule_id"_ls] == id()) {
#if Quotient_VERSION_MINOR > 8
connection()->callApi<DeletePushRuleJob>("override"_ls, id()); connection()->callApi<DeletePushRuleJob>("override"_ls, id());
#else
connection()->callApi<DeletePushRuleJob>("global"_ls, "override"_ls, id());
#endif
} }
} }
} }
@@ -1271,17 +1242,9 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
const QList<PushCondition> conditions = {pushCondition}; const QList<PushCondition> conditions = {pushCondition};
// Add new override rule and make sure it's enabled // Add new override rule and make sure it's enabled
#if Quotient_VERSION_MINOR > 8
auto job = connection()->callApi<SetPushRuleJob>("override"_ls, id(), actions, QString(), QString(), conditions, QString()); auto job = connection()->callApi<SetPushRuleJob>("override"_ls, id(), actions, QString(), QString(), conditions, QString());
#else
auto job = connection()->callApi<SetPushRuleJob>("global"_ls, "override"_ls, id(), actions, QString(), QString(), conditions, QString());
#endif
connect(job, &BaseJob::success, this, [this]() { connect(job, &BaseJob::success, this, [this]() {
#if Quotient_VERSION_MINOR > 8
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("override"_ls, id(), true); auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("override"_ls, id(), true);
#else
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("global"_ls, "override"_ls, id(), true);
#endif
connect(enableJob, &BaseJob::success, this, [this]() { connect(enableJob, &BaseJob::success, this, [this]() {
m_pushNotificationStateUpdating = false; m_pushNotificationStateUpdating = false;
}); });
@@ -1305,17 +1268,9 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
// No conditions for a room rule // No conditions for a room rule
const QList<PushCondition> conditions; const QList<PushCondition> conditions;
#if Quotient_VERSION_MINOR > 8
auto setJob = connection()->callApi<SetPushRuleJob>("room"_ls, id(), actions, QString(), QString(), conditions, QString()); auto setJob = connection()->callApi<SetPushRuleJob>("room"_ls, id(), actions, QString(), QString(), conditions, QString());
#else
auto setJob = connection()->callApi<SetPushRuleJob>("global"_ls, "room"_ls, id(), actions, QString(), QString(), conditions, QString());
#endif
connect(setJob, &BaseJob::success, this, [this]() { connect(setJob, &BaseJob::success, this, [this]() {
#if Quotient_VERSION_MINOR > 8
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("room"_ls, id(), true); auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("room"_ls, id(), true);
#else
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("global"_ls, "room"_ls, id(), true);
#endif
connect(enableJob, &BaseJob::success, this, [this]() { connect(enableJob, &BaseJob::success, this, [this]() {
m_pushNotificationStateUpdating = false; m_pushNotificationStateUpdating = false;
}); });
@@ -1344,17 +1299,9 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
const QList<PushCondition> conditions; const QList<PushCondition> conditions;
// Add new room rule and make sure enabled // Add new room rule and make sure enabled
#if Quotient_VERSION_MINOR > 8
auto setJob = connection()->callApi<SetPushRuleJob>("room"_ls, id(), actions, QString(), QString(), conditions, QString()); auto setJob = connection()->callApi<SetPushRuleJob>("room"_ls, id(), actions, QString(), QString(), conditions, QString());
#else
auto setJob = connection()->callApi<SetPushRuleJob>("global"_ls, "room"_ls, id(), actions, QString(), QString(), conditions, QString());
#endif
connect(setJob, &BaseJob::success, this, [this]() { connect(setJob, &BaseJob::success, this, [this]() {
#if Quotient_VERSION_MINOR > 8
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("room"_ls, id(), true); auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("room"_ls, id(), true);
#else
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("global"_ls, "room"_ls, id(), true);
#endif
connect(enableJob, &BaseJob::success, this, [this]() { connect(enableJob, &BaseJob::success, this, [this]() {
m_pushNotificationStateUpdating = false; m_pushNotificationStateUpdating = false;
}); });
@@ -1445,7 +1392,7 @@ void NeoChatRoom::openEventMediaExternally(const QString &eventId)
const auto evtIt = findInTimeline(eventId); const auto evtIt = findInTimeline(eventId);
if (evtIt != messageEvents().rend() && is<RoomMessageEvent>(**evtIt)) { if (evtIt != messageEvents().rend() && is<RoomMessageEvent>(**evtIt)) {
const auto event = evtIt->viewAs<RoomMessageEvent>(); const auto event = evtIt->viewAs<RoomMessageEvent>();
if (event->hasFileContent()) { if (event->has<EventContent::FileContent>()) {
const auto transferInfo = cachedFileTransferInfo(event); const auto transferInfo = cachedFileTransferInfo(event);
if (transferInfo.completed()) { if (transferInfo.completed()) {
UrlHelper helper; UrlHelper helper;
@@ -1478,7 +1425,7 @@ void NeoChatRoom::copyEventMedia(const QString &eventId)
const auto evtIt = findInTimeline(eventId); const auto evtIt = findInTimeline(eventId);
if (evtIt != messageEvents().rend() && is<RoomMessageEvent>(**evtIt)) { if (evtIt != messageEvents().rend() && is<RoomMessageEvent>(**evtIt)) {
const auto event = evtIt->viewAs<RoomMessageEvent>(); const auto event = evtIt->viewAs<RoomMessageEvent>();
if (event->hasFileContent()) { if (event->has<EventContent::FileContent>()) {
const auto transferInfo = fileTransferInfo(eventId); const auto transferInfo = fileTransferInfo(eventId);
if (transferInfo.completed()) { if (transferInfo.completed()) {
Clipboard clipboard; Clipboard clipboard;
@@ -1511,12 +1458,8 @@ FileTransferInfo NeoChatRoom::cachedFileTransferInfo(const Quotient::RoomEvent *
QString mxcUrl; QString mxcUrl;
int total = 0; int total = 0;
if (auto evt = eventCast<const Quotient::RoomMessageEvent>(event)) { if (auto evt = eventCast<const Quotient::RoomMessageEvent>(event)) {
if (evt->hasFileContent()) { if (evt->has<EventContent::FileContent>()) {
#if Quotient_VERSION_MINOR > 8 const auto fileContent = evt->get<EventContent::FileContent>();
const auto fileContent = evt->fileContent();
#else
const auto fileContent = evt->content()->fileInfo();
#endif
mxcUrl = fileContent->url().toString(); mxcUrl = fileContent->url().toString();
total = fileContent->payloadSize; total = fileContent->payloadSize;
@@ -1874,13 +1817,4 @@ void NeoChatRoom::setRoomState(const QString &type, const QString &stateKey, con
setState(type, stateKey, QJsonDocument::fromJson(content).object()); setState(type, stateKey, QJsonDocument::fromJson(content).object());
} }
#if Quotient_VERSION_MINOR == 8
QList<RoomMember> NeoChatRoom::otherMembersTyping() const
{
auto memberTyping = membersTyping();
memberTyping.removeAll(localMember());
return memberTyping;
}
#endif
#include "moc_neochatroom.cpp" #include "moc_neochatroom.cpp"

View File

@@ -208,10 +208,6 @@ class NeoChatRoom : public Quotient::Room
*/ */
Q_PROPERTY(ChatBarCache *threadCache READ threadCache CONSTANT) Q_PROPERTY(ChatBarCache *threadCache READ threadCache CONSTANT)
#if Quotient_VERSION_MINOR == 8
Q_PROPERTY(QList<Quotient::RoomMember> otherMembersTyping READ otherMembersTyping NOTIFY typingChanged)
#endif
public: public:
explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {}); explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {});
@@ -623,10 +619,6 @@ private:
void cleanupExtraEventRange(Quotient::RoomEventsRange events); void cleanupExtraEventRange(Quotient::RoomEventsRange events);
void cleanupExtraEvent(const QString &eventId); void cleanupExtraEvent(const QString &eventId);
#if Quotient_VERSION_MINOR == 8
QList<Quotient::RoomMember> otherMembersTyping() const;
#endif
private Q_SLOTS: private Q_SLOTS:
void updatePushNotificationState(QString type); void updatePushNotificationState(QString type);

View File

@@ -73,11 +73,7 @@ QString NeochatRoomMember::displayName() const
} }
const auto memberObject = m_room->member(m_memberId); const auto memberObject = m_room->member(m_memberId);
#if Quotient_VERSION_MINOR > 8
return memberObject.isEmpty() ? id() : memberObject.displayName(); return memberObject.isEmpty() ? id() : memberObject.displayName();
#else
return memberObject.id().isEmpty() ? id() : memberObject.displayName();
#endif
} }
QString NeochatRoomMember::htmlSafeDisplayName() const QString NeochatRoomMember::htmlSafeDisplayName() const
@@ -87,11 +83,7 @@ QString NeochatRoomMember::htmlSafeDisplayName() const
} }
const auto memberObject = m_room->member(m_memberId); const auto memberObject = m_room->member(m_memberId);
#if Quotient_VERSION_MINOR > 8
return memberObject.isEmpty() ? id() : memberObject.htmlSafeDisplayName(); return memberObject.isEmpty() ? id() : memberObject.htmlSafeDisplayName();
#else
return memberObject.id().isEmpty() ? id() : memberObject.htmlSafeDisplayName();
#endif
} }
QString NeochatRoomMember::fullName() const QString NeochatRoomMember::fullName() const
@@ -101,11 +93,7 @@ QString NeochatRoomMember::fullName() const
} }
const auto memberObject = m_room->member(m_memberId); const auto memberObject = m_room->member(m_memberId);
#if Quotient_VERSION_MINOR > 8
return memberObject.isEmpty() ? id() : memberObject.fullName(); return memberObject.isEmpty() ? id() : memberObject.fullName();
#else
return memberObject.id().isEmpty() ? id() : memberObject.fullName();
#endif
} }
QString NeochatRoomMember::htmlSafeFullName() const QString NeochatRoomMember::htmlSafeFullName() const
@@ -115,11 +103,7 @@ QString NeochatRoomMember::htmlSafeFullName() const
} }
const auto memberObject = m_room->member(m_memberId); const auto memberObject = m_room->member(m_memberId);
#if Quotient_VERSION_MINOR > 8
return memberObject.isEmpty() ? id() : memberObject.htmlSafeFullName(); return memberObject.isEmpty() ? id() : memberObject.htmlSafeFullName();
#else
return memberObject.id().isEmpty() ? id() : memberObject.htmlSafeFullName();
#endif
} }
QString NeochatRoomMember::disambiguatedName() const QString NeochatRoomMember::disambiguatedName() const
@@ -129,11 +113,7 @@ QString NeochatRoomMember::disambiguatedName() const
} }
const auto memberObject = m_room->member(m_memberId); const auto memberObject = m_room->member(m_memberId);
#if Quotient_VERSION_MINOR > 8
return memberObject.isEmpty() ? id() : memberObject.disambiguatedName(); return memberObject.isEmpty() ? id() : memberObject.disambiguatedName();
#else
return memberObject.id().isEmpty() ? id() : memberObject.disambiguatedName();
#endif
} }
QString NeochatRoomMember::htmlSafeDisambiguatedName() const QString NeochatRoomMember::htmlSafeDisambiguatedName() const
@@ -143,11 +123,7 @@ QString NeochatRoomMember::htmlSafeDisambiguatedName() const
} }
const auto memberObject = m_room->member(m_memberId); const auto memberObject = m_room->member(m_memberId);
#if Quotient_VERSION_MINOR > 8
return memberObject.isEmpty() ? id() : memberObject.htmlSafeDisambiguatedName(); return memberObject.isEmpty() ? id() : memberObject.htmlSafeDisambiguatedName();
#else
return memberObject.id().isEmpty() ? id() : memberObject.htmlSafeDisambiguatedName();
#endif
} }
int NeochatRoomMember::hue() const int NeochatRoomMember::hue() const

View File

@@ -148,11 +148,7 @@ void NotificationsManager::processNotificationJob(QPointer<NeoChatConnection> co
QImage avatar_image; QImage avatar_image;
if (!sender.avatarUrl().isEmpty()) { if (!sender.avatarUrl().isEmpty()) {
#if Quotient_VERSION_MINOR > 8
avatar_image = room->member(sender.id()).avatar(128, 128, {}); avatar_image = room->member(sender.id()).avatar(128, 128, {});
#else
avatar_image = room->memberAvatar(sender.id()).get(connection, 128, {});
#endif
} else { } else {
avatar_image = room->avatar(128); avatar_image = room->avatar(128);
} }
@@ -298,11 +294,7 @@ void NotificationsManager::doPostInviteNotification(QPointer<NeoChatRoom> room)
QImage avatar_image; QImage avatar_image;
if (roomMemberEvent && !room->member(roomMemberEvent->senderId()).avatarUrl().isEmpty()) { if (roomMemberEvent && !room->member(roomMemberEvent->senderId()).avatarUrl().isEmpty()) {
#if Quotient_VERSION_MINOR > 8
avatar_image = room->member(roomMemberEvent->senderId()).avatar(128, 128, {}); avatar_image = room->member(roomMemberEvent->senderId()).avatar(128, 128, {});
#else
avatar_image = room->memberAvatar(roomMemberEvent->senderId()).get(room->connection(), 128, [] {});
#endif
} else { } else {
qWarning() << "using this room's avatar"; qWarning() << "using this room's avatar";
avatar_image = room->avatar(128); avatar_image = room->avatar(128);

View File

@@ -30,6 +30,7 @@ class PollHandler : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT QML_ELEMENT
QML_UNCREATABLE("Use NeoChatRoom::poll")
/** /**
* @brief The question for the poll. * @brief The question for the poll.
@@ -91,7 +92,7 @@ Q_SIGNALS:
void hasEndedChanged(); void hasEndedChanged();
private: private:
const Quotient::PollStartEvent *m_pollStartEvent; const Quotient::PollStartEvent *m_pollStartEvent = nullptr;
void updatePoll(Quotient::RoomEventsRange events); void updatePoll(Quotient::RoomEventsRange events);

View File

@@ -26,6 +26,7 @@
"Name[nn]": "Tobias Fella", "Name[nn]": "Tobias Fella",
"Name[pl]": "Tobias Fella", "Name[pl]": "Tobias Fella",
"Name[ru]": "Tobias Fella", "Name[ru]": "Tobias Fella",
"Name[sk]": "Tobias Fella",
"Name[sl]": "Tobias Fella", "Name[sl]": "Tobias Fella",
"Name[sv]": "Tobias Fella", "Name[sv]": "Tobias Fella",
"Name[ta]": "டோபியாஸ் ஃபெல்லா", "Name[ta]": "டோபியாஸ் ஃபெல்லா",
@@ -93,6 +94,7 @@
"Name[nn]": "NeoChat", "Name[nn]": "NeoChat",
"Name[pl]": "NeoChat", "Name[pl]": "NeoChat",
"Name[ru]": "NeoChat", "Name[ru]": "NeoChat",
"Name[sk]": "NeoChat",
"Name[sl]": "NeoChat", "Name[sl]": "NeoChat",
"Name[sv]": "NeoChat", "Name[sv]": "NeoChat",
"Name[ta]": "நியோச்சாட்", "Name[ta]": "நியோச்சாட்",

View File

@@ -87,13 +87,21 @@ SearchPage {
} }
listHeaderDelegate: Delegates.RoundedItemDelegate { listHeaderDelegate: Delegates.RoundedItemDelegate {
id: delegate
onClicked: _private.openManualRoomDialog() onClicked: _private.openManualRoomDialog()
activeFocusOnTab: false // We handle moving to this item via up/down arrows, otherwise the tab order is wacky activeFocusOnTab: false // We handle moving to this item via up/down arrows, otherwise the tab order is wacky
text: i18n("Enter a room address") text: i18n("Enter a Room Manually")
icon.name: "compass" icon.name: "compass"
icon.width: Kirigami.Units.gridUnit * 2 icon.width: Kirigami.Units.gridUnit * 2
icon.height: Kirigami.Units.gridUnit * 2 icon.height: Kirigami.Units.gridUnit * 2
contentItem: Kirigami.IconTitleSubtitle {
icon: icon.fromControlsIcon(delegate.icon)
title: delegate.text
subtitle: i18n("If you already know a room's address or alias, and it isn't shown here.")
}
} }
listFooterDelegate: QQC2.ProgressBar { listFooterDelegate: QQC2.ProgressBar {
@@ -115,7 +123,7 @@ SearchPage {
QtObject { QtObject {
id: _private id: _private
function openManualRoomDialog() { function openManualRoomDialog() {
let dialog = manualRoomDialog.createObject(applicationWindow().overlay, { let dialog = manualRoomDialog.createObject(root.QQC2.Overlay.overlay, {
connection: root.connection connection: root.connection
}); });
dialog.parent = root.Window.window.overlay; dialog.parent = root.Window.window.overlay;

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtQuick import QtQuick
import QtQuick.Window
import QtQuick.Layouts import QtQuick.Layouts
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
@@ -22,9 +23,9 @@ Kirigami.Dialog {
*/ */
signal roomSelected(string roomId, string displayName, url avatarUrl, string alias, string topic, int memberCount, bool isJoined) signal roomSelected(string roomId, string displayName, url avatarUrl, string alias, string topic, int memberCount, bool isJoined)
title: i18nc("@title", "Room ID or Alias") title: i18nc("@title", "Manually Enter a Room")
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24) width: Math.min(root.Window.window.width, Kirigami.Units.gridUnit * 24)
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
topPadding: 0 topPadding: 0

Some files were not shown because too many files have changed in this diff Show More