From 2215d51f9888dc92ca029c878fde4508ef9a86dd Mon Sep 17 00:00:00 2001
From: cberthet <capucine.berthet@savoirfairelinux.com>
Date: Thu, 21 Dec 2023 14:59:20 -0500
Subject: [PATCH] disable video and photo capture when no webcam is detected

GitLab: #1470
Change-Id: I266667d1ffe53b3839dfb3327db01cfda331c71f
---
 src/app/commoncomponents/PhotoboothPopup.qml | 3 +++
 src/app/commoncomponents/ShareMenu.qml       | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/src/app/commoncomponents/PhotoboothPopup.qml b/src/app/commoncomponents/PhotoboothPopup.qml
index eb66fe3ca..57be2bd67 100644
--- a/src/app/commoncomponents/PhotoboothPopup.qml
+++ b/src/app/commoncomponents/PhotoboothPopup.qml
@@ -96,6 +96,9 @@ BaseModalDialog {
                 height: buttonSize
                 width: buttonSize
 
+                enabled: VideoDevices.listSize !== 0
+                hoverEnabled: enabled
+
                 normalColor: "transparent"
                 imageColor: hovered ? JamiTheme.textColor : JamiTheme.buttonTintedGreyHovered
                 toolTipText: JamiStrings.takePhoto
diff --git a/src/app/commoncomponents/ShareMenu.qml b/src/app/commoncomponents/ShareMenu.qml
index 59721d54f..396e30861 100644
--- a/src/app/commoncomponents/ShareMenu.qml
+++ b/src/app/commoncomponents/ShareMenu.qml
@@ -16,6 +16,8 @@
  */
 import QtQuick
 import net.jami.Constants 1.1
+import net.jami.Adapters 1.1
+
 import "contextmenu"
 
 BaseContextMenu {
@@ -43,6 +45,8 @@ BaseContextMenu {
             iconSource: JamiResources.message_video_black_24dp_svg
             itemName: JamiStrings.leaveVideoMessage
 
+            isActif: VideoDevices.listSize !== 0
+
             onClicked: {
                 root.videoRecordMessageButtonClicked();
             }
-- 
GitLab