Settings Error icon behaviour

Description

If you have listed some files in the "...plausible deniability" settings that you then delete are re-shown when eraser is restarted.

Steps to reproduce

Add files to "...plausible deniability" list.

Save Settings

Close Eraser

re-start Eraser.

Select and remove all files in "...plausible deniability" area

Save Settings

Close Eraser

re-start Eraser.

If will now see that the files reappear.

Also when you have removed all files you get the "flashing" warning information icon, but when you add a new file to this list the icon is still there saying that they are no files even when you have listed new ones. It only goes away when you have hit the "Save settings" button.

Well, you're seeing this because when the Save Settings call failed with the error icon the settings will not be saved, since the settings were not saved, the old files remain on the list.

I don't see how multiple instances of the same file will affect the behaviour, but it definitely will cause the file with the highest number of occurrences to be picked more often as a decoy file.

As for the icon being permanent until Save Settings is clicked, that's by design since Saving the settings will be committing the changes to the system. Unless you have an alternative as to how the error icon be shown?

The alternative I am aware of will be to validate each control on the page (using the validating and validate events) and showing the error icon when the validating event is called and removing it when the validate event is triggered. Would this be a better idea?

So there's a bug in the "Save Settings" button then didn't clear out the entries?

Perhaps some logic needs to be added so that a check is done to see if the filename already exists in the list and if so then generate error.

You can add some extra code on the "Add file", "Add Folder" and "Remove" buttons so that at the end a check is done to see how many files exist in the list (UI control, not in the registry). If none then display the error icon, otherwise hide it. As far as I can see then this is the only control with an error icon being display on the "settings" page.

before the foreach there should be a plausibleDeniabilityFilesList.Clear(); call so that deleted items are deleted. See r1517.

Your patch would move the error icon code from the Save button to the plausible deniability enable/disable handler. Wouldn't this cause the error handling for the plausible deniability code to be separate from the rest of the handlers? More error conditions can be triggered: when the Default PRNGs and Erasure methods are missing/not loaded, when an invalid UI language is selected (try setting in the registry)

My patch has copied the error handling from the save button function that's all. Different people code different ways, some put checking on functions whilst others put it all in 1x place. I prefer to put checking on the functions.

Another way to do this is to have a separate function that handles all of the error handling and you call this from what ever other function you wish to perform validation from. This function would have 1x input parameter which would be either the specific validation to do or a global "all" to check everything, such as: