summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/opie-usermanager.control2
-rw-r--r--noncore/settings/usermanager/passwd.cpp11
-rw-r--r--noncore/settings/usermanager/userdialog.cpp6
-rw-r--r--noncore/settings/usermanager/usermanager.cpp26
4 files changed, 28 insertions, 17 deletions
diff --git a/noncore/settings/usermanager/opie-usermanager.control b/noncore/settings/usermanager/opie-usermanager.control
index f971fdc..e1c7762 100644
--- a/noncore/settings/usermanager/opie-usermanager.control
+++ b/noncore/settings/usermanager/opie-usermanager.control
@@ -1,9 +1,9 @@
Files: bin/usermanager apps/Settings/usermanager.desktop pics/usermanager/*
Priority: optional
Section: opie/settings
Version: $QPE_VERSION-$SUB_VERSION
Depends: opie-base
Architecture: arm
Maintainer: Ted Parnefors <zaurus@bredband.net>
License: GPL
-Description: User/Group manager for OPIE.
+Description: User/Group manager for Opie.
diff --git a/noncore/settings/usermanager/passwd.cpp b/noncore/settings/usermanager/passwd.cpp
index 1e98778..f8e6d17 100644
--- a/noncore/settings/usermanager/passwd.cpp
+++ b/noncore/settings/usermanager/passwd.cpp
@@ -202,20 +202,25 @@ bool Passwd::delUser(int uid, bool delGroup) {
}
// Locate a group in the groupStringList, fill out the gr_* variables and return "true" if found.
bool Passwd::searchGroup(QRegExp &groupRegExp) {
QStringList tempStringList(groupStringList.grep(groupRegExp));
if((tempStringList.isEmpty())) {
return false;
} else {
- groupString=(*(tempStringList.begin()));
- splitGroupEntry(groupString);
+ for(QStringList::Iterator it=tempStringList.begin(); it!=tempStringList.end(); it++) {
+ groupString=*it;
+ if(!groupString.find(QRegExp("^#"),0)) { // Skip commented lines.
+ splitGroupEntry(groupString);
+ return true;
+ }
+ }
}
- return true;
+ return false;
}
// Find a group by groupname.
bool Passwd::findGroup(const char *groupname) {
QRegExp groupRegExp(QString("^%1\\:").arg(groupname));
return searchGroup(groupRegExp);
}
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 0d2122b..c06f639 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -39,18 +39,20 @@ UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool mod
layout->addWidget(myTabWidget);
setupTab1();
setupTab2();
accounts->groupStringList.sort();
// And also fill the listview & the combobox with all available groups.
for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) {
accounts->splitGroupEntry(*it);
- new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
- groupComboBox->insertItem(accounts->gr_name);
+ if(accounts->gr_name.find(QRegExp("^#"),0)) { // Skip commented lines.
+ new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
+ groupComboBox->insertItem(accounts->gr_name);
+ }
}
showMaximized();
}
/**
* Empty destructor.
*
*/
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
@@ -121,26 +121,28 @@ void UserConfig::getUsers() {
// Empty the iconview & the listview.
usersIconView->clear();
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.
getUsers(); // Update users views.
getGroups(); // Update groups view.
@@ -211,20 +213,22 @@ 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() {
int gid;
if(groupsListView->currentItem()) { // Any group selected?