[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: =?GB2312?B?W1BBVENIXSBCVUcgMTcyNTY3IHN1cHBvcnQgbm9uIEFTQ0lJIHVzZXIgbmFtZSB0byBsb2dpbiBp?=
From: "=?GB2312?B?xcvOwMa9?=" <wppan () redflag-linux ! com>
Date: 2008-10-13 2:58:50
Message-ID: 20081013025850.7C041137868 () mail ! redflag-linux ! com
[Download RAW message or body]
This is a MIME-formatted message. If you see this text it means that your
mail software cannot handle MIME-formatted messages.
[Attachment #2 (text/html)]
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: \
Permission 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>kdelibs/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( \
'/');<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 application'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>
["kstartupconfig4.patch" (kstartupconfig4.patch)]
Index: kdostartupconfig.cpp
===================================================================
--- kdostartupconfig.cpp (版本 870678)
+++ kdostartupconfig.cpp (工作副本)
@@ -25,6 +25,7 @@
#undef QT_NO_CAST_ASCII
// See description in kstartupconfig.cpp .
+#include <QCoreApplication>
#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <kcomponentdata.h>
@@ -79,6 +80,7 @@
KComponentData inst( &about );
kDebug() << "Running kdostartupconfig.";
KCmdLineArgs::init( argc, argv, &about ); // for KLocale not to complain about encoding
+ QCoreApplication app(argc, argv);
QString keysname = KStandardDirs::locateLocal( "config", "startupconfigkeys" );
QFile keys( keysname );
if( !keys.open( QIODevice::ReadOnly ))
["kdeinit4.patch" (kdeinit4.patch)]
Index: kinit.cpp
===================================================================
--- kinit.cpp (版本 870678)
+++ kinit.cpp (工作副本)
@@ -41,6 +41,7 @@
#include <unistd.h>
#include <locale.h>
+#include <QCoreApplication>
#include <QtCore/QLibrary>
#include <QtCore/QString>
#include <QtCore/QFile>
@@ -1722,6 +1723,8 @@
int keep_running = 1;
d.suicide = false;
+ QCoreApplication app(argc, argv);
+
/** Save arguments first... **/
char **safe_argv = (char **) malloc( sizeof(char *) * argc);
for(i = 0; i < argc; i++)
>> 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