summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/accounts.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/ppp/accounts.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp80
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 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "accounts.h"
+#include "authwidget.h"
+#include "pppdata.h"
+#include "edit.h"
+
+/* OPIE */
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qdir.h>
-#include <stdlib.h>
#include <qlayout.h>
#include <qtabwidget.h>
#include <qtabdialog.h>
#include <qwhatsthis.h>
#include <qmessagebox.h>
-
#include <qapplication.h>
#include <qbuttongroup.h>
#include <qmessagebox.h>
#include <qvgroupbox.h>
-#include "accounts.h"
-#include "authwidget.h"
-#include "pppdata.h"
-#include "edit.h"
+/* STD */
+#include <stdlib.h>
void parseargs(char* buf, char** args);
@@ -68,7 +73,8 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF
listListbox->insertStringList(_pppdata->getAccountList());
- for (uint i = 0; i < listListbox->count(); i++){
+ for (uint i = 0; i < listListbox->count(); i++)
+ {
if ( listListbox->text(i) == _pppdata->accname() )
listListbox->setCurrentItem( i );
}
@@ -76,7 +82,8 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF
-void AccountWidget::slotListBoxSelect(int idx) {
+void AccountWidget::slotListBoxSelect(int idx)
+{
bool ok = _pppdata->setAccount( listListbox->text(idx) );
ok = (bool)(idx != -1);
delete_b->setEnabled(ok);
@@ -84,12 +91,14 @@ void AccountWidget::slotListBoxSelect(int idx) {
//FIXME copy_b->setEnabled(ok);
}
-void AccountWidget::edit() {
+void AccountWidget::edit()
+{
_pppdata->setAccount(listListbox->text(listListbox->currentItem()));
int result = doTab();
- if(result == QDialog::Accepted) {
+ if(result == QDialog::Accepted)
+ {
listListbox->changeItem(_pppdata->accname(),listListbox->currentItem());
// emit resetaccounts();
_pppdata->save();
@@ -97,7 +106,8 @@ void AccountWidget::edit() {
}
-void AccountWidget::create() {
+void AccountWidget::create()
+{
// if(listListbox->count() == MAX_ACCOUNTS) {
// QMessageBox::information(this, "sorry",
@@ -106,29 +116,34 @@ void AccountWidget::create() {
// }
int result;
- if (_pppdata->newaccount() == -1){
+ if (_pppdata->newaccount() == -1)
+ {
qDebug("_pppdata->newaccount() == -1");
return;
}
result = doTab();
- if(result == QDialog::Accepted) {
+ if(result == QDialog::Accepted)
+ {
listListbox->insertItem(_pppdata->accname());
listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true);
_pppdata->save();
- } else
+ }
+ else
_pppdata->deleteAccount();
}
-void AccountWidget::copy() {
+void AccountWidget::copy()
+{
// if(listListbox->count() == MAX_ACCOUNTS) {
// QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached."));
// return;
// }
- if(listListbox->currentItem()<0) {
+ if(listListbox->currentItem()<0)
+ {
QMessageBox::information(this, "sorry", tr("No account selected."));
return;
}
@@ -141,7 +156,8 @@ void AccountWidget::copy() {
}
-void AccountWidget::remove() {
+void AccountWidget::remove()
+{
QString s = tr("Are you sure you want to delete\nthe account \"%1\"?")
.arg(listListbox->text(listListbox->currentItem()));
@@ -164,7 +180,8 @@ void AccountWidget::remove() {
}
-int AccountWidget::doTab(){
+int AccountWidget::doTab()
+{
QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp );
QVBoxLayout *layout = new QVBoxLayout( dlg );
layout->setSpacing( 0 );
@@ -175,10 +192,13 @@ int AccountWidget::doTab(){
bool isnewaccount;
- if(_pppdata->accname().isEmpty()) {
+ if(_pppdata->accname().isEmpty())
+ {
dlg->setCaption(tr("New Account"));
isnewaccount = true;
- } else {
+ }
+ else
+ {
QString tit = tr("Edit Account: ");
tit += _pppdata->accname();
dlg->setCaption(tit);
@@ -212,18 +232,24 @@ int AccountWidget::doTab(){
int result = 0;
bool ok = false;
- while (!ok){
- dlg->showMaximized();
- result = dlg->exec();
+ while (!ok)
+ {
+ result = QPEApplication::execDialog( dlg );
ok = true;
- if(result == QDialog::Accepted) {
- if (!auth_w->check()){
+ if(result == QDialog::Accepted)
+ {
+ if (!auth_w->check())
+ {
ok = false;
- } else if(!dial_w->save()) {
+ }
+ else if(!dial_w->save())
+ {
QMessageBox::critical(this, "error", tr( "You must enter a unique account name"));
ok = false;
- }else{
+ }
+ else
+ {
ip_w->save();
dns_w->save();
gateway_w->save();