feat(options): offer the file association in Options
Registering as the .dwg/.dxf handler was reachable only by typing FILEASSOC, which is also the only thing that installs the icons the desktop shows — so a user with no reason to know the command had no way to arrive at either. The checkbox makes the same two calls the command does, so the stored setting and the actual registration cannot drift apart. A registration the system refuses puts the checkbox back rather than leaving it showing a state that is not true. The line under it says the icons come with it, since that is what sends people looking for this in the first place. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
7c8271c716
commit
26b4f29a13
4 changed files with 54 additions and 0 deletions
|
|
@ -5087,6 +5087,39 @@ impl OpenCADStudio {
|
|||
Task::none()
|
||||
}
|
||||
|
||||
Message::FileAssocChanged(enabled) => {
|
||||
// The same two calls FILEASSOC makes, so the checkbox and the
|
||||
// command cannot leave the setting and the registration
|
||||
// disagreeing.
|
||||
self.file_assoc_enabled = enabled;
|
||||
self.persist_settings_if_changed();
|
||||
let outcome = if enabled {
|
||||
crate::io::file_association::register_as_handler()
|
||||
} else {
|
||||
crate::io::file_association::unregister_handler()
|
||||
};
|
||||
match outcome {
|
||||
Ok(()) => {
|
||||
let said = if enabled {
|
||||
crate::t!("Registered as a .dwg/.dxf handler.")
|
||||
} else {
|
||||
crate::t!("No longer registered as a file handler.")
|
||||
};
|
||||
self.command_line.push_output(said.as_ref());
|
||||
}
|
||||
Err(why) => {
|
||||
// The setting is what the user asked for; the
|
||||
// registration is what the system allowed. Put the
|
||||
// checkbox back rather than showing a state that is not
|
||||
// true.
|
||||
self.file_assoc_enabled = !enabled;
|
||||
self.persist_settings_if_changed();
|
||||
self.command_line
|
||||
.push_error(crate::tf!("File association failed: {why}").as_ref());
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::LanguageChanged(language) => {
|
||||
if self.language == language {
|
||||
return Task::none();
|
||||
|
|
|
|||
Loading…
Reference in a new issue