summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/usermanager/userdialog.cpp30
-rw-r--r--noncore/settings/usermanager/userdialog.h3
-rw-r--r--noncore/settings/usermanager/usermanager.cpp8
-rw-r--r--noncore/settings/usermanager/usermanager.h9
4 files changed, 41 insertions, 9 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
@@ -34,14 +34,13 @@ UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
setupTab1();
setupTab2();
+ accounts->groupStringList.sort();
// And also fill the listview & the combobox with all available groups.
for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) {
accounts->splitGroupEntry(*it);
- //new QListViewItem(groupsListView,accounts->gr_name);
new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
groupComboBox->insertItem(accounts->gr_name);
}
-
showMaximized();
}
@@ -105,6 +104,14 @@ void UserDialog::setupTab1() {
groupLabel->setText("Primary group: ");
groupComboBox=new QComboBox(tabpage,"PrimaryGroup");
+ // Copy /etc/skel
+ QLabel *skelLabel=new QLabel(tabpage,"skel");
+ skelLabel->setText("Copy /etc/skel: ");
+ skelCheckBox=new QCheckBox(tabpage);
+ skelCheckBox->setChecked(true);
+ skelLabel->setDisabled(true);
+ skelCheckBox->setDisabled(true);
+
// Widget layout
QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout");
layout->addWidget(picturePushButton);
@@ -124,6 +131,8 @@ void UserDialog::setupTab1() {
vlayout1->addWidget(shellLabel);
vlayout1->addSpacing(5);
vlayout1->addWidget(groupLabel);
+ vlayout1->addSpacing(5);
+ vlayout1->addWidget(skelLabel);
// Second column, data
vlayout2->addWidget(loginLineEdit);
vlayout2->addSpacing(5);
@@ -136,6 +145,8 @@ void UserDialog::setupTab1() {
vlayout2->addWidget(shellComboBox);
vlayout2->addSpacing(5);
vlayout2->addWidget(groupComboBox);
+ vlayout2->addSpacing(5);
+ vlayout2->addWidget(skelCheckBox);
hlayout->addLayout(vlayout1);
hlayout->addLayout(vlayout2);
@@ -248,10 +259,13 @@ bool UserDialog::delUser(const char *username) {
*
*/
bool UserDialog::editUser(const char *username) {
+ int invalid_group=0;
UserDialog *edituserDialog=new UserDialog(); // Create Dialog
edituserDialog->setCaption(tr("Edit User"));
accounts->findUser(username); // Locate user in database and fill variables in 'accounts' object.
- accounts->findGroup(accounts->pw_gid); // Locate the user's primary group, and fill group variables in 'accounts' object.
+ if(!(accounts->findGroup(accounts->pw_gid))) { // Locate the user's primary group, and fill group variables in 'accounts' object.
+ invalid_group=1;
+ }
// Fill widgets with userinfo.
edituserDialog->loginLineEdit->setText(accounts->pw_name);
edituserDialog->uidLineEdit->setText(QString::number(accounts->pw_uid));
@@ -267,7 +281,12 @@ bool UserDialog::editUser(const char *username) {
for(int i=0;i<edituserDialog->groupComboBox->count();++i) {
if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) {
edituserDialog->groupComboBox->setCurrentItem(i);
+ break;
+ }
}
+ if(invalid_group) {
+ edituserDialog->groupComboBox->insertItem("<Undefined group>",0);
+ edituserDialog->groupComboBox->setCurrentItem(0);
}
// Select the groups in the listview, to which the user belongs.
QCheckListItem *temp;
@@ -292,8 +311,9 @@ bool UserDialog::editUser(const char *username) {
// Set all variables in accounts object, that will be used when calling 'updateUser()'
accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt();
- accounts->findGroup(edituserDialog->groupComboBox->currentText()); // Fill all group variables in 'accounts' object.
- accounts->pw_gid=accounts->gr_gid;
+ if(accounts->findGroup(edituserDialog->groupComboBox->currentText())) { // Fill all group variables in 'accounts' object.
+ accounts->pw_gid=accounts->gr_gid; // Only do this if the group is a valid group (ie. "<Undefined group>"), otherwise keep the old group.
+ }
accounts->pw_gecos=edituserDialog->gecosLineEdit->text();
accounts->pw_shell=edituserDialog->shellComboBox->currentText();
// Update userinfo, using the information stored in the user variables stored in the accounts object.
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
@@ -15,6 +15,7 @@
#include <qlistview.h>
#include <qtabwidget.h>
#include <qpushbutton.h>
+#include <qcheckbox.h>
#include <qpe/resource.h>
@@ -32,6 +33,8 @@ private:
QLineEdit *passwordLineEdit;
QComboBox *shellComboBox;
QComboBox *groupComboBox;
+ QLabel *skelLabel;
+ QCheckBox *skelCheckBox;
QListView *groupsListView;
QStringList groupMembers;
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
@@ -54,6 +54,7 @@ UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWind
setupTabAccounts();
setupTabAllUsers();
setupTabAllGroups();
+ userPopupMenu.insertItem("Copy",0);
getUsers(); // Fill out the iconview & listview with all users.
getGroups(); // Fill out the group listview with all groups.
@@ -77,6 +78,8 @@ void UserConfig::setupTabAccounts() {
usersIconView->setAllColumnsShowFocus(true);
layout->addWidget(usersIconView);
+ connect(usersIconView,SIGNAL(returnPressed(QListViewItem *)),this,SLOT(showUserMenu(QListViewItem *)));
+
myTabWidget->addTab(tabpage,"Users");
}
@@ -244,3 +247,8 @@ void UserConfig::delGroup() {
QMessageBox::information(this,"No selection","No group has been selected.");
}
}
+
+void UserConfig::showUserMenu(QListViewItem *item) {
+// userPopupMenu.exec(item->mapToGlobal(QPoint(0,0)));
+ qWarning("Pressed!");
+}
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
@@ -13,13 +13,11 @@
#include <qmainwindow.h>
#include <qtabwidget.h>
#include <qlistview.h>
-//#include <qiconview.h>
-
-#include <qpe/qpemenubar.h>
#include <qpopupmenu.h>
-#include <qpe/qpetoolbar.h>
#include <qtoolbutton.h>
+#include <qpe/qpetoolbar.h>
+
#include "userdialog.h"
#include "groupdialog.h"
#include "passwd.h"
@@ -43,6 +41,8 @@ private:
QListView *usersIconView;
QListView *usersListView;
QListView *groupsListView;
+ QPopupMenu userPopupMenu;
+ QPopupMenu groupPopupMenu;
int availableUID;
int availableGID;
void setupTabAccounts();
@@ -60,6 +60,7 @@ private slots:
void addGroup();
void editGroup();
void delGroup();
+ void showUserMenu(QListViewItem *item);
};
#endif // USERCONFIG_H