Diffstat (limited to 'noncore/settings/usermanager/usermanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/usermanager/usermanager.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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 | |||
@@ -64,24 +64,25 @@ UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWind | |||
64 | UserConfig::~UserConfig() { | 64 | UserConfig::~UserConfig() { |
65 | accounts->close(); | 65 | accounts->close(); |
66 | delete accounts; | 66 | delete accounts; |
67 | } | 67 | } |
68 | 68 | ||
69 | void UserConfig::setupTabAccounts() { | 69 | void UserConfig::setupTabAccounts() { |
70 | QWidget *tabpage = new QWidget(this); | 70 | QWidget *tabpage = new QWidget(this); |
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 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 | ||
78 | myTabWidget->addTab(tabpage,"Users"); | 79 | myTabWidget->addTab(tabpage,"Users"); |
79 | } | 80 | } |
80 | 81 | ||
81 | void UserConfig::setupTabAllUsers() { | 82 | void UserConfig::setupTabAllUsers() { |
82 | QWidget *tabpage = new QWidget(this); | 83 | QWidget *tabpage = new QWidget(this); |
83 | QVBoxLayout *layout = new QVBoxLayout(tabpage); | 84 | QVBoxLayout *layout = new QVBoxLayout(tabpage); |
84 | layout->setMargin(5); | 85 | layout->setMargin(5); |
85 | 86 | ||
86 | usersListView=new QListView(tabpage,"allusers"); | 87 | usersListView=new QListView(tabpage,"allusers"); |
87 | usersListView->addColumn("UID"); | 88 | usersListView->addColumn("UID"); |
@@ -114,32 +115,34 @@ void UserConfig::getUsers() { | |||
114 | 115 | ||
115 | // Empty the iconview & the listview. | 116 | // Empty the iconview & the listview. |
116 | usersIconView->clear(); | 117 | usersIconView->clear(); |
117 | usersListView->clear(); | 118 | usersListView->clear(); |
118 | 119 | ||
119 | // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500. | 120 | // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500. |
120 | availableUID=500; | 121 | availableUID=500; |
121 | for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) { | 122 | for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) { |
122 | accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.) | 123 | accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.) |
123 | new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); | 124 | new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); |
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 | } |
130 | new QIconViewItem(usersIconView,mytext,mypixmap);// Add the icon+text to the qiconview. | 132 | new QIconViewItem(usersIconView,mytext,mypixmap);// Add the icon+text to the qiconview. |
131 | } | 133 | } |
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 | ||
136 | void UserConfig::addUser() { | 139 | void UserConfig::addUser() { |
137 | if(UserDialog::addUser(availableUID,availableGID)) {// Add the user to the system, also send next available UID and GID. | 140 | if(UserDialog::addUser(availableUID,availableGID)) {// Add the user to the system, also send next available UID and GID. |
138 | getUsers(); // Update users views. | 141 | getUsers(); // Update users views. |
139 | getGroups(); // Update groups view. | 142 | getGroups(); // Update groups view. |
140 | } | 143 | } |
141 | } | 144 | } |
142 | 145 | ||
143 | void UserConfig::editUser() { | 146 | void UserConfig::editUser() { |
144 | QString username; | 147 | QString username; |
145 | if(myTabWidget->currentPageIndex()==0) {// Users | 148 | if(myTabWidget->currentPageIndex()==0) {// Users |