PICARD-2076: Show a warning when enabling windows long paths

This commit is contained in:
Philipp Wolfer
2022-03-08 08:43:28 +01:00
parent cde45dc7c1
commit 5c84b1a288

View File

@@ -202,6 +202,20 @@ class RenamingOptionsPage(OptionsPage):
if not IS_WIN:
self.ui.windows_compatibility.setEnabled(active)
def toggle_windows_long_paths(self, state):
if state and not system_supports_long_paths():
dialog = QtWidgets.QMessageBox(
QtWidgets.QMessageBox.Icon.Information,
_('Windows long path support'),
_(
'Enabling long paths on Windows might cause files being saved with path names '
'exceeding the 259 character limit traditionally imposed by the Windows API. '
'Some software might not be able to properly access those files.'
),
QtWidgets.QMessageBox.StandardButton.Ok,
self)
dialog.exec_()
def save_from_editor(self):
self.script_text = self.script_editor_dialog.get_script()
self.update_selector_from_editor()
@@ -238,6 +252,10 @@ class RenamingOptionsPage(OptionsPage):
def load(self):
config = get_config()
try:
self.ui.windows_long_paths.toggled.disconnect(self.toggle_windows_long_paths)
except TypeError:
pass
if IS_WIN:
self.ui.windows_compatibility.setChecked(True)
self.ui.windows_compatibility.setEnabled(False)
@@ -259,6 +277,7 @@ class RenamingOptionsPage(OptionsPage):
else:
self.update_selector_from_settings()
self.update_examples_from_local()
self.ui.windows_long_paths.toggled.connect(self.toggle_windows_long_paths)
def check(self):
self.check_format()