author | tille <tille> | 2003-06-12 16:27:32 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-12 16:27:32 (UTC) |
commit | 212f79ac5305c32d0752cc358c2636df0bc7e523 (patch) (unidiff) | |
tree | 324658eb2308a54507edb5a58330aa7de258f3bb | |
parent | f0f9cf3fa486a577770e3c0e89280c66ea331e73 (diff) | |
download | opie-212f79ac5305c32d0752cc358c2636df0bc7e523.zip opie-212f79ac5305c32d0752cc358c2636df0bc7e523.tar.gz opie-212f79ac5305c32d0752cc358c2636df0bc7e523.tar.bz2 |
fix delete account
-rw-r--r-- | noncore/settings/networksettings/ppp/accounts.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index 04905e8..fa1c43b 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp | |||
@@ -137,97 +137,99 @@ void AccountWidget::newaccount() { | |||
137 | 137 | ||
138 | if(accountlist_l->count() == MAX_ACCOUNTS) { | 138 | if(accountlist_l->count() == MAX_ACCOUNTS) { |
139 | QMessageBox::information(this, "sorry", | 139 | QMessageBox::information(this, "sorry", |
140 | tr("Maximum number of accounts reached.")); | 140 | tr("Maximum number of accounts reached.")); |
141 | return; | 141 | return; |
142 | } | 142 | } |
143 | 143 | ||
144 | int result; | 144 | int result; |
145 | if (_pppdata->newaccount() == -1){ | 145 | if (_pppdata->newaccount() == -1){ |
146 | qDebug("_pppdata->newaccount() == -1"); | 146 | qDebug("_pppdata->newaccount() == -1"); |
147 | return; | 147 | return; |
148 | } | 148 | } |
149 | result = doTab(); | 149 | result = doTab(); |
150 | 150 | ||
151 | if(result == QDialog::Accepted) { | 151 | if(result == QDialog::Accepted) { |
152 | accountlist_l->insertItem(_pppdata->accname()); | 152 | accountlist_l->insertItem(_pppdata->accname()); |
153 | accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()),true); | 153 | accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()),true); |
154 | 154 | ||
155 | _pppdata->save(); | 155 | _pppdata->save(); |
156 | } else | 156 | } else |
157 | _pppdata->deleteAccount(); | 157 | _pppdata->deleteAccount(); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | void AccountWidget::copyaccount() { | 161 | void AccountWidget::copyaccount() { |
162 | if(accountlist_l->count() == MAX_ACCOUNTS) { | 162 | if(accountlist_l->count() == MAX_ACCOUNTS) { |
163 | QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); | 163 | QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | 166 | ||
167 | if(accountlist_l->currentItem()<0) { | 167 | if(accountlist_l->currentItem()<0) { |
168 | QMessageBox::information(this, "sorry", tr("No account selected.")); | 168 | QMessageBox::information(this, "sorry", tr("No account selected.")); |
169 | return; | 169 | return; |
170 | } | 170 | } |
171 | 171 | ||
172 | _pppdata->copyaccount(accountlist_l->currentItem()); | 172 | _pppdata->copyaccount(accountlist_l->currentItem()); |
173 | 173 | ||
174 | accountlist_l->insertItem(_pppdata->accname()); | 174 | accountlist_l->insertItem(_pppdata->accname()); |
175 | // emit resetaccounts(); | 175 | // emit resetaccounts(); |
176 | _pppdata->save(); | 176 | _pppdata->save(); |
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | void AccountWidget::deleteaccount() { | 180 | void AccountWidget::deleteaccount() { |
181 | 181 | ||
182 | QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") | 182 | QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") |
183 | .arg(accountlist_l->text(accountlist_l->currentItem())); | 183 | .arg(accountlist_l->text(accountlist_l->currentItem())); |
184 | 184 | ||
185 | if(QMessageBox::warning(this, s, tr("Confirm")) != QMessageBox::Yes) | 185 | if(QMessageBox::warning(this,tr("Confirm"),s, |
186 | QMessageBox::Yes,QMessageBox::No | ||
187 | ) != QMessageBox::Yes) | ||
186 | return; | 188 | return; |
187 | 189 | ||
188 | if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) | 190 | if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) |
189 | accountlist_l->removeItem(accountlist_l->currentItem()); | 191 | accountlist_l->removeItem(accountlist_l->currentItem()); |
190 | 192 | ||
191 | emit resetaccounts(); | 193 | emit resetaccounts(); |
192 | _pppdata->save(); | 194 | _pppdata->save(); |
193 | 195 | ||
194 | slotListBoxSelect(accountlist_l->currentItem()); | 196 | slotListBoxSelect(accountlist_l->currentItem()); |
195 | 197 | ||
196 | } | 198 | } |
197 | 199 | ||
198 | 200 | ||
199 | int AccountWidget::doTab(){ | 201 | int AccountWidget::doTab(){ |
200 | QDialog *dlg = new QDialog( 0, "newAccount", true ); | 202 | QDialog *dlg = new QDialog( 0, "newAccount", true ); |
201 | QVBoxLayout *layout = new QVBoxLayout( dlg ); | 203 | QVBoxLayout *layout = new QVBoxLayout( dlg ); |
202 | layout->setSpacing( 0 ); | 204 | layout->setSpacing( 0 ); |
203 | layout->setMargin( 1 ); | 205 | layout->setMargin( 1 ); |
204 | 206 | ||
205 | tabWindow = new QTabWidget( dlg, "tabWindow" ); | 207 | tabWindow = new QTabWidget( dlg, "tabWindow" ); |
206 | layout->addWidget( tabWindow ); | 208 | layout->addWidget( tabWindow ); |
207 | 209 | ||
208 | bool isnewaccount; | 210 | bool isnewaccount; |
209 | 211 | ||
210 | if(_pppdata->accname().isEmpty()) { | 212 | if(_pppdata->accname().isEmpty()) { |
211 | dlg->setCaption(tr("New Account")); | 213 | dlg->setCaption(tr("New Account")); |
212 | isnewaccount = true; | 214 | isnewaccount = true; |
213 | } else { | 215 | } else { |
214 | QString tit = tr("Edit Account: "); | 216 | QString tit = tr("Edit Account: "); |
215 | tit += _pppdata->accname(); | 217 | tit += _pppdata->accname(); |
216 | dlg->setCaption(tit); | 218 | dlg->setCaption(tit); |
217 | isnewaccount = false; | 219 | isnewaccount = false; |
218 | } | 220 | } |
219 | 221 | ||
220 | // // DIAL WIDGET | 222 | // // DIAL WIDGET |
221 | dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup"); | 223 | dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup"); |
222 | tabWindow->addTab( dial_w, tr("Dial") ); | 224 | tabWindow->addTab( dial_w, tr("Dial") ); |
223 | 225 | ||
224 | // // AUTH WIDGET | 226 | // // AUTH WIDGET |
225 | auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); | 227 | auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); |
226 | tabWindow->addTab( auth_w, tr("Authentication") ); | 228 | tabWindow->addTab( auth_w, tr("Authentication") ); |
227 | 229 | ||
228 | // // IP WIDGET | 230 | // // IP WIDGET |
229 | ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); | 231 | ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); |
230 | tabWindow->addTab( ip_w, tr("IP") ); | 232 | tabWindow->addTab( ip_w, tr("IP") ); |
231 | 233 | ||
232 | // // GATEWAY WIDGET | 234 | // // GATEWAY WIDGET |
233 | gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup")); | 235 | gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup")); |