1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include "common.h"
#include <QtCore/QFile>
#include <kicon.h>
#include <kiconloader.h>
#include <kuser.h>
const QString getUsername(bool useShortName, const KUser& user)
{
if (useShortName)
return user.loginName();
QString username = user.property(KUser::FullName).toString();
if (username.isEmpty())
username = user.loginName();
return username;
}
QPixmap getUserIcon(const KUser& user)
{
QPixmap pixmap;
int iconSize = IconSize(KIconLoader::Desktop);
if (QFile::exists(user.faceIconPath())) {
pixmap.load(user.faceIconPath());
} else
pixmap = KIcon(DEFAULT_ICON_NAME).pixmap(iconSize);
return pixmap;
}
|