Diffstat (limited to 'noncore/settings/usermanager/userdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index 36bcf86..c82cc9d 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp | |||
@@ -32,7 +32,8 @@ using namespace Opie; | |||
32 | * 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. |
33 | * | 33 | * |
34 | */ | 34 | */ |
35 | UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { | 35 | UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { |
36 | vm=viewmode; | ||
36 | QVBoxLayout *layout = new QVBoxLayout(this); | 37 | QVBoxLayout *layout = new QVBoxLayout(this); |
37 | myTabWidget=new QTabWidget(this,"User Tab Widget"); | 38 | myTabWidget=new QTabWidget(this,"User Tab Widget"); |
38 | layout->addWidget(myTabWidget); | 39 | layout->addWidget(myTabWidget); |
@@ -109,13 +110,13 @@ void UserDialog::setupTab1() { | |||
109 | groupLabel->setText("Primary group: "); | 110 | groupLabel->setText("Primary group: "); |
110 | groupComboBox=new QComboBox(tabpage,"PrimaryGroup"); | 111 | groupComboBox=new QComboBox(tabpage,"PrimaryGroup"); |
111 | 112 | ||
112 | // Copy /etc/skel | 113 | if(vm==VIEWMODE_NEW) { |
113 | QLabel *skelLabel=new QLabel(tabpage,"skel"); | 114 | // Copy /etc/skel |
114 | skelLabel->setText("Copy /etc/skel: "); | 115 | skelLabel=new QLabel(tabpage,"skel"); |
115 | skelCheckBox=new QCheckBox(tabpage); | 116 | skelLabel->setText("Copy /etc/skel: "); |
116 | skelCheckBox->setChecked(true); | 117 | skelCheckBox=new QCheckBox(tabpage); |
117 | //skelLabel->setDisabled(true); | 118 | skelCheckBox->setChecked(true); |
118 | //skelCheckBox->setDisabled(true); | 119 | } |
119 | 120 | ||
120 | // Widget layout | 121 | // Widget layout |
121 | QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); | 122 | QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); |
@@ -136,8 +137,10 @@ void UserDialog::setupTab1() { | |||
136 | vlayout1->addWidget(shellLabel); | 137 | vlayout1->addWidget(shellLabel); |
137 | vlayout1->addSpacing(5); | 138 | vlayout1->addSpacing(5); |
138 | vlayout1->addWidget(groupLabel); | 139 | vlayout1->addWidget(groupLabel); |
139 | vlayout1->addSpacing(5); | 140 | if(vm==VIEWMODE_NEW) { |
140 | vlayout1->addWidget(skelLabel); | 141 | vlayout1->addSpacing(5); |
142 | vlayout1->addWidget(skelLabel); | ||
143 | } | ||
141 | // Second column, data | 144 | // Second column, data |
142 | vlayout2->addWidget(loginLineEdit); | 145 | vlayout2->addWidget(loginLineEdit); |
143 | vlayout2->addSpacing(5); | 146 | vlayout2->addSpacing(5); |
@@ -150,8 +153,10 @@ void UserDialog::setupTab1() { | |||
150 | vlayout2->addWidget(shellComboBox); | 153 | vlayout2->addWidget(shellComboBox); |
151 | vlayout2->addSpacing(5); | 154 | vlayout2->addSpacing(5); |
152 | vlayout2->addWidget(groupComboBox); | 155 | vlayout2->addWidget(groupComboBox); |
153 | vlayout2->addSpacing(5); | 156 | if(vm==VIEWMODE_NEW) { |
154 | vlayout2->addWidget(skelCheckBox); | 157 | vlayout2->addSpacing(5); |
158 | vlayout2->addWidget(skelCheckBox); | ||
159 | } | ||
155 | hlayout->addLayout(vlayout1); | 160 | hlayout->addLayout(vlayout1); |
156 | hlayout->addLayout(vlayout2); | 161 | hlayout->addLayout(vlayout2); |
157 | 162 | ||
@@ -196,7 +201,8 @@ bool UserDialog::addUser(int uid, int gid) { | |||
196 | QFile ozTest; | 201 | QFile ozTest; |
197 | int oz=false; | 202 | int oz=false; |
198 | if(ODevice::inst()->system()==System_OpenZaurus) oz=true; | 203 | if(ODevice::inst()->system()==System_OpenZaurus) oz=true; |
199 | UserDialog *adduserDialog=new UserDialog(); | 204 | // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating adduserDialog's widgets here. |
205 | UserDialog *adduserDialog=new UserDialog(VIEWMODE_NEW); | ||
200 | adduserDialog->setCaption(tr("Add User")); | 206 | adduserDialog->setCaption(tr("Add User")); |
201 | adduserDialog->userID=uid;// Set next available UID as default uid. | 207 | adduserDialog->userID=uid;// Set next available UID as default uid. |
202 | adduserDialog->groupID=gid;// Set next available GID as default gid. | 208 | adduserDialog->groupID=gid;// Set next available GID as default gid. |
@@ -298,7 +304,8 @@ bool UserDialog::delUser(const char *username) { | |||
298 | */ | 304 | */ |
299 | bool UserDialog::editUser(const char *username) { | 305 | bool UserDialog::editUser(const char *username) { |
300 | int invalid_group=0; | 306 | int invalid_group=0; |
301 | UserDialog *edituserDialog=new UserDialog();// Create Dialog | 307 | // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating edituserDialog's widgets here. |
308 | UserDialog *edituserDialog=new UserDialog(VIEWMODE_EDIT);// Create Dialog | ||
302 | edituserDialog->setCaption(tr("Edit User")); | 309 | edituserDialog->setCaption(tr("Edit User")); |
303 | accounts->findUser(username);// Locate user in database and fill variables in 'accounts' object. | 310 | accounts->findUser(username);// Locate user in database and fill variables in 'accounts' object. |
304 | if(!(accounts->findGroup(accounts->pw_gid))) {// Locate the user's primary group, and fill group variables in 'accounts' object. | 311 | if(!(accounts->findGroup(accounts->pw_gid))) {// Locate the user's primary group, and fill group variables in 'accounts' object. |