[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [bluedevil] src/wizard: wizard: Merge all pairing pages to single page
From:       David Rosca <nowrep () gmail ! com>
Date:       2015-04-30 20:59:26
Message-ID: E1YnvYM-0005Pt-Dz () scm ! kde ! org
[Download RAW message or body]

Git commit 63d1c901ab9047c0c637cbfbc3ad352727b2d9e5 by David Rosca.
Committed on 30/04/2015 at 18:02.
Pushed by drosca into branch 'master'.

wizard: Merge all pairing pages to single page

It is not needed to have special pages for each device type
when the only thing that really changes is the info text
that is displayed to user.

Also fix incorrect PIN handling when restarting wizard.

M  +2    -7    src/wizard/CMakeLists.txt
M  +2    -22   src/wizard/bluewizard.cpp
M  +1    -8    src/wizard/bluewizard.h
M  +2    -2    src/wizard/main.cpp
M  +17   -32   src/wizard/pages/discover.cpp
M  +1    -11   src/wizard/pages/discover.ui
M  +1    -1    src/wizard/pages/fail.cpp
D  +0    -105  src/wizard/pages/keyboardpairing.cpp
D  +0    -62   src/wizard/pages/keyboardpairing.h
D  +0    -147  src/wizard/pages/keyboardpairing.ui
D  +0    -105  src/wizard/pages/legacypairing.cpp
D  +0    -61   src/wizard/pages/legacypairing.h
D  +0    -147  src/wizard/pages/legacypairing.ui
D  +0    -88   src/wizard/pages/legacypairingdatabase.cpp
D  +0    -59   src/wizard/pages/legacypairingdatabase.h
R  +60   -59   src/wizard/pages/pairing.cpp [from: src/wizard/pages/ssppairing.cpp - \
058% similarity] R  +10   -17   src/wizard/pages/pairing.h [from: \
src/wizard/pages/ssppairing.h - 080% similarity] R  +23   -10   \
src/wizard/pages/pairing.ui [from: src/wizard/pages/ssppairing.ui - 085% similarity] \
M  +2    -9    src/wizard/wizardagent.cpp M  +0    -2    src/wizard/wizardagent.h

http://commits.kde.org/bluedevil/63d1c901ab9047c0c637cbfbc3ad352727b2d9e5

diff --git a/src/wizard/CMakeLists.txt b/src/wizard/CMakeLists.txt
index d52cde1..50e47aa 100644
--- a/src/wizard/CMakeLists.txt
+++ b/src/wizard/CMakeLists.txt
@@ -6,10 +6,7 @@ set(wizard_SRCS
 
     pages/discover.cpp
     pages/connect.cpp
-    pages/legacypairing.cpp
-    pages/legacypairingdatabase.cpp
-    pages/keyboardpairing.cpp
-    pages/ssppairing.cpp
+    pages/pairing.cpp
     pages/fail.cpp
     pages/success.cpp
 )
@@ -17,9 +14,7 @@ set(wizard_SRCS
 ki18n_wrap_ui(wizard_SRCS
             pages/discover.ui
             pages/connect.ui
-            pages/legacypairing.ui
-            pages/keyboardpairing.ui
-            pages/ssppairing.ui
+            pages/pairing.ui
             pages/fail.ui
             pages/success.ui
 )
diff --git a/src/wizard/bluewizard.cpp b/src/wizard/bluewizard.cpp
index 8d53d16..058a6e7 100644
--- a/src/wizard/bluewizard.cpp
+++ b/src/wizard/bluewizard.cpp
@@ -19,10 +19,7 @@
 #include "wizardagent.h"
 #include "pages/discover.h"
 #include "pages/connect.h"
-#include "pages/legacypairing.h"
-#include "pages/legacypairingdatabase.h"
-#include "pages/keyboardpairing.h"
-#include "pages/ssppairing.h"
+#include "pages/pairing.h"
 #include "pages/success.h"
 #include "pages/fail.h"
 #include "debug_p.h"
@@ -42,16 +39,11 @@ BlueWizard::BlueWizard()
     : QWizard()
     , m_agent(new WizardAgent(this))
 {
-    setWindowTitle(i18n("Bluetooth Device Wizard"));
-
     setOption(QWizard::IndependentPages, true);
 
     setPage(Discover, new DiscoverPage(this));
     setPage(Connect, new ConnectPage(this));
-    setPage(LegacyPairing, new LegacyPairingPage(this));
-    setPage(LegacyPairingDatabase, new LegacyPairingPageDatabase(this));
-    setPage(KeyboardPairing, new KeyboardPairingPage(this));
-    setPage(SSPPairing, new SSPPairingPage(this));
+    setPage(Pairing, new PairingPage(this));
     setPage(Success, new SuccessPage(this));
     setPage(Fail, new FailPage(this));
 
@@ -93,18 +85,6 @@ void BlueWizard::setDevice(BluezQt::DevicePtr device)
     m_device = device;
 }
 
-void BlueWizard::setPin(const QString &pin)
-{
-    qCDebug(WIZARD) << "Setting pin:" << pin;
-
-    m_pin = pin;
-}
-
-QString BlueWizard::pin() const
-{
-    return m_pin;
-}
-
 WizardAgent *BlueWizard::agent() const
 {
     return m_agent;
diff --git a/src/wizard/bluewizard.h b/src/wizard/bluewizard.h
index c54a1d5..7143262 100644
--- a/src/wizard/bluewizard.h
+++ b/src/wizard/bluewizard.h
@@ -35,18 +35,12 @@ public:
     BluezQt::DevicePtr device() const;
     void setDevice(BluezQt::DevicePtr device);
 
-    QString pin() const;
-    void setPin(const QString &pin);
-
     WizardAgent *agent() const;
     BluezQt::Manager *manager() const;
 
     enum {
         Discover,
-        LegacyPairing,
-        LegacyPairingDatabase,
-        KeyboardPairing,
-        SSPPairing,
+        Pairing,
         Success,
         Fail,
         Connect
@@ -63,7 +57,6 @@ private:
     WizardAgent *m_agent;
 
     BluezQt::DevicePtr m_device;
-    QString m_pin;
 };
 
 #endif // BLUEWIZARD_H
diff --git a/src/wizard/main.cpp b/src/wizard/main.cpp
index 44345ac..857ace1 100644
--- a/src/wizard/main.cpp
+++ b/src/wizard/main.cpp
@@ -33,9 +33,9 @@
 int main(int argc, char *argv[])
 {
     KAboutData aboutData(QStringLiteral("bluedevilwizard"),
-                         i18n("Bluetooth Wizard"),
+                         i18n("Bluetooth Device Wizard"),
                          BLUEDEVIL_VERSION,
-                         i18n("Bluetooth Wizard"),
+                         i18n("Bluetooth Device Wizard"),
                          KAboutLicense::GPL,
                          i18n("(c) 2010, UFO Coders"));
 
diff --git a/src/wizard/pages/discover.cpp b/src/wizard/pages/discover.cpp
index b53b0e5..c9f90b1 100644
--- a/src/wizard/pages/discover.cpp
+++ b/src/wizard/pages/discover.cpp
@@ -142,7 +142,6 @@ void DiscoverPage::initializePage()
 
     connect(manualPin, &QCheckBox::toggled, pinText, &QLineEdit::setEnabled);
     connect(manualPin, &QCheckBox::toggled, this, &DiscoverPage::completeChanged);
-    connect(pinText, &QLineEdit::textChanged, m_wizard, &BlueWizard::setPin);
     connect(pinText, &QLineEdit::textChanged, this, &DiscoverPage::completeChanged);
 
     m_manager = m_wizard->manager();
@@ -157,8 +156,9 @@ void DiscoverPage::initializePage()
         m_model->setDevicesModel(new BluezQt::DevicesModel(m_manager, this));
     }
 
-    // Reset selected device
     deviceView->setCurrentIndex(QModelIndex());
+    manualPin->setChecked(false);
+    pinText->clear();
 
     checkAdapters();
     connect(m_manager, &BluezQt::Manager::adapterAdded, this, \
&DiscoverPage::checkAdapters); @@ -169,7 +169,7 @@ void \
DiscoverPage::initializePage()  
 bool DiscoverPage::isComplete() const
 {
-    if (!m_wizard->device()) {
+    if (!m_wizard->device() || m_wizard->device()->isPaired()) {
         return false;
     }
 
@@ -196,56 +196,41 @@ int DiscoverPage::nextId() const
 
     BluezQt::DevicePtr device = m_wizard->device();
 
+    if (device->isPaired()) {
+        return BlueWizard::Discover;
+    }
+
     if (m_adapter && m_adapter->isDiscovering()) {
         qCDebug(WIZARD) << "Stopping scanning";
         m_adapter->stopDiscovery();
     }
 
-    if (device->isPaired()) {
-        qCDebug(WIZARD) << "Device is paired, skipping to connect";
-        return BlueWizard::Connect;
-    }
+    QString pin = m_wizard->agent()->getPin(device);
 
-    QString pin;
     if (manualPin->isChecked()) {
-        pin = m_wizard->pin();
+        pin = pinText->text();
         m_wizard->agent()->setPin(pin);
-    } else {
-        pin = m_wizard->agent()->getPin(device);
     }
 
-    qCDebug(WIZARD) << "Class: " << device->deviceType();
+    qCDebug(WIZARD) << "Device type: " << \
BluezQt::Device::typeToString(device->deviceType());  qCDebug(WIZARD) << "Legacy: " \
                << device->hasLegacyPairing();
     qCDebug(WIZARD) << "From DB: " << m_wizard->agent()->isFromDatabase();
-    qCDebug(WIZARD) << "PIN: " << m_wizard->agent()->pin();
+    qCDebug(WIZARD) << "PIN: " << pin;
 
-    // If keyboard no matter what, we go to the keyboard page
-    if (device->deviceType() == BluezQt::Device::Keyboard) {
-        qCDebug(WIZARD) << "Keyboard Pairing";
-        return BlueWizard::KeyboardPairing;
-    }
-
-    // No legacy pairing and no database pin means secure pairing
-    if (!device->hasLegacyPairing() && !m_wizard->agent()->isFromDatabase()) {
-        qCDebug(WIZARD) << "Secure Pairing";
-        return BlueWizard::SSPPairing;
-    }
-
-    // NULL pin means that no pairing is required
+    // NULL pin means that we should only connect to device
     if (pin == QLatin1String("NULL")) {
-        qCDebug(WIZARD) << "No Pairing";
         return BlueWizard::Connect;
     }
 
-    if (m_wizard->agent()->isFromDatabase()) {
-        return BlueWizard::LegacyPairingDatabase;
-    } else {
-        return BlueWizard::LegacyPairing;
-    }
+    return BlueWizard::Pairing;
 }
 
 void DiscoverPage::indexSelected(const QModelIndex &index)
 {
+    if (m_wizard->currentId() != BlueWizard::Discover) {
+        return;
+    }
+
     BluezQt::DevicePtr device = m_model->device(index);
     m_wizard->setDevice(device);
 
diff --git a/src/wizard/pages/discover.ui b/src/wizard/pages/discover.ui
index 5faa988..4683632 100644
--- a/src/wizard/pages/discover.ui
+++ b/src/wizard/pages/discover.ui
@@ -81,19 +81,9 @@
         </spacer>
        </item>
        <item>
-        <widget class="QLabel" name="label_2">
-         <property name="text">
-          <string>Manual PIN:</string>
-         </property>
-         <property name="buddy">
-          <cstring>manualPin</cstring>
-         </property>
-        </widget>
-       </item>
-       <item>
         <widget class="QCheckBox" name="manualPin">
          <property name="text">
-          <string/>
+          <string>Manual PIN:</string>
          </property>
          <property name="checked">
           <bool>false</bool>
diff --git a/src/wizard/pages/fail.cpp b/src/wizard/pages/fail.cpp
index 63faf8e..61c3119 100644
--- a/src/wizard/pages/fail.cpp
+++ b/src/wizard/pages/fail.cpp
@@ -63,7 +63,7 @@ void FailPage::initializePage()
     BluezQt::DevicePtr device = m_wizard->device();
 
     if (device->name().isEmpty()) {
-        failLbl->setText(i18nc("This string is shown when the wizard fail","The \
setup of the device has failed")); +        failLbl->setText(i18nc("This string is \
shown when the wizard fail", "The setup of the device has failed"));  } else {
         failLbl->setText(i18n("The setup of %1 has failed", device->name()));
     }
diff --git a/src/wizard/pages/keyboardpairing.cpp \
b/src/wizard/pages/keyboardpairing.cpp deleted file mode 100644
index 8d5558a..0000000
--- a/src/wizard/pages/keyboardpairing.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************
- * This file is part of the KDE project                                      *
- *                                                                           *
- * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org>          *
- * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com>                   *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License as published by the Free Software Foundation; either              *
- * version 2 of the License, or (at your option) any later version.          *
- *                                                                           *
- * This library is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "keyboardpairing.h"
-#include "wizardagent.h"
-#include "../bluewizard.h"
-#include "debug_p.h"
-
-#include <KIconLoader>
-#include <KPixmapSequence>
-#include <KPixmapSequenceOverlayPainter>
-
-#include <BluezQt/Device>
-#include <BluezQt/Adapter>
-#include <BluezQt/PendingCall>
-
-KeyboardPairingPage::KeyboardPairingPage(BlueWizard *parent)
-    : QWizardPage(parent)
-    , m_wizard(parent)
-    , m_success(false)
-{
-    setupUi(this);
-
-    m_working = new KPixmapSequenceOverlayPainter(this);
-    m_working->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), \
                22));
-    m_working->setWidget(pinNumber);
-    m_working->start();
-
-    QFont font(pinNumber->font());
-    font.setPointSize(42);
-    font.setBold(true);
-    pinNumber->setFont(font);
-}
-
-int KeyboardPairingPage::nextId() const
-{
-    if (m_success) {
-        return BlueWizard::Connect;
-    }
-    return BlueWizard::Fail;
-}
-
-void KeyboardPairingPage::initializePage()
-{
-    qCDebug(WIZARD) << "Initialize Keyboard Pairing Page";
-
-    m_wizard->setButtonLayout(wizardButtonsLayout());
-
-    connect(m_wizard->agent(), &WizardAgent::pinRequested, this, \
                &KeyboardPairingPage::pinRequested);
-
-    // Adapter must be pairable, otherwise pairing would fail
-    BluezQt::PendingCall *call = m_wizard->device()->adapter()->setPairable(true);
-    connect(call, &BluezQt::PendingCall::finished, this, \
                &KeyboardPairingPage::setPairableFinished);
-}
-
-void KeyboardPairingPage::setPairableFinished(BluezQt::PendingCall *call)
-{
-    Q_UNUSED(call)
-
-    BluezQt::PendingCall *pairCall = m_wizard->device()->pair();
-    connect(pairCall, &BluezQt::PendingCall::finished, this, \
                &KeyboardPairingPage::pairingFinished);
-}
-
-void KeyboardPairingPage::pairingFinished(BluezQt::PendingCall *call)
-{
-    qCDebug(WIZARD) << "Keyboard Pairing finished:";
-    qCDebug(WIZARD) << "\t error     : " << (bool) call->error();
-    qCDebug(WIZARD) << "\t errorText : " << call->errorText();
-
-    m_success = !call->error();
-    wizard()->next();
-}
-
-void KeyboardPairingPage::pinRequested(const QString& pin)
-{
-    m_working->stop();
-    pinNumber->setText(pin);
-}
-
-QList<QWizard::WizardButton> KeyboardPairingPage::wizardButtonsLayout() const
-{
-    QList <QWizard::WizardButton> list;
-    list << QWizard::Stretch;
-    list << QWizard::CancelButton;
-    return list;
-}
diff --git a/src/wizard/pages/keyboardpairing.h b/src/wizard/pages/keyboardpairing.h
deleted file mode 100644
index 03ead07..0000000
--- a/src/wizard/pages/keyboardpairing.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
- * This file is part of the KDE project                                      *
- *                                                                           *
- * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org>          *
- * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com>                   *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License as published by the Free Software Foundation; either              *
- * version 2 of the License, or (at your option) any later version.          *
- *                                                                           *
- * This library is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef KEYBOARDPAIRING_H
-#define KEYBOARDPAIRING_H
-
-#include "ui_keyboardpairing.h"
-
-#include <QWizardPage>
-
-namespace BluezQt
-{
-    class PendingCall;
-}
-
-class BlueWizard;
-class KPixmapSequenceOverlayPainter;
-
-class KeyboardPairingPage : public QWizardPage, Ui::KeyboardPairing
-{
-    Q_OBJECT
-
-public:
-    explicit KeyboardPairingPage(BlueWizard *parent = 0);
-
-    int nextId() const Q_DECL_OVERRIDE;
-    void initializePage() Q_DECL_OVERRIDE;
-
-private Q_SLOTS:
-    void setPairableFinished(BluezQt::PendingCall *call);
-    void pairingFinished(BluezQt::PendingCall *call);
-    void pinRequested(const QString &pin);
-
-protected:
-    QList<QWizard::WizardButton> wizardButtonsLayout() const;
-
-private:
-    BlueWizard *m_wizard;
-    KPixmapSequenceOverlayPainter *m_working;
-    bool m_success;
-};
-
-#endif // KEYBOARDPAIRING_H
diff --git a/src/wizard/pages/keyboardpairing.ui \
b/src/wizard/pages/keyboardpairing.ui deleted file mode 100644
index 1c8ad92..0000000
--- a/src/wizard/pages/keyboardpairing.ui
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>KeyboardPairing</class>
- <widget class="QWidget" name="KeyboardPairing">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>400</width>
-    <height>300</height>
-   </rect>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QFrame" name="frame">
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout_2">
-      <item>
-       <spacer name="horizontalSpacer_3">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item>
-       <widget class="QLabel" name="pinNumber">
-        <property name="minimumSize">
-         <size>
-          <width>22</width>
-          <height>22</height>
-         </size>
-        </property>
-        <property name="frameShape">
-         <enum>QFrame::NoFrame</enum>
-        </property>
-        <property name="frameShadow">
-         <enum>QFrame::Raised</enum>
-        </property>
-        <property name="lineWidth">
-         <number>0</number>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <spacer name="horizontalSpacer_4">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer_2">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Please introduce the PIN in your keyboard when it appears and press \
                Enter</string>
-       </property>
-       <property name="wordWrap">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/wizard/pages/legacypairing.cpp b/src/wizard/pages/legacypairing.cpp
deleted file mode 100644
index d755b12..0000000
--- a/src/wizard/pages/legacypairing.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************
- * This file is part of the KDE project                                      *
- *                                                                           *
- * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org>          *
- * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com>                   *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License as published by the Free Software Foundation; either              *
- * version 2 of the License, or (at your option) any later version.          *
- *                                                                           *
- * This library is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "legacypairing.h"
-#include "../bluewizard.h"
-#include "../wizardagent.h"
-#include "debug_p.h"
-
-#include <KIconLoader>
-#include <KPixmapSequence>
-#include <KPixmapSequenceOverlayPainter>
-
-#include <BluezQt/Device>
-#include <BluezQt/Adapter>
-#include <BluezQt/PendingCall>
-
-LegacyPairingPage::LegacyPairingPage(BlueWizard *parent)
-    : QWizardPage(parent)
-    , m_wizard(parent)
-    , m_success(false)
-{
-    setupUi(this);
-
-    m_working = new KPixmapSequenceOverlayPainter(this);
-    m_working->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), \
                22));
