<br>
-------- Forwarded Messages --------<br>
<br>
<br><div><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
From: "ÅËÎÀƽ" wppan@redflag-linux.com <br>
To: kde-devel@kde.org, kde-core-devel@kde.org, coolo@kde.org, l.lunak@kde.org <br>
<br>
This patch is for BUG 172567 .<br>
<br>Hi all,<br>I believe KDE should allow non-ASCII user name to login in computer.<br><br>I am chinese, so I want use chinese user name to login in my computer.<br>I find out that we only need to add a QCoreApplication object to kdeinit4 and kstartupconfig4 program to achieve it, and I made two simple patches.<br><br>I add a user "ÅË" by kuser(compiled from svn), and I set Language=zh_CN.UTF-8<br>in /etc/kde/kdm/kdmrc.<br><br>restart X, kdm displays my name "ÅË" perfectly, but when I input my password, login,<br>a message box shows "Could not start kstartupconfig4. Check your installation."<br> <br>Then I login in safe mode, run kdeinit4, got some error messages:<br>"<br>trying to create local folder /home/.kde: Permission denied<br>trying to create local folder /home/.kde: Permissio
n denied<br>Link points to "/tmp/ksocket-ÅË"<br>trying to create local folder /home/.kde: Permission denied<br>kdeinit4: Aborting. bind() failed: : No such file or directory<br>Could not bin
d to socket '/home/.kde/socket-localhost.localdomain/kdeinit4__0'<br>"<br><br>I infer that kdeinit4 doesn't get my "HOME" environment correctly, so it tries to create local folder in /home/.kde, of course "Permission denied".<br><br>Then I look into why kdeinit4 doesn't get my "HOME" environment correctly.<br>From the error messages, we could learn that maybe kdeinit4 exits when binding a socket.<br><br>in kdelibs/kinit/kinit.cpp I find that:<br>1562 QByteArray socketName = QFile::encodeName(KStandardDirs::locateLocal("socket", QString("kde init4_%1").arg(QLatin1String(display)), *s_instance));<br><br>kdeinit_library_path() calls KStandardDirs::locateLocal to locate the socket.<br>After I see how KStandardDirs::locateLocal is implemented I find that in<br>kde
libs/kdecore/kernel/kstandarddirs.cpp<br>KStandardDirs::addKDEDefaults() calls QDir::homePath() to get "HOME" environment variable.<br>1499 #if defined(Q_WS_MACX)<br>1500 &n
bsp; localKdeDir = QDir::homePath() + QLatin1String("/Library/Preferences/KDE/");<br>1501 #elif defined(Q_WS_WIN)<br>1502 WCHAR wPath[MAX_PATH+1];<br>1503 if ( SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wPath) == S_OK) {<br>1504 localKdeDir = QString::fromUtf16((const ushort *) wPath) + QLatin1Char('/') + KDE_DE FAULT_HOME + QLatin1Char('/');<br>1505 } else {<br>1506 localKdeDir = QDir::homePath() + QLatin1Char('/') + KDE_DEFAULT_HOME + QLatin1Char(&
nbsp; '/');<br>1507 }<br>1508 #else<br>1509 localKdeDir = QDir::homePa
th() + QLatin1Char('/') + KDE_DEFAULT_HOME + QLatin1Char('/ ');<br>1510 #endif<br><br>Because kdeinit4 is a C++ program, it doesn't initialize any QApplication instance, which cause that QDir::homePath() doesn't get the correct "HOME" environment variable.<br><br>So I add a QCoreApplication in kdelibs/kinit/kinit.cpp and kdebase/workspace/kstartupconfig/kdostartupconfig.cpp.<br><br>Then it works. Now I can use my own chinese name "ÅË" to login in my computer.<br><br>In QT manual I find following descriptions:<br>http://doc.trolltech.com/4.4/qcoreapplication.html<br>"<br>QCoreApplication contains the main event loop, where all events from the operating system (e.g., timer and network events) and other sources are processed and dispatched. It also handles the applica
tion's initialization and finalization, as well as system-wide and application-wide settings.<br><br>Some Qt classes, such as QString, can be used without a QCoreApplication object. However,
in general, we recommend that you create a QCoreApplication or a QApplication object in your main() function as early as possible. The application will enter the event loop when exec() is called. exit() will not return until the event loop exits, e.g., when quit() is called.<br>"<br><br>kdeinit4 and kstartupconfig don't create a QCoreApplication, maybe it would lead some encoding problems, I guess.<br><br>
<br>
The kdeinit4.patch should apply to the directory kdelibs/kinit/ <br>and kstartupconfig4.patch should apply to kdebase/workspace/kstartupconfig/ .<br><br>
Best regards<br>
<br>
pwp<br>
<br>
</blockquote></div><br>
<br>
<br>