From ae3f0257c92d199bcc918f7d0294caca0a9ab341 Mon Sep 17 00:00:00 2001 From: William Rehwinkel Date: Mon, 20 Jun 2022 21:37:22 -0400 Subject: [PATCH] Clicking on user's name inserts ID instead of matrix.to href --- client/chatedit.cpp | 13 + client/chatedit.h | 1 + client/chatroomwidget.cpp | 4 +- client/translations/quaternion_en.ts | 433 ++++++++++++++------------- 4 files changed, 233 insertions(+), 218 deletions(-) diff --git a/client/chatedit.cpp b/client/chatedit.cpp index 146dcbb3..a82140ab 100644 --- a/client/chatedit.cpp +++ b/client/chatedit.cpp @@ -229,6 +229,19 @@ void ChatEdit::cancelCompletion() bool ChatEdit::isCompletionActive() { return !completionMatches.isEmpty(); } +void ChatEdit::insertRaw(QString text) +{ + // Similar in behavior to ChatEdit::insertMention + // (see below) except that it inserts + // raw text only. + // Used to insert uri in @username:homeserver + // format + + auto cursor = textCursor(); + cursor.insertText(text); + cursor.insertText(QStringLiteral(" ")); // extra space after name +} + void ChatEdit::insertMention(QString author, QUrl url) { // The order of inserting text below is such to be convenient for the user diff --git a/client/chatedit.h b/client/chatedit.h index 7b70a64c..45c21a76 100644 --- a/client/chatedit.h +++ b/client/chatedit.h @@ -37,6 +37,7 @@ class ChatEdit : public KChatEdit void cancelCompletion(); bool isCompletionActive(); + void insertRaw(QString text); void insertMention(QString author, QUrl url); public slots: diff --git a/client/chatroomwidget.cpp b/client/chatroomwidget.cpp index 48be568c..8e625fb0 100644 --- a/client/chatroomwidget.cpp +++ b/client/chatroomwidget.cpp @@ -332,9 +332,7 @@ void ChatRoomWidget::setHudHtml(const QString& htmlCaption, void ChatRoomWidget::insertMention(Quotient::User* user) { Q_ASSERT(currentRoom() != nullptr); - m_chatEdit->insertMention( - user->displayname(currentRoom()), - Quotient::Uri(user->id()).toUrl(Quotient::Uri::MatrixToUri)); + m_chatEdit->insertRaw(user->id()); m_chatEdit->setFocus(); } diff --git a/client/translations/quaternion_en.ts b/client/translations/quaternion_en.ts index 04d09932..0a509680 100644 --- a/client/translations/quaternion_en.ts +++ b/client/translations/quaternion_en.ts @@ -27,45 +27,43 @@ Choose a room to send messages or enter a command... - + Attach Attach - + Attach file Attach file - - - + Add a message to the file or just push Enter Add a message to the file or just push Enter - - + + Attaching %1 Attaching %1 - + Attaching cancelled Attaching cancelled - + Attaching an image from clipboard Attaching an image from clipboard - + No completions No completions - + %Ln more completions %Ln more completion @@ -73,161 +71,166 @@ - + Next completion: Next completion: - + Currently typing: Currently typing: - + Send a message (no end-to-end encryption support yet)... Send a message (no end-to-end encryption support yet)... - + Send a message (over %1) or enter a command... %1 is the protocol used by the server (usually HTTPS) Send a message (over %1) or enter a command... - + There's nothing to send There's nothing to send - + /join argument doesn't look like a room ID or alias /join argument doesn't look like a room ID or alias - + There's no such /command outside of room. There's no such /command outside of room. - + At pos %1: %2 %1 is a position of the error; %2 is the error message At pos %1: %2 - + You should select a room to send messages. You should select a room to send messages. - + Sending a farewell message is not supported yet. If you intended to leave another room, switch to it and type /leave there. Sending a farewell message is not supported yet. If you intended to leave another room, switch to it and type /leave there. - + + Attaching a local file as pasted/inserted + + + + %L1 more The number of users in the typing or completion list %L1 more - + /forget must be followed by the room id/alias, even for the current room /forget must be followed by the room id/alias, even for the current room - + %1 doesn't look like a room id or alias %1 doesn't look like a room id or alias - + /invite <memberId> /invite <memberId> - + %1 doesn't look like a user ID %1 doesn't look like a user ID - + /%1 <userId> <reason> /%1 <userId> <reason> - - + + %1 doesn't look like a user id %1 doesn't look like a user id - + %1 is not a member of this room %1 is not a member of this room - + /unban <userId> /unban <userId> - + /unban argument doesn't look like a user ID /unban argument doesn't look like a user ID - + /ignore <userId> /ignore <userId> - + /ignore argument doesn't look like a user ID /ignore argument doesn't look like a user ID - + Couldn't find user %1 on the server Couldn't find user %1 on the server - + /me needs an argument /me needs an argument - + /notice needs an argument /notice needs an argument - + /%1 <memberId> <message> /%1 <memberId> <message> - + %1 doesn't seem to have joined room %2 %1 doesn't seem to have joined room %2 - + %1 doesn't look like a user id or room alias %1 doesn't look like a user id or room alias - + Your build of Quaternion doesn't support Markdown Your build of Quaternion doesn't support Markdown - + /%1 <memberId> /%1 <memberId> - + Unknown /command. Use // to send this line literally Unknown /command. Use // to send this line literally @@ -838,39 +841,39 @@ User-defined tags should start with "u." First sync completed for %1 - + Logged out as %1 Logged out as %1 - + Sync failed Sync failed - + The last sync of account %1 has failed with error: %2 The last sync of account %1 has failed with error: %2 - + The last sync has failed with error: %1 The last sync has failed with error: %1 - + Clicking 'Retry' will attempt to resume synchronisation; Clicking 'Cancel' will stop further synchronisation of this account until logout or Quaternion restart. Clicking 'Retry' will attempt to resume synchronisation; Clicking 'Cancel' will stop further synchronisation of this account until logout or Quaternion restart. - + Before this server can process your information, you have to agree with its terms and conditions; please click the button below to open the web page where you can do that Before this server can process your information, you have to agree with its terms and conditions; please click the button below to open the web page where you can do that - + Request URL: %1 Response: %2 @@ -879,157 +882,157 @@ Response: %2 - + Open web page Open web page - + Logging in into a logged in account Logging in into a logged in account - + You're trying to log in into an account that's already logged in. Do you want to continue? You're trying to log in into an account that's already logged in. Do you want to continue? - + About Quaternion About Quaternion - + &About &About - + Web page Web page - + Quaternion project contributors Quaternion project contributors - + Built from Git, commit SHA: Built from Git, commit SHA: - + Library commit SHA: Library commit SHA: - + Original project author: %1 Original project author: %1 - + Felix Rohrbach Felix Rohrbach - + Project leader: %1 Project leader: %1 - + Alexey "Kitsune" Rusakov Alexey "Kitsune" Rusakov - + Contributors: Contributors: - + Quaternion contributors @ GitHub Quaternion contributors @ GitHub - + libQuotient contributors @ GitHub libQuotient contributors @ GitHub - + Quaternion translators @ Lokalise.co Quaternion translators @ Lokalise.co - + Special thanks to %1 for all the testing effort Special thanks to %1 for all the testing effort - + Made with: Made with: - + &Thanks &Thanks - + Failed to resolve server %1 Failed to resolve server %1 - + Welcome to Quaternion Welcome to Quaternion - + Couldn't delete access token Couldn't delete access token - + Quaternion couldn't delete the access token from the keychain. Quaternion couldn't delete the access token from the keychain. - + Open direct chat? Open direct chat? - + Open direct chat with user %1? Open direct chat with user %1? - + Joined %1 as %2 Joined %1 as %2 - + No application for the link No application for the link - + Your operating system could not find an application for the link. Your operating system could not find an application for the link. - + External link confirmation External link confirmation - + An external application will be opened to visit a non-Matrix link: %1 @@ -1042,171 +1045,171 @@ Is that right? Is that right? - + Do not ask again Do not ask again - + Malformed or empty Matrix id Malformed or empty Matrix id - + %1 is not a correct Matrix identifier %1 is not a correct Matrix identifier - - + + Please connect to a server Please connect to a server - + Confirm account to join %1 Confirm account to join %1 - + Confirm your account to open a direct chat with %1 Confirm your account to open a direct chat with %1 - + Confirm your account to open %1 Confirm your account to open %1 - + Room not found Room not found - + There's no room %1 in the room list. Check the spelling and the account. There's no room %1 in the room list. Check the spelling and the account. - + Confirm account Confirm account - + Open room Open room - + Room or user ID, room alias, Matrix URI or matrix.to link Room or user ID, room alias, Matrix URI or matrix.to link - + Go to room Go to room - - + + Join room Join room - + Room ID (starting with !) or alias (starting with #) Room ID (starting with !) or alias (starting with #) - + Account Account - + Chat with user On a button in 'Open room' dialog when a user identifier is entered Chat with user - + Can't open On a disabled button in 'Open room' dialog when an invalid/unsupported URI is entered Can't open - + Could not resolve id Could not resolve id - + Could not find an external application to open the URI: Could not find an external application to open the URI: - + Could not resolve Matrix identifier Could not resolve Matrix identifier - + Incorrect action on a Matrix resource Incorrect action on a Matrix resource - + The URI contains an action '%1' that cannot be applied to Matrix resource %2 The URI contains an action '%1' that cannot be applied to Matrix resource %2 - + Couldn't connect to the server as %1; will retry within %2 seconds Couldn't connect to the server as %1; will retry within %2 seconds - + Reconnecting... Reconnecting... - + No SSL support No SSL support - + Your SSL configuration does not allow Quaternion to establish secure connections. Your SSL configuration does not allow Quaternion to establish secure connections. - + SSL error SSL error - + Proxy needs authentication Proxy needs authentication - + Authenticate Authenticate with the proxy server Authenticate - + User name User name - + Password Password @@ -1214,218 +1217,218 @@ or alias (starting with #) MessageEventModel - + Today Today - + Yesterday Yesterday - + The day before yesterday The day before yesterday - - + + Redacted Redacted - - + + Redacted: %1 Redacted: %1 - + a file a file - + invited %1 to the room invited %1 to the room - + joined the room joined the room - + (repeated) State event that doesn't change the state (repeated) - + cleared the display name cleared the display name - + changed the display name to %1 changed the display name to %1 - + and and - + cleared the avatar cleared the avatar - + updated the avatar updated the avatar - + withdrew %1's invitation withdrew %1's invitation - + rejected the invitation rejected the invitation - + unbanned %1 unbanned %1 - + self-unbanned self-unbanned - + kicked %1 from the room kicked %1 from the room - + kicked %1 from the room: %2 kicked %1 from the room: %2 - + left the room left the room - + banned %1 from the room banned %1 from the room - + banned %1 from the room: %2 banned %1 from the room: %2 - + self-banned from the room self-banned from the room - + knocked knocked - + made something unknown made something unknown - + cleared the room main alias cleared the room main alias - + set the room main alias to: %1 set the room main alias to: %1 - + cleared the room name cleared the room name - + set the room name to: %1 set the room name to: %1 - + cleared the topic cleared the topic - + set the topic to: %1 set the topic to: %1 - + changed the room avatar changed the room avatar - + activated End-to-End Encryption activated End-to-End Encryption - + upgraded the room to version %1 upgraded the room to version %1 - + created the room, version %1 created the room, version %1 - + upgraded the room: %1 upgraded the room: %1 - + updated the database TWIM bot updated the database updated the database - + updated %1 state %1 - Matrix event type updated %1 state - + updated %1 state for %2 %1 - Matrix event type, %2 - state key updated %1 state for %2 - + Unknown event Unknown event - + %Ln more member(s) When the reaction comes from too many members @@ -1742,88 +1745,88 @@ or alias (starting with #) - + %1 (as %2) %Room (as %user) %1 (as %2) - + Main alias: %1 Main alias: %1 - + Joined: %L1 The number of joined members Joined: %L1 - + Invited: %L1 The number of invited users Invited: %L1 - + Direct chat with %1 Direct chat with %1 - + The room enforces encryption The room enforces encryption - + This room's version is unstable! This room's version is unstable! - + Consider upgrading to a stable version (use room settings for that) Consider upgrading to a stable version (use room settings for that) - - Unread messages: %L1 - Unread messages: %L1 + + Events after fully read marker: %L1 + - - (maybe more) - Unread messages - (maybe more) + + Unread events/highlights since read receipt: %L1/%L2 + - - Unread highlights: %L1 - Unread highlights: %L1 + + Unread events since read receipt: %L1 + - - Unread notifications: %L1 - Unread notifications: %L1 + + Room id: %1 + - - ID: %1 - ID: %1 + + You joined this room as %1 + - - You joined this room - You joined this room + + You were invited into this room as %1 + - - You left this room - You left this room + + You left this room as %1 + - - You were invited into this room - You were invited into this room + + (maybe more) + Unread messages + (maybe more) @@ -1937,13 +1940,13 @@ This operation cannot be reverted. Timeline - + Unknown Unknown attachment size Unknown - + %Ln byte(s) %Ln byte @@ -1951,71 +1954,71 @@ This operation cannot be reverted. - + %L1 kB %L1 kB - + %L1 MB %L1 MB - + %L1 GB %L1 GB - + (no name) (no name) - + This room has been upgraded. This room has been upgraded. - + Unstable room version! Unstable room version! - + (no topic) (no topic) - + Hide topic Hide topic - + Show topic Show topic - + Go to new room Go to new room - + Room settings Room settings - + Latest events Latest events - + %Ln events back from now %Ln event back from now @@ -2023,7 +2026,7 @@ settings - + %Ln events cached %Ln event cached @@ -2031,7 +2034,7 @@ settings - + %Ln events requested from the server %Ln event requested from the server @@ -2042,35 +2045,35 @@ settings TimelineItem - + edited edited - + Reaction '%1' from %2 %2 is the list of users Reaction '%1' from %2 - + Resend Resend - + Discard Discard - + Go to older room Go to older room - + Go to new room Go to