Ooops
This commit is contained in:
parent
55eacba63b
commit
3ff7779c7c
8 changed files with 77 additions and 24 deletions
|
@ -14,7 +14,7 @@ set(kded_androidshine_SRCS
|
|||
|
||||
networkpackage.cpp
|
||||
daemon.cpp
|
||||
|
||||
device.cpp
|
||||
)
|
||||
|
||||
kde4_add_plugin(kded_androidshine ${kded_androidshine_SRCS})
|
||||
|
@ -28,6 +28,15 @@ target_link_libraries(kded_androidshine
|
|||
${QJSON_LIBRARY}
|
||||
)
|
||||
|
||||
qt4_generate_dbus_interface(
|
||||
daemon.h
|
||||
org.kde.kdeconnect.xml
|
||||
OPTIONS -a
|
||||
)
|
||||
|
||||
add_dependencies(kded_androidshine ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdeconnect.xml)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdeconnect.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
|
||||
install(TARGETS kded_androidshine DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
install(FILES androidshine.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
|
||||
install(FILES androidshine.notifyrc DESTINATION ${DATA_INSTALL_DIR}/androidshine)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <QtNetwork/QUdpSocket>
|
||||
#include <QFile>
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <KDE/KIcon>
|
||||
|
||||
#include <sstream>
|
||||
|
@ -72,6 +73,8 @@ Daemon::Daemon(QObject *parent, const QList<QVariant>&)
|
|||
//TODO: Read paired devices from config
|
||||
//pairedDevices.push_back(new Device("MyAndroid","MyAndroid"));
|
||||
|
||||
QDBusConnection::sessionBus().registerService("org.kde.kdeconnect");
|
||||
|
||||
}
|
||||
|
||||
QString Daemon::listVisibleDevices()
|
||||
|
@ -83,6 +86,8 @@ QString Daemon::listVisibleDevices()
|
|||
ret << std::setw(20) << "Name";
|
||||
ret << std::endl;
|
||||
|
||||
emit deviceAdded("hola","hola");
|
||||
|
||||
Q_FOREACH (Device* d, visibleDevices) {
|
||||
ret << std::setw(20) << d->id().toStdString();
|
||||
ret << std::setw(20) << d->name().toStdString();
|
||||
|
|
|
@ -47,13 +47,12 @@ class Daemon
|
|||
: public KDEDModule
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect")
|
||||
|
||||
public:
|
||||
Daemon(QObject *parent, const QList<QVariant>&);
|
||||
~Daemon();
|
||||
|
||||
//DBUS interface
|
||||
|
||||
private Q_SLOTS:
|
||||
void deviceConnection(DeviceLink* dl);
|
||||
|
||||
|
@ -67,11 +66,15 @@ public Q_SLOTS:
|
|||
Q_SCRIPTABLE QString listPairedDevices(QString id);
|
||||
|
||||
Q_SCRIPTABLE bool linkAllPairedDevices();
|
||||
|
||||
*/
|
||||
|
||||
Q_SCRIPTABLE QString listLinkedDevices();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
Q_SCRIPTABLE void deviceAdded(QString id, QString name);
|
||||
Q_SCRIPTABLE void deviceRemoved(QString id);
|
||||
|
||||
private:
|
||||
|
||||
void linkTo(DeviceLink* dl);
|
||||
|
|
|
@ -21,20 +21,20 @@
|
|||
#ifndef DEVICE_H
|
||||
#define DEVICE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDBusConnection>
|
||||
#include <QString>
|
||||
|
||||
class Device
|
||||
class Device : public QObject
|
||||
{
|
||||
public:
|
||||
Device(const QString& id, const QString& name)
|
||||
{
|
||||
mDeviceId = id;
|
||||
mDeviceName = name;
|
||||
}
|
||||
Q_OBJECT
|
||||
|
||||
QString id() const{ return mDeviceId; }
|
||||
QString name() const { return mDeviceName; }
|
||||
bool paired() const { return mPaired; }
|
||||
public:
|
||||
Device(const QString& id, const QString& name);
|
||||
|
||||
Q_SCRIPTABLE QString id() const{ return mDeviceId; }
|
||||
Q_SCRIPTABLE QString name() const { return mDeviceName; }
|
||||
Q_SCRIPTABLE bool paired() const { return mPaired; }
|
||||
|
||||
void pair() {
|
||||
mPaired = true;
|
||||
|
|
|
@ -3,7 +3,11 @@ set(kcm_SRCS
|
|||
kcm.cpp
|
||||
)
|
||||
|
||||
qt4_automoc(${kcm_SRCS})
|
||||
qt4_add_dbus_interface(
|
||||
kcm_SRCS
|
||||
${DBUS_INTERFACES_INSTALL_DIR}/org.kde.kdeconnect.xml
|
||||
daemoninterface
|
||||
)
|
||||
|
||||
kde4_add_ui_files(kcm_SRCS kcm.ui wizzard.ui)
|
||||
|
||||
|
|
34
kcm/kcm.cpp
34
kcm/kcm.cpp
|
@ -18,7 +18,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "kcm.h"
|
||||
#include "ui_kcm.h"
|
||||
|
||||
|
@ -28,6 +27,8 @@
|
|||
#include <QtGui/QAction>
|
||||
#include <QtGui/QStackedLayout>
|
||||
#include <QtGui/QListView>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusInterface>
|
||||
|
||||
#include <KDebug>
|
||||
#include <kpluginfactory.h>
|
||||
|
@ -38,21 +39,31 @@ K_EXPORT_PLUGIN(KdeConnectKcmFactory("kdeconnect-kcm", "kdeconnect-kcm"))
|
|||
|
||||
KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&)
|
||||
: KCModule(KdeConnectKcmFactory::componentData(), parent)
|
||||
, dbusInterface("org.kde.kded", "/modules/androidshine", QDBusConnection::sessionBus(), this)
|
||||
{
|
||||
|
||||
m_ui = new Ui::KdeConnectKcmUi();
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_model = new QStandardItemModel(this);
|
||||
//m_selectionModel = new QItemSelectionModel(m_model);
|
||||
//connect(m_selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(currentChanged(QModelIndex,QModelIndex)));
|
||||
//m_selectionModel->setCurrentIndex(m_model->index(0), QItemSelectionModel::SelectCurrent);
|
||||
|
||||
m_ui->deviceList->setIconSize(QSize(32,32));
|
||||
m_ui->deviceList->setModel(m_model);
|
||||
//m_ui->deviceList->setSelectionModel(m_selectionModel);
|
||||
|
||||
connect(&dbusInterface, SIGNAL(deviceAdded(QString, QString)), this, SLOT(deviceAdded(QString)));
|
||||
connect(&dbusInterface, SIGNAL(deviceRemoved(QString, QString)), this, SLOT(deviceRemoved(QString)));
|
||||
|
||||
//TODO: Listen to the objectManager signals objectAdded and objectRemoved, que el daemon exportara
|
||||
//dbusInterface = new QDBusInterface("com.hal.wlan", "/com/hal/wlan/com/hal/wlan", "com.hal.wlan", QDBusConnection::SessionBus(), this);
|
||||
//dbusInterface->connection().connect("com.hal.wlan", "/com/hal/wlan/com/hal/wlan", "com.hal.wlan", "status_changed", this, SLOT(deviceAdded())
|
||||
|
||||
//m_selectionModel = new QItemSelectionModel(m_model);
|
||||
//connect(m_selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(currentChanged(QModelIndex,QModelIndex)));
|
||||
//m_selectionModel->setCurrentIndex(m_model->index(0), QItemSelectionModel::SelectCurrent);
|
||||
|
||||
connect(m_ui->removeButton, SIGNAL(clicked(bool)), this, SLOT(removeButtonClicked()));
|
||||
connect(m_ui->addButton, SIGNAL(clicked(bool)), this, SLOT(addButtonClicked()));
|
||||
|
||||
}
|
||||
|
||||
KdeConnectKcm::~KdeConnectKcm()
|
||||
|
@ -62,7 +73,7 @@ KdeConnectKcm::~KdeConnectKcm()
|
|||
|
||||
void KdeConnectKcm::addButtonClicked()
|
||||
{
|
||||
|
||||
m_model->appendRow(new QStandardItem("lalal"));
|
||||
}
|
||||
|
||||
void KdeConnectKcm::removeButtonClicked()
|
||||
|
@ -75,4 +86,15 @@ void KdeConnectKcm::currentChanged(const QModelIndex& current, const QModelIndex
|
|||
|
||||
}
|
||||
|
||||
void KdeConnectKcm::deviceAdded(QString id, QString name) //TODO: Rebre mes coses...
|
||||
{
|
||||
m_model->appendRow(new QStandardItem("hola"));
|
||||
}
|
||||
|
||||
void KdeConnectKcm::deviceRemoved(QString id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
#include "kcm.moc"
|
||||
|
|
12
kcm/kcm.h
12
kcm/kcm.h
|
@ -21,8 +21,12 @@
|
|||
#ifndef KDECONNECTKCM_H
|
||||
#define KDECONNECTKCM_H
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QDBusConnection>
|
||||
|
||||
#include <kcmodule.h>
|
||||
#include <qstandarditemmodel.h>
|
||||
|
||||
#include "daemoninterface.h"
|
||||
|
||||
class Create;
|
||||
class QModelIndex;
|
||||
|
@ -30,6 +34,8 @@ class AccountsModel;
|
|||
class AccountWidget;
|
||||
class QStackedLayout;
|
||||
class QItemSelectionModel;
|
||||
class QDBusInterface;
|
||||
|
||||
namespace Ui {
|
||||
class KdeConnectKcmUi;
|
||||
}
|
||||
|
@ -46,7 +52,11 @@ private Q_SLOTS:
|
|||
void removeButtonClicked();
|
||||
void currentChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||
|
||||
void deviceAdded(QString id, QString name);
|
||||
void deviceRemoved(QString id);
|
||||
|
||||
private:
|
||||
LocalDaemonInterface dbusInterface;
|
||||
Ui::KdeConnectKcmUi* m_ui;
|
||||
QStandardItemModel* m_model;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Source bashrc to define kdebuild
|
||||
#Source bashrc to define kdebuild and environment variables
|
||||
#http://techbase.kde.org/Getting_Started/Build/Environment
|
||||
. ~/.bashrc
|
||||
|
||||
|
|
Loading…
Reference in a new issue