summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/edit.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/ppp/edit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp52
1 files changed, 4 insertions, 48 deletions
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
@@ -25,37 +25,38 @@
#include <string.h>
#include <termios.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qwhatsthis.h>
#include <qregexp.h>
#include <qapplication.h>
#include <qbuttongroup.h>
#include <qvgroupbox.h>
#include <qhbox.h>
#include <qdialog.h>
+#include <qpe/resource.h>
#include "edit.h"
#include "pppdata.h"
#include "iplined.h"
#include "auth.h"
DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
, const char *name )
: QWidget(parent, name), _pppdata(pd)
{
const int GRIDROWS = 6;
- QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint());
+ QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );
connect_label = new QLabel(tr("Connection name:"), this);
tl->addWidget(connect_label, 0, 0);
connectname_l = new QLineEdit(this);
// connectname_l->setMaxLength(ACCNAME_SIZE);
tl->addWidget(connectname_l, 0, 1);
QString tmp = tr("Type in a unique name for this connection");
QWhatsThis::add(connect_label,tmp);
QWhatsThis::add(connectname_l,tmp);
@@ -66,29 +67,27 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
QHBoxLayout *lpn = new QHBoxLayout(5);
tl->addLayout(lpn, 1, 1);
numbers = new QListBox(this);
// numbers->setMinimumSize(120, 70);
lpn->addWidget(numbers);
QVBoxLayout *lpn1 = new QVBoxLayout;
lpn->addLayout(lpn1);
add = new QPushButton(tr("&Add..."), this);
del = new QPushButton(tr("&Remove"), this);
up = new QPushButton(this);
-//FIXME: QPixmap pm = BarIcon("up");
-// up->setPixmap(pm);
+ up->setPixmap( Resource::loadPixmap("inline/up") );
down = new QPushButton(this);
-//FIXME: pm = BarIcon("down");
-// down->setPixmap(pm);
+ down->setPixmap( Resource::loadPixmap("inline/down") );
lpn1->addWidget(add);
lpn1->addWidget(del);
lpn1->addStretch(1);
lpn1->addWidget(up);
lpn1->addWidget(down);
connect(add, SIGNAL(clicked()),
this, SLOT(addNumber()));
connect(del, SIGNAL(clicked()),
this, SLOT(delNumber()));
connect(up, SIGNAL(clicked()),
this, SLOT(upNumber()));
connect(down, SIGNAL(clicked()),
@@ -99,113 +98,70 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
tmp = tr("<p>Specifies the phone numbers to dial. You\n"
"can supply multiple numbers here, simply\n"
"click on \"Add\". You can arrange the\n"
"order the numbers are tried by using the\n"
"arrow buttons.\n\n"
"When a number is busy or fails, <i>kppp</i> will \n"
"try the next number and so on");
QWhatsThis::add(number_label,tmp);
QWhatsThis::add(numbers,tmp);
- auth_l = new QLabel(tr("Authentication:"), this);
- tl->addWidget(auth_l, 3, 0);
-
- auth = new QComboBox(this);
- auth->insertItem(tr("Script-based"));
- auth->insertItem(tr("PAP"));
- auth->insertItem(tr("Terminal-based"));
- auth->insertItem(tr("CHAP"));
- auth->insertItem(tr("PAP/CHAP"));
- tl->addWidget(auth, 3, 1);
- tmp = tr("<p>Specifies the method used to identify yourself to\n"
- "the PPP server. Most universities still use\n"
- "<b>Terminal</b>- or <b>Script</b>-based authentication,\n"
- "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n"
- "unsure, contact your ISP.\n"
- "\n"
- "If you can choose between PAP and CHAP,\n"
- "choose CHAP, because it's much safer. If you don't know\n"
- "whether PAP or CHAP is right, choose PAP/CHAP.");
-
- QWhatsThis::add(auth_l,tmp);
- QWhatsThis::add(auth,tmp);
-
- store_password = new QCheckBox(tr("Store password"), this);
- store_password->setChecked(true);
- tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight);
- QWhatsThis::add(store_password,
- tr("<p>When this is turned on, your ISP password\n"
- "will be saved in <i>kppp</i>'s config file, so\n"
- "you do not need to type it in every time.\n"
- "\n"
- "<b><font color=\"red\">Warning:</font> your password will be stored as\n"
- "plain text in the config file, which is\n"
- "readable only to you. Make sure nobody\n"
- "gains access to this file!"));
-
pppdargs = new QPushButton(tr("Customize pppd Arguments..."), this);
connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton()));
tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter);
// Set defaults if editing an existing connection
if(!isnewaccount) {
connectname_l->setText(_pppdata->accname());
// insert the phone numbers into the listbox
QString n = _pppdata->phonenumber();
QString tmp = "";
uint idx = 0;
while(idx != n.length()) {
if(n[idx] == ':') {
if(tmp.length() > 0)
numbers->insertItem(tmp);
tmp = "";
} else
tmp += n[idx];
idx++;
}
if(tmp.length() > 0)
numbers->insertItem(tmp);
- auth->setCurrentItem(_pppdata->authMethod());
- store_password->setChecked(_pppdata->storePassword());
- } else {
- // select PAP/CHAP as default
- auth->setCurrentItem(AUTH_PAPCHAP);
}
numbersChanged();
tl->activate();
}
bool DialWidget::save() {
//first check to make sure that the account name is unique!
if(connectname_l->text().isEmpty() ||
!_pppdata->isUniqueAccname(connectname_l->text())) {
return false;
} else {
_pppdata->setAccname(connectname_l->text());
QString number = "";
for(uint i = 0; i < numbers->count(); i++) {
if(i != 0)
number += ":";
number += numbers->text(i);
}
_pppdata->setPhonenumber(number);
- _pppdata->setAuthMethod(auth->currentItem());
- _pppdata->setStorePassword(store_password->isChecked());
return true;
}
}
void DialWidget::numbersChanged() {
int sel = numbers->currentItem();
del->setEnabled(sel != -1);
up->setEnabled(sel != -1 && sel != 0);
down->setEnabled(sel != -1 && sel != (int)numbers->count()-1);
}