Compare commits

..

107 Commits

Author SHA1 Message Date
Soumyadeep Ghosh
0c736b7d1d snap: update libquotient 2024-12-04 01:51:31 +05:30
Joshua Goins
a2914cf7b1 Fix ShareActionStub for Windows and Android
Apparently, we are supposed to be setting source file properties for our QML files *before*
the QML module is created. Doing it after seemed to work until Qt 6.8, where it finally
broke. Notably, this makes the Android version work again but might also affect Windows.

(cherry picked from commit a39194b2ad)

Co-authored-by: Joshua Goins <josh@redstrate.com>
2024-11-22 13:44:45 +00:00
l10n daemon script
05f0277512 GIT_SILENT Sync po/docbooks with svn 2024-11-06 03:07:41 +00:00
l10n daemon script
e82a5c9442 GIT_SILENT Sync po/docbooks with svn 2024-11-02 03:06:39 +00:00
l10n daemon script
896e09bb5b GIT_SILENT Sync po/docbooks with svn 2024-11-01 03:05:02 +00:00
l10n daemon script
52747355a4 GIT_SILENT Sync po/docbooks with svn 2024-10-31 03:06:09 +00:00
l10n daemon script
01f1d655e5 GIT_SILENT made messages (after extraction) 2024-10-31 02:30:41 +00:00
Heiko Becker
4b7011fe14 GIT_SILENT Update Appstream for new release 2024-10-31 01:14:18 +01:00
Heiko Becker
5550091046 GIT_SILENT Upgrade release service version to 24.08.3. 2024-10-31 00:14:30 +01:00
l10n daemon script
fc2e751af9 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 03:02:21 +00:00
l10n daemon script
36137a036c GIT_SILENT made messages (after extraction) 2024-10-29 02:30:53 +00:00
l10n daemon script
e0f3d544f0 GIT_SILENT Sync po/docbooks with svn 2024-10-27 03:16:17 +00:00
James Graham
eb802ff91f Cherry pick compatability changes for libquotient 0.9
Title
2024-10-26 07:47:15 +00:00
l10n daemon script
0e697fc7e3 GIT_SILENT Sync po/docbooks with svn 2024-10-25 03:08:02 +00:00
Soumyadeep Ghosh
89d546f291 snap: add snap package 2024-10-18 16:40:52 +00:00
l10n daemon script
c0324d53e5 GIT_SILENT Sync po/docbooks with svn 2024-10-15 03:04:07 +00:00
l10n daemon script
25084ed46d GIT_SILENT Sync po/docbooks with svn 2024-10-11 03:18:49 +00:00
l10n daemon script
e274e09bbc 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-11 03:14:33 +00:00
l10n daemon script
389016f126 GIT_SILENT made messages (after extraction) 2024-10-11 02:41:20 +00:00
l10n daemon script
e270f553a3 GIT_SILENT Sync po/docbooks with svn 2024-10-10 03:04:09 +00:00
l10n daemon script
a0fef7b397 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-10 03:01:02 +00:00
l10n daemon script
588266d7c3 Additional po sync 2024-10-09 11:01:45 +00:00
l10n daemon script
258e799138 GIT_SILENT made messages (after extraction) 2024-10-09 02:29:41 +00:00
l10n daemon script
73cd253e25 GIT_SILENT Sync po/docbooks with svn 2024-10-07 03:04:36 +00:00
l10n daemon script
eee81329a4 GIT_SILENT made messages (after extraction) 2024-10-07 02:28:56 +00:00
Tobias Fella
9b425e5a54 Fix for not rendering html in replies
The proper fix on master branch isn't suitable to be backported
2024-10-06 22:14:22 +02:00
Tobias Fella
fb83d5cff8 Fix compilation
(cherry picked from commit a769b904dc)
2024-10-06 22:14:22 +02:00
Tobias Fella
21cabeb20c Fix compilation against changes in libQuotient
(cherry picked from commit f156551d4f)
2024-10-06 22:14:22 +02:00
Tobias Fella
bed04cc59f Adapt to libQuotient changes
(cherry picked from commit 3e1044b8fd)
2024-10-06 22:14:22 +02:00
Carl Schwan
18db04d073 Unify redaction handling
The code in messageeventmodel was calling to EventHandler::getBody who
already handles reaction handlings

(cherry picked from commit 16b27700f5)
2024-10-06 22:14:22 +02:00
Carl Schwan
0f05c1b921 Escape html from redaction message
(cherry picked from commit 9ee10b6968)
2024-10-06 22:14:14 +02:00
Heiko Becker
765292e0e9 GIT_SILENT Update Appstream for new release 2024-10-06 22:02:21 +02:00
Heiko Becker
7c27308a59 GIT_SILENT Upgrade release service version to 24.08.2. 2024-10-06 20:00:19 +02:00
l10n daemon script
b574e68164 GIT_SILENT Sync po/docbooks with svn 2024-10-06 03:06:57 +00:00
l10n daemon script
66d16dd16b 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-06 03:04:21 +00:00
l10n daemon script
b1c810c242 GIT_SILENT Sync po/docbooks with svn 2024-09-26 03:06:29 +00:00
l10n daemon script
8f0b3a16f1 GIT_SILENT Sync po/docbooks with svn 2024-09-24 03:32:05 +00:00
l10n daemon script
043519784b GIT_SILENT Sync po/docbooks with svn 2024-09-23 03:06:07 +00:00
Carl Schwan
aafe42c4cc Ensure floating buttons have correct size on mobile
(cherry picked from commit 42dd2e5413)

Co-authored-by: Carl Schwan <carl@carlschwan.eu>
2024-09-22 13:18:36 +00:00
Carl Schwan
d9b9b18872 Make sure that m_components cannot be accessed out of bounds in closeLinkPreview
https://crash-reports.kde.org/organizations/kde/issues/67352/?project=18&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=14d&stream_index=5


(cherry picked from commit f89cec9c55)

53f949e6 Make sure that m_components cannot be accessed out of bounds in closeLinkPreview
34b847cb Add warning

Co-authored-by: James Graham <james.h.graham@protonmail.com>
2024-09-22 13:16:39 +00:00
Carl Schwan
18e26c9e3a Fix NeoChatRoom::directChatRemoteMember
- Don't access member that's not there
- Use NeoChatRoomMember instead of RoomMember

BUG: 492733


(cherry picked from commit 2a5359e73b)

Co-authored-by: Tobias Fella <fella@posteo.de>
2024-09-22 13:14:59 +00:00
Carl Schwan
19c93e9d82 Fix crash in MessageContentModel
(cherry picked from commit 52ab6f484b)

Co-authored-by: Tobias Fella <fella@posteo.de>
2024-09-22 13:14:37 +00:00
Carl Schwan
af6187706e Fix display name in verification message
Previously this would be undefined and i18n doesn't handle this very
well


(cherry picked from commit fad4e506bc)

Co-authored-by: Carl Schwan <carl@carlschwan.eu>
2024-09-21 13:27:00 +00:00
l10n daemon script
bf18fcbbba GIT_SILENT Sync po/docbooks with svn 2024-09-19 03:08:37 +00:00
l10n daemon script
ee5502d7bf GIT_SILENT Sync po/docbooks with svn 2024-09-17 03:16:26 +00:00
l10n daemon script
d8d6a4ef3b GIT_SILENT Sync po/docbooks with svn 2024-09-16 03:30:14 +00:00
Carl Schwan
2803c6fd58 Fix filtering users in the member list
(cherry picked from commit 5c04eb85af)

Co-authored-by: Tobias Fella <fella@posteo.de>
2024-09-15 21:02:05 +00:00
Carl Schwan
f2f6406403 Don't open a room by default on mobile
Since the room window is fullscreen on mobile and you can't see the room list,
the first thing you'll be doing is backing out so you can choose the actual room you want to see


(cherry picked from commit 17da652152)

Co-authored-by: Bart Ribbers <bribbers@disroot.org>
2024-09-15 20:59:12 +00:00
Claire Elford
63dc8a5857 Fix increasing font size of certain emojis
Before this commit, NeoChat has two methods of detecting whether or not a piece
of text was an emoji. One is through a regex, and the other is by using the ICU
library. The two methods are used in different parts of the code.

This commit removes the regex detector and instead uses ICU for all the places
where NeoChat needs to figure out whether or not a string is an emoji. This
fixes increasing the font size for messages that only consist of emoji when
certain emoji are used that the regex did not handle (such as the transgender
symbol and transgender flag emojis).

(cherry picked from commit f7533a454c)
2024-09-15 22:59:54 +02:00
Carl Schwan
3dafc62f04 Use autoTransform on images
closes network/neochat#674


(cherry picked from commit 38cfc915f1)

533130b5 Use autoTransform on images

Co-authored-by: James Graham <james.h.graham@protonmail.com>
2024-09-15 10:22:08 +00:00
l10n daemon script
5be112e0e2 GIT_SILENT Sync po/docbooks with svn 2024-09-12 03:02:17 +00:00
Joshua Goins
b15ee49691 Web Shortcuts: kcmshell5 does not exist anymore on Plasma 6
This is hardcoded, but it's probably a safe assumption to think most
people running modern NeoChat are using Plasma 6 anyway.

(cherry picked from commit aa116a35f5)
2024-09-08 03:53:04 -04:00
l10n daemon script
fa5872ec5a GIT_SILENT Sync po/docbooks with svn 2024-09-08 03:08:01 +00:00
l10n daemon script
54061c744f GIT_SILENT Sync po/docbooks with svn 2024-09-07 03:06:04 +00:00
Heiko Becker
b6dac3bbdf GIT_SILENT Update Appstream for new release 2024-09-07 00:48:45 +02:00
Heiko Becker
3a838596c5 GIT_SILENT Upgrade release service version to 24.08.1. 2024-09-06 23:53:24 +02:00
l10n daemon script
cc22e80adc GIT_SILENT Sync po/docbooks with svn 2024-09-03 03:03:24 +00:00
Joshua Goins
1c0a5edd2e LocationHelper: Move clamp from zoomToFit to QML
The OSM plugin has a different zoom tolerance than what we're hardcoding
here. This fixes the map looking funky from being too zoomed while
trying to fit multiple location points at once.

(cherry picked from commit 15d6287995)
2024-09-02 09:28:15 -04:00
Joshua Goins
47408d536d AuthorDelegate: Don't make empty space clickable
(cherry picked from commit 4b7cbf37d5)
2024-09-02 09:28:15 -04:00
Joshua Goins
fc21eea7e7 AuthorDelegate: Add pointing hand cursor to indicate you can tap
It's not immediately obvious that you can press on this static text to
bring up the user's details. This isn't a problem with the avatar - for
example - because it has a pointing hand cursor. Let's do the same here.

(cherry picked from commit 0ccfe7d991)
2024-09-02 09:28:15 -04:00
Joshua Goins
ca95eb3505 Make the SectionDelegate look just a little bit better
This has insets on it - probably from qqc2-desktop-style - and makes it
look extremely bad when scrolling through messages as the background
size doesn't match. Now the insets are set to zero, except for topInset.
This is done to work around a visual bug where you can see a one-pixel
line right above the SectionDelegate when scrolling.

(cherry picked from commit ab5585cd06)
2024-09-02 09:28:15 -04:00
l10n daemon script
639cbed343 GIT_SILENT Sync po/docbooks with svn 2024-09-02 03:05:11 +00:00
l10n daemon script
be3cffaf3a GIT_SILENT Sync po/docbooks with svn 2024-09-01 03:05:11 +00:00
l10n daemon script
7af520d0ae GIT_SILENT Sync po/docbooks with svn 2024-08-30 03:10:58 +00:00
l10n daemon script
d145177014 GIT_SILENT Sync po/docbooks with svn 2024-08-28 03:30:02 +00:00
l10n daemon script
75aa2c0e8d 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-08-28 03:20:31 +00:00
l10n daemon script
7eda952aa2 GIT_SILENT Sync po/docbooks with svn 2024-08-25 03:09:56 +00:00
Tobias Fella
22d0d84fee Fix pending indicator 2024-08-24 17:42:11 +02:00
Tobias Fella
941a724381 Use plaintext for reply author component
(cherry picked from commit aeb566746a)
2024-08-24 17:33:48 +02:00
Tobias Fella
7e880c6663 Don't run QtKeychain job in a nested event loop
Doing that causes deadlocks and there's no need for it here

(cherry picked from commit 8da567d9fa)
2024-08-24 17:33:44 +02:00
Tobias Fella
22315b810c Adapt to libQuotient API change
(cherry picked from commit d99f69cc24)
2024-08-24 17:33:37 +02:00
Tobias Fella
d0c41d5224 Ensure that room list does not show rooms without title during startup
There's a brief moment during startup where the model knows about the rooms, but their state
is not loaded, which makes them show up in the room list with ugly fallback titles.
To prevent this, we delay closing the welcome page until the basestate is loaded.

(cherry picked from commit bd1d4289c0)
2024-08-24 17:33:30 +02:00
Andreas Sturmlechner
a7e06375fd Include missing ECMQmlModule
Amends bc67033c00 and e0c3a1c143

No idea why this isn't caught by CI, but it fails for me otherwise.

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
(cherry picked from commit 22743b6d8b)
2024-08-24 12:24:15 +02:00
l10n daemon script
e638f61ff1 GIT_SILENT Sync po/docbooks with svn 2024-08-22 03:20:42 +00:00
l10n daemon script
2218b39a50 GIT_SILENT Sync po/docbooks with svn 2024-08-20 03:27:56 +00:00
Tobias Fella
b34936a017 Re-add pending event indicator
This seems to have been accidentally removed

BUG: 491277
(cherry picked from commit 776807580a)
2024-08-18 15:37:08 +02:00
l10n daemon script
5b3e650854 GIT_SILENT Sync po/docbooks with svn 2024-08-16 03:04:39 +00:00
Heiko Becker
86d85c6ce7 GIT_SILENT Update Appstream for new release 2024-08-16 00:35:00 +02:00
Heiko Becker
863e20394a GIT_SILENT Upgrade release service version to 24.08.0. 2024-08-15 23:34:44 +02:00
l10n daemon script
908dcea75e GIT_SILENT made messages (after extraction) 2024-08-11 02:34:30 +00:00
l10n daemon script
c59d5bc75d 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-08-10 03:12:41 +00:00
l10n daemon script
ff4ba4df9c GIT_SILENT made messages (after extraction) 2024-08-10 02:39:29 +00:00
l10n daemon script
0c1494e74a 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-08-09 03:01:15 +00:00
Albert Astals Cid
18d4da8b42 GIT_SILENT Upgrade release service version to 24.07.90. 2024-08-08 10:00:41 +02:00
l10n daemon script
9680cbbb38 GIT_SILENT Sync po/docbooks with svn 2024-08-06 03:07:30 +00:00
l10n daemon script
3b5ba470b6 GIT_SILENT Sync po/docbooks with svn 2024-08-04 03:12:15 +00:00
l10n daemon script
e1066aede2 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-08-04 03:08:29 +00:00
l10n daemon script
2bf4ed26f0 GIT_SILENT Sync po/docbooks with svn 2024-08-03 03:09:58 +00:00
l10n daemon script
b460b588a8 GIT_SILENT Sync po/docbooks with svn 2024-08-02 03:10:44 +00:00
l10n daemon script
05270c38bf GIT_SILENT Sync po/docbooks with svn 2024-07-31 03:05:10 +00:00
l10n daemon script
18afad83db GIT_SILENT Sync po/docbooks with svn 2024-07-30 03:09:21 +00:00
Tobias Fella
d390433b2b Show time without seconds in timeline
(cherry picked from commit 2df2e39d43)
2024-07-29 18:00:10 +02:00
Tobias Fella
0017be1c0f Show time without timezone in tooltip
Constructing the timezone string is relatively heavy and is done for each delegate, even when the tooltip is never shown

(cherry picked from commit 42cec7d5ba)
2024-07-29 18:00:08 +02:00
l10n daemon script
63eda3796d GIT_SILENT Sync po/docbooks with svn 2024-07-29 03:09:38 +00:00
l10n daemon script
3246076a0b GIT_SILENT Sync po/docbooks with svn 2024-07-28 03:10:41 +00:00
James Graham
e905cdd151 Cherrypick: Create NeochatRoomMember as a shim for RoomMember
The intention is that NeochatRoomMember can be created passed to QML and then be fully managed by it. It effectively just grabs the current RoomMember, calls the correct function then discards it so that we don't end up trying to access an already deleted state event.


(cherry picked from commit 11fd4f88ec)

a2a8ad09 Create NeochatRoomMember as a shim for RoomMember so it can be safely passed to QML
0867eef5 Fix showAuthor
0f72ccd0 Mamange the creation of NeochatRoomMembers and only create one per member rather than event.
dba88fe2 REmove getAuthor as no longer needed
4e3a61d1 Update include
32d4d9f7 Pass NeochatRoomMembers rather than RoomMembers to menus
8e4b2034 Don't leak memory
c2f2bb26 Fix code component regression.
5aee89be Make sure the sender Id is intialised properly for pending events
c10c2677 Tweak intialisation
b3146034 Make sure event objects are created for new pending events
e4fab6d9 Pass an empty NeochatRoomMember when not in the map

Co-authored-by: James Graham <james.h.graham@protonmail.com>
2024-07-27 09:33:14 +00:00
l10n daemon script
0372074beb GIT_SILENT Sync po/docbooks with svn 2024-07-27 03:10:43 +00:00
Joshua Goins
09e97f2bdb Make the "Unignore this user" button work on the Ignored Users page
This function now takes a QString. This should be fine to use since it's
in the 0.8.2 release which we require.

(cherry picked from commit 9a4504ce61)
2024-07-26 19:09:57 +00:00
Joshua Goins
8e324c16f3 Fix the emoji page not doing anything
This is yet more stuff broken due to referencing a implicit pageStack
that no longer exists.


(cherry picked from commit cb8ed02e82)

Co-authored-by: Joshua Goins <josh@redstrate.com>
2024-07-26 19:00:47 +00:00
Joshua Goins
2bb55eece7 Don't flag invite notifications as persistent
These really don't need to be persistent, as they even stick around
when NeoChat is closed. This also spams the user's notification system
usually, if they get lots of invitations at once which don't go away
automatically.

(cherry picked from commit 51197d7c1a)
2024-07-25 16:38:13 -04:00
Joshua Goins
2877e40647 Hint that the user can auto-reject invitations on the invite page
This should help make the new setting more discoverable.

(cherry picked from commit 2a2a2e0c05)
2024-07-25 16:38:13 -04:00
Joshua Goins
768ec242fa Allow blocking invites from people you don't share a room with
Matrix currently has a significant moderation loophole, thanks to
invites. Right now, anyone can invite anyone to a room - and clients
like NeoChat will gladly display these rooms to them and even give you
a notification.

However, this creates a pretty easy attack since room names and avatars
are arbitrary and this is a known vector of harassment in the Matrix
community. There's currently no tools to block this server-side, so
let's try to improve the situation where we can.

This adds a new setting to the Security page, wherein it allows you to
block invites from people you don't share a room with. This prevents the
notification from appearing and NeoChat will attempt to leave the room
immediately.

Since this depends on MSC 2666 - a currently unstable feature - the
server may not support it and NeoChat will disable the setting in this
case.

