summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2002-09-28 22:30:24 (UTC)
committer umopapisdn <umopapisdn>2002-09-28 22:30:24 (UTC)
commit551661da944e2b93cff73317d6fb6eaffe5f7102 (patch) (unidiff)
tree29f415d63bad6727920e392efc3dfe201da80bb5
parentaa347496d408431d85ff2d7a2cf60479407620af (diff)
downloadopie-551661da944e2b93cff73317d6fb6eaffe5f7102.zip
opie-551661da944e2b93cff73317d6fb6eaffe5f7102.tar.gz
opie-551661da944e2b93cff73317d6fb6eaffe5f7102.tar.bz2
User icons can be selected.
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 c6b8a57..719dd1e 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -281,74 +281,74 @@ bool UserDialog::editUser(const char *username) {
281 281
282 if(!(edituserDialog->exec())) return false;// SHOW THE DIALOG! 282 if(!(edituserDialog->exec())) return false;// SHOW THE DIALOG!
283 283
284 accounts->findUser(username);// Fill user variables in 'acccounts' object. 284 accounts->findUser(username);// Fill user variables in 'acccounts' object.
285 accounts->pw_name=edituserDialog->loginLineEdit->text(); 285 accounts->pw_name=edituserDialog->loginLineEdit->text();
286 // Has the password been changed ? Make a new "crypt":ed password. 286 // Has the password been changed ? Make a new "crypt":ed password.
287 if(edituserDialog->passwordLineEdit->text()!="........") accounts->pw_passwd=crypt(edituserDialog->passwordLineEdit->text(), accounts->crypt_make_salt()); 287 if(edituserDialog->passwordLineEdit->text()!="........") accounts->pw_passwd=crypt(edituserDialog->passwordLineEdit->text(), accounts->crypt_make_salt());
288 288
289 // Set all variables in accounts object, that will be used when calling 'updateUser()' 289 // Set all variables in accounts object, that will be used when calling 'updateUser()'
290 accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt(); 290 accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt();
291 accounts->findGroup(edituserDialog->groupComboBox->currentText());// Fill all group variables in 'accounts' object. 291 accounts->findGroup(edituserDialog->groupComboBox->currentText());// Fill all group variables in 'accounts' object.
292 accounts->pw_gid=accounts->gr_gid; 292 accounts->pw_gid=accounts->gr_gid;
293 accounts->pw_gecos=edituserDialog->gecosLineEdit->text(); 293 accounts->pw_gecos=edituserDialog->gecosLineEdit->text();
294 accounts->pw_shell=edituserDialog->shellComboBox->currentText(); 294 accounts->pw_shell=edituserDialog->shellComboBox->currentText();
295 // Update userinfo, using the information stored in the user variables stored in the accounts object. 295 // Update userinfo, using the information stored in the user variables stored in the accounts object.
296 accounts->updateUser(username); 296 accounts->updateUser(username);
297 297
298 // Remove user from all groups he/she is a member of. (could be done in a better way I guess, this was simple though.) 298 // Remove user from all groups he/she is a member of. (could be done in a better way I guess, this was simple though.)
299 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { 299 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) {
300 accounts->delGroupMember((*it).left((*it).find(":")),username); 300 accounts->delGroupMember((*it).left((*it).find(":")),username);
301 } 301 }
302 302
303 // Add User to additional groups that he/she is a member of. 303 // Add User to additional groups that he/she is a member of.
304 QListViewItemIterator it( edituserDialog->groupsListView ); 304 QListViewItemIterator it( edituserDialog->groupsListView );
305 for ( ; it.current(); ++it ) { 305 for ( ; it.current(); ++it ) {
306 if ( it.current()->isSelected() ) 306 if ( it.current()->isSelected() )
307 accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text()); 307 accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text());
308 } 308 }
309 309
310 // Copy image to pics/users/ 310 // Copy image to pics/users/
311 if(!(edituserDialog->userImage.isNull())) { 311 if(!(edituserDialog->userImage.isNull())) {
312 QDir d; 312 QDir d;
313 if(!(d.exists("/opt/QtPalmtop/pics/users"))) { 313 if(!(d.exists("/opt/QtPalmtop/pics/users"))) {
314 d.mkdir("/opt/QtPalmtop/pics/users"); 314 d.mkdir("/opt/QtPalmtop/pics/users");
315 } 315 }
316 QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; 316 QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png";
317 edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48); 317 edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48);
318 edituserDialog->userImage.save(filename,"PNG"); 318 edituserDialog->userImage.save(filename,"PNG");
319 } 319 }
320 return true; 320 return true;
321} 321}
322 322
323/** 323/**
324 * "OK" has been clicked. Verify some information before closing the dialog. 324 * "OK" has been clicked. Verify some information before closing the dialog.
325 * 325 *
326 */ 326 */
327void UserDialog::accept() { 327void UserDialog::accept() {
328 // Add checking... valid username? username taken? 328 // Add checking... valid username? username taken?
329 if(loginLineEdit->text().isEmpty()) { 329 if(loginLineEdit->text().isEmpty()) {
330 QMessageBox::information(0,"Empty Login","Please enter a login."); 330 QMessageBox::information(0,"Empty Login","Please enter a login.");
331 return; 331 return;
332 } 332 }
333 QDialog::accept(); 333 QDialog::accept();
334} 334}
335 335
336/** 336/**
337 * This slot is called when the usericon is clicked, this loads (should) the iconselector. 337 * This slot is called when the usericon is clicked, this loads (should) the iconselector.
338 * 338 *
339 */ 339 */
340void UserDialog::clickedPicture() { 340void UserDialog::clickedPicture() {
341 QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED,"/opt/QtPalmtop/pics"); 341 QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED,"/opt/QtPalmtop/pics");
342 if(!(filename.isEmpty())) { 342 if(!(filename.isEmpty())) {
343 userImage.reset(); 343 userImage.reset();
344 if(!(userImage.load(filename))) { 344 if(!(userImage.load(filename))) {
345 QMessageBox::information(0,"Sorry!","Icon selection not yet implemented.\nComming real soon now! (tm)\n"+filename); 345 QMessageBox::information(0,"Sorry!","That icon could not be loaded.\nLoading failed on: "+filename);
346 } else { 346 } else {
347 userImage=userImage.smoothScale(48,48); 347 userImage=userImage.smoothScale(48,48);
348 QPixmap *picture; 348 QPixmap *picture;
349 picture=(QPixmap *)picturePushButton->pixmap(); 349 picture=(QPixmap *)picturePushButton->pixmap();
350 picture->convertFromImage(userImage,0); 350 picture->convertFromImage(userImage,0);
351 picturePushButton->update(); 351 picturePushButton->update();
352 } 352 }
353 } 353 }
354} 354}