author | umopapisdn <umopapisdn> | 2002-09-29 19:17:07 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2002-09-29 19:17:07 (UTC) |
commit | d61d575feac628fe4afb3cc9bf4fc8f24fc8616a (patch) (unidiff) | |
tree | 147ded7eb7f3cc2b42bd6b731b93b5c9a108d9ad | |
parent | 84a7530b51f537552ea03776c9d8ade88254dc51 (diff) | |
download | opie-d61d575feac628fe4afb3cc9bf4fc8f24fc8616a.zip opie-d61d575feac628fe4afb3cc9bf4fc8f24fc8616a.tar.gz opie-d61d575feac628fe4afb3cc9bf4fc8f24fc8616a.tar.bz2 |
Icon selection now works. User listing lists 1 user per row now. (moved from qiconlist to qlistview)
-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 19 | ||||
-rw-r--r-- | noncore/settings/usermanager/usermanager.cpp | 21 | ||||
-rw-r--r-- | noncore/settings/usermanager/usermanager.h | 4 |
3 files changed, 25 insertions, 19 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index 719dd1e..b7827a4 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp | |||
@@ -157,3 +157,3 @@ void UserDialog::setupTab2() { | |||
157 | groupsListView->setColumnWidthMode(0,QListView::Maximum); | 157 | groupsListView->setColumnWidthMode(0,QListView::Maximum); |
158 | groupsListView->setMultiSelection(true); | 158 | groupsListView->setMultiSelection(false); |
159 | groupsListView->setAllColumnsShowFocus(false); | 159 | groupsListView->setAllColumnsShowFocus(false); |
@@ -200,5 +200,7 @@ bool UserDialog::addUser(int uid, int gid) { | |||
200 | // Add User to additional groups. | 200 | // Add User to additional groups. |
201 | QCheckListItem *temp; | ||
201 | QListViewItemIterator it( adduserDialog->groupsListView ); | 202 | QListViewItemIterator it( adduserDialog->groupsListView ); |
202 | for ( ; it.current(); ++it ) { | 203 | for ( ; it.current(); ++it ) { |
203 | if ( it.current()->isSelected() ) | 204 | temp=(QCheckListItem*)it.current(); |
205 | if (temp->isOn() ) | ||
204 | accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); | 206 | accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); |
@@ -212,3 +214,3 @@ bool UserDialog::addUser(int uid, int gid) { | |||
212 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; | 214 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; |
213 | adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); | 215 | // adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); |
214 | adduserDialog->userImage.save(filename,"PNG"); | 216 | adduserDialog->userImage.save(filename,"PNG"); |
@@ -270,2 +272,3 @@ bool UserDialog::editUser(const char *username) { | |||
270 | // Select the groups in the listview, to which the user belongs. | 272 | // Select the groups in the listview, to which the user belongs. |
273 | QCheckListItem *temp; | ||
271 | QRegExp userRegExp(QString("[:\\s]%1\\s").arg(username)); | 274 | QRegExp userRegExp(QString("[:\\s]%1\\s").arg(username)); |
@@ -276,3 +279,4 @@ bool UserDialog::editUser(const char *username) { | |||
276 | if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { | 279 | if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { |
277 | lvit.current()->setSelected(true);// If we find a line with that groupname, select it.; | 280 | temp=(QCheckListItem*)lvit.current(); |
281 | temp->setOn(true);// If we find a line with that groupname, select it.; | ||
278 | } | 282 | } |
@@ -305,3 +309,4 @@ bool UserDialog::editUser(const char *username) { | |||
305 | for ( ; it.current(); ++it ) { | 309 | for ( ; it.current(); ++it ) { |
306 | if ( it.current()->isSelected() ) | 310 | temp=(QCheckListItem*)it.current(); |
311 | if ( temp->isOn() ) | ||
307 | accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text()); | 312 | accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text()); |
@@ -316,3 +321,3 @@ bool UserDialog::editUser(const char *username) { | |||
316 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; | 321 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; |
317 | edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48); | 322 | // edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48); |
318 | edituserDialog->userImage.save(filename,"PNG"); | 323 | edituserDialog->userImage.save(filename,"PNG"); |
@@ -346,3 +351,3 @@ void UserDialog::clickedPicture() { | |||
346 | } else { | 351 | } else { |
347 | userImage=userImage.smoothScale(48,48); | 352 | // userImage=userImage.smoothScale(48,48); |
348 | QPixmap *picture; | 353 | QPixmap *picture; |
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp index ed18b7f..2735e6a 100644 --- a/noncore/settings/usermanager/usermanager.cpp +++ b/noncore/settings/usermanager/usermanager.cpp | |||
@@ -73,5 +73,6 @@ void UserConfig::setupTabAccounts() { | |||
73 | 73 | ||
74 | usersIconView=new QIconView(tabpage,"users"); | 74 | usersIconView=new QListView(tabpage,"users"); |
75 | usersIconView->setItemTextPos(QIconView::Right); | 75 | usersIconView->addColumn("Icon"); |
76 | usersIconView->setArrangement(QIconView::LeftToRight); | 76 | usersIconView->addColumn("Username"); |
77 | usersIconView->setAllColumnsShowFocus(true); | ||
77 | layout->addWidget(usersIconView); | 78 | layout->addWidget(usersIconView); |
@@ -114,3 +115,4 @@ void UserConfig::getUsers() { | |||
114 | QPixmap mypixmap; | 115 | QPixmap mypixmap; |
115 | 116 | QListViewItem *listviewitem; | |
117 | |||
116 | // Empty the iconview & the listview. | 118 | // Empty the iconview & the listview. |
@@ -126,8 +128,7 @@ void UserConfig::getUsers() { | |||
126 | mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. | 128 | mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. |
127 | // mypixmap=Resource::loadPixmap(QString("users/"+accounts->pw_name));// Is there an icon for this user? Resource::loadPixmap is caching, doesn't work. | 129 | if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { // Is there an icon for this user? Resource::loadPixmap is caching, doesn't work. |
128 | if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { | ||
129 | // if(mypixmap.isNull()) { | ||
130 | 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. |
131 | } | 131 | } |
132 | new QIconViewItem(usersIconView,mytext,mypixmap);// Add the icon+text to the qiconview. | 132 | listviewitem=new QListViewItem(usersIconView,"",mytext);// Add the icon+text to the qiconview. |
133 | listviewitem->setPixmap(0,mypixmap); | ||
133 | } | 134 | } |
@@ -149,3 +150,3 @@ void UserConfig::editUser() { | |||
149 | if(usersIconView->currentItem()) {// Any icon selected? | 150 | if(usersIconView->currentItem()) {// Any icon selected? |
150 | username=usersIconView->currentItem()->text();// Get the text associated with the icon. | 151 | username=usersIconView->currentItem()->text(1);// Get the text associated with the icon. |
151 | username=username.left(username.find(" - (",0,true));// Strip out the username. | 152 | username=username.left(username.find(" - (",0,true));// Strip out the username. |
@@ -179,3 +180,3 @@ void UserConfig::delUser() { | |||
179 | if(usersIconView->currentItem()) {// Anything selected? | 180 | if(usersIconView->currentItem()) {// Anything selected? |
180 | username=usersIconView->currentItem()->text();// Get string associated with icon. | 181 | username=usersIconView->currentItem()->text(1);// Get string associated with icon. |
181 | username=username.left(username.find(" - (",0,true));// Strip out the username. | 182 | username=username.left(username.find(" - (",0,true));// Strip out the username. |
diff --git a/noncore/settings/usermanager/usermanager.h b/noncore/settings/usermanager/usermanager.h index bb5d04f..9909242 100644 --- a/noncore/settings/usermanager/usermanager.h +++ b/noncore/settings/usermanager/usermanager.h | |||
@@ -15,3 +15,3 @@ | |||
15 | #include <qlistview.h> | 15 | #include <qlistview.h> |
16 | #include <qiconview.h> | 16 | //#include <qiconview.h> |
17 | 17 | ||
@@ -42,3 +42,3 @@ private: | |||
42 | QTabWidget *myTabWidget; | 42 | QTabWidget *myTabWidget; |
43 | QIconView *usersIconView; | 43 | QListView *usersIconView; |
44 | QListView *usersListView; | 44 | QListView *usersListView; |