Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > media > main-testing-src > by-pkgid > 6a6037a72fe4fe07e6ae3cf1acaf9d61 > files > 9

kdelibs4-4.4.5-0.1mdv2010.1.src.rpm

Index: solid/tests/fakehardwaretest.cpp
===================================================================
--- solid/tests/fakehardwaretest.cpp	(révision 1104288)
+++ solid/tests/fakehardwaretest.cpp	(copie de travail)
@@ -38,7 +38,8 @@
     Solid::Backends::Fake::FakeManager *fakeManager = new Solid::Backends::Fake::FakeManager(0, TEST_DATA);
 
     QVERIFY(!fakeManager->allDevices().isEmpty());
-    QVERIFY(fakeManager->createDevice("/org/kde/solid/fakehw/computer")!=0);
+    QObject *computer = fakeManager->createDevice("/org/kde/solid/fakehw/computer");
+    QVERIFY(computer!=0);
     QVERIFY(fakeManager->createDevice("/com/helloworld/troll/compiutor")==0);
 
     Solid::Backends::Fake::FakeDevice *device = static_cast<Solid::Backends::Fake::FakeDevice *>(fakeManager->createDevice("/org/kde/solid/fakehw/acpi_CPU0"));
@@ -65,6 +66,11 @@
     instructionsets |= Solid::Processor::IntelMmx;
     instructionsets |= Solid::Processor::IntelSse;
     QCOMPARE(processor->instructionSets(), instructionsets);
+
+    delete processor;
+    delete device;
+    delete computer;
+    delete fakeManager;
 }
 
 #include "fakehardwaretest.moc"
Index: solid/tests/halbasictest.cpp
===================================================================
--- solid/tests/halbasictest.cpp	(révision 1104288)
+++ solid/tests/halbasictest.cpp	(copie de travail)
@@ -22,6 +22,7 @@
 #include <QtTest/QtTest>
 
 #include "solid/backends/hal/halmanager.h"
+
 #include <solid/device.h>
 #include <solid/ifaces/device.h>
 #include <solid/ifaces/deviceinterface.h>
@@ -76,10 +77,15 @@
 
 void HalBasicTest::testDeviceCreation()
 {
-    Solid::Device dev("/org/freedesktop/Hal/devices/computer");
-    QVERIFY(dev.isValid());
-    dev = Solid::Device("ddd/ff");
-    QVERIFY(!dev.isValid());
+    // Uncomment to check if the "still reachable" number grows in
+    // valgrind, which probably indicates a memory leak.
+    //for (int i=0; i<1000; i++)
+    {
+        Solid::Device dev("/org/freedesktop/Hal/devices/computer");
+        QVERIFY(dev.isValid());
+        dev = Solid::Device("ddd/ff");
+        QVERIFY(!dev.isValid());
+    }
 }
 
 void HalBasicTest::testSignalHandling()
Index: solid/tests/solidhwtest.cpp
===================================================================
--- solid/tests/solidhwtest.cpp	(révision 1104288)
+++ solid/tests/solidhwtest.cpp	(copie de travail)
@@ -46,7 +46,7 @@
     setenv("SOLID_FAKEHW", FAKE_COMPUTER_XML, 1);
     Solid::ManagerBasePrivate *manager
         = dynamic_cast<Solid::ManagerBasePrivate*>(Solid::DeviceNotifier::instance());
-    fakeManager = qobject_cast<Solid::Backends::Fake::FakeManager*>(manager->managerBackend());
+    fakeManager = qobject_cast<Solid::Backends::Fake::FakeManager*>(manager->managerBackends().first());
 }
 
 void SolidHwTest::testAllDevices()
Index: solid/tests/solidmttest.cpp
===================================================================
--- solid/tests/solidmttest.cpp	(révision 1104288)
+++ solid/tests/solidmttest.cpp	(copie de travail)
@@ -27,6 +27,8 @@
 #include <solid/device.h>
 #include <solid/predicate.h>
 #include <solid/storagevolume.h>
+#include <solid/storagedrive.h>
+#include <solid/genericinterface.h>
 
 
 class SolidMtTest : public QObject
@@ -44,6 +46,11 @@
     virtual void run()
     {
         Solid::Device dev("/org/freedesktop/Hal/devices/computer");
+
+        QList<Solid::Device> driveList = Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive);
+        foreach (const Solid::Device &solidDevice, driveList) {
+            const Solid::StorageDrive* solidDrive = solidDevice.as<Solid::StorageDrive>();
+        }
     }
 };
 
@@ -65,9 +72,16 @@
 void SolidMtTest::testWorkerThread()
 {
     Solid::Device dev("/org/freedesktop/Hal/devices/acpi_ADP1");
+
     WorkerThread *wt = new WorkerThread;
     wt->start();
     wt->wait();
+
+    const QList<Solid::Device> driveList = Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive);
+    foreach (const Solid::Device &solidDevice, driveList) {
+        const Solid::GenericInterface* solidDrive = solidDevice.as<Solid::GenericInterface>();
+    }
+
     delete wt;
 }
 
Index: solid/solid/storagedrive.cpp
===================================================================
--- solid/solid/storagedrive.cpp	(révision 1104288)
+++ solid/solid/storagedrive.cpp	(copie de travail)
@@ -63,5 +63,11 @@
     return_SOLID_CALL(Ifaces::StorageDrive *, d->backendObject(), false, isHotpluggable());
 }
 
+qulonglong Solid::StorageDrive::size() const
+{
+    Q_D(const StorageDrive);
+    return_SOLID_CALL(Ifaces::StorageDrive *, d->backendObject(), false, size());
+}
+
 #include "storagedrive.moc"
 
Index: solid/solid/devicemanager_p.h
===================================================================
--- solid/solid/devicemanager_p.h	(révision 1104288)
+++ solid/solid/devicemanager_p.h	(copie de travail)
@@ -27,6 +27,7 @@
 #include <QtCore/QMap>
 #include <QtCore/QWeakPointer>
 #include <QtCore/QSharedData>
+#include <QtCore/QThreadStorage>
 
 namespace Solid
 {
@@ -58,6 +59,20 @@
         QMap<QString, QWeakPointer<DevicePrivate> > m_devicesMap;
         QMap<QObject *, QString> m_reverseMap;
     };
+
+    class DeviceManagerStorage
+    {
+    public:
+        DeviceManagerStorage();
+
+        QList<QObject*> managerBackends();
+        DeviceNotifier *notifier();
+
+    private:
+        void ensureManagerCreated();
+
+        QThreadStorage<DeviceManagerPrivate*> m_storage;
+    };
 }
 
 
Index: solid/solid/storagedrive.h
===================================================================
--- solid/solid/storagedrive.h	(révision 1104288)
+++ solid/solid/storagedrive.h	(copie de travail)
@@ -43,6 +43,7 @@
         Q_PROPERTY(DriveType driveType READ driveType)
         Q_PROPERTY(bool removable READ isRemovable)
         Q_PROPERTY(bool hotpluggable READ isHotpluggable)
+        Q_PROPERTY(qulonglong size READ size)
         Q_DECLARE_PRIVATE(StorageDrive)
         friend class Device;
 
@@ -137,6 +138,13 @@
          */
         bool isHotpluggable() const;
 
+       /**
+        * Retrieves this drives size in bytes.
+        *
+        * @return the size of this drive
+        */
+       qulonglong size() const;
+
     protected:
         /**
          * @internal
Index: solid/solid/networking.cpp
===================================================================
--- solid/solid/networking.cpp	(révision 1104288)
+++ solid/solid/networking.cpp	(copie de travail)
@@ -28,15 +28,21 @@
 
 SOLID_GLOBAL_STATIC(Solid::NetworkingPrivate, globalNetworkManager)
 
-Solid::NetworkingPrivate::NetworkingPrivate() : netStatus( Solid::Networking::Unknown ), connectPolicy( Solid::Networking::Managed ), disconnectPolicy( Solid::Networking::Managed ), iface(
-        new OrgKdeSolidNetworkingClientInterface( "org.kde.kded",
+Solid::NetworkingPrivate::NetworkingPrivate()
+    : netStatus(Solid::Networking::Unknown),
+      connectPolicy(Solid::Networking::Managed),
+      disconnectPolicy(Solid::Networking::Managed),
+      iface(new OrgKdeSolidNetworkingClientInterface( "org.kde.kded",
             "/modules/networkstatus",
             QDBusConnection::sessionBus(),
-            this ) )
+            this))
 {
     //connect( iface, SIGNAL( statusChanged( uint ) ), globalNetworkManager, SIGNAL( statusChanged( Networking::Status ) ) );
-    connect( iface, SIGNAL(statusChanged(uint)), this, SLOT(serviceStatusChanged(uint)) );
-    connect( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(const QString&, const QString&, const QString & ) ), SLOT(serviceOwnerChanged(const QString&, const QString&, const QString & ) ) );
+    connect(iface, SIGNAL(statusChanged(uint)), this, SLOT(serviceStatusChanged(uint)));
+    QDBusServiceWatcher *watcher = new QDBusServiceWatcher("org.kde.kded", QDBusConnection::sessionBus(),
+                                                           QDBusServiceWatcher::WatchForOwnerChange, this);
+    connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
+            this, SLOT(serviceOwnerChanged(QString,QString,QString)));
 
     initialize();
 }
@@ -100,20 +106,17 @@
 
 void Solid::NetworkingPrivate::serviceOwnerChanged( const QString & name, const QString & oldOwner, const QString & newOwner )
 {
-  Q_UNUSED( oldOwner );
-  if ( name == "org.kde.kded" ) {
     if ( newOwner.isEmpty() ) {
-      // kded quit on us
-      netStatus = Solid::Networking::Unknown;
-      emit globalNetworkManager->statusChanged( netStatus );
+        // kded quit on us
+        netStatus = Solid::Networking::Unknown;
+        emit globalNetworkManager->statusChanged( netStatus );
 
     } else {
-      // kded was replaced or started
-      initialize();
-      emit globalNetworkManager->statusChanged( netStatus );
-      serviceStatusChanged( netStatus );
+        // kded was replaced or started
+        initialize();
+        emit globalNetworkManager->statusChanged( netStatus );
+        serviceStatusChanged( netStatus );
     }
-  }
 }
 
 Solid::Networking::ManagementPolicy Solid::Networking::connectPolicy()
Index: solid/solid/managerbase_p.h
===================================================================
--- solid/solid/managerbase_p.h	(révision 1104288)
+++ solid/solid/managerbase_p.h	(copie de travail)
@@ -32,14 +32,12 @@
     public:
         ManagerBasePrivate();
         virtual ~ManagerBasePrivate();
-        void loadBackend();
+        void loadBackends();
 
-        QObject *managerBackend() const;
-        QString errorText() const;
+        QList<QObject*> managerBackends() const;
 
     private:
-        QObject *m_backend;
-        QString m_errorText;
+        QList<QObject*> m_backends;
     };
 }
 
Index: solid/solid/devicemanager.cpp
===================================================================
--- solid/solid/devicemanager.cpp	(révision 1104288)
+++ solid/solid/devicemanager.cpp	(copie de travail)
@@ -29,25 +29,26 @@
 
 #include "soliddefs_p.h"
 
-SOLID_GLOBAL_STATIC(Solid::DeviceManagerPrivate, globalDeviceManager)
+SOLID_GLOBAL_STATIC(Solid::DeviceManagerStorage, globalDeviceStorage)
 
 Solid::DeviceManagerPrivate::DeviceManagerPrivate()
     : m_nullDevice(new DevicePrivate(QString()))
 {
-    loadBackend();
+    loadBackends();
 
-    if (managerBackend()!=0) {
-        connect(managerBackend(), SIGNAL(deviceAdded(QString)),
+    QList<QObject*> backends = managerBackends();
+    foreach (QObject *backend, backends) {
+        connect(backend, SIGNAL(deviceAdded(QString)),
                 this, SLOT(_k_deviceAdded(QString)));
-        connect(managerBackend(), SIGNAL(deviceRemoved(QString)),
+        connect(backend, SIGNAL(deviceRemoved(QString)),
                 this, SLOT(_k_deviceRemoved(QString)));
     }
 }
 
 Solid::DeviceManagerPrivate::~DeviceManagerPrivate()
 {
-    QObject *backend = managerBackend();
-    if (backend) {
+    QList<QObject*> backends = managerBackends();
+    foreach (QObject *backend, backends) {
         disconnect(backend, 0, this, 0);
     }
 
@@ -61,16 +62,18 @@
 QList<Solid::Device> Solid::Device::allDevices()
 {
     QList<Device> list;
-    Ifaces::DeviceManager *backend
-        = qobject_cast<Ifaces::DeviceManager *>(globalDeviceManager->managerBackend());
+    QList<QObject*> backends = globalDeviceStorage->managerBackends();
 
-    if (backend == 0) return list;
+    foreach (QObject *backendObj, backends) {
+        Ifaces::DeviceManager *backend = qobject_cast<Ifaces::DeviceManager *>(backendObj);
 
-    QStringList udis = backend->allDevices();
+        if (backend == 0) continue;
 
-    foreach (const QString &udi, udis)
-    {
-        list.append(Device(udi));
+        QStringList udis = backend->allDevices();
+
+        foreach (const QString &udi, udis) {
+            list.append(Device(udi));
+        }
     }
 
     return list;
@@ -95,17 +98,19 @@
                                                  const QString &parentUdi)
 {
     QList<Device> list;
+    QList<QObject*> backends = globalDeviceStorage->managerBackends();
 
-    Ifaces::DeviceManager *backend
-        = qobject_cast<Ifaces::DeviceManager *>(globalDeviceManager->managerBackend());
+    foreach (QObject *backendObj, backends) {
+        Ifaces::DeviceManager *backend = qobject_cast<Ifaces::DeviceManager *>(backendObj);
 
-    if (backend == 0) return list;
+        if (backend == 0) continue;
+        if (!backend->supportedInterfaces().contains(type)) continue;
 
-    QStringList udis = backend->devicesFromQuery(parentUdi, type);
+        QStringList udis = backend->devicesFromQuery(parentUdi, type);
 
-    foreach (const QString &udi, udis)
-    {
-        list.append(Device(udi));
+        foreach (const QString &udi, udis) {
+            list.append(Device(udi));
+        }
     }
 
     return list;
@@ -115,38 +120,44 @@
                                                   const QString &parentUdi)
 {
     QList<Device> list;
+    QList<QObject*> backends = globalDeviceStorage->managerBackends();
+    QSet<DeviceInterface::Type> usedTypes = predicate.usedTypes();
 
-    Ifaces::DeviceManager *backend
-        = qobject_cast<Ifaces::DeviceManager *>(globalDeviceManager->managerBackend());
+    foreach (QObject *backendObj, backends) {
+        Ifaces::DeviceManager *backend = qobject_cast<Ifaces::DeviceManager *>(backendObj);
 
-    if (backend == 0) return list;
+        if (backend == 0) continue;
 
-    QSet<QString> udis;
-    if (predicate.isValid()) {
-        QSet<DeviceInterface::Type> types = predicate.usedTypes();
+        QSet<QString> udis;
+        if (predicate.isValid()) {
+            QSet<DeviceInterface::Type> supportedTypes = backend->supportedInterfaces();
+            if (supportedTypes.intersect(usedTypes).isEmpty()) {
+                continue;
+            }
 
-        foreach (DeviceInterface::Type type, types) {
-            udis+= QSet<QString>::fromList(backend->devicesFromQuery(parentUdi, type));
+            foreach (DeviceInterface::Type type, supportedTypes) {
+                udis+= QSet<QString>::fromList(backend->devicesFromQuery(parentUdi, type));
+            }
+        } else {
+            udis+= QSet<QString>::fromList(backend->allDevices());
         }
-    } else {
-        udis+= QSet<QString>::fromList(backend->allDevices());
-    }
 
-    foreach (const QString &udi, udis)
-    {
-        Device dev(udi);
+        foreach (const QString &udi, udis)
+        {
+            Device dev(udi);
 
-        bool matches = false;
+            bool matches = false;
 
-        if(!predicate.isValid()) {
-            matches = true;
-        } else {
-            matches = predicate.matches(dev);
-        }
+            if(!predicate.isValid()) {
+                matches = true;
+            } else {
+                matches = predicate.matches(dev);
+            }
 
-        if (matches)
-        {
-            list.append(dev);
+            if (matches)
+            {
+                list.append(dev);
+            }
         }
     }
 
@@ -155,7 +166,7 @@
 
 Solid::DeviceNotifier *Solid::DeviceNotifier::instance()
 {
-    return globalDeviceManager;
+    return globalDeviceStorage->notifier();
 }
 
 void Solid::DeviceManagerPrivate::_k_deviceAdded(const QString &udi)
@@ -185,7 +196,7 @@
 
         if (dev) {
             Q_ASSERT(dev->backendObject()!=0);
-            delete dev->backendObject();
+            dev->setBackendObject(0);
             Q_ASSERT(dev->backendObject()==0);
         }
     }
@@ -227,21 +238,53 @@
 
 Solid::Ifaces::Device *Solid::DeviceManagerPrivate::createBackendObject(const QString &udi)
 {
-    Ifaces::DeviceManager *backend = qobject_cast<Ifaces::DeviceManager *>(managerBackend());
-    Ifaces::Device *iface = 0;
+    QList<QObject*> backends = globalDeviceStorage->managerBackends();
 
-    if (backend!= 0) {
+    foreach (QObject *backendObj, backends) {
+        Ifaces::DeviceManager *backend = qobject_cast<Ifaces::DeviceManager *>(backendObj);
+
+        if (backend == 0) continue;
+        if (!udi.startsWith(backend->udiPrefix())) continue;
+
+        Ifaces::Device *iface = 0;
+
         QObject *object = backend->createDevice(udi);
         iface = qobject_cast<Ifaces::Device *>(object);
 
         if (iface==0) {
             delete object;
         }
+
+        return iface;
     }
 
-    return iface;
+    return 0;
 }
 
+Solid::DeviceManagerStorage::DeviceManagerStorage()
+{
+
+}
+
+QList<QObject*> Solid::DeviceManagerStorage::managerBackends()
+{
+    ensureManagerCreated();
+    return m_storage.localData()->managerBackends();
+}
+
+Solid::DeviceNotifier *Solid::DeviceManagerStorage::notifier()
+{
+    ensureManagerCreated();
+    return m_storage.localData();
+}
+
+void Solid::DeviceManagerStorage::ensureManagerCreated()
+{
+    if (!m_storage.hasLocalData()) {
+        m_storage.setLocalData(new DeviceManagerPrivate());
+    }
+}
+
 #include "devicenotifier.moc"
 #include "devicemanager_p.moc"
 
Index: solid/solid/device.cpp
===================================================================
--- solid/solid/device.cpp	(révision 1104288)
+++ solid/solid/device.cpp	(copie de travail)
@@ -266,7 +266,7 @@
     foreach (DeviceInterface *iface, m_ifaces) {
         delete iface->d_ptr->backendObject();
     }
-    qDeleteAll(m_ifaces);
+    setBackendObject(0);
 }
 
 void Solid::DevicePrivate::_k_destroyed(QObject *object)
@@ -277,6 +277,12 @@
 
 void Solid::DevicePrivate::setBackendObject(Ifaces::Device *object)
 {
+
+    if (m_backendObject) {
+        m_backendObject.data()->disconnect(this);
+    }
+
+    delete m_backendObject.data();
     m_backendObject = object;
 
     if (object) {
@@ -286,7 +292,6 @@
 
     if (!m_ifaces.isEmpty()) {
         foreach (DeviceInterface *iface, m_ifaces) {
-            delete iface->d_ptr->backendObject();
             delete iface;
             if (!ref.deref()) deleteLater();
         }
@@ -302,7 +307,8 @@
 
 void Solid::DevicePrivate::setInterface(const DeviceInterface::Type &type, DeviceInterface *interface)
 {
-    ref.ref();
+    if(m_ifaces.empty())
+        ref.ref();
     m_ifaces[type] = interface;
 }
 
Index: solid/solid/ifaces/devicemanager.h
===================================================================
--- solid/solid/ifaces/devicemanager.h	(révision 1104288)
+++ solid/solid/ifaces/devicemanager.h	(copie de travail)
@@ -52,7 +52,17 @@
          */
         virtual ~DeviceManager();
 
+        /**
+         * Retrieves the prefix used for the UDIs off all the devices
+         * reported by the device manager
+         */
+        virtual QString udiPrefix() const = 0;
 
+        /**
+         * Retrieves the prefix used for the UDIs off all the devices
+         * reported by the device manager
+         */
+        virtual QSet<Solid::DeviceInterface::Type> supportedInterfaces() const = 0;
 
         /**
          * Retrieves the Universal Device Identifier (UDI) of all the devices
Index: solid/solid/ifaces/storagedrive.h
===================================================================
--- solid/solid/ifaces/storagedrive.h	(révision 1104288)
+++ solid/solid/ifaces/storagedrive.h	(copie de travail)
@@ -77,6 +77,13 @@
          * @return true if this storage supports hotplug, false otherwise
          */
         virtual bool isHotpluggable() const = 0;
+	
+	/**
+	* Retrieves this drives size in bytes.
+	*
+	* @return the size of this drive
+	*/
+	virtual qulonglong size() const = 0;
     };
 }
 }
Index: solid/solid/CMakeLists.txt
===================================================================
--- solid/solid/CMakeLists.txt	(révision 1104288)
+++ solid/solid/CMakeLists.txt	(copie de travail)
@@ -122,6 +122,27 @@
 )
 
 if(NOT WIN32 AND NOT APPLE)
+   message(STATUS "-- Building Solid KUPnP backend." )
+   set(solid_LIB_SRCS ${solid_LIB_SRCS}
+
+   backends/kupnp/lib/service.cpp
+   backends/kupnp/lib/device.cpp
+   backends/kupnp/lib/devicebrowser_p.cpp
+   backends/kupnp/lib/devicebrowser.cpp
+   backends/kupnp/kupnpstorageaccess.cpp
+   backends/kupnp/kupnpdeviceinterface.cpp
+   backends/kupnp/mediaserver1.cpp
+   backends/kupnp/mediaserver2.cpp
+   backends/kupnp/mediaserver3.cpp
+   backends/kupnp/internetgatewaydevice1.cpp
+   backends/kupnp/kupnpdevice.cpp
+   backends/kupnp/kupnprootdevice.cpp
+   backends/kupnp/kupnpmanager.cpp
+
+   )
+
+   qt4_add_dbus_interface( solid_LIB_SRCS  backends/kupnp/lib/org.Coherence.xml coherence_interface )
+
    message(STATUS "-- Building Solid HAL backend." )
    set(solid_LIB_SRCS ${solid_LIB_SRCS}
 
Index: solid/solid/managerbase.cpp
===================================================================
--- solid/solid/managerbase.cpp	(révision 1104288)
+++ solid/solid/managerbase.cpp	(copie de travail)
@@ -27,45 +27,41 @@
 #include "backends/iokit/iokitmanager.h"
 #elif defined (Q_OS_UNIX)
 #include "backends/hal/halmanager.h"
+#include "backends/kupnp/kupnpmanager.h"
 #elif defined (_MSC_VER) // TODO: mingw
 #include "backends/wmi/wmimanager.h"
 #endif
 
 Solid::ManagerBasePrivate::ManagerBasePrivate()
-    : m_backend(0)
 {
 }
 
 Solid::ManagerBasePrivate::~ManagerBasePrivate()
 {
-    delete m_backend;
+    qDeleteAll(m_backends);
 }
 
-void Solid::ManagerBasePrivate::loadBackend()
+void Solid::ManagerBasePrivate::loadBackends()
 {
     QString solidFakeXml(QString::fromLocal8Bit(qgetenv("SOLID_FAKEHW")));
 
     if (!solidFakeXml.isEmpty()) {
-        m_backend = new Solid::Backends::Fake::FakeManager(0, solidFakeXml);
+        m_backends << new Solid::Backends::Fake::FakeManager(0, solidFakeXml);
     } else {
 #        if defined (Q_OS_MAC)
-            m_backend = new Solid::Backends::IOKit::IOKitManager(0);
+            m_backends << new Solid::Backends::IOKit::IOKitManager(0);
 #        elif defined (Q_OS_UNIX)
-            m_backend = new Solid::Backends::Hal::HalManager(0);
+            m_backends << new Solid::Backends::Hal::HalManager(0)
+                       << new Solid::Backends::KUPnP::KUPnPManager(0);
 #        elif defined (_MSC_VER) // TODO: mingw
-            m_backend = new Solid::Backends::Wmi::WmiManager(0);
+            m_backends << new Solid::Backends::Wmi::WmiManager(0);
 #        endif
     }
 }
 
-QString Solid::ManagerBasePrivate::errorText() const
+QList<QObject*> Solid::ManagerBasePrivate::managerBackends() const
 {
-    return m_errorText;
+    return m_backends;
 }
 
-QObject *Solid::ManagerBasePrivate::managerBackend() const
-{
-    return m_backend;
-}
 
-
Index: solid/solid/backends/iokit/iokitmanager.cpp
===================================================================
--- solid/solid/backends/iokit/iokitmanager.cpp	(révision 1104288)
+++ solid/solid/backends/iokit/iokitmanager.cpp	(copie de travail)
@@ -42,6 +42,8 @@
 
     static const char *typeToName(Solid::DeviceInterface::Type type);
     static QStringList devicesFromRegistry(io_iterator_t it);
+
+    QSet<Solid::DeviceInterface::Type> supportedInterfaces;
 };
 
 // gets all registry pathes from an iterator
@@ -119,6 +121,26 @@
     }
 
     CFRunLoopAddSource(CFRunLoopGetCurrent(), d->source, kCFRunLoopDefaultMode);
+
+    d->supportedInterfaces << Solid::DeviceInterface::GenericInterface
+                           << Solid::DeviceInterface::Processor
+                           << Solid::DeviceInterface::Block
+                           << Solid::DeviceInterface::StorageAccess
+                           << Solid::DeviceInterface::StorageDrive
+                           << Solid::DeviceInterface::OpticalDrive
+                           << Solid::DeviceInterface::StorageVolume
+                           << Solid::DeviceInterface::OpticalDisc
+                           << Solid::DeviceInterface::Camera
+                           << Solid::DeviceInterface::PortableMediaPlayer
+                           << Solid::DeviceInterface::NetworkInterface
+                           << Solid::DeviceInterface::AcAdapter
+                           << Solid::DeviceInterface::Battery
+                           << Solid::DeviceInterface::Button
+                           << Solid::DeviceInterface::AudioInterface
+                           << Solid::DeviceInterface::DvbInterface
+                           << Solid::DeviceInterface::Video
+                           << Solid::DeviceInterface::SerialInterface
+                           << Solid::DeviceInterface::SmartCardReader;
 }
 
 IOKitManager::~IOKitManager()
@@ -131,6 +153,16 @@
     delete d;
 }
 
+QString IOKitManager::udiPrefix() const
+{
+    return QString(); //FIXME: We should probably use a prefix there... has to be tested on Mac
+}
+
+QSet<Solid::DeviceInterface::Type> IOKitManager::supportedInterfaces() const
+{
+    return d->supportedInterfaces;
+}
+
 QStringList IOKitManager::allDevices()
 {
     // use an IORegistry Iterator to iterate over all devices in the service plane
Index: solid/solid/backends/iokit/iokitmanager.h
===================================================================
--- solid/solid/backends/iokit/iokitmanager.h	(révision 1104288)
+++ solid/solid/backends/iokit/iokitmanager.h	(copie de travail)
@@ -42,6 +42,9 @@
     IOKitManager(QObject *parent);
     virtual ~IOKitManager();
 
+    virtual QString udiPrefix() const ;
+    virtual QSet<Solid::DeviceInterface::Type> supportedInterfaces() const;
+
     virtual QStringList allDevices();
     virtual QStringList devicesFromQuery(const QString &parentUdi,
                                          Solid::DeviceInterface::Type type);
Index: solid/solid/backends/hal/halmanager.h
===================================================================
--- solid/solid/backends/hal/halmanager.h	(révision 1104288)
+++ solid/solid/backends/hal/halmanager.h	(copie de travail)
@@ -42,15 +42,17 @@
     HalManager(QObject *parent);
     virtual ~HalManager();
 
+    virtual QString udiPrefix() const ;
+    virtual QSet<Solid::DeviceInterface::Type> supportedInterfaces() const;
+
+    bool deviceExists(const QString &udi);
     virtual QStringList allDevices();
-    virtual bool deviceExists(const QString &udi);
 
     virtual QStringList devicesFromQuery(const QString &parentUdi,
                                          Solid::DeviceInterface::Type type);
 
     virtual QObject *createDevice(const QString &udi);
 
-
 private Q_SLOTS:
     void slotDeviceAdded(const QString &udi);
     void slotDeviceRemoved(const QString &udi);
Index: solid/solid/backends/hal/halstorage.h
===================================================================
--- solid/solid/backends/hal/halstorage.h	(révision 1104288)
+++ solid/solid/backends/hal/halstorage.h	(copie de travail)
@@ -43,6 +43,7 @@
 
     virtual bool isRemovable() const;
     virtual bool isHotpluggable() const;
+    virtual qulonglong size() const;
 };
 }
 }
Index: solid/solid/backends/hal/halmanager.cpp
===================================================================
--- solid/solid/backends/hal/halmanager.cpp	(révision 1104288)
+++ solid/solid/backends/hal/halmanager.cpp	(copie de travail)
@@ -40,6 +40,7 @@
     QDBusInterface manager;
     QList<QString> devicesCache;
     bool cacheSynced;
+    QSet<Solid::DeviceInterface::Type> supportedInterfaces;
 };
 
 
