Commit 25902661 authored by Raine Makelainen's avatar Raine Makelainen

Switch to use newer signal-slot mechnanism

This commit also drop servicesChanged slot as it renders to
empty.
parent af3feed4
...@@ -57,14 +57,16 @@ QConnectionAgent::QConnectionAgent(QObject *parent) : ...@@ -57,14 +57,16 @@ QConnectionAgent::QConnectionAgent(QObject *parent) :
valid = false; valid = false;
} }
connect(this,SIGNAL(configurationNeeded(QString)),this,SLOT(openConnectionDialog(QString))); connect(this, &QConnectionAgent::configurationNeeded, this, &QConnectionAgent::openConnectionDialog);
connect(netman,SIGNAL(availabilityChanged(bool)),this,SLOT(connmanAvailabilityChanged(bool))); connect(netman, &NetworkManager::availabilityChanged, this, &QConnectionAgent::connmanAvailabilityChanged);
connect(netman,SIGNAL(servicesListChanged(QStringList)),this,SLOT(servicesListChanged(QStringList))); connect(netman, &NetworkManager::servicesListChanged, this, &QConnectionAgent::servicesListChanged);
connect(netman,SIGNAL(stateChanged(QString)),this,SLOT(networkStateChanged(QString))); connect(netman, &NetworkManager::stateChanged, this, &QConnectionAgent::networkStateChanged);
connect(netman,SIGNAL(offlineModeChanged(bool)),this,SLOT(offlineModeChanged(bool))); connect(netman, &NetworkManager::offlineModeChanged, this, &QConnectionAgent::offlineModeChanged);
connect(netman,SIGNAL(servicesChanged()),this,SLOT(servicesChanged())); connect(netman, &NetworkManager::servicesChanged, this, [=]() {
connect(netman,SIGNAL(technologiesChanged()),this,SLOT(techChanged())); updateServices();
});
connect(netman, &NetworkManager::technologiesChanged, this, &QConnectionAgent::techChanged);
QFile connmanConf("/etc/connman/main.conf"); QFile connmanConf("/etc/connman/main.conf");
if (connmanConf.open(QIODevice::ReadOnly | QIODevice::Text)) { if (connmanConf.open(QIODevice::ReadOnly | QIODevice::Text)) {
...@@ -85,7 +87,7 @@ QConnectionAgent::QConnectionAgent(QObject *parent) : ...@@ -85,7 +87,7 @@ QConnectionAgent::QConnectionAgent(QObject *parent) :
connmanAvailable = QDBusConnection::systemBus().interface()->isServiceRegistered("net.connman"); connmanAvailable = QDBusConnection::systemBus().interface()->isServiceRegistered("net.connman");
scanTimer = new QTimer(this); scanTimer = new QTimer(this);
connect(scanTimer,SIGNAL(timeout()),this,SLOT(scanTimeout())); connect(scanTimer, &QTimer::timeout, this, &QConnectionAgent::scanTimeout);
scanTimer->setSingleShot(true); scanTimer->setSingleShot(true);
if (connmanAvailable && valid) if (connmanAvailable && valid)
setup(); setup();
...@@ -325,16 +327,14 @@ void QConnectionAgent::updateServices() ...@@ -325,16 +327,14 @@ void QConnectionAgent::updateServices()
//new! //new!
qDebug() <<"new service"<< servicePath; qDebug() <<"new service"<< servicePath;
QObject::connect(serv, SIGNAL(stateChanged(QString)), QObject::connect(serv, &NetworkService::stateChanged,
this,SLOT(serviceStateChanged(QString)), Qt::UniqueConnection); this, &QConnectionAgent::serviceStateChanged, Qt::UniqueConnection);
QObject::connect(serv, SIGNAL(connectRequestFailed(QString)), QObject::connect(serv, &NetworkService::connectRequestFailed,
this,SLOT(serviceErrorChanged(QString)), Qt::UniqueConnection); this, &QConnectionAgent::serviceErrorChanged, Qt::UniqueConnection);
QObject::connect(serv, &NetworkService::errorChanged,
QObject::connect(serv, SIGNAL(errorChanged(QString)), this, &QConnectionAgent::servicesError, Qt::UniqueConnection);
this,SLOT(servicesError(QString)), Qt::UniqueConnection); QObject::connect(serv, &NetworkService::autoConnectChanged,
this, &QConnectionAgent::serviceAutoconnectChanged, Qt::UniqueConnection);
QObject::connect(serv, SIGNAL(autoConnectChanged(bool)),
this,SLOT(serviceAutoconnectChanged(bool)), Qt::UniqueConnection);
} }
} }
} }
...@@ -407,16 +407,16 @@ void QConnectionAgent::setup() ...@@ -407,16 +407,16 @@ void QConnectionAgent::setup()
delete ua; delete ua;
ua = new UserAgent(this); ua = new UserAgent(this);
connect(ua,SIGNAL(userInputRequested(QString,QVariantMap)), connect(ua, &UserAgent::userInputRequested,
this,SLOT(onUserInputRequested(QString,QVariantMap))); this, &QConnectionAgent::onUserInputRequested);
connect(ua,SIGNAL(connectionRequest()),this,SLOT(onConnectionRequest())); connect(ua, &UserAgent::connectionRequest, this, &QConnectionAgent::onConnectionRequest);
connect(ua,SIGNAL(errorReported(QString, QString)),this,SLOT(onErrorReported(QString, QString))); connect(ua, &UserAgent::errorReported, this, &QConnectionAgent::onErrorReported);
connect(ua,SIGNAL(userInputCanceled()),this,SLOT(onUserInputCanceled())); connect(ua, &UserAgent::userInputCanceled, this, &QConnectionAgent::onUserInputCanceled);
connect(ua,SIGNAL(userInputRequested(QString,QVariantMap)), connect(ua, &UserAgent::userInputRequested,
this,SLOT(onUserInputRequested(QString,QVariantMap)), Qt::UniqueConnection); this, &QConnectionAgent::onUserInputRequested, Qt::UniqueConnection);
connect(ua,SIGNAL(browserRequested(QString,QString)), connect(ua, &UserAgent::browserRequested,
this,SLOT(browserRequest(QString,QString)), Qt::UniqueConnection); this, &QConnectionAgent::browserRequest, Qt::UniqueConnection);
updateServices(); updateServices();
offlineModeChanged(netman->offlineMode()); offlineModeChanged(netman->offlineMode());
...@@ -449,7 +449,7 @@ void QConnectionAgent::technologyPowerChanged(bool powered) ...@@ -449,7 +449,7 @@ void QConnectionAgent::technologyPowerChanged(bool powered)
if (netman && powered && delayedTethering) { if (netman && powered && delayedTethering) {
// wifi tech might not be ready, so delay this // wifi tech might not be ready, so delay this
QTimer::singleShot(1000,this,SLOT(setWifiTetheringEnabled())); QTimer::singleShot(1000, this, &QConnectionAgent::setWifiTetheringEnabled);
} }
} }
...@@ -474,9 +474,9 @@ void QConnectionAgent::techChanged() ...@@ -474,9 +474,9 @@ void QConnectionAgent::techChanged()
knownTechnologies << technology->path(); knownTechnologies << technology->path();
if (technology->type() == "wifi") { if (technology->type() == "wifi") {
tetheringWifiTech = technology; tetheringWifiTech = technology;
connect(tetheringWifiTech,SIGNAL(poweredChanged(bool)),this,SLOT(technologyPowerChanged(bool))); connect(tetheringWifiTech, &NetworkTechnology::poweredChanged, this, &QConnectionAgent::technologyPowerChanged);
connect(tetheringWifiTech, SIGNAL(tetheringChanged(bool)), connect(tetheringWifiTech, &NetworkTechnology::tetheringChanged,
this,SLOT(techTetheringChanged(bool)), Qt::UniqueConnection); this, &QConnectionAgent::techTetheringChanged, Qt::UniqueConnection);
} }
} else { } else {
knownTechnologies.removeOne(technology->path()); knownTechnologies.removeOne(technology->path());
...@@ -529,7 +529,7 @@ void QConnectionAgent::offlineModeChanged(bool b) ...@@ -529,7 +529,7 @@ void QConnectionAgent::offlineModeChanged(bool b)
{ {
flightModeSuppression = b; flightModeSuppression = b;
if (b) { if (b) {
QTimer::singleShot(5 * 1000 * 60,this,SLOT(flightModeDialogSuppressionTimeout())); //5 minutes QTimer::singleShot(5 * 1000 * 60, this, &QConnectionAgent::flightModeDialogSuppressionTimeout); //5 minutes
} }
} }
...@@ -565,11 +565,6 @@ void QConnectionAgent::scanTimeout() ...@@ -565,11 +565,6 @@ void QConnectionAgent::scanTimeout()
} }
} }
void QConnectionAgent::servicesChanged()
{
updateServices();
}
void QConnectionAgent::removeAllTypes(const QString &type) void QConnectionAgent::removeAllTypes(const QString &type)
{ {
Q_FOREACH (Service elem, orderedServicesList) { Q_FOREACH (Service elem, orderedServicesList) {
......
...@@ -146,7 +146,6 @@ private slots: ...@@ -146,7 +146,6 @@ private slots:
void serviceAutoconnectChanged(bool); void serviceAutoconnectChanged(bool);
void scanTimeout(); void scanTimeout();
void techTetheringChanged(bool b); void techTetheringChanged(bool b);
void servicesChanged();
void openConnectionDialog(const QString &type); void openConnectionDialog(const QString &type);
void setWifiTetheringEnabled(); void setWifiTetheringEnabled();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment