IOUtils: copy and grep are now more consistent and wait before writing

Previously the API was inconsistent with itself and with most Qt APIs
(by using a mix of references and pointers) and copy() and grep()
methods did not wait for empty room in destination QIODevice, leading
to huge memory consumption when destination is slower than source (e.g.
when serving a local file to a network socket).