Diffstat (limited to 'noncore/settings/usermanager/usermanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/usermanager/usermanager.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
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 | |||
@@ -71,9 +71,10 @@ void UserConfig::setupTabAccounts() { | |||
71 | QVBoxLayout *layout = new QVBoxLayout(tabpage); | 71 | QVBoxLayout *layout = new QVBoxLayout(tabpage); |
72 | layout->setMargin(5); | 72 | layout->setMargin(5); |
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); |
78 | 79 | ||
79 | myTabWidget->addTab(tabpage,"Users"); | 80 | myTabWidget->addTab(tabpage,"Users"); |
@@ -112,6 +113,7 @@ void UserConfig::setupTabAllGroups() { | |||
112 | void UserConfig::getUsers() { | 113 | void UserConfig::getUsers() { |
113 | QString mytext; | 114 | QString mytext; |
114 | QPixmap mypixmap; | 115 | QPixmap mypixmap; |
116 | QListViewItem *listviewitem; | ||
115 | 117 | ||
116 | // Empty the iconview & the listview. | 118 | // Empty the iconview & the listview. |
117 | usersIconView->clear(); | 119 | usersIconView->clear(); |
@@ -124,12 +126,11 @@ void UserConfig::getUsers() { | |||
124 | new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); | 126 | new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); |
125 | if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) {// Is this user a "normal" user ? | 127 | if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) {// Is this user a "normal" user ? |
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 | } |
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. | 135 | 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. |
135 | } | 136 | } |
@@ -147,7 +148,7 @@ void UserConfig::editUser() { | |||
147 | QString username; | 148 | QString username; |
148 | if(myTabWidget->currentPageIndex()==0) {// Users | 149 | if(myTabWidget->currentPageIndex()==0) {// Users |
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. |
152 | if(UserDialog::editUser(username)) {// Bring up the userinfo dialog. | 153 | if(UserDialog::editUser(username)) {// Bring up the userinfo dialog. |
153 | // If there were any changed also update the views. | 154 | // If there were any changed also update the views. |
@@ -177,7 +178,7 @@ void UserConfig::delUser() { | |||
177 | 178 | ||
178 | if(myTabWidget->currentPageIndex()==0) {// Users, Iconview. | 179 | if(myTabWidget->currentPageIndex()==0) {// Users, Iconview. |
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. |
182 | if(QMessageBox::warning(this,"Delete user","Are you sure you want to\ndelete this user? \""+QString(username)+"\" ?","&No","&Yes",0,0,1)) { | 183 | if(QMessageBox::warning(this,"Delete user","Are you sure you want to\ndelete this user? \""+QString(username)+"\" ?","&No","&Yes",0,0,1)) { |
183 | if(UserDialog::delUser(username)) {// Delete the user if possible. | 184 | if(UserDialog::delUser(username)) {// Delete the user if possible. |