-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index c43b391..42a9144 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp @@ -105,18 +105,18 @@ 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); +// skelLabel->setDisabled(true); +// skelCheckBox->setDisabled(true); // Widget layout QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); layout->addWidget(picturePushButton); layout->addSpacing(5); layout->addLayout(hlayout); QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1"); QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2"); @@ -238,16 +238,32 @@ bool UserDialog::addUser(int uid, int gid) { QDir d; if(!(d.exists("/opt/QtPalmtop/pics/users"))) { d.mkdir("/opt/QtPalmtop/pics/users"); } QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; // adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); adduserDialog->userImage.save(filename,"PNG"); } + + // Should we copy the skeleton homedirectory /etc/skel to the user's homedirectory? + accounts->findUser(adduserDialog->loginLineEdit->text()); + if(adduserDialog->skelCheckBox->isChecked()) { + QString command_cp; + QString command_chown; + command_cp.sprintf("cp -a /etc/skel/* %s/",accounts->pw_dir.latin1()); + system(command_cp); + + command_cp.sprintf("cp -a /etc/skel/.[!.]* %s/",accounts->pw_dir.latin1()); // Bug in busybox, ".*" includes parent directory, does this work as a workaround? + system(command_cp); + + command_chown.sprintf("chown -R %d:%d %s",accounts->pw_uid,accounts->pw_gid,accounts->pw_dir.latin1()); + system(command_chown); + } + return true; } /** * Deletes the user account. * * @param username User to be deleted. * |