-    m_working->setWidget(pinNumber);
-    m_working->start();
-
-    QFont font(pinNumber->font());
-    font.setPointSize(42);
-    font.setBold(true);
-    pinNumber->setFont(font);
-}
-
-int LegacyPairingPage::nextId() const
-{
-    if (m_success) {
-        return BlueWizard::Connect;
-    }
-    return BlueWizard::Fail;
-}
-
-void LegacyPairingPage::initializePage()
-{
-    qCDebug(WIZARD) << "Initialize Legacy Pairing Page";
-
-    m_wizard->setButtonLayout(wizardButtonsLayout());
-
-    connect(m_wizard->agent(), &WizardAgent::pinRequested, this, \
                &LegacyPairingPage::pinRequested);
-
-    // Adapter must be pairable, otherwise pairing would fail
-    BluezQt::PendingCall *call = m_wizard->device()->adapter()->setPairable(true);
-    connect(call, &BluezQt::PendingCall::finished, this, \
                &LegacyPairingPage::setPairableFinished);
-}
-
-void LegacyPairingPage::setPairableFinished(BluezQt::PendingCall *call)
-{
-    Q_UNUSED(call)
-
-    BluezQt::PendingCall *pairCall = m_wizard->device()->pair();
-    connect(pairCall, &BluezQt::PendingCall::finished, this, \
                &LegacyPairingPage::pairingFinished);
-}
-
-void LegacyPairingPage::pairingFinished(BluezQt::PendingCall *call)
-{
-    qCDebug(WIZARD) << "Legacy Pairing finished:";
-    qCDebug(WIZARD) << "\t error     : " << (bool) call->error();
-    qCDebug(WIZARD) << "\t errorText : " << call->errorText();
-
-    m_success = !call->error();
-    wizard()->next();
-}
-
-void LegacyPairingPage::pinRequested(const QString &pin)
-{
-    m_working->stop();
-    pinNumber->setText(pin);
-}
-
-QList<QWizard::WizardButton> LegacyPairingPage::wizardButtonsLayout() const
-{
-    QList <QWizard::WizardButton> list;
-    list << QWizard::Stretch;
-    list << QWizard::CancelButton;
-    return list;
-}
diff --git a/src/wizard/pages/legacypairing.h b/src/wizard/pages/legacypairing.h
deleted file mode 100644
index 730257c..0000000
--- a/src/wizard/pages/legacypairing.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * This file is part of the KDE project                                      *
- *                                                                           *
- * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org>          *
- * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com>                   *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License as published by the Free Software Foundation; either              *
- * version 2 of the License, or (at your option) any later version.          *
- *                                                                           *
- * This library is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef LEGACYPAIRING_H
-#define LEGACYPAIRING_H
-
-#include "ui_legacypairing.h"
-
-#include <QWizardPage>
-
-namespace BluezQt
-{
-    class PendingCall;
-}
-
-class BlueWizard;
-class KPixmapSequenceOverlayPainter;
-
-class LegacyPairingPage : public QWizardPage, Ui::LegacyPairing
-{
-    Q_OBJECT
-
-public:
-    explicit LegacyPairingPage(BlueWizard *parent = 0);
-
-    int nextId() const Q_DECL_OVERRIDE;
-    void initializePage() Q_DECL_OVERRIDE;
-
-public Q_SLOTS:
-    void setPairableFinished(BluezQt::PendingCall *call);
-    void pairingFinished(BluezQt::PendingCall *call);
-    void pinRequested(const QString &pin);
-
-private:
-    QList <QWizard::WizardButton> wizardButtonsLayout() const;
-
-    BlueWizard *m_wizard;
-    KPixmapSequenceOverlayPainter *m_working;
-    bool m_success;
-};
-
-#endif // LEGACYPAIRING_H
diff --git a/src/wizard/pages/legacypairing.ui b/src/wizard/pages/legacypairing.ui
deleted file mode 100644
index 4d909e5..0000000
--- a/src/wizard/pages/legacypairing.ui
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>LegacyPairing</class>
- <widget class="QWidget" name="LegacyPairing">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>400</width>
-    <height>300</height>
-   </rect>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QFrame" name="frame">
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout_2">
-      <item>
-       <spacer name="horizontalSpacer_3">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item>
-       <widget class="QLabel" name="pinNumber">
-        <property name="minimumSize">
-         <size>
-          <width>22</width>
-          <height>22</height>
-         </size>
-        </property>
-        <property name="frameShape">
-         <enum>QFrame::NoFrame</enum>
-        </property>
-        <property name="frameShadow">
-         <enum>QFrame::Raised</enum>
-        </property>
-        <property name="lineWidth">
-         <number>0</number>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <spacer name="horizontalSpacer_4">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer_2">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Please introduce the PIN in your device when it appears</string>
-       </property>
-       <property name="wordWrap">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/wizard/pages/legacypairingdatabase.cpp \
b/src/wizard/pages/legacypairingdatabase.cpp deleted file mode 100644
index 76780b3..0000000
--- a/src/wizard/pages/legacypairingdatabase.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*****************************************************************************
- * This file is part of the KDE project                                      *
- *                                                                           *
- * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org>          *
- * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com>                   *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License as published by the Free Software Foundation; either              *
- * version 2 of the License, or (at your option) any later version.          *
- *                                                                           *
- * This library is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "legacypairingdatabase.h"
-#include "../bluewizard.h"
-#include "../wizardagent.h"
-#include "debug_p.h"
-
-#include <KLocalizedString>
-
-#include <BluezQt/Device>
-#include <BluezQt/Adapter>
-#include <BluezQt/PendingCall>
-
-LegacyPairingPageDatabase::LegacyPairingPageDatabase(BlueWizard *parent)
-    : QWizardPage(parent)
-    , m_wizard(parent)
-    , m_success(false)
-{
-    setupUi(this);
-}
-
-int LegacyPairingPageDatabase::nextId() const
-{
-    if (m_success) {
-        return BlueWizard::Connect;
-    }
-    return BlueWizard::Fail;
-}
-
-void LegacyPairingPageDatabase::initializePage()
-{
-    qCDebug(WIZARD) << "Initialize Legacy Database Pairing Page";
-
-    m_wizard->setButtonLayout(wizardButtonsLayout());
-
-    BluezQt::DevicePtr device = m_wizard->device();
-    connecting->setText(i18nc("Connecting to a Bluetooth device", "Connecting to \
                %1...", device->name()));
-
-    // Adapter must be pairable, otherwise pairing would fail
-    BluezQt::PendingCall *call = device->adapter()->setPairable(true);
-    connect(call, &BluezQt::PendingCall::finished, this, \
                &LegacyPairingPageDatabase::setPairableFinished);
-}
-
-void LegacyPairingPageDatabase::setPairableFinished(BluezQt::PendingCall *call)
-{
-    Q_UNUSED(call)
-
-    BluezQt::PendingCall *pairCall = m_wizard->device()->pair();
-    connect(pairCall, &BluezQt::PendingCall::finished, this, \
                &LegacyPairingPageDatabase::pairingFinished);
-}
-
-void LegacyPairingPageDatabase::pairingFinished(BluezQt::PendingCall *call)
-{
-    qCDebug(WIZARD) << "Legacy Database Pairing finished:";
-    qCDebug(WIZARD) << "\t error     : " << (bool) call->error();
-    qCDebug(WIZARD) << "\t errorText : " << call->errorText();
-
-    m_success = !call->error();
-    wizard()->next();
-}
-
-QList< QWizard::WizardButton > LegacyPairingPageDatabase::wizardButtonsLayout() \
                const
