Skip to content

Commit

Permalink
feat(Groups): Add a "copy peer ID" context menu action in conferences.
Browse files Browse the repository at this point in the history
You can use it to e.g. add the user to the blocklist or maybe in the
future we can have a "friend add without request" option where people
can add each other without going through friend requests (they have to
both mutually add each other).
  • Loading branch information
iphydf committed Jan 15, 2025
1 parent c31c09c commit 8cd886a
Show file tree
Hide file tree
Showing 55 changed files with 277 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/widget/form/conferenceform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,21 @@
#include "tabcompleter.h"
#include "src/chatlog/chatwidget.h"
#include "src/chatlog/content/text.h"
#include "src/core/conferenceid.h"
#include "src/core/core.h"
#include "src/core/coreav.h"
#include "src/friendlist.h"
#include "src/model/conference.h"
#include "src/model/friend.h"
#include "src/persistence/iconferencesettings.h"
#include "src/persistence/settings.h"
#include "src/widget/chatformheader.h"
#include "src/widget/conferencewidget.h"
#include "src/widget/flowlayout.h"
#include "src/widget/form/chatform.h"
#include "src/widget/maskablepixmapwidget.h"
#include "src/widget/style.h"
#include "src/widget/tool/croppinglabel.h"
#include "src/widget/translator.h"

#include <QApplication>
#include <QClipboard>
#include <QDragEnterEvent>
#include <QMimeData>
#include <QPushButton>
Expand Down Expand Up @@ -431,6 +429,8 @@ void ConferenceForm::onLabelContextMenuRequested(const QPoint& localPos)
}
contextMenu->setStyleSheet(style.getStylesheet(PEER_LABEL_STYLE_SHEET_PATH, settings));

auto* copyIdAction = contextMenu->addAction(tr("copy peer ID"));

const QAction* selectedItem = contextMenu->exec(pos);
if (selectedItem == toggleMuteAction) {
if (isPeerBlocked) {
Expand All @@ -443,6 +443,12 @@ void ConferenceForm::onLabelContextMenuRequested(const QPoint& localPos)
}

settings.setBlockList(blockList);
} else if (selectedItem == copyIdAction) {
auto* clipboard = QApplication::clipboard();
clipboard->setText(peerPk.toString(), QClipboard::Clipboard);
if (clipboard->supportsSelection()) {
clipboard->setText(peerPk.toString(), QClipboard::Selection);
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions translations/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,11 @@ so you can save the file on Windows.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">إلغاء كتم الصوت</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">نسخ معرف النظير</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/be.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,11 @@ so you can save the file on Windows.</source>
<source>unmute</source>
<translation>уключаць</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">скапіяваць ID піра</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/ber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,11 @@ so you can save the file on Windows.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">ⵙⵙⵓⵙⴻⵎ</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">ⵙⵏⵓⵍⴼⵓⴷ ID ⵏ ⵓⵎⴷⴰⴽⴽⴻⵍ</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,11 @@ so you can save the file on Windows.</source>
<source>unmute</source>
<translation>отглуши</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">копиране на peer ID</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/bn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,11 @@ so you can save the file on Windows.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">নিঃশব্দ</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">পিয়ার আইডি কপি করুন</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,11 @@ takže můžete soubor uložit i v systému Windows.</translation>
<source>unmute</source>
<translation>nahlas</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">zkopírovat ID partnera</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/da.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,11 @@ så du kan gemme filen på Windows.</translation>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">slå lyden til</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">kopier peer-id</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,11 @@ um sie in Windows speichern zu können.</translation>
<source>unmute</source>
<translation>Stummschaltung aufheben</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">Peer-ID kopieren</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,11 @@ so you can save the file on Windows.</source>
<source>unmute</source>
<translation>Άρση σίγασης</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">αντιγράψτε το peer ID</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/eo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,11 @@ do vi povas konservi la dosieron en Vindozo.</translation>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">malmute</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">kopii samran ID</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,11 @@ para que puedas guardar el archivo en windows.</translation>
<source>unmute</source>
<translation>activar el sonido</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">copiar ID de compañero</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/et.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ ja sa saad seda faili nüüd Windowsis salvestada.</translation>
<source>unmute</source>
<translation>lülita heli sisse</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">kopeeri partneri ID</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/fa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,11 @@ so you can save the file on Windows.</source>
<source>unmute</source>
<translation>رفع حالت بی‌صدا</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">شناسه همتا را کپی کنید</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/fi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ joten voit tallentaa tiedoston Windowsissa.</translation>
<source>unmute</source>
<translation>poista mykistys</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">kopioi vertaistunnus</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ afin que vous puissiez enregistrer le fichier sur windows.</translation>
<source>unmute</source>
<translation>activer le son</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">copier l&apos;ID du pair</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/gl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,11 @@ para que poida gardar o ficheiro en Windows.</translation>
<source>unmute</source>
<translation>non silenciar</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">copiar o ID do compañeiro</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/he.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,11 @@ so you can save the file on Windows.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">בטל השתקה</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">העתק מזהה עמיתים</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/hr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,11 @@ tako da možete spremiti datoteku na Windows.</translation>
<source>unmute</source>
<translation>iključi zvuk</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">kopiraj peer ID</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/hu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,11 @@ so you can save the file on Windows.</source>
<source>unmute</source>
<translation>némítás kikapcsolása</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">másolja a társazonosítót</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,11 @@ svo þú getur vistað skrána á Windows.</translation>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">slökkva á hljóði</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">afrita jafningjaauðkenni</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ in modo da poter salvare il file su Windows.</translation>
<source>unmute</source>
<translation>riattivare l&apos;audio</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">copiare l&apos;ID peer</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,11 @@ Windows にファイルを保存できるようになります。</translation>
<translatorcomment>Automated translation.</translatorcomment>
<translation>ミュート解除</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">ピアIDをコピーする</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/jbo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,11 @@ e&apos;u do ka&apos;e sfaile lo nu sfaile bu&apos;u la .Windows.zoi ke&apos;a nu
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">no drata</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">fukpi sampyvla sampyvla</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/kn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,11 @@ so you can save the file on Windows.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">ಅನ್‌ಮ್ಯೂಟ್ ಮಾಡಿ</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">ಪೀರ್ ಐಡಿ ನಕಲಿಸಿ</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,11 @@ so you can save the file on Windows.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">음소거 해제</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">피어 ID 복사</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/li.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,11 @@ zodet geer ut bestand op Windows kin opsjlaon.</translation>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">oontdempe</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">kopieer peer ID</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/lt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,11 @@ tad dabar galite įrašyti failą Windows sistemoje.</translation>
<source>unmute</source>
<translation>įjungti garsą</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">nukopijuoti kolegos ID</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/lv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,11 @@ lai varētu saglabāt failus Windows operētājsistēmā.</translation>
<source>unmute</source>
<translation>ieslēgt skaņu</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">kopēt vienaudžu&#xa0;ID</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
5 changes: 5 additions & 0 deletions translations/mk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,11 @@ so you can save the file on Windows.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">вклучи звук</translation>
</message>
<message>
<source>copy peer ID</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">копирајте идентификација на врсници</translation>
</message>
</context>
<context>
<name>ConferenceInviteForm</name>
Expand Down
Loading

0 comments on commit 8cd886a

Please sign in to comment.