@@ -57,6 +58,26 @@
                                      "org.freedesktop.Hal.Manager",
                                      "DeviceRemoved",
                                      this, SLOT(slotDeviceRemoved(const QString &)));
+
+    d->supportedInterfaces << Solid::DeviceInterface::GenericInterface
+                           << Solid::DeviceInterface::Processor
+                           << Solid::DeviceInterface::Block
+                           << Solid::DeviceInterface::StorageAccess
+                           << Solid::DeviceInterface::StorageDrive
+                           << Solid::DeviceInterface::OpticalDrive
+                           << Solid::DeviceInterface::StorageVolume
+                           << Solid::DeviceInterface::OpticalDisc
+                           << Solid::DeviceInterface::Camera
+                           << Solid::DeviceInterface::PortableMediaPlayer
+                           << Solid::DeviceInterface::NetworkInterface
+                           << Solid::DeviceInterface::AcAdapter
+                           << Solid::DeviceInterface::Battery
+                           << Solid::DeviceInterface::Button
+                           << Solid::DeviceInterface::AudioInterface
+                           << Solid::DeviceInterface::DvbInterface
+                           << Solid::DeviceInterface::Video
+                           << Solid::DeviceInterface::SerialInterface
+                           << Solid::DeviceInterface::SmartCardReader;
 }
 
 HalManager::~HalManager()
@@ -64,6 +85,16 @@
     delete d;
 }
 
+QString HalManager::udiPrefix() const
+{
+    return "/org/freedesktop/Hal";
+}
+
+QSet<Solid::DeviceInterface::Type> HalManager::supportedInterfaces() const
+{
+    return d->supportedInterfaces;
+}
+
 QStringList HalManager::allDevices()
 {
     if (d->cacheSynced)
@@ -125,7 +156,7 @@
 
             foreach (const QString &match, matches) {
                 HalDevice device(match);
-                
+
                 if (device.queryDeviceInterface(type)) {
                     result << match;
                 }
Index: solid/solid/backends/hal/haldevice.h
===================================================================
--- solid/solid/backends/hal/haldevice.h	(révision 1104288)
+++ solid/solid/backends/hal/haldevice.h	(copie de travail)
@@ -55,15 +55,14 @@
     virtual QStringList emblems() const;
     virtual QString description() const;
 
-    virtual QVariant property(const QString &key) const;
-
-    virtual QMap<QString, QVariant> allProperties() const;
-
-    virtual bool propertyExists(const QString &key) const;
-
     virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type &type) const;
     virtual QObject *createDeviceInterface(const Solid::DeviceInterface::Type &type);
 
+public:
+    QVariant property(const QString &key) const;
+    QMap<QString, QVariant> allProperties() const;
+    bool propertyExists(const QString &key) const;
+
 Q_SIGNALS:
     void propertyChanged(const QMap<QString,int> &changes);
     void conditionRaised(const QString &condition, const QString &reason);
Index: solid/solid/backends/hal/halstorage.cpp
===================================================================
--- solid/solid/backends/hal/halstorage.cpp	(révision 1104288)
+++ solid/solid/backends/hal/halstorage.cpp	(copie de travail)
@@ -114,4 +114,9 @@
     return m_device->property("storage.hotpluggable").toBool();
 }
 
+qulonglong Storage::size() const
+{
+  return m_device->property("storage.size").toULongLong();
+}
+
 #include "backends/hal/halstorage.moc"
Index: solid/solid/backends/fakehw/fakestorage.h
===================================================================
--- solid/solid/backends/fakehw/fakestorage.h	(révision 1104288)
+++ solid/solid/backends/fakehw/fakestorage.h	(copie de travail)
@@ -44,6 +44,7 @@
 
     virtual bool isRemovable() const;
     virtual bool isHotpluggable() const;
+    virtual qulonglong size() const;
 };
 }
 }
Index: solid/solid/backends/fakehw/fakemanager.cpp
===================================================================
--- solid/solid/backends/fakehw/fakemanager.cpp	(révision 1104288)
+++ solid/solid/backends/fakehw/fakemanager.cpp	(copie de travail)
@@ -39,6 +39,7 @@
     QMap<QString, FakeDevice *> loadedDevices;
     QMap<QString, QMap<QString,QVariant> > hiddenDevices;
     QString xmlFile;
+    QSet<Solid::DeviceInterface::Type> supportedInterfaces;
 };
 
 FakeManager::FakeManager(QObject *parent, const QString &xmlFile)
@@ -50,6 +51,26 @@
     QDBusConnection::sessionBus().registerObject("/org/kde/solid/fakehw", this, QDBusConnection::ExportNonScriptableSlots);
 
     parseMachineFile();
+
+    d->supportedInterfaces << Solid::DeviceInterface::GenericInterface
+                           << Solid::DeviceInterface::Processor
+                           << Solid::DeviceInterface::Block
+                           << Solid::DeviceInterface::StorageAccess
+                           << Solid::DeviceInterface::StorageDrive
+                           << Solid::DeviceInterface::OpticalDrive
+                           << Solid::DeviceInterface::StorageVolume
+                           << Solid::DeviceInterface::OpticalDisc
+                           << Solid::DeviceInterface::Camera
+                           << Solid::DeviceInterface::PortableMediaPlayer
+                           << Solid::DeviceInterface::NetworkInterface
+                           << Solid::DeviceInterface::AcAdapter
+                           << Solid::DeviceInterface::Battery
+                           << Solid::DeviceInterface::Button
+                           << Solid::DeviceInterface::AudioInterface
+                           << Solid::DeviceInterface::DvbInterface
+                           << Solid::DeviceInterface::Video
+                           << Solid::DeviceInterface::SerialInterface
+                           << Solid::DeviceInterface::SmartCardReader;
 }
 
 FakeManager::~FakeManager()
@@ -58,7 +79,16 @@
     delete d;
 }
 
+QString FakeManager::udiPrefix() const
+{
+    return "/org/kde/solid/fakehw";
+}
 
+QSet<Solid::DeviceInterface::Type> FakeManager::supportedInterfaces() const
+{
+    return d->supportedInterfaces;
+}
+
 QStringList FakeManager::allDevices()
 {
     QStringList deviceUdiList;
@@ -113,7 +143,7 @@
 {
     if (d->loadedDevices.contains(udi))
     {
-        return d->loadedDevices[udi];
+        return new FakeDevice(*d->loadedDevices[udi]);
     }
 
     return 0;
@@ -176,6 +206,7 @@
         FakeDevice *dev = d->loadedDevices.take(udi);
         d->hiddenDevices[udi] = dev->allProperties();
         emit deviceRemoved(udi);
+        delete dev;
     }
 }
 
@@ -206,8 +237,8 @@
         if (!tempElement.isNull() && tempElement.tagName() == QLatin1String("device"))
         {
             FakeDevice *tempDevice = parseDeviceElement(tempElement);
-            if(tempDevice)
-            {
+            if(tempDevice) {
+                Q_ASSERT(!d->loadedDevices.contains(tempDevice->udi()));
                 d->loadedDevices.insert(tempDevice->udi(), tempDevice);
                 emit deviceAdded(tempDevice->udi());
             }
Index: solid/solid/backends/fakehw/fakedevice_p.h
===================================================================
--- solid/solid/backends/fakehw/fakedevice_p.h	(révision 0)
+++ solid/solid/backends/fakehw/fakedevice_p.h	(révision 0)
@@ -0,0 +1,55 @@
+/*  This file is part of the KDE project
+ *  Copyright (C) 2006 Michaël Larouche <michael.larouche@kdemail.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License version 2 as published by the Free Software Foundation.
+ *
+ *  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 SOLID_BACKENDS_FAKEHW_FAKEDEVICE_P_H
+#define SOLID_BACKENDS_FAKEHW_FAKEDEVICE_P_H
+
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QVariant>
+#include <QtCore/QObject>
+
+namespace Solid
+{
+namespace Backends
+{
+namespace Fake
+{
+class FakeDevice;
+class FakeDevice::Private : public QObject
+{
+    Q_OBJECT
+public:
+    QString udi;
+    QMap<QString, QVariant> propertyMap;
+    QStringList interfaceList;
+    bool locked;
+    QString lockReason;
+    bool broken;
+
+Q_SIGNALS:
+    void propertyChanged(const QMap<QString,int> &changes);
+    void conditionRaised(const QString &condition, const QString &reason);
+
+    friend class FakeDevice;
+};
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/fakehw/fakedevice_p.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/fakehw/fakestorage.cpp
===================================================================
--- solid/solid/backends/fakehw/fakestorage.cpp	(révision 1104288)
+++ solid/solid/backends/fakehw/fakestorage.cpp	(copie de travail)
@@ -114,4 +114,9 @@
     return fakeDevice()->property("isHotpluggable").toBool();
 }
 
+qulonglong FakeStorage::size() const
+{
+    return fakeDevice()->property("size").toULongLong();
+}
+
 #include "backends/fakehw/fakestorage.moc"
Index: solid/solid/backends/fakehw/fakedevice.h
===================================================================
--- solid/solid/backends/fakehw/fakedevice.h	(révision 1104288)
+++ solid/solid/backends/fakehw/fakedevice.h	(copie de travail)
@@ -22,6 +22,7 @@
 #include <solid/ifaces/device.h>
 
 #include <QtCore/QMap>
+#include <QtCore/QSharedPointer>
 
 namespace Solid
 {
@@ -34,6 +35,7 @@
     Q_OBJECT
 public:
     FakeDevice(const QString &udi, const QMap<QString, QVariant> &propertyMap);
+    FakeDevice(const FakeDevice& dev);
     ~FakeDevice();
 
 public Q_SLOTS:
@@ -71,7 +73,7 @@
 
 private:
     class Private;
-    Private *d;
+    QSharedPointer<Private> d;
 };
 }
 }
Index: solid/solid/backends/fakehw/fakemanager.h
===================================================================
--- solid/solid/backends/fakehw/fakemanager.h	(révision 1104288)
+++ solid/solid/backends/fakehw/fakemanager.h	(copie de travail)
@@ -47,6 +47,9 @@
     FakeManager(QObject *parent, const QString &xmlFile);
     virtual ~FakeManager();
 
+    virtual QString udiPrefix() const ;
+    virtual QSet<Solid::DeviceInterface::Type> supportedInterfaces() const;
+
     /**
      * Return the list of UDI of all available devices.
      */
Index: solid/solid/backends/fakehw/fakedevice.cpp
===================================================================
--- solid/solid/backends/fakehw/fakedevice.cpp	(révision 1104288)
+++ solid/solid/backends/fakehw/fakedevice.cpp	(copie de travail)
@@ -42,19 +42,10 @@
 
 #include <solid/genericinterface.h>
 
+#include "fakedevice_p.h"
+
 using namespace Solid::Backends::Fake;
 
-class FakeDevice::Private
-{
-public:
-    QString udi;
-    QMap<QString, QVariant> propertyMap;
-    QStringList interfaceList;
-    bool locked;
-    QString lockReason;
-    bool broken;
-};
-
 FakeDevice::FakeDevice(const QString &udi, const QMap<QString, QVariant> &propertyMap)
     : Solid::Ifaces::Device(), d(new Private)
 {
@@ -76,11 +67,24 @@
         Solid::DeviceInterface::Type type = Solid::DeviceInterface::stringToType(interface);
         createDeviceInterface(type);
     }
+
+    connect(d.data(), SIGNAL(propertyChanged(const QMap<QString,int> &)),
+            this, SIGNAL(propertyChanged(const QMap<QString,int> &)));
+    connect(d.data(), SIGNAL(conditionRaised(const QString &, const QString &)),
+            this, SIGNAL(conditionRaised(const QString &, const QString &)));
 }
 
+FakeDevice::FakeDevice(const FakeDevice& dev)
+    : Solid::Ifaces::Device(), d(dev.d)
+{
+    connect(d.data(), SIGNAL(propertyChanged(const QMap<QString,int> &)),
+            this, SIGNAL(propertyChanged(const QMap<QString,int> &)));
+    connect(d.data(), SIGNAL(conditionRaised(const QString &, const QString &)),
+            this, SIGNAL(conditionRaised(const QString &, const QString &)));
+}
+
 FakeDevice::~FakeDevice()
 {
-    delete d;
 }
 
 QString FakeDevice::udi() const
@@ -175,7 +179,7 @@
     QMap<QString,int> change;
     change[key] = change_type;
 
-    emit propertyChanged(change);
+    emit d->propertyChanged(change);
 
     return true;
 }
@@ -189,7 +193,7 @@
     QMap<QString,int> change;
     change[key] = Solid::GenericInterface::PropertyRemoved;
 
-    emit propertyChanged(change);
+    emit d->propertyChanged(change);
 
     return true;
 }
@@ -236,7 +240,7 @@
 
 void FakeDevice::raiseCondition(const QString &condition, const QString &reason)
 {
-    emit conditionRaised(condition, reason);
+    emit d->conditionRaised(condition, reason);
 }
 
 bool FakeDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type) const
@@ -307,6 +311,8 @@
     case Solid::DeviceInterface::SmartCardReader:
         iface = new FakeSmartCardReader(this);
         break;
+    case Solid::DeviceInterface::SerialInterface:
+        break;
     case Solid::DeviceInterface::Unknown:
         break;
     case Solid::DeviceInterface::Last:
@@ -323,3 +329,4 @@
 }
 
 #include "backends/fakehw/fakedevice.moc"
+#include "backends/fakehw/fakedevice_p.moc"
Index: solid/solid/backends/wmi/wmistorage.cpp
===================================================================
--- solid/solid/backends/wmi/wmistorage.cpp	(révision 1104288)
+++ solid/solid/backends/wmi/wmistorage.cpp	(copie de travail)
@@ -114,4 +114,9 @@
     return m_device->property("storage.hotpluggable").toBool();
 }
 
+qulonglong Storage::size() const
+{
+    return m_device->property("storage.size").toULongLong();
+}
+
 #include "backends/wmi/wmistorage.moc"
Index: solid/solid/backends/wmi/wmimanager.h
===================================================================
--- solid/solid/backends/wmi/wmimanager.h	(révision 1104288)
+++ solid/solid/backends/wmi/wmimanager.h	(copie de travail)
@@ -42,6 +42,9 @@
     WmiManager(QObject *parent);
     virtual ~WmiManager();
 
+    virtual QString udiPrefix() const ;
+    virtual QSet<Solid::DeviceInterface::Type> supportedInterfaces() const;
+
     virtual QStringList allDevices();
     virtual bool deviceExists(const QString &udi);
 
Index: solid/solid/backends/wmi/wmistorage.h
===================================================================
--- solid/solid/backends/wmi/wmistorage.h	(révision 1104288)
+++ solid/solid/backends/wmi/wmistorage.h	(copie de travail)
@@ -43,6 +43,7 @@
 
     virtual bool isRemovable() const;
     virtual bool isHotpluggable() const;
+    virtual qulonglong size() const;
 };
 }
 }
