From ebf65f250904e0619c10b69a0428fcc538ffc167 Mon Sep 17 00:00:00 2001 From: umopapisdn Date: Sat, 22 Mar 2003 00:31:44 +0000 Subject: Bugfix: Groupmembers should be separated by a comma and not by a space. --- (limited to 'noncore/settings/usermanager/userdialog.cpp') 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 @@ -333,11 +333,26 @@ bool UserDialog::editUser(const char *username) { edituserDialog->groupComboBox->insertItem("",0); edituserDialog->groupComboBox->setCurrentItem(0); } + // Select the groups in the listview, to which the user belongs. QCheckListItem *temp; - QRegExp userRegExp(QString("[:\\s]%1\\s").arg(username)); + // 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. + QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant. QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { // Iterate over all of them. + qWarning(*it); + QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. + for ( ; lvit.current(); ++lvit ) { + if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { + temp=(QCheckListItem*)lvit.current(); + temp->setOn(true); // If we find a line with that groupname, select it.; + } + } + } + userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.) + tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. + for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { // Iterate over all of them. + qWarning(*it); QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. for ( ; lvit.current(); ++lvit ) { if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { -- cgit v0.9.0.2