Commit 5027b7ee authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Device listing in kcm

parent 1bdd3eb9
......@@ -55,7 +55,10 @@ void AvahiAnnouncer::readPendingNotifications()
//log.write(datagram);
qDebug() << ("AvahiAnnouncer incomming udp datagram: " + datagram);
QString id, name;
NetworkPackage np = NetworkPackage::fromString(datagram);
QString id = np.deviceId();
QString name = np.body();
Device* device = new Device(id, name);
DeviceLink* dl = new UdpDeviceLink(device, sender, 10600);
......@@ -74,6 +77,7 @@ AvahiAnnouncer::~AvahiAnnouncer()
void AvahiAnnouncer::setDiscoverable(bool b)
{
qDebug() << "Avahi scanning";
if (b) service->publishAsync();
}
......@@ -101,7 +101,7 @@ QString Daemon::listVisibleDevices()
void Daemon::startDiscovery(int timeOut)
{
qDebug() << "Start discovery";
//Listen to incomming connections
Q_FOREACH (Announcer* a, announcers) {
a->setDiscoverable(true);
......
......@@ -40,8 +40,9 @@ NetworkPackage NetworkPackage::fromString(QByteArray s)
NetworkPackage pp(id);
ss >> pp.mDeviceId;
qDebug() << pp.mDeviceId;
std::string deviceId;
ss >> deviceId;
pp.mDeviceId = QString::fromStdString(deviceId);
ss >> pp.mTime;
......@@ -55,7 +56,6 @@ NetworkPackage NetworkPackage::fromString(QByteArray s)
ss.get(); //Skip ws
ss.read(c,bodyLenght);
pp.mBody = QString::fromAscii(c,bodyLenght);
qDebug() << pp.mBody;
ss >> pp.mIsCancel;
......
......@@ -37,9 +37,10 @@ public:
static NetworkPackage fromString(QByteArray);
QByteArray toString() const;
long id() const { return mId; }
QString deviceId() const { return mDeviceId; }
QString type() const { return mType; }
QString body() const { return mBody; }
long id() const { return mId; }
bool isCancel() const { return mIsCancel; }
......@@ -47,8 +48,8 @@ public:
private:
long mId;
long mDeviceId;
long mTime;
QString mDeviceId;
QString mType;
QString mBody;
QVariant mExtra;
......
......@@ -52,7 +52,6 @@ private Q_SLOTS:
void removeButtonClicked();
void currentChanged(const QModelIndex& current, const QModelIndex& previous);
private:
Ui::KdeConnectKcmUi* kcmUi;
DaemonDbusInterface dbusInterface;
......
......@@ -36,6 +36,8 @@ AddDeviceWizard::AddDeviceWizard(QWidget* parent)
wizardUi->listView->setModel(discoveredDevicesList);
dbusInterface->startDiscovery(123456789);
connect(this,SIGNAL(currentIdChanged(int)),this,SLOT(pageChanged(int)));
connect(dbusInterface, SIGNAL(deviceDiscovered(QString, QString)), this, SLOT(deviceDiscovered(QString,QString)));
......@@ -46,11 +48,6 @@ AddDeviceWizard::AddDeviceWizard(QWidget* parent)
void AddDeviceWizard::pageChanged(int id)
{
qDebug() << id;
//QWizardPage* p = page(id);
if (id == 1) {
dbusInterface->startDiscovery(10);
//Show "scanning"
}
}
void AddDeviceWizard::deviceDiscovered(QString id, QString name)
......
......@@ -5,17 +5,24 @@
. ~/.bashrc
KDE_BUILD_CONFIRMATION=false
export VERBOSE=1
if kdebuild; then
killall kded4
while killall -9 kded4; do
killall kded4 2> /dev/null
while killall -9 kded4 2> /dev/null; do
true
done
#qdbus org.kde.kded /kded unloadModule androidshine
#qdbus org.kde.kded /kded loadModule androidshine
kded4 2>&1 | grep -v "^kded(" &
if [ ""$1 == "--nodaemon" ]; then
echo "nodaemon"
kded4 --nofork
else
kded4 2>&1 | grep -v "^kded(" &
fi
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment