NetworkTime::NetworkTime(QObject *parent) : QObject(parent) { foreach (const QString objectPath, m_modemManager.getModemList()) onModemAdded(objectPath); QObject::connect(&m_modemManager, SIGNAL(modemAdded(QString)), this, SLOT(onModemAdded(QString))); QObject::connect(&m_modemManager, SIGNAL(modemRemoved(QString)), this, SLOT(onModemRemoved(QString))); }
QString NMGsmNetworkInterface::getUdiForModemManager() { if (driver() != QLatin1String("bluez")) { return udi(); } /* BlueZ knows about the rfcommX string that we could use to find the device in ModemManager * but does not export this info, so let's use the first bluetooth device we find in ModemManager. * Modem will be registered in ModemManager only after someone execute its org.bluez.Serial.Connect method. */ foreach(const Solid::Control::ModemInterface *modem, Solid::Control::ModemManager::modemInterfaces()) { if (modem->driver() == QLatin1String("bluetooth")) { return modem->udi(); } } modemRemoved(udi()); return QString(); }
Solid::Control::ModemGsmNetworkInterface * NMGsmNetworkInterface::getModemNetworkIface() { QString correctUdi = getUdiForModemManager(); if (correctUdi.isEmpty()) { return 0; } if (modemGsmNetworkIface == 0) { modemGsmNetworkIface = qobject_cast<Solid::Control::ModemGsmNetworkInterface*> (Solid::Control::ModemManager::findModemInterface(correctUdi, Solid::Control::ModemInterface::GsmNetwork)); if (modemGsmNetworkIface) { connect(Solid::Control::ModemManager::notifier(), SIGNAL(modemInterfaceRemoved(QString)), this, SLOT(modemRemoved(QString))); } } return modemGsmNetworkIface; }
PinDialog::PinDialog(ModemManager::ModemGsmCardInterface *modem, const Type type, QWidget *parent) : QDialog(parent), m_type(type) { if (modem) { m_udi = modem->udi(); m_name = modem->masterDevice(); /* foreach (const Solid::Device &d, Solid::Device::allDevices()) { if (d.udi().contains(m_name, Qt::CaseInsensitive)) { m_name = d.product(); if (!m_name.startsWith(d.vendor())) { m_name = d.vendor() + ' ' + m_name; } break; } } */ } QWidget *w = new QWidget(); ui = new Ui::PinWidget(); ui->setupUi(w); ui->pin->setEchoMode(QLineEdit::Password); QIntValidator * validator = new QIntValidator(this); validator->setRange(1000, 99999999); ui->pin->setValidator(validator); ui->pin2->setValidator(validator); QIntValidator * validator2 = new QIntValidator(this); validator2->setRange(10000000, 99999999); ui->puk->setValidator(validator2); ui->errorMessage->setHidden(true); // QRect desktop = KGlobalSettings::desktopGeometry(topLevelWidget()); // setMinimumWidth(qMin(1000, qMax(sizeHint().width(), desktop.width() / 4))); // pixmapLabel = new QLabel( mainWidget() ); // pixmapLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop ); // ui->gridLayout->addWidget( pixmapLabel, 0, 0 ); // pixmapLabel->setPixmap( QIcon("dialog-password")); // button(KDialog::Ok)->setText(trc("As in 'Unlock cell phone with this pin code'", "Unlock")); // setMainWidget(w); if (m_type == PinPuk) { setWindowTitle(tr("SIM PUK unlock required")); ui->title->setText(tr("SIM PUK Unlock Required")); ui->prompt->setText(tr("The mobile broadband device '%1' requires a SIM PUK code before it can be used.").arg(m_name)); ui->pukLabel->setText(tr("PUK code:")); ui->pinLabel->setText(tr("New PIN code:")); ui->pin2Label->setText(tr("Re-enter new PIN code:")); ui->chkShowPass->setText(tr("Show PIN/PUK code")); ui->puk->setFocus(); ui->pukLabel->show(); ui->puk->show(); ui->pin2Label->show(); ui->pin2->show(); } else { setWindowTitle(tr("SIM PIN unlock required")); ui->title->setText(tr("SIM PIN Unlock Required")); ui->prompt->setText(tr("The mobile broadband device '%1' requires a SIM PIN code before it can be used.").arg(m_name)); ui->pinLabel->setText(tr("PIN code:")); ui->chkShowPass->setText(tr("Show PIN code")); ui->pin->setFocus(); ui->pukLabel->hide(); ui->puk->hide(); ui->pin2Label->hide(); ui->pin2->hide(); } ui->puk->setText(""); ui->pin->setText(""); ui->pin2->setText(""); ui->puk->setCursorPosition(0); ui->pin->setCursorPosition(0); ui->pin2->setCursorPosition(0); // KWindowSystem::setState( winId(), NET::KeepAbove ); // KWindowSystem::setOnAllDesktops( winId(), true ); // KWindowSystem::activateWindow( winId()); // move((desktop.width() - width()) / 2, (desktop.height() - height()) / 2); connect(ui->chkShowPass, SIGNAL(stateChanged(int)), this, SLOT(chkShowPassToggled())); connect(ModemManager::notifier(), SIGNAL(modemRemoved(QString)), SLOT(modemRemoved(QString))); }