Submitted By:            Armin K. <krejzi at email dot com>
Date:                    2015-06-26
Initial Package Version: 5.3.1
Upstream Status:         Fixed
Origin:                  Upstream
Description:             Fixes building against bluez-qt-5.11.0

--- a/src/applet/package/contents/ui/BluetoothApplet.qml	2015-05-21 19:04:52.000000000 +0200
+++ b/src/applet/package/contents/ui/BluetoothApplet.qml	2015-06-26 20:34:47.414264382 +0200
@@ -31,6 +31,7 @@
 
     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 @@
         focus: true
     }
 
-    BluezQt.Manager {
-        id: btManager
-
-        onInitFinished: {
-            Logic.init();
-        }
+    Component.onCompleted: {
+        Logic.init();
     }
 }
--- a/src/applet/package/contents/ui/DeviceItem.qml	2015-05-21 19:04:52.000000000 +0200
+++ b/src/applet/package/contents/ui/DeviceItem.qml	2015-06-26 20:34:47.414264382 +0200
@@ -378,10 +378,10 @@
             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 @@
     function connectToDevice()
     {
         if (Connected) {
-            Device.disconnectDevice();
+            Device.disconnectFromDevice();
             return;
         }
 
@@ -433,7 +433,7 @@
         connecting = true;
         runningActions++;
 
-        var call = Device.connectDevice();
+        var call = Device.connectToDevice();
         call.userData = Device;
 
         call.finished.connect(function(call) {
--- a/src/applet/package/contents/ui/FullRepresentation.qml	2015-05-21 19:04:52.000000000 +0200
+++ b/src/applet/package/contents/ui/FullRepresentation.qml	2015-06-26 20:34:47.414264382 +0200
@@ -28,9 +28,7 @@
 FocusScope {
     PlasmaBt.DevicesProxyModel {
         id: devicesModel
-        sourceModel: BluezQt.DevicesModel {
-            manager: btManager
-        }
+        sourceModel: BluezQt.DevicesModel { }
     }
 
     PlasmaExtras.Heading {
--- a/src/daemon/kded/devicemonitor.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/daemon/kded/devicemonitor.cpp	2015-06-26 20:34:47.414264382 +0200
@@ -147,7 +147,7 @@
     Q_FOREACH (const QString &addr, connectedDevices) {
         BluezQt::DevicePtr device = m_manager->deviceForAddress(addr);
         if (device) {
-            device->connectDevice();
+            device->connectToDevice();
         }
     }
 }
--- a/src/daemon/kded/filereceiver/obexagent.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/daemon/kded/filereceiver/obexagent.cpp	2015-06-26 20:34:47.415264397 +0200
@@ -49,11 +49,11 @@
     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();
 }
--- a/src/daemon/kded/filereceiver/obexagent.h	2015-05-21 19:04:52.000000000 +0200
+++ b/src/daemon/kded/filereceiver/obexagent.h	2015-06-26 20:34:47.415264397 +0200
@@ -40,7 +40,7 @@
     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);
--- a/src/daemon/kded/filereceiver/receivefilejob.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/daemon/kded/filereceiver/receivefilejob.cpp	2015-06-26 20:34:47.415264397 +0200
@@ -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 @@
     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;
     }
--- a/src/daemon/kded/filereceiver/receivefilejob.h	2015-05-21 19:04:52.000000000 +0200
+++ b/src/daemon/kded/filereceiver/receivefilejob.h	2015-06-26 20:34:47.415264397 +0200
@@ -34,7 +34,7 @@
     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 @@
 
     ObexAgent *m_agent;
     BluezQt::ObexTransferPtr m_transfer;
+    BluezQt::ObexSessionPtr m_session;
     BluezQt::Request<QString> m_request;
 };
 
--- a/src/kcmodule/bluedevildevices.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/kcmodule/bluedevildevices.cpp	2015-06-26 20:34:47.416264413 +0200
@@ -113,7 +113,7 @@
     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 @@
             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::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()
--- a/src/kio/obexftp/daemon/obexftpdaemon.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/kio/obexftp/daemon/obexftpdaemon.cpp	2015-06-26 20:34:47.416264413 +0200
@@ -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::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)) {
--- a/src/kio/obexftp/daemon/obexftpdaemon.h	2015-05-21 19:04:52.000000000 +0200
+++ b/src/kio/obexftp/daemon/obexftpdaemon.h	2015-06-26 20:34:47.416264413 +0200
@@ -23,6 +23,8 @@
 
 #include <KDEDModule>
 
+#include <BluezQt/Types>
+
 namespace BluezQt
 {
     class InitObexManagerJob;
@@ -52,7 +54,7 @@
     void cancelTransferFinished(QDBusPendingCallWatcher *watcher);
 
     void operationalChanged(bool operational);
-    void sessionRemoved(const QDBusObjectPath &session);
+    void sessionRemoved(BluezQt::ObexSessionPtr session);
 
 private:
     struct Private;
--- a/src/kio/obexftp/kioobexftp.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/kio/obexftp/kioobexftp.cpp	2015-06-26 20:34:47.416264413 +0200
@@ -442,24 +442,24 @@
         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 @@
         // 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:"
--- a/src/wizard/pages/connect.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/wizard/pages/connect.cpp	2015-06-26 20:34:47.416264413 +0200
@@ -54,7 +54,7 @@
 
     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);
 }
 
--- a/src/wizard/pages/discover.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/wizard/pages/discover.cpp	2015-06-26 20:34:47.417264428 +0200
@@ -215,13 +215,13 @@
         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;
     }
--- a/src/wizard/wizardagent.cpp	2015-05-21 19:04:52.000000000 +0200
+++ b/src/wizard/wizardagent.cpp	2015-06-26 20:34:47.417264428 +0200
@@ -72,8 +72,10 @@
 
     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 @@
         }
 
         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;
             }
         }