Index: solid/solid/backends/wmi/wmimanager.cpp
===================================================================
--- solid/solid/backends/wmi/wmimanager.cpp	(révision 1104288)
+++ solid/solid/backends/wmi/wmimanager.cpp	(copie de travail)
@@ -34,21 +34,41 @@
     {
     }
 
-    ~WmiManagerPrivate() 
+    ~WmiManagerPrivate()
     {
     }
-    
+
     WmiQuery::ItemList sendQuery( const QString &wql )
     {
 		return WmiQuery::instance().sendQuery( wql );
     }
+
+    QSet<Solid::DeviceInterface::Type> supportedInterfaces;
 };
 
 
 WmiManager::WmiManager(QObject *parent)
     : DeviceManager(parent),  d(new WmiManagerPrivate())
 {
-    
+    d->supportedInterfaces << Solid::DeviceInterface::GenericInterface
+                           << Solid::DeviceInterface::Processor
+                           << Solid::DeviceInterface::Block
+                           << Solid::DeviceInterface::StorageAccess
+                           << Solid::DeviceInterface::StorageDrive
+                           << Solid::DeviceInterface::OpticalDrive
+                           << Solid::DeviceInterface::StorageVolume
+                           << Solid::DeviceInterface::OpticalDisc
+                           << Solid::DeviceInterface::Camera
+                           << Solid::DeviceInterface::PortableMediaPlayer
+                           << Solid::DeviceInterface::NetworkInterface
+                           << Solid::DeviceInterface::AcAdapter
+                           << Solid::DeviceInterface::Battery
+                           << Solid::DeviceInterface::Button
+                           << Solid::DeviceInterface::AudioInterface
+                           << Solid::DeviceInterface::DvbInterface
+                           << Solid::DeviceInterface::Video
+                           << Solid::DeviceInterface::SerialInterface
+                           << Solid::DeviceInterface::SmartCardReader;
 }
 
 WmiManager::~WmiManager()
@@ -56,6 +76,16 @@
     delete d;
 }
 
