KcoreAddons

Oswald Buddenhagen ossi at kde.org
Thu Oct 20 18:00:58 UTC 2011


On Thu, Oct 20, 2011 at 05:03:24PM +0200, David Faure wrote:
> On Sunday 16 October 2011 13:37:48 Oswald Buddenhagen wrote:
> > but one can get a nice api by inverting ownership: pass the SaveFile
> > object to a KBackup::commitWithBackup() call.

> > i'd still like to have QSaveFile::commitWithBackup() for simple
> > backups, too.
> 
> You mean, in order to have other features in KBackup, but still offer
> simple backup there as well?
> 
yeah, that's the idea.
it wouldn't make any sense if KBackup was in QtCore, but that seems a
bit unlikely (it contains a bit too much esoteric functionality for my
taste, and it relies on platform stuff).

> > another thing related to file saving: FileUtils::FileSaver. this
> > drastically minimizes the write error checking boilerplate code and thus
> > makes it at least somewhat likely that people will actually check for
> > errors (correctly). however, i'm not entirely satisfied with the api -
> > it looks messy. in particular, the setResult() functions should be in
> > the various (stream) classes, which by extension need to provide
> > FileSaver-aware api. but that would bloat the apis and make them
> > confusing. so maybe filesaver should be just folded into qfile? how to
> > activate that mode? setLatchErrors(bool)?
> 
> OK, found it in qtcreator's fileutils.cpp
> I'll have to look further into it, but if the whole point is to "remember that 
> there was an error while writing", can't QFile do that?
>
that's what setLatchErrors() would be about. ;)
it would also change some other behavior - e.g., a truncated write needs
to be recorded as an error, too.

> And then SaveFile can ask the QFile about it when finalizing.
> 
that's the idea :)


More information about the Kde-frameworks-devel mailing list