[Kmymoney-devel] .xml save not working

Alvaro Soliverez asoliverez at gmail.com
Fri Oct 9 22:09:45 CEST 2009


On Fri, Oct 9, 2009 at 5:08 AM, Cristian Oneţ <onet.cristian at gmail.com>wrote:

> On Fri, Oct 9, 2009 at 8:36 AM, Thomas Baumgart <thb at net-bembel.de> wrote:
> > Hi,
> >
> > on Thursday 08 October 2009 Cristian Oneţ wrote:
> >
> >
> >> În data de Miercuri 30 Septembrie 2009 06:02:47 Alvaro Soliverez a
> scris:
> >> > Hello all,
> >> > just so you know, using a format with .xml extension results in the
> Save
> >> > command not working.
> >> > When you hit save, it seems to work, but if you close and reopen the
> >> > file, nothing has been done.
> >> > I'm not sure I will have time to look at it soon, so if anybody wants
> to
> >> > jump in, you are welcome.
> >> >
> >> > Regards,
> >> > Alvaro
> >>
> >> I found out so far that the problem is that the KSaveFile is not opened
> >>  when saving as xml and the file already exists. This causes the save
> >>  opration to fail. A good place to open the file would be
> >>  KMyMoneyView::saveFile (do it always) but that seems to brake saving as
> >>  kmy file. So I'll have to investigate a bit further but if these
> >>  observations give a clue to those of us who know the application better
> >>  and they can fix this faster, please do that ;).
> >
> > take a look at kmymoneyview.cpp lines 1127 .. 1163 and compare them
> against
> > the KDE3 version. You can clearly see, that the file is not opened if it
> > exists:
> >
> >      if(fi.exists()) {
> >        fmode |= fi.permission(QFile::ReadGroup) ? 040 : 0;
> >        fmode |= fi.permission(QFile::WriteGroup) ? 020 : 0;
> >        fmode |= fi.permission(QFile::ReadOther) ? 004 : 0;
> >        fmode |= fi.permission(QFile::WriteOther) ? 002 : 0;
> >        if(fi.groupId() != static_cast<uint>(-2))
> >          gid = fi.groupId();
> >      } else {
> >        qfile.open();
> >      }
> >
> > This is completely different in the KDE3 version. The trick with the
> basic
> > block and the automatic deletion of the KSaveFile object as done in KDE3
> does
> > not work here anymore. One might use the KSaveFile::finalize() method to
> close
> > the file to be able to change the owner of it.
> >
> > If you don't think you can fix this yourself, please let me know and I'll
> take
> > a look at it next week. Won't have time before.
> Now I get it. So this was messed up during the 'make it compile on
> KDE4' phase. When encountering such problems I always check the KDE3
> version to spot possible problems in the differences. I don't know how
> I missed this difference, thanks for pointing this out this is the
> kind of hint I expected to get after my previous mail :).
>
>
Ok, so there is some karma in this bug, because it was me porting that part
of code, and I got bitten by it. :)

I remember adding the qfile.open() because if the file does not exist, the
subsequent calls wouldn't open automatically like in Qt3.

Why is it that this fails with .xml files, but not with .kmy files?

Regards,
Alvaro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kmymoney-devel/attachments/20091009/34bbeb2b/attachment.htm 


More information about the KMyMoney-devel mailing list