adapterpath.path(),
QDBusConnection::systemBus());
- adapter.RegisterAgent(QDBusObjectPath("/pairing/agent"),"");
+ adapter.RegisterAgent(QDBusObjectPath(path),"");
qDebug()<<"last error: "<<adapter.lastError().message();
QDBusObjectPath adapterpath = manager->DefaultAdapter();
if(adapterpath.path() == "")
+ {
+ ///we actually shouldn't ever get here.
return;
+ }
adapter = new OrgBluezAdapterInterface(
"org.bluez",
this,
SLOT(deviceCreated(QDBusObjectPath)));
+ adapterChanged(true);
+
QList<QDBusObjectPath> list = adapter->ListDevices();
foreach(QDBusObjectPath item, list)
{
beginRemoveRows(QModelIndex(), 0, m_devices.size()-1);
foreach(BluetoothDevice* device, m_devices)
{
+
delete device;
}
m_devices.clear();
endRemoveRows();
if(adapter) delete adapter;
+ adapter = NULL;
+ adapterChanged(false);
return;
}
}
{
Q_OBJECT
Q_PROPERTY(bool discoverable READ discoverable WRITE makeDiscoverable NOTIFY discoverableChanged);
-
+ Q_PROPERTY(bool adapterPresent READ adapterPresent NOTIFY adapterChanged)
public:
explicit BluetoothDevicesModel(QObject *parent = 0);
path
};
+ bool adapterPresent() { return adapter != NULL; }
+
public slots:
int columnCount(const QModelIndex &) const { return 1; }
signals:
void devicePaired(BluetoothDevice* device);
void discoverableChanged(bool discoverable);
+ void adapterChanged(bool adapterPresent);
private:
OrgBluezManagerInterface *manager;