[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#444500: klaptopdaemon: "Hibernate" menu items missing with 2.6.22 and later kernels



On Jan 30, 2008 11:30 PM, Sune Vuorela <debian@pusling.com> 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.



Reply to: