summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2002-09-24 21:48:42 (UTC)
committer umopapisdn <umopapisdn>2002-09-24 21:48:42 (UTC)
commit0792061c7f1758216f9d31314dc2c1bdabda653f (patch) (unidiff)
treedf041dfd0c7144db69cb1a9a419cf28a87741d96
parent5fb5e6b63bbbffcc240380c57f186991253d0bd2 (diff)
downloadopie-0792061c7f1758216f9d31314dc2c1bdabda653f.zip
opie-0792061c7f1758216f9d31314dc2c1bdabda653f.tar.gz
opie-0792061c7f1758216f9d31314dc2c1bdabda653f.tar.bz2
Fixed searchpath for icons.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/usermanager.cpp14
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
@@ -15,57 +15,57 @@
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <qfile.h> 16#include <qfile.h>
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18 18
19#include <qregexp.h> 19#include <qregexp.h>
20 20
21/** 21/**
22 * The mainwindow constructor. 22 * The mainwindow constructor.
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 */
29UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { 29UserConfig::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
64UserConfig::~UserConfig() { 64UserConfig::~UserConfig() {
65 accounts->close(); 65 accounts->close();
66 delete accounts; 66 delete accounts;
67} 67}
68 68
69void UserConfig::setupTabAccounts() { 69void 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);
@@ -104,49 +104,49 @@ void UserConfig::setupTabAllGroups() {
104 groupsListView->addColumn("Groupname"); 104 groupsListView->addColumn("Groupname");
105 layout->addWidget(groupsListView); 105 layout->addWidget(groupsListView);
106 groupsListView->setSorting(1,1); 106 groupsListView->setSorting(1,1);
107 groupsListView->setAllColumnsShowFocus(true); 107 groupsListView->setAllColumnsShowFocus(true);
108 108
109 myTabWidget->addTab(tabpage,"All Groups"); 109 myTabWidget->addTab(tabpage,"All Groups");
110} 110}
111void UserConfig::getUsers() { 111void 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
136void UserConfig::addUser() { 136void 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
143void UserConfig::editUser() { 143void UserConfig::editUser() {
144 QString username; 144 QString username;
145 if(myTabWidget->currentPageIndex()==0) {// Users 145 if(myTabWidget->currentPageIndex()==0) {// Users
146 if(usersIconView->currentItem()) {// Any icon selected? 146 if(usersIconView->currentItem()) {// Any icon selected?
147 username=usersIconView->currentItem()->text();// Get the text associated with the icon. 147 username=usersIconView->currentItem()->text();// Get the text associated with the icon.
148 username=username.left(username.find(" - (",0,true));// Strip out the username. 148 username=username.left(username.find(" - (",0,true));// Strip out the username.
149 if(UserDialog::editUser(username)) {// Bring up the userinfo dialog. 149 if(UserDialog::editUser(username)) {// Bring up the userinfo dialog.
150 // If there were any changed also update the views. 150 // If there were any changed also update the views.
151 getUsers(); 151 getUsers();
152 getGroups(); 152 getGroups();