-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 32 | ||||
-rw-r--r-- | noncore/settings/usermanager/userdialog.h | 3 | ||||
-rw-r--r-- | noncore/settings/usermanager/usermanager.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/usermanager/usermanager.h | 9 |
4 files changed, 42 insertions, 10 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index b7827a4..90e27d5 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp | |||
@@ -35,12 +35,11 @@ UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl) | |||
35 | setupTab2(); | 35 | setupTab2(); |
36 | 36 | ||
37 | accounts->groupStringList.sort(); | ||
37 | // And also fill the listview & the combobox with all available groups. | 38 | // And also fill the listview & the combobox with all available groups. |
38 | for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) { | 39 | for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) { |
39 | accounts->splitGroupEntry(*it); | 40 | accounts->splitGroupEntry(*it); |
40 | //new QListViewItem(groupsListView,accounts->gr_name); | ||
41 | new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox); | 41 | new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox); |
42 | groupComboBox->insertItem(accounts->gr_name); | 42 | groupComboBox->insertItem(accounts->gr_name); |
43 | } | 43 | } |
44 | |||
45 | showMaximized(); | 44 | showMaximized(); |
46 | } | 45 | } |
@@ -106,5 +105,13 @@ void UserDialog::setupTab1() { | |||
106 | groupComboBox=new QComboBox(tabpage,"PrimaryGroup"); | 105 | groupComboBox=new QComboBox(tabpage,"PrimaryGroup"); |
107 | 106 | ||
108 | // Widget layout | 107 | // Copy /etc/skel |
108 | QLabel *skelLabel=new QLabel(tabpage,"skel"); | ||
109 | skelLabel->setText("Copy /etc/skel: "); | ||
110 | skelCheckBox=new QCheckBox(tabpage); | ||
111 | skelCheckBox->setChecked(true); | ||
112 | skelLabel->setDisabled(true); | ||
113 | skelCheckBox->setDisabled(true); | ||
114 | |||
115 | // Widget layout | ||
109 | QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); | 116 | QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); |
110 | layout->addWidget(picturePushButton); | 117 | layout->addWidget(picturePushButton); |
@@ -125,4 +132,6 @@ void UserDialog::setupTab1() { | |||
125 | vlayout1->addSpacing(5); | 132 | vlayout1->addSpacing(5); |
126 | vlayout1->addWidget(groupLabel); | 133 | vlayout1->addWidget(groupLabel); |
134 | vlayout1->addSpacing(5); | ||
135 | vlayout1->addWidget(skelLabel); | ||
127 | // Second column, data | 136 | // Second column, data |
128 | vlayout2->addWidget(loginLineEdit); | 137 | vlayout2->addWidget(loginLineEdit); |
@@ -137,4 +146,6 @@ void UserDialog::setupTab1() { | |||
137 | vlayout2->addSpacing(5); | 146 | vlayout2->addSpacing(5); |
138 | vlayout2->addWidget(groupComboBox); | 147 | vlayout2->addWidget(groupComboBox); |
148 | vlayout2->addSpacing(5); | ||
149 | vlayout2->addWidget(skelCheckBox); | ||
139 | hlayout->addLayout(vlayout1); | 150 | hlayout->addLayout(vlayout1); |
140 | hlayout->addLayout(vlayout2); | 151 | hlayout->addLayout(vlayout2); |
@@ -249,8 +260,11 @@ bool UserDialog::delUser(const char *username) { | |||
249 | */ | 260 | */ |
250 | bool UserDialog::editUser(const char *username) { | 261 | bool UserDialog::editUser(const char *username) { |
262 | int invalid_group=0; | ||
251 | UserDialog *edituserDialog=new UserDialog();// Create Dialog | 263 | UserDialog *edituserDialog=new UserDialog();// Create Dialog |
252 | edituserDialog->setCaption(tr("Edit User")); | 264 | edituserDialog->setCaption(tr("Edit User")); |
253 | accounts->findUser(username);// Locate user in database and fill variables in 'accounts' object. | 265 | accounts->findUser(username);// Locate user in database and fill variables in 'accounts' object. |
254 | accounts->findGroup(accounts->pw_gid);// Locate the user's primary group, and fill group variables in 'accounts' object. | 266 | if(!(accounts->findGroup(accounts->pw_gid))) {// Locate the user's primary group, and fill group variables in 'accounts' object. |
267 | invalid_group=1; | ||
268 | } | ||
255 | // Fill widgets with userinfo. | 269 | // Fill widgets with userinfo. |
256 | edituserDialog->loginLineEdit->setText(accounts->pw_name); | 270 | edituserDialog->loginLineEdit->setText(accounts->pw_name); |
@@ -268,6 +282,11 @@ bool UserDialog::editUser(const char *username) { | |||
268 | if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) { | 282 | if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) { |
269 | edituserDialog->groupComboBox->setCurrentItem(i); | 283 | edituserDialog->groupComboBox->setCurrentItem(i); |
284 | break; | ||
270 | } | 285 | } |
271 | } | 286 | } |
287 | if(invalid_group) { | ||
288 | edituserDialog->groupComboBox->insertItem("<Undefined group>",0); | ||
289 | edituserDialog->groupComboBox->setCurrentItem(0); | ||
290 | } | ||
272 | // Select the groups in the listview, to which the user belongs. | 291 | // Select the groups in the listview, to which the user belongs. |
273 | QCheckListItem *temp; | 292 | QCheckListItem *temp; |
@@ -293,6 +312,7 @@ bool UserDialog::editUser(const char *username) { | |||
293 | // Set all variables in accounts object, that will be used when calling 'updateUser()' | 312 | // Set all variables in accounts object, that will be used when calling 'updateUser()' |
294 | accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt(); | 313 | accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt(); |
295 | accounts->findGroup(edituserDialog->groupComboBox->currentText());// Fill all group variables in 'accounts' object. | 314 | if(accounts->findGroup(edituserDialog->groupComboBox->currentText())) {// Fill all group variables in 'accounts' object. |
296 | accounts->pw_gid=accounts->gr_gid; | 315 | accounts->pw_gid=accounts->gr_gid;// Only do this if the group is a valid group (ie. "<Undefined group>"), otherwise keep the old group. |
316 | } | ||
297 | accounts->pw_gecos=edituserDialog->gecosLineEdit->text(); | 317 | accounts->pw_gecos=edituserDialog->gecosLineEdit->text(); |
298 | accounts->pw_shell=edituserDialog->shellComboBox->currentText(); | 318 | accounts->pw_shell=edituserDialog->shellComboBox->currentText(); |
diff --git a/noncore/settings/usermanager/userdialog.h b/noncore/settings/usermanager/userdialog.h index a878588..133b35d 100644 --- a/noncore/settings/usermanager/userdialog.h +++ b/noncore/settings/usermanager/userdialog.h | |||
@@ -16,4 +16,5 @@ | |||
16 | #include <qtabwidget.h> | 16 | #include <qtabwidget.h> |
17 | #include <qpushbutton.h> | 17 | #include <qpushbutton.h> |
18 | #include <qcheckbox.h> | ||
18 | 19 | ||
19 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
@@ -33,4 +34,6 @@ private: | |||
33 | QComboBox *shellComboBox; | 34 | QComboBox *shellComboBox; |
34 | QComboBox *groupComboBox; | 35 | QComboBox *groupComboBox; |
36 | QLabel *skelLabel; | ||
37 | QCheckBox *skelCheckBox; | ||
35 | QListView *groupsListView; | 38 | QListView *groupsListView; |
36 | 39 | ||
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp index 2735e6a..57efa71 100644 --- a/noncore/settings/usermanager/usermanager.cpp +++ b/noncore/settings/usermanager/usermanager.cpp | |||
@@ -55,4 +55,5 @@ UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWind | |||
55 | setupTabAllUsers(); | 55 | setupTabAllUsers(); |
56 | setupTabAllGroups(); | 56 | setupTabAllGroups(); |
57 | userPopupMenu.insertItem("Copy",0); | ||
57 | 58 | ||
58 | getUsers(); // Fill out the iconview & listview with all users. | 59 | getUsers(); // Fill out the iconview & listview with all users. |
@@ -78,4 +79,6 @@ void UserConfig::setupTabAccounts() { | |||
78 | layout->addWidget(usersIconView); | 79 | layout->addWidget(usersIconView); |
79 | 80 | ||
81 | connect(usersIconView,SIGNAL(returnPressed(QListViewItem *)),this,SLOT(showUserMenu(QListViewItem *))); | ||
82 | |||
80 | myTabWidget->addTab(tabpage,"Users"); | 83 | myTabWidget->addTab(tabpage,"Users"); |
81 | } | 84 | } |
@@ -245,2 +248,7 @@ void UserConfig::delGroup() { | |||
245 | } | 248 | } |
246 | } | 249 | } |
250 | |||
251 | void UserConfig::showUserMenu(QListViewItem *item) { | ||
252 | //userPopupMenu.exec(item->mapToGlobal(QPoint(0,0))); | ||
253 | qWarning("Pressed!"); | ||
254 | } | ||
diff --git a/noncore/settings/usermanager/usermanager.h b/noncore/settings/usermanager/usermanager.h index 9909242..6782923 100644 --- a/noncore/settings/usermanager/usermanager.h +++ b/noncore/settings/usermanager/usermanager.h | |||
@@ -14,11 +14,9 @@ | |||
14 | #include <qtabwidget.h> | 14 | #include <qtabwidget.h> |
15 | #include <qlistview.h> | 15 | #include <qlistview.h> |
16 | //#include <qiconview.h> | ||
17 | |||
18 | #include <qpe/qpemenubar.h> | ||
19 | #include <qpopupmenu.h> | 16 | #include <qpopupmenu.h> |
20 | #include <qpe/qpetoolbar.h> | ||
21 | #include <qtoolbutton.h> | 17 | #include <qtoolbutton.h> |
22 | 18 | ||
19 | #include <qpe/qpetoolbar.h> | ||
20 | |||
23 | #include "userdialog.h" | 21 | #include "userdialog.h" |
24 | #include "groupdialog.h" | 22 | #include "groupdialog.h" |
@@ -44,4 +42,6 @@ private: | |||
44 | QListView *usersListView; | 42 | QListView *usersListView; |
45 | QListView *groupsListView; | 43 | QListView *groupsListView; |
44 | QPopupMenu userPopupMenu; | ||
45 | QPopupMenu groupPopupMenu; | ||
46 | int availableUID; | 46 | int availableUID; |
47 | int availableGID; | 47 | int availableGID; |
@@ -61,4 +61,5 @@ private slots: | |||
61 | void editGroup(); | 61 | void editGroup(); |
62 | void delGroup(); | 62 | void delGroup(); |
63 | void showUserMenu(QListViewItem *item); | ||
63 | }; | 64 | }; |
64 | 65 | ||