28
28
#include <KIconLoader>
29
29
#ifdef COMPILE_MODEM_MANAGER_SUPPORT
30
30
#include <solid/control/modemmanager.h>
31
#include <solid/device.h>
33
34
#include "mobileconnectionwizard.h"
35
MobileConnectionWizard::MobileConnectionWizard(QWidget * parent): QWizard(parent)
36
MobileConnectionWizard::MobileConnectionWizard(Knm::Connection::Type connectionType, QWidget * parent): QWizard(parent)
38
if (connectionType == Knm::Connection::Unknown) {
39
mInitialMethodType = false;
41
mInitialMethodType = true;
43
if (connectionType == Knm::Connection::Bluetooth) {
44
mType = Knm::Connection::Gsm;
46
mType = connectionType;
37
50
mProviders = new MobileProviders();
38
51
setWindowTitle(i18nc("Mobile Connection Wizard", "New Mobile Broadband Connection"));
39
52
addPage(createIntroPage());
78
mIface = Solid::Control::NetworkManager::findNetworkInterface(mDeviceComboBox->itemData(mDeviceComboBox->currentIndex()).toString());
91
if (!mInitialMethodType) {
92
Solid::Control::NetworkInterface *iface = Solid::Control::NetworkManager::findNetworkInterface(mDeviceComboBox->itemData(mDeviceComboBox->currentIndex()).toString());
93
if (iface && iface->type() == Solid::Control::NetworkInterface::Cdma) {
94
mType = Knm::Connection::Cdma;
96
mType = Knm::Connection::Gsm;
79
100
if (mProviders->getError() != MobileProviders::Success) {
84
106
case 2: // Providers Page
85
107
country = mCountryList->currentItem()->text();
207
Knm::Connection::Type MobileConnectionWizard::type() const
209
if (mIface && mIface->type() == Solid::Control::NetworkInterface::Cdma) {
210
return Knm::Connection::Cdma;
213
return Knm::Connection::Gsm;
216
229
/**********************************************************/
218
231
/**********************************************************/
236
249
arg(i18nc("Mobile Connection Wizard", "(in some cases) Your broadband billing plan APN (Access Point Name)")));
237
250
layout->addWidget(label);
239
label = new QLabel("\n" + i18nc("Mobile Connection Wizard", "Create a connection for &this mobile broadband device:"));
240
layout->addWidget(label);
242
mDeviceComboBox = new QComboBox();
243
mDeviceComboBox->addItem(i18nc("Mobile Connection Wizard", "Any device"));
244
mDeviceComboBox->insertSeparator(1);
245
label->setBuddy(mDeviceComboBox);
246
layout->addWidget(mDeviceComboBox);
248
QObject::connect(Solid::Control::NetworkManager::notifier(), SIGNAL(networkInterfaceAdded(const QString)),
249
this, SLOT(introDeviceAdded(const QString)));
250
QObject::connect(Solid::Control::NetworkManager::notifier(), SIGNAL(networkInterfaceRemoved(const QString)),
251
this, SLOT(introDeviceRemoved(const QString)));
252
QObject::connect(Solid::Control::NetworkManager::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
253
this, SLOT(introStatusChanged(Solid::Networking::Status)));
255
introAddInitialDevices();
252
if (!mInitialMethodType) {
253
label = new QLabel("\n" + i18nc("Mobile Connection Wizard", "Create a connection for &this mobile broadband device:"));
254
layout->addWidget(label);
256
mDeviceComboBox = new QComboBox();
257
mDeviceComboBox->addItem(i18nc("Mobile Connection Wizard", "Any device"));
258
mDeviceComboBox->insertSeparator(1);
259
label->setBuddy(mDeviceComboBox);
260
layout->addWidget(mDeviceComboBox);
262
QObject::connect(Solid::Control::NetworkManager::notifier(), SIGNAL(networkInterfaceAdded(const QString)),
263
this, SLOT(introDeviceAdded(const QString)));
264
QObject::connect(Solid::Control::NetworkManager::notifier(), SIGNAL(networkInterfaceRemoved(const QString)),
265
this, SLOT(introDeviceRemoved(const QString)));
266
QObject::connect(Solid::Control::NetworkManager::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
267
this, SLOT(introStatusChanged(Solid::Networking::Status)));
269
introAddInitialDevices();
257
272
page->setLayout(layout);
266
281
#ifdef COMPILE_MODEM_MANAGER_SUPPORT
267
282
Solid::Control::ModemInterface *modem = Solid::Control::ModemManager::findModemInterface(device->udi(), Solid::Control::ModemInterface::GsmCard);
268
if (modem && modem->enabled()) {
269
desc.append(modem->getInfo().manufacturer);
271
desc.append(modem->getInfo().model);
284
if (modem->enabled()) {
285
desc.append(modem->getInfo().manufacturer);
287
desc.append(modem->getInfo().model);
289
QString deviceName = modem->masterDevice();
290
foreach (const Solid::Device &d, Solid::Device::allDevices()) {
291
if (d.udi().contains(deviceName, Qt::CaseInsensitive)) {
292
deviceName = d.product();
293
if (!deviceName.startsWith(d.vendor())) {
294
deviceName = d.vendor() + " " + deviceName;
296
desc.append(deviceName);