author | umopapisdn <umopapisdn> | 2003-03-28 13:12:09 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-03-28 13:12:09 (UTC) |
commit | b271d575fa05cf570a1a829136517761bd47e69b (patch) (side-by-side diff) | |
tree | e82c8e348b3b926fb365c42454d12a56dda0adc6 /noncore/settings/usermanager/usermanager.cpp | |
parent | 8e8803488d2c11b12449e785802da4a5a9adad0f (diff) | |
download | opie-b271d575fa05cf570a1a829136517761bd47e69b.zip opie-b271d575fa05cf570a1a829136517761bd47e69b.tar.gz opie-b271d575fa05cf570a1a829136517761bd47e69b.tar.bz2 |
Bugfix: (bug #0000765) Lines in /etc/passwd & /etc/group starting with a "#" are comments and should not be editable.
Diffstat (limited to 'noncore/settings/usermanager/usermanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/usermanager/usermanager.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp index 57efa71..1946013 100644 --- a/noncore/settings/usermanager/usermanager.cpp +++ b/noncore/settings/usermanager/usermanager.cpp @@ -123,22 +123,24 @@ void UserConfig::getUsers() { usersListView->clear(); // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500. availableUID=500; for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) { accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.) - new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); - if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) { // Is this user a "normal" user ? - mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. - if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { // Is there an icon for this user? Resource::loadPixmap is caching, doesn't work. - mypixmap=Resource::loadPixmap(QString("usermanager/usericon")); // If this user has no icon, load the default icon. + if(accounts->pw_name.find(QRegExp("^#"),0)) { // Skip commented lines. + new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); + if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) { // Is this user a "normal" user ? + mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. + if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { // Is there an icon for this user? Resource::loadPixmap is caching, doesn't work. + mypixmap=Resource::loadPixmap(QString("usermanager/usericon")); // If this user has no icon, load the default icon. + } + listviewitem=new QListViewItem(usersIconView,"",mytext); // Add the icon+text to the qiconview. + listviewitem->setPixmap(0,mypixmap); } - listviewitem=new QListViewItem(usersIconView,"",mytext); // Add the icon+text to the qiconview. - listviewitem->setPixmap(0,mypixmap); + if((accounts->pw_uid>=availableUID) && (accounts->pw_uid<65000)) availableUID=accounts->pw_uid+1; // Increase 1 to the latest know UID to get a free uid. } - if((accounts->pw_uid>=availableUID) && (accounts->pw_uid<65000)) availableUID=accounts->pw_uid+1; // Increase 1 to the latest know UID to get a free uid. } usersIconView->sort(); } void UserConfig::addUser() { if(UserDialog::addUser(availableUID,availableGID)) { // Add the user to the system, also send next available UID and GID. @@ -213,16 +215,18 @@ void UserConfig::delUser() { void UserConfig::getGroups() { groupsListView->clear(); // Empty the listview. availableGID=500; // We need to find the next free GID, and are only interested in values between 500 & 65000. for(QStringList::Iterator it=accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) { // Split the list into lines. accounts->splitGroupEntry(*it); // Split the line into its components and fill the variables of 'accounts'. (gr_name, gr_uid & gr_mem). - new QListViewItem(groupsListView,QString::number(accounts->gr_gid),accounts->gr_name); - if((accounts->gr_gid>=availableGID) && (accounts->gr_gid<65000)) availableGID=accounts->gr_gid+1; // Maybe a new free GID. + if(accounts->gr_name.find(QRegExp("^#"),0)) { // Skip commented lines. + new QListViewItem(groupsListView,QString::number(accounts->gr_gid),accounts->gr_name); + if((accounts->gr_gid>=availableGID) && (accounts->gr_gid<65000)) availableGID=accounts->gr_gid+1; // Maybe a new free GID. + } } -} +} void UserConfig::addGroup() { if(GroupDialog::addGroup(availableGID)) getGroups(); // Bring up the add group dialog. } void UserConfig::editGroup() { |