(cherry picked from commit 07fee30cc0)
2024-07-25 16:38:13 -04:00
Joshua Goins
194751627f Don't display notifications for invite rooms
Sometimes a ghost notification will appear, this is sometimes a stray
m.room.invite notification we didn't handle or some other event. Let's
outright reject all notifications from Invite-type rooms to prevent this
from happening altogether.

(cherry picked from commit 83c6ce0ace)
2024-07-25 16:38:13 -04:00
l10n daemon script
bc701c51d9 GIT_SILENT Sync po/docbooks with svn 2024-07-25 03:13:15 +00:00
l10n daemon script
35939b4af4 GIT_SILENT Sync po/docbooks with svn 2024-07-23 03:14:18 +00:00
l10n daemon script
a178b8b6ca 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-07-23 03:04:52 +00:00
Albert Astals Cid
a6994318de GIT_SILENT Upgrade release service version to 24.07.80. 2024-07-21 12:25:07 +02:00
134 changed files with 16321 additions and 16717 deletions

View File

@@ -8,13 +8,13 @@ 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 "08")
set(RELEASE_SERVICE_VERSION_MICRO "70") set(RELEASE_SERVICE_VERSION_MICRO "3")
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})
set(KF_MIN_VERSION "6.4") set(KF_MIN_VERSION "6.0")
set(QT_MIN_VERSION "6.5") set(QT_MIN_VERSION "6.5")
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE) find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
@@ -38,6 +38,7 @@ include(KDEGitCommitHooks)
include(ECMCheckOutboundLicense) include(ECMCheckOutboundLicense)
include(ECMQtDeclareLoggingCategory) include(ECMQtDeclareLoggingCategory)
include(ECMAddAndroidApk) include(ECMAddAndroidApk)
include(ECMQmlModule)
if (NOT ANDROID) if (NOT ANDROID)
include(KDEClangFormat) include(KDEClangFormat)
endif() endif()
@@ -59,7 +60,6 @@ set_package_properties(Qt6 PROPERTIES
PURPOSE "Basic application components" PURPOSE "Basic application components"
) )
qt_policy(SET QTP0001 NEW)
if (QT_KNOWN_POLICY_QTP0004) if (QT_KNOWN_POLICY_QTP0004)
qt_policy(SET QTP0004 NEW) qt_policy(SET QTP0004 NEW)
endif () endif ()

View File

@@ -274,7 +274,6 @@ void TextHandlerTest::receiveRichInPlainOut_data()
QTest::newRow("ampersand") << QStringLiteral("a &amp; b") << QStringLiteral("a & b"); QTest::newRow("ampersand") << QStringLiteral("a &amp; b") << QStringLiteral("a & b");
QTest::newRow("quote") << QStringLiteral("&quot;a and b&quot;") << QStringLiteral("\"a and b\""); QTest::newRow("quote") << QStringLiteral("&quot;a and b&quot;") << QStringLiteral("\"a and b\"");
QTest::newRow("new line") << QStringLiteral("new<br>line") << QStringLiteral("new\nline"); QTest::newRow("new line") << QStringLiteral("new<br>line") << QStringLiteral("new\nline");
QTest::newRow("unescape") << QStringLiteral("can&#x27;t") << QStringLiteral("can't");
} }
void TextHandlerTest::receiveRichInPlainOut() void TextHandlerTest::receiveRichInPlainOut()

View File

@@ -22,6 +22,7 @@
<name xml:lang="eo">NeoChat</name> <name xml:lang="eo">NeoChat</name>
<name xml:lang="es">NeoChat</name> <name xml:lang="es">NeoChat</name>
<name xml:lang="eu">NeoChat</name> <name xml:lang="eu">NeoChat</name>
<name xml:lang="fa">نئوچت</name>
<name xml:lang="fi">NeoChat</name> <name xml:lang="fi">NeoChat</name>
<name xml:lang="fr">NeoChat</name> <name xml:lang="fr">NeoChat</name>
<name xml:lang="gl">NeoChat</name> <name xml:lang="gl">NeoChat</name>
@@ -55,6 +56,7 @@
<summary xml:lang="ca">Xategeu amb els vostres amics a Matrix</summary> <summary xml:lang="ca">Xategeu amb els vostres amics a Matrix</summary>
<summary xml:lang="ca-valencia">Xategeu amb els vostres amics a Matrix</summary> <summary xml:lang="ca-valencia">Xategeu amb els vostres amics a Matrix</summary>
<summary xml:lang="cs">Mluvte se svými přáteli na Matrixu</summary> <summary xml:lang="cs">Mluvte se svými přáteli na Matrixu</summary>
<summary xml:lang="de">Mit den Freunden auf Matrix unterhalten</summary>
<summary xml:lang="en-GB">Chat with your friends on matrix</summary> <summary xml:lang="en-GB">Chat with your friends on matrix</summary>
<summary xml:lang="eo">Babilu kun viaj amikoj sur matrix</summary> <summary xml:lang="eo">Babilu kun viaj amikoj sur matrix</summary>
<summary xml:lang="es">Charle con sus amigos en matrix</summary> <summary xml:lang="es">Charle con sus amigos en matrix</summary>
@@ -72,6 +74,7 @@
<summary xml:lang="nl">Met uw vrienden chatten op 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="nn">Prat med vennar på Matrix</summary>
<summary xml:lang="pl">Rozmawiaj ze swoimi znajomymi w Matriksie</summary> <summary xml:lang="pl">Rozmawiaj ze swoimi znajomymi w Matriksie</summary>
<summary xml:lang="ru">Общение с друзьями в Matrix</summary>
<summary xml:lang="sl">Klepet z vašimi prijatelji na matrixu</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="sv">Chatta med dina vänner på Matrix</summary>
<summary xml:lang="ta">மேட்ரிக்ஸு மூலம் உங்கள் நண்பர்களிடம் பேசலாம்</summary> <summary xml:lang="ta">மேட்ரிக்ஸு மூலம் உங்கள் நண்பர்களிடம் பேசலாம்</summary>
@@ -85,12 +88,14 @@
<p xml:lang="ar">نيوتشات هو تطبيق دردشة يتيح لك الاستفادة الكاملة من شبكة Matrix. فهو يوفر لك طريقة آمنة لإرسال الرسائل النصية ومقاطع الفيديو والملفات الصوتية إلى عائلتك وزملائك وأصدقائك.</p> <p xml:lang="ar">نيوتشات هو تطبيق دردشة يتيح لك الاستفادة الكاملة من شبكة Matrix. فهو يوفر لك طريقة آمنة لإرسال الرسائل النصية ومقاطع الفيديو والملفات الصوتية إلى عائلتك وزملائك وأصدقائك.</p>
<p xml:lang="ca">El NeoChat és una aplicació de xat que us permet aprofitar plenament la xarxa Matrix. Proporciona una manera segura d'enviar missatges de text, vídeos i arxius d'àudio a la vostra família, companys i amics.</p> <p xml:lang="ca">El NeoChat és una aplicació de xat que us permet aprofitar plenament la xarxa Matrix. Proporciona una manera segura d'enviar missatges de text, vídeos i arxius d'àudio a la vostra família, companys i amics.</p>
<p xml:lang="ca-valencia">NeoChat és una aplicació de xat que us permet aprofitar plenament la xarxa Matrix. Proporciona una manera segura d'enviar missatges de text, vídeos i arxius d'àudio a la vostra família, companys i amics.</p> <p xml:lang="ca-valencia">NeoChat és una aplicació de xat que us permet aprofitar plenament la xarxa Matrix. Proporciona una manera segura d'enviar missatges de text, vídeos i arxius d'àudio a la vostra família, companys i amics.</p>
<p xml:lang="de">NeoChat ist eine Anwendung für Unterhaltungen mit allen Vorteilen des Matrix-Netzwerkes. Sie bietet eine sichere Möglichkeit zum Versenden von Nachrichten, Videos und Audiodateien and die Familienmitglieder.</p>
<p xml:lang="en-GB">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="en-GB">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="eo">NeoChat estas babilej-apo, kiu ebligas al vi plene profiti de la Matrix-reto. Ĝi provizas al vi sekuran manieron sendi tekstmesaĝojn, filmetojn kaj sondosierojn al via familio, kolegoj kaj amikoj.</p> <p xml:lang="eo">NeoChat estas babilej-apo, kiu ebligas al vi plene profiti de la Matrix-reto. Ĝi provizas al vi sekuran manieron sendi tekstmesaĝojn, filmetojn kaj sondosierojn al via familio, kolegoj kaj amikoj.</p>
<p xml:lang="es">NeoChat es una aplicación de chat que le permite aprovechar al máximo la red Matrix. Le proporciona un modo seguro de enviar mensajes de texto, vídeos y archivos de sonido a su familia, colegas y amigos.</p> <p xml:lang="es">NeoChat es una aplicación de chat que le permite aprovechar al máximo la red Matrix. Le proporciona un modo seguro de enviar mensajes de texto, vídeos y archivos de sonido a su familia, colegas y amigos.</p>
<p xml:lang="eu">NeoChat, Matrix sarearen abantaila guztiei probetsua ateratzeko aukera ematen dizun berriketa aplikaizo bat da. Zure familiari, kideei eta lagunei testu mezuak, bideoak eta audio fitxategiak era seguruan bidaltzeko aukera ematen dizu.</p> <p xml:lang="eu">NeoChat, Matrix sarearen abantaila guztiei probetsua ateratzeko aukera ematen dizun berriketa aplikaizo bat da. Zure familiari, kideei eta lagunei testu mezuak, bideoak eta audio fitxategiak era seguruan bidaltzeko aukera ematen dizu.</p>
<p xml:lang="fi">NeoChat on keskustelusovellus, jolla Matrix-verkosta saa täyden hyödyn. Se tarjoaa salatun kanavan lähettää perheelle, työkavereille ja ystäville tekstiviestejä sekä video- ja äänitiedostoja.</p> <p xml:lang="fi">NeoChat on keskustelusovellus, jolla Matrix-verkosta saa täyden hyödyn. Se tarjoaa salatun kanavan lähettää perheelle, työkavereille ja ystäville tekstiviestejä sekä video- ja äänitiedostoja.</p>
<p xml:lang="fr">NeoChat est une application de discussions vous permettant de profiter pleinement du réseau Matrix. Elle vous offre un moyen sécurisé d'envoyer des messages de texte, des vidéos et des fichiers audio à votre famille, vos collègues et vos ami(e)s.</p> <p xml:lang="fr">NeoChat est une application de discussions vous permettant de profiter pleinement du réseau Matrix. Elle vous offre un moyen sécurisé d'envoyer des messages de texte, des vidéos et des fichiers audio à votre famille, vos collègues et vos ami(e)s.</p>
<p xml:lang="gl">NeoChat é unha aplicación de conversa que lle permite usar todas as funcionalidades da rede Matrix. Fornece unha forma segura de enviar mensaxes de texto e ficheiros de vídeo e son a familiares, amizades ou no traballo.</p>
<p xml:lang="he">NeoChat הוא יישום התכתבות שמאפשר לך לנצל את רשת Matrix במלואה. הוא מספק דרך מאובטחת לשליחת הודעות כתובות, סרטונים וקובצי שמע למשפחה, לעמיתים לעבודה ולחברים.</p> <p xml:lang="he">NeoChat הוא יישום התכתבות שמאפשר לך לנצל את רשת Matrix במלואה. הוא מספק דרך מאובטחת לשליחת הודעות כתובות, סרטונים וקובצי שמע למשפחה, לעמיתים לעבודה ולחברים.</p>
<p xml:lang="hu">A NeoChat egy olyan csevegőalkalmazás, amellyel teljes mértékben kihasználhatja a Matrix hálózatot. Biztonságos módot biztosít szöveges üzenetek, videók és hangfájlok küldéséhez családtagjainak, kollégáinak és barátainak.</p> <p xml:lang="hu">A NeoChat egy olyan csevegőalkalmazás, amellyel teljes mértékben kihasználhatja a Matrix hálózatot. Biztonságos módot biztosít szöveges üzenetek, videók és hangfájlok küldéséhez családtagjainak, kollégáinak és barátainak.</p>
<p xml:lang="ia">NeoChat es un app de conversation que te permitte prender avantage plen del rete Matrix. Il te forni un modo secur de inviar messages de texto, videos e files audio a tui familia, collegas e amicos.</p> <p xml:lang="ia">NeoChat es un app de conversation que te permitte prender avantage plen del rete Matrix. Il te forni un modo secur de inviar messages de texto, videos e files audio a tui familia, collegas e amicos.</p>
@@ -100,6 +105,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>
@@ -110,6 +116,7 @@
<p xml:lang="ar">يهدف نيوتشات إلى أن يكون تطبيقًا كامل الميزات لمواصفات ماتركس. على هذا النحو يتم دعم كل شيء في المواصفات المستقرة الحالية مع الاستثناءات الملحوظة لـ VoIP والخيوط وبعض جوانب التشفير من طرف إلى طرف. هناك عدد قليل من الإغفالات الصغيرة الأخرى بسبب حقيقة أن مواصفات ماتركس تتطور باستمرار ، ولكن يبقى الهدف توفير الدعم النهائي للمواصفات بأكملها.</p> <p xml:lang="ar">يهدف نيوتشات إلى أن يكون تطبيقًا كامل الميزات لمواصفات ماتركس. على هذا النحو يتم دعم كل شيء في المواصفات المستقرة الحالية مع الاستثناءات الملحوظة لـ VoIP والخيوط وبعض جوانب التشفير من طرف إلى طرف. هناك عدد قليل من الإغفالات الصغيرة الأخرى بسبب حقيقة أن مواصفات ماتركس تتطور باستمرار ، ولكن يبقى الهدف توفير الدعم النهائي للمواصفات بأكملها.</p>
<p xml:lang="ca">NeoChat pretén ser una aplicació amb totes les característiques per a l'especificació de Matrix. Com a tal, s'ha implementat tota l'especificació actual estable amb les notables excepcions de la VoIP, fils i alguns aspectes de l'encriptatge d'extrem a extrem. Hi ha algunes altres omissions més petites a causa del fet que l'especificació de Matrix està evolucionant constantment, però l'objectiu segueix sent proporcionar suport eventual per a tota l'especificació.</p> <p xml:lang="ca">NeoChat pretén ser una aplicació amb totes les característiques per a l'especificació de Matrix. Com a tal, s'ha implementat tota l'especificació actual estable amb les notables excepcions de la VoIP, fils i alguns aspectes de l'encriptatge d'extrem a extrem. Hi ha algunes altres omissions més petites a causa del fet que l'especificació de Matrix està evolucionant constantment, però l'objectiu segueix sent proporcionar suport eventual per a tota l'especificació.</p>
<p xml:lang="ca-valencia">NeoChat pretén ser una aplicació amb totes les característiques per a l'especificació de Matrix. Com a tal, s'ha implementat tota l'especificació actual estable amb les notables excepcions de la VoIP, fils i alguns aspectes de l'encriptació d'extrem a extrem. Hi ha algunes altres omissions més xicotetes a causa del fet que l'especificació de Matrix està evolucionant constantment, però l'objectiu seguix sent proporcionar suport eventual per a tota l'especificació.</p> <p xml:lang="ca-valencia">NeoChat pretén ser una aplicació amb totes les característiques per a l'especificació de Matrix. Com a tal, s'ha implementat tota l'especificació actual estable amb les notables excepcions de la VoIP, fils i alguns aspectes de l'encriptació d'extrem a extrem. Hi ha algunes altres omissions més xicotetes a causa del fet que l'especificació de Matrix està evolucionant constantment, però l'objectiu seguix sent proporcionar suport eventual per a tota l'especificació.</p>
<p xml:lang="de">NeoChat versucht eine vollumfängliche Anwendung für die Spezifikation von Matrix zu sein. Damit wird alles der aktuellen stabilen Spezifikation mit den erwähnenswerten Ausnahmen von VoIP, Diskussionsfäden und ein paar Teilen der Ende-zu-Ende-Verschlüsselung unterstützt. Zudem sind andere kleinere Auslassungen vorhanden, da sich die Matrixspezifikation ständig weiterentwickelt. Nichtsdestotrotz soll letztendlich die gesamte Spezifikation unterstützt werden.</p>
<p xml:lang="en-GB">NeoChat aims to be a fully featured application for the Matrix specification. As such everything in the current stable specification with the notable exceptions of VoIP, threads and some aspects of End-to-End Encryption are supported. There are a few other smaller omissions due to the fact that the Matrix spec is constantly evolving but the aim remains to provide eventual support for the entire spec.</p> <p xml:lang="en-GB">NeoChat aims to be a fully featured application for the Matrix specification. As such everything in the current stable specification with the notable exceptions of VoIP, threads and some aspects of End-to-End Encryption are supported. There are a few other smaller omissions due to the fact that the Matrix spec is constantly evolving but the aim remains to provide eventual support for the entire spec.</p>
<p xml:lang="eo">NeoChat celas esti plene kapabla aplikaĵo por la Matrix-specifo. Kiel tia, ĉio en la nuna stabila specifo kun la rimarkindaj esceptoj de VoIP, fadenoj kaj kelkaj aspektoj de Fin-al-Fina Ĉifrado estas subtenataj. Estas kelkaj aliaj pli malgrandaj preterlasoj pro la fakto, ke la Matrix-speco konstante evoluas, sed la celo restas provizi finfine subtenon por la tuta specifaĵo.</p> <p xml:lang="eo">NeoChat celas esti plene kapabla aplikaĵo por la Matrix-specifo. Kiel tia, ĉio en la nuna stabila specifo kun la rimarkindaj esceptoj de VoIP, fadenoj kaj kelkaj aspektoj de Fin-al-Fina Ĉifrado estas subtenataj. Estas kelkaj aliaj pli malgrandaj preterlasoj pro la fakto, ke la Matrix-speco konstante evoluas, sed la celo restas provizi finfine subtenon por la tuta specifaĵo.</p>
<p xml:lang="es">NeoChat pretende ser una aplicación con todas las funciones para la especificación de Matrix. Como tal, admite todo en la especificación estable actual, con las notables excepciones de VoIP, subprocesos y algunas funciones de cifrado de extremo a extremo. Existen algunas omisiones menos importantes debido al hecho de que la especificación de Matrix está en constante evolución, pero el objetivo sigue siendo brindar compatibilidad final con toda la especificación.</p> <p xml:lang="es">NeoChat pretende ser una aplicación con todas las funciones para la especificación de Matrix. Como tal, admite todo en la especificación estable actual, con las notables excepciones de VoIP, subprocesos y algunas funciones de cifrado de extremo a extremo. Existen algunas omisiones menos importantes debido al hecho de que la especificación de Matrix está en constante evolución, pero el objetivo sigue siendo brindar compatibilidad final con toda la especificación.</p>
@@ -139,6 +146,7 @@
<p xml:lang="ar">نظرًا لطبيعة تطوير مواصفات ماتركس، يدعم نيوتشات أيضًا العديد من الميزات غير المستقرة وهي:</p> <p xml:lang="ar">نظرًا لطبيعة تطوير مواصفات ماتركس، يدعم نيوتشات أيضًا العديد من الميزات غير المستقرة وهي:</p>
<p xml:lang="ca">A causa de la naturalesa del desenvolupament de l'especificació de Matrix, el NeoChat també implementa nombroses característiques inestables. Actualment són:</p> <p xml:lang="ca">A causa de la naturalesa del desenvolupament de l'especificació de Matrix, el NeoChat també implementa nombroses característiques inestables. Actualment són:</p>
<p xml:lang="ca-valencia">A causa de la naturalea del desenvolupament de l'especificació de Matrix, NeoChat també implementa nombroses característiques inestables. Actualment són:</p> <p xml:lang="ca-valencia">A causa de la naturalea del desenvolupament de l'especificació de Matrix, NeoChat també implementa nombroses característiques inestables. Actualment són:</p>
<p xml:lang="de">Durch die Weiterentwicklung der Matrix-Spezifikation unterstützt auch NeoChat einige als noch instabil gekennzeichnete Funktionen. Derzeit sind das:</p>
<p xml:lang="en-GB">Due to the nature of the Matrix specification development NeoChat also supports numerous unstable features. Currently these are:</p> <p xml:lang="en-GB">Due to the nature of the Matrix specification development NeoChat also supports numerous unstable features. Currently these are:</p>
<p xml:lang="eo">Pro la naturo de la Matrix-specifevoluo NeoChat ankaŭ subtenas multajn malstabilajn funkciojn. Nuntempe ĉi tiuj estas:</p> <p xml:lang="eo">Pro la naturo de la Matrix-specifevoluo NeoChat ankaŭ subtenas multajn malstabilajn funkciojn. Nuntempe ĉi tiuj estas:</p>
<p xml:lang="es">Debido a la naturaleza del desarrollo de la especificación de Matrix, NeoChat también permite numerosas funciones no estables, como:</p> <p xml:lang="es">Debido a la naturaleza del desarrollo de la especificación de Matrix, NeoChat también permite numerosas funciones no estables, como:</p>
@@ -188,6 +196,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>
@@ -293,6 +302,7 @@
<caption xml:lang="ar">العرض الرئيسة مع قائمة الغرف والدردشات و معلومات الغرفة</caption> <caption xml:lang="ar">العرض الرئيسة مع قائمة الغرف والدردشات و معلومات الغرفة</caption>
<caption xml:lang="ca">Vista principal amb la llista de sales, xats i informació de les sales</caption> <caption xml:lang="ca">Vista principal amb la llista de sales, xats i informació de les sales</caption>
<caption xml:lang="ca-valencia">Vista principal amb la llista de sales, xats i informació de les sales</caption> <caption xml:lang="ca-valencia">Vista principal amb la llista de sales, xats i informació de les sales</caption>
<caption xml:lang="de">Hauptansicht mit Raumliste, Unterhaltung und Raum-Informationen</caption>
<caption xml:lang="en-GB">Main view with room list, chat, and room information</caption> <caption xml:lang="en-GB">Main view with room list, chat, and room information</caption>
<caption xml:lang="eo">Ĉefa vido kun ĉambra listo, babilejo kaj ĉambra informo</caption> <caption xml:lang="eo">Ĉefa vido kun ĉambra listo, babilejo kaj ĉambra informo</caption>
<caption xml:lang="es">Vista principal con la lista de salas, chat e información de la sala</caption> <caption xml:lang="es">Vista principal con la lista de salas, chat e información de la sala</caption>
@@ -326,12 +336,14 @@
<caption xml:lang="ar">اكتشف مجتمعات جديدة مع فضاءات ماتركس</caption> <caption xml:lang="ar">اكتشف مجتمعات جديدة مع فضاءات ماتركس</caption>
<caption xml:lang="ca">Descobriu comunitats noves amb els espais de Matrix</caption> <caption xml:lang="ca">Descobriu comunitats noves amb els espais de Matrix</caption>
<caption xml:lang="ca-valencia">Descobriu comunitats noves amb els espais de Matrix</caption> <caption xml:lang="ca-valencia">Descobriu comunitats noves amb els espais de Matrix</caption>
<caption xml:lang="de">Neue Gemeinschaften mit den Umgebungen von Matrix erkunden</caption>
<caption xml:lang="en-GB">Discover new communities with Matrix Spaces</caption> <caption xml:lang="en-GB">Discover new communities with Matrix Spaces</caption>
<caption xml:lang="eo">Malkovru novajn komunumojn per Matrix Spaces</caption> <caption xml:lang="eo">Malkovru novajn komunumojn per Matrix Spaces</caption>
<caption xml:lang="es">Descubra nuevas comunidades con los espacios de Matrix</caption> <caption xml:lang="es">Descubra nuevas comunidades con los espacios de Matrix</caption>
<caption xml:lang="eu">Ezagutu komunitate berriak Matrixeko Tokiak erabiliz</caption> <caption xml:lang="eu">Ezagutu komunitate berriak Matrixeko Tokiak erabiliz</caption>
<caption xml:lang="fi">Löydä uusia yhteisöjä Matrix Spacesillä</caption> <caption xml:lang="fi">Löydä uusia yhteisöjä Matrix Spacesillä</caption>
<caption xml:lang="fr">Découvrez de nouvelles communautés avec les espaces sous Matrix</caption> <caption xml:lang="fr">Découvrez de nouvelles communautés avec les espaces sous Matrix</caption>
<caption xml:lang="gl">Descubra novas comunidades dos espazos de Matrix.</caption>
<caption xml:lang="he">אפשר להיחשף לקהילות חדשות דרך Matrix Spaces</caption> <caption xml:lang="he">אפשר להיחשף לקהילות חדשות דרך Matrix Spaces</caption>
<caption xml:lang="hu">Fedezzen fel új közösségeket a Matrix Terek segítségével</caption> <caption xml:lang="hu">Fedezzen fel új közösségeket a Matrix Terek segítségével</caption>
<caption xml:lang="ia">Discoperi nove communitate con Matrix Spaces (Spatios de Matrix)</caption> <caption xml:lang="ia">Discoperi nove communitate con Matrix Spaces (Spatios de Matrix)</caption>
@@ -341,8 +353,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>
@@ -361,6 +375,7 @@
<caption xml:lang="ar">العرض الرئيسة مع قائمة الغرف والدردشات و معلومات الغرفة</caption> <caption xml:lang="ar">العرض الرئيسة مع قائمة الغرف والدردشات و معلومات الغرفة</caption>
<caption xml:lang="ca">Vista principal amb la llista de sales, xats i informació de les sales</caption> <caption xml:lang="ca">Vista principal amb la llista de sales, xats i informació de les sales</caption>
<caption xml:lang="ca-valencia">Vista principal amb la llista de sales, xats i informació de les sales</caption> <caption xml:lang="ca-valencia">Vista principal amb la llista de sales, xats i informació de les sales</caption>
<caption xml:lang="de">Hauptansicht mit Raumliste, Unterhaltung und Raum-Informationen</caption>
<caption xml:lang="en-GB">Main view with room list, chat, and room information</caption> <caption xml:lang="en-GB">Main view with room list, chat, and room information</caption>
<caption xml:lang="eo">Ĉefa vido kun ĉambra listo, babilejo kaj ĉambra informo</caption> <caption xml:lang="eo">Ĉefa vido kun ĉambra listo, babilejo kaj ĉambra informo</caption>
<caption xml:lang="es">Vista principal con la lista de salas, chat e información de la sala</caption> <caption xml:lang="es">Vista principal con la lista de salas, chat e información de la sala</caption>
@@ -395,6 +410,7 @@
<caption xml:lang="ca">Pantalla d'inici de sessió</caption> <caption xml:lang="ca">Pantalla d'inici de sessió</caption>
<caption xml:lang="ca-valencia">Pantalla d'inici de sessió</caption> <caption xml:lang="ca-valencia">Pantalla d'inici de sessió</caption>
<caption xml:lang="cs">Přihlašovací obrazovka</caption> <caption xml:lang="cs">Přihlašovací obrazovka</caption>
<caption xml:lang="de">Anmeldebildschirm</caption>
<caption xml:lang="en-GB">Login screen</caption> <caption xml:lang="en-GB">Login screen</caption>
<caption xml:lang="eo">Ensaluta ekrano</caption> <caption xml:lang="eo">Ensaluta ekrano</caption>
<caption xml:lang="es">Pantalla de inicio de sesión</caption> <caption xml:lang="es">Pantalla de inicio de sesión</caption>
@@ -427,6 +443,10 @@
<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.1" date="2024-09-12"/>
<release version="24.08.0" date="2024-08-22"/>
<release version="24.05.2" date="2024-07-04"/> <release version="24.05.2" date="2024-07-04"/>
<release version="24.05.1" date="2024-06-13"/> <release version="24.05.1" date="2024-06-13"/>
<release version="24.05.0" date="2024-05-23"/> <release version="24.05.0" date="2024-05-23"/>

