author | ar <ar> | 2004-02-21 18:32:37 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-21 18:32:37 (UTC) |
commit | 536f271b1e6a1d1886e96a28524a3503c4c38c4e (patch) (unidiff) | |
tree | 63b3c0ce472a89a0f9731195fececc701bf4ca67 /noncore/settings/networksettings/ppp/accounts.cpp | |
parent | db2afda83e495bff9fc19fa14a30072f1cd4c67a (diff) | |
download | opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.zip opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.tar.gz opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.tar.bz2 |
improve support for BigScreen
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 | |||
@@ -24,23 +24,28 @@ | |||
24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | */ | 25 | */ |
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> |
30 | #include <qtabwidget.h> | 38 | #include <qtabwidget.h> |
31 | #include <qtabdialog.h> | 39 | #include <qtabdialog.h> |
32 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
33 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
34 | |||
35 | #include <qapplication.h> | 42 | #include <qapplication.h> |
36 | #include <qbuttongroup.h> | 43 | #include <qbuttongroup.h> |
37 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
38 | #include <qvgroupbox.h> | 45 | #include <qvgroupbox.h> |
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 | ||
45 | void parseargs(char* buf, char** args); | 50 | void parseargs(char* buf, char** args); |
46 | 51 | ||
@@ -68,7 +73,8 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF | |||
68 | 73 | ||
69 | listListbox->insertStringList(_pppdata->getAccountList()); | 74 | listListbox->insertStringList(_pppdata->getAccountList()); |
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() ) |
73 | listListbox->setCurrentItem( i ); | 79 | listListbox->setCurrentItem( i ); |
74 | } | 80 | } |
@@ -76,7 +82,8 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF | |||
76 | 82 | ||
77 | 83 | ||
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) ); |
81 | ok = (bool)(idx != -1); | 88 | ok = (bool)(idx != -1); |
82 | delete_b->setEnabled(ok); | 89 | delete_b->setEnabled(ok); |
@@ -84,12 +91,14 @@ void AccountWidget::slotListBoxSelect(int idx) { | |||
84 | //FIXME copy_b->setEnabled(ok); | 91 | //FIXME copy_b->setEnabled(ok); |
85 | } | 92 | } |
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())); |
89 | 97 | ||
90 | int result = doTab(); | 98 | int result = doTab(); |
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()); |
94 | // emit resetaccounts(); | 103 | // emit resetaccounts(); |
95 | _pppdata->save(); | 104 | _pppdata->save(); |
@@ -97,7 +106,8 @@ void AccountWidget::edit() { | |||
97 | } | 106 | } |
98 | 107 | ||
99 | 108 | ||
100 | void AccountWidget::create() { | 109 | void AccountWidget::create() |
110 | { | ||
101 | 111 | ||
102 | // if(listListbox->count() == MAX_ACCOUNTS) { | 112 | // if(listListbox->count() == MAX_ACCOUNTS) { |
103 | // QMessageBox::information(this, "sorry", | 113 | // QMessageBox::information(this, "sorry", |
@@ -106,29 +116,34 @@ void AccountWidget::create() { | |||
106 | // } | 116 | // } |
107 | 117 | ||
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"); |
111 | return; | 122 | return; |
112 | } | 123 | } |
113 | result = doTab(); | 124 | result = doTab(); |
114 | 125 | ||
115 | if(result == QDialog::Accepted) { | 126 | if(result == QDialog::Accepted) |
127 | { | ||
116 | listListbox->insertItem(_pppdata->accname()); | 128 | listListbox->insertItem(_pppdata->accname()); |
117 | listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); | 129 | listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); |
118 | 130 | ||
119 | _pppdata->save(); | 131 | _pppdata->save(); |
120 | } else | 132 | } |
133 | else | ||
121 | _pppdata->deleteAccount(); | 134 | _pppdata->deleteAccount(); |
122 | } | 135 | } |
123 | 136 | ||
124 | 137 | ||
125 | void AccountWidget::copy() { | 138 | void AccountWidget::copy() |
139 | { | ||
126 | // if(listListbox->count() == MAX_ACCOUNTS) { | 140 | // if(listListbox->count() == MAX_ACCOUNTS) { |
127 | // QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); | 141 | // QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); |
128 | // return; | 142 | // return; |
129 | // } | 143 | // } |
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.")); |
133 | return; | 148 | return; |
134 | } | 149 | } |
@@ -141,7 +156,8 @@ void AccountWidget::copy() { | |||
141 | } | 156 | } |
142 | 157 | ||
143 | 158 | ||
144 | void AccountWidget::remove() { | 159 | void AccountWidget::remove() |
160 | { | ||
145 | 161 | ||
146 | QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") | 162 | QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") |
147 | .arg(listListbox->text(listListbox->currentItem())); | 163 | .arg(listListbox->text(listListbox->currentItem())); |
@@ -164,7 +180,8 @@ void AccountWidget::remove() { | |||
164 | } | 180 | } |
165 | 181 | ||
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 ); |
169 | QVBoxLayout *layout = new QVBoxLayout( dlg ); | 186 | QVBoxLayout *layout = new QVBoxLayout( dlg ); |
170 | layout->setSpacing( 0 ); | 187 | layout->setSpacing( 0 ); |
@@ -175,10 +192,13 @@ int AccountWidget::doTab(){ | |||
175 | 192 | ||
176 | bool isnewaccount; | 193 | bool isnewaccount; |
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: "); |
183 | tit += _pppdata->accname(); | 203 | tit += _pppdata->accname(); |
184 | dlg->setCaption(tit); | 204 | dlg->setCaption(tit); |
@@ -212,18 +232,24 @@ int AccountWidget::doTab(){ | |||
212 | int result = 0; | 232 | int result = 0; |
213 | bool ok = false; | 233 | bool ok = false; |
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(); |
228 | dns_w->save(); | 254 | dns_w->save(); |
229 | gateway_w->save(); | 255 | gateway_w->save(); |