-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 37 | ||||
-rw-r--r-- | noncore/settings/usermanager/userdialog.h | 1 | ||||
-rw-r--r-- | noncore/settings/usermanager/usermanager.cpp | 7 |
3 files changed, 39 insertions, 6 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index 6940a3b..c6b8a57 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp @@ -205,2 +205,12 @@ bool UserDialog::addUser(int uid, int gid) { } + // Copy image to pics/users/ + if(!(adduserDialog->userImage.isNull())) { + QDir d; + if(!(d.exists("/opt/QtPalmtop/pics/users"))) { + d.mkdir("/opt/QtPalmtop/pics/users"); + } + QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; + adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); + adduserDialog->userImage.save(filename,"PNG"); + } return true; @@ -298,2 +308,13 @@ bool UserDialog::editUser(const char *username) { } + + // Copy image to pics/users/ + if(!(edituserDialog->userImage.isNull())) { + QDir d; + if(!(d.exists("/opt/QtPalmtop/pics/users"))) { + d.mkdir("/opt/QtPalmtop/pics/users"); + } + QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; + edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48); + edituserDialog->userImage.save(filename,"PNG"); + } return true; @@ -320,6 +341,14 @@ void UserDialog::clickedPicture() { QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED,"/opt/QtPalmtop/pics"); - // OFileDialog *fd=new OFileDialog("Select Icon",this, OFileSelector::OPEN, OFileSelector::EXTENDED,"/"); - //fd->showMaximized(); - //fd->exec(); - QMessageBox::information(0,"Sorry!","Icon selection not yet implemented.\nComming real soon now! (tm)\n"+filename); + if(!(filename.isEmpty())) { + userImage.reset(); + if(!(userImage.load(filename))) { + QMessageBox::information(0,"Sorry!","Icon selection not yet implemented.\nComming real soon now! (tm)\n"+filename); + } else { + userImage=userImage.smoothScale(48,48); + QPixmap *picture; + picture=(QPixmap *)picturePushButton->pixmap(); + picture->convertFromImage(userImage,0); + picturePushButton->update(); + } + } } diff --git a/noncore/settings/usermanager/userdialog.h b/noncore/settings/usermanager/userdialog.h index df54269..a878588 100644 --- a/noncore/settings/usermanager/userdialog.h +++ b/noncore/settings/usermanager/userdialog.h @@ -38,2 +38,3 @@ private: QString pictureLocation; + QImage userImage; int groupID; diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp index 87dd7f1..ed18b7f 100644 --- a/noncore/settings/usermanager/usermanager.cpp +++ b/noncore/settings/usermanager/usermanager.cpp @@ -75,2 +75,3 @@ void UserConfig::setupTabAccounts() { usersIconView->setItemTextPos(QIconView::Right); + usersIconView->setArrangement(QIconView::LeftToRight); layout->addWidget(usersIconView); @@ -125,4 +126,5 @@ void UserConfig::getUsers() { mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. - mypixmap=Resource::loadPixmap(QString("users/"+accounts->pw_name)); // Is there an icon for this user? - if(mypixmap.isNull()) { +// mypixmap=Resource::loadPixmap(QString("users/"+accounts->pw_name)); // Is there an icon for this user? Resource::loadPixmap is caching, doesn't work. + if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { +// if(mypixmap.isNull()) { mypixmap=Resource::loadPixmap(QString("usermanager/usericon")); // If this user has no icon, load the default icon. @@ -133,2 +135,3 @@ void UserConfig::getUsers() { } + usersIconView->sort(); } |