network dataengine in kdereview

Alex Merry kde at randomguy3.me.uk
Mon Aug 25 12:02:12 CEST 2008


On Monday 25 August 2008 08:14:19 Gerhard Gappmeier wrote:
> If noticed that readNumberFromFile() and readStringFromFile() are using
> fopen to access the file.
> 1.) For passing the filename as character string, it uses
> QString::toLatin1()
> This will not work if the filename has any special characters that don't
> fit into the local character set.
> QString::toLocal8Bit() would do that job.

It should be QFile::encodeName(), since it is possible the filesystem uses a 
different encoding than the application.

> 2.) Why using fopen at all? I think using QFile would be more consistent
> to the rest of the Qt code.
> But this would be more cosmetic change, becasue fopen should be portable
> too.

QFile would generally be better because it takes care of things like closing 
it once you are done with it (ie: the QFile goes out of scope).

Alex


-- 
Proud KDE hacker: http://www.kde.org
Get KDE 4.1 - out now!
Arch Linux: perfect for geeks like me - http://www.archlinux.org
OpenSUSE: just works - http://www.opensuse.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080825/566c3ac5/attachment.sig 


More information about the Plasma-devel mailing list