summaryrefslogtreecommitdiff
authorar <ar>2003-12-22 17:29:18 (UTC)
committer ar <ar>2003-12-22 17:29:18 (UTC)
commitf0a4320f43abb1a24f80d6de1a94d39453945355 (patch) (unidiff)
tree5ad5cd96bb659152a67c0f8b43726091615109e8
parent34194d7d8957b77fbc032efa5b89ef56e322d35f (diff)
downloadopie-f0a4320f43abb1a24f80d6de1a94d39453945355.zip
opie-f0a4320f43abb1a24f80d6de1a94d39453945355.tar.gz
opie-f0a4320f43abb1a24f80d6de1a94d39453945355.tar.bz2
- remove stdlib.h and stdio.h
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/groupdialog.cpp2
-rw-r--r--noncore/settings/usermanager/userdialog.cpp9
-rw-r--r--noncore/settings/usermanager/usermanager.cpp1
3 files changed, 3 insertions, 9 deletions
diff --git a/noncore/settings/usermanager/groupdialog.cpp b/noncore/settings/usermanager/groupdialog.cpp
index b595d31..76810be 100644
--- a/noncore/settings/usermanager/groupdialog.cpp
+++ b/noncore/settings/usermanager/groupdialog.cpp
@@ -1,49 +1,47 @@
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 "groupdialog.h" 10#include "groupdialog.h"
11 11
12#include <qlabel.h> 12#include <qlabel.h>
13#include <qlayout.h> 13#include <qlayout.h>
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15 15
16#include <stdlib.h>
17
18#include "passwd.h" 16#include "passwd.h"
19 17
20GroupDialog::GroupDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { 18GroupDialog::GroupDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) {
21 // GID 19 // GID
22 QLabel *gidLabel=new QLabel(this,"gid: "); 20 QLabel *gidLabel=new QLabel(this,"gid: ");
23 gidLabel->setText("GroupID: "); 21 gidLabel->setText("GroupID: ");
24 gidLineEdit=new QLineEdit(this,"gid: "); 22 gidLineEdit=new QLineEdit(this,"gid: ");
25 gidLineEdit->setEnabled(false); 23 gidLineEdit->setEnabled(false);
26 24
27 // Groupname 25 // Groupname
28 QLabel *groupnameLabel=new QLabel(this,"groupname"); 26 QLabel *groupnameLabel=new QLabel(this,"groupname");
29 groupnameLabel->setText("Groupname: "); 27 groupnameLabel->setText("Groupname: ");
30 groupnameLineEdit=new QLineEdit(this,"groupname"); 28 groupnameLineEdit=new QLineEdit(this,"groupname");
31 29
32 // Widget layout 30 // Widget layout
33 QVBoxLayout *layout=new QVBoxLayout(this); 31 QVBoxLayout *layout=new QVBoxLayout(this);
34 layout->setMargin(5); 32 layout->setMargin(5);
35 QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); 33 QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout");
36 layout->addLayout(hlayout); 34 layout->addLayout(hlayout);
37 QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1"); 35 QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1");
38 QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2"); 36 QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2");
39 // First column, labels 37 // First column, labels
40 vlayout1->addWidget(gidLabel); 38 vlayout1->addWidget(gidLabel);
41 vlayout1->addWidget(groupnameLabel); 39 vlayout1->addWidget(groupnameLabel);
42 // Second column, data 40 // Second column, data
43 vlayout2->addWidget(gidLineEdit); 41 vlayout2->addWidget(gidLineEdit);
44 vlayout2->addWidget(groupnameLineEdit); 42 vlayout2->addWidget(groupnameLineEdit);
45 hlayout->addLayout(vlayout1); 43 hlayout->addLayout(vlayout1);
46 hlayout->addLayout(vlayout2); 44 hlayout->addLayout(vlayout2);
47 layout->addSpacing(5); 45 layout->addSpacing(5);
48 46
49 //showMaximized(); 47 //showMaximized();
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 19b0e84..d87a005 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -1,154 +1,151 @@
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 "userdialog.h" 10#include "userdialog.h"
11 11
12#include <qlayout.h> 12#include <qlayout.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15#include <qfile.h> 15#include <qfile.h>
16 16
17#include <stdlib.h>
18
19#include <stdio.h>
20#include <sys/types.h> 17#include <sys/types.h>
21#include <sys/wait.h> 18#include <sys/wait.h>
22#include <unistd.h> 19#include <unistd.h>
23#include <signal.h> 20#include <signal.h>
24 21
25#include "passwd.h" 22#include "passwd.h"
26 23
27#include <opie/odevice.h> 24#include <opie/odevice.h>
28using namespace Opie; 25using namespace Opie;
29 26
30 27
31/** 28/**
32 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. 29 * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups.
33 * 30 *
34 */ 31 */
35UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { 32UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) {
36 vm=viewmode; 33 vm=viewmode;
37 QVBoxLayout *layout = new QVBoxLayout(this); 34 QVBoxLayout *layout = new QVBoxLayout(this);
38 myTabWidget=new QTabWidget(this,"User Tab Widget"); 35 myTabWidget=new QTabWidget(this,"User Tab Widget");
39 layout->addWidget(myTabWidget); 36 layout->addWidget(myTabWidget);
40 setupTab1(); 37 setupTab1();
41 setupTab2(); 38 setupTab2();
42 39
43 accounts->groupStringList.sort(); 40 accounts->groupStringList.sort();
44 // And also fill the listview & the combobox with all available groups. 41 // And also fill the listview & the combobox with all available groups.
45 for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) { 42 for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) {
46 accounts->splitGroupEntry(*it); 43 accounts->splitGroupEntry(*it);
47 if(accounts->gr_name.find(QRegExp("^#"),0)) {// Skip commented lines. 44 if(accounts->gr_name.find(QRegExp("^#"),0)) {// Skip commented lines.
48 new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox); 45 new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
49 groupComboBox->insertItem(accounts->gr_name); 46 groupComboBox->insertItem(accounts->gr_name);
50 } 47 }
51 } 48 }
52 showMaximized(); 49 showMaximized();
53} 50}
54 51
55/** 52/**
56 * Empty destructor. 53 * Empty destructor.
57 * 54 *
58 */ 55 */
59UserDialog::~UserDialog() { 56UserDialog::~UserDialog() {
60} 57}
61 58
62/** 59/**
63 * Creates the first tab, all userinfo is here. 60 * Creates the first tab, all userinfo is here.
64 * 61 *
65 */ 62 */
66void UserDialog::setupTab1() { 63void UserDialog::setupTab1() {
67 QPixmap mypixmap; 64 QPixmap mypixmap;
68 QWidget *tabpage = new QWidget(myTabWidget,"page1"); 65 QWidget *tabpage = new QWidget(myTabWidget,"page1");
69 QVBoxLayout *layout = new QVBoxLayout(tabpage); 66 QVBoxLayout *layout = new QVBoxLayout(tabpage);
70 layout->setMargin(5); 67 layout->setMargin(5);
71 68
72 // Picture 69 // Picture
73 picturePushButton = new QPushButton(tabpage,"Label"); 70 picturePushButton = new QPushButton(tabpage,"Label");
74 picturePushButton->setMinimumSize(48,48); 71 picturePushButton->setMinimumSize(48,48);
75 picturePushButton->setMaximumSize(48,48); 72 picturePushButton->setMaximumSize(48,48);
76 picturePushButton->setPixmap(Resource::loadPixmap("usermanager/usericon"));// Load default usericon. 73 picturePushButton->setPixmap(Resource::loadPixmap("usermanager/usericon"));// Load default usericon.
77 connect(picturePushButton,SIGNAL(clicked()),this,SLOT(clickedPicture()));// Clicking the picture should invoke pictureselector. 74 connect(picturePushButton,SIGNAL(clicked()),this,SLOT(clickedPicture()));// Clicking the picture should invoke pictureselector.
78 75
79 // Login 76 // Login
80 QLabel *loginLabel=new QLabel(tabpage,"Login: "); 77 QLabel *loginLabel=new QLabel(tabpage,"Login: ");
81 loginLabel->setText("Login: "); 78 loginLabel->setText("Login: ");
82 loginLineEdit=new QLineEdit(tabpage,"Login: "); 79 loginLineEdit=new QLineEdit(tabpage,"Login: ");
83 80
84 // UID 81 // UID
85 QLabel *uidLabel=new QLabel(tabpage,"uid: "); 82 QLabel *uidLabel=new QLabel(tabpage,"uid: ");
86 uidLabel->setText("UserID: "); 83 uidLabel->setText("UserID: ");
87 uidLineEdit=new QLineEdit(tabpage,"uid: "); 84 uidLineEdit=new QLineEdit(tabpage,"uid: ");
88 uidLineEdit->setEnabled(false); 85 uidLineEdit->setEnabled(false);
89 86
90 // Username (gecos) 87 // Username (gecos)
91 QLabel *gecosLabel=new QLabel(tabpage,"gecos"); 88 QLabel *gecosLabel=new QLabel(tabpage,"gecos");
92 gecosLabel->setText("Username: "); 89 gecosLabel->setText("Username: ");
93 gecosLineEdit=new QLineEdit(tabpage,"gecos"); 90 gecosLineEdit=new QLineEdit(tabpage,"gecos");
94 91
95 // Password 92 // Password
96 QLabel *passwordLabel=new QLabel(tabpage,"password"); 93 QLabel *passwordLabel=new QLabel(tabpage,"password");
97 passwordLabel->setText("Password: "); 94 passwordLabel->setText("Password: ");
98 passwordLineEdit=new QLineEdit(tabpage,"password"); 95 passwordLineEdit=new QLineEdit(tabpage,"password");
99 passwordLineEdit->setEchoMode(QLineEdit::Password); 96 passwordLineEdit->setEchoMode(QLineEdit::Password);
100 97
101 // Shell 98 // Shell
102 QLabel *shellLabel=new QLabel(tabpage,"shell"); 99 QLabel *shellLabel=new QLabel(tabpage,"shell");
103 shellLabel->setText("Shell: "); 100 shellLabel->setText("Shell: ");
104 shellComboBox=new QComboBox(tabpage,"shell"); 101 shellComboBox=new QComboBox(tabpage,"shell");
105 shellComboBox->setEditable(true); 102 shellComboBox->setEditable(true);
106 shellComboBox->insertItem("/bin/sh"); 103 shellComboBox->insertItem("/bin/sh");
107 shellComboBox->insertItem("/bin/ash"); 104 shellComboBox->insertItem("/bin/ash");
108 shellComboBox->insertItem("/bin/false"); 105 shellComboBox->insertItem("/bin/false");
109 106
110 // Primary Group 107 // Primary Group
111 QLabel *groupLabel=new QLabel(tabpage,"group"); 108 QLabel *groupLabel=new QLabel(tabpage,"group");
112 groupLabel->setText("Primary group: "); 109 groupLabel->setText("Primary group: ");
113 groupComboBox=new QComboBox(tabpage,"PrimaryGroup"); 110 groupComboBox=new QComboBox(tabpage,"PrimaryGroup");
114 111
115 if(vm==VIEWMODE_NEW) { 112 if(vm==VIEWMODE_NEW) {
116 // Copy /etc/skel 113 // Copy /etc/skel
117 skelLabel=new QLabel(tabpage,"skel"); 114 skelLabel=new QLabel(tabpage,"skel");
118 skelLabel->setText("Copy /etc/skel: "); 115 skelLabel->setText("Copy /etc/skel: ");
119 skelCheckBox=new QCheckBox(tabpage); 116 skelCheckBox=new QCheckBox(tabpage);
120 skelCheckBox->setChecked(true); 117 skelCheckBox->setChecked(true);
121 } 118 }
122 119
123 // Widget layout 120 // Widget layout
124 QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout"); 121 QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout");
125 layout->addWidget(picturePushButton); 122 layout->addWidget(picturePushButton);
126 layout->addSpacing(5); 123 layout->addSpacing(5);
127 layout->addLayout(hlayout); 124 layout->addLayout(hlayout);
128 QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1"); 125 QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1");
129 QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2"); 126 QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2");
130 // First column, labels 127 // First column, labels
131 vlayout1->addWidget(loginLabel); 128 vlayout1->addWidget(loginLabel);
132 vlayout1->addSpacing(5); 129 vlayout1->addSpacing(5);
133 vlayout1->addWidget(uidLabel); 130 vlayout1->addWidget(uidLabel);
134 vlayout1->addSpacing(5); 131 vlayout1->addSpacing(5);
135 vlayout1->addWidget(gecosLabel); 132 vlayout1->addWidget(gecosLabel);
136 vlayout1->addSpacing(5); 133 vlayout1->addSpacing(5);
137 vlayout1->addWidget(passwordLabel); 134 vlayout1->addWidget(passwordLabel);
138 vlayout1->addSpacing(5); 135 vlayout1->addSpacing(5);
139 vlayout1->addWidget(shellLabel); 136 vlayout1->addWidget(shellLabel);
140 vlayout1->addSpacing(5); 137 vlayout1->addSpacing(5);
141 vlayout1->addWidget(groupLabel); 138 vlayout1->addWidget(groupLabel);
142 if(vm==VIEWMODE_NEW) { 139 if(vm==VIEWMODE_NEW) {
143 vlayout1->addSpacing(5); 140 vlayout1->addSpacing(5);
144 vlayout1->addWidget(skelLabel); 141 vlayout1->addWidget(skelLabel);
145 } 142 }
146 // Second column, data 143 // Second column, data
147 vlayout2->addWidget(loginLineEdit); 144 vlayout2->addWidget(loginLineEdit);
148 vlayout2->addSpacing(5); 145 vlayout2->addSpacing(5);
149 vlayout2->addWidget(uidLineEdit); 146 vlayout2->addWidget(uidLineEdit);
150 vlayout2->addSpacing(5); 147 vlayout2->addSpacing(5);
151 vlayout2->addWidget(gecosLineEdit); 148 vlayout2->addWidget(gecosLineEdit);
152 vlayout2->addSpacing(5); 149 vlayout2->addSpacing(5);
153 vlayout2->addWidget(passwordLineEdit); 150 vlayout2->addWidget(passwordLineEdit);
154 vlayout2->addSpacing(5); 151 vlayout2->addSpacing(5);
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index 5c90525..5411995 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -1,45 +1,44 @@
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>
14 13
15#include <qmessagebox.h> 14#include <qmessagebox.h>
16#include <qfile.h> 15#include <qfile.h>
17#include <qpe/resource.h> 16#include <qpe/resource.h>
18 17
19#include <qregexp.h> 18#include <qregexp.h>
20 19
21/** 20/**
22 * The mainwindow constructor. 21 * The mainwindow constructor.
23 * 22 *
24 * @param QWidget *parent 23 * @param QWidget *parent
25 * @param const char *name 24 * @param const char *name
26 * @ param WFlags fl 25 * @ param WFlags fl
27 * 26 *
28 */ 27 */
29UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { 28UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) {
30 setCaption(tr("Opie User Manager")); 29 setCaption(tr("Opie User Manager"));
31 30
32 // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them. 31 // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them.
33 accounts=new Passwd(); 32 accounts=new Passwd();
34 accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory. 33 accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory.
35 34
36 // Create the toolbar. 35 // Create the toolbar.
37 QToolBar *toolbar = new QToolBar(this,"Toolbar"); 36 QToolBar *toolbar = new QToolBar(this,"Toolbar");
38 toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!? 37 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"); 38 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"); 39 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"); 40 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"); 41 QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User");
43 userstext->setUsesTextLabel(true); 42 userstext->setUsesTextLabel(true);
44 toolbar->addSeparator(); 43 toolbar->addSeparator();
45 addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group"); 44 addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group");