+QString WmiManager::udiPrefix() const
+{
+    return QString(); //FIXME: We should probably use a prefix there... has to be tested on Windows
+}
+
+QSet<Solid::DeviceInterface::Type> WmiManager::supportedInterfaces() const
+{
+    return d->supportedInterfaces;
+}
+
 QStringList WmiManager::allDevices()
 {
     QStringList deviceUdiList;
Index: solid/solid/backends/kupnp/mediaserver3.h
===================================================================
--- solid/solid/backends/kupnp/mediaserver3.h	(révision 0)
+++ solid/solid/backends/kupnp/mediaserver3.h	(révision 0)
@@ -0,0 +1,68 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPnP_MEDIASERVER3_H
+#define SOLID_BACKENDS_KUPnP_MEDIASERVER3_H
+
+// KUPnP
+#include "kupnpdevice.h"
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+class MediaServer3Factory : public AbstractDeviceFactory
+{
+public:
+    MediaServer3Factory();
+
+public: // AbstractDeviceFactory API
+    virtual void addSupportedInterfaces( QSet<Solid::DeviceInterface::Type>& interfaces ) const;
+    virtual bool hasDeviceInterface( const UPnP::Device& device,
+                                     Solid::DeviceInterface::Type type ) const;
+    virtual QObject* tryCreateDevice( const UPnP::Device& device ) const;
+};
+
+
+class MediaServer3 : public KUPnPDevice
+{
+public:
+    explicit MediaServer3(const UPnP::Device& device);
+    virtual ~MediaServer3();
+
+public: // Solid::Ifaces::Device API
+    virtual QString icon() const;
+    virtual QString description() const;
+
+    virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type& type) const;
+    virtual QObject* createDeviceInterface(const Solid::DeviceInterface::Type& type);
+};
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/mediaserver3.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnpdeviceinterface.cpp
===================================================================
--- solid/solid/backends/kupnp/kupnpdeviceinterface.cpp	(révision 0)
+++ solid/solid/backends/kupnp/kupnpdeviceinterface.cpp	(révision 0)
@@ -0,0 +1,48 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kupnpdeviceinterface.h"
+
+// backend
+#include "kupnpdevice.h"
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+DeviceInterface::DeviceInterface(KUPnPDevice* device)
+  : QObject(device),
+    mDevice(device)
+{
+}
+
+DeviceInterface::~DeviceInterface()
+{
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/kupnpdeviceinterface.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnpdeviceinterface.h
===================================================================
--- solid/solid/backends/kupnp/kupnpdeviceinterface.h	(révision 0)
+++ solid/solid/backends/kupnp/kupnpdeviceinterface.h	(révision 0)
@@ -0,0 +1,58 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPNP_DEVICEINTERFACE_H
+#define SOLID_BACKENDS_KUPNP_DEVICEINTERFACE_H
+
+// Solid
+#include <solid/ifaces/deviceinterface.h>
+// Qt
+#include <QtCore/QObject>
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+class KUPnPDevice;
+
+
+class DeviceInterface : public QObject, virtual public Solid::Ifaces::DeviceInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(Solid::Ifaces::DeviceInterface)
+
+public:
+    DeviceInterface(KUPnPDevice* device);
+    virtual ~DeviceInterface();
+
+protected:
+    KUPnPDevice* mDevice;
+};
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/kupnpdeviceinterface.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnpstorageaccess.cpp
===================================================================
--- solid/solid/backends/kupnp/kupnpstorageaccess.cpp	(révision 0)
+++ solid/solid/backends/kupnp/kupnpstorageaccess.cpp	(révision 0)
@@ -0,0 +1,77 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kupnpstorageaccess.h"
+
+// backend
+#include "kupnpdevice.h"
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+StorageAccess::StorageAccess(KUPnPDevice* device)
+  : DeviceInterface(device)
+{
+}
+
+StorageAccess::~StorageAccess()
+{
+
+}
+
+
+bool StorageAccess::isAccessible() const
+{
+    return true;
+}
+
+QString StorageAccess::filePath() const
+{
+    QString result;
+
+    const UPnP::Device& device = mDevice->device();
+
+    result = QString::fromLatin1("upnp://%1:%2/")
+        .arg( device.ipAddress() ).arg( device.ipPortNumber() );
+
+    return result;
+}
+
+
+bool StorageAccess::setup()
+{
+    return true;
+}
+
+bool StorageAccess::teardown()
+{
+    return true;
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/kupnpstorageaccess.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnpstorageaccess.h
===================================================================
--- solid/solid/backends/kupnp/kupnpstorageaccess.h	(révision 0)
+++ solid/solid/backends/kupnp/kupnpstorageaccess.h	(révision 0)
@@ -0,0 +1,64 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPNP_STORAGEACCESS_H
+#define SOLID_BACKENDS_KUPNP_STORAGEACCESS_H
+
+// backend
+#include "kupnpdeviceinterface.h"
+// Solid
+#include <solid/ifaces/storageaccess.h>
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+class StorageAccess : public DeviceInterface, virtual public Solid::Ifaces::StorageAccess
+{
+    Q_OBJECT
+    Q_INTERFACES(Solid::Ifaces::StorageAccess)
+
+public:
+    explicit StorageAccess(KUPnPDevice* device);
+    virtual ~StorageAccess();
+
+public: // Solid::Ifaces::StorageAccess API
+    virtual bool isAccessible() const;
+    virtual QString filePath() const;
+    virtual bool setup();
+    virtual bool teardown();
+
+Q_SIGNALS: // Solid::Ifaces::StorageAccess API
+    void accessibilityChanged(bool accessible, const QString &udi);
+    void setupDone(Solid::ErrorType error, QVariant errorData, const QString &udi);
+    void teardownDone(Solid::ErrorType error, QVariant errorData, const QString &udi);
+};
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/kupnpstorageaccess.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/internetgatewaydevice1.cpp
===================================================================
--- solid/solid/backends/kupnp/internetgatewaydevice1.cpp	(révision 0)
+++ solid/solid/backends/kupnp/internetgatewaydevice1.cpp	(révision 0)
@@ -0,0 +1,88 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "internetgatewaydevice1.h"
+
+// Solid
+#include "kupnpstorageaccess.h"
+// Qt
+#include <QtCore/QSet>
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+InternetGatewayDevice1Factory::InternetGatewayDevice1Factory() {}
+
+
+QObject* InternetGatewayDevice1Factory::tryCreateDevice( const UPnP::Device& device ) const
+{
+    return ( device.type() == QLatin1String("InternetGatewayDevice1") ) ?
+        new InternetGatewayDevice1( device ) : 0;
+}
+
+
+
+InternetGatewayDevice1::InternetGatewayDevice1(const UPnP::Device& device)
+  : KUPnPDevice(device)
+{
+}
+
+InternetGatewayDevice1::~InternetGatewayDevice1()
+{
+}
+
+QString InternetGatewayDevice1::icon() const
+{
+    return QString::fromLatin1("network-server");
+}
+
+
+QString InternetGatewayDevice1::description() const
+{
+    return QObject::tr("UPnP Internet Gateway Device");
+}
+
+
+bool InternetGatewayDevice1::queryDeviceInterface(const Solid::DeviceInterface::Type &type) const
+{
+    Q_UNUSED( type );
+
+    bool result = false;
+
+    return result;
+}
+
+QObject* InternetGatewayDevice1::createDeviceInterface(const Solid::DeviceInterface::Type& type)
+{
+    Q_UNUSED( type );
+
+    DeviceInterface* interface = 0;
+
+    return interface;
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/internetgatewaydevice1.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnpdevice.cpp
===================================================================
--- solid/solid/backends/kupnp/kupnpdevice.cpp	(révision 0)
+++ solid/solid/backends/kupnp/kupnpdevice.cpp	(révision 0)
@@ -0,0 +1,206 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kupnpdevice.h"
+
+// Solid
+#include "kupnpstorageaccess.h"
+// Qt
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+
+#define QI18N(x) x
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+struct DeviceData
+{
+    const char* type;
+    const char* iconName;
+    const char* name;
+};
+
+static const
+DeviceData deviceData[] =
+{
+    {"BasicDevice1", "network-server", QI18N("UPnP Basic Device") },
+    {"WLANAccessPointDevice1", "network-wireless", QI18N("UPnP WLAN Access Point Device") },
+    {"PrinterBasic1", "printer", QI18N("UPnP Printer (Basic)") },
+    {"PrinterEnhanced1", "printer", QI18N("UPnP Printer (Enhanced)") },
+    {"Scanner1", "scanner", QI18N("UPnP Scanner") },
+    {"MediaRenderer1", "video-television", QI18N("UPnP Media Renderer") },
+    {"MediaRenderer2", "video-television", QI18N("UPnP Media Renderer") },
+    {"SolarProtectionBlind1", "device", QI18N("UPnP Solar Protection Blind") },
+    {"DigitalSecurityCamera1", "camera", QI18N("UPnP Digital Security Camera") },
+    {"HVAC1", "device", QI18N("UPnP HVAC") },
+    {"LightingControls1", "light", QI18N("UPnP Lighting Controls") },
+    {"RemoteUIClientDevice1", "device", QI18N("UPnP Remote UI Client") },
+    {"RemoteUIServerDevice1", "device", QI18N("UPnP Remote UI Server") },
+    {"RAClient1", "device", QI18N("UPnP Remote Access Client") },
+    {"RAServer1", "device", QI18N("UPnP Remote Access Server") },
+    {"RADiscoveryAgent1", "device", QI18N("UPnP Remote Access Discovery Agent") },
+    {"Unknown", "device", QI18N("Unknown UPnP Device") },
+    {"LANDevice1", "network-wired", QI18N("UPnP LAN Device") },
+    {"WANDevice1", "network-wired", QI18N("UPnP WAN Device") },
+    {"WANConnectionDevice1", "network-wired", QI18N("UPnP WAN Connection Device") },
+    {"WFADevice1", "network-wireless", QI18N("UPnP Wi-Fi Alliance Device") }
+};
+
+
+static const int deviceDataCount = sizeof(deviceData) / sizeof(deviceData[0]);
+
+
+AbstractDeviceFactory::~AbstractDeviceFactory() {}
+
+DeviceFactory::DeviceFactory() {}
+
+void AbstractDeviceFactory::addSupportedInterfaces( QSet<Solid::DeviceInterface::Type>& interfaces ) const
+{
+    Q_UNUSED( interfaces );
+}
+
+bool AbstractDeviceFactory:: hasDeviceInterface( const UPnP::Device& device,
+                                         Solid::DeviceInterface::Type type ) const
+{
+    Q_UNUSED( device );
+    Q_UNUSED( type );
+
+    return false;
+}
+
+QObject* DeviceFactory::tryCreateDevice( const UPnP::Device& device ) const
+{
+    return new KUPnPDevice( device );
+}
+
+
+KUPnPDevice::KUPnPDevice(const UPnP::Device& device)
+  : Device(),
+    mDevice(device),
+    mParentDevice(0)
+{
+}
+
+KUPnPDevice::~KUPnPDevice()
+{
+    delete mParentDevice;
+}
+
+QString KUPnPDevice::udi() const
+{
+    return QString::fromLatin1("/org/kde/KUPnP/%1").arg( mDevice.udn() );
+}
+
+QString KUPnPDevice::parentUdi() const
+{
+    const QString result =
+        mDevice.hasParentDevice() ?
+            QString::fromLatin1("/org/kde/KUPnP/%1").arg( mDevice.parentUdn() ) :
+            QString::fromLatin1("/org/kde/KUPnP");
+
+    return result;
+}
+
+QString KUPnPDevice::vendor() const
+{
+    return QString("UPnP vendor"); // TODO: expose vendor in UPnP::Device
+}
+
+QString KUPnPDevice::product() const
+{
+    return mDevice.displayName(); // TODO: expose product in UPnP::Device
+}
+
+QString KUPnPDevice::icon() const
+{
+    const char* result;
+
+    const QString type = mDevice.type();
+    int i = 0;
+    for (;i<deviceDataCount; ++i ) {
+        const DeviceData& data = deviceData[i];
+        if (type == QLatin1String(data.type)) {
+            result = data.iconName;
+            break;
+        }
+    }
+    if (i==deviceDataCount) {
+        result = "network-server";
+    }
+
+    return QString::fromLatin1(result);
+}
+
+QStringList KUPnPDevice::emblems() const
+{
+    QStringList result;
+#if 0
+    if (queryDeviceInterface(Solid::DeviceInterface::StorageAccess)) {
+        bool isEncrypted = property("volume.fsusage").toString()=="crypto";
+
+        const Hal::StorageAccess accessIface(const_cast<KUPnPDevice *>(this));
+        if (accessIface.isAccessible()) {
+            if (isEncrypted) {
+                result << "emblem-encrypted-unlocked";
+            } else {
+                result << "emblem-mounted";
+            }
+        } else {
+            if (isEncrypted) {
+                result << "emblem-encrypted-locked";
+            } else {
+                result << "emblem-unmounted";
+            }
+        }
+    }
+#endif
+    return result;
+}
+
+QString KUPnPDevice::description() const
+{
+    return mDevice.displayName();
+}
+
+
+bool KUPnPDevice::queryDeviceInterface(const Solid::DeviceInterface::Type& type) const
+{
+    Q_UNUSED( type );
+
+    return false;
+}
+
+QObject* KUPnPDevice::createDeviceInterface(const Solid::DeviceInterface::Type& type)
+{
+    Q_UNUSED( type );
+
+    return 0;
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/kupnpdevice.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/internetgatewaydevice1.h
===================================================================
--- solid/solid/backends/kupnp/internetgatewaydevice1.h	(révision 0)
+++ solid/solid/backends/kupnp/internetgatewaydevice1.h	(révision 0)
@@ -0,0 +1,65 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPNP_INTERNETGATEWAYDEVICE1_H
+#define SOLID_BACKENDS_KUPNP_INTERNETGATEWAYDEVICE1_H
+
+// KUPnP
+#include "kupnpdevice.h"
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+class InternetGatewayDevice1Factory : public AbstractDeviceFactory
+{
+public:
+    InternetGatewayDevice1Factory();
+
+public: // AbstractDeviceFactory API
+    virtual QObject* tryCreateDevice( const UPnP::Device& device ) const;
+};
+
+
+class InternetGatewayDevice1 : public KUPnPDevice
+{
+public:
+    explicit InternetGatewayDevice1(const UPnP::Device& device);
+    virtual ~InternetGatewayDevice1();
+
+public: // Solid::Ifaces::Device API
+    virtual QString icon() const;
+    virtual QString description() const;
+
+    virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type& type) const;
+    virtual QObject* createDeviceInterface(const Solid::DeviceInterface::Type& type);
+};
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/internetgatewaydevice1.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnprootdevice.cpp
===================================================================
--- solid/solid/backends/kupnp/kupnprootdevice.cpp	(révision 0)
+++ solid/solid/backends/kupnp/kupnprootdevice.cpp	(révision 0)
@@ -0,0 +1,90 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kupnprootdevice.h"
+
+// Qt
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+
+#define QI18N(x) x
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+KUPnPRootDevice::KUPnPRootDevice()
+  : Solid::Ifaces::Device()
+{
+}
+
+KUPnPRootDevice::~KUPnPRootDevice()
+{
+}
+
+QString KUPnPRootDevice::udi() const
+{
+    return QString::fromLatin1("/org/kde/KUPnP");
+}
+
+QString KUPnPRootDevice::parentUdi() const { return QString(); }
+QString KUPnPRootDevice::vendor() const { return QString(); }
+
+QString KUPnPRootDevice::product() const
+{
+    return QObject::tr("UPnP devices");
+}
+
+QString KUPnPRootDevice::icon() const
+{
+    return QString::fromLatin1("network-server");
+}
+
+QStringList KUPnPRootDevice::emblems() const
+{
+    return QStringList();
+}
+
+QString KUPnPRootDevice::description() const
+{
+    return QString();
+}
+
+
+bool KUPnPRootDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type) const
+{
+    Q_UNUSED( type );
+    return false;
+}
+
+QObject* KUPnPRootDevice::createDeviceInterface(const Solid::DeviceInterface::Type& type)
+{
+    Q_UNUSED( type );
+    return 0;
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/kupnprootdevice.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnpdevice.h
===================================================================
--- solid/solid/backends/kupnp/kupnpdevice.h	(révision 0)
+++ solid/solid/backends/kupnp/kupnpdevice.h	(révision 0)
@@ -0,0 +1,99 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPnP_KUPNPDEVICE_H
+#define SOLID_BACKENDS_KUPnP_KUPNPDEVICE_H
+
+// KUPnP
+#include "lib/device.h"
+// Solid
+#include <solid/ifaces/device.h>
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+class AbstractDeviceFactory
+{
+public:
+    virtual ~AbstractDeviceFactory();
+
+public:
+    virtual void addSupportedInterfaces( QSet<Solid::DeviceInterface::Type>& interfaces ) const;
+    virtual bool hasDeviceInterface( const UPnP::Device& device,
+                                     Solid::DeviceInterface::Type type ) const;
+    virtual QObject* tryCreateDevice( const UPnP::Device& device ) const = 0;
+};
+
+
+class DeviceFactory : public AbstractDeviceFactory
+{
+public:
+    DeviceFactory();
+
+public: // AbstractDeviceFactory API
+    virtual QObject* tryCreateDevice( const UPnP::Device& device ) const;
+};
+
+
+class KUPnPDevice : public Solid::Ifaces::Device
+{
+    Q_OBJECT
+
+public:
+    explicit KUPnPDevice(const UPnP::Device& device);
+    virtual ~KUPnPDevice();
+
+public: // Solid::Ifaces::Device API
+    virtual QString udi() const;
+    virtual QString parentUdi() const;
+
+    virtual QString vendor() const;
+    virtual QString product() const;
+    virtual QString icon() const;
+    virtual QStringList emblems() const;
+    virtual QString description() const;
+
+    virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type& type) const;
+    virtual QObject* createDeviceInterface(const Solid::DeviceInterface::Type& type);
+
+public:
+    const UPnP::Device& device() const;
+
+protected:
+    UPnP::Device mDevice;
+
+    KUPnPDevice* mParentDevice;
+};
+
+
+inline const UPnP::Device& KUPnPDevice::device() const { return mDevice; }
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/kupnpdevice.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/device.cpp
===================================================================
--- solid/solid/backends/kupnp/lib/device.cpp	(révision 0)
+++ solid/solid/backends/kupnp/lib/device.cpp	(révision 0)
@@ -0,0 +1,73 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "device.h"
+#include "device_p.h"
+
+
+namespace UPnP
+{
+
+Device::Device()
+  : d( new DevicePrivate() )
+{}
+
+Device::Device( DevicePrivate* _d )
+  : d( _d )
+{
+}
+
+Device::Device( const Device& other )
+  : d( other.d )
+{
+}
+
+
+QString Device::udn() const { return d->udn(); }
+QString Device::displayName() const { return d->displayName(); }
+QString Device::type() const { return d->type(); }
+QList<Service> Device::services() const { return d->services(); }
+QString Device::ipAddress() const { return d->ipAddress(); }
+int Device::ipPortNumber() const { return d->ipPortNumber(); }
+QString Device::presentationUrl() const { return d->presentationUrl(); }
+Device Device::parentDevice() const { return d->parentDevice(); }
+QString Device::parentUdn() const { return d->parentUdn(); }
+QList<Device> Device::childDevices() const { return d->childDevices(); }
+bool Device::hasParentDevice() const { return d->hasParentDevice(); }
+bool Device::isValid() const { return d->isValid(); }
+
+Device& Device::operator =( const Device& other )
+{
+    d = other.d;
+    return *this;
+}
+
+bool Device::operator==( const Device& other ) const
+{
+    return ( d == other.d );
+}
+
+Device::~Device()
+{
+}
+
+}

Modification de propriétés sur solid/solid/backends/kupnp/lib/device.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/org.Coherence.xml
===================================================================
--- solid/solid/backends/kupnp/lib/org.Coherence.xml	(révision 0)
+++ solid/solid/backends/kupnp/lib/org.Coherence.xml	(révision 0)
@@ -0,0 +1,116 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<!--
+  This file is part of ?
+  Found by introspection output via qdbusviewer
+
+  License
+-->
+
+<node>
+    <interface name="org.Coherence">
+        <method name="pin">
+            <arg direction="in" type="s" name="key" />
+            <arg direction="in" type="v" name="value" />
+        </method>
+        <method name="create_oob">
+            <arg direction="in" type="s" name="file" />
+            <arg direction="out" type="s" />
+        </method>
+        <signal name="DMR_added">
+            <arg type="v" name="device" />
+            <arg type="s" name="udn" />
+        </signal>
+        <method name="import_resource">
+            <arg direction="in" type="s" name="device_id" />
+            <arg direction="in" type="s" name="source_uri" />
+            <arg direction="in" type="s" name="destination_uri" />
+            <arg direction="out" type="v" />
+        </method>
+        <signal name="DMS_added">
+            <arg type="v" name="device" />
+            <arg type="s" name="udn" />
+        </signal>
+        <method name="get_device_with_id">
+            <arg direction="in" type="s" name="id" />
+            <arg direction="out" type="v" />
+        </method>
+        <method name="get_devices_async">
+            <arg direction="out" type="av" />
+        </method>
+        <method name="put_resource">
+            <arg direction="in" type="s" name="destination_uri" />
+            <arg direction="in" type="s" name="filepath" />
+            <arg direction="out" type="v" />
+        </method>
+        <method name="hostname">
+            <arg direction="out" type="s" />
+        </method>
+        <method name="version">
+            <arg direction="out" type="s" />
+        </method>
+        <signal name="DMS_removed">
+            <arg type="s" name="udn" />
+        </signal>
+        <signal name="UPnP_ControlPoint_MediaServer_removed">
+            <arg type="s" name="udn" />
+        </signal>
+        <method name="create_object">
+            <arg direction="in" type="s" name="device_id" /> 
+            <arg direction="in" type="s" name="container_id" /> 
+            <arg direction="in" type="a{ss}" name="arguments" /> 
+            <arg direction="out" type="v" />
+            <annotation name="com.trolltech.QtDBus.QtTypeName.In2" value="QVariantMap"/>
+        </method> 
+        <signal name="DMR_removed">
+            <arg type="s" name="udn" />
+        </signal>
+        <method name="remove_plugin">
+            <arg direction="in" type="s" name="uuid" />
+            <arg direction="out" type="s" />
+        </method>
+        <signal name="UPnP_ControlPoint_MediaRenderer_detected">
+            <arg type="v" name="device" />
+            <arg type="s" name="udn" />
+        </signal>
+        <method name="add_plugin">
+            <arg direction="in" type="s" name="backend" />
+            <arg direction="in" type="a{ss}" name="arguments" />
+            <arg direction="out" type="s" />
+            <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QVariantMap"/>
+        </method>
+        <signal name="UPnP_ControlPoint_MediaServer_detected">
+            <arg type="v" name="device" />
+            <arg type="s" name="udn" />
+        </signal>
+        <method name="call_plugin">
+            <arg direction="in" type="s" name="uuid" />
+            <arg direction="in" type="s" name="method" />
+            <arg direction="in" type="a{ss}" name="arguments" />
+            <arg direction="out" type="s" />
+            <annotation name="com.trolltech.QtDBus.QtTypeName.In2" value="QVariantMap"/>
+        </method> 
+        <method name="get_devices">
+            <arg direction="out" type="av" />
+        </method>
+        <signal name="UPnP_ControlPoint_MediaRenderer_removed">
+            <arg type="s" name="udn" />
+        </signal>
+        <signal name="device_removed">
+            <arg type="s" name="udn" />
+        </signal>
+        <method name="unpin">
+            <arg direction="in" type="s" name="key" />
+        </method>
+        <signal name="device_detected">
+            <arg type="v" name="device" />
+            <arg type="s" name="udn" />
+        </signal>
+        <method name="get_pin">
+            <arg direction="in" type="s" name="key" />
+            <arg direction="out" type="v" />
+        </method>
+    </interface>
+</node>
Index: solid/solid/backends/kupnp/lib/service.cpp
===================================================================
--- solid/solid/backends/kupnp/lib/service.cpp	(révision 0)
+++ solid/solid/backends/kupnp/lib/service.cpp	(révision 0)
@@ -0,0 +1,61 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "service.h"
+#include "service_p.h"
+
+
+namespace UPnP
+{
+
+Service::Service()
+  : d( new ServicePrivate() ) // TODO: would a static default null object increase performance?
+{}
+
+Service::Service( ServicePrivate* _d )
+  : d( _d )
+{
+}
+
+Service::Service( const Service& other )
+  : d( other.d )
+{
+}
+
+// QString Service::udn() const { return d->udn(); }
+Device Service::device() const { return d->device(); }
+
+QString Service::displayName() const { return d->displayName(); }
+QString Service::type() const  { return d->type(); }
+
+
+Service& Service::operator =( const Service& other )
+{
+    d = other.d;
+    return *this;
+}
+
+Service::~Service()
+{
+}
+
+}

Modification de propriétés sur solid/solid/backends/kupnp/lib/service.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/devicebrowser_p.cpp
===================================================================
--- solid/solid/backends/kupnp/lib/devicebrowser_p.cpp	(révision 0)
+++ solid/solid/backends/kupnp/lib/devicebrowser_p.cpp	(révision 0)
@@ -0,0 +1,290 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009-2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+    Copyright 2009 Adriaan de Groot <groot@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 argument proxy defined in Section 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received argument copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "devicebrowser_p.h"
+
+// lib
+#include "device_p.h"
+#include "service_p.h"
+// Qt
+#include <QtDBus/QDBusArgument>
+
+#include <QtCore/QDebug>
+
+namespace UPnP
+{
+
+static const char requiredCoherenceVersionString[] = "0.6.5";
+static const int requiredCoherenceVersion[] = {0,6,5};
+static const int requiredCoherenceVersionLength =
+    sizeof(requiredCoherenceVersion) / sizeof(requiredCoherenceVersion[0]);
+
+
+static bool checkVersion( const QString& coherenceVersionString )
+{
+    const QStringList coherenceVersionParts = coherenceVersionString.split( '.' );
+
+    for( int i=0; i<requiredCoherenceVersionLength; ++i )
+    {
+        const int versionPart = coherenceVersionParts[i].toInt();
+        if( requiredCoherenceVersion[i] < versionPart )
+            break;
+
+        if( requiredCoherenceVersion[i] > versionPart )
+        {
+qDebug() << "Coherence version" << coherenceVersionString << "is not ok,"
+         << requiredCoherenceVersionString << "required." << endl;
+            return false;
+        }
+    }
+qDebug() << "Coherence version" << coherenceVersionString << "is ok.";
+
+    return true;
+}
+
+QList<UPnP::Service> DeviceBrowserPrivate::demarshallServices( const Device& device, const QVariant& variant )
+{
+    QList<UPnP::Service> result;
+
+    const QStringList serviceDBusPathList = variant.value<QStringList>();
+    foreach( const QString& serviceDBusPath, serviceDBusPathList )
+    {
+        const QString typeName = serviceDBusPath.mid( serviceDBusPath.lastIndexOf('/')+1 );
+
+        ServicePrivate* servicePrivate = new ServicePrivate();
+        servicePrivate->setDevice( device );
+        servicePrivate->setDisplayName( typeName );
+        servicePrivate->setType( typeName );
+        servicePrivate->setDBusPath( serviceDBusPath );
+
+        result.append( Service(servicePrivate) );
+    }
+
+    return result;
+}
+
+Device DeviceBrowserPrivate::addDevice( const QDBusArgument& dBusArgument )
+{
+    DevicePrivate* devicePrivate = new DevicePrivate();
+    Device device( devicePrivate );
+
+    QString parentUdn;
+
+    dBusArgument.beginMap();
+    while( ! dBusArgument.atEnd() )
+    {
+        dBusArgument.beginMapEntry();
+        QString key;
+        QDBusVariant dBusVariant;
+        dBusArgument >> key >> dBusVariant;
+        const QVariant variant = dBusVariant.variant();
+
+        if( key == QLatin1String("udn") )
+        {
+            const QString uuid = variant.value<QString>().mid( 5 );
+            devicePrivate->setUdn( uuid );
+        }
+        else if( key == QLatin1String("friendly_name") )
+            devicePrivate->setDisplayName( variant.value<QString>() );
+        else if( key == QLatin1String("parent_udn") )
+            parentUdn = variant.value<QString>().mid( 5 );
+        else if( key == QLatin1String("device_type") )
+        {
+            const QStringList typeParts = variant.value<QString>().split( ':' );
+            devicePrivate->setType( typeParts[3]+typeParts[4] );
+        }
+        else if( key == QLatin1String("path") )
+            devicePrivate->setDBusPath( variant.value<QString>() );
+        else if( key == QLatin1String("presentation_url") )
+            devicePrivate->setPresentationUrl( variant.value<QString>() );
+        else if( key == QLatin1String("uri") )
+        {
+            const QString hostAddressAndPort = variant.value<QStringList>()[1];
+            const int indexOfSeparator = hostAddressAndPort.indexOf( ':' );
+            const QString hostAddress = hostAddressAndPort.left( indexOfSeparator );
+            const int portNumber = hostAddressAndPort.mid( indexOfSeparator+1 ).toInt();
+            devicePrivate->setIpAddress( hostAddress );
+            devicePrivate->setIpPortNumber( portNumber );
+        }
+        else if( key == QLatin1String("services") )
+        {
+            QList<Service> services = demarshallServices( device, variant );
+            devicePrivate->setServices( services );
+        }
+//         else
+        {
+            if( variant.canConvert<QString>())
+            {
+                const QString value = variant.value<QString>();
+qDebug() << "  " << key << value;
+            }
+            else
+            {
+qDebug() << "  " << key << "-not argument string-";
+            }
+        }
+        dBusArgument.endMapEntry();
+    }
+    dBusArgument.endMap();
+
+    const QString& udn = devicePrivate->udn();
+    if( udn.isEmpty() )
+    {
+qDebug()<<"No udn found!";
+        devicePrivate->setInvalid();
+    }
+    else if( mDevices.contains(udn) )
+    {
+qDebug()<<"Already inserted:"<<udn<<"!";
+        devicePrivate->setInvalid();
+    }
+    else if( ! mBrowsedDeviceTypes.isEmpty() && ! mBrowsedDeviceTypes.contains(devicePrivate->type()) )
+    {
+qDebug()<<"Not interested in:"<<devicePrivate->type();
+        devicePrivate->setInvalid();
+    }
+    else
+    {
+qDebug()<<"Adding: "<<device.displayName()<<udn;
+        mDevices[udn] = device;
+
+        if( ! parentUdn.isEmpty() )
+        {
+            devicePrivate->setParentUdn(parentUdn);
+            if( mDevices.contains(parentUdn) )
+            {
+                devicePrivate->setParentDevice( mDevices[parentUdn].dPtr() );
+                // TODO: else set to pending devices waiting for their parent device streamed
+                // but how to find about orphaned devices? might increase by time if the backend is broken
+                // what to do if devices browsed are filtered? set a flag like wouldHaveParent?
+            }
+        }
+    }
+
+    return device;
+}
+
+
+
+void DeviceBrowserPrivate::init()
+{
+qDebug() << "Connecting to Coherence...";
+
+    // TODO: or use system bus?
+    mCoherence = new org::Coherence( "org.Coherence", "/org/Coherence", QDBusConnection::sessionBus()/*systemBus*/, q );
+
+    QDBusPendingReply<QString> versionReply = mCoherence->version();
+    versionReply.waitForFinished();
+    if( versionReply.isError() )
+    {
+qDebug()<< versionReply.error();
+        return;
+    }
+
+    const QString version = versionReply.value();
+
+    const bool versionOk = checkVersion( version );
+    if( ! versionOk )
+        return;
+
+    connect( mCoherence, SIGNAL(device_detected( const QDBusVariant&, const QString& )),
+             SLOT(onDeviceAdded( const QDBusVariant&, const QString& )) );
+
+    connect( mCoherence, SIGNAL(device_removed(const QString& )),
+             SLOT(onDeviceRemoved( const QString& )) );
+
+    QDBusPendingReply<QVariantList> devicesReply = mCoherence->get_devices();
+    devicesReply.waitForFinished();
+    if( devicesReply.isError() )
+    {
+qDebug()<< devicesReply.error();
+        return;
+    }
+
+qDebug()<< "Current devices...";
+    QVariantList devicesReplyValue = devicesReply.value();
+    foreach( const QVariant& devicesReplyValueItem, devicesReplyValue )
+    {
+        const QVariant variant = qvariant_cast<QDBusVariant>( devicesReplyValueItem ).variant();
+        const QDBusArgument dBusArgument = variant.value<QDBusArgument>();
+        addDevice( dBusArgument );
+    }
+qDebug()<<"That's all.";
+}
+
+QList<Device> DeviceBrowserPrivate::devices() const
+{
+    QList<Device> result;
+
+    QHashIterator<QString,Device> it( mDevices);
+    while( it.hasNext() )
+    {
+        it.next();
+        result.append( it.value() );
+    }
+
+    return result;
+}
+
+Device DeviceBrowserPrivate::device( const QString& udn ) const
+{
+    return mDevices.contains(udn) ? mDevices[udn] : Device();
+}
+
+void DeviceBrowserPrivate::onDeviceAdded( const QDBusVariant& dBusVariant, const QString& udn )
+{
+    Q_UNUSED( udn );
+
+    const QVariant variant = dBusVariant.variant();
+    const QDBusVariant sv = variant.value<QDBusVariant>();
+    const QVariant v = sv.variant();
+    const QDBusArgument dBusArgument = v.value<QDBusArgument>();
+
+    Device device = addDevice( dBusArgument );
+    if( device.isValid() )
+        emit q->deviceAdded( device );
+}
+
+void DeviceBrowserPrivate::onDeviceRemoved( const QString& _udn )
+{
+    const QString udn = _udn.mid( 5 );
+    QHash<QString,Device>::Iterator it = mDevices.find( udn );
+    if( it != mDevices.end() )
+    {
+        Device device = it.value();
+        mDevices.erase( it );
+qDebug() << "Removing"<<device.displayName();
+        emit q->deviceRemoved( device );
+    }
+    else
+qDebug() << "Not found in device list:"<<udn;
+}
+
+
+DeviceBrowserPrivate::~DeviceBrowserPrivate()
+{
+    delete mCoherence;
+}
+
+
+}

Modification de propriétés sur solid/solid/backends/kupnp/lib/devicebrowser_p.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/device_p.h
===================================================================
--- solid/solid/backends/kupnp/lib/device_p.h	(révision 0)
+++ solid/solid/backends/kupnp/lib/device_p.h	(révision 0)
@@ -0,0 +1,155 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UPNP_DEVICE_P_H
+#define UPNP_DEVICE_P_H
+
+// lib
+#include "device.h"
+#include "service.h"
+// Qt
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QSharedData>
+
+
+namespace UPnP
+{
+
+class DevicePrivate : public QSharedData
+{
+  public:
+    DevicePrivate();
+
+    ~DevicePrivate();
+
+  public:
+    const QString& udn() const;
+    const QString& displayName() const;
+    const QString& type() const;
+    const QString& ipAddress() const;
+    int ipPortNumber() const;
+    const QString& presentationUrl() const;
+    const QString& dBusPath() const;
+    const QList<Service>& services() const;
+    Device parentDevice() const;
+    const QString& parentUdn() const;
+    const QList<Device>& childDevices() const;
+
+    bool hasParentDevice() const;
+    bool isValid() const;
+
+  public:
+    void setUdn( const QString& udn );
+    void setType( const QString& deviceType );
+    void setDisplayName( const QString& displayName );
+    void setIpAddress( const QString& ipAddress );
+    void setIpPortNumber( int portNumber );
+    void setPresentationUrl( const QString& presentationUrl );
+    void setDBusPath( const QString& dBusPath );
+    void setServices( const QList<Service>& services );
+    void setParentDevice( DevicePrivate* parentDevicePrivate );
+    void setParentUdn( const QString& parentUdn );
+
+    void setInvalid();
+
+    void addChildDevice( DevicePrivate* childDevice );
+    void removeChildDevice( DevicePrivate* childDevice );
+
+  protected:
+    // TODO: could just be a QByteArray
+    QString mUdn;
+    QString mDeviceType;
+    QString mDisplayName;
+    QString mIpAddress;
+    int mPortNumber;
+    QString mPresentationUrl;
+    QString mDBusPath;
+    QString mParentUdn;
+
+    QList<Service> mServices;
+
+    //just pointer to private to avoid circular refcounting
+    DevicePrivate* mParentDevicePrivate;
+    QList<Device> mChildDevices;
+};
+
+
+inline DevicePrivate::DevicePrivate()
+ : mParentDevicePrivate( 0 )
+{}
+
+inline const QString& DevicePrivate::udn() const { return mUdn; }
+inline const QString& DevicePrivate::type() const { return mDeviceType; }
+inline const QString& DevicePrivate::displayName() const { return mDisplayName; }
+inline const QString& DevicePrivate::ipAddress() const { return mIpAddress; }
+inline int DevicePrivate::ipPortNumber() const { return mPortNumber; }
+inline const QString& DevicePrivate::presentationUrl() const { return mPresentationUrl; }
+inline const QString& DevicePrivate::dBusPath() const { return mDBusPath; }
+inline const QList<Service>& DevicePrivate::services() const { return mServices; }
+inline Device DevicePrivate::parentDevice() const { return Device(mParentDevicePrivate); }
+inline const QString& DevicePrivate::parentUdn() const { return mParentUdn; }
+inline const QList<Device>& DevicePrivate::childDevices() const { return mChildDevices; }
+inline bool DevicePrivate::hasParentDevice() const
+{
+    return (mParentDevicePrivate != 0) || !mParentUdn.isEmpty() ;
+}
+inline bool DevicePrivate::isValid() const { return ! mUdn.isEmpty(); }
+
+inline void DevicePrivate::setUdn( const QString& udn ) { mUdn = udn; }
+inline void DevicePrivate::setType( const QString& deviceType ) { mDeviceType = deviceType; }
+inline void DevicePrivate::setDisplayName( const QString& displayName ) { mDisplayName = displayName; }
+inline void DevicePrivate::setIpAddress( const QString& ipAddress ) { mIpAddress = ipAddress; }
+inline void DevicePrivate::setIpPortNumber( int portNumber ) { mPortNumber = portNumber; }
+inline void DevicePrivate::setPresentationUrl( const QString& presentationUrl ) { mPresentationUrl = presentationUrl; }
+inline void DevicePrivate::setDBusPath( const QString& dBusPath ) { mDBusPath = dBusPath; }
+inline void DevicePrivate::setServices( const QList<Service>& services ) { mServices = services; }
+inline void DevicePrivate::setParentDevice( DevicePrivate* parentDevicePrivate )
+{
+    mParentDevicePrivate = parentDevicePrivate;
+    if( mParentDevicePrivate )
+        mParentDevicePrivate->addChildDevice( this );
+}
+inline void DevicePrivate::setParentUdn( const QString& parentUdn ) { mParentUdn = parentUdn; }
+
+inline void DevicePrivate::setInvalid() { mUdn.clear(); }
+
+inline void DevicePrivate::addChildDevice( DevicePrivate* childDevice )
+{
+    mChildDevices.append( Device(childDevice) );
+}
+inline void DevicePrivate::removeChildDevice( DevicePrivate* childDevice )
+{
+    mChildDevices.removeOne( Device(childDevice) );
+}
+
+inline DevicePrivate::~DevicePrivate()
+{
+    if( mParentDevicePrivate )
+        mParentDevicePrivate->removeChildDevice( this );
+    foreach( const Device& device, mChildDevices )
+        device.dPtr()->setParentDevice( 0 );
+}
+
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/lib/device_p.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/devicebrowser.cpp
===================================================================
--- solid/solid/backends/kupnp/lib/devicebrowser.cpp	(révision 0)
+++ solid/solid/backends/kupnp/lib/devicebrowser.cpp	(révision 0)
@@ -0,0 +1,63 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "devicebrowser.h"
+#include "devicebrowser_p.h"
+
+
+namespace UPnP
+{
+
+DeviceBrowser::DeviceBrowser( const QStringList& deviceTypes, QObject* parent )
+  : QObject( parent ),
+    d( new DeviceBrowserPrivate(this,deviceTypes) )
+{
+    d->init();
+}
+DeviceBrowser::DeviceBrowser( const QString& deviceType, QObject* parent )
+  : QObject( parent ),
+    d( new DeviceBrowserPrivate(this,deviceType) )
+{
+    d->init();
+}
+
+QList<Device> DeviceBrowser::devices() const
+{
+    return d->devices();
+}
+
+Device DeviceBrowser::device( const QString& udn ) const
+{
+    return d->device( udn );
+}
+
+QStringList DeviceBrowser::browsedDeviceTypes() const
+{
+    return d->browsedDeviceTypes();
+}
+
+DeviceBrowser::~DeviceBrowser()
+{
+    delete d;
+}
+
+}

Modification de propriétés sur solid/solid/backends/kupnp/lib/devicebrowser.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/device.h
===================================================================
--- solid/solid/backends/kupnp/lib/device.h	(révision 0)
+++ solid/solid/backends/kupnp/lib/device.h	(révision 0)
@@ -0,0 +1,87 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UPNP_DEVICE_H
+#define UPNP_DEVICE_H
+
+// lib
+#include "upnp_export.h"
+// Qt
+#include <QtCore/QExplicitlySharedDataPointer>
+
+template<class T> class QList;
+
+
+namespace UPnP
+{
+class DevicePrivate;
+class Service;
+
+
+class KUPNP_EXPORT Device
+{
+  friend class ServicePrivate;
+  friend class DevicePrivate;
+  friend class DeviceBrowserPrivate;
+
+  protected:
+    explicit Device( DevicePrivate* d );
+
+  public:
+    Device();
+    Device( const Device& other );
+
+    virtual ~Device();
+
+  public:
+    /// without the prefix "uuid:"
+    QString udn() const;
+    QString displayName() const;
+    QString type() const;
+    QString ipAddress() const;
+    int ipPortNumber() const;
+    QString presentationUrl() const;
+    QList<Service> services() const;
+    Device parentDevice() const;
+    QString parentUdn() const;
+    QList<Device> childDevices() const;
+
+    bool hasParentDevice() const;
+    bool isValid() const;
+
+  public:
+    Device& operator =( const Device& other );
+    bool operator==( const Device& other ) const;
+
+  private:
+    DevicePrivate* dPtr() const;
+
+  protected:
+    QExplicitlySharedDataPointer<DevicePrivate> d;
+};
+
+
+inline  DevicePrivate* Device::dPtr() const { return const_cast<DevicePrivate*>( d.data() ); }
+
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/lib/device.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/service_p.h
===================================================================
--- solid/solid/backends/kupnp/lib/service_p.h	(révision 0)
+++ solid/solid/backends/kupnp/lib/service_p.h	(révision 0)
@@ -0,0 +1,81 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UPNP_SERVICE_P_H
+#define UPNP_SERVICE_P_H
+
+// lib
+#include "service.h"
+#include "device.h"
+// Qt
+#include <QtCore/QString>
+#include <QtCore/QSharedData>
+
+
+namespace UPnP
+{
+
+class ServicePrivate : public QSharedData
+{
+  public:
+    ServicePrivate();
+
+    ~ServicePrivate();
+
+  public:
+    const Device& device() const;
+    const QString& displayName() const;
+    const QString& type() const;
+    const QString& dBusPath() const;
+
+  public:
+    void setDevice( const Device& device );
+    void setDisplayName( const QString& displayName );
+    void setType( const QString& type );
+    void setDBusPath( const QString& dBusPath );
+
+  protected:
+    Device mDevice;
+
+    QString mDisplayName;
+    QString mType;
+    QString mDBusPath;
+};
+
+
+inline ServicePrivate::ServicePrivate() {}
+
+inline const Device& ServicePrivate::device() const { return mDevice; }
+inline const QString& ServicePrivate::displayName() const { return mDisplayName; }
+inline const QString& ServicePrivate::type() const { return mType; }
+inline const QString& ServicePrivate::dBusPath() const { return mDBusPath; }
+
+inline void ServicePrivate::setDevice( const Device& device ) { mDevice = device; }
+inline void ServicePrivate::setDisplayName( const QString& displayName ) { mDisplayName = displayName; }
+inline void ServicePrivate::setType( const QString& type ) { mType = type; }
+inline void ServicePrivate::setDBusPath( const QString& dBusPath ) { mDBusPath = dBusPath; }
+
+inline ServicePrivate::~ServicePrivate() {}
+
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/lib/service_p.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/service.h
===================================================================
--- solid/solid/backends/kupnp/lib/service.h	(révision 0)
+++ solid/solid/backends/kupnp/lib/service.h	(révision 0)
@@ -0,0 +1,74 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UPNP_SERVICE_H
+#define UPNP_SERVICE_H
+
+// lib
+#include "upnp_export.h"
+// #include "device.h"
+// Qt
+#include <QtCore/QExplicitlySharedDataPointer>
+
+
+namespace UPnP
+{
+class ServicePrivate;
+class Device;
+
+
+class KUPNP_EXPORT Service
+{
+  friend class ServicePrivate;
+  friend class DeviceBrowserPrivate;
+
+  protected:
+    explicit Service( ServicePrivate* d );
+
+  public:
+    Service();
+    Service( const Service& other );
+
+    virtual ~Service();
+
+  public:
+//     QString udn() const;
+    QString displayName() const;
+    QString type() const;
+    Device device() const;
+
+  public:
+    Service& operator =( const Service& other );
+
+  private:
+    ServicePrivate* dPtr() const;
+
+  protected:
+    QExplicitlySharedDataPointer<ServicePrivate> d;
+};
+
+
+inline  ServicePrivate* Service::dPtr() const { return const_cast<ServicePrivate*>( d.data() ); }
+
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/lib/service.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/devicebrowser_p.h
===================================================================
--- solid/solid/backends/kupnp/lib/devicebrowser_p.h	(révision 0)
+++ solid/solid/backends/kupnp/lib/devicebrowser_p.h	(révision 0)
@@ -0,0 +1,89 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UPNP_DEVICEBROWSER_P_H
+#define UPNP_DEVICEBROWSER_P_H
+
+// lib
+#include "devicebrowser.h"
+#include "device.h"
+#include "coherence_interface.h"
+
+
+namespace UPnP
+{
+
+class DeviceBrowserPrivate : public QObject
+{
+  Q_OBJECT
+
+  protected:
+    static QList<Service> demarshallServices( const Device& device, const QVariant& variant );
+
+  public:
+    explicit DeviceBrowserPrivate( DeviceBrowser* q, const QStringList& deviceTypes );
+    explicit DeviceBrowserPrivate( DeviceBrowser* q, const QString& deviceType );
+
+    ~DeviceBrowserPrivate();
+
+  public:
+    QList<Device> devices() const;
+    const QStringList& browsedDeviceTypes() const;
+    Device device( const QString& udn ) const;
+
+  public:
+    void init();
+
+  protected:
+    Device addDevice( const QDBusArgument& dbusArgument );
+
+  protected Q_SLOTS:
+    void onDeviceAdded( const QDBusVariant&, const QString& udn );
+    void onDeviceRemoved( const QString& udn );
+
+  protected:
+    DeviceBrowser* const q;
+
+    org::Coherence* mCoherence;
+
+    QStringList mBrowsedDeviceTypes;
+    QHash<QString,Device> mDevices;
+};
+
+
+inline DeviceBrowserPrivate::DeviceBrowserPrivate( DeviceBrowser* _q, const QStringList& deviceTypes )
+  : q( _q ),
+    mCoherence( 0 ),
+    mBrowsedDeviceTypes( deviceTypes )
+{}
+inline DeviceBrowserPrivate::DeviceBrowserPrivate( DeviceBrowser* _q, const QString& deviceType )
+  : q( _q ),
+    mCoherence( 0 )
+{
+    mBrowsedDeviceTypes.append( deviceType );
+}
+
+inline const QStringList& DeviceBrowserPrivate::browsedDeviceTypes() const { return mBrowsedDeviceTypes; }
+
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/lib/devicebrowser_p.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/devicebrowser.h
===================================================================
--- solid/solid/backends/kupnp/lib/devicebrowser.h	(révision 0)
+++ solid/solid/backends/kupnp/lib/devicebrowser.h	(révision 0)
@@ -0,0 +1,69 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UPNP_DEVICEBROWSER_H
+#define UPNP_DEVICEBROWSER_H
+
+// lib
+#include "upnp_export.h"
+// Qt
+#include <QtCore/QStringList>
+#include <QtCore/QObject>
+
+template<class T> class QList;
+
+
+namespace UPnP
+{
+class DeviceBrowserPrivate;
+class Device;
+
+
+class KUPNP_EXPORT DeviceBrowser : public QObject
+{
+  Q_OBJECT
+
+  friend class DeviceBrowserPrivate;
+
+  public:
+    explicit DeviceBrowser( const QStringList& deviceTypes = QStringList(), QObject* parent = 0 );
+    explicit DeviceBrowser( const QString& deviceType, QObject* parent = 0 );
+
+    virtual ~DeviceBrowser();
+
+  public:
+    QList<Device> devices() const;
+    Device device( const QString& udn ) const;
+
+    QStringList browsedDeviceTypes() const;
+
+  Q_SIGNALS:
+    void deviceAdded( const UPnP::Device& device );
+    void deviceRemoved( const UPnP::Device& device );
+
+  protected:
+    DeviceBrowserPrivate* const d;
+};
+
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/lib/devicebrowser.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/upnp_export.h
===================================================================
--- solid/solid/backends/kupnp/lib/upnp_export.h	(révision 0)
+++ solid/solid/backends/kupnp/lib/upnp_export.h	(révision 0)
@@ -0,0 +1,47 @@
+/*
+    This file is part of the KUPnP library, part of the KDE project.
+
+    Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UPNP_EXPORT_H
+#define UPNP_EXPORT_H
+
+#if 0
+// KDE
+#include <kdemacros.h>
+
+
+#ifndef KUPNP_EXPORT
+  // building the library?
+# if defined(MAKE_KUPNP_LIB)
+#  define KUPNP_EXPORT KDE_EXPORT
+  // using the library
+# else
+#  define KUPNP_EXPORT KDE_IMPORT
+# endif
+#endif
+
+# ifndef KUPNP_EXPORT_DEPRECATED
+#  define KUPNP_EXPORT_DEPRECATED KDE_DEPRECATED KUPNP_EXPORT
+# endif
+#endif
+#define KUPNP_EXPORT
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/lib/upnp_export.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/CMakeLists.txt
===================================================================
--- solid/solid/backends/kupnp/lib/CMakeLists.txt	(révision 0)
+++ solid/solid/backends/kupnp/lib/CMakeLists.txt	(révision 0)
@@ -0,0 +1,37 @@
+include_directories(
+)
+
+set( kupnp_LIB_SRCS
+  service.cpp
+  device.cpp
+  devicebrowser_p.cpp
+  devicebrowser.cpp
+)
+set( kupnp_LIB_HDRS
+  upnp_export.h
+  service.h
+  device.h
+  devicebrowser.h
+)
+
+# http://techbase.kde.org/Development/Tutorials/D-Bus/Accessing_Interfaces also adds:
+#PKGCONFIG_GETVAR(dbus-1 prefix DBUS_PREFIX)
+#set(network_xml ${DBUS_PREFIX}/interfaces/org.foo.bar.xml)
+qt4_add_dbus_interface( kupnp_LIB_SRCS  org.Coherence.xml coherence_interface )
+
+
+kde4_add_library( kupnp  SHARED ${kupnp_LIB_SRCS} )
+
+# If making the lib SHARED again, uncomment again:
+target_link_libraries( kupnp
+  ${QT_QTDBUS_LIBRARY}
+  ${QT_QTCORE_LIBRARY}
+  ${KDE4_KDECORE_LIBS})
+set_target_properties( kupnp  PROPERTIES
+  VERSION ${GENERIC_LIB_VERSION}
+  SOVERSION ${GENERIC_LIB_SOVERSION}
+)
+
+install( TARGETS kupnp  ${INSTALL_TARGETS_DEFAULT_ARGS} )
+
+install( FILES ${kupnp_LIB_HDRS}  DESTINATION ${INCLUDE_INSTALL_DIR}/upnp  COMPONENT Devel )

Modification de propriétés sur solid/solid/backends/kupnp/lib/CMakeLists.txt
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/lib/org.Coherence.device.xml
===================================================================
--- solid/solid/backends/kupnp/lib/org.Coherence.device.xml	(révision 0)
+++ solid/solid/backends/kupnp/lib/org.Coherence.device.xml	(révision 0)
@@ -0,0 +1,32 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+    <interface name="org.Coherence.device">
+        <method name="get_friendly_device_type">
+            <arg direction="out" type="s" />
+        </method>
+        <method name="get_friendly_name">
+            <arg direction="out" type="s" />
+        </method>
+        <method name="get_device_icons">
+            <arg direction="out" type="av" />
+        </method>
+        <method name="get_usn">
+            <arg direction="out" type="s" />
+        </method>
+        <method name="get_device_type_version">
+            <arg direction="out" type="i" />
+        </method>
+        <method name="get_device_type">
+            <arg direction="out" type="s" />
+        </method>
+        <method name="get_id">
+            <arg direction="out" type="s" />
+        </method>
+        <method name="get_info">
+            <arg direction="out" type="v" />
+        </method>
+        <method name="get_markup_name">
+            <arg direction="out" type="s" />
+        </method>
+    </interface>
+</node>
Index: solid/solid/backends/kupnp/kupnprootdevice.h
===================================================================
--- solid/solid/backends/kupnp/kupnprootdevice.h	(révision 0)
+++ solid/solid/backends/kupnp/kupnprootdevice.h	(révision 0)
@@ -0,0 +1,67 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPnP_KUPNPROOTDEVICE_H
+#define SOLID_BACKENDS_KUPnP_KUPNPROOTDEVICE_H
+
+// KUPnP
+#include "lib/device.h"
+// Solid
+#include <solid/ifaces/device.h>
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+class KUPnPRootDevice : public Solid::Ifaces::Device
+{
+    Q_OBJECT
+
+public:
+    KUPnPRootDevice();
+    virtual ~KUPnPRootDevice();
+
+public: // Solid::Ifaces::Device API
+    virtual QString udi() const;
+    virtual QString parentUdi() const;
+
+    virtual QString vendor() const;
+    virtual QString product() const;
+    virtual QString icon() const;
+    virtual QStringList emblems() const;
+    virtual QString description() const;
+
+    virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type& type) const;
+    virtual QObject* createDeviceInterface(const Solid::DeviceInterface::Type& type);
+
+private:
+};
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/kupnprootdevice.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/mediaserver1.cpp
===================================================================
--- solid/solid/backends/kupnp/mediaserver1.cpp	(révision 0)
+++ solid/solid/backends/kupnp/mediaserver1.cpp	(révision 0)
@@ -0,0 +1,103 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "mediaserver1.h"
+
+// Solid
+#include "kupnpstorageaccess.h"
+// Qt
+#include <QtCore/QSet>
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+MediaServer1Factory::MediaServer1Factory() {}
+
+void MediaServer1Factory::addSupportedInterfaces( QSet<Solid::DeviceInterface::Type>& interfaces ) const
+{
+    interfaces << Solid::DeviceInterface::StorageAccess;
+}
+
+bool MediaServer1Factory:: hasDeviceInterface( const UPnP::Device& device,
+                                               Solid::DeviceInterface::Type type ) const
+{
+    return type==Solid::DeviceInterface::StorageAccess
+           && device.type() == QLatin1String("MediaServer1");
+}
+
+QObject* MediaServer1Factory::tryCreateDevice( const UPnP::Device& device ) const
+{
+    return ( device.type() == QLatin1String("MediaServer1") ) ?
+        new MediaServer1( device ) : 0;
+}
+
+
+MediaServer1::MediaServer1(const UPnP::Device& device)
+  : KUPnPDevice(device)
+{
+}
+
+MediaServer1::~MediaServer1()
+{
+}
+
+QString MediaServer1::icon() const
+{
+    return QString::fromLatin1("folder-remote");
+}
+
+
+QString MediaServer1::description() const
+{
+    return QObject::tr("UPnP Media Server v1");
+}
+
+
+bool MediaServer1::queryDeviceInterface(const Solid::DeviceInterface::Type &type) const
+{
+    bool result = false;
+
+    if (type==Solid::DeviceInterface::StorageAccess) {
+        result = true;
+    }
+
+    return result;
+}
+
+QObject* MediaServer1::createDeviceInterface(const Solid::DeviceInterface::Type& type)
+{
+    DeviceInterface* interface = 0;
+
+    if (type==Solid::DeviceInterface::StorageAccess) {
+        interface = new StorageAccess(this);
+    }
+
+    return interface;
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/mediaserver1.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnpmanager.cpp
===================================================================
--- solid/solid/backends/kupnp/kupnpmanager.cpp	(révision 0)
+++ solid/solid/backends/kupnp/kupnpmanager.cpp	(révision 0)
@@ -0,0 +1,203 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kupnpmanager.h"
+
+// backend
+#include "kupnprootdevice.h"
+#include "mediaserver1.h"
+#include "mediaserver2.h"
+#include "mediaserver3.h"
+#include "internetgatewaydevice1.h"
+#include "kupnpdevice.h"
+#include "lib/devicebrowser.h"
+#include "lib/device.h"
+// Qt
+#include <QtCore/QDebug>
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+const char KUPnPUdiPrefix[] = "/org/kde/KUPnP";
+static const int KUPnPUdiPrefixLength = sizeof( KUPnPUdiPrefix ); // count final \0 for / separator
+
+
+KUPnPManager::KUPnPManager(QObject *parent)
+  : Solid::Ifaces::DeviceManager(parent),
+    mDeviceBrowser( new UPnP::DeviceBrowser(QStringList(),this) ),
+    mUdiPrefix( QString::fromLatin1(KUPnPUdiPrefix) )
+{
+    connect( mDeviceBrowser, SIGNAL(deviceAdded( const UPnP::Device& )),
+             SLOT(onDeviceAdded( const UPnP::Device& )) );
+    connect( mDeviceBrowser, SIGNAL(deviceRemoved( const UPnP::Device& )),
+             SLOT(onDeviceRemoved( const UPnP::Device& )) );
+
+    mDeviceFactories
+        << new MediaServer1Factory()
+        << new MediaServer2Factory()
+        << new MediaServer3Factory()
+        << new InternetGatewayDevice1Factory()
+        // keep last:
+        << new DeviceFactory();
+
+    foreach( AbstractDeviceFactory* factory, mDeviceFactories )
+        factory->addSupportedInterfaces( mSupportedInterfaces );
+}
+
+
+QString KUPnPManager::udiPrefix() const
+{
+    return mUdiPrefix;
+}
+
+QSet<Solid::DeviceInterface::Type> KUPnPManager::supportedInterfaces() const
+{
+    return mSupportedInterfaces;
+}
+
+QStringList KUPnPManager::allDevices()
+{
+    QStringList result;
+    result << mUdiPrefix; // group parent
+    const QList<UPnP::Device> devices = mDeviceBrowser->devices();
+    foreach( const UPnP::Device& device, devices )
+        result << udiFromUdn( device.udn() );
+
+    return result;
+}
+
+
+QStringList KUPnPManager::devicesFromQuery( const QString& parentUdi,
+                                            Solid::DeviceInterface::Type type)
+{
+    QStringList result;
+    if (!parentUdi.isEmpty())
+    {
+        result = findDeviceByParent(parentUdi,type);
+    } else if (type!=Solid::DeviceInterface::Unknown) {
+        return findDeviceByDeviceInterface(type);
+    } else {
+        return allDevices();
+    }
+
+    return result;
+}
+
+QObject* KUPnPManager::createDevice(const QString &udi)
+{
+    QObject* result = 0;
+
+    const QString udn = udnFromUdi( udi );
+    if( udn.isEmpty() ) {
+        result = new KUPnPRootDevice();
+    } else {
+        QList<UPnP::Device> devices = mDeviceBrowser->devices();
+        foreach( const UPnP::Device& device, devices ) {
+            if( device.udn() == udn ) {
+                foreach( AbstractDeviceFactory* factory, mDeviceFactories ) {
+                    result = factory->tryCreateDevice( device );
+                    if( result != 0 )
+                        break;
+                }
+                break;
+            }
+        }
+    }
+
+    return result;
+}
+
+QStringList KUPnPManager::findDeviceByParent(const QString& parentUdi,
+                                             Solid::DeviceInterface::Type type)
+{
+    QStringList result;
+
+    if( parentUdi.isEmpty() ) {
+        if (type!=Solid::DeviceInterface::Unknown) {
+            result << mUdiPrefix;
+        }
+    } else {
+        const QString parentUdn = udnFromUdi( parentUdi );
+        const QList<UPnP::Device> devices = mDeviceBrowser->devices();
+
+        foreach( const UPnP::Device& device, devices ) {
+            if ((parentUdn.isEmpty() && device.hasParentDevice())
+                ||(! parentUdn.isEmpty() && device.parentDevice().udn() == parentUdn )) {
+                continue;
+            }
+            foreach( AbstractDeviceFactory* factory, mDeviceFactories ) {
+                if( factory->hasDeviceInterface(device,type) ) {
+                    result << udiFromUdn( device.udn() );
+                    break;
+                }
+            }
+        }
+    }
+
+    return result;
+}
+
+QStringList KUPnPManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type &type)
+{
+    QStringList result;
+
+    const QList<UPnP::Device> devices = mDeviceBrowser->devices();
+
+    foreach( const UPnP::Device& device, devices ) {
+        foreach( AbstractDeviceFactory* factory, mDeviceFactories ) {
+            if( factory->hasDeviceInterface(device,type) ) {
+                result << udiFromUdn( device.udn() );
+                break;
+            }
+        }
+    }
+
+    return result;
+}
+
+QString KUPnPManager::udiFromUdn( const QString& udn ) const { return mUdiPrefix + '/' + udn; }
+QString KUPnPManager::udnFromUdi( const QString& udi ) const { return udi.mid( KUPnPUdiPrefixLength ); }
+
+void KUPnPManager::onDeviceAdded( const UPnP::Device& device )
+{
+    emit deviceAdded( udiFromUdn(device.udn()) );
+}
+
+void KUPnPManager::onDeviceRemoved( const UPnP::Device& device )
+{
+    emit deviceRemoved( udiFromUdn(device.udn()) );
+}
+
+
+KUPnPManager::~KUPnPManager()
+{
+    qDeleteAll(mDeviceFactories);
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/kupnpmanager.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/mediaserver2.cpp
===================================================================
--- solid/solid/backends/kupnp/mediaserver2.cpp	(révision 0)
+++ solid/solid/backends/kupnp/mediaserver2.cpp	(révision 0)
@@ -0,0 +1,103 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "mediaserver2.h"
+
+// Solid
+#include "kupnpstorageaccess.h"
+// Qt
+#include <QtCore/QSet>
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+MediaServer2Factory::MediaServer2Factory() {}
+
+void MediaServer2Factory::addSupportedInterfaces( QSet<Solid::DeviceInterface::Type>& interfaces ) const
+{
+    interfaces << Solid::DeviceInterface::StorageAccess;
+}
+
+bool MediaServer2Factory:: hasDeviceInterface( const UPnP::Device& device,
+                                               Solid::DeviceInterface::Type type ) const
+{
+    return type==Solid::DeviceInterface::StorageAccess
+           && device.type() == QLatin1String("MediaServer2");
+}
+
+QObject* MediaServer2Factory::tryCreateDevice( const UPnP::Device& device ) const
+{
+    return ( device.type() == QLatin1String("MediaServer2") ) ?
+        new MediaServer2( device ) : 0;
+}
+
+
+MediaServer2::MediaServer2(const UPnP::Device& device)
+  : KUPnPDevice(device)
+{
+}
+
+MediaServer2::~MediaServer2()
+{
+}
+
+QString MediaServer2::icon() const
+{
+    return QString::fromLatin1("folder-remote");
+}
+
+
+QString MediaServer2::description() const
+{
+    return QObject::tr("UPnP Media Server v2");
+}
+
+
+bool MediaServer2::queryDeviceInterface(const Solid::DeviceInterface::Type &type) const
+{
+    bool result = false;
+
+    if (type==Solid::DeviceInterface::StorageAccess) {
+        result = true;
+    }
+
+    return result;
+}
+
+QObject* MediaServer2::createDeviceInterface(const Solid::DeviceInterface::Type& type)
+{
+    DeviceInterface* interface = 0;
+
+    if (type==Solid::DeviceInterface::StorageAccess) {
+        interface = new StorageAccess(this);
+    }
+
+    return interface;
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/mediaserver2.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/mediaserver3.cpp
===================================================================
--- solid/solid/backends/kupnp/mediaserver3.cpp	(révision 0)
+++ solid/solid/backends/kupnp/mediaserver3.cpp	(révision 0)
@@ -0,0 +1,103 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "mediaserver3.h"
+
+// Solid
+#include "kupnpstorageaccess.h"
+// Qt
+#include <QtCore/QSet>
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+MediaServer3Factory::MediaServer3Factory() {}
+
+void MediaServer3Factory::addSupportedInterfaces( QSet<Solid::DeviceInterface::Type>& interfaces ) const
+{
+    interfaces << Solid::DeviceInterface::StorageAccess;
+}
+
+bool MediaServer3Factory:: hasDeviceInterface( const UPnP::Device& device,
+                                               Solid::DeviceInterface::Type type ) const
+{
+    return type==Solid::DeviceInterface::StorageAccess
+           && device.type() == QLatin1String("MediaServer3");
+}
+
+QObject* MediaServer3Factory::tryCreateDevice( const UPnP::Device& device ) const
+{
+    return ( device.type() == QLatin1String("MediaServer3") ) ?
+        new MediaServer3( device ) : 0;
+}
+
+
+MediaServer3::MediaServer3(const UPnP::Device& device)
+  : KUPnPDevice(device)
+{
+}
+
+MediaServer3::~MediaServer3()
+{
+}
+
+QString MediaServer3::icon() const
+{
+    return QString::fromLatin1("folder-remote");
+}
+
+
+QString MediaServer3::description() const
+{
+    return QObject::tr("UPnP Media Server v3");
+}
+
+
+bool MediaServer3::queryDeviceInterface(const Solid::DeviceInterface::Type &type) const
+{
+    bool result = false;
+
+    if (type==Solid::DeviceInterface::StorageAccess) {
+        result = true;
+    }
+
+    return result;
+}
+
+QObject* MediaServer3::createDeviceInterface(const Solid::DeviceInterface::Type& type)
+{
+    DeviceInterface* interface = 0;
+
+    if (type==Solid::DeviceInterface::StorageAccess) {
+        interface = new StorageAccess(this);
+    }
+
+    return interface;
+}
+
+}
+}
+}

Modification de propriétés sur solid/solid/backends/kupnp/mediaserver3.cpp
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/mediaserver1.h
===================================================================
--- solid/solid/backends/kupnp/mediaserver1.h	(révision 0)
+++ solid/solid/backends/kupnp/mediaserver1.h	(révision 0)
@@ -0,0 +1,68 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPnP_MEDIASERVER1_H
+#define SOLID_BACKENDS_KUPnP_MEDIASERVER1_H
+
+// KUPnP
+#include "kupnpdevice.h"
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+class MediaServer1Factory : public AbstractDeviceFactory
+{
+public:
+    MediaServer1Factory();
+
+public: // AbstractDeviceFactory API
+    virtual void addSupportedInterfaces( QSet<Solid::DeviceInterface::Type>& interfaces ) const;
+    virtual bool hasDeviceInterface( const UPnP::Device& device,
+                                     Solid::DeviceInterface::Type type ) const;
+    virtual QObject* tryCreateDevice( const UPnP::Device& device ) const;
+};
+
+
+class MediaServer1 : public KUPnPDevice
+{
+public:
+    explicit MediaServer1(const UPnP::Device& device);
+    virtual ~MediaServer1();
+
+public: // Solid::Ifaces::Device API
+    virtual QString icon() const;
+    virtual QString description() const;
+
+    virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type& type) const;
+    virtual QObject* createDeviceInterface(const Solid::DeviceInterface::Type& type);
+};
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/mediaserver1.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/kupnpmanager.h
===================================================================
--- solid/solid/backends/kupnp/kupnpmanager.h	(révision 0)
+++ solid/solid/backends/kupnp/kupnpmanager.h	(révision 0)
@@ -0,0 +1,88 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPNP_KUPNPMANAGER_H
+#define SOLID_BACKENDS_KUPNP_KUPNPMANAGER_H
+
+// Solid
+#include <solid/ifaces/devicemanager.h>
+#include <solid/deviceinterface.h>
+// Qt
+#include <QtCore/QVariant>
+#include <QtCore/QStringList>
+#include <QtCore/QSet>
+#include <QtCore/QVector>
+
+
+namespace UPnP {
+class DeviceBrowser;
+class Device;
+}
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+class AbstractDeviceFactory;
+
+
+class KUPnPManager : public Solid::Ifaces::DeviceManager
+{
+    Q_OBJECT
+
+public:
+    KUPnPManager( QObject* parent );
+    virtual ~KUPnPManager();
+
+public: // Solid::Ifaces::DeviceManager API
+    virtual QString udiPrefix() const ;
+    virtual QSet<Solid::DeviceInterface::Type> supportedInterfaces() const;
+    virtual QStringList allDevices();
+    virtual QStringList devicesFromQuery(const QString& parentUdi,
+                                         Solid::DeviceInterface::Type type);
+    virtual QObject* createDevice(const QString& udi);
+
+private Q_SLOTS:
+    void onDeviceAdded( const UPnP::Device& device );
+    void onDeviceRemoved( const UPnP::Device& device );
+
+private:
+    QStringList findDeviceByParent(const QString& parentUdi, Solid::DeviceInterface::Type type);
+    QStringList findDeviceByDeviceInterface(const Solid::DeviceInterface::Type &type);
+    QString udiFromUdn( const QString& udn ) const;
+    QString udnFromUdi( const QString& udi ) const;
+
+private:
+    QSet<Solid::DeviceInterface::Type> mSupportedInterfaces;
+
+    QVector<AbstractDeviceFactory*> mDeviceFactories;
+    UPnP::DeviceBrowser* mDeviceBrowser;
+    QString mUdiPrefix;
+};
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/kupnpmanager.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native

Index: solid/solid/backends/kupnp/mediaserver2.h
===================================================================
--- solid/solid/backends/kupnp/mediaserver2.h	(révision 0)
+++ solid/solid/backends/kupnp/mediaserver2.h	(révision 0)
@@ -0,0 +1,68 @@
+/*
+    This file is part of the KDE project
+
+    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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 6 of version 3 of the license.
+
+    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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SOLID_BACKENDS_KUPnP_MEDIASERVER2_H
+#define SOLID_BACKENDS_KUPnP_MEDIASERVER2_H
+
+// KUPnP
+#include "kupnpdevice.h"
+
+
+namespace Solid
+{
+namespace Backends
+{
+namespace KUPnP
+{
+
+class MediaServer2Factory : public AbstractDeviceFactory
+{
+public:
+    MediaServer2Factory();
+
+public: // AbstractDeviceFactory API
+    virtual void addSupportedInterfaces( QSet<Solid::DeviceInterface::Type>& interfaces ) const;
+    virtual bool hasDeviceInterface( const UPnP::Device& device,
+                                     Solid::DeviceInterface::Type type ) const;
+    virtual QObject* tryCreateDevice( const UPnP::Device& device ) const;
+};
+
+
+class MediaServer2 : public KUPnPDevice
+{
+public:
+    explicit MediaServer2(const UPnP::Device& device);
+    virtual ~MediaServer2();
+
+public: // Solid::Ifaces::Device API
+    virtual QString icon() const;
+    virtual QString description() const;
+
+    virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type& type) const;
+    virtual QObject* createDeviceInterface(const Solid::DeviceInterface::Type& type);
+};
+
+}
+}
+}
+
+#endif

Modification de propriétés sur solid/solid/backends/kupnp/mediaserver2.h
___________________________________________________________________
Ajouté : svn:eol-style
   + native