[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    It's necessary to add a QCoreApplication to kdeinit4
From:       "=?GB2312?B?xcvOwMa9?=" <panweiping3 () gmail ! com>
Date:       2008-10-14 3:52:13
Message-ID: 499f24540810132052jd691178vb53d931bfd1b001c () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]

[Attachment #4 (text/plain)]

Hi all,
I made two experiments:
the first program is:
#include <QCoreApplication>
#include <QFile>
#include <stdio.h>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
printf("%s\n", QFile::encodeName(QString::fromUtf8("*/home/*ΕΛ")).data());
return 0;
}
the output is:
*/home/*ΕΛ

the second program is:
#include <QCoreApplication>
#include <QFile>
#include <stdio.h>
int main(int argc, char *argv[])
{
//QCoreApplication app(argc, argv);
printf("%s\n", QFile::encodeName(QString::fromUtf8("*/home/*ΕΛ")).data());
return 0;
}
the output is:
*/home/*

QFile::encodeName got wrong file name without a QCoreApplication object !
(my locale is zh_CN.UTF-8)

From the error messages:
"
trying to create local folder */home/*.kde: Permission denied
trying to create local folder */home/*.kde: Permission denied
Link points to "/tmp/ksocket-ΕΛ"
trying to create local folder */home/*.kde: Permission denied
kdeinit4: Aborting. bind() failed: : No such file or directory
Could not bind to socket
'*/home/*.kde/socket-localhost.localdomain/kdeinit4__0'
"
I find that maybe something is wrong when binding a socket.

kdelibs/kinit/kinit.cpp
main() function calls kdeinit_library_path() function.
1808 kdeinit_library_path();

and in kdeinit_library_path() function,
1562 QByteArray socketName =
QFile::encodeName(KStandardDirs::locateLocal("socket",
QString("kdeinit4_%1").a rg(QLatin1String(display)), *s_instance));

I think that's the reason why kdeinit4 binds the socket wrongly,
and we should add a QCoreAoolication to make QFile, QDir and other QT
class work in kdeinit4.

Best regards!

pwp

[Attachment #5 (text/html)]

<div dir="ltr"><pre>Hi all,<br>I made two experiments:<br>the first program \
is:<br>#include &lt;QCoreApplication&gt;<br>#include &lt;QFile&gt;<br>#include \
&lt;stdio.h&gt;<br>int main(int argc, char *argv[])<br>{<br>QCoreApplication \
app(argc, argv);<br> printf(&quot;%s\n&quot;, \
QFile::encodeName(QString::fromUtf8(&quot;<i class="moz-txt-slash"><span \
class="moz-txt-tag">/</span>home<span \
class="moz-txt-tag">/</span></i>ΕΛ&quot;)).data());<br>return 0;<br>}<br>the output \
is:<br> <i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span \
class="moz-txt-tag">/</span></i>ΕΛ<br><br>the second program is:<br>#include \
&lt;QCoreApplication&gt;<br>#include &lt;QFile&gt;<br>#include &lt;stdio.h&gt;<br> \
int main(int argc, char *argv[])<br>{<br>//QCoreApplication app(argc, \
argv);<br>printf(&quot;%s\n&quot;, QFile::encodeName(QString::fromUtf8(&quot;<i \
class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span \
class="moz-txt-tag">/</span></i>ΕΛ&quot;)).data());<br> return 0;<br>}<br>the output \
is:<br><i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span \
class="moz-txt-tag">/</span></i><br><br>QFile::encodeName got wrong file name without \
a QCoreApplication object !<br> (my locale is zh_CN.UTF-8)<br><br>From the error \
messages:<br>&quot;<br>trying to create local folder <i class="moz-txt-slash"><span \
class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>.kde: \
Permission denied<br> trying to create local folder <i class="moz-txt-slash"><span \
class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>.kde: \
Permission denied<br>Link points to &quot;/tmp/ksocket-ΕΛ&quot;<br>trying to create \
local folder <i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span \
                class="moz-txt-tag">/</span></i>.kde: Permission denied<br>
kdeinit4: Aborting. bind() failed: : No such file or directory<br>Could not bind to \
socket<br>&#39;<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span \
class="moz-txt-tag">/</span></i>.kde/socket-localhost.localdomain/kdeinit4__0&#39;<br>
 &quot;<br>I find that maybe something is wrong when binding a \
socket.<br><br>kdelibs/kinit/kinit.cpp<br>main() function calls \
kdeinit_library_path() function.<br>1808 kdeinit_library_path();<br><br>and in \
kdeinit_library_path() function,<br> 1562 QByteArray socketName \
=<br>QFile::encodeName(KStandardDirs::locateLocal(&quot;socket&quot;,<br>QString(&quot;kdeinit4_%1&quot;).a \
rg(QLatin1String(display)), *s_instance));<br><br>I think that&#39;s the reason why \
kdeinit4 binds the socket wrongly,<br> and we should add a QCoreAoolication to make \
QFile, QDir and other QT<br>class work in kdeinit4.<br><br>Best \
regards!<br><br>pwp</pre></div>



>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic