From add88ef21596a43bc0c2f60d051366ef3dffb73c Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Tue, 17 Oct 2023 09:39:06 +1100 Subject: [PATCH] Prevent disabling files as well as text (or vice versa) in receive mode --- desktop/onionshare/gui_common.py | 4 ++++ desktop/onionshare/tab/mode/receive_mode/__init__.py | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/desktop/onionshare/gui_common.py b/desktop/onionshare/gui_common.py index e3d712f5..fcbf47f7 100644 --- a/desktop/onionshare/gui_common.py +++ b/desktop/onionshare/gui_common.py @@ -471,6 +471,10 @@ class GuiCommon: QPushButton { padding: 5px 10px; }""", + "receive_options": """ + QCheckBox:disabled { + color: #666666; + }""", # Tor Settings dialogs "tor_settings_error": """ QLabel { diff --git a/desktop/onionshare/tab/mode/receive_mode/__init__.py b/desktop/onionshare/tab/mode/receive_mode/__init__.py index 87f8fc5f..bfa85459 100644 --- a/desktop/onionshare/tab/mode/receive_mode/__init__.py +++ b/desktop/onionshare/tab/mode/receive_mode/__init__.py @@ -85,12 +85,14 @@ class ReceiveMode(Mode): self.disable_text_checkbox.setText( strings._("mode_settings_receive_disable_text_checkbox") ) + self.disable_text_checkbox.setStyleSheet(self.common.gui.css["receive_options"]) self.disable_files_checkbox = self.settings.get("receive", "disable_files") self.disable_files_checkbox = QtWidgets.QCheckBox() self.disable_files_checkbox.clicked.connect(self.disable_files_checkbox_clicked) self.disable_files_checkbox.setText( strings._("mode_settings_receive_disable_files_checkbox") ) + self.disable_files_checkbox.setStyleSheet(self.common.gui.css["receive_options"]) disable_layout = QtWidgets.QHBoxLayout() disable_layout.addWidget(self.disable_text_checkbox) disable_layout.addWidget(self.disable_files_checkbox) @@ -235,11 +237,21 @@ class ReceiveMode(Mode): self.settings.set( "receive", "disable_text", self.disable_text_checkbox.isChecked() ) + if self.disable_text_checkbox.isChecked(): + # Prevent also disabling files if text is disabled + self.disable_files_checkbox.setDisabled(True) + else: + self.disable_files_checkbox.setDisabled(False) def disable_files_checkbox_clicked(self): self.settings.set( "receive", "disable_files", self.disable_files_checkbox.isChecked() ) + if self.disable_files_checkbox.isChecked(): + # Prevent also disabling text if files is disabled + self.disable_text_checkbox.setDisabled(True) + else: + self.disable_text_checkbox.setDisabled(False) def webhook_url_checkbox_clicked(self): if self.webhook_url_checkbox.isChecked():