[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Fix for bug 67892
From: Ravi <ravi () kde ! org>
Date: 2003-12-08 23:49:03
[Download RAW message or body]
Hello,
The patch attached fixes
http://bugs.kde.org/show_bug.cgi?id=67892
in the right way. While it seems long, it is simply the code from
kdeutils/kdepasswd/userinfo/userinfo_chface.cpp
which is known to work. The only modifications are change of variable names to
be more consistent, and use of QDir::home(). Use of the defined constants can
be improved, but I submit it as is so that it has a greater chance of making
it into 3.2.
Can I commit it?
Regards,
Ravi
PS: Both userinfo and ksplashml can benefit from the KUser class, but I have
postponed it until past 3.2.
["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 8 Dec 2003 23:43:48 -0000
@@ -26,6 +26,7 @@
#include <qcheckbox.h>
#include <qdesktopwidget.h>
+#include <qdir.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qrect.h>
@@ -186,10 +187,68 @@ void ThemeRedmond::_initUi()
greetingString = QString::fromLocal8Bit( _pwent->pw_name );
// 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"))); +//////////////////////// Constants: \
//////////////////////// + // Keep in sync with \
kdeutils/kdepasswd/userinfo/userinfo_constants.h // +#define USER_FACE_FILE \
"/.face.icon" // The file in the user's home dir +#define USER_FACES_DIR \
"/.faces/" // User can install additional faces to ~/.faces/ +
+#define SYS_DEFAULT_FILE "/default1.png" // The system-wide default image
+#define KDM_FACES_DIR "/pics/faces/" // Directory where system-wide faces are \
stored (KDMDIR+this) +#define KDM_USER_FACES_DIR "/pics/users/"// Directory where \
kdm stores user pics (KDMDIR+this) +
+#define FACE_PIX_SIZE 64 // Default Size for faces is 60x60
+#define FACE_BTN_SIZE FACE_PIX_SIZE+10// Size for the Face button in the main \
dialog +
+// Move to an enum later on.
+#define FACE_SRC_USERONLY 4
+#define FACE_SRC_USERFIRST 3
+#define FACE_SRC_ADMINFIRST 2 // USERONLY *MUST* be one more than USERFIRST,
+#define FACE_SRC_ADMINONLY 1 // which must be one more than ADMINFIRST, etc.
+////////////////////////////////////////////////////////////
+ // Get face dirs
+ QString kdmDir = KGlobal::dirs()->resourceDirs("data").last() + "kdm/";
+ QString userPicsDir = kdmDir + KDM_USER_FACES_DIR;
+ QString facesDir = kdmDir + KDM_FACES_DIR;
+ int faceSource = 1; // 1 = Admin Only, 2 = Admin first, 3 = User first, or user \
only + KConfig *kdmconfig = new KConfig("kdm/kdmrc", true);
+ kdmconfig->setGroup("X-*-Greeter");
+ QString fs = kdmconfig->readEntry( "FaceSource" );
+ if (fs == QString::fromLatin1("UserOnly"))
+ faceSource = FACE_SRC_USERONLY;
+ else if (fs == QString::fromLatin1("PreferUser"))
+ faceSource = FACE_SRC_USERFIRST;
+ else if (fs == QString::fromLatin1("PreferAdmin"))
+ faceSource = FACE_SRC_ADMINFIRST;
+ else
+ faceSource = FACE_SRC_ADMINONLY; // Admin Only
+ delete kdmconfig;
+
+ QPixmap userp;
+ if ( faceSource == FACE_SRC_ADMINFIRST )
+ {
+ // If the administrator's choice takes preference
+ userp = QPixmap( userPicsDir + username + ".png" );
+ if ( userp.isNull() )
+ faceSource = FACE_SRC_USERONLY;
+ }
+ if ( faceSource >= FACE_SRC_USERFIRST)
+ {
+ // If the user's choice takes preference
+ userp = QPixmap( QDir::home().path() + USER_FACE_FILE );
+ if ( userp.isNull() && faceSource == FACE_SRC_USERFIRST ) // The user has no \
face, should we check for the admin's setting? + userp = QPixmap( userPicsDir \
+ username + ".png" ); + if ( userp.isNull() )
+ userp = QPixmap( userPicsDir + SYS_DEFAULT_FILE );
+ }
+ else if ( faceSource <= FACE_SRC_ADMINONLY )
+ {
+ // Admin only
+ userp = QPixmap( userPicsDir + username + ".png" );
+ if ( userp.isNull() )
+ userp = QPixmap( userPicsDir + SYS_DEFAULT_FILE );
+ }
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