summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/userdialog.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 42a9144..36bcf86 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -3,48 +3,52 @@
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10#include "userdialog.h" 10#include "userdialog.h"
11 11
12#include <qlayout.h> 12#include <qlayout.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15#include <qfile.h> 15#include <qfile.h>
16 16
17#include <stdlib.h> 17#include <stdlib.h>
18 18
19#include <stdio.h> 19#include <stdio.h>
20#include <sys/types.h> 20#include <sys/types.h>
21#include <sys/wait.h> 21#include <sys/wait.h>
22#include <unistd.h> 22#include <unistd.h>
23#include <signal.h> 23#include <signal.h>
24 24
25#include "passwd.h" 25#include "passwd.h"
26 26
27#include <opie/odevice.h>
28using namespace Opie;
29
30
27/** 31/**
28 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. 32 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups.
29 * 33 *
30 */ 34 */
31UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { 35UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) {
32 QVBoxLayout *layout = new QVBoxLayout(this); 36 QVBoxLayout *layout = new QVBoxLayout(this);
33 myTabWidget=new QTabWidget(this,"User Tab Widget"); 37 myTabWidget=new QTabWidget(this,"User Tab Widget");
34 layout->addWidget(myTabWidget); 38 layout->addWidget(myTabWidget);
35 setupTab1(); 39 setupTab1();
36 setupTab2(); 40 setupTab2();
37 41
38 accounts->groupStringList.sort(); 42 accounts->groupStringList.sort();
39 // And also fill the listview & the combobox with all available groups. 43 // And also fill the listview & the combobox with all available groups.
40 for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) { 44 for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) {
41 accounts->splitGroupEntry(*it); 45 accounts->splitGroupEntry(*it);
42 new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox); 46 new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
43 groupComboBox->insertItem(accounts->gr_name); 47 groupComboBox->insertItem(accounts->gr_name);
44 } 48 }
45 showMaximized(); 49 showMaximized();
46} 50}
47 51
48/** 52/**
49 * Empty destructor. 53 * Empty destructor.
50 * 54 *
@@ -169,49 +173,50 @@ void UserDialog::setupTab2() {
169 groupsListView->setColumnWidthMode(0,QListView::Maximum); 173 groupsListView->setColumnWidthMode(0,QListView::Maximum);
170 groupsListView->setMultiSelection(false); 174 groupsListView->setMultiSelection(false);
171 groupsListView->setAllColumnsShowFocus(false); 175 groupsListView->setAllColumnsShowFocus(false);
172 176
173 layout->addSpacing(5); 177 layout->addSpacing(5);
174 // Grouplist 178 // Grouplist
175 layout->addWidget(groupsListView); 179 layout->addWidget(groupsListView);
176 180
177 myTabWidget->addTab(tabpage,"User Groups"); 181 myTabWidget->addTab(tabpage,"User Groups");
178} 182}
179 183
180/** 184/**
181 * Static function that creates the userinfo dialog. 185 * Static function that creates the userinfo dialog.
182 * The user will be prompted to add a user. 186 * The user will be prompted to add a user.
183 * 187 *
184 * @param uid This is a suggested available UID. 188 * @param uid This is a suggested available UID.
185 * @param gid This is a suggested available GID. 189 * @param gid This is a suggested available GID.
186 * 190 *
187 * @return <code>true</code> if the user was successfully added, otherwise <code>false</code>. 191 * @return <code>true</code> if the user was successfully added, otherwise <code>false</code>.
188 * 192 *
189 */ 193 */
190bool UserDialog::addUser(int uid, int gid) { 194bool UserDialog::addUser(int uid, int gid) {
191 QCheckListItem *temp; 195 QCheckListItem *temp;
192 QFile ozTest; 196 QFile ozTest;
193 int oz=ozTest.exists("/etc/oz_version"); 197 int oz=false;
198 if(ODevice::inst()->system()==System_OpenZaurus) oz=true;
194 UserDialog *adduserDialog=new UserDialog(); 199 UserDialog *adduserDialog=new UserDialog();
195 adduserDialog->setCaption(tr("Add User")); 200 adduserDialog->setCaption(tr("Add User"));
196 adduserDialog->userID=uid;// Set next available UID as default uid. 201 adduserDialog->userID=uid;// Set next available UID as default uid.
197 adduserDialog->groupID=gid;// Set next available GID as default gid. 202 adduserDialog->groupID=gid;// Set next available GID as default gid.
198 // Insert default group into groupComboBox 203 // Insert default group into groupComboBox
199 adduserDialog->groupComboBox->insertItem("<create new group>",0); 204 adduserDialog->groupComboBox->insertItem("<create new group>",0);
200 adduserDialog->uidLineEdit->setText(QString::number(uid)); 205 adduserDialog->uidLineEdit->setText(QString::number(uid));
201 // If we're running on OZ, add new users to some default groups. 206 // If we're running on OZ, add new users to some default groups.
202 if(oz) { 207 if(oz) {
203 QListViewItemIterator iter( adduserDialog->groupsListView ); 208 QListViewItemIterator iter( adduserDialog->groupsListView );
204 for ( ; iter.current(); ++iter ) { 209 for ( ; iter.current(); ++iter ) {
205 temp=(QCheckListItem*)iter.current(); 210 temp=(QCheckListItem*)iter.current();
206 if (temp->text()=="video") temp->setOn(true); 211 if (temp->text()=="video") temp->setOn(true);
207 if (temp->text()=="audio") temp->setOn(true); 212 if (temp->text()=="audio") temp->setOn(true);
208 if (temp->text()=="time") temp->setOn(true); 213 if (temp->text()=="time") temp->setOn(true);
209 if (temp->text()=="power") temp->setOn(true); 214 if (temp->text()=="power") temp->setOn(true);
210 if (temp->text()=="input") temp->setOn(true); 215 if (temp->text()=="input") temp->setOn(true);
211 if (temp->text()=="sharp") temp->setOn(true); 216 if (temp->text()=="sharp") temp->setOn(true);
212 if (temp->text()=="tty") temp->setOn(true); 217 if (temp->text()=="tty") temp->setOn(true);
213 } 218 }
214 } 219 }
215 // Show the dialog! 220 // Show the dialog!
216 if(!(adduserDialog->exec())) return false; 221 if(!(adduserDialog->exec())) return false;
217 if((adduserDialog->groupComboBox->currentItem()!=0)) { 222 if((adduserDialog->groupComboBox->currentItem()!=0)) {