Removed unused add device wizzard

This commit is contained in:
Albert Vaca 2013-09-04 19:37:58 +02:00
parent 682db437ca
commit 8309879a19
5 changed files with 3 additions and 234 deletions

View file

@ -6,10 +6,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
set(kcm_SRCS devicessortproxymodel.cpp
kcm.cpp
#wizard.cpp
)
kde4_add_ui_files(kcm_SRCS kcm.ui wizard.ui)
kde4_add_ui_files(kcm_SRCS kcm.ui)
kde4_add_plugin(kcm_kdeconnect ${kcm_SRCS})

View file

@ -27,7 +27,6 @@
#include <kcmodule.h>
#include <ksharedconfig.h>
#include "wizard.h"
#include "libkdeconnect/devicesmodel.h"
class QModelIndex;
@ -67,11 +66,10 @@ private:
Ui::KdeConnectKcmUi* kcmUi;
DevicesModel* devicesModel;
DevicesSortProxyModel* sortProxyModel;
AddDeviceWizard* addDeviceWizard;
DeviceDbusInterface* currentDevice;
QModelIndex currentIndex;
//KSharedConfigPtr config;
public slots:
public Q_SLOTS:
void unpair();
};

View file

@ -1,108 +0,0 @@
/*
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "wizard.h"
#include "devicesmodel.h"
#include <QDebug>
#include <QStandardItemModel>
#include <kdebug.h>
#include "ui_wizard.h"
AddDeviceWizard::AddDeviceWizard(QWidget* parent)
: QWizard(parent)
, wizardUi(new Ui::Wizard())
, dbusInterface(new DaemonDbusInterface(this))
, discoveredDevicesList(new DevicesModel(this))
{
wizardUi->setupUi(this);
connect(wizardUi->listView,SIGNAL(activated(QModelIndex)),this,SLOT(deviceSelected(QModelIndex)));
wizardUi->listView->setModel(discoveredDevicesList);
connect(this,SIGNAL(currentIdChanged(int)),this,SLOT(pageChanged(int)));
connect(this,SIGNAL(accepted()),this,SLOT(wizardFinished()));
connect(dbusInterface, SIGNAL(deviceDiscovered(QString, QString)), this, SLOT(deviceDiscovered(QString,QString)));
//connect(dbusInterface, SIGNAL(deviceLost(QString)), this, SLOT(deviceLost(QString)));
}
void AddDeviceWizard::wizardFinished()
{
if (selectedIndex.isValid() && selectedIndex.row() >= 0 && selectedIndex.row() < discoveredDevicesList->rowCount()) {
QString name = discoveredDevicesList->data(selectedIndex,DevicesModel::NameModelRole).toString();
QString id = discoveredDevicesList->data(selectedIndex,DevicesModel::IdModelRole).toString();
emit deviceAdded(id,name);
}
}
void AddDeviceWizard::pageChanged(int id)
{
qDebug() << id;
if (id == 2) {
//TODO: Do the actual pairing in this page
}
}
void AddDeviceWizard::deviceDiscovered(QString id, QString name)
{
qDebug() << "Discovered"<<name;
discoveredDevicesList->addDevice(id,name,DevicesModel::Visible);
}
/*
void AddDeviceWizard::deviceLost(QString id)
{
//discoveredDevicesList->removeRow();
}
*/
void AddDeviceWizard::restart()
{
selectedIndex = QModelIndex();
QWizard::restart();
}
void AddDeviceWizard::show()
{
restart();
QWizard::show();
}
void AddDeviceWizard::deviceSelected(const QModelIndex& index)
{
qDebug() << "Selected:" << index.row();
selectedIndex = index;
next();
}
AddDeviceWizard::~AddDeviceWizard()
{
delete wizardUi;
delete dbusInterface;
delete discoveredDevicesList;
}

View file

@ -1,66 +0,0 @@
/*
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WIZARD_H
#define WIZARD_H
#include <QWizard>
#include <QObject>
#include "../libkdeconnect/dbusinterfaces.h"
#include "../libkdeconnect/devicesmodel.h"
namespace Ui {
class Wizard;
}
class QStandardItemModel;
class AddDeviceWizard : public QWizard
{
Q_OBJECT
public:
AddDeviceWizard(QWidget* parent);
~AddDeviceWizard();
void show();
void restart();
private Q_SLOTS:
void pageChanged(int id);
void deviceDiscovered(QString id, QString name);
//void deviceLost(QString id);
void deviceSelected(const QModelIndex& index);
void wizardFinished();
Q_SIGNALS:
void deviceAdded(QString id, QString name);
private:
Ui::Wizard* wizardUi;
DaemonDbusInterface* dbusInterface;
DevicesModel* discoveredDevicesList;
QModelIndex selectedIndex;
};
#endif // WIZARD_H

View file

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Wizard</class>
<widget class="QWizard" name="Wizard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>361</width>
<height>293</height>
</rect>
</property>
<property name="windowTitle">
<string>Wizard</string>
</property>
<widget class="QWizardPage" name="wizardPage1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Bla bla bla blo blo blo&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href=&quot;https://accounts.google.com/ServiceLogin?service=googleplay&amp;amp;passive=86400&amp;amp;continue=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.melloware.zeroconf%26hl%3Den%26rdid%3Dcom.melloware.zeroconf%26rdot%&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;Click Here!&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Select your device</string>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="listView"/>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage3"/>
</widget>
<resources/>
<connections/>
</ui>