View File

@@ -15,6 +15,7 @@ Name[en_GB]=NeoChat
Name[eo]=NeoChat Name[eo]=NeoChat
Name[es]=NeoChat Name[es]=NeoChat
Name[eu]=NeoChat Name[eu]=NeoChat
Name[fa]=نئوچت
Name[fi]=NeoChat Name[fi]=NeoChat
Name[fr]=NeoChat Name[fr]=NeoChat
Name[gl]=NeoChat Name[gl]=NeoChat

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

5383
po/fa/neochat.po Normal file

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

158
snapcraft.yaml Normal file
View File

@@ -0,0 +1,158 @@
# SPDX-FileCopyrightText: 2024 Scarlett Moore <sgmoore@kde.org>
#
# SPDX-License-Identifier: CC0-1.0
---
name: neochat
base: core22
adopt-info: neochat
grade: stable
confinement: strict
apps:
neochat:
extensions:
- kde-neon-6
command: usr/bin/neochat
common-id: org.kde.neochat
desktop: usr/share/applications/org.kde.neochat.desktop
plugs:
- home
- removable-media
- audio-playback
- unity7
- network
- network-bind
- network-manager-observe
- password-manager-service
- accounts-service
compression: lzo
slots:
session-dbus-interface:
interface: dbus
name: org.kde.neochat
bus: session
parts:
olm:
source: https://gitlab.matrix.org/matrix-org/olm.git
source-depth: 1
source-tag: '3.2.12'
plugin: cmake
cmake-parameters:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr
prime:
- -usr/include
- -usr/lib/*/pkgconfig
- -usr/lib/*/cmake
libsecret:
source: https://gitlab.gnome.org/GNOME/libsecret.git
source-tag: '0.21.4'
source-depth: 1
plugin: meson
meson-parameters:
- --prefix=/usr
- -Doptimization=3
- -Ddebug=true
- -Dmanpage=false
- -Dvapi=false
- -Dintrospection=false
- -Dcrypto=disabled
- -Dgtk_doc=false
build-packages:
- meson
- libglib2.0-dev
- libgcrypt20-dev
prime:
- -usr/include
- -usr/lib/*/pkgconfig
qtkeychain:
after: [libsecret]
source: https://github.com/frankosterfeld/qtkeychain.git
source-tag: 0.14.3
source-depth: 1
plugin: cmake
build-environment:
- PKG_CONFIG_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$PKG_CONFIG_PATH
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_BUILD_TYPE=Release
- -DBUILD_TRANSLATIONS=NO
- -DBUILD_WITH_QT6=ON
prime:
- -usr/include
- -usr/lib/*/pkgconfig
- -usr/lib/*/cmake
libquotient:
after:
- olm
- qtkeychain
source: https://github.com/quotient-im/libQuotient.git
source-tag: 0.9.1
source-depth: 1
plugin: cmake
build-packages:
- libssl-dev
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_BUILD_TYPE=Release
- -DBUILD_TESTING=OFF
- -DQuotient_ENABLE_E2EE=ON
- -DBUILD_WITH_QT6=ON
prime:
- -usr/include
- -usr/lib/*/pkgconfig
- -usr/lib/*/cmake
kquickimageeditor:
source: https://invent.kde.org/libraries/kquickimageeditor.git
source-tag: 'v0.3.0'
source-depth: 1
plugin: cmake
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_BUILD_TYPE=Release
- -DBUILD_WITH_QT6=ON
- -DBUILD_TESTING=OFF
prime:
- -usr/include
- -usr/lib/*/pkgconfig
- -usr/lib/*/cmake
neochat:
after:
- qtkeychain
- libquotient
- kquickimageeditor
parse-info:
- usr/share/metainfo/org.kde.neochat.appdata.xml
source: .
source-type: local
plugin: cmake
build-packages:
- cmark
- libcmark-dev
- libsqlite3-dev
- libvulkan-dev
- libxkbcommon-dev
- libicu-dev
- libpulse0
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_BUILD_TYPE=Release
- -DBUILD_TESTING=OFF
prime:
- -usr/share/man
deps:
after: [neochat]
plugin: nil
stage-packages:
- libcmark0.30.2
prime:
- usr/lib/*/libcmark.so*

View File

