2
Copyright 2011 Lamarque Souza <lamarque@gmail.com>
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 <nm-setting-bluetooth.h>
23
#include "bluetoothwidget.h"
24
#include "settingwidget_p.h"
25
#include "ui_bluetooth.h"
26
#include "connection.h"
27
#include "settings/bluetooth.h"
29
class BluetoothWidgetPrivate : public SettingWidgetPrivate
33
Knm::BluetoothSetting * setting;
36
BluetoothWidget::BluetoothWidget(Knm::Connection * connection, QWidget * parent)
37
: SettingWidget(*new BluetoothWidgetPrivate, connection, parent)
41
d->setting = static_cast<Knm::BluetoothSetting *>(connection->setting(Knm::Setting::Bluetooth));
42
d->ui.networkname->setEnabled(false);
43
d->ui.bdaddr->setEnabled(false);
44
d->ui.networktype->setEnabled(false);
46
d->ui.networktype->setItemData(DunIndex, QString(NM_SETTING_BLUETOOTH_TYPE_DUN));
47
d->ui.networktype->setItemData(PanuIndex, QString(NM_SETTING_BLUETOOTH_TYPE_PANU));
50
BluetoothWidget::~BluetoothWidget()
54
void BluetoothWidget::readConfig()
57
d->ui.networkname->setText(d->setting->networkname());
58
d->ui.bdaddr->setText(d->setting->bdaddrAsString());
59
d->ui.networktype->setCurrentIndex(networktypeIndexFromString(d->setting->networktype()));
62
void BluetoothWidget::writeConfig()
65
d->setting->setNetworkname(d->ui.networkname->text());
66
d->setting->setBdaddrFromString(d->ui.bdaddr->text());
67
d->setting->setNetworktype(d->ui.networktype->itemData(d->ui.networktype->currentIndex()).toString());
70
/*void BluetoothWidget::readSecrets()
74
void BluetoothWidget::validate()
78
BluetoothWidget::NetworktypeIndex BluetoothWidget::networktypeIndexFromString(const QString &networktype) const
80
if (networktype == NM_SETTING_BLUETOOTH_TYPE_PANU) {
86
// vim: sw=4 sts=4 et tw=100