Diffstat (limited to 'noncore/settings/usermanager/usermanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/usermanager/usermanager.cpp | 4 |
1 files changed, 4 insertions, 0 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 | |||
@@ -117,35 +117,37 @@ void UserConfig::getUsers() { | |||
117 | QString mytext; | 117 | QString mytext; |
118 | QPixmap mypixmap; | 118 | QPixmap mypixmap; |
119 | QListViewItem *listviewitem; | 119 | QListViewItem *listviewitem; |
120 | 120 | ||
121 | // Empty the iconview & the listview. | 121 | // Empty the iconview & the listview. |
122 | usersIconView->clear(); | 122 | usersIconView->clear(); |
123 | usersListView->clear(); | 123 | usersListView->clear(); |
124 | 124 | ||
125 | // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500. | 125 | // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500. |
126 | availableUID=500; | 126 | availableUID=500; |
127 | for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) { | 127 | for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) { |
128 | accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.) | 128 | accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.) |
129 | if(accounts->pw_name.find(QRegExp("^#"),0)) {// Skip commented lines. | ||
129 | new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); | 130 | new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); |
130 | if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) {// Is this user a "normal" user ? | 131 | if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) {// Is this user a "normal" user ? |
131 | mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. | 132 | mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. |
132 | 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. | 133 | 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. |
133 | mypixmap=Resource::loadPixmap(QString("usermanager/usericon"));// If this user has no icon, load the default icon. | 134 | mypixmap=Resource::loadPixmap(QString("usermanager/usericon"));// If this user has no icon, load the default icon. |
134 | } | 135 | } |
135 | listviewitem=new QListViewItem(usersIconView,"",mytext);// Add the icon+text to the qiconview. | 136 | listviewitem=new QListViewItem(usersIconView,"",mytext);// Add the icon+text to the qiconview. |
136 | listviewitem->setPixmap(0,mypixmap); | 137 | listviewitem->setPixmap(0,mypixmap); |
137 | } | 138 | } |
138 | 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. | 139 | 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. |
139 | } | 140 | } |
141 | } | ||
140 | usersIconView->sort(); | 142 | usersIconView->sort(); |
141 | } | 143 | } |
142 | 144 | ||
143 | void UserConfig::addUser() { | 145 | void UserConfig::addUser() { |
144 | if(UserDialog::addUser(availableUID,availableGID)) {// Add the user to the system, also send next available UID and GID. | 146 | if(UserDialog::addUser(availableUID,availableGID)) {// Add the user to the system, also send next available UID and GID. |
145 | getUsers(); // Update users views. | 147 | getUsers(); // Update users views. |
146 | getGroups(); // Update groups view. | 148 | getGroups(); // Update groups view. |
147 | } | 149 | } |
148 | } | 150 | } |
149 | 151 | ||
150 | void UserConfig::editUser() { | 152 | void UserConfig::editUser() { |
151 | QString username; | 153 | QString username; |
@@ -207,28 +209,30 @@ void UserConfig::delUser() { | |||
207 | } else { | 209 | } else { |
208 | QMessageBox::information(this,"No selection","No user has been selected."); | 210 | QMessageBox::information(this,"No selection","No user has been selected."); |
209 | } | 211 | } |
210 | } | 212 | } |
211 | 213 | ||
212 | } | 214 | } |
213 | 215 | ||
214 | void UserConfig::getGroups() { | 216 | void UserConfig::getGroups() { |
215 | groupsListView->clear();// Empty the listview. | 217 | groupsListView->clear();// Empty the listview. |
216 | availableGID=500;// We need to find the next free GID, and are only interested in values between 500 & 65000. | 218 | availableGID=500;// We need to find the next free GID, and are only interested in values between 500 & 65000. |
217 | for(QStringList::Iterator it=accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) {// Split the list into lines. | 219 | for(QStringList::Iterator it=accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) {// Split the list into lines. |
218 | accounts->splitGroupEntry(*it);// Split the line into its components and fill the variables of 'accounts'. (gr_name, gr_uid & gr_mem). | 220 | accounts->splitGroupEntry(*it);// Split the line into its components and fill the variables of 'accounts'. (gr_name, gr_uid & gr_mem). |
221 | if(accounts->gr_name.find(QRegExp("^#"),0)) {// Skip commented lines. | ||
219 | new QListViewItem(groupsListView,QString::number(accounts->gr_gid),accounts->gr_name); | 222 | new QListViewItem(groupsListView,QString::number(accounts->gr_gid),accounts->gr_name); |
220 | if((accounts->gr_gid>=availableGID) && (accounts->gr_gid<65000)) availableGID=accounts->gr_gid+1;// Maybe a new free GID. | 223 | if((accounts->gr_gid>=availableGID) && (accounts->gr_gid<65000)) availableGID=accounts->gr_gid+1;// Maybe a new free GID. |
221 | } | 224 | } |
222 | } | 225 | } |
226 | } | ||
223 | 227 | ||
224 | void UserConfig::addGroup() { | 228 | void UserConfig::addGroup() { |
225 | if(GroupDialog::addGroup(availableGID)) getGroups();// Bring up the add group dialog. | 229 | if(GroupDialog::addGroup(availableGID)) getGroups();// Bring up the add group dialog. |
226 | } | 230 | } |
227 | 231 | ||
228 | void UserConfig::editGroup() { | 232 | void UserConfig::editGroup() { |
229 | int gid; | 233 | int gid; |
230 | if(groupsListView->currentItem()) {// Any group selected? | 234 | if(groupsListView->currentItem()) {// Any group selected? |
231 | gid=groupsListView->currentItem()->text(0).toInt();// Get the GID from the listview. | 235 | gid=groupsListView->currentItem()->text(0).toInt();// Get the GID from the listview. |
232 | if(GroupDialog::editGroup(gid)) getGroups();// Bring up the edit group dialog. | 236 | if(GroupDialog::editGroup(gid)) getGroups();// Bring up the edit group dialog. |
233 | } else { | 237 | } else { |
234 | QMessageBox::information(this,"No selection","No group has been selected."); | 238 | QMessageBox::information(this,"No selection","No group has been selected."); |