2
Copyright 2008 Will Stephenson <wstephenson@kde.org>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License or (at your option) version 3 or any later version
8
accepted by the membership of KDE e.V. (or its successor approved
9
by the membership of KDE e.V.), which shall act as a proxy
10
defined in Section 14 of version 3 of the license.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include "gsmwidget.h"
24
#include "connection.h"
25
#include "settings/gsm.h"
27
class GsmWidget::Private
31
Knm::GsmSetting * setting;
34
GsmWidget::GsmWidget(Knm::Connection * connection, QWidget * parent)
35
: SettingWidget(connection, parent), d(new GsmWidget::Private)
38
d->setting = static_cast<Knm::GsmSetting *>(connection->setting(Knm::Setting::Gsm));
39
connect(d->ui.chkShowPass, SIGNAL(stateChanged(int)), this, SLOT(chkShowPassToggled()));
40
d->ui.pin->setEchoMode(QLineEdit::Password);
41
d->ui.puk->setEchoMode(QLineEdit::Password);
44
GsmWidget::~GsmWidget()
49
void GsmWidget::readConfig()
51
d->ui.number->setText(d->setting->number());
52
d->ui.username->setText(d->setting->username());
53
d->ui.apn->setText(d->setting->apn());
54
d->ui.network->setText(d->setting->networkid());
55
d->ui.band->setValue(d->setting->band());
56
d->ui.password->setEchoMode(QLineEdit::Password);
59
void GsmWidget::chkShowPassToggled()
61
bool on = d->ui.chkShowPass->isChecked();
62
d->ui.password->setEchoMode(on ? QLineEdit::Normal : QLineEdit::Password);
63
d->ui.pin->setEchoMode(on ? QLineEdit::Normal : QLineEdit::Password);
64
d->ui.puk->setEchoMode(on ? QLineEdit::Normal : QLineEdit::Password);
68
void GsmWidget::writeConfig()
70
d->setting->setNumber(d->ui.number->text());
71
d->setting->setUsername(d->ui.username->text());
72
d->setting->setPassword(d->ui.password->text());
73
d->setting->setApn(d->ui.apn->text());
74
d->setting->setNetworkid(d->ui.network->text());
75
d->setting->setBand(d->ui.band->value());
76
d->setting->setPin(d->ui.pin->text());
77
d->setting->setPuk(d->ui.puk->text());
80
void GsmWidget::readSecrets()
82
d->ui.password->setText(d->setting->password());
83
d->ui.pin->setText(d->setting->pin());
84
d->ui.puk->setText(d->setting->puk());
88
// vim: sw=4 sts=4 et tw=100