~ubuntu-branches/ubuntu/precise/networkmanagement/precise-updates

« back to all changes in this revision

Viewing changes to libs/ui/bluetoothwidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl, Modestas Vainius, Michael Biebl
  • Date: 2011-05-27 12:18:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110527121825-vfufwquq3vy0k3zn
Tags: 0.1+git20110526.911025d-1
[ Modestas Vainius ]
* Use official KDE branding in the package descriptions.

[ Michael Biebl ]
* New upstream Git snapshot 911025d81fdfbe09b64705e94e5411f521c38e3e.
* debian/control
  - Bump Build-Depends on kdelibs5-dev and kdebase-workspace-dev to
    (>= 4:4.6.0).
  - Bump Build-Depends on network-manager-dev and libnm-util-dev to
    (>= 0.8.1).
  - Bump Depends on network-manager to (>= 0.8.1).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright 2011 Lamarque Souza <lamarque@gmail.com>
 
3
 
 
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.
 
11
 
 
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.
 
16
 
 
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/>.
 
19
*/
 
20
 
 
21
#include <nm-setting-bluetooth.h>
 
22
 
 
23
#include "bluetoothwidget.h"
 
24
#include "settingwidget_p.h"
 
25
#include "ui_bluetooth.h"
 
26
#include "connection.h"
 
27
#include "settings/bluetooth.h"
 
28
 
 
29
class BluetoothWidgetPrivate : public SettingWidgetPrivate
 
30
{
 
31
public:
 
32
    Ui_Bluetooth ui;
 
33
    Knm::BluetoothSetting * setting;
 
34
};
 
35
 
 
36
BluetoothWidget::BluetoothWidget(Knm::Connection * connection, QWidget * parent)
 
37
: SettingWidget(*new BluetoothWidgetPrivate, connection, parent)
 
38
{
 
39
    Q_D(BluetoothWidget);
 
40
    d->ui.setupUi(this);
 
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);
 
45
 
 
46
    d->ui.networktype->setItemData(DunIndex, QString(NM_SETTING_BLUETOOTH_TYPE_DUN));
 
47
    d->ui.networktype->setItemData(PanuIndex, QString(NM_SETTING_BLUETOOTH_TYPE_PANU));
 
48
}
 
49
 
 
50
BluetoothWidget::~BluetoothWidget()
 
51
{
 
52
}
 
53
 
 
54
void BluetoothWidget::readConfig()
 
55
{
 
56
    Q_D(BluetoothWidget);
 
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()));
 
60
}
 
61
 
 
62
void BluetoothWidget::writeConfig()
 
63
{
 
64
    Q_D(BluetoothWidget);
 
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());
 
68
}
 
69
 
 
70
/*void BluetoothWidget::readSecrets()
 
71
{
 
72
}*/
 
73
 
 
74
void BluetoothWidget::validate()
 
75
{
 
76
}
 
77
 
 
78
BluetoothWidget::NetworktypeIndex BluetoothWidget::networktypeIndexFromString(const QString &networktype) const
 
79
{
 
80
    if (networktype == NM_SETTING_BLUETOOTH_TYPE_PANU) {
 
81
        return PanuIndex;
 
82
    }
 
83
    return DunIndex;
 
84
}
 
85
 
 
86
// vim: sw=4 sts=4 et tw=100