summaryrefslogtreecommitdiff
blob: 326ff6e01ae1cffbf15ac605a0f9bbcf22d385fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
diff --git a/src/applet/package/contents/ui/BluetoothApplet.qml b/src/applet/package/contents/ui/BluetoothApplet.qml
index 834d034..d685cb2 100644
--- a/src/applet/package/contents/ui/BluetoothApplet.qml
+++ b/src/applet/package/contents/ui/BluetoothApplet.qml
@@ -31,6 +31,7 @@ Item {
 
     property bool deviceConnected : false
     property int runningActions : 0
+    property QtObject btManager : BluezQt.Manager
 
     Plasmoid.toolTipMainText: i18n("Bluetooth")
     Plasmoid.icon: Logic.icon()
@@ -44,11 +45,7 @@ Item {
         focus: true
     }
 
-    BluezQt.Manager {
-        id: btManager
-
-        onInitFinished: {
-            Logic.init();
-        }
+    Component.onCompleted: {
+        Logic.init();
     }
 }
diff --git a/src/applet/package/contents/ui/DeviceItem.qml b/src/applet/package/contents/ui/DeviceItem.qml
index 19b55cf..b0fc9ce 100644
--- a/src/applet/package/contents/ui/DeviceItem.qml
+++ b/src/applet/package/contents/ui/DeviceItem.qml
@@ -378,10 +378,10 @@ PlasmaComponents.ListItem {
             return i18n("Connecting");
         }
 
-        switch (DeviceType) {
+        switch (Type) {
         case BluezQt.Device.Headset:
         case BluezQt.Device.Headphones:
-        case BluezQt.Device.OtherAudio:
+        case BluezQt.Device.AudioVideo:
             return i18n("Audio device");
 
         case BluezQt.Device.Keyboard:
@@ -422,7 +422,7 @@ PlasmaComponents.ListItem {
     function connectToDevice()
     {
         if (Connected) {
-            Device.disconnectDevice();
+            Device.disconnectFromDevice();
             return;
         }
 
@@ -433,7 +433,7 @@ PlasmaComponents.ListItem {
         connecting = true;
         runningActions++;
 
-        var call = Device.connectDevice();
+        var call = Device.connectToDevice();
         call.userData = Device;
 
         call.finished.connect(function(call) {
diff --git a/src/applet/package/contents/ui/FullRepresentation.qml b/src/applet/package/contents/ui/FullRepresentation.qml
index 849ae4e..94df8b4 100644
--- a/src/applet/package/contents/ui/FullRepresentation.qml
+++ b/src/applet/package/contents/ui/FullRepresentation.qml
@@ -28,9 +28,7 @@ import org.kde.plasma.private.bluetooth 1.0 as PlasmaBt
 FocusScope {
     PlasmaBt.DevicesProxyModel {
         id: devicesModel
-        sourceModel: BluezQt.DevicesModel {
-            manager: btManager
-        }
+        sourceModel: BluezQt.DevicesModel { }
     }
 
     PlasmaExtras.Heading {
diff --git a/src/daemon/kded/devicemonitor.cpp b/src/daemon/kded/devicemonitor.cpp
index 29ac2f3..22c8020 100644
--- a/src/daemon/kded/devicemonitor.cpp
+++ b/src/daemon/kded/devicemonitor.cpp
@@ -147,7 +147,7 @@ void DeviceMonitor::restoreState()
     Q_FOREACH (const QString &addr, connectedDevices) {
         BluezQt::DevicePtr device = m_manager->deviceForAddress(addr);
         if (device) {
-            device->connectDevice();
+            device->connectToDevice();
         }
     }
 }
diff --git a/src/daemon/kded/filereceiver/obexagent.cpp b/src/daemon/kded/filereceiver/obexagent.cpp
index 9cd98ff..6ffd620 100644
--- a/src/daemon/kded/filereceiver/obexagent.cpp
+++ b/src/daemon/kded/filereceiver/obexagent.cpp
@@ -49,11 +49,11 @@ QDBusObjectPath ObexAgent::objectPath() const
     return QDBusObjectPath(QStringLiteral("/BlueDevilObexAgent"));
 }
 
-void ObexAgent::authorizePush(BluezQt::ObexTransferPtr transfer, const BluezQt::Request<QString> &request)
+void ObexAgent::authorizePush(BluezQt::ObexTransferPtr transfer, BluezQt::ObexSessionPtr session, const BluezQt::Request<QString> &request)
 {
     qCDebug(BLUEDAEMON) << "Agent-AuthorizePush";
 
-    ReceiveFileJob *job = new ReceiveFileJob(request, transfer, this);
+    ReceiveFileJob *job = new ReceiveFileJob(request, transfer, session, this);
     connect(job, &ReceiveFileJob::finished, this, &ObexAgent::receiveFileJobFinished);
     job->start();
 }
diff --git a/src/daemon/kded/filereceiver/obexagent.h b/src/daemon/kded/filereceiver/obexagent.h
index 0f5adc5..e32f1fe 100644
--- a/src/daemon/kded/filereceiver/obexagent.h
+++ b/src/daemon/kded/filereceiver/obexagent.h
@@ -40,7 +40,7 @@ public:
     bool shouldAutoAcceptTransfer(const QString &address) const;
 
     QDBusObjectPath objectPath() const Q_DECL_OVERRIDE;
-    void authorizePush(BluezQt::ObexTransferPtr transfer, const BluezQt::Request<QString> &request) Q_DECL_OVERRIDE;
+    void authorizePush(BluezQt::ObexTransferPtr transfer, BluezQt::ObexSessionPtr session, const BluezQt::Request<QString> &request) Q_DECL_OVERRIDE;
 
 private Q_SLOTS:
     void receiveFileJobFinished(KJob *job);
diff --git a/src/daemon/kded/filereceiver/receivefilejob.cpp b/src/daemon/kded/filereceiver/receivefilejob.cpp
index 1569163..fbb04b5 100644
--- a/src/daemon/kded/filereceiver/receivefilejob.cpp
+++ b/src/daemon/kded/filereceiver/receivefilejob.cpp
@@ -36,11 +36,12 @@
 #include <BluezQt/Device>
 #include <BluezQt/ObexSession>
 
-ReceiveFileJob::ReceiveFileJob(const BluezQt::Request<QString> &req, BluezQt::ObexTransferPtr transfer, ObexAgent *parent)
+ReceiveFileJob::ReceiveFileJob(const BluezQt::Request<QString> &req, BluezQt::ObexTransferPtr transfer, BluezQt::ObexSessionPtr session, ObexAgent *parent)
     : KJob(parent)
     , m_speedBytes(0)
     , m_agent(parent)
     , m_transfer(transfer)
+    , m_session(session)
     , m_request(req)
 {
     setCapabilities(Killable);
@@ -74,24 +75,24 @@ void ReceiveFileJob::init()
     qCDebug(BLUEDAEMON) << "\tTransferred:" << m_transfer->transferred();
 
     qCDebug(BLUEDAEMON) << "ObexSession:";
-    qCDebug(BLUEDAEMON) << "\tSource:" << m_transfer->session()->source();
-    qCDebug(BLUEDAEMON) << "\tDestination:" << m_transfer->session()->destination();
+    qCDebug(BLUEDAEMON) << "\tSource:" << m_session->source();
+    qCDebug(BLUEDAEMON) << "\tDestination:" << m_session->destination();
 
     connect(m_transfer.data(), &BluezQt::ObexTransfer::statusChanged, this, &ReceiveFileJob::statusChanged);
     connect(m_transfer.data(), &BluezQt::ObexTransfer::transferredChanged, this, &ReceiveFileJob::transferredChanged);
 
-    m_deviceName = m_transfer->session()->destination();
+    m_deviceName = m_session->destination();
 
-    BluezQt::AdapterPtr adapter = m_agent->manager()->adapterForAddress(m_transfer->session()->source());
+    BluezQt::AdapterPtr adapter = m_agent->manager()->adapterForAddress(m_session->source());
     if (!adapter) {
-        qCDebug(BLUEDAEMON) << "No adapter for" << m_transfer->session()->source();
+        qCDebug(BLUEDAEMON) << "No adapter for" << m_session->source();
         showNotification();
         return;
     }
 
-    BluezQt::DevicePtr device = adapter->deviceForAddress(m_transfer->session()->destination());
+    BluezQt::DevicePtr device = adapter->deviceForAddress(m_session->destination());
     if (!device) {
-        qCDebug(BLUEDAEMON) << "No device for" << m_transfer->session()->destination();
+        qCDebug(BLUEDAEMON) << "No device for" << m_session->destination();
         showNotification();
         return;
     }
diff --git a/src/daemon/kded/filereceiver/receivefilejob.h b/src/daemon/kded/filereceiver/receivefilejob.h
index 461d453..801bb45 100644
--- a/src/daemon/kded/filereceiver/receivefilejob.h
+++ b/src/daemon/kded/filereceiver/receivefilejob.h
@@ -34,7 +34,7 @@ class ReceiveFileJob : public KJob
     Q_OBJECT
 
 public:
-    explicit ReceiveFileJob(const BluezQt::Request<QString> &req, BluezQt::ObexTransferPtr transfer, ObexAgent *parent);
+    explicit ReceiveFileJob(const BluezQt::Request<QString> &req, BluezQt::ObexTransferPtr transfer, BluezQt::ObexSessionPtr session, ObexAgent *parent);
 
     QString deviceAddress() const;
 
@@ -63,6 +63,7 @@ private:
 
     ObexAgent *m_agent;
     BluezQt::ObexTransferPtr m_transfer;
+    BluezQt::ObexSessionPtr m_session;
     BluezQt::Request<QString> m_request;
 };
 
diff --git a/src/kcmodule/bluedevildevices.cpp b/src/kcmodule/bluedevildevices.cpp
index b1b6b0e..deafecc 100644
--- a/src/kcmodule/bluedevildevices.cpp
+++ b/src/kcmodule/bluedevildevices.cpp
@@ -113,7 +113,7 @@ void BluetoothDevicesDelegate::paint(QPainter *painter, const QStyleOptionViewIt
     painter->setFont(f);
     painter->drawText(r, Qt::AlignLeft | Qt::AlignTop, index.data(BluezQt::DevicesModel::FriendlyNameRole).toString());
     painter->restore();
-    painter->drawText(r, Qt::AlignLeft | Qt::AlignBottom, deviceTypeString(index.data(BluezQt::DevicesModel::DeviceTypeRole).toInt()));
+    painter->drawText(r, Qt::AlignLeft | Qt::AlignBottom, deviceTypeString(index.data(BluezQt::DevicesModel::TypeRole).toInt()));
 
     // Draw state
     r = option.rect;
@@ -166,7 +166,7 @@ QString BluetoothDevicesDelegate::deviceTypeString(int type) const
             return i18nc("This device is a Headset", "Headset");
         case BluezQt::Device::Headphones:
             return i18nc("This device are Headphones", "Headphones");
-        case BluezQt::Device::OtherAudio:
+        case BluezQt::Device::AudioVideo:
             return i18nc("This device is of type Audio", "Audio");
         case BluezQt::Device::Keyboard:
             return i18nc("This device is a Keyboard", "Keyboard");
@@ -349,14 +349,14 @@ void KCMBlueDevilDevices::removeDevice()
 void KCMBlueDevilDevices::connectDevice()
 {
     BluezQt::DevicePtr device = m_devicesModel->device(m_devices->currentIndex());
-    device->connectDevice();
+    device->connectToDevice();
 }
 
 void KCMBlueDevilDevices::disconnectDevice()
 {
     m_disconnectDevice->setEnabled(false);
     BluezQt::DevicePtr device = m_devicesModel->device(m_devices->currentIndex());
-    device->disconnectDevice();
+    device->disconnectFromDevice();
 }
 
 void KCMBlueDevilDevices::launchWizard()
diff --git a/src/kio/obexftp/daemon/obexftpdaemon.cpp b/src/kio/obexftp/daemon/obexftpdaemon.cpp
index a2cdac4..45a1f75 100644
--- a/src/kio/obexftp/daemon/obexftpdaemon.cpp
+++ b/src/kio/obexftp/daemon/obexftpdaemon.cpp
@@ -34,6 +34,7 @@
 #include <BluezQt/InitObexManagerJob>
 #include <BluezQt/ObexFileTransfer>
 #include <BluezQt/PendingCall>
+#include <BluezQt/ObexSession>
 
 K_PLUGIN_FACTORY_WITH_JSON(ObexFtpFactory,
                            "obexftpdaemon.json",
@@ -208,9 +209,9 @@ void ObexFtpDaemon::operationalChanged(bool operational)
     }
 }
 
-void ObexFtpDaemon::sessionRemoved(const QDBusObjectPath &session)
+void ObexFtpDaemon::sessionRemoved(BluezQt::ObexSessionPtr session)
 {
-    const QString &path = session.path();
+    const QString &path = session->objectPath().path();
     const QString &key = d->m_sessionMap.key(path);
 
     if (!d->m_sessionMap.contains(key)) {
diff --git a/src/kio/obexftp/daemon/obexftpdaemon.h b/src/kio/obexftp/daemon/obexftpdaemon.h
index c42d720..a902333 100644
--- a/src/kio/obexftp/daemon/obexftpdaemon.h
+++ b/src/kio/obexftp/daemon/obexftpdaemon.h
@@ -23,6 +23,8 @@
 
 #include <KDEDModule>
 
+#include <BluezQt/Types>
+
 namespace BluezQt
 {
     class InitObexManagerJob;
@@ -52,7 +54,7 @@ private Q_SLOTS:
     void cancelTransferFinished(QDBusPendingCallWatcher *watcher);
 
     void operationalChanged(bool operational);
-    void sessionRemoved(const QDBusObjectPath &session);
+    void sessionRemoved(BluezQt::ObexSessionPtr session);
 
 private:
     struct Private;
diff --git a/src/kio/obexftp/kioobexftp.cpp b/src/kio/obexftp/kioobexftp.cpp
index cb8d3b1..47910b4 100644
--- a/src/kio/obexftp/kioobexftp.cpp
+++ b/src/kio/obexftp/kioobexftp.cpp
@@ -442,24 +442,24 @@ QList<KIO::UDSEntry> KioFtp::listFolder(const QUrl &url, bool *ok)
         return list;
     }
 
-    const QList<BluezQt::ObexFileTransfer::Item> &items = call->value().value<QList<BluezQt::ObexFileTransfer::Item> >();
+    const QList<BluezQt::ObexFileTransferEntry> &items = call->value().value<QList<BluezQt::ObexFileTransferEntry> >();
 
-    Q_FOREACH (const BluezQt::ObexFileTransfer::Item &item, items) {
+    Q_FOREACH (const BluezQt::ObexFileTransferEntry &item, items) {
         KIO::UDSEntry entry;
-        entry.insert(KIO::UDSEntry::UDS_NAME, item.name);
-        entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, item.label);
+        entry.insert(KIO::UDSEntry::UDS_NAME, item.name());
+        entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, item.label());
         entry.insert(KIO::UDSEntry::UDS_ACCESS, 0700);
-        entry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, item.modified.toTime_t());
-        entry.insert(KIO::UDSEntry::UDS_SIZE, item.size);
+        entry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, item.modificationTime().toTime_t());
+        entry.insert(KIO::UDSEntry::UDS_SIZE, item.size());
 
-        if (item.type == BluezQt::ObexFileTransfer::Item::Folder) {
+        if (item.type() == BluezQt::ObexFileTransferEntry::Folder) {
             entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
         } else {
             entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
         }
 
         if (urlIsRoot(url)) {
-            updateRootEntryIcon(entry, item.memoryType);
+            updateRootEntryIcon(entry, item.memoryType());
         }
 
         list.append(entry);
@@ -467,7 +467,7 @@ QList<KIO::UDSEntry> KioFtp::listFolder(const QUrl &url, bool *ok)
         // Most probably the client of the kio will stat each file
         // so since we are on it, let's cache all of them.
         QUrl statUrl = url;
-        statUrl.setPath(statUrl.path() + QLatin1Char('/') + item.name);
+        statUrl.setPath(statUrl.path() + QLatin1Char('/') + item.name());
 
         if (!m_statMap.contains(statUrl.toDisplayString())) {
             qCDebug(OBEXFTP) << "Stat:"
diff --git a/src/wizard/pages/connect.cpp b/src/wizard/pages/connect.cpp
index 1880c08..082cb10 100644
--- a/src/wizard/pages/connect.cpp
+++ b/src/wizard/pages/connect.cpp
@@ -54,7 +54,7 @@ void ConnectPage::initializePage()
 
     m_wizard->device()->setTrusted(true);
 
-    BluezQt::PendingCall *call = m_wizard->device()->connectDevice();
+    BluezQt::PendingCall *call = m_wizard->device()->connectToDevice();
     connect(call, &BluezQt::PendingCall::finished, this, &ConnectPage::connectFinished);
 }
 
diff --git a/src/wizard/pages/discover.cpp b/src/wizard/pages/discover.cpp
index 9810f7c..862cf8a 100644
--- a/src/wizard/pages/discover.cpp
+++ b/src/wizard/pages/discover.cpp
@@ -215,13 +215,13 @@ int DiscoverPage::nextId() const
         pin = m_wizard->agent()->getPin(device);
     }
 
-    qCDebug(WIZARD) << "Class: " << device->deviceType();
+    qCDebug(WIZARD) << "Class: " << device->type();
     qCDebug(WIZARD) << "Legacy: " << device->hasLegacyPairing();
     qCDebug(WIZARD) << "From DB: " << m_wizard->agent()->isFromDatabase();
     qCDebug(WIZARD) << "PIN: " << m_wizard->agent()->pin();
 
     // If keyboard no matter what, we go to the keyboard page
-    if (device->deviceType() == BluezQt::Device::Keyboard) {
+    if (device->type() == BluezQt::Device::Keyboard) {
         qCDebug(WIZARD) << "Keyboard Pairing";
         return BlueWizard::KeyboardPairing;
     }
diff --git a/src/wizard/wizardagent.cpp b/src/wizard/wizardagent.cpp
index a0b4b04..a263e28 100644
--- a/src/wizard/wizardagent.cpp
+++ b/src/wizard/wizardagent.cpp
@@ -72,8 +72,10 @@ QString WizardAgent::getPin(BluezQt::DevicePtr device)
 
     QXmlStreamReader xml(&file);
 
-    int deviceType = device->deviceType();
-    int xmlType = 0;
+    QString deviceType = BluezQt::Device::typeToString(device->type());
+    if (deviceType == QLatin1String("audiovideo")) {
+        deviceType = QStringLiteral("audio");
+    }
 
     while (!xml.atEnd()) {
         xml.readNext();
@@ -87,9 +89,7 @@ QString WizardAgent::getPin(BluezQt::DevicePtr device)
         }
 
         if (attr.hasAttribute(QLatin1String("type")) && attr.value(QLatin1String("type")) != QLatin1String("any")) {
-            xmlType = BluezQt::Device::stringToType(attr.value(QLatin1String("type")).toString());
-            if (deviceType != xmlType) {
-                xmlType = 0;
+            if (deviceType != attr.value(QLatin1String("type")).toString()) {
                 continue;
             }
         }