@@ -198,6 +198,12 @@ set_source_files_properties(qml/OsmLocationPlugin.qml PROPERTIES
QT_QML_SINGLETON_TYPE TRUE QT_QML_SINGLETON_TYPE TRUE
) )
if(ANDROID OR WIN32)
set_source_files_properties(qml/ShareActionStub.qml PROPERTIES
QT_QML_SOURCE_TYPENAME ShareAction
)
endif()
ecm_add_qml_module(neochat URI org.kde.neochat GENERATE_PLUGIN_SOURCE ecm_add_qml_module(neochat URI org.kde.neochat GENERATE_PLUGIN_SOURCE
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat
QML_FILES QML_FILES
@@ -288,7 +294,6 @@ ecm_add_qml_module(neochat URI org.kde.neochat GENERATE_PLUGIN_SOURCE
qml/ConsentDialog.qml qml/ConsentDialog.qml
qml/AskDirectChatConfirmation.qml qml/AskDirectChatConfirmation.qml
qml/HoverLinkIndicator.qml qml/HoverLinkIndicator.qml
qml/AvatarNotification.qml
DEPENDENCIES DEPENDENCIES
QtCore QtCore
QtQuick QtQuick
@@ -309,13 +314,9 @@ add_subdirectory(chatbar)
if(UNIX) if(UNIX)
qt_target_qml_sources(neochat QML_FILES qml/ShareAction.qml) qt_target_qml_sources(neochat QML_FILES qml/ShareAction.qml)
else() else()
set_source_files_properties(qml/ShareActionStub.qml PROPERTIES
QT_RESOURCE_ALIAS qml/ShareAction.qml
)
qt_target_qml_sources(neochat QML_FILES qml/ShareActionStub.qml) qt_target_qml_sources(neochat QML_FILES qml/ShareActionStub.qml)
endif() endif()
configure_file(config-neochat.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-neochat.h) configure_file(config-neochat.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-neochat.h)
if(WIN32) if(WIN32)
@@ -426,7 +427,7 @@ if (TARGET KF6::Crash)
target_link_libraries(neochat PUBLIC KF6::Crash) target_link_libraries(neochat PUBLIC KF6::Crash)
endif() endif()
kconfig_target_kcfg_file(neochat FILE neochatconfig.kcfg CLASS_NAME NeoChatConfig MUTATORS GENERATE_PROPERTIES DEFAULT_VALUE_GETTERS PARENT_IN_CONSTRUCTOR SINGLETON GENERATE_MOC QML_REGISTRATION) kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc)
if(NEOCHAT_FLATPAK) if(NEOCHAT_FLATPAK)
target_compile_definitions(neochat PUBLIC NEOCHAT_FLATPAK) target_compile_definitions(neochat PUBLIC NEOCHAT_FLATPAK)

View File

@@ -91,10 +91,18 @@ void ActionsHandler::handleMessage(const QString &text, QString handledText, Cha
for (auto it = m_room->messageEvents().crbegin(); it != m_room->messageEvents().crend(); it++) { for (auto it = m_room->messageEvents().crbegin(); it != m_room->messageEvents().crend(); it++) {
if (const auto event = eventCast<const RoomMessageEvent>(&**it)) { if (const auto event = eventCast<const RoomMessageEvent>(&**it)) {
#if Quotient_VERSION_MINOR > 8
if (event->senderId() == m_room->localMember().id() && event->has<EventContent::TextContent>()) {
#else
if (event->senderId() == m_room->localMember().id() && event->hasTextContent()) { if (event->senderId() == m_room->localMember().id() && event->hasTextContent()) {
#endif
QString originalString; QString originalString;
if (event->content()) { if (event->content()) {
#if Quotient_VERSION_MINOR > 8
originalString = event->get<EventContent::TextContent>()->body;
#else
originalString = static_cast<const Quotient::EventContent::TextContent *>(event->content())->body; originalString = static_cast<const Quotient::EventContent::TextContent *>(event->content())->body;
#endif
} else { } else {
originalString = event->plainBody(); originalString = event->plainBody();
} }

View File

@@ -219,7 +219,7 @@ QQC2.Control {
} }
onTextChanged: { onTextChanged: {
if (!repeatTimer.running && NeoChatConfig.typingNotifications) { if (!repeatTimer.running && Config.typingNotifications) {
var textExists = text.length > 0; var textExists = text.length > 0;
root.currentRoom.sendTypingNotification(textExists); root.currentRoom.sendTypingNotification(textExists);
textExists ? repeatTimer.start() : repeatTimer.stop(); textExists ? repeatTimer.start() : repeatTimer.stop();
@@ -353,8 +353,8 @@ QQC2.Control {
startBreakpoint: Kirigami.Units.gridUnit * 46 startBreakpoint: Kirigami.Units.gridUnit * 46
endBreakpoint: Kirigami.Units.gridUnit * 66 endBreakpoint: Kirigami.Units.gridUnit * 66
startPercentWidth: 100 startPercentWidth: 100
endPercentWidth: NeoChatConfig.compactLayout ? 100 : 85 endPercentWidth: Config.compactLayout ? 100 : 85
maxWidth: NeoChatConfig.compactLayout ? -1 : Kirigami.Units.gridUnit * 60 maxWidth: Config.compactLayout ? -1 : Kirigami.Units.gridUnit * 60
parentWidth: root.width parentWidth: root.width
} }

View File

@@ -120,7 +120,11 @@ QString ChatBarCache::relationMessage() const
if (auto event = room->findInTimeline(m_relationId); event != room->historyEdge()) { if (auto event = room->findInTimeline(m_relationId); event != room->historyEdge()) {
EventHandler eventhandler(room, &**event); EventHandler eventhandler(room, &**event);
return eventhandler.getMarkdownBody(); if (isEditing()) {
return eventhandler.getMarkdownBody();
} else {
return eventhandler.getMarkdownBody().toHtmlEscaped();
}
} }
return {}; return {};
} }

View File

@@ -9,18 +9,12 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <QGuiApplication> #include <QGuiApplication>
#include <QNetworkReply>
#include <QRandomGenerator>
#include <QTcpServer>
#include <QTimer> #include <QTimer>
#include <QCoroNetworkReply>
#include <signal.h> #include <signal.h>
#include <Quotient/accountregistry.h> #include <Quotient/accountregistry.h>
#include <Quotient/csapi/notifications.h> #include <Quotient/csapi/notifications.h>
#include <Quotient/csapi/wellknown.h>
#include <Quotient/qt_connection_util.h> #include <Quotient/qt_connection_util.h>
#include <Quotient/settings.h> #include <Quotient/settings.h>
@@ -51,7 +45,6 @@
bool testMode = false; bool testMode = false;
using namespace Quotient; using namespace Quotient;
using namespace Qt::Literals::StringLiterals;
Controller::Controller(QObject *parent) Controller::Controller(QObject *parent)
: QObject(parent) : QObject(parent)
@@ -71,7 +64,11 @@ 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"));
#else
c->assumeIdentity(QStringLiteral("@user:localhost:1234"), QStringLiteral("token_1234")); 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();
@@ -209,20 +206,33 @@ void Controller::invokeLogin()
m_connectionsLoading[accountId] = connection; m_connectionsLoading[accountId] = connection;
connect(connection, &NeoChatConnection::connected, this, [this, connection, accountId] { connect(connection, &NeoChatConnection::connected, this, [this, connection, accountId] {
connection->loadState(); connection->loadState();
addConnection(connection); if (connection->allRooms().size() == 0 || connection->allRooms()[0]->currentState().get<RoomCreateEvent>()) {
m_accountsLoading.removeAll(connection->userId()); addConnection(connection);
m_connectionsLoading.remove(accountId); m_accountsLoading.removeAll(connection->userId());
Q_EMIT accountsLoadingChanged(); m_connectionsLoading.remove(accountId);
Q_EMIT accountsLoadingChanged();
} else {
connect(
connection->allRooms()[0],
&Room::baseStateLoaded,
this,
[this, connection, accountId]() {
addConnection(connection);
m_accountsLoading.removeAll(connection->userId());
m_connectionsLoading.remove(accountId);
Q_EMIT accountsLoadingChanged();
},
Qt::SingleShotConnection);
}
}); });
connect(connection, &NeoChatConnection::networkError, this, [this](const QString &error, const QString &, int, int) { connect(connection, &NeoChatConnection::networkError, this, [this](const QString &error, const QString &, int, int) {
Q_EMIT errorOccured(i18n("Network Error: %1", error), {}); Q_EMIT errorOccured(i18n("Network Error: %1", error), {});
}); });
#if Quotient_VERSION_MINOR > 8
if (!account.clientId().isEmpty()) { connection->assumeIdentity(account.userId(), account.deviceId(), accessToken);
connection->assumeOidcIdentity(account.userId(), accessToken, account.clientId(), account.tokenEndpoint()); #else
} else { connection->assumeIdentity(account.userId(), accessToken);
connection->assumeIdentity(account.userId(), accessToken); #endif
}
}); });
} }
} }
@@ -263,23 +273,19 @@ QKeychain::ReadPasswordJob *Controller::loadAccessTokenFromKeyChain(const QStrin
return job; return job;
} }
bool Controller::saveAccessTokenToKeyChain(const QString &userId, const QByteArray &accessToken) void Controller::saveAccessTokenToKeyChain(const QString &userId, const QByteArray &accessToken)
{ {
qDebug() << "Save the access token to the keychain for " << userId; qDebug() << "Save the access token to the keychain for " << userId;
QKeychain::WritePasswordJob job(qAppName()); auto job = new QKeychain::WritePasswordJob(qAppName());
job.setAutoDelete(false); job->setAutoDelete(true);
job.setKey(userId); job->setKey(userId);
job.setBinaryData(accessToken); job->setBinaryData(accessToken);
QEventLoop loop; connect(job, &QKeychain::WritePasswordJob::finished, this, [job]() {
QKeychain::WritePasswordJob::connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit); if (job->error()) {
job.start(); qWarning() << "Could not save access token to the keychain: " << qPrintable(job->errorString());
loop.exec(); }
});
if (job.error()) { job->start();
qWarning() << "Could not save access token to the keychain: " << qPrintable(job.errorString());
return false;
}
return true;
} }
bool Controller::supportSystemTray() const bool Controller::supportSystemTray() const
@@ -421,29 +427,11 @@ void Controller::removeConnection(const QString &userId)
bool Controller::csSupported() const bool Controller::csSupported() const
{ {
#if Quotient_VERSION_MINOR > 8 #if Quotient_VERSION_MINOR > 9
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
NeoChatConnection *Controller::pendingOidcConnection() const
{
return m_pendingOidcConnection.get();
}
void Controller::startOidcLogin(const QString &homeserver)
{
auto url = QUrl::fromUserInput(homeserver.startsWith(u"https:"_s) ? homeserver : u"https://%1"_s.arg(homeserver));
m_pendingOidcConnection = new NeoChatConnection(url, this);
Q_EMIT pendingOidcConnectionChanged();
m_pendingOidcConnection->startOidcLogin();
connect(m_pendingOidcConnection, &Connection::connected, this, [this]() {
m_pendingOidcConnection->loadState();
addConnection(m_pendingOidcConnection);
setActiveConnection(m_pendingOidcConnection);
});
}
#include "moc_controller.cpp" #include "moc_controller.cpp"

View File

@@ -52,8 +52,6 @@ class Controller : public QObject
Q_PROPERTY(bool csSupported READ csSupported CONSTANT) Q_PROPERTY(bool csSupported READ csSupported CONSTANT)
Q_PROPERTY(NeoChatConnection *pendingOidcConnection READ pendingOidcConnection NOTIFY pendingOidcConnectionChanged)
public: public:
/** /**
* @brief Define the types on inline messages that can be shown. * @brief Define the types on inline messages that can be shown.
@@ -88,7 +86,7 @@ public:
/** /**
* @brief Save an access token to the keychain for the given account. * @brief Save an access token to the keychain for the given account.
*/ */
bool saveAccessTokenToKeyChain(const QString &userId, const QByteArray &accessToken); void saveAccessTokenToKeyChain(const QString &userId, const QByteArray &accessToken);
[[nodiscard]] bool supportSystemTray() const; [[nodiscard]] bool supportSystemTray() const;
@@ -108,12 +106,8 @@ public:
Q_INVOKABLE void removeConnection(const QString &userId); Q_INVOKABLE void removeConnection(const QString &userId);
Q_INVOKABLE void startOidcLogin(const QString &homeserver);
bool csSupported() const; bool csSupported() const;
NeoChatConnection *pendingOidcConnection() const;
private: private:
explicit Controller(QObject *parent = nullptr); explicit Controller(QObject *parent = nullptr);
@@ -125,13 +119,10 @@ private:
void loadSettings(); void loadSettings();
void saveSettings() const; void saveSettings() const;
QCoro::Task<void> doStartOidcLogin(QString homeserver);
Quotient::AccountRegistry m_accountRegistry; Quotient::AccountRegistry m_accountRegistry;
QStringList m_accountsLoading; QStringList m_accountsLoading;
QMap<QString, QPointer<NeoChatConnection>> m_connectionsLoading; QMap<QString, QPointer<NeoChatConnection>> m_connectionsLoading;
QString m_endpoint; QString m_endpoint;
QPointer<NeoChatConnection> m_pendingOidcConnection;
private Q_SLOTS: private Q_SLOTS:
void invokeLogin(); void invokeLogin();
@@ -145,5 +136,4 @@ Q_SIGNALS:
void activeConnectionChanged(NeoChatConnection *connection); void activeConnectionChanged(NeoChatConnection *connection);
void accountsLoadingChanged(); void accountsLoadingChanged();
void showMessage(MessageType messageType, const QString &message); void showMessage(MessageType messageType, const QString &message);
void pendingOidcConnectionChanged();
}; };

View File

@@ -17,25 +17,25 @@ FormCard.FormCardPage {
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
text: i18nc("@option:check", "Show hidden events in the timeline") text: i18nc("@option:check", "Show hidden events in the timeline")
checked: NeoChatConfig.showAllEvents checked: Config.showAllEvents
onToggled: NeoChatConfig.showAllEvents = checked onToggled: Config.showAllEvents = checked
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: roomAccountDataVisibleCheck id: roomAccountDataVisibleCheck
text: i18nc("@option:check Enable the matrix 'threads' feature", "Always allow device verification") text: i18nc("@option:check Enable the matrix 'threads' feature", "Always allow device verification")
description: i18n("Allow the user to start a verification session with devices that were already verified") description: i18n("Allow the user to start a verification session with devices that were already verified")
checked: NeoChatConfig.alwaysVerifyDevice checked: Config.alwaysVerifyDevice
onToggled: NeoChatConfig.alwaysVerifyDevice = checked onToggled: Config.alwaysVerifyDevice = checked
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
text: i18nc("@option:check", "Show focus in window header") text: i18nc("@option:check", "Show focus in window header")
checked: NeoChatConfig.windowTitleFocus checked: Config.windowTitleFocus
onToggled: { onToggled: {
NeoChatConfig.windowTitleFocus = checked; Config.windowTitleFocus = checked;
NeoChatConfig.save(); Config.save();
} }
} }
} }

View File

@@ -18,23 +18,23 @@ FormCard.FormCardPage {
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: roomAccountDataVisibleCheck id: roomAccountDataVisibleCheck
text: i18nc("@option:check Enable the matrix 'threads' feature", "Threads") text: i18nc("@option:check Enable the matrix 'threads' feature", "Threads")
checked: NeoChatConfig.threads checked: Config.threads
onToggled: NeoChatConfig.threads = checked onToggled: Config.threads = checked
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
text: i18nc("@option:check Enable the matrix 'secret backup' feature", "Secret Backup") text: i18nc("@option:check Enable the matrix 'secret backup' feature", "Secret Backup")
checked: NeoChatConfig.secretBackup checked: Config.secretBackup
onToggled: NeoChatConfig.secretBackup = checked onToggled: Config.secretBackup = checked
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
text: i18nc("@option:check Enable the matrix feature to add a phone number as a third party ID", "Add phone numbers as 3PIDs") text: i18nc("@option:check Enable the matrix feature to add a phone number as a third party ID", "Add phone numbers as 3PIDs")
checked: NeoChatConfig.phone3PId checked: Config.phone3PId
onToggled: { onToggled: {
NeoChatConfig.phone3PId = checked Config.phone3PId = checked
NeoChatConfig.save(); Config.save();
} }
} }
} }

View File

