[PATCH] Make KDiskFreeSpace more convenient -> KJob-like usage

Sebastian Trüg strueg at mandriva.com
Thu Jul 24 22:03:06 BST 2008


David and I had a rather long discussion about this issue and we came up with 
a solution. IMHO the most clean one. So please agree with us so I can 
commit. ;)

The attached patch reverts my previous patch and marks the whole 
KDiskFreeSpace class deprecated (although that would not link here so I 
marked the methods).
A new class takes its place that works 100% sync and has a rather nice API.

May I commit?

Cheers,
Sebastian

On Thursday 24 July 2008 20:31:50 Alex Merry wrote:
> On Thursday 24 July 2008 08:07:22 Sebastian Trüg wrote:
> > bool KIO::freeDiskSpace( const QString& path, KIO::filesize_t* avail,
> > KIO::filesize_t* size = 0 )
> >
> > would that be OK? And if so, should I revert the previous patch?
>
> Personally, I think it looks odd having a function named freeDiskSpace not
> returning the data, but passing it out in pointers-to-ints.  But I'm not
> sure how to get around that, since you want to set several values at once,
> and having it return one but not the others would create a strange
> asymmetry.
>
> Would splitting it into two functions (freeDiskSpace and totalDiskSpace,
> say) have a significant impact on performance?  I mean, is it worth the
> extra time cost to have a more natural API, especially as it would probably
> still involve passing a pointer to a bool to check it worked, since
> filesize_t is unsigned?
>
> Other than that, I think that "size" would be better named "total" and
> "avail" should be either "available" or "free".
>
> Alex


-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdiskfreespace.diff
Type: text/x-diff
Size: 18107 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080724/aefc56e2/attachment.diff>


More information about the kde-core-devel mailing list