From 113cd7eb4b7cc2623c7f12c8ad8782ec0bca321c Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 1 Sep 2019 21:22:59 -0700 Subject: [PATCH] Remove the "Allow downloading individual files" setting altogether, and make it just automatically enabled if "Stop sharing..." is disabled --- onionshare/settings.py | 1 - onionshare/web/share_mode.py | 5 ++--- onionshare_gui/settings_dialog.py | 26 -------------------------- share/locale/en.json | 1 - tests/GuiShareTest.py | 4 ++-- tests/test_onionshare_settings.py | 1 - 6 files changed, 4 insertions(+), 34 deletions(-) diff --git a/onionshare/settings.py b/onionshare/settings.py index d76e4855..762c6dc2 100644 --- a/onionshare/settings.py +++ b/onionshare/settings.py @@ -98,7 +98,6 @@ class Settings(object): 'auth_type': 'no_auth', 'auth_password': '', 'close_after_first_download': True, - 'share_allow_downloading_individual_files': True, 'autostop_timer': False, 'autostart_timer': False, 'use_stealth': False, diff --git a/onionshare/web/share_mode.py b/onionshare/web/share_mode.py index c3066a03..b478fbd4 100644 --- a/onionshare/web/share_mode.py +++ b/onionshare/web/share_mode.py @@ -16,9 +16,8 @@ class ShareModeWeb(SendBaseModeWeb): """ def init(self): self.common.log('ShareModeWeb', 'init') - # If "Stop sharing after files have been sent" is unchecked and "Allow downloading of individual files" is checked - self.download_individual_files = not self.common.settings.get('close_after_first_download') \ - and self.common.settings.get('share_allow_downloading_individual_files') + # Allow downloading individual files if "Stop sharing after files have been sent" is unchecked + self.download_individual_files = not self.common.settings.get('close_after_first_download') def define_routes(self): """ diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py index cabddc9b..6ffd4523 100644 --- a/onionshare_gui/settings_dialog.py +++ b/onionshare_gui/settings_dialog.py @@ -204,17 +204,10 @@ class SettingsDialog(QtWidgets.QDialog): self.close_after_first_download_checkbox = QtWidgets.QCheckBox() self.close_after_first_download_checkbox.setCheckState(QtCore.Qt.Checked) self.close_after_first_download_checkbox.setText(strings._("gui_settings_close_after_first_download_option")) - self.close_after_first_download_checkbox.toggled.connect(self.close_after_first_download_toggled) - - # Close after first download - self.allow_downloading_individual_files_checkbox = QtWidgets.QCheckBox() - self.allow_downloading_individual_files_checkbox.setCheckState(QtCore.Qt.Checked) - self.allow_downloading_individual_files_checkbox.setText(strings._("gui_settings_allow_downloading_individual_files_option")) # Sharing options layout sharing_group_layout = QtWidgets.QVBoxLayout() sharing_group_layout.addWidget(self.close_after_first_download_checkbox) - sharing_group_layout.addWidget(self.allow_downloading_individual_files_checkbox) sharing_group = QtWidgets.QGroupBox(strings._("gui_settings_sharing_label")) sharing_group.setLayout(sharing_group_layout) @@ -510,16 +503,8 @@ class SettingsDialog(QtWidgets.QDialog): close_after_first_download = self.old_settings.get('close_after_first_download') if close_after_first_download: self.close_after_first_download_checkbox.setCheckState(QtCore.Qt.Checked) - self.allow_downloading_individual_files_checkbox.setEnabled(False) else: self.close_after_first_download_checkbox.setCheckState(QtCore.Qt.Unchecked) - self.allow_downloading_individual_files_checkbox.setEnabled(True) - - allow_downloading_individual_files = self.old_settings.get('share_allow_downloading_individual_files') - if allow_downloading_individual_files: - self.allow_downloading_individual_files_checkbox.setCheckState(QtCore.Qt.Checked) - else: - self.allow_downloading_individual_files_checkbox.setCheckState(QtCore.Qt.Unchecked) autostart_timer = self.old_settings.get('autostart_timer') if autostart_timer: @@ -644,16 +629,6 @@ class SettingsDialog(QtWidgets.QDialog): self.connect_to_tor_label.show() self.onion_settings_widget.hide() - def close_after_first_download_toggled(self, checked): - """ - Stop sharing after files have been sent was toggled. If checked, disable allow downloading of individual files. - """ - self.common.log('SettingsDialog', 'close_after_first_download_toggled') - if checked: - self.allow_downloading_individual_files_checkbox.setEnabled(False) - else: - self.allow_downloading_individual_files_checkbox.setEnabled(True) - def connection_type_bundled_toggled(self, checked): """ Connection type bundled was toggled. If checked, hide authentication fields. @@ -980,7 +955,6 @@ class SettingsDialog(QtWidgets.QDialog): settings.load() # To get the last update timestamp settings.set('close_after_first_download', self.close_after_first_download_checkbox.isChecked()) - settings.set('share_allow_downloading_individual_files', self.allow_downloading_individual_files_checkbox.isChecked()) settings.set('autostart_timer', self.autostart_timer_checkbox.isChecked()) settings.set('autostop_timer', self.autostop_timer_checkbox.isChecked()) diff --git a/share/locale/en.json b/share/locale/en.json index 23f4dd14..2063a415 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -52,7 +52,6 @@ "gui_settings_onion_label": "Onion settings", "gui_settings_sharing_label": "Sharing settings", "gui_settings_close_after_first_download_option": "Stop sharing after files have been sent", - "gui_settings_allow_downloading_individual_files_option": "Allow downloading of individual files", "gui_settings_connection_type_label": "How should OnionShare connect to Tor?", "gui_settings_connection_type_bundled_option": "Use the Tor version built into OnionShare", "gui_settings_connection_type_automatic_option": "Attempt auto-configuration with Tor Browser", diff --git a/tests/GuiShareTest.py b/tests/GuiShareTest.py index 64e57b9f..70ae43fd 100644 --- a/tests/GuiShareTest.py +++ b/tests/GuiShareTest.py @@ -44,7 +44,7 @@ class GuiShareTest(GuiBaseTest): self.file_selection_widget_has_files(0) - def file_selection_widget_readd_files(self): + def file_selection_widget_read_files(self): '''Re-add some files to the list so we can share''' self.gui.share_mode.server_status.file_selection.file_list.add_file('/etc/hosts') self.gui.share_mode.server_status.file_selection.file_list.add_file('/tmp/test.txt') @@ -117,7 +117,7 @@ class GuiShareTest(GuiBaseTest): self.history_is_visible(self.gui.share_mode) self.deleting_all_files_hides_delete_button() self.add_a_file_and_delete_using_its_delete_widget() - self.file_selection_widget_readd_files() + self.file_selection_widget_read_files() def run_all_share_mode_started_tests(self, public_mode, startup_time=2000): diff --git a/tests/test_onionshare_settings.py b/tests/test_onionshare_settings.py index 54c09686..05878899 100644 --- a/tests/test_onionshare_settings.py +++ b/tests/test_onionshare_settings.py @@ -51,7 +51,6 @@ class TestSettings: 'auth_type': 'no_auth', 'auth_password': '', 'close_after_first_download': True, - 'share_allow_downloading_individual_files': True, 'autostop_timer': False, 'autostart_timer': False, 'use_stealth': False,