-{
-    QList <QWizard::WizardButton> list;
-    list << QWizard::Stretch;
-    list << QWizard::CancelButton;
-    return list;
-}
diff --git a/src/wizard/pages/legacypairingdatabase.h \
b/src/wizard/pages/legacypairingdatabase.h deleted file mode 100644
index 4b73c2f..0000000
--- a/src/wizard/pages/legacypairingdatabase.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************************
- * This file is part of the KDE project                                      *
- *                                                                           *
- * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org>          *
- * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com>                   *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License as published by the Free Software Foundation; either              *
- * version 2 of the License, or (at your option) any later version.          *
- *                                                                           *
- * This library is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef LEGACYPAIRINGDATABASE_H
-#define LEGACYPAIRINGDATABASE_H
-
-#include "ui_connect.h"
-
-#include <QWizardPage>
-
-namespace BluezQt
-{
-    class PendingCall;
-}
-
-class BlueWizard;
-
-class LegacyPairingPageDatabase : public QWizardPage, Ui::Connect
-{
-    Q_OBJECT
-
-public:
-    explicit LegacyPairingPageDatabase(BlueWizard *parent = 0);
-
-    int nextId() const Q_DECL_OVERRIDE;
-    void initializePage() Q_DECL_OVERRIDE;
-
-public Q_SLOTS:
-    void setPairableFinished(BluezQt::PendingCall *call);
-    void pairingFinished(BluezQt::PendingCall *call);
-
-protected:
-    QList<QWizard::WizardButton> wizardButtonsLayout() const;
-
-private:
-    BlueWizard *m_wizard;
-    bool m_success;
-};
-
-#endif // LEGACYPAIRINGDATABASE_H
diff --git a/src/wizard/pages/ssppairing.cpp b/src/wizard/pages/pairing.cpp
similarity index 58%
rename from src/wizard/pages/ssppairing.cpp
rename to src/wizard/pages/pairing.cpp
index f710c49..6b8622e 100644
--- a/src/wizard/pages/ssppairing.cpp
+++ b/src/wizard/pages/pairing.cpp
@@ -1,8 +1,7 @@
 /*****************************************************************************
  * This file is part of the KDE project                                      *
  *                                                                           *
- * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org>          *
- * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com>                   *
+ * Copyright (C) 2015 David Rosca <nowrep@gmail.com>                         *
  *                                                                           *
  * This library is free software; you can redistribute it and/or             *
  * modify it under the terms of the GNU Library General Public               *
@@ -20,7 +19,7 @@
  * Boston, MA 02110-1301, USA.                                               *
  *****************************************************************************/
 
