On Jan 30, 2008 11:30 PM, Sune Vuorela <[EMAIL PROTECTED]> wrote:
> Unless this hunk does it all the magic by it self, I kind of having a hard
> time figuring out why this works.
>
>                if (p.exists() && p.open(IO_ReadOnly)) {
> +                       QTextStream stream(&p);
>                        QString l;
> -                       p.readLine(l,500);
> +                       l = stream.readLine();
>                        QStringList ll = QStringList::split(' ',l,false);
>                        for (QValueListIterator<QString> i = ll.begin();
> i!=ll.end(); i++) {
>
> Someone, please enlighten me ;)

I believe that the fix comes from the fact that QTextStream::readLine
strips the trailing newline from the end of the line, while
QFile::readLine() does not. The disk state is at the end of the line
in /sys/power/state and so the newline gets attached to it and it
cannot be recognized.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to