KcoreAddons
Oswald Buddenhagen
ossi at kde.org
Sun Oct 16 11:37:48 UTC 2011
On Sun, Oct 16, 2011 at 10:31:57AM +0200, David Faure wrote:
> On Saturday 15 October 2011 15:46:08 Oswald Buddenhagen wrote:
> > On Fri, Oct 14, 2011 at 02:33:30PM +0200, David Faure wrote:
> > > On Wednesday 28 September 2011 20:00:49 Romain Perier wrote:
> > > > Ok, I will create a kbackups.{h,cpp} with a KDE5 TODO for now, we will
> > > > move it up with kconfig later.
> > >
> > > Great.
> >
> > how is the split supposed to work? kbackups needs to be used by
> > ksavefile to be useful in any way, so you don't get rid of the
> > dependency.
>
> No, KSaveFile has never called the backups methods, the application has to do
> that.
>
hmm, right.
> This makes sense, you don't really want -every- file being saved (e.g.
> kconfig files, xmlgui files, bookmarks etc. etc.) to have 10 numbered backups
> if the user enables that. This is usually only done for actual documents.
>
well, in my SaveFile class there is a bool property to enable (simple)
backups. if the commit fails, it will rollback the backup, too.
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.
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)?
More information about the Kde-frameworks-devel
mailing list