Skip to content

Add a context menu and multi-select to the contacts list - #31301

Open
meh7an wants to merge 1 commit into
telegramdesktop:devfrom
meh7an:feature/contacts-context-menu
Open

Add a context menu and multi-select to the contacts list#31301
meh7an wants to merge 1 commit into
telegramdesktop:devfrom
meh7an:feature/contacts-context-menu

Conversation

@meh7an

@meh7an meh7an commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Adds a context menu to contacts in the Contacts box, similar to the contact actions in the mobile apps, and a selection mode to delete several contacts at once.

Right-clicking a contact shows:

  • Send message opens the chat.
  • Call starts a voice call. It follows the rules of the call button in the chat top bar, so it isn't shown for bots, service accounts such as Telegram notifications, support accounts, deleted accounts, or users whose calls are disabled.
  • Select starts selecting contacts.
  • Delete contact asks for confirmation and deletes the contact while keeping the Contacts box open.

Secret chats and video calls from the mobile menu are not included: the desktop app has no secret chats, and video can be turned on from the call panel. Starting a call from the menu uses Ui::PreventDelayedActivation(), so the main window isn't activated over the call panel when the menu closes.

Selection works like choosing several recipients in the forward box. After the first contact is selected, clicking other contacts toggles them, the box title shows how many are selected, and the buttons change to Delete and Cancel. Delete asks for confirmation and removes all selected contacts with a single contacts.deleteContacts request. Global search results in the box are not contacts, so they only get Send message and Call.

The list shows story outlines by reusing each row's checkbox: PeerListStories checks rows with active stories and draws their segments. Because of that, the box keeps the selection itself instead of using the rows' checked state. Selected rows draw the same round check over the userpic as other peer lists, and PeerListStories::setRowSelected() shows the regular selection outline for a selected row and ignores story updates for it until it is deselected, when its story outline is restored. ContactsBoxController::setRowSelected() forwards to it, or just checks the row when stories aren't shown.

The contacts list was built once when contacts loaded, so a deleted contact stayed in the open box. The box now listens for contact status updates and removes rows of users that are no longer contacts.

Testing

Built and tested on macOS (Debug):

  • Send message opens the chat, and Call starts a call with the call panel in front of the main window.
  • Call isn't shown for the Telegram notifications account.
  • Delete contact from the menu removes the contact from the list and keeps the box open.
  • Selecting contacts shows the check on their userpics and the selected count in the title. Cancel clears the selection, and Delete removes all selected contacts from the list.
  • For contacts with active stories, the menu is shown, selecting replaces the story outline with the selection outline, and deselecting restores it. With nothing selected, clicking a contact still opens the chat, or the stories when clicking the userpic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant