Add OperationList to keep track of Operations
The code in Contacts.MainWindow
that has dealt with operations is
problematic in several ways:
- It only kept track of the last operation, and didn't do that well either as it could easily be overwritten
- Due to
Contacts.DeleteOperation
being irreversible, it needed special (and buggy) workarounds - It repeated code for dealing with operations several times, which lead to copy-paste bugs.
This commit tries to fix that by introducing a Contacts.OperationList
object, which acts as a container and wrapper API for
Contacts.Operation
s. The most prominent extra API it provides, is that
of postponing execution with a timeout, and being able to cancel ongoing
operations. Both of these APIs allow us to remove any special-casing we
had to do for delete operations.
It also adds a flush
API, which we can later use to prevent the
application from completely quitting before all operations have
finished executing.