-#include "ssppairing.h"
+#include "pairing.h"
 #include "../bluewizard.h"
 #include "../wizardagent.h"
 #include "debug_p.h"
@@ -30,32 +29,25 @@
 #include <KIconLoader>
 #include <KStandardGuiItem>
 #include <KLocalizedString>
-#include <KPixmapSequence>
-#include <KPixmapSequenceOverlayPainter>
 
 #include <BluezQt/Device>
 #include <BluezQt/Adapter>
 #include <BluezQt/PendingCall>
 
-SSPPairingPage::SSPPairingPage(BlueWizard *parent)
+PairingPage::PairingPage(BlueWizard *parent)
     : QWizardPage(parent)
     , m_wizard(parent)
     , m_success(false)
 {
     setupUi(this);
 
-    m_working = new KPixmapSequenceOverlayPainter(this);
-    m_working->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), \
                22));
-    m_working->setWidget(pinNumber);
-    m_working->start();
-
     QFont font(pinNumber->font());
     font.setPointSize(42);
     font.setBold(true);
     pinNumber->setFont(font);
 }
 
-int SSPPairingPage::nextId() const
+int PairingPage::nextId() const
 {
     if (m_success) {
         return BlueWizard::Connect;
@@ -63,54 +55,69 @@ int SSPPairingPage::nextId() const
     return BlueWizard::Fail;
 }
 
-void SSPPairingPage::initializePage()
+void PairingPage::initializePage()
 {
-    qCDebug(WIZARD) << "Initialize Secure Simple Pairing Page";
+    qCDebug(WIZARD) << "Initialize Pairing Page";
 
-    QList <QWizard::WizardButton> list;
-    list << QWizard::Stretch;
-    list << QWizard::CustomButton1;
-    m_wizard->setButtonLayout(list);
+    m_device = m_wizard->device();
+    m_wizard->setButtonLayout(wizardButtonsLayout());
 
     QPushButton *cancel = new QPushButton(this);
     KGuiItem::assign(cancel, KStandardGuiItem::cancel());
-
-    connect(cancel, &QPushButton::clicked, this, &SSPPairingPage::cancelClicked);
+    connect(cancel, &QPushButton::clicked, this, &PairingPage::cancelClicked);
     wizard()->setButton(QWizard::CustomButton1, cancel);
 
-    BluezQt::DevicePtr device = m_wizard->device();
-    confirmLbl->setText(i18n("Connecting to %1...", device->name()));
+    frame->hide();
+    progressBar->show();
+    connectingLbl->show();
+    confirmLbl->clear();
 
-    connect(m_wizard->agent(), &WizardAgent::confirmationRequested, this, \
                &SSPPairingPage::confirmationRequested);
-    connect(m_wizard->agent(), &WizardAgent::pinRequested, this, \
&SSPPairingPage::pinRequested); +    connectingLbl->setText(i18n("Connecting to \
%1...", m_device->name()));  
-    // Adapter must be pairable, otherwise pairing would fail
-    BluezQt::PendingCall *call = device->adapter()->setPairable(true);
-    connect(call, &BluezQt::PendingCall::finished, this, \
                &SSPPairingPage::setPairableFinished);
-}
+    connect(m_wizard->agent(), &WizardAgent::pinRequested, this, \
&PairingPage::pinRequested); +    connect(m_wizard->agent(), \
&WizardAgent::confirmationRequested, this, &PairingPage::confirmationRequested);  
-void SSPPairingPage::setPairableFinished(BluezQt::PendingCall *call)
-{
-    Q_UNUSED(call)
-
-    BluezQt::PendingCall *pairCall = m_wizard->device()->pair();
-    connect(pairCall, &BluezQt::PendingCall::finished, this, \
&SSPPairingPage::pairingFinished); +    BluezQt::PendingCall *pairCall = \
m_device->pair(); +    connect(pairCall, &BluezQt::PendingCall::finished, this, \
&PairingPage::pairingFinished);  }
 
-void SSPPairingPage::pairingFinished(BluezQt::PendingCall *call)
+void PairingPage::pairingFinished(BluezQt::PendingCall *call)
 {
-    qCDebug(WIZARD) << "Secure Pairing finished:";
+    qCDebug(WIZARD) << "Pairing finished:";
     qCDebug(WIZARD) << "\t error     : " << (bool) call->error();
     qCDebug(WIZARD) << "\t errorText : " << call->errorText();
 
     m_success = !call->error();
-    wizard()->next();
+    m_wizard->next();
 }
 
-void SSPPairingPage::confirmationRequested(const QString &passkey, const \
BluezQt::Request<> &req) +void PairingPage::pinRequested(const QString &pin)
+{
+    // Don't ask user to introduce the PIN if it was used from database
+    if (m_wizard->agent()->isFromDatabase()) {
+        return;
+    }
+
+    frame->show();
+    connectingLbl->hide();
+    progressBar->hide();
+
+    if (m_device->deviceType() == BluezQt::Device::Keyboard) {
+        confirmLbl->setText(i18n("Please introduce the PIN in your keyboard when it \
appears and press Enter")); +    } else {
+        confirmLbl->setText(i18n("Please introduce the PIN in your device when it \
appears")); +    }
+    pinNumber->setText(pin);
+}
+
+void PairingPage::confirmationRequested(const QString &passkey, const \
BluezQt::Request<> &req)  {
     m_req = req;
 
+    frame->show();
+    connectingLbl->hide();
+    progressBar->hide();
+
     QPushButton *matches = new QPushButton(this);
     KGuiItem::assign(matches, KStandardGuiItem::apply());
     matches->setText(i18n("Matches"));
@@ -119,28 +126,23 @@ void SSPPairingPage::confirmationRequested(const QString \
&passkey, const BluezQt  KGuiItem::assign(notMatch, KStandardGuiItem::cancel());
     notMatch->setText(i18n("Does not match"));
 
-    connect(matches, &QPushButton::clicked, this, &SSPPairingPage::matchesClicked);
-    connect(notMatch, &QPushButton::clicked, this, \
&SSPPairingPage::notMatchClicked); +    connect(matches, &QPushButton::clicked, this, \
&PairingPage::matchesClicked); +    connect(notMatch, &QPushButton::clicked, this, \
&PairingPage::notMatchClicked);  
-    wizard()->setButton(QWizard::CustomButton1, matches);
-    wizard()->setButton(QWizard::CustomButton2, notMatch);
+    m_wizard->setButton(QWizard::CustomButton1, matches);
+    m_wizard->setButton(QWizard::CustomButton2, notMatch);
 
-    wizard()->setButtonLayout(wizardButtonsLayout());
+    QList <QWizard::WizardButton> list;
+    list << QWizard::Stretch;
+    list << QWizard::CustomButton1;
+    list << QWizard::CustomButton2;
+    m_wizard->setButtonLayout(list);
 
-    m_working->stop();
     pinNumber->setText(passkey);
-
-    confirmLbl->setText(i18n("Please, confirm that the PIN displayed on \"%1\" \
matches the wizard one.", m_wizard->device()->name())); +    \
confirmLbl->setText(i18n("Please, confirm that the PIN displayed on %1 matches the \
wizard one.", m_wizard->device()->name()));  }
 
-void SSPPairingPage::pinRequested(const QString& pin)
-{
-    m_working->stop();
-    pinNumber->setText(pin);
-    confirmLbl->setText(i18n("Please introduce the PIN in your device when it \
                appears"));
-}
-
-void SSPPairingPage::matchesClicked()
+void PairingPage::matchesClicked()
 {
     wizard()->button(QWizard::CustomButton1)->setEnabled(false);
     wizard()->button(QWizard::CustomButton2)->setEnabled(false);
@@ -148,21 +150,20 @@ void SSPPairingPage::matchesClicked()
     m_req.accept();
 }
 
-void SSPPairingPage::notMatchClicked()
+void PairingPage::notMatchClicked()
 {
     m_req.reject();
 }
 
-void SSPPairingPage::cancelClicked()
+void PairingPage::cancelClicked()
 {
-    m_wizard->device()->cancelPairing();
+    m_device->cancelPairing();
 }
 
-QList<QWizard::WizardButton> SSPPairingPage::wizardButtonsLayout() const
+QList<QWizard::WizardButton> PairingPage::wizardButtonsLayout() const
 {
     QList <QWizard::WizardButton> list;
     list << QWizard::Stretch;
     list << QWizard::CustomButton1;
-    list << QWizard::CustomButton2;
     return list;
 }
diff --git a/src/wizard/pages/ssppairing.h b/src/wizard/pages/pairing.h
similarity index 80%
rename from src/wizard/pages/ssppairing.h
rename to src/wizard/pages/pairing.h
index 0efe2a0..f573821 100644
--- a/src/wizard/pages/ssppairing.h
+++ b/src/wizard/pages/pairing.h
@@ -1,8 +1,7 @@
 /*****************************************************************************
  * This file is part of the KDE project                                      *
  *                                                                           *
- * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org>          *
- * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com>                   *
+ * Copyright (C) 2015 David Rosca <nowrep@gmail.com>                         *
  *                                                                           *
  * This library is free software; you can redistribute it and/or             *
  * modify it under the terms of the GNU Library General Public               *
@@ -20,38 +19,32 @@
  * Boston, MA 02110-1301, USA.                                               *
  *****************************************************************************/
 
-#ifndef SSPPAIRINGPAGE_H
-#define SSPPAIRINGPAGE_H
+#ifndef PAIRINGPAGE_H
+#define PAIRINGPAGE_H
 
-#include "ui_ssppairing.h"
+#include "ui_pairing.h"
 
 #include <QWizardPage>
 
+#include <BluezQt/Device>
 #include <BluezQt/Request>
 
-namespace BluezQt
-{
-    class PendingCall;
-}
-
 class BlueWizard;
-class KPixmapSequenceOverlayPainter;
 
-class SSPPairingPage : public QWizardPage, Ui::SSPPairing
+class PairingPage : public QWizardPage, Ui::Pairing
 {
     Q_OBJECT
 
 public:
-    explicit SSPPairingPage(BlueWizard *parent = 0);
+    explicit PairingPage(BlueWizard *parent = Q_NULLPTR);
 
     int nextId() const Q_DECL_OVERRIDE;
     void initializePage() Q_DECL_OVERRIDE;
 
 public Q_SLOTS:
-    void setPairableFinished(BluezQt::PendingCall *call);
     void pairingFinished(BluezQt::PendingCall *call);
-    void confirmationRequested(const QString &passkey, const BluezQt::Request<> \
&req);  void pinRequested(const QString &pin);
+    void confirmationRequested(const QString &passkey, const BluezQt::Request<> \
&req);  void matchesClicked();
     void notMatchClicked();
     void cancelClicked();
@@ -60,9 +53,9 @@ private:
     QList<QWizard::WizardButton> wizardButtonsLayout() const;
 
     BlueWizard *m_wizard;
-    KPixmapSequenceOverlayPainter *m_working;
+    BluezQt::DevicePtr m_device;
     BluezQt::Request<> m_req;
     bool m_success;
 };
 
-#endif // SSPPAIRINGPAGE_H
+#endif // PAIRINGPAGE_H
diff --git a/src/wizard/pages/ssppairing.ui b/src/wizard/pages/pairing.ui
similarity index 85%
rename from src/wizard/pages/ssppairing.ui
rename to src/wizard/pages/pairing.ui
index 673df77..7790b7c 100644
--- a/src/wizard/pages/ssppairing.ui
+++ b/src/wizard/pages/pairing.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>SSPPairing</class>
- <widget class="QWidget" name="SSPPairing">
+ <class>Pairing</class>
+ <widget class="QWidget" name="Pairing">
   <property name="geometry">
    <rect>
     <x>0</x>
@@ -12,6 +12,16 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
+    <widget class="QLabel" name="connectingLbl"/>
+   </item>
+   <item>
+    <widget class="QProgressBar" name="progressBar">
+     <property name="maximum">
+      <number>0</number>
+     </property>
+    </widget>
+   </item>
+   <item>
     <widget class="QFrame" name="frame">
      <property name="frameShape">
       <enum>QFrame::StyledPanel</enum>
@@ -94,9 +104,12 @@
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Fixed</enum>
+       </property>
        <property name="sizeHint" stdset="0">
         <size>
-         <width>40</width>
+         <width>50</width>
          <height>20</height>
         </size>
        </property>
@@ -107,15 +120,12 @@
        <property name="enabled">
         <bool>true</bool>
        </property>
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
        <property name="text">
         <string/>
        </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
        <property name="wordWrap">
         <bool>true</bool>
        </property>
@@ -126,9 +136,12 @@
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Fixed</enum>
+       </property>
        <property name="sizeHint" stdset="0">
         <size>
-         <width>40</width>
+         <width>50</width>
          <height>20</height>
         </size>
        </property>
diff --git a/src/wizard/wizardagent.cpp b/src/wizard/wizardagent.cpp
index a0b4b04..1737228 100644
--- a/src/wizard/wizardagent.cpp
+++ b/src/wizard/wizardagent.cpp
@@ -45,6 +45,7 @@ QString WizardAgent::pin()
 void WizardAgent::setPin(const QString &pin)
 {
     m_pin = pin;
+    m_fromDatabase = false;
 }
 
 bool WizardAgent::isFromDatabase()
@@ -54,10 +55,7 @@ bool WizardAgent::isFromDatabase()
 
 QString WizardAgent::getPin(BluezQt::DevicePtr device)
 {
-    if (!m_pin.isEmpty() || !device) {
-        return m_pin;
-    }
-
+    m_fromDatabase = false;
     m_pin = QString::number(KRandom::random());
     m_pin = m_pin.left(6);
 
@@ -164,8 +162,3 @@ void WizardAgent::requestConfirmation(BluezQt::DevicePtr device, \
const QString &  
     Q_EMIT confirmationRequested(passkey, req);
 }
-
-void WizardAgent::release()
-{
-    Q_EMIT agentReleased();
-}
diff --git a/src/wizard/wizardagent.h b/src/wizard/wizardagent.h
index 31598ef..831edda 100644
--- a/src/wizard/wizardagent.h
+++ b/src/wizard/wizardagent.h
@@ -43,12 +43,10 @@ public:
     void requestPasskey(BluezQt::DevicePtr device, const BluezQt::Request<quint32> \
                &req) Q_DECL_OVERRIDE;
     void displayPasskey(BluezQt::DevicePtr device, const QString &passkey, const \
                QString &entered) Q_DECL_OVERRIDE;
     void requestConfirmation(BluezQt::DevicePtr device, const QString &passkey, \
                const BluezQt::Request<> &req) Q_DECL_OVERRIDE;
-    void release() Q_DECL_OVERRIDE;
 
 Q_SIGNALS:
     void pinRequested(const QString &pin);
     void confirmationRequested(const QString &passkey, const BluezQt::Request<> \
                &req);
-    void agentReleased();
 
 private:
     bool m_fromDatabase;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic