Prevent disabling files as well as text (or vice versa) in receive mode

This commit is contained in:
Miguel Jacq 2023-10-17 09:39:06 +11:00
parent 7c11266107
commit add88ef215
No known key found for this signature in database
GPG Key ID: 59B3F0C24135C6A9
2 changed files with 16 additions and 0 deletions

View File

@ -471,6 +471,10 @@ class GuiCommon:
QPushButton {
padding: 5px 10px;
}""",
"receive_options": """
QCheckBox:disabled {
color: #666666;
}""",
# Tor Settings dialogs
"tor_settings_error": """
QLabel {

View File

@ -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():