[commhistory-daemon] Fix EventModel::eventsCommitted() handling

Qt::QueuedConnection is needed.

(Most probably) this is broken since libcommhistory commits
579ed607531d348747535b803c59082c97503895 (Fix id of returned event from
DatabaseIO::addEvent) and 33dbd0785e5555197448856c611766db5bb8962f (Emit
eventsCommitted signals after modifying an EventModel). Before these
commits EventModel::eventsCommitted() was only emitted *after*
EventModel::addEvents() and similar calls returned. After these commits
the EventModel::eventsCommitted() signal is possibly emitted before
EventModel::addEvents() and similar calls return.

Without QueuedConnection it breaks in
TextChannelListener::handleMessages() around lines 875 and 893 where
addEvents() and modifyEventsInGroup() are called.

The former one explained:

    if (!addEvents.isEmpty()) {
        if (eventModel().addEvents(addEvents)) {
            processedMessages << addMessages;
            foreach (CommHistory::Event e, addEvents)
                m_EventTokens.insertMulti(e.id(), e.messageToken());
        } else {
            qWarning() << "Adding events failed";
        }
    }

Here m_EventTokens is modified only after addEvents() returns -> if the
eventsCommitted() signal is emitted already during the addEvent() call,
it then fails to find the event id in m_EventTokens inside
slotEventsCommitted() at line 1724.
ut_textchannellistener: Fix EventModel::eventsCommitted() handling

(Most probably) this is broken since libcommhistory commits
579ed607531d348747535b803c59082c97503895 (Fix id of returned event from
DatabaseIO::addEvent) and 33dbd0785e5555197448856c611766db5bb8962f (Emit
eventsCommitted signals after modifying an EventModel). Before these
commits EventModel::eventsCommitted() was only emitted *after*
EventModel::addEvents() and similar calls returned. After these commits
the EventModel::eventsCommitted() signal is possibly emitted before
EventModel::addEvents() and similar calls return.
ut_textchannellistener: Wait to let expunging run off the loop

QCoreApplication::processEvents() is not enough here.
tests: Cleanup created events upon exit
Merge pull request #36 from martyone/master

Fix one bug + fix tests.