Skip to content

Instantly share code, notes, and snippets.

@nowrep
Created December 14, 2014 22:11
Show Gist options
  • Save nowrep/1156c6fd5595ceac1f2d to your computer and use it in GitHub Desktop.
Save nowrep/1156c6fd5595ceac1f2d to your computer and use it in GitHub Desktop.
diff --git a/src/daemon/kded/BlueDevilDaemon.cpp b/src/daemon/kded/BlueDevilDaemon.cpp
index 7b1e6e4..59e0b1d 100644
--- a/src/daemon/kded/BlueDevilDaemon.cpp
+++ b/src/daemon/kded/BlueDevilDaemon.cpp
@@ -110,6 +110,8 @@ BlueDevilDaemon::BlueDevilDaemon(QObject *parent, const QList<QVariant>&)
this, SLOT(usableAdapterChanged(Adapter*)));
connect(Manager::self(), SIGNAL(adapterAdded(Adapter*)),
this, SLOT(adapterAdded(Adapter*)));
+ connect(Manager::self(), SIGNAL(adapterRemoved(Adapter*)),
+ this, SLOT(adapterRemoved(Adapter*)));
// Catch suspend/resume events
QDBusConnection::systemBus().connect("org.freedesktop.login1",
@@ -309,9 +311,6 @@ void BlueDevilDaemon::offlineMode()
d->m_placesModel->removePlace(index);
}
- if (BlueDevil::Manager::self()->adapters().isEmpty()) {
- killMonolithic();
- }
d->m_status = Private::Offline;
}
@@ -344,6 +343,15 @@ void BlueDevilDaemon::adapterAdded(Adapter *adapter)
restoreAdapterState(adapter);
}
+void BlueDevilDaemon::adapterRemoved(Adapter *adapter)
+{
+ Q_UNUSED(adapter)
+
+ if (BlueDevil::Manager::self()->adapters().isEmpty()) {
+ killMonolithic();
+ }
+}
+
void BlueDevilDaemon::deviceFound(Device *device)
{
kDebug(dblue()) << "DeviceFound: " << device->name();
diff --git a/src/daemon/kded/BlueDevilDaemon.h b/src/daemon/kded/BlueDevilDaemon.h
index e0f7d43..4d0c6c1 100644
--- a/src/daemon/kded/BlueDevilDaemon.h
+++ b/src/daemon/kded/BlueDevilDaemon.h
@@ -83,6 +83,7 @@ private Q_SLOTS:
void usableAdapterChanged(Adapter *adapter);
void adapterAdded(Adapter *adapter);
+ void adapterRemoved(Adapter *adapter);
/**
* When the agent is released this is called to unload it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment