summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/userdialog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 892fc8a..f31775d 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -1,319 +1,319 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
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 15
16#include <stdlib.h> 16#include <stdlib.h>
17 17
18#include <stdio.h> 18#include <stdio.h>
19#include <sys/types.h> 19#include <sys/types.h>
20#include <sys/wait.h> 20#include <sys/wait.h>
21#include <unistd.h> 21#include <unistd.h>
22#include <signal.h> 22#include <signal.h>
23 23
24#include "passwd.h" 24#include "passwd.h"
25 25
26/** 26/**
27 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. 27 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups.
28 * 28 *
29 */ 29 */
30UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { 30UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) {
31 QVBoxLayout *layout = new QVBoxLayout(this); 31 QVBoxLayout *layout = new QVBoxLayout(this);
32 myTabWidget=new QTabWidget(this,"User Tab Widget"); 32 myTabWidget=new QTabWidget(this,"User Tab Widget");
33 layout->addWidget(myTabWidget); 33 layout->addWidget(myTabWidget);
34 setupTab1(); 34 setupTab1();
35 setupTab2(); 35 setupTab2();
36 36
37 // And also fill the listview & the combobox with all available groups. 37 // And also fill the listview & the combobox with all available groups.
38 for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) { 38 for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) {
39 accounts->splitGroupEntry(*it); 39 accounts->splitGroupEntry(*it);
40 new QListViewItem(groupsListView,accounts->gr_name); 40 new QListViewItem(groupsListView,accounts->gr_name);
41 groupComboBox->insertItem(accounts->gr_name); 41 groupComboBox->insertItem(accounts->gr_name);
42 } 42 }
43 43
44 showMaximized(); 44 showMaximized();
45} 45}
46 46
47/** 47/**
48 * Empty destructor. 48 * Empty destructor.
49 * 49 *
50 */ 50 */
51UserDialog::~UserDialog() { 51UserDialog::~UserDialog() {
52} 52}
53 53
54/** 54/**
55 * Creates the first tab, all userinfo is here. 55 * Creates the first tab, all userinfo is here.
56 * 56 *
57 */ 57 */
58void UserDialog::setupTab1() { 58void UserDialog::setupTab1() {
59 QPixmap mypixmap; 59 QPixmap mypixmap;
60 QWidget *tabpage = new QWidget(myTabWidget,"page1"); 60 QWidget *tabpage = new QWidget(myTabWidget,"page1");
61 QVBoxLayout *layout = new QVBoxLayout(tabpage); 61 QVBoxLayout *layout = new QVBoxLayout(tabpage);
62 layout->setMargin(5); 62 layout->setMargin(5);
63 63
64 // Picture 64 // Picture
65 picturePushButton = new QPushButton(tabpage,"Label"); 65 picturePushButton = new QPushButton(tabpage,"Label");
66 picturePushButton->setMinimumSize(48,48); 66 picturePushButton->setMinimumSize(48,48);
67 picturePushButton->setMaximumSize(48,48); 67 picturePushButton->setMaximumSize(48,48);
68 picturePushButton->setPixmap(Resource::loadPixmap("userconfig/usericon"));// Load default usericon. 68 picturePushButton->setPixmap(Resource::loadPixmap("usermanager/usericon"));// Load default usericon.
69 connect(picturePushButton,SIGNAL(clicked()),this,SLOT(clickedPicture()));// Clicking the picture should invoke pictureselector. 69 connect(picturePushButton,SIGNAL(clicked()),this,SLOT(clickedPicture()));// Clicking the picture should invoke pictureselector.
70 70
71 // Login 71 // Login
72 QLabel *loginLabel=new QLabel(tabpage,"Login: "); 72 QLabel *loginLabel=new QLabel(tabpage,"Login: ");
73 loginLabel->setText("Login: "); 73 loginLabel->setText("Login: ");
74 loginLineEdit=new QLineEdit(tabpage,"Login: "); 74 loginLineEdit=new QLineEdit(tabpage,"Login: ");
75 75
76 // UID 76 // UID
77 QLabel *uidLabel=new QLabel(tabpage,"uid: "); 77 QLabel *uidLabel=new QLabel(tabpage,"uid: ");
78 uidLabel->setText("UserID: "); 78 uidLabel->setText("UserID: ");
79 uidLineEdit=new QLineEdit(tabpage,"uid: "); 79 uidLineEdit=new QLineEdit(tabpage,"uid: ");
80 uidLineEdit->setEnabled(false); 80 uidLineEdit->setEnabled(false);
81 81
82 // Username (gecos) 82 // Username (gecos)
83 QLabel *gecosLabel=new QLabel(tabpage,"gecos"); 83 QLabel *gecosLabel=new QLabel(tabpage,"gecos");
84 gecosLabel->setText("Username: "); 84 gecosLabel->setText("Username: ");
85 gecosLineEdit=new QLineEdit(tabpage,"gecos"); 85 gecosLineEdit=new QLineEdit(tabpage,"gecos");
86 86
87 // Password 87 // Password
88 QLabel *passwordLabel=new QLabel(tabpage,"password"); 88 QLabel *passwordLabel=new QLabel(tabpage,"password");
89 passwordLabel->setText("Password: "); 89 passwordLabel->setText("Password: ");
90 passwordLineEdit=new QLineEdit(tabpage,"password"); 90 passwordLineEdit=new QLineEdit(tabpage,"password");
91 passwordLineEdit->setEchoMode(QLineEdit::Password); 91 passwordLineEdit->setEchoMode(QLineEdit::Password);
92 92
93 // Shell 93 // Shell
94 QLabel *shellLabel=new QLabel(tabpage,"shell"); 94 QLabel *shellLabel=new QLabel(tabpage,"shell");
95 shellLabel->setText("Shell: "); 95 shellLabel->setText("Shell: ");
96 shellComboBox=new QComboBox(tabpage,"shell"); 96 shellComboBox=new QComboBox(tabpage,"shell");
97 shellComboBox->setEditable(true); 97 shellComboBox->setEditable(true);
98 shellComboBox->insertItem("/bin/sh"); 98 shellComboBox->insertItem("/bin/sh");
99 shellComboBox->insertItem("/bin/ash"); 99 shellComboBox->insertItem("/bin/ash");
100 shellComboBox->insertItem("/bin/false"); 100 shellComboBox->insertItem("/bin/false");
101 101
102 // Primary Group 102 // Primary Group
103 QLabel *groupLabel=new QLabel(tabpage,"group"); 103 QLabel *groupLabel=new QLabel(tabpage,"group");
104 groupLabel->setText("Primary group: "); 104 groupLabel->setText("Primary group: ");
105 groupComboBox=new QComboBox(tabpage,"PrimaryGroup"); 105 groupComboBox=new QComboBox(tabpage,"PrimaryGroup");
106 106
107 // Widget layout 107 // Widget layout
108 QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); 108 QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout");
109 layout->addWidget(picturePushButton); 109 layout->addWidget(picturePushButton);
110 layout->addSpacing(5); 110 layout->addSpacing(5);
111 layout->addLayout(hlayout); 111 layout->addLayout(hlayout);
112 QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1"); 112 QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1");
113 QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2"); 113 QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2");
114 // First column, labels 114 // First column, labels
115 vlayout1->addWidget(loginLabel); 115 vlayout1->addWidget(loginLabel);
116 vlayout1->addSpacing(5); 116 vlayout1->addSpacing(5);
117 vlayout1->addWidget(uidLabel); 117 vlayout1->addWidget(uidLabel);
118 vlayout1->addSpacing(5); 118 vlayout1->addSpacing(5);
119 vlayout1->addWidget(gecosLabel); 119 vlayout1->addWidget(gecosLabel);
120 vlayout1->addSpacing(5); 120 vlayout1->addSpacing(5);
121 vlayout1->addWidget(passwordLabel); 121 vlayout1->addWidget(passwordLabel);
122 vlayout1->addSpacing(5); 122 vlayout1->addSpacing(5);
123 vlayout1->addWidget(shellLabel); 123 vlayout1->addWidget(shellLabel);
124 vlayout1->addSpacing(5); 124 vlayout1->addSpacing(5);
125 vlayout1->addWidget(groupLabel); 125 vlayout1->addWidget(groupLabel);
126 // Second column, data 126 // Second column, data
127 vlayout2->addWidget(loginLineEdit); 127 vlayout2->addWidget(loginLineEdit);
128 vlayout2->addSpacing(5); 128 vlayout2->addSpacing(5);
129 vlayout2->addWidget(uidLineEdit); 129 vlayout2->addWidget(uidLineEdit);
130 vlayout2->addSpacing(5); 130 vlayout2->addSpacing(5);
131 vlayout2->addWidget(gecosLineEdit); 131 vlayout2->addWidget(gecosLineEdit);
132 vlayout2->addSpacing(5); 132 vlayout2->addSpacing(5);
133 vlayout2->addWidget(passwordLineEdit); 133 vlayout2->addWidget(passwordLineEdit);
134 vlayout2->addSpacing(5); 134 vlayout2->addSpacing(5);
135 vlayout2->addWidget(shellComboBox); 135 vlayout2->addWidget(shellComboBox);
136 vlayout2->addSpacing(5); 136 vlayout2->addSpacing(5);
137 vlayout2->addWidget(groupComboBox); 137 vlayout2->addWidget(groupComboBox);
138 hlayout->addLayout(vlayout1); 138 hlayout->addLayout(vlayout1);
139 hlayout->addLayout(vlayout2); 139 hlayout->addLayout(vlayout2);
140 140
141 myTabWidget->addTab(tabpage,"User Info"); 141 myTabWidget->addTab(tabpage,"User Info");
142} 142}
143 143
144/** 144/**
145 * Creates the second tab containing additional groups for the user. 145 * Creates the second tab containing additional groups for the user.
146 * 146 *
147 */ 147 */
148void UserDialog::setupTab2() { 148void UserDialog::setupTab2() {
149 QWidget *tabpage = new QWidget(myTabWidget,"page2"); 149 QWidget *tabpage = new QWidget(myTabWidget,"page2");
150 QVBoxLayout *layout = new QVBoxLayout(tabpage); 150 QVBoxLayout *layout = new QVBoxLayout(tabpage);
151 layout->setMargin(5); 151 layout->setMargin(5);
152 152
153 // Additional groups 153 // Additional groups
154 groupsListView=new QListView(tabpage,"groups"); 154 groupsListView=new QListView(tabpage,"groups");
155 groupsListView->addColumn("Additional groups"); 155 groupsListView->addColumn("Additional groups");
156 groupsListView->setColumnWidthMode(0,QListView::Maximum); 156 groupsListView->setColumnWidthMode(0,QListView::Maximum);
157 groupsListView->setMultiSelection(true); 157 groupsListView->setMultiSelection(true);
158 158
159 layout->addSpacing(5); 159 layout->addSpacing(5);
160 // Grouplist 160 // Grouplist
161 layout->addWidget(groupsListView); 161 layout->addWidget(groupsListView);
162 162
163 myTabWidget->addTab(tabpage,"User Groups"); 163 myTabWidget->addTab(tabpage,"User Groups");
164} 164}
165 165
166/** 166/**
167 * Static function that creates the userinfo dialog. 167 * Static function that creates the userinfo dialog.
168 * The user will be prompted to add a user. 168 * The user will be prompted to add a user.
169 * 169 *
170 * @param uid This is a suggested available UID. 170 * @param uid This is a suggested available UID.
171 * @param gid This is a suggested available GID. 171 * @param gid This is a suggested available GID.
172 * 172 *
173 * @return <code>true</code> if the user was successfully added, otherwise <code>false</code>. 173 * @return <code>true</code> if the user was successfully added, otherwise <code>false</code>.
174 * 174 *
175 */ 175 */
176bool UserDialog::addUser(int uid, int gid) { 176bool UserDialog::addUser(int uid, int gid) {
177 UserDialog *adduserDialog=new UserDialog(); 177 UserDialog *adduserDialog=new UserDialog();
178 adduserDialog->setCaption(tr("Add User")); 178 adduserDialog->setCaption(tr("Add User"));
179 adduserDialog->userID=uid;// Set next available UID as default uid. 179 adduserDialog->userID=uid;// Set next available UID as default uid.
180 adduserDialog->groupID=gid;// Set next available GID as default gid. 180 adduserDialog->groupID=gid;// Set next available GID as default gid.
181 // Insert default group into groupComboBox 181 // Insert default group into groupComboBox
182 adduserDialog->groupComboBox->insertItem("<create new group>",0); 182 adduserDialog->groupComboBox->insertItem("<create new group>",0);
183 adduserDialog->uidLineEdit->setText(QString::number(uid)); 183 adduserDialog->uidLineEdit->setText(QString::number(uid));
184 // Show the dialog! 184 // Show the dialog!
185 if(!(adduserDialog->exec())) return false; 185 if(!(adduserDialog->exec())) return false;
186 if((adduserDialog->groupComboBox->currentItem()!=0)) { 186 if((adduserDialog->groupComboBox->currentItem()!=0)) {
187 accounts->findGroup(adduserDialog->groupComboBox->currentText()); 187 accounts->findGroup(adduserDialog->groupComboBox->currentText());
188 adduserDialog->groupID=accounts->gr_gid; 188 adduserDialog->groupID=accounts->gr_gid;
189 qWarning(QString::number(accounts->gr_gid)); 189 qWarning(QString::number(accounts->gr_gid));
190 } 190 }
191 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), 191 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(),
192 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), 192 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(),
193 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) { 193 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) {
194 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); 194 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user.");
195 return false; 195 return false;
196 } 196 }
197 197
198 // Add User to additional groups. 198 // Add User to additional groups.
199 QListViewItemIterator it( adduserDialog->groupsListView ); 199 QListViewItemIterator it( adduserDialog->groupsListView );
200 for ( ; it.current(); ++it ) { 200 for ( ; it.current(); ++it ) {
201 if ( it.current()->isSelected() ) 201 if ( it.current()->isSelected() )
202 accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); 202 accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text());
203 } 203 }
204 return true; 204 return true;
205} 205}
206 206
207/** 207/**
208 * Deletes the user account. 208 * Deletes the user account.
209 * 209 *
210 * @param username User to be deleted. 210 * @param username User to be deleted.
211 * 211 *
212 * @return <code>true</code> if the user was successfully deleted, otherwise <code>false</code>. 212 * @return <code>true</code> if the user was successfully deleted, otherwise <code>false</code>.
213 * 213 *
214 */ 214 */
215bool UserDialog::delUser(const char *username) { 215bool UserDialog::delUser(const char *username) {
216 if((accounts->findUser(username))) {// Does that user exist? 216 if((accounts->findUser(username))) {// Does that user exist?
217 if(!(accounts->delUser(username))) {// Delete the user. 217 if(!(accounts->delUser(username))) {// Delete the user.
218 QMessageBox::information(0,"Ooops!","Something went wrong\nUnable to delete user: "+QString(username)+"."); 218 QMessageBox::information(0,"Ooops!","Something went wrong\nUnable to delete user: "+QString(username)+".");
219 } 219 }
220 } else { 220 } else {
221 QMessageBox::information(0,"Invalid Username","That username ("+QString(username)+")does not exist."); 221 QMessageBox::information(0,"Invalid Username","That username ("+QString(username)+")does not exist.");
222 return false; 222 return false;
223 } 223 }
224 return true; 224 return true;
225} 225}
226 226
227/** 227/**
228 * This displays a confirmation dialog wether a user should be deleted or not. 228 * This displays a confirmation dialog wether a user should be deleted or not.
229 * (And also deletes the account) 229 * (And also deletes the account)
230 * 230 *
231 * @param username User to be deleted. 231 * @param username User to be deleted.
232 * 232 *
233 * @return <code>true</code> if the user was successfully deleted, otherwise <code>false</code>. 233 * @return <code>true</code> if the user was successfully deleted, otherwise <code>false</code>.
234 * 234 *
235 */ 235 */
236bool UserDialog::editUser(const char *username) { 236bool UserDialog::editUser(const char *username) {
237 UserDialog *edituserDialog=new UserDialog();// Create Dialog 237 UserDialog *edituserDialog=new UserDialog();// Create Dialog
238 edituserDialog->setCaption(tr("Edit User")); 238 edituserDialog->setCaption(tr("Edit User"));
239 accounts->findUser(username);// Locate user in database and fill variables in 'accounts' object. 239 accounts->findUser(username);// Locate user in database and fill variables in 'accounts' object.
240 accounts->findGroup(accounts->pw_gid);// Locate the user's primary group, and fill group variables in 'accounts' object. 240 accounts->findGroup(accounts->pw_gid);// Locate the user's primary group, and fill group variables in 'accounts' object.
241 // Fill widgets with userinfo. 241 // Fill widgets with userinfo.
242 edituserDialog->loginLineEdit->setText(accounts->pw_name); 242 edituserDialog->loginLineEdit->setText(accounts->pw_name);
243 edituserDialog->uidLineEdit->setText(QString::number(accounts->pw_uid)); 243 edituserDialog->uidLineEdit->setText(QString::number(accounts->pw_uid));
244 edituserDialog->gecosLineEdit->setText(accounts->pw_gecos); 244 edituserDialog->gecosLineEdit->setText(accounts->pw_gecos);
245 // Set password to '........', we will later check if this still is the contents, if not, the password has been changed. 245 // Set password to '........', we will later check if this still is the contents, if not, the password has been changed.
246 edituserDialog->passwordLineEdit->setText("........"); 246 edituserDialog->passwordLineEdit->setText("........");
247 // If this user is not using /bin/sh,/bin/ash or /bin/false as shell, add that entry to the shell-combobox. 247 // If this user is not using /bin/sh,/bin/ash or /bin/false as shell, add that entry to the shell-combobox.
248 if(accounts->pw_shell!="/bin/sh" && accounts->pw_shell!="/bin/ash" && accounts->pw_shell!="/bin/false") { 248 if(accounts->pw_shell!="/bin/sh" && accounts->pw_shell!="/bin/ash" && accounts->pw_shell!="/bin/false") {
249 edituserDialog->shellComboBox->insertItem(accounts->pw_shell,0); 249 edituserDialog->shellComboBox->insertItem(accounts->pw_shell,0);
250 edituserDialog->shellComboBox->setCurrentItem(0); 250 edituserDialog->shellComboBox->setCurrentItem(0);
251 } 251 }
252 // Select the primary group for this user. 252 // Select the primary group for this user.
253 for(int i=0;i<edituserDialog->groupComboBox->count();++i) { 253 for(int i=0;i<edituserDialog->groupComboBox->count();++i) {
254 if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) { 254 if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) {
255 edituserDialog->groupComboBox->setCurrentItem(i); 255 edituserDialog->groupComboBox->setCurrentItem(i);
256 } 256 }
257 } 257 }
258 // Select the groups in the listview, to which the user belongs. 258 // Select the groups in the listview, to which the user belongs.
259 QRegExp userRegExp(QString("[:\\s]%1\\s").arg(username)); 259 QRegExp userRegExp(QString("[:\\s]%1\\s").arg(username));
260 QStringList tempList=accounts->groupStringList.grep(userRegExp);// Find all entries in the group database, that the user is a member of. 260 QStringList tempList=accounts->groupStringList.grep(userRegExp);// Find all entries in the group database, that the user is a member of.
261 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) {// Iterate over all of them. 261 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) {// Iterate over all of them.
262 QListViewItemIterator lvit( edituserDialog->groupsListView );// Compare to all groups. 262 QListViewItemIterator lvit( edituserDialog->groupsListView );// Compare to all groups.
263 for ( ; lvit.current(); ++lvit ) { 263 for ( ; lvit.current(); ++lvit ) {
264 if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { 264 if(lvit.current()->text(0)==(*it).left((*it).find(":"))) {
265 lvit.current()->setSelected(true);// If we find a line with that groupname, select it.; 265 lvit.current()->setSelected(true);// If we find a line with that groupname, select it.;
266 } 266 }
267 } 267 }
268 } 268 }
269 269
270 if(!(edituserDialog->exec())) return false;// SHOW THE DIALOG! 270 if(!(edituserDialog->exec())) return false;// SHOW THE DIALOG!
271 271
272 accounts->findUser(username);// Fill user variables in 'acccounts' object. 272 accounts->findUser(username);// Fill user variables in 'acccounts' object.
273 accounts->pw_name=edituserDialog->loginLineEdit->text(); 273 accounts->pw_name=edituserDialog->loginLineEdit->text();
274 // Has the password been changed ? Make a new "crypt":ed password. 274 // Has the password been changed ? Make a new "crypt":ed password.
275 if(edituserDialog->passwordLineEdit->text()!="........") accounts->pw_passwd=crypt(edituserDialog->passwordLineEdit->text(), accounts->crypt_make_salt()); 275 if(edituserDialog->passwordLineEdit->text()!="........") accounts->pw_passwd=crypt(edituserDialog->passwordLineEdit->text(), accounts->crypt_make_salt());
276 276
277 // Set all variables in accounts object, that will be used when calling 'updateUser()' 277 // Set all variables in accounts object, that will be used when calling 'updateUser()'
278 accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt(); 278 accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt();
279 accounts->findGroup(edituserDialog->groupComboBox->currentText());// Fill all group variables in 'accounts' object. 279 accounts->findGroup(edituserDialog->groupComboBox->currentText());// Fill all group variables in 'accounts' object.
280 accounts->pw_gid=accounts->gr_gid; 280 accounts->pw_gid=accounts->gr_gid;
281 accounts->pw_gecos=edituserDialog->gecosLineEdit->text(); 281 accounts->pw_gecos=edituserDialog->gecosLineEdit->text();
282 accounts->pw_shell=edituserDialog->shellComboBox->currentText(); 282 accounts->pw_shell=edituserDialog->shellComboBox->currentText();
283 // Update userinfo, using the information stored in the user variables stored in the accounts object. 283 // Update userinfo, using the information stored in the user variables stored in the accounts object.
284 accounts->updateUser(username); 284 accounts->updateUser(username);
285 285
286 // Remove user from all groups he/she is a member of. (could be done in a better way I guess, this was simple though.) 286 // Remove user from all groups he/she is a member of. (could be done in a better way I guess, this was simple though.)
287 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { 287 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) {
288 accounts->delGroupMember((*it).left((*it).find(":")),username); 288 accounts->delGroupMember((*it).left((*it).find(":")),username);
289 } 289 }
290 290
291 // Add User to additional groups that he/she is a member of. 291 // Add User to additional groups that he/she is a member of.
292 QListViewItemIterator it( edituserDialog->groupsListView ); 292 QListViewItemIterator it( edituserDialog->groupsListView );
293 for ( ; it.current(); ++it ) { 293 for ( ; it.current(); ++it ) {
294 if ( it.current()->isSelected() ) 294 if ( it.current()->isSelected() )
295 accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text()); 295 accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text());
296 } 296 }
297 return true; 297 return true;
298} 298}
299 299
300/** 300/**
301 * "OK" has been clicked. Verify some information before closing the dialog. 301 * "OK" has been clicked. Verify some information before closing the dialog.
302 * 302 *
303 */ 303 */
304void UserDialog::accept() { 304void UserDialog::accept() {
305 // Add checking... valid username? username taken? 305 // Add checking... valid username? username taken?
306 if(loginLineEdit->text().isEmpty()) { 306 if(loginLineEdit->text().isEmpty()) {
307 QMessageBox::information(0,"Empty Login","Please enter a login."); 307 QMessageBox::information(0,"Empty Login","Please enter a login.");
308 return; 308 return;
309 } 309 }
310 QDialog::accept(); 310 QDialog::accept();
311} 311}
312 312
313/** 313/**
314 * This slot is called when the usericon is clicked, this loads (should) the iconselector. 314 * This slot is called when the usericon is clicked, this loads (should) the iconselector.
315 * 315 *
316 */ 316 */
317void UserDialog::clickedPicture() { 317void UserDialog::clickedPicture() {
318 QMessageBox::information(0,"Sorry!","Icon selection not yet implemented.\nComming real soon now! (tm)"); 318 QMessageBox::information(0,"Sorry!","Icon selection not yet implemented.\nComming real soon now! (tm)");
319} 319}