summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2002-11-01 21:29:35 (UTC)
committer umopapisdn <umopapisdn>2002-11-01 21:29:35 (UTC)
commit7ccfa11a1ccbb4cfb047bd1fa1eb19402d9c8dd6 (patch) (side-by-side diff)
treebb2d0b7a66a188ffd7ad6f9729b9691aa8452682
parent89567519b98853932093e06af4a28f6cc4cc8fd9 (diff)
downloadopie-7ccfa11a1ccbb4cfb047bd1fa1eb19402d9c8dd6.zip
opie-7ccfa11a1ccbb4cfb047bd1fa1eb19402d9c8dd6.tar.gz
opie-7ccfa11a1ccbb4cfb047bd1fa1eb19402d9c8dd6.tar.bz2
* "Copy /etc/skel" option is now only available when adding a user.
* Documented some more of the source code.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/usermanager/passwd.cpp23
-rw-r--r--noncore/settings/usermanager/userdialog.cpp19
-rw-r--r--noncore/settings/usermanager/userdialog.h7
3 files changed, 42 insertions, 7 deletions
diff --git a/noncore/settings/usermanager/passwd.cpp b/noncore/settings/usermanager/passwd.cpp
index 5063661..0a2bfba 100644
--- a/noncore/settings/usermanager/passwd.cpp
+++ b/noncore/settings/usermanager/passwd.cpp
@@ -53,2 +53,3 @@ char *Passwd::crypt_make_salt() {
+// opens the files /etc/passwd & /etc/group and loads the contents into passwdStringList & groupStringList
bool Passwd::open() {
@@ -78,2 +79,3 @@ bool Passwd::open() {
+// Writes back the contents of passwdStringList to /etc/passwd & groupStringList to /etc/group
bool Passwd::close() {
@@ -100,2 +102,3 @@ bool Passwd::close() {
+// Splits a "passwd" line into the components and stores them in the pw_* variables.
void Passwd::splitPasswdEntry(QString &userString) {
@@ -112,2 +115,3 @@ void Passwd::splitPasswdEntry(QString &userString) {
+// Splits a "group" line into the components and stores them in the gr_* variables.
void Passwd::splitGroupEntry(QString &groupString) {
@@ -121,2 +125,3 @@ void Passwd::splitGroupEntry(QString &groupString) {
+// Find a user in the passwdStringList. Return true if found and also fill the pw_* variables.
bool Passwd::searchUser(QRegExp &userRegExp) {
@@ -132,2 +137,3 @@ bool Passwd::searchUser(QRegExp &userRegExp) {
+// Find a user by login.
bool Passwd::findUser(const char *username) {
@@ -137,2 +143,3 @@ bool Passwd::findUser(const char *username) {
+// Find a user by uid.
bool Passwd::findUser(int uid) {
@@ -142,2 +149,3 @@ bool Passwd::findUser(int uid) {
+// Add a user to the passwdStringList, create home directory, and optionally create a group for the user.
bool Passwd::addUser(QString pw_name, QString pw_passwd, int pw_uid, int pw_gid, QString pw_gecos,QString pw_dir, QString pw_shell, bool createGroup) {
@@ -158,2 +166,3 @@ bool Passwd::addUser(QString pw_name, QString pw_passwd, int pw_uid, int pw_gid,
+// Update info for a user in passwdStringList, take info from the pw_* fields.
bool Passwd::updateUser(QString login) {
@@ -169,2 +178,3 @@ bool Passwd::updateUser(QString login) {
+// Delete a user from passwdStringList.
bool Passwd::deleteUser(QRegExp &userRegExp, bool delGroup) {
@@ -181,2 +191,3 @@ bool Passwd::deleteUser(QRegExp &userRegExp, bool delGroup) {
+// Delete a user by login, and optionally also delete group.
bool Passwd::delUser(const char *username, bool delGroup) {
@@ -186,2 +197,3 @@ bool Passwd::delUser(const char *username, bool delGroup) {
+// Delete a user by uid, and optionally also delete group.
bool Passwd::delUser(int uid, bool delGroup) {
@@ -191,2 +203,3 @@ bool Passwd::delUser(int uid, bool delGroup) {
+// Locate a group in the groupStringList, fill out the gr_* variables and return "true" if found.
bool Passwd::searchGroup(QRegExp &groupRegExp) {
@@ -202,2 +215,3 @@ bool Passwd::searchGroup(QRegExp &groupRegExp) {
+// Find a group by groupname.
bool Passwd::findGroup(const char *groupname) {
@@ -207,2 +221,3 @@ bool Passwd::findGroup(const char *groupname) {
+// Find a group by gid.
bool Passwd::findGroup(int gid) {
@@ -212,2 +227,3 @@ bool Passwd::findGroup(int gid) {
+// Add a group to groupStringList
bool Passwd::addGroup(QString gr_name, int gr_gid) {
@@ -219,2 +235,3 @@ bool Passwd::addGroup(QString gr_name, int gr_gid) {
+// Update fields for a group in groupStringList, take info from the gr_* variables.
bool Passwd::updateGroup(int gid) {
@@ -234,2 +251,3 @@ bool Passwd::updateGroup(int gid) {
+// Delete a group from groupStringList.
bool Passwd::deleteGroup(QRegExp &groupRegExp) {
@@ -244,2 +262,3 @@ bool Passwd::deleteGroup(QRegExp &groupRegExp) {
+// Delete a group by groupname.
bool Passwd::delGroup(const char *groupname) {
@@ -249,2 +268,3 @@ bool Passwd::delGroup(const char *groupname) {
+// Delete a group by gid.
bool Passwd::delGroup(int gid) {
@@ -254,2 +274,3 @@ bool Passwd::delGroup(int gid) {
+// Add a user as a member to a group in groupStringList.
bool Passwd::addGroupMember(QString groupname, QString member) {
@@ -261,2 +282,3 @@ bool Passwd::addGroupMember(QString groupname, QString member) {
+// Delete a user as a groupmember from a group in groupStringList.
bool Passwd::delGroupMember(QString groupname, QString member) {
@@ -273,2 +295,3 @@ bool Passwd::delGroupMember(QString groupname, QString member) {
+// Global Object
Passwd *accounts;
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 36bcf86..c82cc9d 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -34,3 +34,4 @@ using namespace Opie;
*/
-UserDialog::UserDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) {
+UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) {
+ vm=viewmode;
QVBoxLayout *layout = new QVBoxLayout(this);
@@ -111,4 +112,5 @@ void UserDialog::setupTab1() {
+ if(vm==VIEWMODE_NEW) {
// Copy /etc/skel
- QLabel *skelLabel=new QLabel(tabpage,"skel");
+ skelLabel=new QLabel(tabpage,"skel");
skelLabel->setText("Copy /etc/skel: ");
@@ -116,4 +118,3 @@ void UserDialog::setupTab1() {
skelCheckBox->setChecked(true);
-// skelLabel->setDisabled(true);
-// skelCheckBox->setDisabled(true);
+ }
@@ -138,4 +139,6 @@ void UserDialog::setupTab1() {
vlayout1->addWidget(groupLabel);
+ if(vm==VIEWMODE_NEW) {
vlayout1->addSpacing(5);
vlayout1->addWidget(skelLabel);
+ }
// Second column, data
@@ -152,4 +155,6 @@ void UserDialog::setupTab1() {
vlayout2->addWidget(groupComboBox);
+ if(vm==VIEWMODE_NEW) {
vlayout2->addSpacing(5);
vlayout2->addWidget(skelCheckBox);
+ }
hlayout->addLayout(vlayout1);
@@ -198,3 +203,4 @@ bool UserDialog::addUser(int uid, int gid) {
if(ODevice::inst()->system()==System_OpenZaurus) oz=true;
- UserDialog *adduserDialog=new UserDialog();
+ // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating adduserDialog's widgets here.
+ UserDialog *adduserDialog=new UserDialog(VIEWMODE_NEW);
adduserDialog->setCaption(tr("Add User"));
@@ -300,3 +306,4 @@ bool UserDialog::editUser(const char *username) {
int invalid_group=0;
- UserDialog *edituserDialog=new UserDialog(); // Create Dialog
+ // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating edituserDialog's widgets here.
+ UserDialog *edituserDialog=new UserDialog(VIEWMODE_EDIT); // Create Dialog
edituserDialog->setCaption(tr("Edit User"));
diff --git a/noncore/settings/usermanager/userdialog.h b/noncore/settings/usermanager/userdialog.h
index 133b35d..b7b925d 100644
--- a/noncore/settings/usermanager/userdialog.h
+++ b/noncore/settings/usermanager/userdialog.h
@@ -44,2 +44,7 @@ private:
int userID;
+ int vm;
+ enum VIEWMODE {
+ VIEWMODE_NEW,
+ VIEWMODE_EDIT
+ };
@@ -53,3 +58,3 @@ private slots:
public:
- UserDialog( QWidget* parent = 0, const char* name = 0, bool modal=true, WFlags fl = 0 );
+ UserDialog( int viewmode=VIEWMODE_NEW, QWidget* parent = 0, const char* name = 0, bool modal=true, WFlags fl = 0 );
~UserDialog();