From aa34576dfd5781ddd9a97522ca15084f8195045f Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 16 Jul 2020 20:19:28 +0200 Subject: [PATCH 1/3] Warn before kicking,banning,inviting,etc --- src/ChatPage.cpp | 56 +++++++++++++++++++++++++++++-------- src/dialogs/UserProfile.cpp | 11 ++++++++ src/dialogs/UserProfile.h | 1 + 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index 0b290927..36d1fc92 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -1152,11 +1152,19 @@ ChatPage::leaveRoom(const QString &room_id) void ChatPage::inviteUser(QString userid, QString reason) { + auto room = current_room_; + + if (QMessageBox::question(this, + tr("Confirm invite"), + tr("Do you really want to invite %1 (%2)?") + .arg(cache::displayName(current_room_, userid)) + .arg(userid)) != QMessageBox::Yes) + return; + http::client()->invite_user( - current_room_.toStdString(), + room.toStdString(), userid.toStdString(), - [this, userid, room = current_room_](const mtx::responses::Empty &, - mtx::http::RequestErr err) { + [this, userid, room](const mtx::responses::Empty &, mtx::http::RequestErr err) { if (err) { emit showNotification( tr("Failed to invite %1 to %2: %3") @@ -1171,11 +1179,19 @@ ChatPage::inviteUser(QString userid, QString reason) void ChatPage::kickUser(QString userid, QString reason) { + auto room = current_room_; + + if (QMessageBox::question(this, + tr("Confirm kick"), + tr("Do you really want to kick %1 (%2)?") + .arg(cache::displayName(current_room_, userid)) + .arg(userid)) != QMessageBox::Yes) + return; + http::client()->kick_user( - current_room_.toStdString(), + room.toStdString(), userid.toStdString(), - [this, userid, room = current_room_](const mtx::responses::Empty &, - mtx::http::RequestErr err) { + [this, userid, room](const mtx::responses::Empty &, mtx::http::RequestErr err) { if (err) { emit showNotification( tr("Failed to kick %1 to %2: %3") @@ -1190,11 +1206,19 @@ ChatPage::kickUser(QString userid, QString reason) void ChatPage::banUser(QString userid, QString reason) { + auto room = current_room_; + + if (QMessageBox::question(this, + tr("Confirm ban"), + tr("Do you really want to ban %1 (%2)?") + .arg(cache::displayName(current_room_, userid)) + .arg(userid)) != QMessageBox::Yes) + return; + http::client()->ban_user( - current_room_.toStdString(), + room.toStdString(), userid.toStdString(), - [this, userid, room = current_room_](const mtx::responses::Empty &, - mtx::http::RequestErr err) { + [this, userid, room](const mtx::responses::Empty &, mtx::http::RequestErr err) { if (err) { emit showNotification( tr("Failed to ban %1 in %2: %3") @@ -1209,11 +1233,19 @@ ChatPage::banUser(QString userid, QString reason) void ChatPage::unbanUser(QString userid, QString reason) { + auto room = current_room_; + + if (QMessageBox::question(this, + tr("Confirm unban"), + tr("Do you really want to unban %1 (%2)?") + .arg(cache::displayName(current_room_, userid)) + .arg(userid)) != QMessageBox::Yes) + return; + http::client()->unban_user( - current_room_.toStdString(), + room.toStdString(), userid.toStdString(), - [this, userid, room = current_room_](const mtx::responses::Empty &, - mtx::http::RequestErr err) { + [this, userid, room](const mtx::responses::Empty &, mtx::http::RequestErr err) { if (err) { emit showNotification( tr("Failed to unban %1 in %2: %3") diff --git a/src/dialogs/UserProfile.cpp b/src/dialogs/UserProfile.cpp index 3415b127..086dbb40 100644 --- a/src/dialogs/UserProfile.cpp +++ b/src/dialogs/UserProfile.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -97,6 +98,14 @@ UserProfile::UserProfile(QWidget *parent) if (utils::localUser() != user_id) req.invite = {user_id.toStdString()}; + if (QMessageBox::question( + this, + tr("Confirm DM"), + tr("Do you really want to invite %1 (%2) to a direct chat?") + .arg(cache::displayName(roomId_, user_id)) + .arg(user_id)) != QMessageBox::Yes) + return; + emit ChatPage::instance()->createRoom(req); }); @@ -199,6 +208,8 @@ UserProfile::init(const QString &userId, const QString &roomId) { resetToDefaults(); + this->roomId_ = roomId; + auto displayName = cache::displayName(roomId, userId); userIdLabel_->setText(userId); diff --git a/src/dialogs/UserProfile.h b/src/dialogs/UserProfile.h index 81276d2a..8129fdcf 100644 --- a/src/dialogs/UserProfile.h +++ b/src/dialogs/UserProfile.h @@ -53,6 +53,7 @@ private: void resetToDefaults(); Avatar *avatar_; + QString roomId_; QLabel *userIdLabel_; QLabel *displayNameLabel_; From e86c1cc79f2720027762a052d6e7157227588d0f Mon Sep 17 00:00:00 2001 From: Lorem Date: Sun, 19 Jul 2020 08:51:44 +0530 Subject: [PATCH 2/3] Make dateBubble's text vertically aligned to vertical center --- resources/qml/TimelineView.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 5494c1ba..6af0372b 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -245,6 +245,7 @@ Page { width: contentWidth * 1.2 horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter background: Rectangle { radius: parent.height / 2 color: colors.base From 48877307cac11e50bb60db4814012e91224f90ca Mon Sep 17 00:00:00 2001 From: HelaBasa Date: Thu, 30 Jul 2020 19:43:46 +0000 Subject: [PATCH 3/3] Added translation using Weblate (Sinhala) --- resources/langs/nheko_si.ts | 1604 +++++++++++++++++++++++++++++++++++ 1 file changed, 1604 insertions(+) create mode 100644 resources/langs/nheko_si.ts diff --git a/resources/langs/nheko_si.ts b/resources/langs/nheko_si.ts new file mode 100644 index 00000000..2f405ca2 --- /dev/null +++ b/resources/langs/nheko_si.ts @@ -0,0 +1,1604 @@ + + + + + Cache + + + You joined this room. + + + + + ChatPage + + + Failed to invite user: %1 + + + + + + Invited user: %1 + + + + + Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually. + + + + + Room %1 created. + + + + + Failed to invite %1 to %2: %3 + + + + + Failed to kick %1 to %2: %3 + + + + + Kicked user: %1 + + + + + Failed to ban %1 in %2: %3 + + + + + Banned user: %1 + + + + + Failed to unban %1 in %2: %3 + + + + + Unbanned user: %1 + + + + + Failed to upload media. Please try again. + + + + + Cache migration failed! + + + + + Incompatible cache version + + + + + The cache on your disk is newer than this version of Nheko supports. Please update or clear your cache. + + + + + Failed to restore OLM account. Please login again. + + + + + Failed to restore save data. Please login again. + + + + + Failed to setup encryption keys. Server response: %1 %2. Please try again later. + + + + + + Please try to login again: %1 + + + + + Failed to join room: %1 + + + + + You joined the room + + + + + Failed to remove invite: %1 + + + + + Room creation failed: %1 + + + + + Failed to leave room: %1 + + + + + CommunitiesListItem + + + All rooms + + + + + Favourite rooms + + + + + Low priority rooms + + + + + + (tag) + + + + + (community) + + + + + EditModal + + + Apply + + + + + Cancel + + + + + Name + + + + + Topic + + + + + EncryptionIndicator + + + Encrypted + + + + + This message is not encrypted! + + + + + InviteeItem + + + Remove + + + + + LoginPage + + + Matrix ID + + + + + e.g @joe:matrix.org + + + + + Your login name. A mxid should start with @ followed by the user id. After the user id you need to include your server name after a :. +You can also put your homeserver address there, if your server doesn't support .well-known lookup. +Example: @user:server.my +If Nheko fails to discover your homeserver, it will show you a field to enter the server manually. + + + + + Password + + + + + Device name + + + + + A name for this device, which will be shown to others, when verifying your devices. If none is provided, a random string is used for privacy purposes. + + + + + The address that can be used to contact you homeservers client API. +Example: https://server.my:8787 + + + + + + LOGIN + + + + + Autodiscovery failed. Received malformed response. + + + + + Autodiscovery failed. Unknown error when requesting .well-known. + + + + + The required endpoints were not found. Possibly not a Matrix server. + + + + + Received malformed response. Make sure the homeserver domain is valid. + + + + + An unknown error occured. Make sure the homeserver domain is valid. + + + + + SSO LOGIN + + + + + Empty password + + + + + SSO login failed + + + + + MemberList + + + Room members + + + + + OK + + + + + MessageDelegate + + + redacted + + + + + Encryption enabled + + + + + room name changed to: %1 + + + + + removed room name + + + + + topic changed to: %1 + + + + + removed topic + + + + + %1 created and configured room: %2 + + + + + Placeholder + + + unimplemented event: + + + + + QuickSwitcher + + + Search for a room... + + + + + RegisterPage + + + Username + + + + + The username must not be empty, and must contain only the characters a-z, 0-9, ., _, =, -, and /. + + + + + Password + + + + + Please choose a secure password. The exact requirements for password strength may depend on your server. + + + + + Password confirmation + + + + + Homeserver + + + + + A server that allows registration. Since matrix is decentralized, you need to first find a server you can register on or host your own. + + + + + REGISTER + + + + + No supported registration flows! + + + + + Invalid username + + + + + Password is not long enough (min 8 chars) + + + + + Passwords don't match + + + + + Invalid server name + + + + + RoomInfo + + + no version stored + + + + + RoomInfoListItem + + + Leave room + + + + + Tag room as: + + + + + Favourite + Standard matrix tag for favourites + + + + + Low Priority + Standard matrix tag for low priority rooms + + + + + Server Notice + Standard matrix tag for server notices + + + + + Adds or removes the specified tag. + WhatsThis hint for tag menu actions + + + + + New tag... + Add a new tag to the room + + + + + New Tag + Tag name prompt title + + + + + Tag: + + + + + Accept + + + + + Decline + + + + + SideBarActions + + + User settings + + + + + Create new room + + + + + Join a room + + + + + Start a new chat + + + + + Room directory + + + + + StatusIndicator + + + Failed + + + + + Sent + + + + + Received + + + + + Read + + + + + TextInputWidget + + + Send a file + + + + + + Write a message... + + + + + Send a message + + + + + Emoji + + + + + Select a file + + + + + All Files (*) + + + + + Connection lost. Nheko is trying to re-connect... + + + + + TimelineModel + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + + + + + Message redaction failed: %1 + + + + + Save image + + + + + Save video + + + + + Save audio + + + + + Save file + + + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted. + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. + + + + + %1 and %2 are typing. + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + + + + + + + %1 opened the room to the public. + + + + + %1 made this room require and invitation to join. + + + + + %1 made the room open to guests. + + + + + %1 has closed the room to guest access. + + + + + %1 made the room history world readable. Events may be now read by non-joined people. + + + + + %1 set the room history visible to members from this point on. + + + + + %1 set the room history visible to members since they were invited. + + + + + %1 set the room history visible to members since they joined the room. + + + + + %1 has changed the room's permissions. + + + + + %1 was invited. + + + + + %1 changed their display name and avatar. + + + + + %1 changed their display name. + + + + + %1 changed their avatar. + + + + + %1 joined. + + + + + %1 rejected their invite. + + + + + Revoked the invite to %1. + + + + + %1 left the room. + + + + + Kicked %1. + + + + + Unbanned %1. + + + + + %1 was banned. + + + + + %1 redacted their knock. + + + + + You joined this room. + + + + + Rejected the knock from %1. + + + + + %1 left after having already left! + This is a leave event after the user already left and shouldn't happen apart from state resets + + + + + Reason: %1 + + + + + %1 knocked. + + + + + TimelineRow + + + Reply + + + + + Options + + + + + TimelineView + + + Reply + + + + + Read receipts + + + + + Mark as read + + + + + View raw message + + + + + View decrypted raw message + + + + + Redact message + + + + + Save as + + + + + No room open + + + + + Close + + + + + TopRoomBar + + + Room options + + + + + Mentions + + + + + Invite users + + + + + Members + + + + + Leave room + + + + + Settings + + + + + TrayIcon + + + Show + + + + + Quit + + + + + UserInfoWidget + + + Logout + + + + + UserSettingsPage + + + Minimize to tray + + + + + Start in tray + + + + + Group's sidebar + + + + + Circular Avatars + + + + + Decrypt messages in sidebar + + + + + Show buttons in timeline + + + + + Typing notifications + + + + + Sort rooms by unreads + + + + + Read receipts + + + + + Send messages as Markdown + + + + + Desktop notifications + + + + + Highlight message on hover + + + + + Scale factor + + + + + Font size + + + + + Font Family + + + + + Theme + + + + + Device ID + + + + + Device Fingerprint + + + + + Session Keys + + + + + IMPORT + + + + + EXPORT + + + + + ENCRYPTION + + + + + GENERAL + + + + + INTERFACE + + + + + Emoji Font Family + + + + + Open Sessions File + + + + + + + + + + + + + + Error + + + + + + File Password + + + + + Enter the passphrase to decrypt the file: + + + + + + The password cannot be empty + + + + + Enter passphrase to encrypt your session keys: + + + + + File to save the exported session keys + + + + + WelcomePage + + + Welcome to nheko! The desktop client for the Matrix protocol. + + + + + Enjoy your stay! + + + + + REGISTER + + + + + LOGIN + + + + + descriptiveTime + + + Yesterday + + + + + dialogs::CreateRoom + + + Create room + + + + + Cancel + + + + + Name + + + + + Topic + + + + + Alias + + + + + Room Visibility + + + + + Room Preset + + + + + Direct Chat + + + + + dialogs::FallbackAuth + + + Open Fallback in Browser + + + + + Cancel + + + + + Confirm + + + + + Open the fallback, follow the steps and confirm after completing them. + + + + + dialogs::InviteUsers + + + Cancel + + + + + User ID to invite + + + + + dialogs::JoinRoom + + + Join + + + + + Cancel + + + + + Room ID or alias + + + + + dialogs::LeaveRoom + + + Cancel + + + + + Are you sure you want to leave? + + + + + dialogs::Logout + + + Cancel + + + + + Logout. Are you sure? + + + + + dialogs::PreviewUploadOverlay + + + Upload + + + + + Cancel + + + + + Media type: %1 +Media size: %2 + + + + + + dialogs::ReCaptcha + + + Cancel + + + + + Confirm + + + + + Solve the reCAPTCHA and press the confirm button + + + + + dialogs::ReadReceipts + + + Read receipts + + + + + Close + + + + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + + + dialogs::RoomSettings + + + Settings + + + + + Info + + + + + Internal ID + + + + + Room Version + + + + + Notifications + + + + + Muted + + + + + Mentions only + + + + + All messages + + + + + Room access + + + + + Anyone and guests + + + + + Anyone + + + + + Invited users + + + + + Encryption + + + + + End-to-End Encryption + + + + + Encryption is currently experimental and things might break unexpectedly. <br>Please take note that it can't be disabled afterwards. + + + + + Respond to key requests + + + + + Whether or not the client should respond automatically with the session keys + upon request. Use with caution, this is a temporary measure to test the + E2E implementation until device verification is completed. + + + + + %n member(s) + + + + + + + + Failed to enable encryption: %1 + + + + + Select an avatar + + + + + All Files (*) + + + + + The selected file is not an image + + + + + Error while reading file: %1 + + + + + + Failed to upload image: %s + + + + + dialogs::UserProfile + + + Ban the user from the room + + + + + Ignore messages from this user + + + + + Kick the user from the room + + + + + Start a conversation + + + + + Devices + + + + + emoji::Panel + + + Smileys & People + + + + + Animals & Nature + + + + + Food & Drink + + + + + Activity + + + + + Travel & Places + + + + + Objects + + + + + Symbols + + + + + Flags + + + + + message-description sent: + + + You sent an audio clip + + + + + %1 sent an audio clip + + + + + You sent an image + + + + + %1 sent an image + + + + + You sent a file + + + + + %1 sent a file + + + + + You sent a video + + + + + %1 sent a video + + + + + You sent a sticker + + + + + %1 sent a sticker + + + + + You sent a notification + + + + + %1 sent a notification + + + + + You: %1 + + + + + %1: %2 + + + + + You sent an encrypted message + + + + + %1 sent an encrypted message + + + + + popups::UserMentions + + + This Room + + + + + All Rooms + + + + + utils + + + Unknown Message Type + + + +