summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2002-10-14 21:58:41 (UTC)
committer umopapisdn <umopapisdn>2002-10-14 21:58:41 (UTC)
commit09ba6b7531801dde243469f05f5e5c31596cdd2d (patch) (unidiff)
tree07531378e9a05ff777dfb151276075b233bcb4d8
parent14f450ead20011e5697bb36a4ad087cc648b439d (diff)
downloadopie-09ba6b7531801dde243469f05f5e5c31596cdd2d.zip
opie-09ba6b7531801dde243469f05f5e5c31596cdd2d.tar.gz
opie-09ba6b7531801dde243469f05f5e5c31596cdd2d.tar.bz2
Support for a skeleton homedirectory in /etc/skel.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/userdialog.cpp20
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
@@ -107,14 +107,14 @@ void UserDialog::setupTab1() {
107 107
108 // Copy /etc/skel 108 // Copy /etc/skel
109 QLabel *skelLabel=new QLabel(tabpage,"skel"); 109 QLabel *skelLabel=new QLabel(tabpage,"skel");
110 skelLabel->setText("Copy /etc/skel: "); 110 skelLabel->setText("Copy /etc/skel: ");
111 skelCheckBox=new QCheckBox(tabpage); 111 skelCheckBox=new QCheckBox(tabpage);
112 skelCheckBox->setChecked(true); 112 skelCheckBox->setChecked(true);
113 skelLabel->setDisabled(true); 113 //skelLabel->setDisabled(true);
114 skelCheckBox->setDisabled(true); 114 //skelCheckBox->setDisabled(true);
115 115
116 // Widget layout 116 // Widget layout
117 QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); 117 QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout");
118 layout->addWidget(picturePushButton); 118 layout->addWidget(picturePushButton);
119 layout->addSpacing(5); 119 layout->addSpacing(5);
120 layout->addLayout(hlayout); 120 layout->addLayout(hlayout);
@@ -240,12 +240,28 @@ bool UserDialog::addUser(int uid, int gid) {
240 d.mkdir("/opt/QtPalmtop/pics/users"); 240 d.mkdir("/opt/QtPalmtop/pics/users");
241 } 241 }
242 QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; 242 QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png";
243 // adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); 243 // adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48);
244 adduserDialog->userImage.save(filename,"PNG"); 244 adduserDialog->userImage.save(filename,"PNG");
245 } 245 }
246
247 // Should we copy the skeleton homedirectory /etc/skel to the user's homedirectory?
248 accounts->findUser(adduserDialog->loginLineEdit->text());
249 if(adduserDialog->skelCheckBox->isChecked()) {
250 QString command_cp;
251 QString command_chown;
252 command_cp.sprintf("cp -a /etc/skel/* %s/",accounts->pw_dir.latin1());
253 system(command_cp);
254
255 command_cp.sprintf("cp -a /etc/skel/.[!.]* %s/",accounts->pw_dir.latin1());// Bug in busybox, ".*" includes parent directory, does this work as a workaround?
256 system(command_cp);
257
258 command_chown.sprintf("chown -R %d:%d %s",accounts->pw_uid,accounts->pw_gid,accounts->pw_dir.latin1());
259 system(command_chown);
260 }
261
246 return true; 262 return true;
247} 263}
248 264
249/** 265/**
250 * Deletes the user account. 266 * Deletes the user account.
251 * 267 *