@@ -9,6 +9,8 @@
#include <Quotient/eventitem.h> #include <Quotient/eventitem.h>
#include <Quotient/events/encryptionevent.h> #include <Quotient/events/encryptionevent.h>
#include <Quotient/events/event.h>
#include <Quotient/events/eventcontent.h>
#include <Quotient/events/reactionevent.h> #include <Quotient/events/reactionevent.h>
#include <Quotient/events/redactionevent.h> #include <Quotient/events/redactionevent.h>
#include <Quotient/events/roomavatarevent.h> #include <Quotient/events/roomavatarevent.h>
@@ -234,10 +236,18 @@ QString EventHandler::rawMessageBody(const Quotient::RoomMessageEvent &event)
{ {
QString body; QString body;
#if Quotient_VERSION_MINOR > 8
if (event.has<EventContent::FileContent>()) {
#else
if (event.hasFileContent()) { if (event.hasFileContent()) {
#endif
// 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;
#else
QString filename = event.content()->fileInfo()->originalName; 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();
@@ -245,8 +255,13 @@ QString EventHandler::rawMessageBody(const Quotient::RoomMessageEvent &event)
return body; return body;
} }
#if Quotient_VERSION_MINOR > 8
if (event.has<EventContent::TextContent>() && event.content()) {
body = event.get<EventContent::TextContent>()->body;
#else
if (event.hasTextContent() && event.content()) { if (event.hasTextContent() && event.content()) {
body = static_cast<const EventContent::TextContent *>(event.content())->body; body = static_cast<const EventContent::TextContent *>(event.content())->body;
#endif
} else { } else {
body = event.plainBody(); body = event.plainBody();
} }
@@ -294,7 +309,7 @@ QString EventHandler::getBody(const Quotient::RoomEvent *event, Qt::TextFormat f
{ {
if (event->isRedacted()) { if (event->isRedacted()) {
auto reason = event->redactedBecause()->reason(); auto reason = event->redactedBecause()->reason();
return (reason.isEmpty()) ? i18n("<i>[This message was deleted]</i>") : i18n("<i>[This message was deleted: %1]</i>", reason); return (reason.isEmpty()) ? i18n("<i>[This message was deleted]</i>") : i18n("<i>[This message was deleted: %1]</i>", reason.toHtmlEscaped());
} }
const bool prettyPrint = (format == Qt::RichText); const bool prettyPrint = (format == Qt::RichText);
@@ -461,11 +476,16 @@ QString EventHandler::getMessageBody(const RoomMessageEvent &event, Qt::TextForm
{ {
TextHandler textHandler; TextHandler textHandler;
#if Quotient_VERSION_MINOR > 8
if (event.has<EventContent::FileContent>()) {
QString fileCaption = event.get<EventContent::FileContent>()->originalName;
#else
if (event.hasFileContent()) { if (event.hasFileContent()) {
auto fileCaption = event.content()->fileInfo()->originalName; auto fileCaption = event.content()->fileInfo()->originalName;
#endif
if (fileCaption.isEmpty()) { if (fileCaption.isEmpty()) {
fileCaption = event.plainBody(); fileCaption = event.plainBody();
} else if (event.content()->fileInfo()->originalName != event.plainBody()) { } else if (fileCaption != event.plainBody()) {
fileCaption = event.plainBody() + " | "_ls + fileCaption; fileCaption = event.plainBody() + " | "_ls + fileCaption;
} }
textHandler.setData(fileCaption); textHandler.setData(fileCaption);
@@ -473,8 +493,13 @@ QString EventHandler::getMessageBody(const RoomMessageEvent &event, Qt::TextForm
} }
QString body; QString body;
#if Quotient_VERSION_MINOR > 8
if (event.has<EventContent::TextContent>() && event.content()) {
body = event.get<EventContent::TextContent>()->body;
#else
if (event.hasTextContent() && event.content()) { if (event.hasTextContent() && event.content()) {
body = static_cast<const EventContent::TextContent *>(event.content())->body; body = static_cast<const EventContent::TextContent *>(event.content())->body;
#endif
} else { } else {
body = event.plainBody(); body = event.plainBody();
} }
@@ -655,39 +680,65 @@ QVariantMap EventHandler::getMediaInfoForEvent(const Quotient::RoomEvent *event)
// 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 Quotient_VERSION_MINOR > 8
if (!roomMessageEvent->has<EventContent::FileContentBase>()) {
#else
if (!roomMessageEvent->hasFileContent()) { if (!roomMessageEvent->hasFileContent()) {
#endif
return {}; return {};
} }
const EventContent::FileInfo *fileInfo; #if Quotient_VERSION_MINOR > 8
fileInfo = roomMessageEvent->content()->fileInfo(); const auto content = roomMessageEvent->get<EventContent::FileContentBase>();
QVariantMap mediaInfo = getMediaInfoFromFileInfo(fileInfo, eventId, false, false); QVariantMap mediaInfo = getMediaInfoFromFileInfo(content.get(), eventId, false, false);
#else
const auto content = static_cast<const EventContent::FileContent *>(roomMessageEvent->content());
QVariantMap mediaInfo = getMediaInfoFromFileInfo(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
mediaInfo["filename"_ls] = (fileInfo->originalName.isEmpty()) ? roomMessageEvent->plainBody() : fileInfo->originalName; #if Quotient_VERSION_MINOR > 8
mediaInfo["filename"_ls] = content->commonInfo().originalName.isEmpty() ? roomMessageEvent->plainBody() : content->commonInfo().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>()) {
const EventContent::FileInfo *fileInfo;
auto stickerEvent = eventCast<const StickerEvent>(event); auto stickerEvent = eventCast<const StickerEvent>(event);
fileInfo = &stickerEvent->image(); auto content = &stickerEvent->image();
return getMediaInfoFromFileInfo(fileInfo, eventId, false, true); return getMediaInfoFromFileInfo(content, eventId, false, true);
} else { } else {
return {}; return {};
} }
} }
QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo *fileInfo, const QString &eventId, bool isThumbnail, bool isSticker) const QVariantMap EventHandler::getMediaInfoFromFileInfo(
#if Quotient_VERSION_MINOR > 8
const Quotient::EventContent::FileContentBase *fileContent,
#else
const Quotient::EventContent::TypedBase *fileContent,
#endif
const QString &eventId,
bool isThumbnail,
bool isSticker) const
{ {
QVariantMap mediaInfo; QVariantMap mediaInfo;
// Get the mxc URL for the media. // Get the mxc URL for the media.
if (!fileInfo->url().isValid() || fileInfo->url().scheme() != QStringLiteral("mxc") || eventId.isEmpty()) { #if Quotient_VERSION_MINOR > 8
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 {
QUrl source = m_room->makeMediaUrl(eventId, fileInfo->url()); #if Quotient_VERSION_MINOR > 8
QUrl source = m_room->makeMediaUrl(eventId, fileContent->url());
#else
QUrl source = m_room->makeMediaUrl(eventId, fileContent->fileInfo()->url());
#endif
if (source.isValid()) { if (source.isValid()) {
mediaInfo["source"_ls] = source; mediaInfo["source"_ls] = source;
@@ -696,7 +747,7 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo
} }
} }
auto mimeType = fileInfo->mimeType; auto mimeType = fileContent->type();
// Add the MIME type for the media if available. // Add the MIME type for the media if available.
mediaInfo["mimeType"_ls] = mimeType.name(); mediaInfo["mimeType"_ls] = mimeType.name();
@@ -704,45 +755,53 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo
mediaInfo["mimeIcon"_ls] = mimeType.iconName(); mediaInfo["mimeIcon"_ls] = mimeType.iconName();
// Add media size if available. // Add media size if available.
mediaInfo["size"_ls] = fileInfo->payloadSize; #if Quotient_VERSION_MINOR > 8
mediaInfo["size"_ls] = fileContent->commonInfo().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 *>(fileInfo)) { 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());
if (!isThumbnail) { QVariantMap tempInfo;
QVariantMap tempInfo; auto thumbnailInfo = getMediaInfoFromTumbnail(castInfo->thumbnail, eventId);
auto thumbnailInfo = getMediaInfoFromFileInfo(castInfo->thumbnailInfo(), eventId, true); if (thumbnailInfo["source"_ls].toUrl().scheme() == "mxc"_ls) {
if (thumbnailInfo["source"_ls].toUrl().scheme() == "mxc"_ls) { tempInfo = thumbnailInfo;
tempInfo = thumbnailInfo; } else {
QString blurhash = castInfo->originalInfoJson["xyz.amorgan.blurhash"_ls].toString();
if (blurhash.isEmpty()) {
tempInfo["source"_ls] = QUrl();
} else { } else {
QString blurhash = castInfo->originalInfoJson["xyz.amorgan.blurhash"_ls].toString(); tempInfo["source"_ls] = QUrl("image://blurhash/"_ls + blurhash);
if (blurhash.isEmpty()) {
tempInfo["source"_ls] = QUrl();
} else {
tempInfo["source"_ls] = QUrl("image://blurhash/"_ls + blurhash);
}
} }
mediaInfo["tempInfo"_ls] = tempInfo;
} }
mediaInfo["tempInfo"_ls] = tempInfo;
} }
} }
if (mimeType.name().contains(QStringLiteral("video"))) { if (mimeType.name().contains(QStringLiteral("video"))) {
if (auto castInfo = static_cast<const EventContent::VideoContent *>(fileInfo)) { if (auto castInfo = static_cast<const EventContent::VideoContent *>(fileContent)) {
mediaInfo["width"_ls] = castInfo->imageSize.width(); mediaInfo["width"_ls] = castInfo->imageSize.width();
mediaInfo["height"_ls] = castInfo->imageSize.height(); mediaInfo["height"_ls] = castInfo->imageSize.height();
mediaInfo["duration"_ls] = castInfo->duration; mediaInfo["duration"_ls] = castInfo->duration;
if (!isThumbnail) { if (!isThumbnail) {
QVariantMap tempInfo; QVariantMap tempInfo;
auto thumbnailInfo = getMediaInfoFromFileInfo(castInfo->thumbnailInfo(), eventId, true); auto thumbnailInfo = getMediaInfoFromTumbnail(castInfo->thumbnail, eventId);
if (thumbnailInfo["source"_ls].toUrl().scheme() == "mxc"_ls) { if (thumbnailInfo["source"_ls].toUrl().scheme() == "mxc"_ls) {
tempInfo = thumbnailInfo; tempInfo = thumbnailInfo;
} else { } else {
@@ -758,7 +817,7 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo
} }
} }
if (mimeType.name().contains(QStringLiteral("audio"))) { if (mimeType.name().contains(QStringLiteral("audio"))) {
if (auto castInfo = static_cast<const EventContent::AudioContent *>(fileInfo)) { if (auto castInfo = static_cast<const EventContent::AudioContent *>(fileContent)) {
mediaInfo["duration"_ls] = castInfo->duration; mediaInfo["duration"_ls] = castInfo->duration;
} }
} }
@@ -766,6 +825,38 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo
return mediaInfo; return mediaInfo;
} }
QVariantMap EventHandler::getMediaInfoFromTumbnail(const Quotient::EventContent::Thumbnail &thumbnail, const QString &eventId) const
{
QVariantMap thumbnailInfo;
if (!thumbnail.url().isValid() || thumbnail.url().scheme() != QStringLiteral("mxc") || eventId.isEmpty()) {
thumbnailInfo["source"_ls] = QUrl();
} else {
QUrl source = m_room->makeMediaUrl(eventId, thumbnail.url());
if (source.isValid()) {
thumbnailInfo["source"_ls] = source;
} else {
thumbnailInfo["source"_ls] = QUrl();
}
}
auto mimeType = thumbnail.mimeType;
// Add the MIME type for the media if available.
thumbnailInfo["mimeType"_ls] = mimeType.name();
// Add the MIME type icon if available.
thumbnailInfo["mimeIcon"_ls] = mimeType.iconName();
// Add media size if available.
thumbnailInfo["size"_ls] = thumbnail.payloadSize;
thumbnailInfo["width"_ls] = thumbnail.imageSize.width();
thumbnailInfo["height"_ls] = thumbnail.imageSize.height();
return thumbnailInfo;
}
bool EventHandler::hasReply() const bool EventHandler::hasReply() const
{ {
if (m_event == nullptr) { if (m_event == nullptr) {

View File

@@ -339,6 +339,14 @@ private:
QString getMessageBody(const Quotient::RoomMessageEvent &event, Qt::TextFormat format, bool stripNewlines) const; QString getMessageBody(const Quotient::RoomMessageEvent &event, Qt::TextFormat format, bool stripNewlines) const;
QVariantMap getMediaInfoForEvent(const Quotient::RoomEvent *event) const; QVariantMap getMediaInfoForEvent(const Quotient::RoomEvent *event) const;
QVariantMap QVariantMap getMediaInfoFromFileInfo(
getMediaInfoFromFileInfo(const Quotient::EventContent::FileInfo *fileInfo, const QString &eventId, bool isThumbnail = false, bool isSticker = false) const; #if Quotient_VERSION_MINOR > 8
const Quotient::EventContent::FileContentBase *fileContent,
#else
const Quotient::EventContent::TypedBase *fileContent,
#endif
const QString &eventId,
bool isThumbnail = false,
bool isSticker = false) const;
QVariantMap getMediaInfoFromTumbnail(const Quotient::EventContent::Thumbnail &thumbnail, const QString &eventId) const;
}; };

View File

@@ -10,13 +10,22 @@
#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"
struct ForeignConfig {
Q_GADGET
QML_FOREIGN(NeoChatConfig)
QML_NAMED_ELEMENT(Config)
QML_SINGLETON
public:
static NeoChatConfig *create(QQmlEngine *, QJSEngine *)
{
QQmlEngine::setObjectOwnership(NeoChatConfig::self(), QQmlEngine::CppOwnership);
return NeoChatConfig::self();
}
};
struct ForeignAccountRegistry { struct ForeignAccountRegistry {
Q_GADGET Q_GADGET
QML_FOREIGN(Quotient::AccountRegistry) QML_FOREIGN(Quotient::AccountRegistry)
@@ -42,12 +51,3 @@ struct ForeignSSSSHandler {
QML_FOREIGN(Quotient::SSSSHandler) QML_FOREIGN(Quotient::SSSSHandler)
QML_NAMED_ELEMENT(SSSSHandler) QML_NAMED_ELEMENT(SSSSHandler)
}; };
#if Quotient_VERSION_MINOR > 8
struct ForeignKeyImport {
Q_GADGET
QML_SINGLETON
QML_FOREIGN(Quotient::KeyImport)
QML_NAMED_ELEMENT(KeyImport)
};
#endif

View File

@@ -40,7 +40,7 @@ float LocationHelper::zoomToFit(const QRectF &r, float mapWidth, float mapHeight
const auto zy = std::log2((mapHeight / (p2.y() - p1.y()))); const auto zy = std::log2((mapHeight / (p2.y() - p1.y())));
const auto z = std::min(zx, zy); const auto z = std::min(zx, zy);
return std::clamp(z, 5.0, 18.0); return z;
} }
#include "moc_locationhelper.cpp" #include "moc_locationhelper.cpp"

View File

@@ -78,9 +78,7 @@ void LoginHelper::init()
account.setHomeserver(m_connection->homeserver()); account.setHomeserver(m_connection->homeserver());
account.setDeviceId(m_connection->deviceId()); account.setDeviceId(m_connection->deviceId());
account.setDeviceName(m_deviceName); account.setDeviceName(m_deviceName);
if (!Controller::instance().saveAccessTokenToKeyChain(account.userId(), m_connection->accessToken())) { Controller::instance().saveAccessTokenToKeyChain(account.userId(), m_connection->accessToken());
qWarning() << "Couldn't save access token";
}
account.sync(); account.sync();
Controller::instance().addConnection(m_connection); Controller::instance().addConnection(m_connection);
Controller::instance().setActiveConnection(m_connection); Controller::instance().setActiveConnection(m_connection);

View File

@@ -20,5 +20,4 @@ ecm_add_qml_module(login GENERATE_PLUGIN_SOURCE
Sso.qml Sso.qml
Terms.qml Terms.qml
Username.qml Username.qml
Oidc.qml
) )

View File

@@ -31,11 +31,4 @@ LoginStep {
text: i18nc("@action:button", "Register") text: i18nc("@action:button", "Register")
onClicked: root.processed("Homeserver") onClicked: root.processed("Homeserver")
} }
FormCard.FormDelegateSeparator {}
FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Login with OIDC")
onClicked: root.processed("Oidc")
}
} }

View File

@@ -1,74 +0,0 @@
// SPDX-FileCopyrightText: 2024 Tobias Fella <tobias.fella@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick
import QtQuick.Layouts
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat
LoginStep {
id: root
FormCard.FormTextFieldDelegate {
id: homeserver
visible: !infoLabel.visible
label: i18n("Homeserver")
text: "synapse-oidc.element.dev"
}
Connections {
target: Controller.pendingOidcConnection
function onOpenOidcUrl(url: string): void {
infoLabel.url = url;
infoLabel.visible = true;
}
function onConnected(): void {
root.processed("Loading");
}
}
FormCard.FormTextDelegate {
id: infoLabel
property string url: ""
visible: false
text: i18n("To continue, please open the following link in your web browser: %1", "<br /><br /><a href='" + url + "'>" + url + "</a>")
onLinkActivated: url => Qt.openUrlExternally(url)
}
FormCard.FormDelegateSeparator { above: openLink }
FormCard.FormButtonDelegate {
id: openLink
visible: infoLabel.visible
text: i18n("Open Authorization Link")
icon.name: "document-open"
onClicked: Qt.openUrlExternally(infoLabel.url.authorizeUrl)
}
FormCard.FormDelegateSeparator {
visible: infoLabel.visible
above: openLink
below: copyLink
}
FormCard.FormButtonDelegate {
id: copyLink
visible: infoLabel.visible
text: i18n("Copy Authorization Link")
icon.name: "edit-copy"
onClicked: {
Clipboard.saveText(infoLabel.url)
applicationWindow().showPassiveNotification(i18n("Link copied."));
}
}
FormCard.FormButtonDelegate {
visible: !infoLabel.visible
text: i18nc("@action:button", "Log in with OIDC")
onClicked: Controller.startOidcLogin(homeserver.text)
}
}

View File

@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
i18n("Maintainer"), i18n("Maintainer"),
QStringLiteral("carl@carlschwan.eu"), QStringLiteral("carl@carlschwan.eu"),
QStringLiteral("https://carlschwan.eu"), QStringLiteral("https://carlschwan.eu"),
QUrl(QStringLiteral("https://carlschwan.eu/avatar.png"))); QStringLiteral("https://carlschwan.eu/avatar.png"));
about.addAuthor(i18n("Tobias Fella"), i18n("Maintainer"), QStringLiteral("tobias.fella@kde.org"), QStringLiteral("https://tobiasfella.de")); about.addAuthor(i18n("Tobias Fella"), i18n("Maintainer"), QStringLiteral("tobias.fella@kde.org"), QStringLiteral("https://tobiasfella.de"));
about.addAuthor(i18n("James Graham"), i18n("Maintainer"), QStringLiteral("james.h.graham@protonmail.com")); about.addAuthor(i18n("James Graham"), i18n("Maintainer"), QStringLiteral("james.h.graham@protonmail.com"));
about.addCredit(i18n("Black Hat"), i18n("Original author of Spectral"), QStringLiteral("bhat@encom.eu.org")); about.addCredit(i18n("Black Hat"), i18n("Original author of Spectral"), QStringLiteral("bhat@encom.eu.org"));

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>
@@ -31,8 +32,8 @@
using namespace Quotient; using namespace Quotient;
MessageContentModel::MessageContentModel(NeoChatRoom *room, const Quotient::RoomEvent *event, bool isReply, bool isPending, MessageContentModel *parent) MessageContentModel::MessageContentModel(NeoChatRoom *room, const Quotient::RoomEvent *event, bool isReply, bool isPending)
: QAbstractListModel(parent) : QAbstractListModel(nullptr)
, m_room(room) , m_room(room)
, m_eventId(event != nullptr ? event->id() : QString()) , m_eventId(event != nullptr ? event->id() : QString())
, m_eventSenderId(event != nullptr ? event->senderId() : QString()) , m_eventSenderId(event != nullptr ? event->senderId() : QString())
@@ -43,8 +44,8 @@ MessageContentModel::MessageContentModel(NeoChatRoom *room, const Quotient::Room
initializeModel(); initializeModel();
} }
MessageContentModel::MessageContentModel(NeoChatRoom *room, const QString &eventId, bool isReply, bool isPending, MessageContentModel *parent) MessageContentModel::MessageContentModel(NeoChatRoom *room, const QString &eventId, bool isReply, bool isPending)
: QAbstractListModel(parent) : QAbstractListModel(nullptr)
, m_room(room) , m_room(room)
, m_eventId(eventId) , m_eventId(eventId)
, m_isPending(isPending) , m_isPending(isPending)
@@ -58,16 +59,15 @@ void MessageContentModel::initializeModel()
Q_ASSERT(m_room != nullptr); Q_ASSERT(m_room != nullptr);
// Allow making a model for an event that is being downloaded but will appear later // Allow making a model for an event that is being downloaded but will appear later
// e.g. a reply, but we need an ID to know when it has arrived. // e.g. a reply, but we need an ID to know when it has arrived.
// Also note that a pending event may not have an event ID yet but as long as we have an event Q_ASSERT(!m_eventId.isEmpty());
// pointer we can pass out the transaction ID until it is set.
Q_ASSERT(!m_eventId.isEmpty() || m_event != nullptr);
Quotient::connectUntil(m_room.get(), &NeoChatRoom::extraEventLoaded, this, [this](const QString &eventId) { Quotient::connectUntil(m_room.get(), &NeoChatRoom::extraEventLoaded, this, [this](const QString &eventId) {
if (m_room != nullptr) { if (m_room != nullptr) {
if (eventId == m_eventId) { if (eventId == m_eventId) {
intiializeEvent(m_room->getEvent(eventId)); m_event = loadEvent<RoomEvent>(m_room->getEvent(eventId)->fullJson());
Q_EMIT eventUpdated();
updateReplyModel(); updateReplyModel();
resetModel(); resetContent();
return true; return true;
} }
} }
@@ -165,12 +165,7 @@ void MessageContentModel::intiializeEvent(const QString &eventId)
void MessageContentModel::intiializeEvent(const Quotient::RoomEvent *event) void MessageContentModel::intiializeEvent(const Quotient::RoomEvent *event)
{ {
m_event = loadEvent<RoomEvent>(event->fullJson()); m_event = loadEvent<RoomEvent>(event->fullJson());
// a pending event may not previously have had an event ID so update. auto senderId = event->senderId();
if (m_eventId.isEmpty()) {
m_eventId = m_event->id();
}
auto senderId = m_event->senderId();
// A pending event might not have a sender ID set yet but in that case it must // A pending event might not have a sender ID set yet but in that case it must
// be the local member. // be the local member.
if (senderId.isEmpty()) { if (senderId.isEmpty()) {
@@ -231,11 +226,6 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
if (m_event == nullptr) { if (m_event == nullptr) {
return QString(); return QString();
} }
if (m_event->isRedacted()) {
auto reason = m_event->redactedBecause()->reason();
return (reason.isEmpty()) ? i18n("<i>[This message was deleted]</i>")
: i18n("<i>[This message was deleted: %1]</i>", m_event->redactedBecause()->reason());
}
if (!component.content.isEmpty()) { if (!component.content.isEmpty()) {
return component.content; return component.content;
} }
@@ -428,9 +418,9 @@ void MessageContentModel::updateReplyModel()
const auto replyEvent = m_room->findInTimeline(eventHandler.getReplyId()); const auto replyEvent = m_room->findInTimeline(eventHandler.getReplyId());
if (replyEvent == m_room->historyEdge()) { if (replyEvent == m_room->historyEdge()) {
m_replyModel = new MessageContentModel(m_room, eventHandler.getReplyId(), true, false, this); m_replyModel = new MessageContentModel(m_room, eventHandler.getReplyId(), true);
} else { } else {
m_replyModel = new MessageContentModel(m_room, replyEvent->get(), true, false, this); m_replyModel = new MessageContentModel(m_room, replyEvent->get(), true);
} }
connect(m_replyModel, &MessageContentModel::eventUpdated, this, [this]() { connect(m_replyModel, &MessageContentModel::eventUpdated, this, [this]() {
@@ -456,10 +446,19 @@ QList<MessageComponent> MessageContentModel::componentsForType(MessageComponentT
auto fileTransferInfo = m_room->cachedFileTransferInfo(m_event.get()); auto fileTransferInfo = m_room->cachedFileTransferInfo(m_event.get());
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
Q_ASSERT(event->content() != nullptr && event->content()->fileInfo() != nullptr); #if Quotient_VERSION_MINOR > 8
Q_ASSERT(event->content() != nullptr && event->has<EventContent::FileContent>());
const QMimeType mimeType = event->get<EventContent::FileContent>()->mimeType;
#else
Q_ASSERT(event->content() != nullptr && event->hasFileContent());
const QMimeType mimeType = event->content()->fileInfo()->mimeType; const QMimeType mimeType = event->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 = event->get<EventContent::FileContent>()->originalName;
#else
QString originalName = event->content()->fileInfo()->originalName; QString originalName = event->content()->fileInfo()->originalName;
#endif
if (originalName.isEmpty()) { if (originalName.isEmpty()) {
originalName = event->plainBody(); originalName = event->plainBody();
} }
@@ -520,7 +519,7 @@ MessageComponent MessageContentModel::linkPreviewComponent(const QUrl &link)
if (linkPreviewer->loaded()) { if (linkPreviewer->loaded()) {
return MessageComponent{MessageComponentType::LinkPreview, QString(), {{"link"_ls, link}}}; return MessageComponent{MessageComponentType::LinkPreview, QString(), {{"link"_ls, link}}};
} else { } else {
connect(linkPreviewer, &LinkPreviewer::loadedChanged, [this, link]() { connect(linkPreviewer, &LinkPreviewer::loadedChanged, this, [this, link]() {
const auto linkPreviewer = dynamic_cast<NeoChatConnection *>(m_room->connection())->previewerForLink(link); const auto linkPreviewer = dynamic_cast<NeoChatConnection *>(m_room->connection())->previewerForLink(link);
if (linkPreviewer != nullptr && linkPreviewer->loaded()) { if (linkPreviewer != nullptr && linkPreviewer->loaded()) {
for (auto &component : m_components) { for (auto &component : m_components) {
@@ -561,6 +560,11 @@ QList<MessageComponent> MessageContentModel::addLinkPreviews(QList<MessageCompon
void MessageContentModel::closeLinkPreview(int row) void MessageContentModel::closeLinkPreview(int row)
{ {
if (row < 0 || row > m_components.size()) {
qWarning() << "closeLinkPreview() called with row" << row << "which does not exist. m_components.size() =" << m_components.size();
return;
}
if (m_components[row].type == MessageComponentType::LinkPreview || m_components[row].type == MessageComponentType::LinkPreviewLoad) { if (m_components[row].type == MessageComponentType::LinkPreview || m_components[row].type == MessageComponentType::LinkPreviewLoad) {
beginResetModel(); beginResetModel();
m_removedLinkPreviews += m_components[row].attributes["link"_ls].toUrl(); m_removedLinkPreviews += m_components[row].attributes["link"_ls].toUrl();
@@ -577,8 +581,12 @@ void MessageContentModel::updateItineraryModel()
} }
if (auto event = eventCast<const Quotient::RoomMessageEvent>(m_event)) { if (auto event = eventCast<const Quotient::RoomMessageEvent>(m_event)) {
#if Quotient_VERSION_MINOR > 8
if (event->has<EventContent::FileContent>()) {
#else
if (event->hasFileContent()) { if (event->hasFileContent()) {
auto filePath = m_room->cachedFileTransferInfo(m_event.get()).localPath; #endif
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;
m_itineraryModel = nullptr; m_itineraryModel = nullptr;

View File

@@ -75,12 +75,8 @@ public:
}; };
Q_ENUM(Roles) Q_ENUM(Roles)
explicit MessageContentModel(NeoChatRoom *room, explicit MessageContentModel(NeoChatRoom *room, const Quotient::RoomEvent *event, bool isReply = false, bool isPending = false);
const Quotient::RoomEvent *event, MessageContentModel(NeoChatRoom *room, const QString &eventId, bool isReply = false, bool isPending = false);
bool isReply = false,
bool isPending = false,
MessageContentModel *parent = nullptr);
MessageContentModel(NeoChatRoom *room, const QString &eventId, bool isReply = false, bool isPending = false, MessageContentModel *parent = nullptr);
bool showAuthor() const; bool showAuthor() const;
void setShowAuthor(bool showAuthor); void setShowAuthor(bool showAuthor);

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>
@@ -88,6 +89,7 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
// HACK: Reset the model to a null room first to make sure QML dismantles // HACK: Reset the model to a null room first to make sure QML dismantles
// last room's objects before the room is actually changed // last room's objects before the room is actually changed
beginResetModel(); beginResetModel();
m_readMarkerModels.clear();
m_currentRoom->disconnect(this); m_currentRoom->disconnect(this);
m_currentRoom = nullptr; m_currentRoom = nullptr;
endResetModel(); endResetModel();
@@ -95,9 +97,6 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
// Don't clear the member objects until the model has been fully reset and all // Don't clear the member objects until the model has been fully reset and all
// refs cleared. // refs cleared.
m_memberObjects.clear(); m_memberObjects.clear();
m_contentModels.clear();
m_reactionModels.clear();
m_readMarkerModels.clear();
} }
beginResetModel(); beginResetModel();
@@ -435,17 +434,17 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
EventHandler eventHandler(m_currentRoom, &evt); EventHandler eventHandler(m_currentRoom, &evt);
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
if (evt.isRedacted()) {
auto reason = evt.redactedBecause()->reason();
return (reason.isEmpty()) ? i18n("<i>[This message was deleted]</i>")
: i18n("<i>[This message was deleted: %1]</i>", evt.redactedBecause()->reason());
}
return eventHandler.getRichBody(); return eventHandler.getRichBody();
} }
if (role == ContentModelRole) { if (role == ContentModelRole) {
if (m_contentModels.contains(evt.id())) { if (!evt.isStateEvent() && !evt.id().isEmpty()) {
return QVariant::fromValue<MessageContentModel *>(m_contentModels.at(evt.id()).get()); return QVariant::fromValue<MessageContentModel *>(new MessageContentModel(m_currentRoom, &evt));
}
if (evt.isStateEvent()) {
if (evt.matrixType() == QStringLiteral("org.matrix.msc3672.beacon_info")) {
return QVariant::fromValue<MessageContentModel *>(new MessageContentModel(m_currentRoom, &evt));
}
} }
return {}; return {};
} }
@@ -500,7 +499,11 @@ 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 Quotient_VERSION_MINOR > 8
if (e->has<EventContent::FileContent>()) {
#else
if (e->hasFileContent()) { if (e->hasFileContent()) {
#endif
return QVariant::fromValue(m_currentRoom->cachedFileTransferInfo(&evt)); return QVariant::fromValue(m_currentRoom->cachedFileTransferInfo(&evt));
} }
} }
@@ -631,12 +634,6 @@ void MessageEventModel::createEventObjects(const Quotient::RoomEvent *event)
m_memberObjects[senderId] = std::unique_ptr<NeochatRoomMember>(new NeochatRoomMember(m_currentRoom, senderId)); m_memberObjects[senderId] = std::unique_ptr<NeochatRoomMember>(new NeochatRoomMember(m_currentRoom, senderId));
} }
if (!m_contentModels.contains(eventId)) {
if (!event->isStateEvent() || event->matrixType() == QStringLiteral("org.matrix.msc3672.beacon_info")) {
m_contentModels[eventId] = std::unique_ptr<MessageContentModel>(new MessageContentModel(m_currentRoom, event));
}
}
// ReadMarkerModel handles updates to add and remove markers, we only need to // ReadMarkerModel handles updates to add and remove markers, we only need to
// handle adding and removing whole models here. // handle adding and removing whole models here.
if (m_readMarkerModels.contains(eventId)) { if (m_readMarkerModels.contains(eventId)) {

View File

@@ -8,7 +8,6 @@
#include <QQmlEngine> #include <QQmlEngine>
#include "linkpreviewer.h" #include "linkpreviewer.h"
#include "messagecontentmodel.h"
#include "neochatroom.h" #include "neochatroom.h"
#include "neochatroommember.h" #include "neochatroommember.h"
#include "pollhandler.h" #include "pollhandler.h"
@@ -118,7 +117,6 @@ private:
KFormat m_format; KFormat m_format;
std::map<QString, std::unique_ptr<NeochatRoomMember>> m_memberObjects; std::map<QString, std::unique_ptr<NeochatRoomMember>> m_memberObjects;
std::map<QString, std::unique_ptr<MessageContentModel>> m_contentModels;
QMap<QString, QSharedPointer<ReadMarkerModel>> m_readMarkerModels; QMap<QString, QSharedPointer<ReadMarkerModel>> m_readMarkerModels;
QMap<QString, QSharedPointer<ReactionModel>> m_reactionModels; QMap<QString, QSharedPointer<ReactionModel>> m_reactionModels;

View File

@@ -247,7 +247,7 @@ void PermissionsModel::setPowerLevel(const QString &permission, const int &newPo
powerLevelContent[QLatin1String("events")] = eventPowerLevels; powerLevelContent[QLatin1String("events")] = eventPowerLevels;
} }
m_room->setState<Quotient::RoomPowerLevelsEvent>(powerLevelContent); m_room->setState<Quotient::RoomPowerLevelsEvent>(Quotient::fromJson<Quotient::PowerLevelsEventContent>(powerLevelContent));
} }
} }

View File

@@ -312,8 +312,12 @@ 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),
#else
auto job = m_connection->callApi<Quotient::SetPushRuleJob>(QLatin1String("global"), auto job = m_connection->callApi<Quotient::SetPushRuleJob>(QLatin1String("global"),
PushRuleKind::kindString(kind), PushRuleKind::kindString(kind),
#endif
keyword, keyword,
actions, actions,
QString(), QString(),
@@ -338,7 +342,11 @@ 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);
#else
auto job = m_connection->callApi<Quotient::DeletePushRuleJob>(QStringLiteral("global"), kind, m_rules[index].id); 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();
}); });
@@ -346,10 +354,18 @@ 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);
#else
auto job = m_connection->callApi<Quotient::IsPushRuleEnabledJob>(QStringLiteral("global"), kind, ruleId); 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);
#else
m_connection->callApi<Quotient::SetPushRuleEnabledJob>(QStringLiteral("global"), kind, ruleId, enabled); m_connection->callApi<Quotient::SetPushRuleEnabledJob>(QStringLiteral("global"), kind, ruleId, enabled);
#endif
} }
}); });
} }
@@ -363,7 +379,11 @@ 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);
#else
m_connection->callApi<Quotient::SetPushRuleActionsJob>(QStringLiteral("global"), kind, ruleId, actions); 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

@@ -3,15 +3,10 @@
#include "reactionmodel.h" #include "reactionmodel.h"
#include "neochatroom.h" #include "neochatroom.h"
#include "utils.h"
#include <QDebug> #include <QDebug>
#include <QFont> #include <QFont>
#ifdef HAVE_ICU
#include <QTextBoundaryFinder>
#include <QTextCharFormat>
#include <unicode/uchar.h>
#include <unicode/urename.h>
#endif
#include <KLocalizedString> #include <KLocalizedString>
@@ -157,30 +152,6 @@ QHash<int, QByteArray> ReactionModel::roleNames() const
}; };
} }
bool isEmoji(const QString &text)
{
#ifdef HAVE_ICU
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
int from = 0;
while (finder.toNextBoundary() != -1) {
auto to = finder.position();
if (text[from].isSpace()) {
from = to;
continue;
}
auto first = text.mid(from, to - from).toUcs4()[0];
if (!u_hasBinaryProperty(first, UCHAR_EMOJI)) {
return false;
}
from = to;
}
return true;
#else
return false;
#endif
}
QString ReactionModel::reactionText(QString text) const QString ReactionModel::reactionText(QString text) const
{ {
text = text.toHtmlEscaped(); text = text.toHtmlEscaped();
@@ -194,7 +165,7 @@ QString ReactionModel::reactionText(QString text) const
.arg(m_room->connection()->makeMediaUrl(QUrl(text)).toString(), QString::number(size)); .arg(m_room->connection()->makeMediaUrl(QUrl(text)).toString(), QString::number(size));
} }
return isEmoji(text) ? QStringLiteral("<span style=\"font-family: 'emoji';\">") + text + QStringLiteral("</span>") : text; return Utils::isEmoji(text) ? QStringLiteral("<span style=\"font-family: 'emoji';\">") + text + QStringLiteral("</span>") : text;
} }
#include "moc_reactionmodel.cpp" #include "moc_reactionmodel.cpp"

View File

@@ -8,7 +8,7 @@
bool UserFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const bool UserFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{ {
Q_UNUSED(sourceParent); Q_UNUSED(sourceParent);
if (m_filterText.length() < 1) { if (!m_allowEmpty && m_filterText.length() < 1) {
return false; return false;
} }
return sourceModel()->data(sourceModel()->index(sourceRow, 0), UserListModel::DisplayNameRole).toString().contains(m_filterText, Qt::CaseInsensitive) return sourceModel()->data(sourceModel()->index(sourceRow, 0), UserListModel::DisplayNameRole).toString().contains(m_filterText, Qt::CaseInsensitive)
@@ -27,4 +27,15 @@ void UserFilterModel::setFilterText(const QString &filterText)
invalidateFilter(); invalidateFilter();
} }
bool UserFilterModel::allowEmpty() const
{
return m_allowEmpty;
}
void UserFilterModel::setAllowEmpty(bool allowEmpty)
{
m_allowEmpty = allowEmpty;
Q_EMIT allowEmptyChanged();
}
#include "moc_userfiltermodel.cpp" #include "moc_userfiltermodel.cpp"

View File

@@ -24,6 +24,7 @@ class UserFilterModel : public QSortFilterProxyModel
* The text is either a desired display name or matrix id. * The text is either a desired display name or matrix id.
*/ */
Q_PROPERTY(QString filterText READ filterText WRITE setFilterText NOTIFY filterTextChanged) Q_PROPERTY(QString filterText READ filterText WRITE setFilterText NOTIFY filterTextChanged)
Q_PROPERTY(bool allowEmpty READ allowEmpty WRITE setAllowEmpty NOTIFY allowEmptyChanged)
public: public:
/** /**
@@ -36,9 +37,14 @@ public:
QString filterText() const; QString filterText() const;
void setFilterText(const QString &filterText); void setFilterText(const QString &filterText);
bool allowEmpty() const;
void setAllowEmpty(bool allowEmpty);
Q_SIGNALS: Q_SIGNALS:
void filterTextChanged(); void filterTextChanged();
void allowEmptyChanged();
private: private:
QString m_filterText; QString m_filterText;
bool m_allowEmpty = false;
}; };

View File

@@ -88,7 +88,11 @@ 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();
#else
return m_currentRoom->memberAvatar(memberId).url(); return m_currentRoom->memberAvatar(memberId).url();
#endif
} }
if (role == ObjectRole) { if (role == ObjectRole) {
return QVariant::fromValue(memberId); return QVariant::fromValue(memberId);

View File

@@ -125,7 +125,7 @@ void WebShortcutModel::trigger(const QString &data)
void WebShortcutModel::configureWebShortcuts() void WebShortcutModel::configureWebShortcuts()
{ {
#ifdef HAVE_KIO #ifdef HAVE_KIO
auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5"), QStringList() << QStringLiteral("webshortcuts"), this); auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell6"), QStringList() << QStringLiteral("webshortcuts"), this);
job->exec(); job->exec();
#endif #endif
} }

View File

@@ -13,6 +13,7 @@ Name[en_GB]=NeoChat
Name[eo]=NeoChat Name[eo]=NeoChat
Name[es]=NeoChat Name[es]=NeoChat
Name[eu]=NeoChat Name[eu]=NeoChat
Name[fa]=نئوچت
Name[fi]=NeoChat Name[fi]=NeoChat
Name[fr]=NeoChat Name[fr]=NeoChat
Name[gl]=NeoChat Name[gl]=NeoChat
@@ -261,14 +262,16 @@ 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[en_GB]=Share Name[en_GB]=Share
Name[eo]=Kundividi Name[eo]=Kundividi
Name[es]=Compartir Name[es]=Compartir
Name[eu]=Partekatu Name[eu]=Partekatu
Name[fi]=Jaa Name[fi]=Jaa
Name[fr]=Partager Name[fr]=Partager
Name[gl]=Compartir
Name[he]=שיתוף Name[he]=שיתוף
Name[hu]=Megosztás Name[hu]=Megosztás
Name[ia]=Comparti Name[ia]=Comparti
@@ -279,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]=பகிர்
@@ -290,12 +294,14 @@ Comment=The result of sharing a piece of content
Comment[ar]=نتيجة مشاركة محتوى Comment[ar]=نتيجة مشاركة محتوى
Comment[ca]=El resultat de compartir una peça de contingut Comment[ca]=El resultat de compartir una peça de contingut
Comment[ca@valencia]=El resultat de compartir una peça de contingut Comment[ca@valencia]=El resultat de compartir una peça de contingut
Comment[de]=Das Ergebnis nach dem Teilen eines Teils des Inhalts
Comment[en_GB]=The result of sharing a piece of content Comment[en_GB]=The result of sharing a piece of content
Comment[eo]=La rezulto el kundividado de enhavero Comment[eo]=La rezulto el kundividado de enhavero
Comment[es]=El resultado de compartir una parte de contenido Comment[es]=El resultado de compartir una parte de contenido
Comment[eu]=Eduki pieza bat partekatzearen emaitza Comment[eu]=Eduki pieza bat partekatzearen emaitza
Comment[fi]=Tulos yhden sisältöosasen jakamisesta Comment[fi]=Tulos yhden sisältöosasen jakamisesta
Comment[fr]=Le résultat du partage d'une partie de contenu. Comment[fr]=Le résultat du partage d'une partie de contenu.
Comment[gl]=O resultado de compartir un fragmento de contido.
Comment[he]=תוצאת שיתוף פיסת תוכן Comment[he]=תוצאת שיתוף פיסת תוכן
Comment[hu]=Tartalom megosztásának eredménye Comment[hu]=Tartalom megosztásának eredménye
Comment[ia]=Le exito de compartir un pecietta de contento Comment[ia]=Le exito de compartir un pecietta de contento
@@ -306,6 +312,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]=எதையோ பகிர்ந்த‍தன் விளைவு

9
src/neochatconfig.kcfgc Normal file
View File

@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
# SPDX-License-Identifier: LGPL-2.1-or-later
File=neochatconfig.kcfg
ClassName=NeoChatConfig
Mutators=true
DefaultValueGetters=true
GenerateProperties=true
ParentInConstructor=true
Singleton=true

View File

@@ -23,7 +23,6 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <Quotient/connectiondata.h>
#include <Quotient/csapi/content-repo.h> #include <Quotient/csapi/content-repo.h>
#include <Quotient/csapi/profile.h> #include <Quotient/csapi/profile.h>
#include <Quotient/csapi/versions.h> #include <Quotient/csapi/versions.h>
@@ -149,17 +148,6 @@ void NeoChatConnection::connectSignals()
}); });
}, },
Qt::SingleShotConnection); Qt::SingleShotConnection);
connect(this, &Connection::refreshTokenChanged, this, [this]() {
QKeychain::WritePasswordJob job(qAppName());
job.setAutoDelete(true);
job.setKey(userId());
job.setBinaryData(connectionData()->refreshToken().toLatin1());
QEventLoop loop;
connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
job.start();
loop.exec();
});
} }
int NeoChatConnection::badgeNotificationCount() const int NeoChatConnection::badgeNotificationCount() const
@@ -586,21 +574,4 @@ 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 keyImport;
auto result = keyImport.exportKeys(passphrase, this);
if (!result.has_value()) {
return result.error();
}
QUrl url(path);
QFile file(url.toLocalFile());
file.open(QFile::WriteOnly);
file.write(result.value());
file.close();
return KeyImport::Success;
}
#endif
#include "moc_neochatconnection.cpp" #include "moc_neochatconnection.cpp"

View File

@@ -9,10 +9,6 @@
#include <QCoroTask> #include <QCoroTask>
#include <Quotient/connection.h> #include <Quotient/connection.h>
#if Quotient_VERSION_MINOR > 8
#include <Quotient/keyimport.h>
#endif
#include "models/threepidmodel.h" #include "models/threepidmodel.h"
class LinkPreviewer; class LinkPreviewer;
@@ -173,10 +169,6 @@ 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);
#endif
qsizetype directChatNotifications() const; qsizetype directChatNotifications() const;
bool directChatsHaveHighlightNotifications() const; bool directChatsHaveHighlightNotifications() const;
qsizetype homeNotifications() const; qsizetype homeNotifications() const;

View File

@@ -9,6 +9,7 @@
#include <QMimeDatabase> #include <QMimeDatabase>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <Quotient/events/eventcontent.h>
#include <Quotient/jobs/basejob.h> #include <Quotient/jobs/basejob.h>
#include <Quotient/quotient_common.h> #include <Quotient/quotient_common.h>
#include <qcoro/qcorosignal.h> #include <qcoro/qcorosignal.h>
@@ -76,11 +77,16 @@ 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 Quotient_VERSION_MINOR > 8
if (event->has<EventContent::FileContentBase>()) {
mxcUrl = event->get<EventContent::FileContentBase>()->url().toString();
#else
if (event->hasFileContent()) { if (event->hasFileContent()) {
mxcUrl = event->content()->fileInfo()->url().toString(); 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().fileInfo()->url().toString(); mxcUrl = event->image().url().toString();
} }
if (mxcUrl.isEmpty()) { if (mxcUrl.isEmpty()) {
return; return;
@@ -134,7 +140,11 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
auto showNotification = [this, roomMemberEvent] { auto showNotification = [this, roomMemberEvent] {
QImage avatar_image; QImage avatar_image;
if (roomMemberEvent && !member(roomMemberEvent->senderId()).avatarUrl().isEmpty()) { if (roomMemberEvent && !member(roomMemberEvent->senderId()).avatarUrl().isEmpty()) {
#if Quotient_VERSION_MINOR > 8
avatar_image = member(roomMemberEvent->senderId()).avatar(128, 128, {});
#else
avatar_image = memberAvatar(roomMemberEvent->senderId()).get(this->connection(), 128, [] {}); avatar_image = memberAvatar(roomMemberEvent->senderId()).get(this->connection(), 128, [] {});
#endif
} else { } else {
qWarning() << "using this room's avatar"; qWarning() << "using this room's avatar";
avatar_image = avatar(128); avatar_image = avatar(128);
@@ -251,7 +261,11 @@ 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;
#else
EventContent::TypedBase *content; 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());
@@ -266,7 +280,11 @@ 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));
#else
QString txnId = postFile(body.isEmpty() ? url.fileName() : body, content); 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) {
@@ -392,8 +410,13 @@ 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 Quotient_VERSION_MINOR > 8
if (e->has<EventContent::TextContent>() && e->content() && e->mimeType().name() == "text/html"_ls) {
auto htmlBody = e->get<EventContent::TextContent>()->body;
#else
if (e->hasTextContent() && e->content() && e->mimeType().name() == "text/html"_ls) { if (e->hasTextContent() && e->content() && e->mimeType().name() == "text/html"_ls) {
auto htmlBody = static_cast<const Quotient::EventContent::TextContent *>(e->content())->body; 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);
} }
} }
@@ -1223,7 +1246,11 @@ 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()) {
connection()->callApi<DeletePushRuleJob>("global"_ls, "room"_ls, id()); #if Quotient_VERSION_MINOR > 8
connection()->callApi<DeletePushRuleJob>("room"_ls, id());
#else
connection()->callApi<DeletePushRuleJob>(QLatin1String("global"), "room"_ls, id());
#endif
} }
} }
} }
@@ -1234,7 +1261,11 @@ 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());
#else
connection()->callApi<DeletePushRuleJob>("global"_ls, "override"_ls, id()); connection()->callApi<DeletePushRuleJob>("global"_ls, "override"_ls, id());
#endif
} }
} }
} }
@@ -1270,9 +1301,17 @@ 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());
#else
auto job = connection()->callApi<SetPushRuleJob>("global"_ls, "override"_ls, id(), actions, QString(), QString(), conditions, QString()); 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);
#else
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("global"_ls, "override"_ls, id(), true); 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;
}); });
@@ -1296,9 +1335,17 @@ 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());
#else
auto setJob = connection()->callApi<SetPushRuleJob>("global"_ls, "room"_ls, id(), actions, QString(), QString(), conditions, QString()); 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);
#else
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("global"_ls, "room"_ls, id(), true); 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;
}); });
@@ -1327,9 +1374,17 @@ 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());
#else
auto setJob = connection()->callApi<SetPushRuleJob>("global"_ls, "room"_ls, id(), actions, QString(), QString(), conditions, QString()); 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);
#else
auto enableJob = connection()->callApi<SetPushRuleEnabledJob>("global"_ls, "room"_ls, id(), true); 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;
}); });
@@ -1420,7 +1475,11 @@ 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 Quotient_VERSION_MINOR > 8
if (event->has<EventContent::FileContent>()) {
#else
if (event->hasFileContent()) { if (event->hasFileContent()) {
#endif
const auto transferInfo = cachedFileTransferInfo(event); const auto transferInfo = cachedFileTransferInfo(event);
if (transferInfo.completed()) { if (transferInfo.completed()) {
UrlHelper helper; UrlHelper helper;
@@ -1453,7 +1512,11 @@ 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 Quotient_VERSION_MINOR > 8
if (event->has<EventContent::FileContent>()) {
#else
if (event->hasFileContent()) { if (event->hasFileContent()) {
#endif
const auto transferInfo = fileTransferInfo(eventId); const auto transferInfo = fileTransferInfo(eventId);
if (transferInfo.completed()) { if (transferInfo.completed()) {
Clipboard clipboard; Clipboard clipboard;
@@ -1486,13 +1549,20 @@ 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 Quotient_VERSION_MINOR > 8
if (evt->has<EventContent::FileContent>()) {
const auto fileContent = evt->get<EventContent::FileContent>();
#else
if (evt->hasFileContent()) { if (evt->hasFileContent()) {
mxcUrl = evt->content()->fileInfo()->url().toString(); const auto fileContent = evt->content()->fileInfo();
total = evt->content()->fileInfo()->payloadSize; #endif
mxcUrl = fileContent->url().toString();
total = fileContent->payloadSize;
} }
} else if (auto evt = eventCast<const Quotient::StickerEvent>(event)) { } else if (auto evt = eventCast<const Quotient::StickerEvent>(event)) {
mxcUrl = evt->image().fileInfo()->url().toString(); mxcUrl = evt->image().url().toString();
total = evt->image().fileInfo()->payloadSize; total = evt->image().payloadSize;
} }
FileTransferInfo transferInfo = fileTransferInfo(event->id()); FileTransferInfo transferInfo = fileTransferInfo(event->id());
@@ -1705,9 +1775,13 @@ int NeoChatRoom::maxRoomVersion() const
return maxVersion; return maxVersion;
} }
Quotient::RoomMember NeoChatRoom::directChatRemoteMember() const NeochatRoomMember *NeoChatRoom::directChatRemoteMember()
{ {
return directChatMembers()[0]; if (directChatMembers().size() == 0) {
qWarning() << "No other member available in this room";
return {};
}
return new NeochatRoomMember(this, directChatMembers()[0].id());
} }
void NeoChatRoom::sendLocation(float lat, float lon, const QString &description) void NeoChatRoom::sendLocation(float lat, float lon, const QString &description)
@@ -1748,7 +1822,6 @@ void NeoChatRoom::downloadEventFromServer(const QString &eventId)
connect(job, &BaseJob::success, this, [this, job, eventId] { connect(job, &BaseJob::success, this, [this, job, eventId] {
// The event may have arrived in the meantime so check it's not in the timeline. // The event may have arrived in the meantime so check it's not in the timeline.
if (findInTimeline(eventId) != historyEdge()) { if (findInTimeline(eventId) != historyEdge()) {
Q_EMIT extraEventLoaded(eventId);
return; return;
} }

View File

@@ -13,6 +13,7 @@
#include <Quotient/roommember.h> #include <Quotient/roommember.h>
#include "enums/pushrule.h" #include "enums/pushrule.h"
#include "neochatroommember.h"
#include "pollhandler.h" #include "pollhandler.h"
namespace Quotient namespace Quotient
@@ -74,7 +75,7 @@ class NeoChatRoom : public Quotient::Room
/** /**
* @brief Get a RoomMember object for the other person in a direct chat. * @brief Get a RoomMember object for the other person in a direct chat.
*/ */
Q_PROPERTY(Quotient::RoomMember directChatRemoteMember READ directChatRemoteMember CONSTANT) Q_PROPERTY(NeochatRoomMember *directChatRemoteMember READ directChatRemoteMember CONSTANT)
/** /**
* @brief The Matrix IDs of this room's parents. * @brief The Matrix IDs of this room's parents.
@@ -319,7 +320,7 @@ public:
[[nodiscard]] QString avatarMediaId() const; [[nodiscard]] QString avatarMediaId() const;
Quotient::RoomMember directChatRemoteMember() const; NeochatRoomMember *directChatRemoteMember();
/** /**
* @brief Whether this room has one or more parent spaces set. * @brief Whether this room has one or more parent spaces set.

View File

@@ -131,7 +131,11 @@ 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, {});
#else
avatar_image = room->memberAvatar(sender.id()).get(connection, 128, {}); avatar_image = room->memberAvatar(sender.id()).get(connection, 128, {});
#endif
} else { } else {
avatar_image = room->avatar(128); avatar_image = room->avatar(128);
} }

View File

@@ -14,6 +14,7 @@ Name[en_GB]=NeoChat
Name[eo]=NeoChat Name[eo]=NeoChat
Name[es]=NeoChat Name[es]=NeoChat
Name[eu]=NeoChat Name[eu]=NeoChat
Name[fa]=نئوچت
Name[fi]=NeoChat Name[fi]=NeoChat
Name[fr]=NeoChat Name[fr]=NeoChat
Name[gl]=NeoChat Name[gl]=NeoChat

View File

@@ -4,9 +4,34 @@
{ {
"Name": "Tobias Fella", "Name": "Tobias Fella",
"Name[ar]": "توبياس فلة", "Name[ar]": "توبياس فلة",
"Name[he]": "טוביאס פלה", "Name[ca@valencia]": "Tobias Fella",
"Name[ca]": "Tobias Fella",
"Name[cs]": "Tobias Fella",
"Name[de]": "Tobias Fella",
"Name[en_GB]": "Tobias Fella",
"Name[eo]": "Tobias Fella",
"Name[es]": "Tobias Fella",
"Name[eu]": "Tobias Fella",
"Name[fi]": "Tobias Fella",
"Name[fr]": "Tobias Fella",
"Name[gl]": "Tobias Fella",
"Name[hu]": "Tobias Fella",
"Name[ia]": "Tobias Fella",
"Name[it]": "Tobias Fella",
"Name[ka]": "Tobias Fella",
"Name[lv]": "Tobias Fella",
"Name[nl]": "Tobias Fella",
"Name[nn]": "Tobias Fella",
"Name[pl]": "Tobias Fella",
"Name[pt_BR]": "Tobias Fella",
"Name[ru]": "Tobias Fella",
"Name[sl]": "Tobias Fella",
"Name[sv]": "Tobias Fella",
"Name[ta]": "டோபியாஸ் ஃபெல்லா", "Name[ta]": "டோபியாஸ் ஃபெல்லா",
"Name[x-test]": "xxTobias Fellaxx" "Name[tr]": "Tobias Fella",
"Name[uk]": "Tobias Fella",
"Name[x-test]": "xxTobias Fellaxx",
"Name[zh_TW]": "Tobias Fella"
} }
], ],
"Category": "Utilities", "Category": "Utilities",
@@ -15,13 +40,13 @@
"Description[ca@valencia]": "Compartix a través de NeoChat", "Description[ca@valencia]": "Compartix a través de NeoChat",
"Description[ca]": "Comparteix a través del NeoChat", "Description[ca]": "Comparteix a través del NeoChat",
"Description[de]": "Über NeoChat teilen", "Description[de]": "Über NeoChat teilen",
"Description[en_GB]": "Share via NeoChat",
"Description[eo]": "Kundividi per NeoChat", "Description[eo]": "Kundividi per NeoChat",
"Description[es]": "Compartir mediante NeoChat", "Description[es]": "Compartir mediante NeoChat",
"Description[eu]": "Partekatu NeoChat bidez", "Description[eu]": "Partekatu NeoChat bidez",
"Description[fi]": "Jaa NeoChatillä", "Description[fi]": "Jaa NeoChatillä",
"Description[fr]": "Partager grâce à NeoChat", "Description[fr]": "Partager grâce à NeoChat",
"Description[gl]": "Compartir por NeoChat", "Description[gl]": "Compartir por NeoChat",
"Description[he]": "שיתוף דרך NeoChat",
"Description[hu]": "Megosztás NeoChatben", "Description[hu]": "Megosztás NeoChatben",
"Description[ia]": "Comparti via NeoChat", "Description[ia]": "Comparti via NeoChat",
"Description[it]": "Condividi tramite NeoChat", "Description[it]": "Condividi tramite NeoChat",
@@ -30,6 +55,7 @@
"Description[nl]": "Delen via NeoChat", "Description[nl]": "Delen via NeoChat",
"Description[nn]": "Del via NeoChat", "Description[nn]": "Del via NeoChat",
"Description[pl]": "Udostępnij przez NeoChat", "Description[pl]": "Udostępnij przez NeoChat",
"Description[pt_BR]": "Compartilhar via NeoChat",
"Description[ru]": "Опубликовать в NeoChat", "Description[ru]": "Опубликовать в NeoChat",
"Description[sl]": "Deli prek NeoChat", "Description[sl]": "Deli prek NeoChat",
"Description[sv]": "Dela via NeoChat", "Description[sv]": "Dela via NeoChat",
@@ -42,9 +68,36 @@
"License": "GPL", "License": "GPL",
"Name": "NeoChat", "Name": "NeoChat",
"Name[ar]": "نيوتشات", "Name[ar]": "نيوتشات",
"Name[ast]": "NeoChat",
"Name[ca@valencia]": "NeoChat",
"Name[ca]": "NeoChat",
"Name[cs]": "NeoChat",
"Name[de]": "NeoChat",
"Name[en_GB]": "NeoChat",
"Name[eo]": "NeoChat",
"Name[es]": "NeoChat",
"Name[eu]": "NeoChat",
"Name[fa]": "نئوچت",
"Name[fi]": "NeoChat",
"Name[fr]": "NeoChat",
"Name[gl]": "NeoChat",
"Name[hu]": "NeoChat",
"Name[ia]": "Neochat", "Name[ia]": "Neochat",
"Name[it]": "NeoChat",
"Name[ka]": "NeoChat",
"Name[lv]": "NeoChat",
"Name[nl]": "NeoChat",
"Name[nn]": "NeoChat",
"Name[pl]": "NeoChat",
"Name[pt_BR]": "NeoChat",
"Name[ru]": "NeoChat",
"Name[sl]": "NeoChat",
"Name[sv]": "NeoChat",
"Name[ta]": "நியோச்சாட்", "Name[ta]": "நியோச்சாட்",
"Name[tr]": "NeoChat",
"Name[uk]": "NeoChat",
"Name[x-test]": "xxNeoChatxx", "Name[x-test]": "xxNeoChatxx",
"Name[zh_TW]": "NeoChat",
"X-Purpose-ActionDisplay": "NeoChat" "X-Purpose-ActionDisplay": "NeoChat"
}, },
"X-Purpose-PluginTypes": [ "X-Purpose-PluginTypes": [

View File

@@ -19,22 +19,6 @@ QQC2.Menu {
margins: Kirigami.Units.smallSpacing margins: Kirigami.Units.smallSpacing
QQC2.MenuItem {
text: i18nc("@action:button", "Show QR code")
icon.name: "view-barcode-qr-symbolic"
onTriggered: {
let qrMax = Qt.createComponent('org.kde.neochat', 'QrCodeMaximizeComponent').createObject(QQC2.Overlay.overlay, {
text: "https://matrix.to/#/" + root.connection.localUser.id,
title: root.connection.localUser.displayName,
subtitle: root.connection.localUser.id,
avatarSource: root.connection.makeMediaUrl(root.connection.localUser.avatarUrl)
});
if (typeof root.closeDialog === "function") {
root.closeDialog();
}
qrMax.open();
}
}
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Edit this account") text: i18n("Edit this account")
icon.name: "document-edit" icon.name: "document-edit"
@@ -61,7 +45,7 @@ QQC2.Menu {
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Open developer tools") text: i18n("Open developer tools")
icon.name: "tools" icon.name: "tools"
visible: NeoChatConfig.developerTools visible: Config.developerTools
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), { onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), {
connection: root.connection connection: root.connection
}, { }, {
@@ -73,7 +57,7 @@ QQC2.Menu {
QQC2.MenuItem { QQC2.MenuItem {
text: i18nc("@action:inmenu", "Open Secret Backup") text: i18nc("@action:inmenu", "Open Secret Backup")
icon.name: "unlock" icon.name: "unlock"
visible: NeoChatConfig.secretBackup visible: Config.secretBackup
onTriggered: root.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UnlockSSSSDialog'), {}, { onTriggered: root.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UnlockSSSSDialog'), {}, {
title: i18nc("@title:window", "Open Key Backup") title: i18nc("@title:window", "Open Key Backup")
}) })

View File

@@ -1,47 +0,0 @@
// SPDX-FileCopyrightText: 2024 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtQuick
import QtQuick.Controls as QQC2
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
KirigamiComponents.Avatar {
id: root
property int notificationCount
property bool notificationHighlight
property bool showNotificationLabel
QQC2.Label {
id: notificationCountLabel
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: -Kirigami.Units.smallSpacing
anchors.rightMargin: -Kirigami.Units.smallSpacing
z: 1
width: Math.max(notificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
height: Kirigami.Units.iconSizes.smallMedium
text: root.notificationCount > 0 ? root.notificationCount : ""
visible: root.showNotificationLabel
color: Kirigami.Theme.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
background: Rectangle {
visible: true
Kirigami.Theme.colorSet: Kirigami.Theme.Button
Kirigami.Theme.inherit: false
color: root.notificationHighlight ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.backgroundColor
radius: height / 2
}
TextMetrics {
id: notificationCountTextMetrics
text: notificationCountLabel.text
}
}
}

View File

@@ -15,12 +15,6 @@ Delegates.RoundedItemDelegate {
property url source property url source
property alias notificationCount: avatarNotification.notificationCount
property alias notificationHighlight: avatarNotification.notificationHighlight
property alias showNotificationLabel: avatarNotification.showNotificationLabel
signal contextMenuRequested signal contextMenuRequested
signal selected signal selected
@@ -47,8 +41,7 @@ Delegates.RoundedItemDelegate {
} }
} }
contentItem: AvatarNotification { contentItem: KirigamiComponents.Avatar {
id: avatarNotification
source: root.source source: root.source
name: root.text name: root.text
} }

View File

@@ -74,7 +74,7 @@ Loader {
* Some common actions shared between menus * Some common actions shared between menus
*/ */
component ViewSourceAction: Kirigami.Action { component ViewSourceAction: Kirigami.Action {
visible: NeoChatConfig.developerTools visible: Config.developerTools
text: i18n("View Source") text: i18n("View Source")
icon.name: "code-context" icon.name: "code-context"
onTriggered: RoomManager.viewEventSource(root.eventId) onTriggered: RoomManager.viewEventSource(root.eventId)

View File

@@ -101,13 +101,13 @@ DelegateContextMenu {
id: saveAsDialog id: saveAsDialog
FileDialog { FileDialog {
fileMode: FileDialog.SaveFile fileMode: FileDialog.SaveFile
folder: NeoChatConfig.lastSaveDirectory.length > 0 ? NeoChatConfig.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation)
onAccepted: { onAccepted: {
if (!currentFile) { if (!currentFile) {
return; return;
} }
NeoChatConfig.lastSaveDirectory = folder; Config.lastSaveDirectory = folder;
NeoChatConfig.save(); Config.save();
currentRoom.downloadFile(eventId, currentFile); currentRoom.downloadFile(eventId, currentFile);
} }
} }

View File

@@ -117,7 +117,7 @@ QQC2.Control {
} }
}, },
Kirigami.Action { Kirigami.Action {
visible: NeoChatConfig.threads && !root.currentRoom.readOnly visible: Config.threads && !root.currentRoom.readOnly
text: i18n("Reply in Thread") text: i18n("Reply in Thread")
icon.name: "dialog-messages" icon.name: "dialog-messages"
onTriggered: { onTriggered: {

View File

@@ -27,7 +27,10 @@ Kirigami.Page {
let c = LocationHelper.center(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox)); let c = LocationHelper.center(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox));
return QtPositioning.coordinate(c.y, c.x); return QtPositioning.coordinate(c.y, c.x);
} }
map.zoomLevel: LocationHelper.zoomToFit(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox), mapView.width, mapView.height) map.zoomLevel: {
const zoom = LocationHelper.zoomToFit(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox), mapView.width, mapView.height)
return Math.min(Math.max(zoom, map.minimumZoomLevel), map.maximumZoomLevel);
}
MapItemView { MapItemView {
Component.onCompleted: mapView.map.addMapItemView(this) Component.onCompleted: mapView.map.addMapItemView(this)

View File

@@ -18,7 +18,7 @@ Kirigami.ApplicationWindow {
readonly property HoverLinkIndicator hoverLinkIndicator: linkIndicator readonly property HoverLinkIndicator hoverLinkIndicator: linkIndicator
title: NeoChatConfig.windowTitleFocus ? activeFocusItem + " " + (activeFocusItem ? activeFocusItem.Accessible.name : "") : "NeoChat" title: Config.windowTitleFocus ? activeFocusItem + " " + (activeFocusItem ? activeFocusItem.Accessible.name : "") : "NeoChat"
minimumWidth: Kirigami.Units.gridUnit * 20 minimumWidth: Kirigami.Units.gridUnit * 20
minimumHeight: Kirigami.Units.gridUnit * 15 minimumHeight: Kirigami.Units.gridUnit * 15
@@ -54,16 +54,6 @@ Kirigami.ApplicationWindow {
} }
} }
Connections {
id: pendingOidcConnections
target: Controller.pendingOidcConnection
function onConnected() {
console.warn("loading rooms")
root.load();
pendingOidcConnections.enabled = false;
}
}
Connections { Connections {
target: root.quitAction target: root.quitAction
function onTriggered() { function onTriggered() {
@@ -168,7 +158,7 @@ Kirigami.ApplicationWindow {
// This is a memory for all user initiated actions on the drawer, i.e. clicking the button // This is a memory for all user initiated actions on the drawer, i.e. clicking the button
// It is used to ensure that user choice is remembered when changing pages and expanding and contracting the window width // It is used to ensure that user choice is remembered when changing pages and expanding and contracting the window width
property bool drawerUserState: NeoChatConfig.autoRoomInfoDrawer property bool drawerUserState: Config.autoRoomInfoDrawer
connection: root.connection connection: root.connection
@@ -189,7 +179,7 @@ Kirigami.ApplicationWindow {
modal: (!root.wideScreen || !enabled) modal: (!root.wideScreen || !enabled)
onEnabledChanged: drawerOpen = enabled && !modal onEnabledChanged: drawerOpen = enabled && !modal
onModalChanged: { onModalChanged: {
if (NeoChatConfig.autoRoomInfoDrawer) { if (Config.autoRoomInfoDrawer) {
drawerOpen = !modal && drawerUserState; drawerOpen = !modal && drawerUserState;
dim = false; dim = false;
} }
@@ -204,11 +194,11 @@ Kirigami.ApplicationWindow {
RoomSettingsView.window = root; RoomSettingsView.window = root;
NeoChatSettingsView.window = root; NeoChatSettingsView.window = root;
NeoChatSettingsView.connection = root.connection; NeoChatSettingsView.connection = root.connection;
WindowController.setBlur(pageStack, NeoChatConfig.blur && !NeoChatConfig.compactLayout); WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout);
if (ShareHandler.text && root.connection) { if (ShareHandler.text && root.connection) {
root.handleShare() root.handleShare()
} }
if (NeoChatConfig.minimizeToSystemTrayOnStartup && !Kirigami.Settings.isMobile && Controller.supportSystemTray && NeoChatConfig.systemTray) { if (Config.minimizeToSystemTrayOnStartup && !Kirigami.Settings.isMobile && Controller.supportSystemTray && Config.systemTray) {
restoreWindowGeometryConnections.enabled = true; // To restore window size and position restoreWindowGeometryConnections.enabled = true; // To restore window size and position
} else { } else {
visible = true; visible = true;
@@ -216,21 +206,21 @@ Kirigami.ApplicationWindow {
} }
} }
Connections { Connections {
target: NeoChatConfig target: Config
function onBlurChanged() { function onBlurChanged() {
WindowController.setBlur(pageStack, NeoChatConfig.blur && !NeoChatConfig.compactLayout); WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout);
} }
function onCompactLayoutChanged() { function onCompactLayoutChanged() {
WindowController.setBlur(pageStack, NeoChatConfig.blur && !NeoChatConfig.compactLayout); WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout);
} }
} }
// blur effect // blur effect
color: NeoChatConfig.blur && !NeoChatConfig.compactLayout ? "transparent" : Kirigami.Theme.backgroundColor color: Config.blur && !Config.compactLayout ? "transparent" : Kirigami.Theme.backgroundColor
// we need to apply the translucency effect separately on top of the color // we need to apply the translucency effect separately on top of the color
background: Rectangle { background: Rectangle {
color: NeoChatConfig.blur && !NeoChatConfig.compactLayout ? Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 1 - NeoChatConfig.transparency) : "transparent" color: Config.blur && !Config.compactLayout ? Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 1 - Config.transparency) : "transparent"
} }
Component { Component {

View File

@@ -119,8 +119,8 @@ Components.AlbumMaximizeComponent {
fileMode: Platform.FileDialog.SaveFile fileMode: Platform.FileDialog.SaveFile
folder: root.saveFolder folder: root.saveFolder
onAccepted: { onAccepted: {
NeoChatConfig.lastSaveDirectory = folder; Config.lastSaveDirectory = folder;
NeoChatConfig.save(); Config.save();
if (!currentFile) { if (!currentFile) {
return; return;
} }

View File

@@ -54,17 +54,13 @@ Delegates.RoundedItemDelegate {
contentItem: RowLayout { contentItem: RowLayout {
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
AvatarNotification { Components.Avatar {
source: root.avatar ? root.connection.makeMediaUrl("mxc://" + root.avatar) : "" source: root.avatar ? root.connection.makeMediaUrl("mxc://" + root.avatar) : ""
name: root.displayName name: root.displayName
visible: NeoChatConfig.showAvatarInRoomDrawer visible: Config.showAvatarInRoomDrawer
implicitHeight: Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) implicitHeight: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2)
implicitWidth: visible ? implicitHeight : 0 implicitWidth: visible ? implicitHeight : 0
notificationCount: root.contextNotificationCount
notificationHighlight: root.hasHighlightNotifications
showNotificationLabel: root.hasNotifications && root.collapsed
Layout.fillHeight: true Layout.fillHeight: true
Layout.preferredWidth: height Layout.preferredWidth: height
} }
@@ -95,7 +91,7 @@ Delegates.RoundedItemDelegate {
elide: Text.ElideRight elide: Text.ElideRight
font: Kirigami.Theme.smallFont font: Kirigami.Theme.smallFont
opacity: root.hasNotifications ? 0.9 : 0.7 opacity: root.hasNotifications ? 0.9 : 0.7
visible: !NeoChatConfig.compactRoomList && text.length > 0 visible: !Config.compactRoomList && text.length > 0
textFormat: Text.PlainText textFormat: Text.PlainText
Layout.fillWidth: true Layout.fillWidth: true
@@ -141,7 +137,7 @@ Delegates.RoundedItemDelegate {
QQC2.Button { QQC2.Button {
id: configButton id: configButton
visible: root.hovered && !Kirigami.Settings.isMobile && !NeoChatConfig.compactRoomList && !root.collapsed && root.showConfigure visible: root.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList && !root.collapsed && root.showConfigure
text: i18n("Configure room") text: i18n("Configure room")
display: QQC2.Button.IconOnly display: QQC2.Button.IconOnly
@@ -159,14 +155,14 @@ Delegates.RoundedItemDelegate {
room: root.currentRoom, room: root.currentRoom,
connection: root.connection connection: root.connection
}); });
if (!Kirigami.Settings.isMobile && !NeoChatConfig.compactRoomList) { if (!Kirigami.Settings.isMobile && !Config.compactRoomList) {
configButton.visible = true; configButton.visible = true;
configButton.down = true; configButton.down = true;
} }
menu.closed.connect(function () { menu.closed.connect(function () {
configButton.down = undefined; configButton.down = undefined;
configButton.visible = Qt.binding(() => { configButton.visible = Qt.binding(() => {
return root.hovered && !Kirigami.Settings.isMobile && !NeoChatConfig.compactRoomList; return root.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList;
}); });
}); });
menu.open(); menu.open();

View File

@@ -24,10 +24,10 @@ Kirigami.OverlayDrawer {
readonly property int maxWidth: Kirigami.Units.gridUnit * 25 readonly property int maxWidth: Kirigami.Units.gridUnit * 25
readonly property int defaultWidth: Kirigami.Units.gridUnit * 20 readonly property int defaultWidth: Kirigami.Units.gridUnit * 20
property int actualWidth: { property int actualWidth: {
if (NeoChatConfig.roomDrawerWidth === -1) { if (Config.roomDrawerWidth === -1) {
return Kirigami.Units.gridUnit * 20; return Kirigami.Units.gridUnit * 20;
} else { } else {
return NeoChatConfig.roomDrawerWidth; return Config.roomDrawerWidth;
} }
} }
@@ -45,8 +45,8 @@ Kirigami.OverlayDrawer {
visible: true visible: true
onPressed: _lastX = mapToGlobal(mouseX, mouseY).x onPressed: _lastX = mapToGlobal(mouseX, mouseY).x
onReleased: { onReleased: {
NeoChatConfig.roomDrawerWidth = root.actualWidth; Config.roomDrawerWidth = root.actualWidth;
NeoChatConfig.save(); Config.save();
} }
property real _lastX: -1 property real _lastX: -1
@@ -55,9 +55,9 @@ Kirigami.OverlayDrawer {
return; return;
} }
if (Qt.application.layoutDirection === Qt.RightToLeft) { if (Qt.application.layoutDirection === Qt.RightToLeft) {
root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, NeoChatConfig.roomDrawerWidth - _lastX + mapToGlobal(mouseX, mouseY).x)); root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth - _lastX + mapToGlobal(mouseX, mouseY).x));
} else { } else {
root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, NeoChatConfig.roomDrawerWidth + _lastX - mapToGlobal(mouseX, mouseY).x)); root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth + _lastX - mapToGlobal(mouseX, mouseY).x));
} }
} }
} }

