[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Fix for bug 67892
From: Ravi <ravi () kde ! org>
Date: 2003-12-09 21:02:20
[Download RAW message or body]
On Monday 08 December 2003 10:05 pm, Oswald Buddenhagen wrote:
> i wonder how ... when exactly did you test last time?
I hadn't updated kdm in months. That was actually quite funny. I have
rewritten the code to my liking.
Anyway, with an up-to-date kdm, the following patch works, and is much
cleaner. I have also used KUser. If this one's fine, I can go update the code
in userinfo as well. Can I commit?
One note: the default face icon is quite ugly; perhaps someone could come up
with a nicer icon. I am tempted to use the "go" icon in place of the current
default face icon.
Regards,
Ravi
["67892fix.diff" (text/x-diff)]
Index: ksplashml/themeengine/redmond/themeredmond.cpp
===================================================================
RCS file: /home/kde/kdebase/ksplashml/themeengine/redmond/themeredmond.cpp,v
retrieving revision 1.9
diff -u -p -w -r1.9 themeredmond.cpp
--- ksplashml/themeengine/redmond/themeredmond.cpp 13 Sep 2003 03:17:58 -0000 1.9
+++ ksplashml/themeengine/redmond/themeredmond.cpp 9 Dec 2003 20:59:12 -0000
@@ -17,12 +17,13 @@
#include <kconfig.h>
#include <kdebug.h>
#include <kdialogbase.h>
+#include <kfontcombo.h>
#include <kgenericfactory.h>
#include <kglobalsettings.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kstandarddirs.h>
-#include <kfontcombo.h>
+#include <kuser.h>
#include <qcheckbox.h>
#include <qdesktopwidget.h>
@@ -173,23 +174,57 @@ void ThemeRedmond::_initUi()
// The current theme wants to say something in particular, rather than display the
// account's fullname.
- QString greetingString = i18n("Starting KDE...");
- QString username( "" );
- struct passwd *_pwent = getpwuid( getuid() );
- username = QString( _pwent->pw_name );
-
- if( !mUsernameText.isNull() )
- greetingString = mUsernameText;
- else if( _pwent && *(_pwent->pw_gecos) )
- greetingString = QStringList::split( QChar( ',' ), QString::fromLocal8Bit( \
_pwent->pw_gecos ) ).first();
- else if( _pwent && *(_pwent->pw_name) )
- greetingString = QString::fromLocal8Bit( _pwent->pw_name );
+ KUser user;
+ QString greetingString = ( !mUsernameText.isNull() ) ? mUsernameText : \
user.fullName();
// Try to load the user's KDM icon... TODO: Make this overridable by the Theme.
- // Ravi - integrate this with face editor.
if( mUseKdmUserIcon )
{
- QPixmap userp( locate("data", "kdm/pics/users/" + username + \
QString::fromLatin1(".png"))); + const QString defSys( ".default.face.icon" ); // \
The system-wide default image + const int fAdminOnly = 1;
+ const int fAdminFirst = fAdminOnly+1;
+ const int fUserFirst = fAdminFirst+1;
+ const int fUserOnly = fUserFirst+1;
+
+ int faceSource = fAdminOnly;
+ KConfig *kdmconfig = new KConfig("kdm/kdmrc", true);
+ kdmconfig->setGroup("X-*-Greeter");
+ QString userPicsDir = kdmconfig->readEntry( "FaceDir", \
KGlobal::dirs()->resourceDirs("data").last() + "kdm/faces" ) + '/'; + QString fs = \
kdmconfig->readEntry( "FaceSource" ); + if (fs == QString::fromLatin1("UserOnly"))
+ faceSource = fUserOnly;
+ else if (fs == QString::fromLatin1("PreferUser"))
+ faceSource = fUserFirst;
+ else if (fs == QString::fromLatin1("PreferAdmin"))
+ faceSource = fAdminFirst;
+ else
+ faceSource = fAdminOnly; // Admin Only
+ delete kdmconfig;
+
+ QPixmap userp;
+ if ( faceSource == fAdminFirst )
+ {
+ // If the administrator's choice takes preference
+ userp = QPixmap( userPicsDir + user.loginName() + ".face.icon" );
+ if ( userp.isNull() )
+ faceSource = fUserOnly;
+ }
+ if ( faceSource >= fUserFirst)
+ {
+ // If the user's choice takes preference
+ userp = QPixmap( user.homeDir() + "/.face.icon" );
+ if ( userp.isNull() && faceSource == fUserFirst ) // The user has no face, \
should we check for the admin's setting? + userp = QPixmap( userPicsDir + \
user.loginName() + ".face.icon" ); + if ( userp.isNull() )
+ userp = QPixmap( userPicsDir + defSys );
+ }
+ else if ( faceSource <= fAdminOnly )
+ {
+ // Admin only
+ userp = QPixmap( userPicsDir + user.loginName() + ".face.icon" );
+ if ( userp.isNull() )
+ userp = QPixmap( userPicsDir + defSys );
+ }
if( !userp.isNull() )
mPixmap = userp;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic