author | umopapisdn <umopapisdn> | 2002-09-28 22:28:39 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2002-09-28 22:28:39 (UTC) |
commit | aa347496d408431d85ff2d7a2cf60479407620af (patch) (unidiff) | |
tree | 64e7fed8efd41d2c4b3bdf26c863a5486ee0ede3 /noncore | |
parent | 7980189a2cb34e2864c339ef68bfbe7fb4910750 (diff) | |
download | opie-aa347496d408431d85ff2d7a2cf60479407620af.zip opie-aa347496d408431d85ff2d7a2cf60479407620af.tar.gz opie-aa347496d408431d85ff2d7a2cf60479407620af.tar.bz2 |
*** empty log message ***
-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 | |||
@@ -204,4 +204,14 @@ bool UserDialog::addUser(int uid, int gid) { | |||
204 | accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); | 204 | accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); |
205 | } | 205 | } |
206 | // Copy image to pics/users/ | ||
207 | if(!(adduserDialog->userImage.isNull())) { | ||
208 | QDir d; | ||
209 | if(!(d.exists("/opt/QtPalmtop/pics/users"))) { | ||
210 | d.mkdir("/opt/QtPalmtop/pics/users"); | ||
211 | } | ||
212 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; | ||
213 | adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); | ||
214 | adduserDialog->userImage.save(filename,"PNG"); | ||
215 | } | ||
206 | return true; | 216 | return true; |
207 | } | 217 | } |
@@ -297,4 +307,15 @@ bool UserDialog::editUser(const char *username) { | |||
297 | accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text()); | 307 | accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text()); |
298 | } | 308 | } |
309 | |||
310 | // Copy image to pics/users/ | ||
311 | if(!(edituserDialog->userImage.isNull())) { | ||
312 | QDir d; | ||
313 | if(!(d.exists("/opt/QtPalmtop/pics/users"))) { | ||
314 | d.mkdir("/opt/QtPalmtop/pics/users"); | ||
315 | } | ||
316 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; | ||
317 | edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48); | ||
318 | edituserDialog->userImage.save(filename,"PNG"); | ||
319 | } | ||
299 | return true; | 320 | return true; |
300 | } | 321 | } |
@@ -319,7 +340,15 @@ void UserDialog::accept() { | |||
319 | void UserDialog::clickedPicture() { | 340 | void UserDialog::clickedPicture() { |
320 | QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED,"/opt/QtPalmtop/pics"); | 341 | QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED,"/opt/QtPalmtop/pics"); |
321 | // OFileDialog *fd=new OFileDialog("Select Icon",this, OFileSelector::OPEN, OFileSelector::EXTENDED,"/"); | 342 | if(!(filename.isEmpty())) { |
322 | //fd->showMaximized(); | 343 | userImage.reset(); |
323 | //fd->exec(); | 344 | if(!(userImage.load(filename))) { |
324 | QMessageBox::information(0,"Sorry!","Icon selection not yet implemented.\nComming real soon now! (tm)\n"+filename); | 345 | QMessageBox::information(0,"Sorry!","Icon selection not yet implemented.\nComming real soon now! (tm)\n"+filename); |
346 | } else { | ||
347 | userImage=userImage.smoothScale(48,48); | ||
348 | QPixmap *picture; | ||
349 | picture=(QPixmap *)picturePushButton->pixmap(); | ||
350 | picture->convertFromImage(userImage,0); | ||
351 | picturePushButton->update(); | ||
352 | } | ||
353 | } | ||
325 | } | 354 | } |
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 | |||
@@ -37,4 +37,5 @@ private: | |||
37 | QStringList groupMembers; | 37 | QStringList groupMembers; |
38 | QString pictureLocation; | 38 | QString pictureLocation; |
39 | QImage userImage; | ||
39 | int groupID; | 40 | int groupID; |
40 | int userID; | 41 | int userID; |
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 | |||
@@ -74,4 +74,5 @@ void UserConfig::setupTabAccounts() { | |||
74 | usersIconView=new QIconView(tabpage,"users"); | 74 | usersIconView=new QIconView(tabpage,"users"); |
75 | usersIconView->setItemTextPos(QIconView::Right); | 75 | usersIconView->setItemTextPos(QIconView::Right); |
76 | usersIconView->setArrangement(QIconView::LeftToRight); | ||
76 | layout->addWidget(usersIconView); | 77 | layout->addWidget(usersIconView); |
77 | 78 | ||
@@ -124,6 +125,7 @@ void UserConfig::getUsers() { | |||
124 | if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) {// Is this user a "normal" user ? | 125 | if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) {// Is this user a "normal" user ? |
125 | mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. | 126 | mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. |
126 | mypixmap=Resource::loadPixmap(QString("users/"+accounts->pw_name));// Is there an icon for this user? | 127 | // mypixmap=Resource::loadPixmap(QString("users/"+accounts->pw_name));// Is there an icon for this user? Resource::loadPixmap is caching, doesn't work. |
127 | if(mypixmap.isNull()) { | 128 | if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { |
129 | // if(mypixmap.isNull()) { | ||
128 | mypixmap=Resource::loadPixmap(QString("usermanager/usericon"));// If this user has no icon, load the default icon. | 130 | mypixmap=Resource::loadPixmap(QString("usermanager/usericon"));// If this user has no icon, load the default icon. |
129 | } | 131 | } |
@@ -132,4 +134,5 @@ void UserConfig::getUsers() { | |||
132 | if((accounts->pw_uid>=availableUID) && (accounts->pw_uid<65000)) availableUID=accounts->pw_uid+1; // Increase 1 to the latest know UID to get a free uid. | 134 | if((accounts->pw_uid>=availableUID) && (accounts->pw_uid<65000)) availableUID=accounts->pw_uid+1; // Increase 1 to the latest know UID to get a free uid. |
133 | } | 135 | } |
136 | usersIconView->sort(); | ||
134 | } | 137 | } |
135 | 138 | ||