summaryrefslogtreecommitdiff
path: root/noncore/settings/usermanager/userdialog.cpp
Unidiff
Diffstat (limited to 'noncore/settings/usermanager/userdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/usermanager/userdialog.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 5854fe0..3616507 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -8,14 +8,17 @@
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10#include "userdialog.h" 10#include "userdialog.h"
11#include "passwd.h" 11#include "passwd.h"
12 12
13/* OPIE */ 13/* OPIE */
14#include <opie2/odebug.h>
14#include <opie2/odevice.h> 15#include <opie2/odevice.h>
15#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17using namespace Opie::Core;
18using namespace Opie::Ui;
16 19
17/* QT */ 20/* QT */
18#include <qlayout.h> 21#include <qlayout.h>
19#include <qlabel.h> 22#include <qlabel.h>
20#include <qmessagebox.h> 23#include <qmessagebox.h>
21#include <qfile.h> 24#include <qfile.h>
@@ -23,21 +26,16 @@
23/* STD */ 26/* STD */
24#include <sys/types.h> 27#include <sys/types.h>
25#include <sys/wait.h> 28#include <sys/wait.h>
26#include <unistd.h> 29#include <unistd.h>
27#include <signal.h> 30#include <signal.h>
28 31
29
30using namespace Opie::Core;
31
32
33/** 32/**
34 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. 33 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups.
35 * 34 *
36 */ 35 */
37using namespace Opie::Ui;
38UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) 36UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl)
39{ 37{
40 vm=viewmode; 38 vm=viewmode;
41 QVBoxLayout *layout = new QVBoxLayout(this); 39 QVBoxLayout *layout = new QVBoxLayout(this);
42 myTabWidget=new QTabWidget(this,"User Tab Widget"); 40 myTabWidget=new QTabWidget(this,"User Tab Widget");
43 layout->addWidget(myTabWidget); 41 layout->addWidget(myTabWidget);
@@ -242,13 +240,13 @@ bool UserDialog::addUser(int uid, int gid)
242 // Show the dialog! 240 // Show the dialog!
243 if(!(adduserDialog->exec())) return false; 241 if(!(adduserDialog->exec())) return false;
244 if((adduserDialog->groupComboBox->currentItem()!=0)) 242 if((adduserDialog->groupComboBox->currentItem()!=0))
245 { 243 {
246 accounts->findGroup(adduserDialog->groupComboBox->currentText()); 244 accounts->findGroup(adduserDialog->groupComboBox->currentText());
247 adduserDialog->groupID=accounts->gr_gid; 245 adduserDialog->groupID=accounts->gr_gid;
248 qWarning(QString::number(accounts->gr_gid)); 246 owarn << QString::number(accounts->gr_gid) << oendl;
249 } 247 }
250 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), 248 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(),
251 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), 249 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(),
252 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) 250 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText())))
253 { 251 {
254 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); 252 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user.");
@@ -371,13 +369,13 @@ bool UserDialog::editUser(const char *username)
371 QCheckListItem *temp; 369 QCheckListItem *temp;
372 // 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. 370 // 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.
373 QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant. 371 QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant.
374 QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. 372 QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of.
375 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) 373 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it)
376 { // Iterate over all of them. 374 { // Iterate over all of them.
377 qWarning(*it); 375 owarn << *it << oendl;
378 QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. 376 QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
379 for ( ; lvit.current(); ++lvit ) 377 for ( ; lvit.current(); ++lvit )
380 { 378 {
381 if(lvit.current()->text(0)==(*it).left((*it).find(":"))) 379 if(lvit.current()->text(0)==(*it).left((*it).find(":")))
382 { 380 {
383 temp=(QCheckListItem*)lvit.current(); 381 temp=(QCheckListItem*)lvit.current();
@@ -386,13 +384,13 @@ bool UserDialog::editUser(const char *username)
386 } 384 }
387 } 385 }
388 userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.) 386 userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.)
389 tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. 387 tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of.
390 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) 388 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it)
391 { // Iterate over all of them. 389 { // Iterate over all of them.
392 qWarning(*it); 390 owarn << *it << oendl;
393 QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. 391 QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
394 for ( ; lvit.current(); ++lvit ) 392 for ( ; lvit.current(); ++lvit )
395 { 393 {
396 if(lvit.current()->text(0)==(*it).left((*it).find(":"))) 394 if(lvit.current()->text(0)==(*it).left((*it).find(":")))
397 { 395 {
398 temp=(QCheckListItem*)lvit.current(); 396 temp=(QCheckListItem*)lvit.current();