author | drw <drw> | 2004-02-22 00:50:59 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-22 00:50:59 (UTC) |
commit | 9ab4aa3df617519bdf4309303725abc802fbc704 (patch) (unidiff) | |
tree | 42f80b5b426c9c2dfeeee0d758a81a15f8031a1c /noncore/settings | |
parent | b7f37da2a6266326102cda0dc4569033e3d3f9d0 (diff) | |
download | opie-9ab4aa3df617519bdf4309303725abc802fbc704.zip opie-9ab4aa3df617519bdf4309303725abc802fbc704.tar.gz opie-9ab4aa3df617519bdf4309303725abc802fbc704.tar.bz2 |
User Manager: libopie->libopie2
-rw-r--r-- | noncore/settings/usermanager/main.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/usermanager/opie-usermanager.control | 2 | ||||
-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 60 | ||||
-rw-r--r-- | noncore/settings/usermanager/userdialog.h | 70 | ||||
-rw-r--r-- | noncore/settings/usermanager/usermanager.pro | 16 |
5 files changed, 76 insertions, 76 deletions
diff --git a/noncore/settings/usermanager/main.cpp b/noncore/settings/usermanager/main.cpp index 515ea9a..d7147d1 100644 --- a/noncore/settings/usermanager/main.cpp +++ b/noncore/settings/usermanager/main.cpp | |||
@@ -9,6 +9,6 @@ | |||
9 | 9 | ||
10 | #include "usermanager.h" | 10 | #include "usermanager.h" |
11 | #include <qpe/qpeapplication.h> | 11 | |
12 | #include <opie/oapplicationfactory.h> | 12 | #include <opie2/oapplicationfactory.h> |
13 | 13 | ||
14 | OPIE_EXPORT_APP( OApplicationFactory<UserConfig> ) | 14 | OPIE_EXPORT_APP( OApplicationFactory<UserConfig> ) |
diff --git a/noncore/settings/usermanager/opie-usermanager.control b/noncore/settings/usermanager/opie-usermanager.control index 5061366..52930d2 100644 --- a/noncore/settings/usermanager/opie-usermanager.control +++ b/noncore/settings/usermanager/opie-usermanager.control | |||
@@ -3,5 +3,5 @@ Files: plugins/application/libusermanager.so* bin/usermanager apps/Settings/user | |||
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Depends: task-opie-minimal | 5 | Depends: task-opie-minimal, libopiecore2, libopieui2 |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Maintainer: Ted Parnefors <zaurus@bredband.net> | 7 | Maintainer: Ted Parnefors <zaurus@bredband.net> |
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index 08de352..eb9a289 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp | |||
@@ -12,5 +12,5 @@ | |||
12 | 12 | ||
13 | /* OPIE */ | 13 | /* OPIE */ |
14 | #include <opie/odevice.h> | 14 | #include <opie2/odevice.h> |
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | 16 | ||
@@ -50,5 +50,5 @@ UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool mod | |||
50 | accounts->splitGroupEntry(*it); | 50 | accounts->splitGroupEntry(*it); |
51 | if(accounts->gr_name.find(QRegExp("^#"),0)) | 51 | if(accounts->gr_name.find(QRegExp("^#"),0)) |
52 | {// Skip commented lines. | 52 | { // Skip commented lines. |
53 | new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox); | 53 | new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox); |
54 | groupComboBox->insertItem(accounts->gr_name); | 54 | groupComboBox->insertItem(accounts->gr_name); |
@@ -80,6 +80,6 @@ void UserDialog::setupTab1() | |||
80 | picturePushButton->setMinimumSize(48,48); | 80 | picturePushButton->setMinimumSize(48,48); |
81 | picturePushButton->setMaximumSize(48,48); | 81 | picturePushButton->setMaximumSize(48,48); |
82 | picturePushButton->setPixmap(Resource::loadPixmap("usermanager/usericon"));// Load default usericon. | 82 | picturePushButton->setPixmap(Resource::loadPixmap("usermanager/usericon")); // Load default usericon. |
83 | connect(picturePushButton,SIGNAL(clicked()),this,SLOT(clickedPicture()));// Clicking the picture should invoke pictureselector. | 83 | connect(picturePushButton,SIGNAL(clicked()),this,SLOT(clickedPicture())); // Clicking the picture should invoke pictureselector. |
84 | 84 | ||
85 | // Login | 85 | // Login |
@@ -201,5 +201,5 @@ void UserDialog::setupTab2() | |||
201 | /** | 201 | /** |
202 | * Static function that creates the userinfo dialog. | 202 | * Static function that creates the userinfo dialog. |
203 | * The user will be prompted to add a user. | 203 | * The user will be prompted to add a user. |
204 | * | 204 | * |
205 | * @param uid This is a suggested available UID. | 205 | * @param uid This is a suggested available UID. |
@@ -218,6 +218,6 @@ bool UserDialog::addUser(int uid, int gid) | |||
218 | UserDialog *adduserDialog=new UserDialog(VIEWMODE_NEW); | 218 | UserDialog *adduserDialog=new UserDialog(VIEWMODE_NEW); |
219 | adduserDialog->setCaption(tr("Add User")); | 219 | adduserDialog->setCaption(tr("Add User")); |
220 | adduserDialog->userID=uid;// Set next available UID as default uid. | 220 | adduserDialog->userID=uid; // Set next available UID as default uid. |
221 | adduserDialog->groupID=gid;// Set next available GID as default gid. | 221 | adduserDialog->groupID=gid; // Set next available GID as default gid. |
222 | // Insert default group into groupComboBox | 222 | // Insert default group into groupComboBox |
223 | adduserDialog->groupComboBox->insertItem("<create new group>",0); | 223 | adduserDialog->groupComboBox->insertItem("<create new group>",0); |
@@ -272,5 +272,5 @@ bool UserDialog::addUser(int uid, int gid) | |||
272 | } | 272 | } |
273 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; | 273 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; |
274 | // adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); | 274 | // adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48); |
275 | adduserDialog->userImage.save(filename,"PNG"); | 275 | adduserDialog->userImage.save(filename,"PNG"); |
276 | } | 276 | } |
@@ -285,5 +285,5 @@ bool UserDialog::addUser(int uid, int gid) | |||
285 | system(command_cp); | 285 | system(command_cp); |
286 | 286 | ||
287 | command_cp.sprintf("cp -a /etc/skel/.[!.]* %s/",accounts->pw_dir.latin1());// Bug in busybox, ".*" includes parent directory, does this work as a workaround? | 287 | command_cp.sprintf("cp -a /etc/skel/.[!.]* %s/",accounts->pw_dir.latin1()); // Bug in busybox, ".*" includes parent directory, does this work as a workaround? |
288 | system(command_cp); | 288 | system(command_cp); |
289 | 289 | ||
@@ -306,7 +306,7 @@ bool UserDialog::delUser(const char *username) | |||
306 | { | 306 | { |
307 | if((accounts->findUser(username))) | 307 | if((accounts->findUser(username))) |
308 | {// Does that user exist? | 308 | { // Does that user exist? |
309 | if(!(accounts->delUser(username))) | 309 | if(!(accounts->delUser(username))) |
310 | {// Delete the user. | 310 | { // Delete the user. |
311 | QMessageBox::information(0,"Ooops!","Something went wrong\nUnable to delete user: "+QString(username)+"."); | 311 | QMessageBox::information(0,"Ooops!","Something went wrong\nUnable to delete user: "+QString(username)+"."); |
312 | } | 312 | } |
@@ -333,9 +333,9 @@ bool UserDialog::editUser(const char *username) | |||
333 | int invalid_group=0; | 333 | int invalid_group=0; |
334 | // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating edituserDialog's widgets here. | 334 | // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating edituserDialog's widgets here. |
335 | UserDialog *edituserDialog=new UserDialog(VIEWMODE_EDIT);// Create Dialog | 335 | UserDialog *edituserDialog=new UserDialog(VIEWMODE_EDIT); // Create Dialog |
336 | edituserDialog->setCaption(tr("Edit User")); | 336 | edituserDialog->setCaption(tr("Edit User")); |
337 | accounts->findUser(username);// Locate user in database and fill variables in 'accounts' object. | 337 | accounts->findUser(username); // Locate user in database and fill variables in 'accounts' object. |
338 | if(!(accounts->findGroup(accounts->pw_gid))) | 338 | if(!(accounts->findGroup(accounts->pw_gid))) |
339 | {// Locate the user's primary group, and fill group variables in 'accounts' object. | 339 | { // Locate the user's primary group, and fill group variables in 'accounts' object. |
340 | invalid_group=1; | 340 | invalid_group=1; |
341 | } | 341 | } |
@@ -370,10 +370,10 @@ bool UserDialog::editUser(const char *username) | |||
370 | QCheckListItem *temp; | 370 | QCheckListItem *temp; |
371 | // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead. | 371 | // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead. |
372 | QRegExp userRegExp(QString("[:,]%1$").arg(username));// The end of line variant. | 372 | QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant. |
373 | QStringList tempList=accounts->groupStringList.grep(userRegExp);// Find all entries in the group database, that the user is a member of. | 373 | QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. |
374 | for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) | 374 | for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) |
375 | {// Iterate over all of them. | 375 | { // Iterate over all of them. |
376 | qWarning(*it); | 376 | qWarning(*it); |
377 | QListViewItemIterator lvit( edituserDialog->groupsListView );// Compare to all groups. | 377 | QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. |
378 | for ( ; lvit.current(); ++lvit ) | 378 | for ( ; lvit.current(); ++lvit ) |
379 | { | 379 | { |
@@ -381,14 +381,14 @@ bool UserDialog::editUser(const char *username) | |||
381 | { | 381 | { |
382 | temp=(QCheckListItem*)lvit.current(); | 382 | temp=(QCheckListItem*)lvit.current(); |
383 | temp->setOn(true);// If we find a line with that groupname, select it.; | 383 | temp->setOn(true); // If we find a line with that groupname, select it.; |
384 | } | 384 | } |
385 | } | 385 | } |
386 | } | 386 | } |
387 | userRegExp=QRegExp(QString("[:,]%1,").arg(username));// And the other one. (not end of line.) | 387 | userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.) |
388 | tempList=accounts->groupStringList.grep(userRegExp);// Find all entries in the group database, that the user is a member of. | 388 | tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. |
389 | for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) | 389 | for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) |
390 | {// Iterate over all of them. | 390 | { // Iterate over all of them. |
391 | qWarning(*it); | 391 | qWarning(*it); |
392 | QListViewItemIterator lvit( edituserDialog->groupsListView );// Compare to all groups. | 392 | QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. |
393 | for ( ; lvit.current(); ++lvit ) | 393 | for ( ; lvit.current(); ++lvit ) |
394 | { | 394 | { |
@@ -396,12 +396,12 @@ bool UserDialog::editUser(const char *username) | |||
396 | { | 396 | { |
397 | temp=(QCheckListItem*)lvit.current(); | 397 | temp=(QCheckListItem*)lvit.current(); |
398 | temp->setOn(true);// If we find a line with that groupname, select it.; | 398 | temp->setOn(true); // If we find a line with that groupname, select it.; |
399 | } | 399 | } |
400 | } | 400 | } |
401 | } | 401 | } |
402 | 402 | ||
403 | if(!(edituserDialog->exec())) return false;// SHOW THE DIALOG! | 403 | if(!(edituserDialog->exec())) return false; // SHOW THE DIALOG! |
404 | 404 | ||
405 | accounts->findUser(username);// Fill user variables in 'acccounts' object. | 405 | accounts->findUser(username); // Fill user variables in 'acccounts' object. |
406 | accounts->pw_name=edituserDialog->loginLineEdit->text(); | 406 | accounts->pw_name=edituserDialog->loginLineEdit->text(); |
407 | // Has the password been changed ? Make a new "crypt":ed password. | 407 | // Has the password been changed ? Make a new "crypt":ed password. |
@@ -411,6 +411,6 @@ bool UserDialog::editUser(const char *username) | |||
411 | accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt(); | 411 | accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt(); |
412 | if(accounts->findGroup(edituserDialog->groupComboBox->currentText())) | 412 | if(accounts->findGroup(edituserDialog->groupComboBox->currentText())) |
413 | {// Fill all group variables in 'accounts' object. | 413 | { // Fill all group variables in 'accounts' object. |
414 | accounts->pw_gid=accounts->gr_gid;// Only do this if the group is a valid group (ie. "<Undefined group>"), otherwise keep the old group. | 414 | accounts->pw_gid=accounts->gr_gid; // Only do this if the group is a valid group (ie. "<Undefined group>"), otherwise keep the old group. |
415 | } | 415 | } |
416 | accounts->pw_gecos=edituserDialog->gecosLineEdit->text(); | 416 | accounts->pw_gecos=edituserDialog->gecosLineEdit->text(); |
@@ -443,5 +443,5 @@ bool UserDialog::editUser(const char *username) | |||
443 | } | 443 | } |
444 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; | 444 | QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; |
445 | // edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48); | 445 | // edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48); |
446 | edituserDialog->userImage.save(filename,"PNG"); | 446 | edituserDialog->userImage.save(filename,"PNG"); |
447 | } | 447 | } |
@@ -480,5 +480,5 @@ void UserDialog::clickedPicture() | |||
480 | else | 480 | else |
481 | { | 481 | { |
482 | // userImage=userImage.smoothScale(48,48); | 482 | // userImage=userImage.smoothScale(48,48); |
483 | QPixmap *picture; | 483 | QPixmap *picture; |
484 | picture=(QPixmap *)picturePushButton->pixmap(); | 484 | picture=(QPixmap *)picturePushButton->pixmap(); |
diff --git a/noncore/settings/usermanager/userdialog.h b/noncore/settings/usermanager/userdialog.h index 3272afc..a94e49b 100644 --- a/noncore/settings/usermanager/userdialog.h +++ b/noncore/settings/usermanager/userdialog.h | |||
@@ -21,46 +21,46 @@ | |||
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | #include <opie/ofiledialog.h> | 23 | #include <opie2/ofiledialog.h> |
24 | 24 | ||
25 | class UserDialog : public QDialog | 25 | class UserDialog : public QDialog |
26 | { | 26 | { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | private: | 28 | private: |
29 | QTabWidget *myTabWidget; | 29 | QTabWidget *myTabWidget; |
30 | QPushButton *picturePushButton; | 30 | QPushButton *picturePushButton; |
31 | QLineEdit *loginLineEdit; | 31 | QLineEdit *loginLineEdit; |
32 | QLineEdit *uidLineEdit; | 32 | QLineEdit *uidLineEdit; |
33 | QLineEdit *gecosLineEdit; | 33 | QLineEdit *gecosLineEdit; |
34 | QLineEdit *passwordLineEdit; | 34 | QLineEdit *passwordLineEdit; |
35 | QComboBox *shellComboBox; | 35 | QComboBox *shellComboBox; |
36 | QComboBox *groupComboBox; | 36 | QComboBox *groupComboBox; |
37 | QLabel *skelLabel; | 37 | QLabel *skelLabel; |
38 | QCheckBox *skelCheckBox; | 38 | QCheckBox *skelCheckBox; |
39 | QListView *groupsListView; | 39 | QListView *groupsListView; |
40 | 40 | ||
41 | QStringList groupMembers; | 41 | QStringList groupMembers; |
42 | QString pictureLocation; | 42 | QString pictureLocation; |
43 | QImage userImage; | 43 | QImage userImage; |
44 | int groupID; | 44 | int groupID; |
45 | int userID; | 45 | int userID; |
46 | int vm; | 46 | int vm; |
47 | enum VIEWMODE { | 47 | enum VIEWMODE { |
48 | VIEWMODE_NEW, | 48 | VIEWMODE_NEW, |
49 | VIEWMODE_EDIT | 49 | VIEWMODE_EDIT |
50 | }; | 50 | }; |
51 | 51 | ||
52 | void setupTab1(void); | 52 | void setupTab1(void); |
53 | void setupTab2(void); | 53 | void setupTab2(void); |
54 | void accept(void); | 54 | void accept(void); |
55 | 55 | ||
56 | private slots: | 56 | private slots: |
57 | void clickedPicture(void); | 57 | void clickedPicture(void); |
58 | 58 | ||
59 | public: | 59 | public: |
60 | UserDialog( int viewmode=VIEWMODE_NEW, QWidget* parent = 0, const char* name = 0, bool modal=true, WFlags fl = 0 ); | 60 | UserDialog( int viewmode=VIEWMODE_NEW, QWidget* parent = 0, const char* name = 0, bool modal=true, WFlags fl = 0 ); |
61 | ~UserDialog(); | 61 | ~UserDialog(); |
62 | static bool addUser(int uid, int gid); | 62 | static bool addUser(int uid, int gid); |
63 | static bool editUser(const char *username); | 63 | static bool editUser(const char *username); |
64 | static bool delUser(const char *username); | 64 | static bool delUser(const char *username); |
65 | }; | 65 | }; |
66 | 66 | ||
diff --git a/noncore/settings/usermanager/usermanager.pro b/noncore/settings/usermanager/usermanager.pro index 0b2f056..f20c9c3 100644 --- a/noncore/settings/usermanager/usermanager.pro +++ b/noncore/settings/usermanager/usermanager.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | #CONFIG = qt warn_on debug | 1 | #CONFIG = qt warn_on debug |
2 | CONFIG = qt warn_on release quick-app | 2 | CONFIG = qt warn_on release quick-app |
3 | HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h | 3 | HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h |
4 | SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp | 4 | SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp |
5 | INCLUDEPATH+= $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lqpe -lopie -lcrypt | 7 | LIBS += -lqpe -lopiecore2 -lopieui2 -lcrypt |
8 | TARGET = usermanager | 8 | TARGET = usermanager |
9 | 9 | ||
10 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |