Diffstat (limited to 'noncore/settings/usermanager/userdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
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 | |||
@@ -324,29 +324,44 @@ bool UserDialog::editUser(const char *username) { | |||
324 | } | 324 | } |
325 | // Select the primary group for this user. | 325 | // Select the primary group for this user. |
326 | for(int i=0;i<edituserDialog->groupComboBox->count();++i) { | 326 | for(int i=0;i<edituserDialog->groupComboBox->count();++i) { |
327 | if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) { | 327 | if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) { |
328 | edituserDialog->groupComboBox->setCurrentItem(i); | 328 | edituserDialog->groupComboBox->setCurrentItem(i); |
329 | break; | 329 | break; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | if(invalid_group) { | 332 | if(invalid_group) { |
333 | edituserDialog->groupComboBox->insertItem("<Undefined group>",0); | 333 | edituserDialog->groupComboBox->insertItem("<Undefined group>",0); |
334 | edituserDialog->groupComboBox->setCurrentItem(0); | 334 | edituserDialog->groupComboBox->setCurrentItem(0); |
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. |
342 | for ( ; lvit.current(); ++lvit ) { | 357 | for ( ; lvit.current(); ++lvit ) { |
343 | if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { | 358 | if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { |
344 | temp=(QCheckListItem*)lvit.current(); | 359 | temp=(QCheckListItem*)lvit.current(); |
345 | temp->setOn(true);// If we find a line with that groupname, select it.; | 360 | temp->setOn(true);// If we find a line with that groupname, select it.; |
346 | } | 361 | } |
347 | } | 362 | } |
348 | } | 363 | } |
349 | 364 | ||
350 | if(!(edituserDialog->exec())) return false;// SHOW THE DIALOG! | 365 | if(!(edituserDialog->exec())) return false;// SHOW THE DIALOG! |
351 | 366 | ||
352 | accounts->findUser(username);// Fill user variables in 'acccounts' object. | 367 | accounts->findUser(username);// Fill user variables in 'acccounts' object. |