Add test for CollectionScheduler, code cleanups, bugfixes.

Authored by dfaure on Apr 7 2019, 4:55 PM.

Description

Add test for CollectionScheduler, code cleanups, bugfixes.

Summary:
Wrote a unittest just for fun. Found lots of interesting things...

  • Methods called in the wrong thread, leading to QTimer warnings
  • Unscheduling all collections with the same "next time" when one collection is removed
  • for() loops with if+return, where find_if() is much more readable
  • Unnecessary detaching (non-const lowerBound)
  • All this will break in 2038 (32 bit time in seconds), will fix in next commit

Test Plan: bin/collectionschedulertest

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: kde-pim

Tags: KDE PIM

Differential Revision: https://phabricator.kde.org/D20362