Home GnuPG

Try hard to keep the currently selected key/item if the model changes

Description

Try hard to keep the currently selected key/item if the model changes

This ensures that the selection does not change for example after
setting the owner trust of the currently selected key.

  • Store the current selection if an imminent model change is announced
  • Restore (if possible) the selection after the model change
  • Tell the model to use the key cache and remove the custom "Loading keys" item only after the initial key listing.
  • Select the default key only after the initial key listing.
  • In setCurrentKey() look up the key by fingerprint instead of by the key object because the latter fails if the key was updated.
  • In setCurrentKey() fall back to selecting the default key if the given key isn't found and selectPerfectIdMatch() also fails.
  • Add removeCustomItem() (currently only used in the test).