void ConnectionAgentPlugin::connectToConnectiond(QString) { if (connManagerInterface) { delete connManagerInterface; connManagerInterface = 0; } if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(CONND_SERVICE)) { qDebug() << Q_FUNC_INFO << QString("connection service not available").arg(CONND_SERVICE); QDBusReply<void> reply = QDBusConnection::sessionBus().interface()->startService(CONND_SERVICE); if (!reply.isValid()) { qDebug() << Q_FUNC_INFO << reply.error().message(); return; } } connManagerInterface = new com::jolla::Connectiond(CONND_SERVICE, CONND_PATH, QDBusConnection::sessionBus(), this); if (!connManagerInterface->isValid()) { qDebug() << Q_FUNC_INFO << "is not valid interface"; } connect(connManagerInterface,SIGNAL(connectionRequest()), this,SLOT(onConnectionRequested())); connect(connManagerInterface,SIGNAL(configurationNeeded(QString)), this,SIGNAL(configurationNeeded(QString))); connect(connManagerInterface,SIGNAL(userInputCanceled()), this,SIGNAL(userInputCanceled())); connect(connManagerInterface, SIGNAL(errorReported(QString, QString)), this, SLOT(onErrorReported(QString, QString))); connect(connManagerInterface,SIGNAL(connectionState(QString, QString)), this,SLOT(onConnectionState(QString, QString))); connect(connManagerInterface,SIGNAL(requestBrowser(QString)), this,SLOT(onRequestBrowser(QString))); connect(connManagerInterface,SIGNAL(userInputRequested(QString,QVariantMap)), this,SLOT(onUserInputRequested(QString,QVariantMap)), Qt::UniqueConnection); connect(connManagerInterface,SIGNAL(tetheringFinished(bool)), this,SLOT(onTetheringFinished(bool))); }
void QConnectionManager::connectToType(const QString &type) { qDebug() << type; currentType = type; QString techPath = netman->technologyPathForType(type); if (techPath.isEmpty()) { Q_EMIT errorReported("","Type not valid"); return; } NetworkTechnology netTech; netTech.setPath(techPath); if (!netTech.powered()) { // user has indicated they want a connection netTech.setPowered(true); } QStringList servicesList = netman->servicesList(type); bool needConfig = false; if (servicesList.isEmpty()) { if (type == "wifi") { QObject::connect(&netTech,SIGNAL(scanFinished()),this,SLOT(onScanFinished())); netTech.scan(); } else { needConfig = true; // Q_EMIT errorReported("Service not found"); ?? do we want to report an error } } else { currentType = ""; Q_FOREACH (const QString path, servicesList) { // try harder with cell. a favorite is one that has been connected // if there is a context configured but not yet connected, try to connect anyway if (servicesMap.contains(path) && (servicesMap.value(path)->favorite() || servicesMap.value(path)->type() == "cellular")) { connectToNetworkService(path); needConfig = false; return; } else { needConfig = true; } } } if (needConfig) { Q_EMIT configurationNeeded(type); } }