Today I wrote the rest of the Edit Raw POL dialog. It now supports multi-line strings, forgetting, and deletion. Using the Delete Value(s) button on a value instantly converts it to an explicit "delete this value." Using it on a key brings up a dialog with a choice of deleting everything in the key, adding an instruction to clear the key of other values, and explicitly deleting a single value by name.
That middle one was tough. I had previously assumed that a dictionary kept its keys in the order of insertion, and it usually does, but when the same key is deleted and then re-added, it keeps its place instead of going to the end of the line. Order of application matters because it's possible for a policy to clear a key and then put values in it - lists can do this. I switched to a sorted dictionary for keeping track of the POL entries, which works because **del sorts before normal value names and so will be correctly applied first.
Then I finally decided I'd had enough of the list view's scroll bar jumping all around due to my previous update logic. There isn't really a convenient way of making a list view scroll to a specific location, so I can't recall and then restore that. There is a TopItem property, but it's somewhat buggy and at least for me doesn't always do anything, but it's better than nothing, so I'm going with that.
I also noticed today that policies adding values directly on the Policies key were incorrectly treated as preferences. That's fixed now.
No comments:
Post a Comment