-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index 90e27d5..c43b391 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp @@ -9,12 +9,13 @@ #include "userdialog.h" #include <qlayout.h> #include <qlabel.h> #include <qmessagebox.h> +#include <qfile.h> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> @@ -184,19 +185,36 @@ void UserDialog::setupTab2() { * @param gid This is a suggested available GID. * * @return <code>true</code> if the user was successfully added, otherwise <code>false</code>. * */ bool UserDialog::addUser(int uid, int gid) { + QCheckListItem *temp; + QFile ozTest; + int oz=ozTest.exists("/etc/oz_version"); UserDialog *adduserDialog=new UserDialog(); adduserDialog->setCaption(tr("Add User")); adduserDialog->userID=uid; // Set next available UID as default uid. adduserDialog->groupID=gid; // Set next available GID as default gid. // Insert default group into groupComboBox adduserDialog->groupComboBox->insertItem("<create new group>",0); adduserDialog->uidLineEdit->setText(QString::number(uid)); + // If we're running on OZ, add new users to some default groups. + if(oz) { + QListViewItemIterator iter( adduserDialog->groupsListView ); + for ( ; iter.current(); ++iter ) { + temp=(QCheckListItem*)iter.current(); + if (temp->text()=="video") temp->setOn(true); + if (temp->text()=="audio") temp->setOn(true); + if (temp->text()=="time") temp->setOn(true); + if (temp->text()=="power") temp->setOn(true); + if (temp->text()=="input") temp->setOn(true); + if (temp->text()=="sharp") temp->setOn(true); + if (temp->text()=="tty") temp->setOn(true); + } + } // Show the dialog! if(!(adduserDialog->exec())) return false; if((adduserDialog->groupComboBox->currentItem()!=0)) { accounts->findGroup(adduserDialog->groupComboBox->currentText()); adduserDialog->groupID=accounts->gr_gid; qWarning(QString::number(accounts->gr_gid)); @@ -206,17 +224,16 @@ bool UserDialog::addUser(int uid, int gid) { QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) { QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); return false; } // Add User to additional groups. - QCheckListItem *temp; QListViewItemIterator it( adduserDialog->groupsListView ); for ( ; it.current(); ++it ) { - temp=(QCheckListItem*)it.current(); - if (temp->isOn() ) + temp=(QCheckListItem*)it.current(); + if (temp->isOn() ) accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); } // Copy image to pics/users/ if(!(adduserDialog->userImage.isNull())) { QDir d; if(!(d.exists("/opt/QtPalmtop/pics/users"))) { |