Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[connectionagent] Cleanup deadcode. Contributes to JB#20091
  • Loading branch information
rainemak committed Jun 19, 2017
1 parent 904c8e6 commit 1836b01
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
66 changes: 0 additions & 66 deletions connd/qconnectionagent.cpp
Expand Up @@ -111,7 +111,6 @@ void QConnectionAgent::onUserInputRequested(const QString &servicePath, const QV
// from useragent
void QConnectionAgent::onUserInputCanceled()
{
qDebug() ;
Q_EMIT userInputCanceled();
}

Expand Down Expand Up @@ -305,11 +304,6 @@ void QConnectionAgent::connectToType(const QString &type)
Q_EMIT configurationNeeded(convType);
}

void QConnectionAgent::onScanFinished()
{
qDebug() << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
}

void QConnectionAgent::updateServices()
{
qDebug() << Q_FUNC_INFO;
Expand Down Expand Up @@ -483,7 +477,6 @@ void QConnectionAgent::techChanged()
if (technology->type() == "wifi") {
tetheringWifiTech = technology;
connect(tetheringWifiTech,SIGNAL(poweredChanged(bool)),this,SLOT(technologyPowerChanged(bool)));
connect(tetheringWifiTech,SIGNAL(scanFinished()),this,SLOT(onScanFinished()));
connect(tetheringWifiTech, SIGNAL(tetheringChanged(bool)),
this,SLOT(techTetheringChanged(bool)), Qt::UniqueConnection);
}
Expand Down Expand Up @@ -560,22 +553,6 @@ void QConnectionAgent::serviceAutoconnectChanged(bool on)
}
}

bool QConnectionAgent::isBestService(NetworkService *service)
{

qDebug() << Q_FUNC_INFO
<< service->path()
<< tetheringEnabled
<< netman->defaultRoute()->path().contains(service->path())
<< (netman->defaultRoute()->state() != "online");

if (tetheringEnabled) return false;
if (netman->offlineMode() && service->type() == "cellular") return false;
if (netman->defaultRoute()->type() == "wifi" && service->type() == "cellular") return false;
if (netman->defaultRoute()->path().contains(service->path())) return false;
return true;
}

void QConnectionAgent::scanTimeout()
{
if (!tetheringWifiTech || tetheringWifiTech->tethering())
Expand All @@ -598,49 +575,6 @@ void QConnectionAgent::servicesChanged()
updateServices();
}

QString QConnectionAgent::findBestConnectableService()
{
for (int i = 0; i < orderedServicesList.count(); i++) {

QString path = orderedServicesList.at(i).path;

NetworkService *service = orderedServicesList.at(i).service;
if (!service)
continue;

qDebug() << "looking at"
<< service->name()
<< service->autoConnect();

bool online = isStateOnline(netman->defaultRoute()->state());
qDebug() << "state is"<< online << netman->defaultRoute()->path();

if (!service->autoConnect()) {
continue;
}

qDebug() <<Q_FUNC_INFO<< "continued"
<< online
<< (netman->defaultRoute()->path() == service->path())
<< netman->defaultRoute()->strength()
<< service->strength();

if ((netman->defaultRoute()->type() == "wifi" && service->type() == "wifi")
&& netman->defaultRoute()->strength() > service->strength())
return QString(); //better quality already connected

if (netman->defaultRoute()->type() == "wifi" && service->type() != "wifi")
return QString(); // prefer connected wifi

if (isBestService(service)
&& service->favorite()) {
qDebug() << path;
return path;
}
}
return QString();
}

void QConnectionAgent::removeAllTypes(const QString &type)
{
Q_FOREACH (Service elem, orderedServicesList) {
Expand Down
4 changes: 0 additions & 4 deletions connd/qconnectionagent.h
Expand Up @@ -106,8 +106,6 @@ public Q_SLOTS:
void setup();
void updateServices();
bool isStateOnline(const QString &state);
bool isBestService(NetworkService *service);
QString findBestConnectableService();
void removeAllTypes(const QString &type);

bool shouldSuppressError(const QString &error, bool cellular) const;
Expand All @@ -131,8 +129,6 @@ public Q_SLOTS:
bool valid;

private slots:
void onScanFinished();

void serviceErrorChanged(const QString &error);
void serviceStateChanged(const QString &state);
void networkStateChanged(const QString &state);
Expand Down

0 comments on commit 1836b01

Please sign in to comment.