author | tille <tille> | 2003-06-03 14:08:04 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-03 14:08:04 (UTC) |
commit | 60d9f66d2b31c659ac652c15423ecaca89a5f312 (patch) (unidiff) | |
tree | bfda269b58eb1c72893057d9d7fae5a6a2e45abc | |
parent | aaf7709f64dda5a6cb81eeb96e421ba4189654d6 (diff) | |
download | opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.zip opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.tar.gz opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.tar.bz2 |
authentication (except when passwd not stored)
and minor things
17 files changed, 313 insertions, 156 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO index 5635438..80fc5a6 100644 --- a/noncore/settings/networksettings/ppp/TODO +++ b/noncore/settings/networksettings/ppp/TODO | |||
@@ -1,7 +1,9 @@ | |||
1 | - add possibility to input username and password ;) | 1 | - ask for password is non is set |
2 | - impl. PPPData::copyaccount & PPPData::deleteAccount | 2 | |
3 | - stop pppd, i.e. fix interfaceinformationppp | ||
4 | |||
3 | - update modem attribute inputs when modem has changed | 5 | - update modem attribute inputs when modem has changed |
4 | - fix layout of edit account, i.e. get it shown maximised | 6 | - impl. PPPData::copyaccount & PPPData::deleteAccount |
5 | - popup configure modem with the correct account prselected | ||
6 | not quite shure why it does not work... IMHO it should work | ||
7 | 7 | ||
8 | - check if the same interface device combination allready exists | ||
9 | - fix layout of edit account, i.e. get it shown maximised | ||
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index f704c84..7760d5e 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <qvgroupbox.h> | 38 | #include <qvgroupbox.h> |
39 | 39 | ||
40 | #include "pppdata.h" | ||
41 | #include "accounts.h" | 40 | #include "accounts.h" |
41 | #include "authwidget.h" | ||
42 | #include "pppdata.h" | ||
42 | #include "edit.h" | 43 | #include "edit.h" |
43 | 44 | ||
@@ -45,6 +46,7 @@ void parseargs(char* buf, char** args); | |||
45 | 46 | ||
46 | AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) | 47 | AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) |
47 | : QWidget( parent, name ), _pppdata(pd) | 48 | : QWidget( parent, name )//, _pppdata(pd) |
48 | { | 49 | { |
50 | _pppdata = pd; | ||
49 | QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); | 51 | QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); |
50 | accountlist_l = new QListBox(this); | 52 | accountlist_l = new QListBox(this); |
@@ -87,4 +89,7 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
87 | l1->addLayout(l12); | 89 | l1->addLayout(l12); |
88 | 90 | ||
91 | int currAccId = _pppdata->currentAccountID(); | ||
92 | qDebug("currentAccountID %i", currAccId); | ||
93 | |||
89 | //load up account list from gppdata to the list box | 94 | //load up account list from gppdata to the list box |
90 | if(_pppdata->count() > 0) { | 95 | if(_pppdata->count() > 0) { |
@@ -94,9 +99,9 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
94 | } | 99 | } |
95 | } | 100 | } |
96 | 101 | _pppdata->setAccountbyIndex( currAccId ); | |
97 | 102 | ||
98 | qDebug("setting listview index to %i",_pppdata->currentAccountID() ); | 103 | qDebug("setting listview index to %i",_pppdata->currentAccountID() ); |
99 | accountlist_l->setCurrentItem( _pppdata->currentAccountID() ); | 104 | accountlist_l->setCurrentItem( _pppdata->currentAccountID() ); |
100 | slotListBoxSelect( _pppdata->currentAccountID()); | 105 | slotListBoxSelect( _pppdata->currentAccountID() ); |
101 | 106 | ||
102 | l1->activate(); | 107 | l1->activate(); |
@@ -113,40 +118,7 @@ void AccountWidget::slotListBoxSelect(int idx) { | |||
113 | QString account = _pppdata->accname(); | 118 | QString account = _pppdata->accname(); |
114 | _pppdata->setAccountbyIndex(accountlist_l->currentItem()); | 119 | _pppdata->setAccountbyIndex(accountlist_l->currentItem()); |
115 | // _pppdata->setAccount(account); | ||
116 | } | 120 | } |
117 | } | 121 | } |
118 | 122 | ||
119 | |||
120 | // void AccountWidget::viewLogClicked(){ | ||
121 | |||
122 | // QApplication::flushX(); | ||
123 | // if(fork() == 0) { | ||
124 | // setgid(getgid()); | ||
125 | // setuid(getuid()); | ||
126 | // system("kppplogview -kppp"); | ||
127 | // _exit(0); | ||
128 | // } | ||
129 | // } | ||
130 | |||
131 | |||
132 | // void AccountWidget::resetClicked(){ | ||
133 | // if(accountlist_l->currentItem() == -1) | ||
134 | // return; | ||
135 | |||
136 | // // QueryReset dlg(this); | ||
137 | // // int what = dlg.exec(); | ||
138 | |||
139 | // // if(what && QueryReset::COSTS) { | ||
140 | // // emit resetCosts(accountlist_l->text(accountlist_l->currentItem())); | ||
141 | // // costedit->setText("0"); | ||
142 | // // } | ||
143 | |||
144 | // // if(what && QueryReset::VOLUME) { | ||
145 | // // emit resetVolume(accountlist_l->text(accountlist_l->currentItem())); | ||
146 | // // voledit->setText(prettyPrintVolume(0)); | ||
147 | // // } | ||
148 | // } | ||
149 | |||
150 | |||
151 | void AccountWidget::editaccount() { | 123 | void AccountWidget::editaccount() { |
152 | _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem())); | 124 | _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem())); |
@@ -250,4 +222,8 @@ int AccountWidget::doTab(){ | |||
250 | tabWindow->addTab( dial_w, tr("Dial") ); | 222 | tabWindow->addTab( dial_w, tr("Dial") ); |
251 | 223 | ||
224 | // // AUTH WIDGET | ||
225 | auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); | ||
226 | tabWindow->addTab( auth_w, tr("Authentication") ); | ||
227 | |||
252 | // // IP WIDGET | 228 | // // IP WIDGET |
253 | ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); | 229 | ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); |
@@ -262,8 +238,4 @@ int AccountWidget::doTab(){ | |||
262 | tabWindow->addTab( dns_w, tr("DNS") ); | 238 | tabWindow->addTab( dns_w, tr("DNS") ); |
263 | 239 | ||
264 | // // SCRIPT WIDGET | ||
265 | script_w = new ScriptWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); | ||
266 | tabWindow->addTab( script_w, tr("Login Script") ); | ||
267 | |||
268 | // // EXECUTE WIDGET | 240 | // // EXECUTE WIDGET |
269 | ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs")); | 241 | ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs")); |
@@ -279,6 +251,5 @@ int AccountWidget::doTab(){ | |||
279 | 251 | ||
280 | if(result == QDialog::Accepted) { | 252 | if(result == QDialog::Accepted) { |
281 | if (!script_w->check()){ | 253 | if (!auth_w->check()){ |
282 | QMessageBox::critical(this, "error", tr("<qt>Login script has unbalanced loop Start/End<qt>")); | ||
283 | ok = false; | 254 | ok = false; |
284 | } else if(!dial_w->save()) { | 255 | } else if(!dial_w->save()) { |
@@ -289,5 +260,5 @@ int AccountWidget::doTab(){ | |||
289 | dns_w->save(); | 260 | dns_w->save(); |
290 | gateway_w->save(); | 261 | gateway_w->save(); |
291 | script_w->save(); | 262 | auth_w->save(); |
292 | exec_w->save(); | 263 | exec_w->save(); |
293 | } | 264 | } |
diff --git a/noncore/settings/networksettings/ppp/accounts.h b/noncore/settings/networksettings/ppp/accounts.h index eae3922..8c16a7c 100644 --- a/noncore/settings/networksettings/ppp/accounts.h +++ b/noncore/settings/networksettings/ppp/accounts.h | |||
@@ -39,5 +39,5 @@ class QLineEdit; | |||
39 | class QTabWidget; | 39 | class QTabWidget; |
40 | class DialWidget; | 40 | class DialWidget; |
41 | class ScriptWidget; | 41 | class AuthWidget; |
42 | class IPWidget; | 42 | class IPWidget; |
43 | class DNSWidget; | 43 | class DNSWidget; |
@@ -73,5 +73,5 @@ private: | |||
73 | DNSWidget *dns_w; | 73 | DNSWidget *dns_w; |
74 | GatewayWidget *gateway_w; | 74 | GatewayWidget *gateway_w; |
75 | ScriptWidget *script_w; | 75 | AuthWidget *auth_w; |
76 | 76 | ||
77 | QListBox *accountlist_l; | 77 | QListBox *accountlist_l; |
@@ -83,18 +83,4 @@ private: | |||
83 | 83 | ||
84 | 84 | ||
85 | // class QueryReset : public QDialog { | ||
86 | // Q_OBJECT | ||
87 | // public: | ||
88 | // QueryReset(QWidget *parent); | ||
89 | |||
90 | // enum {COSTS=1, VOLUME=2}; | ||
91 | |||
92 | // private slots: | ||
93 | // void accepted(); | ||
94 | |||
95 | // private: | ||
96 | // QCheckBox *costs, *volume; | ||
97 | // }; | ||
98 | |||
99 | #endif | 85 | #endif |
100 | 86 | ||
diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp new file mode 100644 index 0000000..86bea98 --- a/dev/null +++ b/noncore/settings/networksettings/ppp/authwidget.cpp | |||
@@ -0,0 +1,195 @@ | |||
1 | |||
2 | #include <qlayout.h> | ||
3 | #include <qmessagebox.h> | ||
4 | #include <qtoolbutton.h> | ||
5 | #include <qwhatsthis.h> | ||
6 | |||
7 | #include "auth.h" | ||
8 | #include "authwidget.h" | ||
9 | #include "edit.h" | ||
10 | #include "pppdata.h" | ||
11 | |||
12 | |||
13 | static const char* const image0_data[] = { | ||
14 | "16 16 2 1", | ||
15 | ". c None", | ||
16 | "# c #000000", | ||
17 | "................", | ||
18 | "...#...###...##.", | ||
19 | "..#.#..#..#.##..", | ||
20 | "..###..###.##...", | ||
21 | ".#...#.#..##....", | ||
22 | ".#...#.#.##.....", | ||
23 | "........##.#..#.", | ||
24 | "..##...##...##..", | ||
25 | ".#..#.###...##..", | ||
26 | ".#...##..#.#..#.", | ||
27 | ".#..##..........", | ||
28 | ".#.##.#..#.#..#.", | ||
29 | "..##...##...##..", | ||
30 | ".##....##...##..", | ||
31 | ".#....#..#.#..#.", | ||
32 | "................"}; | ||
33 | |||
34 | |||
35 | AuthWidget::AuthWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) | ||
36 | : QWidget( parent, name), | ||
37 | scriptWidget(0), | ||
38 | _pppdata(pd), | ||
39 | isNewAccount(isnewaccount) | ||
40 | { | ||
41 | layout = new QGridLayout(this); | ||
42 | |||
43 | auth_l = new QLabel(tr("Authentication: "), this); | ||
44 | layout->addWidget(auth_l, 0, 0); | ||
45 | |||
46 | auth = new QComboBox(this); | ||
47 | auth->insertItem(tr("Script-based")); | ||
48 | auth->insertItem(tr("PAP")); | ||
49 | auth->insertItem(tr("Terminal-based")); | ||
50 | auth->insertItem(tr("CHAP")); | ||
51 | auth->insertItem(tr("PAP/CHAP")); | ||
52 | layout->addWidget(auth, 0, 1); | ||
53 | |||
54 | connect( auth, SIGNAL(activated(const QString&)), | ||
55 | SLOT(authChanged(const QString&))); | ||
56 | |||
57 | QString tmp = tr("<p>Specifies the method used to identify yourself to\n" | ||
58 | "the PPP server. Most universities still use\n" | ||
59 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" | ||
60 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" | ||
61 | "unsure, contact your ISP.\n" | ||
62 | "\n" | ||
63 | "If you can choose between PAP and CHAP,\n" | ||
64 | "choose CHAP, because it's much safer. If you don't know\n" | ||
65 | "whether PAP or CHAP is right, choose PAP/CHAP."); | ||
66 | |||
67 | QWhatsThis::add(auth_l,tmp); | ||
68 | QWhatsThis::add(auth,tmp); | ||
69 | |||
70 | user_l = new QLabel( tr("Username: "), this); | ||
71 | layout->addWidget( user_l, 1, 0 ); | ||
72 | userName = new QLineEdit( this, "usernameEdit" ); | ||
73 | layout->addWidget( userName, 1, 1 ); | ||
74 | tmp = tr("Enter your username here..."); | ||
75 | QWhatsThis::add( user_l, tmp ); | ||
76 | QWhatsThis::add( userName, tmp ); | ||
77 | |||
78 | pw_l = new QLabel( tr("Password: "), this); | ||
79 | layout->addWidget( pw_l, 2, 0 ); | ||
80 | passWord = new QLineEdit( this, "pw" ); | ||
81 | passWord->setAutoMask( true ); | ||
82 | passWord->setEchoMode( QLineEdit::Password ); | ||
83 | layout->addWidget( passWord, 2, 1 ); | ||
84 | hidePw = new QToolButton( this ); | ||
85 | hidePw->setPixmap( QPixmap( ( const char** ) image0_data ) ); | ||
86 | hidePw->setToggleButton( true ); | ||
87 | layout->addWidget( hidePw, 2, 2 ); | ||
88 | |||
89 | connect(hidePw, SIGNAL(toggled(bool)), SLOT(toggleEchoMode(bool))); | ||
90 | |||
91 | tmp = tr("Enter your password here"); | ||
92 | QWhatsThis::add( pw_l, tmp ); | ||
93 | QWhatsThis::add( passWord, tmp ); | ||
94 | |||
95 | store_password = new QCheckBox(tr("Store password"), this); | ||
96 | layout->addMultiCellWidget(store_password, 3, 3, 0, 1, AlignRight); | ||
97 | QWhatsThis::add(store_password, | ||
98 | tr("<p>When this is turned on, your ISP password\n" | ||
99 | "will be saved in <i>kppp</i>'s config file, so\n" | ||
100 | "you do not need to type it in every time.\n" | ||
101 | "\n" | ||
102 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" | ||
103 | "plain text in the config file, which is\n" | ||
104 | "readable only to you. Make sure nobody\n" | ||
105 | "gains access to this file!")); | ||
106 | |||
107 | if (isNewAccount){ | ||
108 | // select PAP/CHAP as default | ||
109 | auth->setCurrentItem(AUTH_PAPCHAP); | ||
110 | store_password->setChecked(true); | ||
111 | }else{ | ||
112 | auth->setCurrentItem(_pppdata->authMethod()); | ||
113 | authChanged( auth->currentText() ); | ||
114 | userName->setText( _pppdata->storedUsername() ); | ||
115 | store_password->setChecked(_pppdata->storePassword()); | ||
116 | if (store_password->isChecked()) | ||
117 | passWord->setText( _pppdata->storedPassword() ); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | bool AuthWidget::check() | ||
122 | { | ||
123 | bool ret = true; | ||
124 | if (scriptWidget){ | ||
125 | if (!scriptWidget->check()){ | ||
126 | QMessageBox::critical(this, tr("error"), tr("<qt>Login script has unbalanced loop Start/End<qt>")); | ||
127 | ret = false; | ||
128 | } | ||
129 | } | ||
130 | return ret; | ||
131 | } | ||
132 | |||
133 | void AuthWidget::save() | ||
134 | { | ||
135 | _pppdata->setAuthMethod(auth->currentItem()); | ||
136 | if (scriptWidget) scriptWidget->save(); | ||
137 | _pppdata->setStoredUsername( userName->text() ); | ||
138 | _pppdata->setStorePassword(store_password->isChecked()); | ||
139 | if (store_password->isChecked()) | ||
140 | _pppdata->setStoredPassword( passWord->text() ); | ||
141 | } | ||
142 | |||
143 | void AuthWidget::authChanged( const QString &authStr ) | ||
144 | { | ||
145 | qDebug("AuthWidget::authChanged( %s )", authStr.latin1() ); | ||
146 | if ( authStr.contains( tr("Script-based") ) ){ | ||
147 | showUsernamePassword( false ); | ||
148 | showScriptWindow( true ); | ||
149 | } else if ( authStr.contains( tr("PAP") ) || | ||
150 | authStr.contains( tr("CHAP") ) ){ | ||
151 | showUsernamePassword( true ); | ||
152 | showScriptWindow( false ); | ||
153 | } else { | ||
154 | qDebug("do not really know how to handle"); | ||
155 | showUsernamePassword( false ); | ||
156 | showScriptWindow( false ); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | |||
161 | void AuthWidget::showUsernamePassword( bool show ) | ||
162 | { | ||
163 | if (show){ | ||
164 | user_l->show(); | ||
165 | userName->show(); | ||
166 | pw_l->show(); | ||
167 | passWord->show(); | ||
168 | store_password->show(); | ||
169 | }else{//!show | ||
170 | user_l->hide(); | ||
171 | userName->hide(); | ||
172 | pw_l->hide(); | ||
173 | passWord->hide(); | ||
174 | store_password->hide(); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | void AuthWidget::showScriptWindow( bool show ) | ||
179 | { | ||
180 | if (show){ | ||
181 | if (!scriptWidget){ | ||
182 | scriptWidget = new ScriptWidget( _pppdata, this, isNewAccount, "scriptWid"); | ||
183 | layout->addMultiCellWidget( scriptWidget, 1, 4, 0, 1 ); | ||
184 | } | ||
185 | scriptWidget->show(); | ||
186 | }else{ // !show | ||
187 | if (scriptWidget) scriptWidget->hide(); | ||
188 | } | ||
189 | } | ||
190 | |||
191 | void AuthWidget::toggleEchoMode( bool t ) | ||
192 | { | ||
193 | passWord->setEchoMode( t ? QLineEdit::Normal : QLineEdit::Password ); | ||
194 | } | ||
195 | |||
diff --git a/noncore/settings/networksettings/ppp/authwidget.h b/noncore/settings/networksettings/ppp/authwidget.h new file mode 100644 index 0000000..33ec4c2 --- a/dev/null +++ b/noncore/settings/networksettings/ppp/authwidget.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef _AUTHWIDGET_H | ||
2 | #define _AUTHWIDGET_H | ||
3 | |||
4 | #include <qwidget.h> | ||
5 | |||
6 | class ScriptWidget; | ||
7 | class PPPData; | ||
8 | class QCheckBox; | ||
9 | class QComboBox; | ||
10 | class QLabel; | ||
11 | class QGridLayout; | ||
12 | class QLineEdit; | ||
13 | class QToolButton; | ||
14 | |||
15 | class AuthWidget : public QWidget { | ||
16 | Q_OBJECT | ||
17 | public: | ||
18 | AuthWidget(PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 ); | ||
19 | ~AuthWidget() {}; | ||
20 | |||
21 | public slots: | ||
22 | bool check(); | ||
23 | void save(); | ||
24 | |||
25 | private slots: | ||
26 | void authChanged(const QString&); | ||
27 | void showUsernamePassword(bool); | ||
28 | void showScriptWindow(bool); | ||
29 | void toggleEchoMode(bool); | ||
30 | |||
31 | private: | ||
32 | ScriptWidget *scriptWidget; | ||
33 | PPPData *_pppdata; | ||
34 | bool isNewAccount; | ||
35 | QGridLayout *layout; | ||
36 | QComboBox *auth; | ||
37 | QLabel *auth_l; | ||
38 | QLabel *user_l; | ||
39 | QLineEdit *userName; | ||
40 | QLabel *pw_l; | ||
41 | QLineEdit *passWord; | ||
42 | QToolButton *hidePw; | ||
43 | QCheckBox *store_password; | ||
44 | }; | ||
45 | |||
46 | #endif | ||
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index 89d9930..a93f93d 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -125,4 +125,5 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam | |||
125 | debug = new QPushButton(i18n("Log"), this); | 125 | debug = new QPushButton(i18n("Log"), this); |
126 | debug->setToggleButton(true); | 126 | debug->setToggleButton(true); |
127 | debug->setEnabled( false ); // FIXME: disable the log button | ||
127 | connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow())); | 128 | connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow())); |
128 | 129 | ||
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index 45d6e4f..b880978 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp | |||
@@ -35,4 +35,5 @@ | |||
35 | #include <qhbox.h> | 35 | #include <qhbox.h> |
36 | #include <qdialog.h> | 36 | #include <qdialog.h> |
37 | #include <qpe/resource.h> | ||
37 | 38 | ||
38 | #include "edit.h" | 39 | #include "edit.h" |
@@ -47,5 +48,5 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount | |||
47 | const int GRIDROWS = 6; | 48 | const int GRIDROWS = 6; |
48 | 49 | ||
49 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); | 50 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 ); |
50 | 51 | ||
51 | connect_label = new QLabel(tr("Connection name:"), this); | 52 | connect_label = new QLabel(tr("Connection name:"), this); |
@@ -76,9 +77,7 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount | |||
76 | 77 | ||
77 | up = new QPushButton(this); | 78 | up = new QPushButton(this); |
78 | //FIXME: QPixmap pm = BarIcon("up"); | 79 | up->setPixmap( Resource::loadPixmap("inline/up") ); |
79 | // up->setPixmap(pm); | ||
80 | down = new QPushButton(this); | 80 | down = new QPushButton(this); |
81 | //FIXME: pm = BarIcon("down"); | 81 | down->setPixmap( Resource::loadPixmap("inline/down") ); |
82 | // down->setPixmap(pm); | ||
83 | lpn1->addWidget(add); | 82 | lpn1->addWidget(add); |
84 | lpn1->addWidget(del); | 83 | lpn1->addWidget(del); |
@@ -109,40 +108,4 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount | |||
109 | QWhatsThis::add(numbers,tmp); | 108 | QWhatsThis::add(numbers,tmp); |
110 | 109 | ||
111 | auth_l = new QLabel(tr("Authentication:"), this); | ||
112 | tl->addWidget(auth_l, 3, 0); | ||
113 | |||
114 | auth = new QComboBox(this); | ||
115 | auth->insertItem(tr("Script-based")); | ||
116 | auth->insertItem(tr("PAP")); | ||
117 | auth->insertItem(tr("Terminal-based")); | ||
118 | auth->insertItem(tr("CHAP")); | ||
119 | auth->insertItem(tr("PAP/CHAP")); | ||
120 | tl->addWidget(auth, 3, 1); | ||
121 | tmp = tr("<p>Specifies the method used to identify yourself to\n" | ||
122 | "the PPP server. Most universities still use\n" | ||
123 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" | ||
124 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" | ||
125 | "unsure, contact your ISP.\n" | ||
126 | "\n" | ||
127 | "If you can choose between PAP and CHAP,\n" | ||
128 | "choose CHAP, because it's much safer. If you don't know\n" | ||
129 | "whether PAP or CHAP is right, choose PAP/CHAP."); | ||
130 | |||
131 | QWhatsThis::add(auth_l,tmp); | ||
132 | QWhatsThis::add(auth,tmp); | ||
133 | |||
134 | store_password = new QCheckBox(tr("Store password"), this); | ||
135 | store_password->setChecked(true); | ||
136 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); | ||
137 | QWhatsThis::add(store_password, | ||
138 | tr("<p>When this is turned on, your ISP password\n" | ||
139 | "will be saved in <i>kppp</i>'s config file, so\n" | ||
140 | "you do not need to type it in every time.\n" | ||
141 | "\n" | ||
142 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" | ||
143 | "plain text in the config file, which is\n" | ||
144 | "readable only to you. Make sure nobody\n" | ||
145 | "gains access to this file!")); | ||
146 | |||
147 | pppdargs = new QPushButton(tr("Customize pppd Arguments..."), this); | 110 | pppdargs = new QPushButton(tr("Customize pppd Arguments..."), this); |
148 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); | 111 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); |
@@ -169,9 +132,4 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount | |||
169 | numbers->insertItem(tmp); | 132 | numbers->insertItem(tmp); |
170 | 133 | ||
171 | auth->setCurrentItem(_pppdata->authMethod()); | ||
172 | store_password->setChecked(_pppdata->storePassword()); | ||
173 | } else { | ||
174 | // select PAP/CHAP as default | ||
175 | auth->setCurrentItem(AUTH_PAPCHAP); | ||
176 | } | 134 | } |
177 | 135 | ||
@@ -196,6 +154,4 @@ bool DialWidget::save() { | |||
196 | 154 | ||
197 | _pppdata->setPhonenumber(number); | 155 | _pppdata->setPhonenumber(number); |
198 | _pppdata->setAuthMethod(auth->currentItem()); | ||
199 | _pppdata->setStorePassword(store_password->isChecked()); | ||
200 | return true; | 156 | return true; |
201 | } | 157 | } |
diff --git a/noncore/settings/networksettings/ppp/edit.h b/noncore/settings/networksettings/ppp/edit.h index 2cc0fed..8b5ec03 100644 --- a/noncore/settings/networksettings/ppp/edit.h +++ b/noncore/settings/networksettings/ppp/edit.h | |||
@@ -71,7 +71,4 @@ private: | |||
71 | QLabel *number_label; | 71 | QLabel *number_label; |
72 | QPushButton *pppdargs; | 72 | QPushButton *pppdargs; |
73 | QComboBox *auth; | ||
74 | QLabel *auth_l; | ||
75 | QCheckBox *store_password; | ||
76 | 73 | ||
77 | // for the phonenumber selection | 74 | // for the phonenumber selection |
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp index 3cf1167..553daa2 100644 --- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp | |||
@@ -6,4 +6,5 @@ | |||
6 | //#include <qgroupbox.h> | 6 | //#include <qgroupbox.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qabstractlayout.h> | ||
8 | 9 | ||
9 | #include "connect.h" | 10 | #include "connect.h" |
@@ -24,6 +25,10 @@ InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *na | |||
24 | qDebug("InterfaceInformationPPP::InterfaceInformationPPP"); | 25 | qDebug("InterfaceInformationPPP::InterfaceInformationPPP"); |
25 | con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); | 26 | con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); |
26 | // InterfaceInformationLayout->addMultiCellWidget( con, 7, 7, 0, 1 ); | 27 | con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, |
27 | InterfaceInformationLayout->addWidget( con, 7, 0 ); | 28 | QSizePolicy::Fixed) ); |
29 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); | ||
30 | InterfaceInformationLayout->addItem( spacer, 7, 0 ); | ||
31 | InterfaceInformationLayout->addMultiCellWidget( con, 8, 8, 0, 1 ); | ||
32 | // InterfaceInformationLayout->addWidget( con, 7, 0 ); | ||
28 | connect(i, SIGNAL(begin_connect()),con, SLOT(preinit())); | 33 | connect(i, SIGNAL(begin_connect()),con, SLOT(preinit())); |
29 | } | 34 | } |
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp index dc24824..98bb4da 100644 --- a/noncore/settings/networksettings/ppp/interfaceppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp | |||
@@ -46,10 +46,8 @@ void InterfacePPP::start() | |||
46 | { | 46 | { |
47 | qDebug("InterfacePPP::start"); | 47 | qDebug("InterfacePPP::start"); |
48 | if (data()->storedPassword() != "" ){ | 48 | if (data()->password().isEmpty() ){ |
49 | data()->setPassword(data()->storedPassword()); | 49 | //FIXME: ask for password |
50 | }else{ | ||
51 | //FIXME: | ||
52 | qDebug("using dummy password"); | 50 | qDebug("using dummy password"); |
53 | data()->setPassword( "dummy" ); | 51 | QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)"); |
54 | } | 52 | } |
55 | 53 | ||
@@ -97,5 +95,5 @@ void InterfacePPP::start() | |||
97 | data()->authMethod() == AUTH_CHAP || | 95 | data()->authMethod() == AUTH_CHAP || |
98 | data()->authMethod() == AUTH_PAPCHAP ) { | 96 | data()->authMethod() == AUTH_PAPCHAP ) { |
99 | if(false){ //ID_Edit->text().isEmpty()) { | 97 | if(false){ //FIXME: ID_Edit->text().isEmpty()) { |
100 | QMessageBox::warning(0,tr("Error"), | 98 | QMessageBox::warning(0,tr("Error"), |
101 | i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>")); | 99 | i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>")); |
@@ -121,11 +119,7 @@ void InterfacePPP::start() | |||
121 | } | 119 | } |
122 | 120 | ||
123 | // this->hide(); | 121 | // SEGFAULTS: |
124 | 122 | // setStatus( true ); | |
125 | QString tit = i18n("Connecting to: %1").arg(data()->accname()); | 123 | // emit updateInterface((Interface*) this); |
126 | // con->setCaption(tit); | ||
127 | |||
128 | // con->show(); | ||
129 | |||
130 | 124 | ||
131 | emit begin_connect(); | 125 | emit begin_connect(); |
@@ -140,2 +134,7 @@ void InterfacePPP::stop() | |||
140 | } | 134 | } |
141 | 135 | ||
136 | void InterfacePPP::save() | ||
137 | { | ||
138 | data()->save(); | ||
139 | emit updateInterface((Interface*) this); | ||
140 | } | ||
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.h b/noncore/settings/networksettings/ppp/interfaceppp.h index 06a4dbf..6eb6a69 100644 --- a/noncore/settings/networksettings/ppp/interfaceppp.h +++ b/noncore/settings/networksettings/ppp/interfaceppp.h | |||
@@ -24,4 +24,5 @@ public slots: | |||
24 | virtual void start(); | 24 | virtual void start(); |
25 | virtual void stop(); | 25 | virtual void stop(); |
26 | void save(); | ||
26 | 27 | ||
27 | private: | 28 | private: |
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index 289e9f5..7b5c74d 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp | |||
@@ -601,5 +601,5 @@ void KPPPWidget::beginConnect() { | |||
601 | QMessageBox::warning(this,"error", | 601 | QMessageBox::warning(this,"error", |
602 | i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!")); | 602 | i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!")); |
603 | // FIXME: return; | 603 | return; |
604 | } else { | 604 | } else { |
605 | if(!Modem::modem->setSecret(_pppdata->authMethod(), | 605 | if(!Modem::modem->setSecret(_pppdata->authMethod(), |
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro index 483aa58..56a7ace 100644 --- a/noncore/settings/networksettings/ppp/ppp.pro +++ b/noncore/settings/networksettings/ppp/ppp.pro | |||
@@ -5,8 +5,6 @@ TEMPLATE = lib | |||
5 | CONFIG += qt warn_on debug | 5 | CONFIG += qt warn_on debug |
6 | DESTDIR = $(OPIEDIR)/plugins/networksettings | 6 | DESTDIR = $(OPIEDIR)/plugins/networksettings |
7 | HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h | 7 | HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h |
8 | # kpppwidget.h | 8 | SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp |
9 | SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp | ||
10 | # kpppwidget.cpp | ||
11 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ | 9 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ |
12 | DEPENDPATH+= $(OPIEDIR)/include | 10 | DEPENDPATH+= $(OPIEDIR)/include |
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp index 63f9335..5fa7d3f 100644 --- a/noncore/settings/networksettings/ppp/pppconfig.cpp +++ b/noncore/settings/networksettings/ppp/pppconfig.cpp | |||
@@ -43,6 +43,4 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, | |||
43 | modem2 = new ModemWidget2( interface, tabWindow, "modem2" ); | 43 | modem2 = new ModemWidget2( interface, tabWindow, "modem2" ); |
44 | tabWindow->addTab( modem2, tr("&Modem") ); | 44 | tabWindow->addTab( modem2, tr("&Modem") ); |
45 | // graph = new GraphSetup( tabWindow->addPage( tr("&Graph"), tr("Throughput Graph" ) ) ); | ||
46 | // general = new GeneralWidget( tabWindow->addPage( tr("M&isc"), tr("Miscellaneous Settings") ) ); | ||
47 | 45 | ||
48 | } | 46 | } |
@@ -61,5 +59,5 @@ void PPPConfigWidget::accept() | |||
61 | interface->setInterfaceName( interface->data()->modemDevice() ); | 59 | interface->setInterfaceName( interface->data()->modemDevice() ); |
62 | interface->setHardwareName( interface->data()->accname() ); | 60 | interface->setHardwareName( interface->data()->accname() ); |
63 | interface->data()->save(); | 61 | interface->save(); |
64 | QDialog::accept(); | 62 | QDialog::accept(); |
65 | } | 63 | } |
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index 23db409..8f066ff 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp | |||
@@ -44,9 +44,10 @@ | |||
44 | PPPData::PPPData() | 44 | PPPData::PPPData() |
45 | : modemDeviceGroup(-1), | 45 | : modemDeviceGroup(-1), |
46 | highcount(-1), // start out with no entries | 46 | passwd(""), |
47 | caccount(-1), // set the current account index also | 47 | highcount(-1), // start out with no entries |
48 | suidprocessid(-1), // process ID of setuid child | 48 | caccount(-1), // set the current account index also |
49 | pppdisrunning(false), | 49 | suidprocessid(-1), // process ID of setuid child |
50 | pppderror(0) | 50 | pppdisrunning(false), |
51 | pppderror(0) | ||
51 | { | 52 | { |
52 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; | 53 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; |
@@ -218,6 +219,7 @@ void PPPData::writeListConfig(const QString &group, const QString &key, | |||
218 | // functions to set/return general information | 219 | // functions to set/return general information |
219 | // | 220 | // |
220 | QString PPPData::password() const { | 221 | QString PPPData::password(){ |
221 | return passwd; | 222 | if ( storePassword() ) return storedPassword(); |
223 | else return passwd; | ||
222 | } | 224 | } |
223 | 225 | ||
@@ -754,5 +756,5 @@ bool PPPData::isUniqueAccname(const QString &n) { | |||
754 | 756 | ||
755 | bool PPPData::deleteAccount() { | 757 | bool PPPData::deleteAccount() { |
756 | //FIXME: | 758 | //FIXME: PPPData::deleteAccount |
757 | // if(caccount < 0) | 759 | // if(caccount < 0) |
758 | return false; | 760 | return false; |
@@ -827,5 +829,5 @@ int PPPData::newaccount() { | |||
827 | 829 | ||
828 | int PPPData::copyaccount(int i) { | 830 | int PPPData::copyaccount(int i) { |
829 | // FIXME | 831 | // FIXME: PPPData::copyaccount |
830 | // if(highcount >= MAX_ACCOUNTS) | 832 | // if(highcount >= MAX_ACCOUNTS) |
831 | return -1; | 833 | return -1; |
@@ -1277,10 +1279,12 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) | |||
1277 | int i = 0; | 1279 | int i = 0; |
1278 | Config cfg = config(); | 1280 | Config cfg = config(); |
1279 | for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){ | 1281 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ |
1280 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i)); | 1282 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); |
1281 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); | 1283 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); |
1282 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); | 1284 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); |
1285 | qDebug("I %i",i); | ||
1283 | } | 1286 | } |
1284 | cfg.setGroup( ACCLIST_GRP ); | 1287 | cfg.setGroup( ACCLIST_GRP ); |
1288 | qDebug("saved %i account settings", i); | ||
1285 | cfg.writeEntry( ACCOUNTS_COUNT, i ); | 1289 | cfg.writeEntry( ACCOUNTS_COUNT, i ); |
1286 | 1290 | ||
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h index c9cd482..6e1379d 100644 --- a/noncore/settings/networksettings/ppp/pppdata.h +++ b/noncore/settings/networksettings/ppp/pppdata.h | |||
@@ -182,8 +182,8 @@ public: | |||
182 | 182 | ||
183 | // functions to set/get general kppp info | 183 | // functions to set/get general kppp info |
184 | QString password() const; | 184 | QString password(); |
185 | void setPassword(const QString &); | 185 | void setPassword(const QString &); |
186 | 186 | ||
187 | int currentAccountID() { return caccount; }; | 187 | int currentAccountID() { return caccount; }; |
188 | const QString defaultAccount(); | 188 | const QString defaultAccount(); |
189 | void setDefaultAccount(const QString &); | 189 | void setDefaultAccount(const QString &); |
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index 8c401a9..d4c137b 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -81,8 +81,6 @@ QWidget *PPPModule::information(Interface *i){ | |||
81 | // We don't have any advanced pppd information widget yet :-D | 81 | // We don't have any advanced pppd information widget yet :-D |
82 | // TODO ^ | 82 | // TODO ^ |
83 | qDebug("return PPPModule::information"); | 83 | |
84 | // InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i); | 84 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); |
85 | InterfaceInformationPPP *information = new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); | ||
86 | return information; | ||
87 | } | 85 | } |
88 | 86 | ||