summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2002-09-30 18:11:33 (UTC)
committer umopapisdn <umopapisdn>2002-09-30 18:11:33 (UTC)
commitd49bd63f3b15795a1ee2497960f00eb3fb075e69 (patch) (side-by-side diff)
tree44459a473faadc66288822f43146af817bac124e
parent096eb52cfbb50fefbe6679fb91e926346ff3c9d7 (diff)
downloadopie-d49bd63f3b15795a1ee2497960f00eb3fb075e69.zip
opie-d49bd63f3b15795a1ee2497960f00eb3fb075e69.tar.gz
opie-d49bd63f3b15795a1ee2497960f00eb3fb075e69.tar.bz2
Primary group combobox is sorted.
Deleting a primary group for a user sets the primarygroup combobox to <Undefined group> not an arbitrary group.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/userdialog.cpp32
-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, 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
@@ -36,2 +36,3 @@ UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
+ accounts->groupStringList.sort();
// And also fill the listview & the combobox with all available groups.
@@ -39,3 +40,2 @@ UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
accounts->splitGroupEntry(*it);
- //new QListViewItem(groupsListView,accounts->gr_name);
new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
@@ -43,3 +43,2 @@ UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
}
-
showMaximized();
@@ -107,3 +106,11 @@ void UserDialog::setupTab1() {
- // Widget layout
+ // 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");
@@ -126,2 +133,4 @@ void UserDialog::setupTab1() {
vlayout1->addWidget(groupLabel);
+ vlayout1->addSpacing(5);
+ vlayout1->addWidget(skelLabel);
// Second column, data
@@ -138,2 +147,4 @@ void UserDialog::setupTab1() {
vlayout2->addWidget(groupComboBox);
+ vlayout2->addSpacing(5);
+ vlayout2->addWidget(skelCheckBox);
hlayout->addLayout(vlayout1);
@@ -250,2 +261,3 @@ bool UserDialog::delUser(const char *username) {
bool UserDialog::editUser(const char *username) {
+ int invalid_group=0;
UserDialog *edituserDialog=new UserDialog(); // Create Dialog
@@ -253,3 +265,5 @@ bool UserDialog::editUser(const char *username) {
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.
@@ -269,4 +283,9 @@ bool UserDialog::editUser(const char *username) {
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.
@@ -294,4 +313,5 @@ bool UserDialog::editUser(const char *username) {
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();
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
@@ -17,2 +17,3 @@
#include <qpushbutton.h>
+#include <qcheckbox.h>
@@ -34,2 +35,4 @@ private:
QComboBox *groupComboBox;
+ QLabel *skelLabel;
+ QCheckBox *skelCheckBox;
QListView *groupsListView;
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
@@ -56,2 +56,3 @@ UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWind
setupTabAllGroups();
+ userPopupMenu.insertItem("Copy",0);
@@ -79,2 +80,4 @@ void UserConfig::setupTabAccounts() {
+ connect(usersIconView,SIGNAL(returnPressed(QListViewItem *)),this,SLOT(showUserMenu(QListViewItem *)));
+
myTabWidget->addTab(tabpage,"Users");
@@ -246 +249,6 @@ void UserConfig::delGroup() {
}
+
+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
@@ -15,9 +15,7 @@
#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"
@@ -45,2 +43,4 @@ private:
QListView *groupsListView;
+ QPopupMenu userPopupMenu;
+ QPopupMenu groupPopupMenu;
int availableUID;
@@ -62,2 +62,3 @@ private slots:
void delGroup();
+ void showUserMenu(QListViewItem *item);
};