Diffstat (limited to 'noncore/settings/networksettings/ppp/accounts.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/accounts.cpp | 80 |
1 files changed, 53 insertions, 27 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index 28d8732..b8a1925a 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp | |||
@@ -26,4 +26,12 @@ | |||
26 | 26 | ||
27 | #include "accounts.h" | ||
28 | #include "authwidget.h" | ||
29 | #include "pppdata.h" | ||
30 | #include "edit.h" | ||
31 | |||
32 | /* OPIE */ | ||
33 | #include <qpe/qpeapplication.h> | ||
34 | |||
35 | /* QT */ | ||
27 | #include <qdir.h> | 36 | #include <qdir.h> |
28 | #include <stdlib.h> | ||
29 | #include <qlayout.h> | 37 | #include <qlayout.h> |
@@ -33,3 +41,2 @@ | |||
33 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
34 | |||
35 | #include <qapplication.h> | 42 | #include <qapplication.h> |
@@ -39,6 +46,4 @@ | |||
39 | 46 | ||
40 | #include "accounts.h" | 47 | /* STD */ |
41 | #include "authwidget.h" | 48 | #include <stdlib.h> |
42 | #include "pppdata.h" | ||
43 | #include "edit.h" | ||
44 | 49 | ||
@@ -70,3 +75,4 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF | |||
70 | 75 | ||
71 | for (uint i = 0; i < listListbox->count(); i++){ | 76 | for (uint i = 0; i < listListbox->count(); i++) |
77 | { | ||
72 | if ( listListbox->text(i) == _pppdata->accname() ) | 78 | if ( listListbox->text(i) == _pppdata->accname() ) |
@@ -78,3 +84,4 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF | |||
78 | 84 | ||
79 | void AccountWidget::slotListBoxSelect(int idx) { | 85 | void AccountWidget::slotListBoxSelect(int idx) |
86 | { | ||
80 | bool ok = _pppdata->setAccount( listListbox->text(idx) ); | 87 | bool ok = _pppdata->setAccount( listListbox->text(idx) ); |
@@ -86,3 +93,4 @@ void AccountWidget::slotListBoxSelect(int idx) { | |||
86 | 93 | ||
87 | void AccountWidget::edit() { | 94 | void AccountWidget::edit() |
95 | { | ||
88 | _pppdata->setAccount(listListbox->text(listListbox->currentItem())); | 96 | _pppdata->setAccount(listListbox->text(listListbox->currentItem())); |
@@ -91,3 +99,4 @@ void AccountWidget::edit() { | |||
91 | 99 | ||
92 | if(result == QDialog::Accepted) { | 100 | if(result == QDialog::Accepted) |
101 | { | ||
93 | listListbox->changeItem(_pppdata->accname(),listListbox->currentItem()); | 102 | listListbox->changeItem(_pppdata->accname(),listListbox->currentItem()); |
@@ -99,3 +108,4 @@ void AccountWidget::edit() { | |||
99 | 108 | ||
100 | void AccountWidget::create() { | 109 | void AccountWidget::create() |
110 | { | ||
101 | 111 | ||
@@ -108,3 +118,4 @@ void AccountWidget::create() { | |||
108 | int result; | 118 | int result; |
109 | if (_pppdata->newaccount() == -1){ | 119 | if (_pppdata->newaccount() == -1) |
120 | { | ||
110 | qDebug("_pppdata->newaccount() == -1"); | 121 | qDebug("_pppdata->newaccount() == -1"); |
@@ -114,3 +125,4 @@ void AccountWidget::create() { | |||
114 | 125 | ||
115 | if(result == QDialog::Accepted) { | 126 | if(result == QDialog::Accepted) |
127 | { | ||
116 | listListbox->insertItem(_pppdata->accname()); | 128 | listListbox->insertItem(_pppdata->accname()); |
@@ -119,3 +131,4 @@ void AccountWidget::create() { | |||
119 | _pppdata->save(); | 131 | _pppdata->save(); |
120 | } else | 132 | } |
133 | else | ||
121 | _pppdata->deleteAccount(); | 134 | _pppdata->deleteAccount(); |
@@ -124,3 +137,4 @@ void AccountWidget::create() { | |||
124 | 137 | ||
125 | void AccountWidget::copy() { | 138 | void AccountWidget::copy() |
139 | { | ||
126 | // if(listListbox->count() == MAX_ACCOUNTS) { | 140 | // if(listListbox->count() == MAX_ACCOUNTS) { |
@@ -130,3 +144,4 @@ void AccountWidget::copy() { | |||
130 | 144 | ||
131 | if(listListbox->currentItem()<0) { | 145 | if(listListbox->currentItem()<0) |
146 | { | ||
132 | QMessageBox::information(this, "sorry", tr("No account selected.")); | 147 | QMessageBox::information(this, "sorry", tr("No account selected.")); |
@@ -143,3 +158,4 @@ void AccountWidget::copy() { | |||
143 | 158 | ||
144 | void AccountWidget::remove() { | 159 | void AccountWidget::remove() |
160 | { | ||
145 | 161 | ||
@@ -166,3 +182,4 @@ void AccountWidget::remove() { | |||
166 | 182 | ||
167 | int AccountWidget::doTab(){ | 183 | int AccountWidget::doTab() |
184 | { | ||
168 | QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp ); | 185 | QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp ); |
@@ -177,6 +194,9 @@ int AccountWidget::doTab(){ | |||
177 | 194 | ||
178 | if(_pppdata->accname().isEmpty()) { | 195 | if(_pppdata->accname().isEmpty()) |
196 | { | ||
179 | dlg->setCaption(tr("New Account")); | 197 | dlg->setCaption(tr("New Account")); |
180 | isnewaccount = true; | 198 | isnewaccount = true; |
181 | } else { | 199 | } |
200 | else | ||
201 | { | ||
182 | QString tit = tr("Edit Account: "); | 202 | QString tit = tr("Edit Account: "); |
@@ -214,14 +234,20 @@ int AccountWidget::doTab(){ | |||
214 | 234 | ||
215 | while (!ok){ | 235 | while (!ok) |
216 | dlg->showMaximized(); | 236 | { |
217 | result = dlg->exec(); | 237 | result = QPEApplication::execDialog( dlg ); |
218 | ok = true; | 238 | ok = true; |
219 | 239 | ||
220 | if(result == QDialog::Accepted) { | 240 | if(result == QDialog::Accepted) |
221 | if (!auth_w->check()){ | 241 | { |
242 | if (!auth_w->check()) | ||
243 | { | ||
222 | ok = false; | 244 | ok = false; |
223 | } else if(!dial_w->save()) { | 245 | } |
246 | else if(!dial_w->save()) | ||
247 | { | ||
224 | QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); | 248 | QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); |
225 | ok = false; | 249 | ok = false; |
226 | }else{ | 250 | } |
251 | else | ||
252 | { | ||
227 | ip_w->save(); | 253 | ip_w->save(); |