From fc3a0e7d792196e36879f5c23391c79a7f4cfae1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Thu, 1 Sep 2022 14:02:31 -0400
Subject: [PATCH] accessibility: add shortcuts to mute camera/mic during a call

Change-Id: Ib125fcac0620326d5864e577d9252e9ea9b3c3d9
GitLab: #788
---
 .../components/KeyboardShortcutTable.qml      |  8 +++++++
 src/app/mainview/components/MainOverlay.qml   | 23 +++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/src/app/mainview/components/KeyboardShortcutTable.qml b/src/app/mainview/components/KeyboardShortcutTable.qml
index 7c64d6b13..3ab16c042 100644
--- a/src/app/mainview/components/KeyboardShortcutTable.qml
+++ b/src/app/mainview/components/KeyboardShortcutTable.qml
@@ -151,6 +151,14 @@ Window {
             shortcut: "Ctrl + Shift + D"
             description: qsTr("Decline the call request")
         }
+        ListElement {
+            shortcut: "M"
+            description: qsTr("Mute the microphone (during a call)")
+        }
+        ListElement {
+            shortcut: "V"
+            description: qsTr("Mute the camera (during a call)")
+        }
     }
 
     Rectangle {
diff --git a/src/app/mainview/components/MainOverlay.qml b/src/app/mainview/components/MainOverlay.qml
index 08d899104..7ecedde7c 100644
--- a/src/app/mainview/components/MainOverlay.qml
+++ b/src/app/mainview/components/MainOverlay.qml
@@ -72,6 +72,29 @@ Item {
         }
     }
 
+
+    Shortcut {
+        sequence: "M"
+        enabled: root.visible
+        context: Qt.ApplicationShortcut
+        onActivated: {
+            CallAdapter.muteAudioToggle()
+            root.opacity = 1
+            fadeOutTimer.restart()
+        }
+    }
+
+    Shortcut {
+        sequence: "V"
+        enabled: root.visible
+        context: Qt.ApplicationShortcut
+        onActivated: {
+            CallAdapter.muteCameraToggle()
+            root.opacity = 1
+            fadeOutTimer.restart()
+        }
+    }
+
     // control overlay fade out.
     Timer {
         id: fadeOutTimer
-- 
GitLab