summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/passwd.cpp11
-rw-r--r--noncore/settings/usermanager/userdialog.cpp17
2 files changed, 23 insertions, 5 deletions
diff --git a/noncore/settings/usermanager/passwd.cpp b/noncore/settings/usermanager/passwd.cpp
index 0a2bfba..1e98778 100644
--- a/noncore/settings/usermanager/passwd.cpp
+++ b/noncore/settings/usermanager/passwd.cpp
@@ -122,3 +122,3 @@ void Passwd::splitGroupEntry(QString &groupString) {
122 gr_gid=(*it++).toInt(); 122 gr_gid=(*it++).toInt();
123 gr_mem=QStringList::split(" ",(*it++)); 123 gr_mem=QStringList::split(",",(*it++));
124} 124}
@@ -241,5 +241,6 @@ bool Passwd::updateGroup(int gid) {
241 *it=QString(gr_name+":*:"+QString::number(gr_gid)+":"); 241 *it=QString(gr_name+":*:"+QString::number(gr_gid)+":");
242 for(QStringList::Iterator member=gr_mem.begin(); member!=gr_mem.end(); ++member) { 242 for(QStringList::Iterator member=gr_mem.begin(); member!=gr_mem.end();) {
243 *it+=*member; 243 *it+=*member;
244 *it+=" "; 244 ++member;
245 if(member!=gr_mem.end()) *it+=",";
245 } 246 }
@@ -277,3 +278,5 @@ bool Passwd::addGroupMember(QString groupname, QString member) {
277 if(!(findGroup(groupname))) return false; 278 if(!(findGroup(groupname))) return false;
278 gr_mem << member; 279 QRegExp memberRegExp(QString("^%1$").arg(member));
280 QStringList templist=gr_mem.grep(memberRegExp);
281 if(templist.isEmpty()) gr_mem << member;
279 if(!(updateGroup(gr_gid))) return false; 282 if(!(updateGroup(gr_gid))) return false;
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index c82cc9d..0d2122b 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -335,7 +335,22 @@ bool UserDialog::editUser(const char *username) {
335 } 335 }
336
336 // Select the groups in the listview, to which the user belongs. 337 // Select the groups in the listview, to which the user belongs.
337 QCheckListItem *temp; 338 QCheckListItem *temp;
338 QRegExp userRegExp(QString("[:\\s]%1\\s").arg(username)); 339 // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead.
340 QRegExp userRegExp(QString("[:,]%1$").arg(username));// The end of line variant.
339 QStringList tempList=accounts->groupStringList.grep(userRegExp);// Find all entries in the group database, that the user is a member of. 341 QStringList tempList=accounts->groupStringList.grep(userRegExp);// Find all entries in the group database, that the user is a member of.
340 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) {// Iterate over all of them. 342 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) {// Iterate over all of them.
343 qWarning(*it);
344 QListViewItemIterator lvit( edituserDialog->groupsListView );// Compare to all groups.
345 for ( ; lvit.current(); ++lvit ) {
346 if(lvit.current()->text(0)==(*it).left((*it).find(":"))) {
347 temp=(QCheckListItem*)lvit.current();
348 temp->setOn(true);// If we find a line with that groupname, select it.;
349 }
350 }
351 }
352 userRegExp=QRegExp(QString("[:,]%1,").arg(username));// And the other one. (not end of line.)
353 tempList=accounts->groupStringList.grep(userRegExp);// Find all entries in the group database, that the user is a member of.
354 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) {// Iterate over all of them.
355 qWarning(*it);
341 QListViewItemIterator lvit( edituserDialog->groupsListView );// Compare to all groups. 356 QListViewItemIterator lvit( edituserDialog->groupsListView );// Compare to all groups.