summaryrefslogtreecommitdiff
path: root/noncore/settings/usermanager
Unidiff
Diffstat (limited to 'noncore/settings/usermanager') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/userdialog.cpp2
-rw-r--r--noncore/settings/usermanager/userdialog.h1
-rw-r--r--noncore/settings/usermanager/usermanager.cpp2
-rw-r--r--noncore/settings/usermanager/usermanager.pro2
4 files changed, 4 insertions, 3 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index c06f639..19b0e84 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -380,62 +380,62 @@ bool UserDialog::editUser(const char *username) {
380 accounts->pw_shell=edituserDialog->shellComboBox->currentText(); 380 accounts->pw_shell=edituserDialog->shellComboBox->currentText();
381 // Update userinfo, using the information stored in the user variables stored in the accounts object. 381 // Update userinfo, using the information stored in the user variables stored in the accounts object.
382 accounts->updateUser(username); 382 accounts->updateUser(username);
383 383
384 // Remove user from all groups he/she is a member of. (could be done in a better way I guess, this was simple though.) 384 // Remove user from all groups he/she is a member of. (could be done in a better way I guess, this was simple though.)
385 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { 385 for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) {
386 accounts->delGroupMember((*it).left((*it).find(":")),username); 386 accounts->delGroupMember((*it).left((*it).find(":")),username);
387 } 387 }
388 388
389 // Add User to additional groups that he/she is a member of. 389 // Add User to additional groups that he/she is a member of.
390 QListViewItemIterator it( edituserDialog->groupsListView ); 390 QListViewItemIterator it( edituserDialog->groupsListView );
391 for ( ; it.current(); ++it ) { 391 for ( ; it.current(); ++it ) {
392 temp=(QCheckListItem*)it.current(); 392 temp=(QCheckListItem*)it.current();
393 if ( temp->isOn() ) 393 if ( temp->isOn() )
394 accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text()); 394 accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text());
395 } 395 }
396 396
397 // Copy image to pics/users/ 397 // Copy image to pics/users/
398 if(!(edituserDialog->userImage.isNull())) { 398 if(!(edituserDialog->userImage.isNull())) {
399 QDir d; 399 QDir d;
400 if(!(d.exists("/opt/QtPalmtop/pics/users"))) { 400 if(!(d.exists("/opt/QtPalmtop/pics/users"))) {
401 d.mkdir("/opt/QtPalmtop/pics/users"); 401 d.mkdir("/opt/QtPalmtop/pics/users");
402 } 402 }
403 QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; 403 QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png";
404 // edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48); 404 // edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48);
405 edituserDialog->userImage.save(filename,"PNG"); 405 edituserDialog->userImage.save(filename,"PNG");
406 } 406 }
407 return true; 407 return true;
408} 408}
409 409
410/** 410/**
411 * "OK" has been clicked. Verify some information before closing the dialog. 411 * "OK" has been clicked. Verify some information before closing the dialog.
412 * 412 *
413 */ 413 */
414void UserDialog::accept() { 414void UserDialog::accept() {
415 // Add checking... valid username? username taken? 415 // Add checking... valid username? username taken?
416 if(loginLineEdit->text().isEmpty()) { 416 if(loginLineEdit->text().isEmpty()) {
417 QMessageBox::information(0,"Empty Login","Please enter a login."); 417 QMessageBox::information(0,"Empty Login","Please enter a login.");
418 return; 418 return;
419 } 419 }
420 QDialog::accept(); 420 QDialog::accept();
421} 421}
422 422
423/** 423/**
424 * This slot is called when the usericon is clicked, this loads (should) the iconselector. 424 * This slot is called when the usericon is clicked, this loads (should) the iconselector.
425 * 425 *
426 */ 426 */
427void UserDialog::clickedPicture() { 427void UserDialog::clickedPicture() {
428 QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED,"/opt/QtPalmtop/pics"); 428 QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED, QString::null);
429 if(!(filename.isEmpty())) { 429 if(!(filename.isEmpty())) {
430 userImage.reset(); 430 userImage.reset();
431 if(!(userImage.load(filename))) { 431 if(!(userImage.load(filename))) {
432 QMessageBox::information(0,"Sorry!","That icon could not be loaded.\nLoading failed on: "+filename); 432 QMessageBox::information(0,"Sorry!","That icon could not be loaded.\nLoading failed on: "+filename);
433 } else { 433 } else {
434 // userImage=userImage.smoothScale(48,48); 434 // userImage=userImage.smoothScale(48,48);
435 QPixmap *picture; 435 QPixmap *picture;
436 picture=(QPixmap *)picturePushButton->pixmap(); 436 picture=(QPixmap *)picturePushButton->pixmap();
437 picture->convertFromImage(userImage,0); 437 picture->convertFromImage(userImage,0);
438 picturePushButton->update(); 438 picturePushButton->update();
439 } 439 }
440 } 440 }
441} 441}
diff --git a/noncore/settings/usermanager/userdialog.h b/noncore/settings/usermanager/userdialog.h
index b7b925d..3272afc 100644
--- a/noncore/settings/usermanager/userdialog.h
+++ b/noncore/settings/usermanager/userdialog.h
@@ -1,66 +1,67 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9#ifndef USERDIALOG_H 9#ifndef USERDIALOG_H
10#define USERDIALOG_H 10#define USERDIALOG_H
11 11
12#include <qdialog.h> 12#include <qdialog.h>
13#include <qlineedit.h> 13#include <qlineedit.h>
14#include <qcombobox.h> 14#include <qcombobox.h>
15#include <qlistview.h> 15#include <qlistview.h>
16#include <qtabwidget.h> 16#include <qtabwidget.h>
17#include <qpushbutton.h> 17#include <qpushbutton.h>
18#include <qcheckbox.h> 18#include <qcheckbox.h>
19#include <qlabel.h>
19 20
20#include <qpe/resource.h> 21#include <qpe/resource.h>
21 22
22#include <opie/ofiledialog.h> 23#include <opie/ofiledialog.h>
23 24
24class UserDialog : public QDialog 25class UserDialog : public QDialog
25{ 26{
26 Q_OBJECT 27 Q_OBJECT
27private: 28private:
28 QTabWidget *myTabWidget; 29 QTabWidget *myTabWidget;
29 QPushButton *picturePushButton; 30 QPushButton *picturePushButton;
30 QLineEdit *loginLineEdit; 31 QLineEdit *loginLineEdit;
31 QLineEdit *uidLineEdit; 32 QLineEdit *uidLineEdit;
32 QLineEdit *gecosLineEdit; 33 QLineEdit *gecosLineEdit;
33 QLineEdit *passwordLineEdit; 34 QLineEdit *passwordLineEdit;
34 QComboBox *shellComboBox; 35 QComboBox *shellComboBox;
35 QComboBox *groupComboBox; 36 QComboBox *groupComboBox;
36 QLabel *skelLabel; 37 QLabel *skelLabel;
37 QCheckBox *skelCheckBox; 38 QCheckBox *skelCheckBox;
38 QListView *groupsListView; 39 QListView *groupsListView;
39 40
40 QStringList groupMembers; 41 QStringList groupMembers;
41 QString pictureLocation; 42 QString pictureLocation;
42 QImage userImage; 43 QImage userImage;
43 int groupID; 44 int groupID;
44 int userID; 45 int userID;
45 int vm; 46 int vm;
46 enum VIEWMODE { 47 enum VIEWMODE {
47 VIEWMODE_NEW, 48 VIEWMODE_NEW,
48 VIEWMODE_EDIT 49 VIEWMODE_EDIT
49 }; 50 };
50 51
51 void setupTab1(void); 52 void setupTab1(void);
52 void setupTab2(void); 53 void setupTab2(void);
53 void accept(void); 54 void accept(void);
54 55
55private slots: 56private slots:
56 void clickedPicture(void); 57 void clickedPicture(void);
57 58
58public: 59public:
59 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 );
60 ~UserDialog(); 61 ~UserDialog();
61 static bool addUser(int uid, int gid); 62 static bool addUser(int uid, int gid);
62 static bool editUser(const char *username); 63 static bool editUser(const char *username);
63 static bool delUser(const char *username); 64 static bool delUser(const char *username);
64}; 65};
65 66
66#endif 67#endif
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index 1946013..65bbd8b 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -1,78 +1,78 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10#include "usermanager.h" 10#include "usermanager.h"
11 11
12#include <qlayout.h> 12#include <qlayout.h>
13#include <stdio.h> 13#include <stdio.h>
14 14
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <qfile.h> 16#include <qfile.h>
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18 18
19#include <qregexp.h> 19#include <qregexp.h>
20 20
21/** 21/**
22 * The mainwindow constructor. 22 * The mainwindow constructor.
23 * 23 *
24 * @param QWidget *parent 24 * @param QWidget *parent
25 * @param const char *name 25 * @param const char *name
26 * @ param WFlags fl 26 * @ param WFlags fl
27 * 27 *
28 */ 28 */
29UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { 29UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) {
30 setCaption(tr("OPIE User Manager")); 30 setCaption(tr("Opie User Manager"));
31 31
32 // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them. 32 // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them.
33 accounts=new Passwd(); 33 accounts=new Passwd();
34 accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory. 34 accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory.
35 35
36 // Create the toolbar. 36 // Create the toolbar.
37 QPEToolBar *toolbar = new QPEToolBar(this,"Toolbar"); 37 QPEToolBar *toolbar = new QPEToolBar(this,"Toolbar");
38 toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!? 38 toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!?
39 adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User"); 39 adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User");
40 edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User"); 40 edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User");
41 deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User"); 41 deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User");
42 QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User"); 42 QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User");
43 userstext->setUsesTextLabel(true); 43 userstext->setUsesTextLabel(true);
44 toolbar->addSeparator(); 44 toolbar->addSeparator();
45 addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group"); 45 addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group");
46 editgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/editgroup"),"Edit Group",0,this,SLOT(editGroup()),toolbar,"Edit Group"); 46 editgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/editgroup"),"Edit Group",0,this,SLOT(editGroup()),toolbar,"Edit Group");
47 deletegroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/deletegroup"),"Delete Group",0,this,SLOT(delGroup()),toolbar,"Delete Group"); 47 deletegroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/deletegroup"),"Delete Group",0,this,SLOT(delGroup()),toolbar,"Delete Group");
48 QToolButton *groupstext = new QToolButton(0,"Group",0,0,0,toolbar,"Group"); 48 QToolButton *groupstext = new QToolButton(0,"Group",0,0,0,toolbar,"Group");
49 groupstext->setUsesTextLabel(true); 49 groupstext->setUsesTextLabel(true);
50 addToolBar(toolbar,"myToolBar"); 50 addToolBar(toolbar,"myToolBar");
51 51
52 // Add a tabwidget and all the tabs. 52 // Add a tabwidget and all the tabs.
53 myTabWidget = new QTabWidget(this,"My Tab Widget"); 53 myTabWidget = new QTabWidget(this,"My Tab Widget");
54 setupTabAccounts(); 54 setupTabAccounts();
55 setupTabAllUsers(); 55 setupTabAllUsers();
56 setupTabAllGroups(); 56 setupTabAllGroups();
57 userPopupMenu.insertItem("Copy",0); 57 userPopupMenu.insertItem("Copy",0);
58 58
59 getUsers(); // Fill out the iconview & listview with all users. 59 getUsers(); // Fill out the iconview & listview with all users.
60 getGroups(); // Fill out the group listview with all groups. 60 getGroups(); // Fill out the group listview with all groups.
61 61
62 setCentralWidget(myTabWidget); 62 setCentralWidget(myTabWidget);
63} 63}
64 64
65UserConfig::~UserConfig() { 65UserConfig::~UserConfig() {
66 accounts->close(); 66 accounts->close();
67 delete accounts; 67 delete accounts;
68} 68}
69 69
70void UserConfig::setupTabAccounts() { 70void UserConfig::setupTabAccounts() {
71 QWidget *tabpage = new QWidget(this); 71 QWidget *tabpage = new QWidget(this);
72 QVBoxLayout *layout = new QVBoxLayout(tabpage); 72 QVBoxLayout *layout = new QVBoxLayout(tabpage);
73 layout->setMargin(5); 73 layout->setMargin(5);
74 74
75 usersIconView=new QListView(tabpage,"users"); 75 usersIconView=new QListView(tabpage,"users");
76 usersIconView->addColumn("Icon"); 76 usersIconView->addColumn("Icon");
77 usersIconView->addColumn("Username"); 77 usersIconView->addColumn("Username");
78 usersIconView->setAllColumnsShowFocus(true); 78 usersIconView->setAllColumnsShowFocus(true);
diff --git a/noncore/settings/usermanager/usermanager.pro b/noncore/settings/usermanager/usermanager.pro
index 576a233..1baccb6 100644
--- a/noncore/settings/usermanager/usermanager.pro
+++ b/noncore/settings/usermanager/usermanager.pro
@@ -1,34 +1,34 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on debug 2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release 3 CONFIG = qt warn_on release
4 HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h 4 HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h
5 SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp 5 SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.h main.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include 6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include 7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe -lopie -lcrypt 8LIBS += -lqpe -lopie -lcrypt
9 TARGET = usermanager 9 TARGET = usermanager
10DESTDIR = $(OPIEDIR)/bin 10DESTDIR = $(OPIEDIR)/bin
11 11
12TRANSLATIONS = ../../../i18n/de/usermanager.ts \ 12TRANSLATIONS = ../../../i18n/de/usermanager.ts \
13 ../../../i18n/nl/usermanager.ts \ 13 ../../../i18n/nl/usermanager.ts \
14 ../../../i18n/xx/usermanager.ts \ 14 ../../../i18n/xx/usermanager.ts \
15 ../../../i18n/en/usermanager.ts \ 15 ../../../i18n/en/usermanager.ts \
16 ../../../i18n/es/usermanager.ts \ 16 ../../../i18n/es/usermanager.ts \
17 ../../../i18n/fr/usermanager.ts \ 17 ../../../i18n/fr/usermanager.ts \
18 ../../../i18n/hu/usermanager.ts \ 18 ../../../i18n/hu/usermanager.ts \
19 ../../../i18n/ja/usermanager.ts \ 19 ../../../i18n/ja/usermanager.ts \
20 ../../../i18n/ko/usermanager.ts \ 20 ../../../i18n/ko/usermanager.ts \
21 ../../../i18n/no/usermanager.ts \ 21 ../../../i18n/no/usermanager.ts \
22 ../../../i18n/pl/usermanager.ts \ 22 ../../../i18n/pl/usermanager.ts \
23 ../../../i18n/pt/usermanager.ts \ 23 ../../../i18n/pt/usermanager.ts \
24 ../../../i18n/pt_BR/usermanager.ts \ 24 ../../../i18n/pt_BR/usermanager.ts \
25 ../../../i18n/sl/usermanager.ts \ 25 ../../../i18n/sl/usermanager.ts \
26 ../../../i18n/zh_CN/usermanager.ts \ 26 ../../../i18n/zh_CN/usermanager.ts \
27 ../../../i18n/zh_TW/usermanager.ts \ 27 ../../../i18n/zh_TW/usermanager.ts \
28 ../../../i18n/it/usermanager.ts \ 28 ../../../i18n/it/usermanager.ts \
29 ../../../i18n/da/usermanager.ts 29 ../../../i18n/da/usermanager.ts
30 30
31 31
32 32
33 33
34include ( $(OPIEDIR)/include.pro ) 34include ( $(OPIEDIR)/include.pro )