-rw-r--r-- | noncore/settings/usermanager/usermanager.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp index 883e5d7..87dd7f1 100644 --- a/noncore/settings/usermanager/usermanager.cpp +++ b/noncore/settings/usermanager/usermanager.cpp | |||
@@ -23,41 +23,41 @@ | |||
23 | * | 23 | * |
24 | * @param QWidget *parent | 24 | * @param QWidget *parent |
25 | * @param const char *name | 25 | * @param const char *name |
26 | * @ param WFlags fl | 26 | * @ param WFlags fl |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { | 29 | UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { |
30 | setCaption(tr("OPIE User Manager")); | 30 | setCaption(tr("OPIE User Manager")); |
31 | 31 | ||
32 | // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them. | 32 | // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them. |
33 | accounts=new Passwd(); | 33 | accounts=new Passwd(); |
34 | accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory. | 34 | accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory. |
35 | 35 | ||
36 | // Create the toolbar. | 36 | // Create the toolbar. |
37 | QPEToolBar *toolbar = new QPEToolBar(this,"Toolbar"); | 37 | QPEToolBar *toolbar = new QPEToolBar(this,"Toolbar"); |
38 | toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!? | 38 | toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!? |
39 | adduserToolButton = new QToolButton(Resource::loadPixmap("userconfig/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User"); | 39 | adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User"); |
40 | edituserToolButton = new QToolButton(Resource::loadPixmap("userconfig/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User"); | 40 | edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User"); |
41 | deleteuserToolButton = new QToolButton(Resource::loadPixmap("userconfig/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User"); | 41 | deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User"); |
42 | QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User"); | 42 | QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User"); |
43 | userstext->setUsesTextLabel(true); | 43 | userstext->setUsesTextLabel(true); |
44 | toolbar->addSeparator(); | 44 | toolbar->addSeparator(); |
45 | addgroupToolButton = new QToolButton(Resource::loadPixmap("userconfig/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group"); | 45 | addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group"); |
46 | editgroupToolButton = new QToolButton(Resource::loadPixmap("userconfig/editgroup"),"Edit Group",0,this,SLOT(editGroup()),toolbar,"Edit Group"); | 46 | editgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/editgroup"),"Edit Group",0,this,SLOT(editGroup()),toolbar,"Edit Group"); |
47 | deletegroupToolButton = new QToolButton(Resource::loadPixmap("userconfig/deletegroup"),"Delete Group",0,this,SLOT(delGroup()),toolbar,"Delete Group"); | 47 | deletegroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/deletegroup"),"Delete Group",0,this,SLOT(delGroup()),toolbar,"Delete Group"); |
48 | QToolButton *groupstext = new QToolButton(0,"Group",0,0,0,toolbar,"Group"); | 48 | QToolButton *groupstext = new QToolButton(0,"Group",0,0,0,toolbar,"Group"); |
49 | groupstext->setUsesTextLabel(true); | 49 | groupstext->setUsesTextLabel(true); |
50 | addToolBar(toolbar,"myToolBar"); | 50 | addToolBar(toolbar,"myToolBar"); |
51 | 51 | ||
52 | // Add a tabwidget and all the tabs. | 52 | // Add a tabwidget and all the tabs. |
53 | myTabWidget = new QTabWidget(this,"My Tab Widget"); | 53 | myTabWidget = new QTabWidget(this,"My Tab Widget"); |
54 | setupTabAccounts(); | 54 | setupTabAccounts(); |
55 | setupTabAllUsers(); | 55 | setupTabAllUsers(); |
56 | setupTabAllGroups(); | 56 | setupTabAllGroups(); |
57 | 57 | ||
58 | getUsers(); // Fill out the iconview & listview with all users. | 58 | getUsers(); // Fill out the iconview & listview with all users. |
59 | getGroups(); // Fill out the group listview with all groups. | 59 | getGroups(); // Fill out the group listview with all groups. |
60 | 60 | ||
61 | setCentralWidget(myTabWidget); | 61 | setCentralWidget(myTabWidget); |
62 | } | 62 | } |
63 | 63 | ||
@@ -112,33 +112,33 @@ void UserConfig::getUsers() { | |||
112 | QString mytext; | 112 | QString mytext; |
113 | QPixmap mypixmap; | 113 | QPixmap mypixmap; |
114 | 114 | ||
115 | // Empty the iconview & the listview. | 115 | // Empty the iconview & the listview. |
116 | usersIconView->clear(); | 116 | usersIconView->clear(); |
117 | usersListView->clear(); | 117 | usersListView->clear(); |
118 | 118 | ||
119 | // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500. | 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=500; | 120 | availableUID=500; |
121 | for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) { | 121 | 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.) | 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 | new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); | 123 | 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 ? | 124 | 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. | 125 | 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? | 126 | mypixmap=Resource::loadPixmap(QString("users/"+accounts->pw_name));// Is there an icon for this user? |
127 | if(mypixmap.isNull()) { | 127 | if(mypixmap.isNull()) { |
128 | mypixmap=Resource::loadPixmap(QString("userconfig/usericon"));// If this user has no icon, load the default icon. | 128 | mypixmap=Resource::loadPixmap(QString("usermanager/usericon"));// If this user has no icon, load the default icon. |
129 | } | 129 | } |
130 | new QIconViewItem(usersIconView,mytext,mypixmap);// Add the icon+text to the qiconview. | 130 | new QIconViewItem(usersIconView,mytext,mypixmap);// Add the icon+text to the qiconview. |
131 | } | 131 | } |
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. | 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. |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | void UserConfig::addUser() { | 136 | void UserConfig::addUser() { |
137 | if(UserDialog::addUser(availableUID,availableGID)) {// Add the user to the system, also send next available UID and GID. | 137 | if(UserDialog::addUser(availableUID,availableGID)) {// Add the user to the system, also send next available UID and GID. |
138 | getUsers(); // Update users views. | 138 | getUsers(); // Update users views. |
139 | getGroups(); // Update groups view. | 139 | getGroups(); // Update groups view. |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | void UserConfig::editUser() { | 143 | void UserConfig::editUser() { |
144 | QString username; | 144 | QString username; |