[PATCH] Make KDiskFreeSpace more convenient -> KJob-like usage
David Faure
faure at kde.org
Wed Jul 23 14:13:21 BST 2008
On Wednesday 23 July 2008, Sebastian TrĂ¼g wrote:
> Hi,
>
> please find attached a patch for KDiskFreeSpace. I found it to be very
> inconvenient to use. You would have to connect to two signals of a one-shot
> object. That is really not nice. So the patch transforms the usage to
> something very similar to KJob: a finished signal which has the
> KDiskFreeSpace as parameter. You then check for success and get the actual
> values from the object. Afterwards it is deleted as before.
> Oh, and it now uses byte values instead of Kib. I don't really see the reason
> there. Also, we are in KIO, so I thought KIO::filesize_t was appropriate.
Agreed up to here.
> BTW: a one-shot-object that you can create yourself? IMHO it should only
> delete itself when used through the static method.
I disagree. By default KJobs work this way too: you create them yourself and they
delete themselves automatically when done (unless you call setAutoDelete(false)).
By inheritance, KIO jobs work this way too (but ok, you don't use new for them,
you use a static method that calls new, like you did here... still if you create a custom
kjob or kio job like we did in e.g. kmail then it will also have autodelete by default).
And KRun works this way too.
> May I commit? BC is no problem, old API is marked deprecated (in documentation
> that is).
OK.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list