Blob Blame History Raw
commit 688e2a2ce823d99e5ca1def1861fdf7591603cf2
Author: Lamarque V. Souza <lamarque@kde.org>
Date:   Tue Jul 2 00:26:02 2013 -0300

    Add missing files from last commit.

diff --git a/contourd/location/network-engines/networkmanager/NetworkManagerQtNotifier.cpp b/contourd/location/network-engines/networkmanager/NetworkManagerQtNotifier.cpp
new file mode 100644
index 0000000..bccbaf1
--- /dev/null
+++ b/contourd/location/network-engines/networkmanager/NetworkManagerQtNotifier.cpp
@@ -0,0 +1,66 @@
+/*
+ *   Copyright (C) 2013 Lamarque V. Souza <lamarque@kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   or (at your option) any later version, as published by the Free
+ *   Software Foundation
+ *
+ *   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, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "NetworkManagerQtNotifier.h"
+
+#include <NetworkManagerQt/Manager>
+#include <NetworkManagerQt/WirelessDevice>
+#include <NetworkManagerQt/AccessPoint>
+
+#include <QHash>
+
+#include <KDebug>
+
+REGISTER_NETWORK_NOTIFIER(NetworkManagerQtNotifier)
+
+class NetworkManagerQtNotifier::Private {
+public:
+    QHash<QString, NetworkManager::WirelessDevice::Ptr> devices;
+};
+
+
+NetworkManagerQtNotifier::NetworkManagerQtNotifier(QObject *parent)
+    : NetworkNotifier(parent), d(new Private())
+{
+}
+
+void NetworkManagerQtNotifier::init()
+{
+    kDebug() << "NetworkManagerQt";
+
+    foreach (const NetworkManager::Device::Ptr &device, NetworkManager::networkInterfaces()) {
+        // Check whether it is a wifi device.
+        if (device->type() != NetworkManager::Device::Wifi) {
+            continue;
+        }
+
+        NetworkManager::WirelessDevice::Ptr wifiDevice = device.objectCast<NetworkManager::WirelessDevice>();
+
+        d->devices[device->interfaceName()] = wifiDevice;
+
+        connect(wifiDevice.data(), SIGNAL(activeAccessPointChanged(QString)),
+                this, SLOT(setActiveAccessPoint(QString)));
+    }
+}
+
+NetworkManagerQtNotifier::~NetworkManagerQtNotifier()
+{
+    delete d;
+}
+
diff --git a/contourd/location/network-engines/networkmanager/NetworkManagerQtNotifier.h b/contourd/location/network-engines/networkmanager/NetworkManagerQtNotifier.h
new file mode 100644
index 0000000..765d66c
--- /dev/null
+++ b/contourd/location/network-engines/networkmanager/NetworkManagerQtNotifier.h
@@ -0,0 +1,44 @@
+/*
+ *   Copyright (C) 2013 Lamarque V. Souza <lamarque@kde.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   or (at your option) any later version, as published by the Free
+ *   Software Foundation
+ *
+ *   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, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef NETWORK_MANAGER_QT_NOTIFIER_H
+#define NETWORK_MANAGER_QT_NOTIFIER_H
+
+#include "../NetworkNotifier.h"
+
+/**
+ * NetworkManagerQtNotifier
+ */
+class NetworkManagerQtNotifier: public NetworkNotifier {
+    Q_OBJECT
+
+public:
+    NetworkManagerQtNotifier(QObject *parent = 0);
+    virtual ~NetworkManagerQtNotifier();
+
+protected:
+    void init();
+
+private:
+    class Private;
+    Private * const d;
+};
+
+#endif // NETWORK_MANAGER_QT_NOTIFIER_H
+