[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/bluedevil/src/daemon/kded
From: Eduardo Robles Elvira <edulix () gmail ! com>
Date: 2010-04-12 20:25:35
Message-ID: 20100412202535.C600DAC897 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1114139 by edulix:
minor changes: using isEmpty() instead of size() < 0, and converting status from bool to anonymous enum
M +10 -11 BlueDevilDaemon.cpp
--- trunk/playground/base/bluedevil/src/daemon/kded/BlueDevilDaemon.cpp #1114138:1114139
@@ -36,7 +36,7 @@
struct BlueDevilDaemon::Private
{
- bool status;
+ enum Status {Online = 0, Offline} status;
//Do not delete this :)
Solid::Control::BluetoothManager* man;
AgentListener *agentListener;
@@ -71,7 +71,7 @@
"http://blog.edulix.es");
//Status = offline ATM
- d->status = false;
+ d->status = Private::Offline;
d->man = &Solid::Control::BluetoothManager::self();
@@ -105,13 +105,12 @@
void BlueDevilDaemon::onlineMode()
{
- if (d->status == true) {
+ kDebug();
+ if (d->status == Private::Online) {
kDebug() << "Already in onlineMode";
return;
}
- kDebug() << "Online mode";
-
d->agentListener = new AgentListener();
connect(d->agentListener,SIGNAL(agentReleased()),this,SLOT(agentReleased()));
d->agentListener->start();
@@ -122,12 +121,12 @@
}
d->service->launchServer();
- d->status = true;
+ d->status = Private::Online;
}
void BlueDevilDaemon::offlineMode()
{
- if (d->status == false) {
+ if (d->status == Private::Offline) {
kDebug() << "Already in offlineMode";
return;
}
@@ -137,7 +136,7 @@
d->agentListener->quit();
kDebug() << "You've got no bluetooth interfaces attached!";
- d->status = false;
+ d->status = Private::Offline;
if (!serviceStarted()) {
return;
@@ -168,7 +167,7 @@
void BlueDevilDaemon::adapterAdded(const QString& adapterName)
{
kDebug() << adapterName;
- if (d->man->bluetoothInterfaces().size() > 0 && !d->status) {
+ if (!d->man->bluetoothInterfaces().isEmpty() && d->status == Private::Offline) {
d->m_defaultAdapterName = adapterName;
onlineMode();
}
@@ -177,7 +176,7 @@
void BlueDevilDaemon::adapterRemoved(const QString& adapterName)
{
kDebug() << adapterName;
- if (d->man->bluetoothInterfaces().size() < 1) {
+ if (d->man->bluetoothInterfaces().isEmpty()) {
d->m_defaultAdapterName = QString();
offlineMode();
}
@@ -187,7 +186,7 @@
{
kDebug() << adapterName;
//This should do the trick :)
- if (d->m_defaultAdapterName == adapterName && d->status) {
+ if (d->m_defaultAdapterName == adapterName && d->status == Private::Online) {
kDebug() << "already online with that adapter";
return;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic