[Kde-pim] mbox resource

Daniel Vrátil dvratil at redhat.com
Tue Feb 4 14:51:39 GMT 2014


On Monday 03 of February 2014 21:11:37 Martin Koller wrote:
> Hi,
> 
> I'm debugging the mbox resource and find a strange thing.
> When I append a new message from the shell (simulating an external program
> appending a new message) then SingleFileResourceBase::fileChanged() gets
> called which in turn lands in MboxResource::writeToFile().
> There the given filename is a temporary file, e.g.
> /home/kdetrunk/.kde4/share/apps/akonadi_mbox_resource_0/mbox-1
> to which the whole current mbox file is copied via mMBox->save( fileName )
> 
> But then follows something I do not understand.
> The comment in this file says something like
> "... Therefore we
>   // copy the original file and append pending changes to it but also add an
> extra // '\n' to make sure that the hashes differ and the user gets
> notified. ..."
> 
> But in fact it destroys what it has just written via
>     QFile file( fileName );
>     file.open( QIODevice::WriteOnly );
>     file.seek( file.size() );
>     file.write( "\n" );
> 
> QIODevice::WriteOnly is not QIODevice::WriteOnly|QIODevice::Append even with
> the seek() so I assume that this is simply a bug, right ?

Hi,

I haven't checked the code, but I think that WriteOnly + seek(file.size()) is 
equal to Append, so this should be just fine.

Dan

> 
> (but as I do not really understand what the comment shall tell me, maybe I'm
> wrong and this does not matter ...)
> 
> Anybody can tell me if I'm wrong ?

-- 
Daniel Vrátil
KDE Desktop Team
Associate Software Engineer, Red Hat, Inc.

GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20140204/2f48fced/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list