View File

@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com> // 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 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Controls as QQC2 import QtQuick.Controls as QQC2
import QtQuick.Layouts import QtQuick.Layouts
@@ -188,11 +190,17 @@ QQC2.ScrollView {
focusSequence: "Ctrl+Shift+F" focusSequence: "Ctrl+Shift+F"
onAccepted: sortedMessageEventModel.filterString = text onAccepted: userFilterModel.filterText = text
} }
} }
model: root.room.isDirectChat() ? 0 : RoomManager.userListModel model: root.room.isDirectChat() ? 0 : userFilterModel
UserFilterModel {
id: userFilterModel
sourceModel: RoomManager.userListModel
allowEmpty: true
}
clip: true clip: true
focus: true focus: true

View File

@@ -27,7 +27,7 @@ Kirigami.Page {
required property NeoChatConnection connection required property NeoChatConnection connection
readonly property bool collapsed: NeoChatConfig.collapsed readonly property bool collapsed: Config.collapsed
signal search signal search
@@ -258,7 +258,7 @@ Kirigami.Page {
if (_private.currentWidth < _private.collapseWidth && _private.currentWidth + (mouse.x - _lastX) >= _private.collapseWidth) { if (_private.currentWidth < _private.collapseWidth && _private.currentWidth + (mouse.x - _lastX) >= _private.collapseWidth) {
// Here we get back directly to a more wide mode. // Here we get back directly to a more wide mode.
_private.currentWidth = _private.defaultWidth; _private.currentWidth = _private.defaultWidth;
NeoChatConfig.collapsed = false; Config.collapsed = false;
} else if (_private.currentWidth >= _private.collapseWidth) { } else if (_private.currentWidth >= _private.collapseWidth) {
// Increase page width // Increase page width
_private.currentWidth = Math.min(_private.defaultWidth, _private.currentWidth + (mouse.x - _lastX)); _private.currentWidth = Math.min(_private.defaultWidth, _private.currentWidth + (mouse.x - _lastX));
@@ -267,7 +267,7 @@ Kirigami.Page {
const tmpWidth = _private.currentWidth - (_lastX - mouse.x); const tmpWidth = _private.currentWidth - (_lastX - mouse.x);
if (tmpWidth < _private.collapseWidth) { if (tmpWidth < _private.collapseWidth) {
_private.currentWidth = Qt.binding(() => _private.collapsedSize); _private.currentWidth = Qt.binding(() => _private.collapsedSize);
NeoChatConfig.collapsed = true; Config.collapsed = true;
} else { } else {
_private.currentWidth = tmpWidth; _private.currentWidth = tmpWidth;
} }
@@ -324,9 +324,9 @@ Kirigami.Page {
*/ */
QtObject { QtObject {
id: _private id: _private
property int currentWidth: NeoChatConfig.collapsed ? collapsedSize : defaultWidth property int currentWidth: Config.collapsed ? collapsedSize : defaultWidth
readonly property int defaultWidth: Kirigami.Units.gridUnit * 17 readonly property int defaultWidth: Kirigami.Units.gridUnit * 17
readonly property int collapseWidth: Kirigami.Units.gridUnit * 10 readonly property int collapseWidth: Kirigami.Units.gridUnit * 10
readonly property int collapsedSize: Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) + Kirigami.Units.largeSpacing * 2 + (scrollView.QQC2.ScrollBar.vertical.visible ? scrollView.QQC2.ScrollBar.vertical.width : 0) readonly property int collapsedSize: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) + Kirigami.Units.largeSpacing * 2 + (scrollView.QQC2.ScrollBar.vertical.visible ? scrollView.QQC2.ScrollBar.vertical.width : 0)
} }
} }

View File

@@ -155,7 +155,6 @@ Kirigami.Page {
sourceComponent: Kirigami.PlaceholderMessage { sourceComponent: Kirigami.PlaceholderMessage {
icon.name: "org.kde.neochat" icon.name: "org.kde.neochat"
text: i18n("Welcome to NeoChat") text: i18n("Welcome to NeoChat")
explanation: i18n("Select or join a room to get started")
} }
} }
@@ -170,7 +169,7 @@ Kirigami.Page {
background: Rectangle { background: Rectangle {
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
color: NeoChatConfig.compactLayout ? Kirigami.Theme.backgroundColor : "transparent" color: Config.compactLayout ? Kirigami.Theme.backgroundColor : "transparent"
} }
footer: Loader { footer: Loader {

View File

@@ -86,34 +86,6 @@ QQC2.Control {
text: i18n("Home") text: i18n("Home")
contentItem: Kirigami.Icon { contentItem: Kirigami.Icon {
source: "user-home-symbolic" source: "user-home-symbolic"
QQC2.Label {
id: homeNotificationCountLabel
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: -Kirigami.Units.smallSpacing
anchors.rightMargin: -Kirigami.Units.smallSpacing
z: 1
width: Math.max(homeNotificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
height: Kirigami.Units.iconSizes.smallMedium
text: root.connection.homeNotifications > 0 ? root.connection.homeNotifications : ""
visible: root.connection.homeNotifications > 0 && (RoomManager.currentSpace.length > 0 || root.showDirectChats === true)
color: Kirigami.Theme.textColor
horizontalAlignment: Text.AlignHCenter
background: Rectangle {
visible: true
Kirigami.Theme.colorSet: Kirigami.Theme.Button
Kirigami.Theme.inherit: false
color: root.connection.homeHaveHighlightNotifications ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.backgroundColor
radius: height / 2
}
TextMetrics {
id: homeNotificationCountTextMetrics
text: homeNotificationCountLabel.text
}
}
} }
activeFocusOnTab: true activeFocusOnTab: true
@@ -123,6 +95,33 @@ QQC2.Control {
RoomManager.currentSpace = ""; RoomManager.currentSpace = "";
root.selectionChanged(); root.selectionChanged();
} }
QQC2.Label {
id: homeNotificationCountLabel
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: Kirigami.Units.smallSpacing / 2
z: 1
width: Math.max(homeNotificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
height: Kirigami.Units.iconSizes.smallMedium
text: root.connection.homeNotifications > 0 ? root.connection.homeNotifications : ""
visible: root.connection.homeNotifications > 0 && (RoomManager.currentSpace.length > 0 || root.showDirectChats === true)
color: Kirigami.Theme.textColor
horizontalAlignment: Text.AlignHCenter
background: Rectangle {
visible: true
Kirigami.Theme.colorSet: Kirigami.Theme.Button
Kirigami.Theme.inherit: false
color: root.connection.homeHaveHighlightNotifications ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.backgroundColor
radius: height / 2
}
TextMetrics {
id: homeNotificationCountTextMetrics
text: homeNotificationCountLabel.text
}
}
} }
AvatarTabButton { AvatarTabButton {
id: directChatButton id: directChatButton
@@ -135,34 +134,6 @@ QQC2.Control {
text: i18nc("@button View all one-on-one chats with your friends.", "Friends") text: i18nc("@button View all one-on-one chats with your friends.", "Friends")
contentItem: Kirigami.Icon { contentItem: Kirigami.Icon {
source: "system-users" source: "system-users"
QQC2.Label {
id: directChatNotificationCountLabel
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: -Kirigami.Units.smallSpacing
anchors.rightMargin: -Kirigami.Units.smallSpacing
z: 1
width: Math.max(directChatNotificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
height: Kirigami.Units.iconSizes.smallMedium
text: root.connection.directChatNotifications > 0 ? root.connection.directChatNotifications : ""
visible: (root.connection.directChatNotifications > 0 || root.connection.directChatInvites) && RoomManager.currentSpace !== "DM"
color: Kirigami.Theme.textColor
horizontalAlignment: Text.AlignHCenter
background: Rectangle {
visible: true
Kirigami.Theme.colorSet: Kirigami.Theme.Button
Kirigami.Theme.inherit: false
color: root.connection.directChatsHaveHighlightNotifications ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.backgroundColor
radius: height / 2
}
TextMetrics {
id: directChatNotificationCountTextMetrics
text: directChatNotificationCountLabel.text
}
}
} }
activeFocusOnTab: true activeFocusOnTab: true
@@ -172,6 +143,33 @@ QQC2.Control {
RoomManager.currentSpace = "DM"; RoomManager.currentSpace = "DM";
root.selectionChanged(); root.selectionChanged();
} }
QQC2.Label {
id: directChatNotificationCountLabel
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: Kirigami.Units.smallSpacing / 2
z: 1
width: Math.max(directChatNotificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
height: Kirigami.Units.iconSizes.smallMedium
text: root.connection.directChatNotifications > 0 ? root.connection.directChatNotifications : ""
visible: (root.connection.directChatNotifications > 0 || root.connection.directChatInvites) && RoomManager.currentSpace !== "DM"
color: Kirigami.Theme.textColor
horizontalAlignment: Text.AlignHCenter
background: Rectangle {
visible: true
Kirigami.Theme.colorSet: Kirigami.Theme.Button
Kirigami.Theme.inherit: false
color: root.connection.directChatsHaveHighlightNotifications ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.backgroundColor
radius: height / 2
}
TextMetrics {
id: directChatNotificationCountTextMetrics
text: directChatNotificationCountLabel.text
}
}
} }
Repeater { Repeater {
@@ -192,10 +190,6 @@ QQC2.Control {
text: displayName text: displayName
source: avatar ? root.connection.makeMediaUrl("mxc://" + avatar) : "" source: avatar ? root.connection.makeMediaUrl("mxc://" + avatar) : ""
notificationCount: spaceDelegate.currentRoom.childrenNotificationCount
notificationHighlight: spaceDelegate.currentRoom.childrenHaveHighlightNotifications
showNotificationLabel: spaceDelegate.currentRoom.childrenNotificationCount > 0 && RoomManager.currentSpace != spaceDelegate.roomId
activeFocusOnTab: true activeFocusOnTab: true
onSelected: { onSelected: {
@@ -204,6 +198,34 @@ QQC2.Control {
} }
checked: RoomManager.currentSpace === roomId checked: RoomManager.currentSpace === roomId
onContextMenuRequested: root.createContextMenu(currentRoom) onContextMenuRequested: root.createContextMenu(currentRoom)
QQC2.Label {
id: notificationCountLabel
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: Kirigami.Units.smallSpacing / 2
z: 1
width: Math.max(notificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
height: Kirigami.Units.iconSizes.smallMedium
text: spaceDelegate.currentRoom.childrenNotificationCount > 0 ? spaceDelegate.currentRoom.childrenNotificationCount : ""
visible: spaceDelegate.currentRoom.childrenNotificationCount > 0 && RoomManager.currentSpace != spaceDelegate.roomId
color: Kirigami.Theme.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
background: Rectangle {
visible: true
Kirigami.Theme.colorSet: Kirigami.Theme.Button
Kirigami.Theme.inherit: false
color: spaceDelegate.currentRoom.childrenHaveHighlightNotifications ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.backgroundColor
radius: height / 2
}
TextMetrics {
id: notificationCountTextMetrics
text: notificationCountLabel.text
}
}
} }
} }

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