Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2
kdebase4-workspace
kdm-make_it_cool.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kdm-make_it_cool.diff of Package kdebase4-workspace
--- kdm/kfrontend/kgreeter.cpp 2011-08-18 18:54:29.000000000 +0200 +++ kdm/kfrontend/kgreeter.cpp 2011-08-19 09:37:02.384127904 +0200 @@ -68,20 +68,20 @@ class UserListView : public QListWidget { public: - UserListView(QWidget *parent = 0) + UserListView( bool _themed, QWidget *parent = 0) : QListWidget(parent) , cachedSizeHint(-1, 0) + , themed (_themed) { setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored); setUniformItemSizes(true); setVerticalScrollMode(ScrollPerPixel); setIconSize(QSize(48, 48)); - setAlternatingRowColors(true); + setAlternatingRowColors(!themed); } mutable QSize cachedSizeHint; - protected: virtual QSize sizeHint() const { if (!cachedSizeHint.isValid()) { @@ -149,6 +149,7 @@ private: bool m_suppressClick; + bool themed; }; class UserListViewItem : public QListWidgetItem { @@ -185,7 +186,7 @@ "PrevUser"); if (_userList) { - userView = new UserListView(this); + userView = new UserListView(framed, this); connect(userView, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(slotUserClicked(QListWidgetItem*))); connect(userView, SIGNAL(itemDoubleClicked(QListWidgetItem*)), @@ -193,8 +194,6 @@ } if (_userCompletion) userList = new QStringList; - if (userView || userList) - insertUsers(); sessMenu = new QMenu(this); connect(sessMenu, SIGNAL(triggered(QAction*)), @@ -365,8 +364,11 @@ } } +#include <utmp.h> +#include <utmpx.h> + void -KGreeter::insertUsers() +KGreeter::insertUsers( int limit_users ) { struct passwd *ps; @@ -392,6 +394,9 @@ if (_showUsers == SHOW_ALL) { UserList noUsers(_noUsers); QSet<QString> dupes; + QStringList toinsert; + + int count = 0; for (setpwent(); (ps = getpwent()) != 0;) { if (*ps->pw_dir && *ps->pw_shell && (ps->pw_uid >= (unsigned)_lowUserId || @@ -403,10 +408,55 @@ QString username(QFile::decodeName(ps->pw_name)); if (!dupes.contains(username)) { dupes.insert(username); - insertUser(default_pix, username, ps); + toinsert.append( username ); + + if ( limit_users >= 0 && ++count > limit_users ) + break; + + } + } + } + if ( limit_users >= 0 && ++count > limit_users ) { + utmpname( _PATH_WTMP ); + setutxent(); + toinsert = QStringList(); + dupes.clear(); + + for ( count = 0; count < limit_users; ) { + struct utmpx * ent = getutxent(); + if ( !ent ) + break; + struct passwd *ps = getpwnam( ent->ut_user ); + if (ps && *ps->pw_dir && *ps->pw_shell && + (ps->pw_uid >= (unsigned)_lowUserId || + !ps->pw_uid && _showRoot) && + ( ps->pw_uid <= (unsigned)_highUserId ) && + !noUsers.hasUser( ps->pw_name ) && + !noUsers.hasGroup( ps->pw_gid )) + { + QString username( QFile::decodeName( ent->ut_user ) ); + if (!dupes.contains( username )) { + dupes.insert( username ); + toinsert.append( username ); + count++; + } } + + } + endutxent(); } + + for ( QStringList::ConstIterator it = toinsert.begin(); + it != toinsert.end(); ++it ) + { + // pretty stupid to do another lookup round, but the number is limited + // and caching struct passwd is pretty ugly + struct passwd *ps = getpwnam( QFile::encodeName( *it ) ); + if ( ps ) + insertUser( default_pix, *it, ps ); + } + } else { UserList users(_users); if (users.hasGroups()) { @@ -783,6 +833,9 @@ break; } } + if (userView || userList) + insertUsers(); + if (userView) { if (clock) inner_box->addWidget(clock, 0, Qt::AlignCenter); @@ -895,6 +948,7 @@ setMouseTracking(true); adjustGeometry(); + themer->setTypeVisible( "userlist", true ); themer->setWidget(this); @@ -983,6 +1037,13 @@ completeMenu(); #endif + if (userView || userList) + { + insertUsers(7); + themer->setTypeVisible( "userlist", true ); + } else + themer->setTypeVisible( "userlist", false ); + if ((system_button = themer->findNode("system_button"))) { if (optMenu) addAction(optMenu->menuAction()); @@ -1021,6 +1082,8 @@ inherited::pluginSetup(); if (userView && verify->entitiesLocal() && verify->entityPresettable() && userlist_node) { + userView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + userView->setMaximumHeight( userView->sizeHint().height() ); userlist_node->setWidget(userView); userlist_rect->setVisible(true); } else { --- kdm/kfrontend/kgreeter.h 2011-08-18 18:54:29.000000000 +0200 +++ kdm/kfrontend/kgreeter.h 2011-08-19 09:36:00.097124913 +0200 @@ -70,7 +70,7 @@ protected: void insertUser(const QImage &, const QString &, struct passwd *); - void insertUsers(); + void insertUsers(int limit_users = -1); void putSession(const QString &, const QString &, bool, const char *); void insertSessions(); virtual void pluginSetup(); --- kdm/kfrontend/themer/kdmitem.cpp 2011-08-18 18:54:29.000000000 +0200 +++ kdm/kfrontend/themer/kdmitem.cpp 2011-08-19 09:36:00.098124907 +0200 @@ -65,7 +65,6 @@ !modes.split(",", QString::SkipEmptyParts).contains("console")))) { m_visible = false; - return; } m_showType = sel.attribute("type"); @@ -78,7 +77,6 @@ themer()->typeVisible(m_showType) == m_showTypeInvert) { m_visible = false; - return; } } --- kdm/kfrontend/themer/kdmlist.cpp 2011-08-18 18:54:29.000000000 +0200 +++ kdm/kfrontend/themer/kdmlist.cpp 2011-08-19 09:36:00.098124907 +0200 @@ -29,8 +29,6 @@ : KdmItem(parent, node) { itemType = "list"; - if (!isVisible()) - return; // Read RECT TAGS QDomNodeList childList = node.childNodes(); --- kdm/kfrontend/themer/kdmthemer.cpp 2011-08-18 18:54:29.000000000 +0200 +++ kdm/kfrontend/themer/kdmthemer.cpp 2011-08-19 09:38:00.360130704 +0200 @@ -223,10 +223,6 @@ } else { continue; } - if (!newItem->isVisible()) { - delete newItem; - continue; - } connect(newItem, SIGNAL(needUpdate(int,int,int,int)), SLOT(update(int,int,int,int))); connect(newItem, SIGNAL(needPlacement()),
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor