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.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index 0c96253..ceac90c 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -1,273 +1,273 @@
/*
* kPPP: A pppd Front End for the KDE project
*
* $Id$
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#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 );
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);
number_label = new QLabel(tr("Phone number:"), this);
number_label->setAlignment(AlignTop|AlignLeft);
tl->addWidget(number_label, 1, 0);
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);
- up->setPixmap( Resource::loadPixmap("inline/up") );
+ up->setPixmap( Resource::loadPixmap("up") );
down = new QPushButton(this);
- down->setPixmap( Resource::loadPixmap("inline/down") );
+ down->setPixmap( Resource::loadPixmap("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()),
this, SLOT(downNumber()));
connect(numbers, SIGNAL(highlighted(int)),
this, SLOT(selectionChanged(int)));
numbersChanged();
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);
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);
}
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);
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);
}
void DialWidget::selectionChanged(int) {
numbersChanged();
}
void DialWidget::addNumber() {
PhoneNumberDialog dlg(this);
if(dlg.exec()) {
numbers->insertItem(dlg.phoneNumber());
numbersChanged();
}
}
void DialWidget::delNumber() {
if(numbers->currentItem() != -1) {
numbers->removeItem(numbers->currentItem());
numbersChanged();
}
}
void DialWidget::upNumber() {
int idx = numbers->currentItem();
if(idx != -1) {
QString item = numbers->text(idx);
numbers->removeItem(idx);
numbers->insertItem(item, idx-1);
numbers->setCurrentItem(idx-1);
numbersChanged();
}
}
void DialWidget::downNumber() {
int idx = numbers->currentItem();
if(idx != -1) {
QString item = numbers->text(idx);
numbers->removeItem(idx);
numbers->insertItem(item, idx+1);
numbers->setCurrentItem(idx+1);
numbersChanged();
}
}
void DialWidget::pppdargsbutton() {
PPPdArguments pa(_pppdata, this);
pa.showMaximized();
pa.exec();
}
/////////////////////////////////////////////////////////////////////////////
// ExecWidget
/////////////////////////////////////////////////////////////////////////////
ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) :
QWidget(parent, name), _pppdata(pd)
{
QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
QLabel *l = new QLabel( tr("Here you can select commands to run at certain stages of the connection. The commands are run with your real user id, so you cannot run any commands here requiring root permissions (unless, of course, you are root).<br><br>Be sure to supply the whole path to the program otherwise we might be unable to find it."), this);
tl->addWidget(l);
tl->addStretch(1);
QGridLayout *l1 = new QGridLayout(4, 2, 10);
tl->addLayout(l1);
l1->setColStretch(0, 0);
l1->setColStretch(1, 1);
before_connect_l = new QLabel(tr("Before connect:"), this);
before_connect_l->setAlignment(AlignVCenter);
l1->addWidget(before_connect_l, 0, 0);
before_connect = new QLineEdit(this);
// before_connect->setMaxLength(COMMAND_SIZE);
l1->addWidget(before_connect, 0, 1);
QString tmp = tr("Allows you to run a program <b>before</b> a connection\n"
"is established. It is called immediately before\n"
"dialing has begun.\n\n"
"This might be useful, e.g. to stop HylaFAX blocking the\n"
"modem.");
QWhatsThis::add(before_connect_l,tmp);
QWhatsThis::add(before_connect,tmp);
command_label = new QLabel(tr("Upon connect:"), this);
command_label->setAlignment(AlignVCenter);
l1->addWidget(command_label, 1, 0);
command = new QLineEdit(this);
// command->setMaxLength(COMMAND_SIZE);
l1->addWidget(command, 1, 1);
tmp = tr("Allows you to run a program <b>after</b> a connection\n"
"is established. When your program is called, all\n"
"preparations for an Internet connection are finished.\n"
"\n"
"Very useful for fetching mail and news");
QWhatsThis::add(command_label,tmp);
QWhatsThis::add(command,tmp);
predisconnect_label = new QLabel(tr("Before disconnect:"),
this);