Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes MER#1039 #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions libconnman-qt/networkservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ const QString NetworkService::Hidden("Hidden");
NetworkService::NetworkService(const QString &path, const QVariantMap &properties, QObject* parent)
: QObject(parent),
m_service(NULL),
m_path(path),
m_path(QString()),
m_propertiesCache(properties),
isConnected(false)
{
qRegisterMetaType<NetworkService *>();

Q_ASSERT(!path.isEmpty());
reconnectServiceInterface();
setPath(path);
}

NetworkService::NetworkService(QObject* parent)
Expand Down Expand Up @@ -554,7 +554,7 @@ void NetworkService::getPropertiesFinished(QDBusPendingCallWatcher *call)
if (!reply.isError())
updateProperties(reply.value());
else
qDebug() << reply.error().message();
qDebug() << reply.error().message() << "for" << m_path;
Q_EMIT propertiesReady();
}

Expand All @@ -577,24 +577,30 @@ void NetworkService::updateProperties(const QVariantMap &properties)

void NetworkService::setPath(const QString &path)
{
if (path == m_path)
if (path == m_path || path.isEmpty())
return;

bool initialPath = (m_path.isEmpty() && path != QStringLiteral("/"));
// the / path is a special case used internally for empty defaultRoute

m_path = path;
emit pathChanged(m_path);

resetProperties();
if (!initialPath)
resetProperties();

reconnectServiceInterface();

if (!m_service || !m_service->isValid())
return;

QDBusPendingReply<QVariantMap> reply = m_service->GetProperties();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
if (path != QStringLiteral("/")) {
QDBusPendingReply<QVariantMap> reply = m_service->GetProperties();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);

connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
this, SLOT(getPropertiesFinished(QDBusPendingCallWatcher*)));
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
this, SLOT(getPropertiesFinished(QDBusPendingCallWatcher*)));
}
}

bool NetworkService::connected()
Expand Down