Add guard ensuring that we don't return invalid -last UI event action- IDs
Fix problem where the last UI event action was not set
Move handling of user event actions to QWebPage

Some low-level events spawned multiple events within the event handler (e.g. mouse raise and copy events). By handling user events at the QWebPage level its easier to combine these together into one single event action.