diff --git a/kcontrol/CMakeLists.txt b/kcontrol/CMakeLists.txt index 1bf04d4f..c20d4eff 100644 --- a/kcontrol/CMakeLists.txt +++ b/kcontrol/CMakeLists.txt @@ -32,7 +32,6 @@ add_subdirectory( knotify ) add_subdirectory( componentchooser ) add_subdirectory( mediaplayer ) add_subdirectory( menus ) -add_subdirectory( dnssd ) add_subdirectory( spellchecking ) add_subdirectory( kdebug ) diff --git a/kcontrol/dnssd/CMakeLists.txt b/kcontrol/dnssd/CMakeLists.txt deleted file mode 100644 index e3a7de3b..00000000 --- a/kcontrol/dnssd/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -########### next target ############### - -kde4_add_plugin(kcm_kdnssd kcmdnssd.cpp) - -target_link_libraries(kcm_kdnssd - ${KDE4_KDNSSD_LIBS} - ${KDE4_KDEUI_LIBS} -) - -install( - TARGETS kcm_kdnssd - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) - -########### install files ############### - -install( - FILES kcm_kdnssd.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) diff --git a/kcontrol/dnssd/Messages.sh b/kcontrol/dnssd/Messages.sh deleted file mode 100644 index b23e7a0c..00000000 --- a/kcontrol/dnssd/Messages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -$EXTRACTRC *.ui >> rc.cpp -$XGETTEXT *.cpp *.h -o $podir/kcmkdnssd.pot diff --git a/kcontrol/dnssd/configdialog.ui b/kcontrol/dnssd/configdialog.ui deleted file mode 100644 index 24edb753..00000000 --- a/kcontrol/dnssd/configdialog.ui +++ /dev/null @@ -1,63 +0,0 @@ - - - ConfigDialog - - - - 0 - 0 - 571 - 486 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - Additional Domains - - - - - - - 0 - 0 - - - - List of Internet domains that will be browsed for services in addition to default domain (typically local network). - - - Additional Domains - - - - - - - - - - - KEditListWidget - QWidget -
keditlistwidget.h
- 1 -
-
- - -
diff --git a/kcontrol/dnssd/kcm_kdnssd.desktop b/kcontrol/dnssd/kcm_kdnssd.desktop deleted file mode 100644 index b6849ed3..00000000 --- a/kcontrol/dnssd/kcm_kdnssd.desktop +++ /dev/null @@ -1,193 +0,0 @@ -[Desktop Entry] -Exec=kcmshell4 kcm_kdnssd -Icon=preferences-system-network-discovery -Name=Service Discovery -Name[af]=Dienste ontdekker -Name[ar]=استكشاف الخدمة -Name[ast]=Guetador de servicios -Name[be]=Пошук сервісаў -Name[be@latin]=Pošuk słužbaŭ -Name[bg]=Откриване на услуги -Name[bn]=সার্ভিস উদ্ঘাটন -Name[bn_IN]=পরিসেবার ডিরেক্টরি -Name[bs]=Otkrivanje servisa -Name[ca]=Descobriment de serveis -Name[ca@valencia]=Descobriment de serveis -Name[cs]=Hledání služeb -Name[csb]=Wëkrëwanié ùsłëżnotów -Name[da]=Opdagelse af tjenester -Name[de]=Diensteerkennung -Name[el]=Εύρεση υπηρεσιών -Name[en_GB]=Service Discovery -Name[eo]=Malkovrado de servo -Name[es]=Buscador de servicios -Name[et]=Teenuste tuvastamine -Name[eu]=Zerbitzu-aurkikuntza -Name[fa]=کشف خدمت -Name[fi]=Palvelun havaitseminen -Name[fr]=Découverte de services -Name[fy]=Tsjinst warskôging -Name[ga]=Fionnachtain Seirbhísí -Name[gl]=Descubrimento de servizos -Name[gu]=સેવા શોધ -Name[he]=גילוי שירותים -Name[hi]=सेवा डिस्कवरी -Name[hne]=सेवा डिस्कवरी -Name[hr]=Usluga Discovery -Name[hsb]=Pytanje słužbow -Name[hu]=Zeroconf-beállítások -Name[ia]=Discoperta de Servicio -Name[id]=Penemuan Layanan -Name[is]=Uppgötvun þjónustu -Name[it]=Rilevamento dei servizi -Name[ja]=サービスディスカバリ -Name[ka]=სერვისის აღმოჩენა -Name[kk]=Қызметтерді байқау -Name[km]=ការ​រក​ឃើញ​សេវា -Name[kn]=ಸೇವಾ ಆವಿಷ್ಕಾರ (ಸರ್ವೀಸ್ ಡಿಸ್ಕವರಿ) -Name[ko]=서비스 발견 -Name[ku]=Naskirina Servîsê -Name[lt]=Tarnybų radimas -Name[lv]=Servisu atklāšana -Name[mai]=सेवा डिस्कवरी -Name[mk]=Откривање сервиси -Name[ml]=സേവനം കണ്ടെത്തല്‍ -Name[mr]=सेवा आढळली -Name[ms]=Penemuan Servis -Name[nb]=Oppdaging av tjenester -Name[nds]=Deensten finnen -Name[ne]=सेवा खोजी -Name[nl]=Dienstwaarneming -Name[nn]=Oppdaging av tenester -Name[or]=ସର୍ଭିସ ଆବିଷ୍କାର -Name[pa]=ਸਰਵਿਸ ਖੋਜ -Name[pl]=Wykrywanie usług -Name[pt]=Descoberta de Serviços -Name[pt_BR]=Descoberta de serviços -Name[ro]=Descoperire servicii -Name[ru]=Обнаружение служб -Name[se]=Bálvalusáican -Name[si]=සේවා අනාවරණය -Name[sk]=Zisťovanie služieb -Name[sl]=Odkrivanje storitev -Name[sr]=Откривање сервиса -Name[sr@ijekavian]=Откривање сервиса -Name[sr@ijekavianlatin]=Otkrivanje servisa -Name[sr@latin]=Otkrivanje servisa -Name[sv]=Tjänstupptäckt -Name[ta]=சர்வீஸ் டிஸ்கவரி -Name[te]= -Name[tg]=Дарёфтани хизматҳо -Name[th]=การค้นหาบริการ -Name[tr]=Servis Araştırması -Name[ug]=مۇلازىمەت بايقاش -Name[uk]=Пошук служб -Name[uz]=Tarmoqdagi xizmatlarni qidirish -Name[uz@cyrillic]=Тармоқдаги хизматларни қидириш -Name[vi]=Khám phá dịch vụ -Name[wa]=Discovraedje di siervices -Name[x-test]=xxService Discoveryxx -Name[zh_CN]=服务探索 -Name[zh_TW]=服務偵測 - -Comment=Configure service discovery -Comment[af]=Stel dienste ontdekker op -Comment[ar]=اضبط استكشاف الخدمة -Comment[ast]=Configura'l guetador de servicios -Comment[be]=Настаўленні пошуку сервісаў -Comment[be@latin]=Naładź pošuk słužbaŭ -Comment[bg]=Настройване откриването на услуги -Comment[bn]=সার্ভিস উদ্ঘাটন কনফিগার করুন -Comment[bn_IN]=পরিসেবার ডিরেক্টরি কনফিগার করুন -Comment[bs]=Podešavanje otkrivanja servisa -Comment[ca]=Configura el descobriment de serveis -Comment[ca@valencia]=Configura el descobriment de serveis -Comment[cs]=Nastavení hledání služeb -Comment[csb]=Kòfigùracëjô wëkrëwaniô ùsłëżnotów -Comment[da]=Indstil opdagelse af tjeneste -Comment[de]=Diensteerkennung einrichten -Comment[el]=Διαμόρφωση εύρεσης υπηρεσιών -Comment[en_GB]=Configure service discovery -Comment[eo]=Agordi malkovradon de servo -Comment[es]=Configura el buscador de servicios -Comment[et]=Teenuste tuvastamise seadistamine -Comment[eu]=Zerbitzu-aurkikuntzaren konfigurazioa -Comment[fa]=پیکربندی کشف خدمت -Comment[fi]=Palvelun havaitsemisen asetukset -Comment[fr]=Configuration de la découverte de services -Comment[fy]=Tsjinst waarnimming ynstellen -Comment[ga]=Cumraigh fionnachtain seirbhísí -Comment[gl]=Configurar o descubrimento de servizos -Comment[gu]=સેવા શોધ રૂપરેખાંકિત કરો -Comment[he]=שינוי הגדרות הקשורות לגילוי שירותים -Comment[hi]=सेवा डिस्कवरी कॉन्फ़िगर करें -Comment[hne]=सेवा डिस्कवरी कान्फिगर करव -Comment[hr]=Konfiguriranje usluge discovery -Comment[hsb]=Pytanje słužbow připrawić -Comment[hu]=A szolgáltatásdetektálás beállításai -Comment[ia]=Configura discoperta de servicio -Comment[id]=Atur penemuan layanan -Comment[is]=Stilla uppgötvun þjónustna -Comment[it]=Configura il rilevamento dei servizi -Comment[ja]=サービスディスカバリの設定 -Comment[ka]=სერვისის არმოჩენის კონფიგურირება -Comment[kk]=Қызыметтерді байқауды баптау -Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ការ​រក​ឃើញ​សេវា -Comment[kn]=ಸೇವಾ ಆವಿಷ್ಕಾರವನ್ನು (ಸರ್ವೀಸ್ ಡಿಸ್ಕವರಿ) ಸಂರಚಿಸು -Comment[ko]=서비스 발견 설정 -Comment[ku]=naskirina servîsê mîheng bike -Comment[lt]=Konfigūruoti tarnybų radimą -Comment[lv]=Konfigurē servisu atklāšanu -Comment[mai]=सेवा डिस्कवरी बिन्यस्त करू -Comment[mk]=Конфигурирајте го откривањето сервиси -Comment[ml]=സേവനം കണ്ടെത്തല്‍ ക്രമീകരണം -Comment[mr]=सेवा आढळल्यास संयोजीत करा -Comment[ms]=Konfigur penemuan servis -Comment[nb]=Tilpass tjenesteoppdagingen -Comment[nds]=Dat Finnen vun Deensten inrichten -Comment[ne]=सेवा खोजी कन्फिगर गर्नुहोस् -Comment[nl]=Dienstwaarneming instellen -Comment[nn]=Set opp oppdagingstenesta -Comment[or]=ସର୍ଭିସ ଆବିଷ୍କାର ବିନ୍ୟାସ କରନ୍ତୁ -Comment[pa]=ਸਰਵਿਸ ਖੋਜ ਸੰਰਚਨਾ -Comment[pl]=Ustawienia wykrywania usług -Comment[pt]=Configurar a descoberta de serviços -Comment[pt_BR]=Configura a descoberta de serviços -Comment[ro]=Configurează serviciul de descoperire -Comment[ru]=Настройка обнаружения служб -Comment[se]=Heivet bálvalusáicama -Comment[si]=සේවා අනාවරණය සැකසීම -Comment[sk]=Nastavenie zisťovania služieb -Comment[sl]=Nastavi odkrivanje storitev -Comment[sr]=Подешавање откривања сервиса -Comment[sr@ijekavian]=Подешавање откривања сервиса -Comment[sr@ijekavianlatin]=Podešavanje otkrivanja servisa -Comment[sr@latin]=Podešavanje otkrivanja servisa -Comment[sv]=Anpassa tjänstupptäckt -Comment[ta]=சர்வீஸ் டிஸ்கவரியை வடிவமை -Comment[te]=సేవా డిస్కవరిని ఆకృతీకరించుము -Comment[tg]=Танзимоти дарёфтани хизматҳо -Comment[th]=ปรับแต่งการค้นหาบริการ -Comment[tr]=Servis araştırmasını yapılandır -Comment[ug]=مۇلازىمەت بايقاش سەپلىمىسى -Comment[uk]=Налаштування знаходження служб -Comment[uz]=Tarmoqdagi xizmatlarni qidirishni moslash -Comment[uz@cyrillic]=Тармоқдаги хизматларни қидиришни мослаш -Comment[vi]=Cấu hình khả năng khám phám dịch vụ -Comment[wa]=Apontyî l' discovraedje di siervices -Comment[x-test]=xxConfigure service discoveryxx -Comment[zh_CN]=配置服务探索 -Comment[zh_TW]=設定服務偵測 -StartupNotify=true -Terminal=false -Type=Service -X-KDE-ServiceTypes=KCModule -X-DBUS-StartupType= -X-KDE-HasReadOnlyMode=false -X-KDE-Library=kcm_kdnssd -X-KDE-ParentApp=kcontrol -X-KDE-SubstituteUID=false -X-KDE-RootOnly=true -Categories=Qt;KDE;X-KDE-settings-network; -X-KDE-System-Settings-Parent-Category=network-settings -X-KDE-Weight=70 diff --git a/kcontrol/dnssd/kcmdnssd.cpp b/kcontrol/dnssd/kcmdnssd.cpp deleted file mode 100644 index 1b90eeba..00000000 --- a/kcontrol/dnssd/kcmdnssd.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004,2005 by Jakub Stachowski * - * qbast@go2.pl * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "kcmdnssd.h" - -#include -#include - -#include - -//Added by qt3to4: - -#include -#include -#include -#include - -#include -#include - -#define MDNSD_CONF "/etc/mdnsd.conf" -#define MDNSD_PID "/var/run/mdnsd.pid" - -K_PLUGIN_FACTORY(KCMDnssdFactory, registerPlugin();) -K_EXPORT_PLUGIN(KCMDnssdFactory("kcmkdnssd")) - -KCMDnssd::KCMDnssd(QWidget *parent, const QVariantList&) - : KCModule( KCMDnssdFactory::componentData(), parent) -{ - - widget = new Ui_ConfigDialog(); - widget->setupUi(this); - setAboutData(new KAboutData("kcm_kdnssd", 0, - ki18n("ZeroConf configuration"),0,KLocalizedString(),KAboutData::License_GPL, - ki18n("(C) 2004-2007 Jakub Stachowski"))); - setQuickHelp(i18n("Setup services browsing with ZeroConf")); - addConfig(DNSSD::Configuration::self(),this); - setButtons( Default|Apply ); -} - -KCMDnssd::~KCMDnssd() -{ -} - -void KCMDnssd::save() -{ - KCModule::save(); - - // Send signal to all kde applications which have a DNSSD::DomainBrowserPrivate instance - QDBusMessage message = - QDBusMessage::createSignal("/libdnssd", "org.kde.DNSSD.DomainBrowser", "domainListChanged"); - QDBusConnection::sessionBus().send(message); -} - - -#include "moc_kcmdnssd.cpp" - diff --git a/kcontrol/dnssd/kcmdnssd.h b/kcontrol/dnssd/kcmdnssd.h deleted file mode 100644 index 5f1b306b..00000000 --- a/kcontrol/dnssd/kcmdnssd.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004,2005 by Jakub Stachowski * - * qbast@go2.pl * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef _KCMDNSSD_H_ -#define _KCMDNSSD_H_ - - -#include -#include -#include - -class KCMDnssd: public KCModule -{ - Q_OBJECT - -public: - explicit KCMDnssd( QWidget *parent=0, const QVariantList& = QVariantList() ); - ~KCMDnssd(); - virtual void save(); -private: - Ui_ConfigDialog *widget; -}; - -#endif diff --git a/kioslave/network/CMakeLists.txt b/kioslave/network/CMakeLists.txt index 6db342dd..2548d9ab 100644 --- a/kioslave/network/CMakeLists.txt +++ b/kioslave/network/CMakeLists.txt @@ -1,9 +1,2 @@ -add_definitions( - -DQT_NO_CAST_TO_ASCII - -DQT_NO_CAST_FROM_ASCII -) - -add_subdirectory( network ) add_subdirectory( ioslave ) -add_subdirectory( kded ) add_subdirectory( mimetypes ) diff --git a/kioslave/network/README b/kioslave/network/README deleted file mode 100644 index 555d45b1..00000000 --- a/kioslave/network/README +++ /dev/null @@ -1,37 +0,0 @@ -networkkio -========== - -This is an experimental kioslave which presents the network. -It also includes a library which models the network, the devices, and services, -and could be reused by other code. - -Please contact the author Friedrich W. H. Kossebau for any further questions. -Cooperation in this area is welcome :) - - -ioslave -------- -The ioslave lists the local network as represented by the -The protocol name is "network", so enter "network:/" to see your local network. -Currently, due to synchronisation problems, the network data is fetched from the -kded network module via D-Bus, instead of using the network library directly. - - -kded ----- -A kded module to emit KDirNotify signals as needed if the network structure changes. - -That way all users of the network kioslave and listening to KDirNotify can update the view, -e.g. Dolphin, Konqueror and the KDElibs file dialogs. -It also offers the data of the network structure over D-Bus, as currently used by the ioslave. - - -network -------- -A library which models the network with all its devices and the services offered by them. - -Currently it uses KDNSSD, the KDElibs interface to the zeroconf service discovery system, -as the engine to find about the content of network structure. Later on this library should -support different backends concurrently (also SLP, UPnP, Windows related stuff like smb, -including undiscoverable/hidden but user/admin entered ones). -If this works out this library might end in KDElibs solid module. diff --git a/kioslave/network/ioslave/CMakeLists.txt b/kioslave/network/ioslave/CMakeLists.txt index fdedb1c7..516ae222 100644 --- a/kioslave/network/ioslave/CMakeLists.txt +++ b/kioslave/network/ioslave/CMakeLists.txt @@ -1,27 +1,27 @@ -project( kio_network ) +project(kio_network) -include_directories( - ../network - ${CMAKE_CURRENT_BINARY_DIR}/../network -) - -set( kio_network_SRCS - networkdbusinterface.cpp - networkinitwatcher.cpp - networkthread.cpp - networkuri.cpp - mimetypes.cpp +set(kio_network_SRCS networkslave.cpp main.cpp ) -# qt4_add_dbus_interface( kio_network_SRCS ../kded/org.kde.network.xml networkdbusproxy ) +kde4_add_plugin(kio_network ${kio_network_SRCS}) -kde4_add_plugin( kio_network ${kio_network_SRCS} ) +target_link_libraries(kio_network + ${KDE4_KIO_LIBS} + ${KDE4_KDNSSD_LIBS} +) -target_link_libraries( kio_network molletnetwork ${KDE4_KIO_LIBS} ) +install( + TARGETS kio_network + DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} +) -install( TARGETS kio_network DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) - -install( FILES network.protocol DESTINATION ${KDE4_SERVICES_INSTALL_DIR}) -install( FILES network.desktop DESTINATION ${KDE4_DATA_INSTALL_DIR}/remoteview) +install( + FILES network.protocol + DESTINATION ${KDE4_SERVICES_INSTALL_DIR} +) +install( + FILES network.desktop + DESTINATION ${KDE4_DATA_INSTALL_DIR}/remoteview +) diff --git a/kioslave/network/ioslave/main.cpp b/kioslave/network/ioslave/main.cpp index f357e41d..0d241b70 100644 --- a/kioslave/network/ioslave/main.cpp +++ b/kioslave/network/ioslave/main.cpp @@ -26,18 +26,17 @@ #include #include // Qt -#include - +#include extern "C" { -int KDE_EXPORT kdemain( int argc, char** argv ) +int KDE_EXPORT kdemain(int argc, char** argv) { - KComponentData componentData( "kio_network" ); - QCoreApplication app( argc, argv ); + KComponentData componentData("kio_network"); + QCoreApplication app(argc, argv); - NetworkSlave slave( argv[1], argv[2], argv[3] ); + NetworkSlave slave(argv[1], argv[2], argv[3]); slave.dispatchLoop(); return 0; diff --git a/kioslave/network/ioslave/mimetypes.cpp b/kioslave/network/ioslave/mimetypes.cpp deleted file mode 100644 index 50ba41c6..00000000 --- a/kioslave/network/ioslave/mimetypes.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "mimetypes.h" - -// Qt -#include - - -const char Mimetypes::NetworkMimetype[] = "inode/vnd.kde.network"; - -// keep in sync with Mollet::NetDevice::Type -const char* const Mimetypes::DeviceMimetype[] = -{ - "inode/vnd.kde.device.unknown", - "inode/vnd.kde.device.scanner", - "inode/vnd.kde.device.printer", - "inode/vnd.kde.device.server", - "inode/vnd.kde.device.router", - "inode/vnd.kde.device.workstation" -}; - - -struct MimetypePair { - const char* typeName; - const char* mimetype; -}; - - -// keep in sync with network.xml -static const char* const SimpleServiceMimetype[] = -{ - "ftp", - "sftp-ssh", - "ftps", - "nfs", - "afpovertcp", - "smb", - - "ssh", - "telnet", - "rfb", - "rdp", - - "http", - "ntp", - "ldap", - - "xmpp-server", - "presence", - "lobby", - "giver", - "sip", - "h323", - "skype", - - "ipp", - "printer", - "pdl-datastream", - - "plasma", - - "kbattleship", - "lskat", - "kfourinline", - "ksirk", - - "pulse-server", - "pulse-source", - "pulse-sink", - "udisks-ssh", - "libvirt", - "airmouse", - - "postgresql", - "couchdb_location", - - "realplayfavs", - "acrobat-server", - "adobe-vc", - "ggz", - - "pgpkey-ldap", - "pgpkey-hkp", - "pgpkey-https", - - "maemo-inf", - - "airport", - "daap", - "dacp", - "eppc", - "net-assistant", - "odisk", - "raop", - "touch-able", - "workstation", - "sleep-proxy", - "nssocketport", - "home-sharing", - "appletv-itunes", - "appletv-pair", - - "upnp.BasicDevice1", - "upnp.WLANAccessPointDevice1", - "upnp.InternetGatewayDevice1", - "upnp.PrinterBasic1", - "upnp.PrinterEnhanced1", - "upnp.Scanner1", - "upnp.MediaServer1", - "upnp.MediaRenderer1", - "upnp.MediaServer2", - "upnp.MediaRenderer2", - "upnp.MediaServer3", - "upnp.SolarProtectionBlind1", - "upnp.DigitalSecurityCamera1", - "upnp.HVAC1", - "upnp.LightingControls1", - "upnp.RemoteUIClientDevice1", - "upnp.RemoteUIServerDevice1", - "upnp.RAClient1", - "upnp.RAServer1", - "upnp.RADiscoveryAgent1", - "upnp.LANDevice1", - "upnp.WANDevice1", - "upnp.WANConnectionDevice1", - "upnp.WFADevice1", - "upnp.Unknown" -}; -static const int SimpleServiceMimetypeCount = sizeof(SimpleServiceMimetype) / sizeof(SimpleServiceMimetype[0]); - -QString Mimetypes::mimetypeForServiceType( const QString& serviceTypeName ) -{ - QString subType = QLatin1String("unknown"); - for( int i=0; i - - 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 . -*/ - -#ifndef MIMETYPES_H -#define MIMETYPES_H - -#include - - -class Mimetypes -{ - public: - static const char NetworkMimetype[]; - static const char* const DeviceMimetype[]; - - static QString mimetypeForServiceType( const QString& serviceTypeName ); -}; - -#endif diff --git a/kioslave/network/ioslave/networkdbusinterface.cpp b/kioslave/network/ioslave/networkdbusinterface.cpp deleted file mode 100644 index d6df7f4a..00000000 --- a/kioslave/network/ioslave/networkdbusinterface.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "networkdbusinterface.h" - -// Qt -#include - - -static const char NetworkDBusInterfaceName[] = "org.kde.network"; - -NetworkDBusInterface::NetworkDBusInterface( const QString& service, const QString& path, const QDBusConnection& connection, QObject* parent ) - : QDBusAbstractInterface( service, path, NetworkDBusInterfaceName, connection, parent ) -{ - // TODO: best place to do this? - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); -} - -NetworkDBusInterface::~NetworkDBusInterface() -{ -} - diff --git a/kioslave/network/ioslave/networkdbusinterface.h b/kioslave/network/ioslave/networkdbusinterface.h deleted file mode 100644 index e5e04aeb..00000000 --- a/kioslave/network/ioslave/networkdbusinterface.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORKDBUSINTERFACE_H -#define NETWORKDBUSINTERFACE_H - - -// network -#include -// Qt -#include -#include - - -// TODO: see file networkdbus.h -class NetworkDBusInterface: public QDBusAbstractInterface -{ - Q_OBJECT - - public: - NetworkDBusInterface( const QString& service, const QString& path, const QDBusConnection& connection, QObject* parent = 0 ); - virtual ~NetworkDBusInterface(); - - public Q_SLOTS: - QDBusReply deviceData( const QString& hostAddress ); - QDBusReply serviceData( const QString& hostAddress, const QString& serviceName, const QString& serviceType ); - QDBusReply deviceDataList(); - QDBusReply serviceDataList( const QString& hostAddress ); -}; - -// TODO: is QDBus::Block the right solution here? -inline QDBusReply NetworkDBusInterface::deviceData( const QString& hostAddress ) -{ - QList argumentList; - argumentList << qVariantFromValue(hostAddress); - return callWithArgumentList( QDBus::Block, QString::fromLatin1("deviceData"), argumentList ); -} -inline QDBusReply NetworkDBusInterface::serviceData( const QString& hostAddress, const QString& serviceName, const QString& serviceType ) -{ - QList argumentList; - argumentList << qVariantFromValue(hostAddress) << qVariantFromValue(serviceName) << qVariantFromValue(serviceType); - return callWithArgumentList( QDBus::Block, QString::fromLatin1("serviceData"), argumentList ); -} -inline QDBusReply NetworkDBusInterface::deviceDataList() -{ - return call( QString::fromLatin1("deviceDataList") ); -} -inline QDBusReply NetworkDBusInterface::serviceDataList( const QString& hostAddress ) -{ - QList argumentList; - argumentList << qVariantFromValue(hostAddress); - return callWithArgumentList( QDBus::Block, QString::fromLatin1("serviceDataList"), argumentList ); -} - -#endif diff --git a/kioslave/network/ioslave/networkinitwatcher.cpp b/kioslave/network/ioslave/networkinitwatcher.cpp deleted file mode 100644 index 4edaee90..00000000 --- a/kioslave/network/ioslave/networkinitwatcher.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "networkinitwatcher.h" diff --git a/kioslave/network/ioslave/networkinitwatcher.h b/kioslave/network/ioslave/networkinitwatcher.h deleted file mode 100644 index d595e5a1..00000000 --- a/kioslave/network/ioslave/networkinitwatcher.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORKINITWATCHER_H -#define NETWORKINITWATCHER_H - -// network -#include "network.h" -//Qt -#include -#include - -#include - -using namespace Mollet; - - -class NetworkInitWatcher : public QObject -{ - Q_OBJECT - - public: - NetworkInitWatcher( Network* network, QMutex* mutex ); - virtual ~NetworkInitWatcher(); - - public Q_SLOTS: - void onNetworkInitDone(); - - private: - QMutex* mMutex; -}; - - -inline NetworkInitWatcher::NetworkInitWatcher( Network* network, QMutex* mutex ) - : mMutex( mutex ) -{ - connect( network, SIGNAL(initDone()), SLOT(onNetworkInitDone()) ); -} -inline NetworkInitWatcher::~NetworkInitWatcher() -{ -kDebug(); -} - -inline void NetworkInitWatcher::onNetworkInitDone() -{ -kDebug()<<"before unlock"; - mMutex->unlock(); -kDebug()<<"after unlock"; - deleteLater(); -kDebug()<<"after deleteLater"; -} - -#endif diff --git a/kioslave/network/ioslave/networkslave.cpp b/kioslave/network/ioslave/networkslave.cpp index 4aea6b29..41a8589a 100644 --- a/kioslave/network/ioslave/networkslave.cpp +++ b/kioslave/network/ioslave/networkslave.cpp @@ -22,306 +22,82 @@ #include "networkslave.h" -// ioslave -#include "networkuri.h" -#include "mimetypes.h" -#include "networkdbusinterface.h" -// network -#include -#include -// KDE -// Qt -#include +#include #include -#include - -// static const char NetworkIconName[] = "network-workgroup"; - - -NetworkSlave::NetworkSlave( const QByteArray& name, const QByteArray& poolSocket, const QByteArray& programSocket ) - : SlaveBase( name, poolSocket, programSocket ) +static QString mimeForService(const KDNSSDService &kdnssdservice) { -kDebug(); - mNetworkDBusProxy = new NetworkDBusInterface( QLatin1String("org.kde.kded"), - QLatin1String("/modules/networkwatcher"), - QDBusConnection::sessionBus() ); + return QString::fromLatin1("inode/vnd.kde.service.%1").arg( + KUrl(kdnssdservice.url).protocol() + ); } -void NetworkSlave::get( const KUrl& url ) +static QString iconForService(const KDNSSDService &kdnssdservice) { - const NetworkUri networkUri( url ); - - bool successfulGetting = false; - - const NetworkUri::Type type = networkUri.type(); -kDebug()<<"type="< reply = mNetworkDBusProxy->serviceData( hostAddress, serviceName, serviceType ); - -kDebug()< - -#include - -NetworkThread::NetworkThread() - : QThread() - , mNetwork( 0 ) - , mContinue( true ) -{ -} - -Mollet::Network* NetworkThread::network() const { return mNetwork; } - -void NetworkThread::pause() -{ -kDebug()<<"before lock"; - mMutex.lock(); -kDebug()<<"after lock"; - exit(); -kDebug()<<"after exit"; -} - - -void NetworkThread::unpause() -{ -kDebug()<<"before unlock"; - mMutex.unlock(); -kDebug()<<"after unlock"; -} - -void NetworkThread::finish() -{ - mContinue = false; - exit(); -} - - -void NetworkThread::run() -{ - mNetwork = Mollet::Network::network(); - -kDebug()<<"starting with lock"; - mMutex.lock(); - new NetworkInitWatcher( mNetwork, &mMutex ); - - do - { -kDebug()<<"going exec()"; - exec(); -kDebug()<<"left exec()"; - mMutex.lock(); -kDebug()<<"after lock"; - mMutex.unlock(); -kDebug()<<"after unlock"; - } - while( mContinue ); -} - -NetworkThread::~NetworkThread() -{ -} diff --git a/kioslave/network/ioslave/networkthread.h b/kioslave/network/ioslave/networkthread.h deleted file mode 100644 index d94ec721..00000000 --- a/kioslave/network/ioslave/networkthread.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORKTHREAD_H -#define NETWORKTHREAD_H - -// Qt -#include -#include - -namespace Mollet { -class Network; -} - - -class NetworkThread : public QThread -{ - public: - NetworkThread(); - virtual ~NetworkThread(); - - public: - Mollet::Network* network() const; - - public: - void pause(); - void unpause(); - void finish(); - - protected: // QThread API - virtual void run(); - - private: - QMutex mMutex; - Mollet::Network* mNetwork; - - bool mContinue; -}; - -#endif diff --git a/kioslave/network/ioslave/networkuri.cpp b/kioslave/network/ioslave/networkuri.cpp deleted file mode 100644 index 6b6cc478..00000000 --- a/kioslave/network/ioslave/networkuri.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "networkuri.h" diff --git a/kioslave/network/ioslave/networkuri.h b/kioslave/network/ioslave/networkuri.h deleted file mode 100644 index 18e8a756..00000000 --- a/kioslave/network/ioslave/networkuri.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORKURI_H -#define NETWORKURI_H - -// KDE -#include -// // Qt -// #include - - -// network://domain/hostname/servicename -class NetworkUri -{ -// friend QDataStream& operator<<( QDataStream& stream, const NetworkUri& networkUri ); - - public: - enum Type { InvalidUrl, Domain, Device, Service }; - public: - explicit NetworkUri( const KUrl& url ); - - public: - const QString& hostAddress() const; - const QString& serviceName() const; - const QString& serviceType() const; - NetworkUri::Type type() const; - - private: - - private: // data - QString mHostAddress; - QString mServiceName; - QString mServiceType; -}; - - -inline NetworkUri::NetworkUri( const KUrl& url ) -{ - mHostAddress = url.path().mid( 1 ); - const int slashIndex = mHostAddress.indexOf( QLatin1Char('/') ); - if( slashIndex != -1 ) - { - // servicetype is currently appended as .type to the name - const int serviceTypeIndex = mHostAddress.lastIndexOf( QLatin1Char('.') ) + 1; - mServiceType = mHostAddress.mid( serviceTypeIndex ); - - const int serviceNameLength = (serviceTypeIndex-1) - (slashIndex+1); - mServiceName = mHostAddress.mid( slashIndex + 1, serviceNameLength ); - mHostAddress.resize( slashIndex ); - } -} - -inline const QString& NetworkUri::hostAddress() const { return mHostAddress; } -inline const QString& NetworkUri::serviceName() const { return mServiceName; } -inline const QString& NetworkUri::serviceType() const { return mServiceType; } - -inline NetworkUri::Type NetworkUri::type() const -{ - Type result = - mHostAddress.isEmpty() ? Domain : - mServiceName.isEmpty() ? Device : - /*else*/ Service; - - return result; -} - -/* -inline QDataStream& operator<<( QDataStream& stream, const NetworkUri& networkUri ) -{ - stream << "NetworkUri(host:"<(networkUri.type())<<")"; - return stream; -} -*/ - -#endif diff --git a/kioslave/network/kded/CMakeLists.txt b/kioslave/network/kded/CMakeLists.txt deleted file mode 100644 index 899fe718..00000000 --- a/kioslave/network/kded/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -project( networkwatcher ) - -include_directories( - ../network - ${CMAKE_CURRENT_BINARY_DIR}/../network - ../ioslave -) -set( kded_networkwatcher_SRCS - networkdbusadaptor.cpp - kioslavenotifier.cpp - networkwatcher.cpp - main.cpp -) - -qt4_add_dbus_adaptor( kded_networkwatcher_SRCS org.kde.network.kioslavenotifier.xml kioslavenotifier.h Mollet::KioSlaveNotifier ) - -kde4_add_plugin( kded_networkwatcher ${kded_networkwatcher_SRCS} ) - -target_link_libraries( kded_networkwatcher ${KDE4_KIO_LIBS} molletnetwork ) - -install( TARGETS kded_networkwatcher DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} ) - -install( FILES networkwatcher.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kded ) -install( FILES org.kde.network.kioslavenotifier.xml DESTINATION ${KDE4_DBUS_INTERFACES_INSTALL_DIR} ) diff --git a/kioslave/network/kded/kioslavenotifier.cpp b/kioslave/network/kded/kioslavenotifier.cpp deleted file mode 100644 index 90f7f056..00000000 --- a/kioslave/network/kded/kioslavenotifier.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "kioslavenotifier.h" - -// module -#include "kioslavenotifieradaptor.h" -// kioslave -#include -// network -#include -#include -#include -// KDE -#include -// Qt -#include - -#include - - -namespace Mollet -{ - -static inline QString idFrom( const NetworkUri& networkUri ) -{ - return networkUri.hostAddress().isEmpty() ? QString() : - networkUri.serviceName().isEmpty() ? networkUri.hostAddress() : - /*else*/ networkUri.hostAddress()+QLatin1Char('/')+networkUri.serviceName(); -} - -static inline QString dirIdFor( const NetDevice& device ) -{ -Q_UNUSED( device ) - return QString(); -} -static inline QString pathFor( const NetDevice& device ) -{ - return device.hostAddress(); -} - -static inline QString dirIdFor( const NetService& service ) -{ - return service.device().hostAddress(); -} - -static inline QString pathFor( const NetService& service ) -{ - return service.device().hostAddress() + QLatin1Char('/') + service.name()+QLatin1Char('.')+service.type(); -} - - -KioSlaveNotifier::KioSlaveNotifier( Network* network, QObject* parent ) - : QObject( parent ) -{ - QDBusConnection sessionBus = QDBusConnection::sessionBus(); - const QString allServices; - const QString allPaths; - const QString interface = QLatin1String( "org.kde.KDirNotify" ); - sessionBus.connect( allServices, allPaths, interface, QLatin1String("enteredDirectory"), - this, SLOT(onDirectoryEntered(QString)) ); - sessionBus.connect( allServices, allPaths, interface, QLatin1String("leftDirectory"), - this, SLOT(onDirectoryLeft(QString)) ); - - new KioSlaveNotifierAdaptor( this ); - - connect( network, SIGNAL(devicesAdded(QList)), SLOT(onDevicesAdded(QList)) ); - connect( network, SIGNAL(devicesRemoved(QList)), SLOT(onDevicesRemoved(QList)) ); - connect( network, SIGNAL(servicesAdded(QList)), SLOT(onServicesAdded(QList)) ); - connect( network, SIGNAL(servicesRemoved(QList)), SLOT(onServicesRemoved(QList)) ); -} - -QStringList KioSlaveNotifier::watchedDirectories() const -{ - return mWatchedDirs.keys(); -} - - -void KioSlaveNotifier::onDirectoryEntered( const QString& directory ) -{ -kDebug()<::Iterator it = mWatchedDirs.find( id ); - - if( it == mWatchedDirs.end() ) - { - const QString id = idFrom( networkUri ); - mWatchedDirs.insert( id, 1 ); - } - else - *it++; -} - - -void KioSlaveNotifier::onDirectoryLeft( const QString& directory ) -{ -kDebug()<::Iterator it = mWatchedDirs.find( id ); - - if( it == mWatchedDirs.end() ) - return; - - if( *it == 1 ) - mWatchedDirs.erase( it ); - else - *it--; -} - - -void KioSlaveNotifier::notifyAboutAdded( const QString& dirId ) -{ - QHash::Iterator it = mWatchedDirs.find( dirId ); - if( it != mWatchedDirs.end() ) - { - const QString url = QLatin1String("network:/") + dirId; -kDebug()<::Iterator it = mWatchedDirs.find( dirId ); - if( it != mWatchedDirs.end() ) - { - QStringList itemUrls; - itemUrls.append( QLatin1String("network:/") + itemPath ); -kDebug()<& deviceList ) -{ - foreach( const NetDevice& device, deviceList ) - { - const QString id = dirIdFor( device ); - notifyAboutAdded( id ); - } -} - -void KioSlaveNotifier::onDevicesRemoved( const QList& deviceList ) -{ - foreach( const NetDevice& device, deviceList ) - { - const QString dirId = dirIdFor( device ); - const QString itemPath = pathFor( device ); - notifyAboutRemoved( dirId, itemPath ); - } -} - - -void KioSlaveNotifier::onServicesAdded( const QList& serviceList ) -{ - foreach( const NetService& service, serviceList ) - { - const QString id = dirIdFor( service ); - notifyAboutAdded( id ); - } -} - - -void KioSlaveNotifier::onServicesRemoved( const QList& serviceList ) -{ - foreach( const NetService& service, serviceList ) - { - const QString dirId = dirIdFor( service ); - const QString itemPath = pathFor( service ); - notifyAboutRemoved( dirId, itemPath ); - } -} - -KioSlaveNotifier::~KioSlaveNotifier() -{ -} - -} diff --git a/kioslave/network/kded/kioslavenotifier.h b/kioslave/network/kded/kioslavenotifier.h deleted file mode 100644 index df052aed..00000000 --- a/kioslave/network/kded/kioslavenotifier.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef KIOSLAVENOTIFIER_H -#define KIOSLAVENOTIFIER_H - -// Qt -#include -#include - -namespace Mollet -{ - -class Network; -class NetDevice; -class NetService; - - -class KioSlaveNotifier : public QObject -{ - Q_OBJECT - - public: - explicit KioSlaveNotifier( Network* network, QObject* parent = 0 ); - virtual ~KioSlaveNotifier(); - - public: // for debugging, remove also from adaptor.xml - QStringList watchedDirectories() const; - - public Q_SLOTS: - void onDirectoryEntered( const QString& directory ); - void onDirectoryLeft( const QString& directory ); - - private: - void notifyAboutAdded( const QString& dirId ); - void notifyAboutRemoved( const QString& dirId, const QString& itemPath ); - - private Q_SLOTS: - void onDevicesAdded( const QList& deviceList ); - void onDevicesRemoved( const QList& deviceList ); - void onServicesAdded( const QList& serviceList ); - void onServicesRemoved( const QList& serviceList ); - - private: - QHash mWatchedDirs; -}; - -} - -#endif diff --git a/kioslave/network/kded/main.cpp b/kioslave/network/kded/main.cpp deleted file mode 100644 index 34e3e760..00000000 --- a/kioslave/network/kded/main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "networkwatcher.h" - -// KDE -#include -#include - - -K_PLUGIN_FACTORY( NetworkWatcherFactory, registerPlugin(); ) - -K_EXPORT_PLUGIN( NetworkWatcherFactory("networkwatcher") ) diff --git a/kioslave/network/kded/networkdbusadaptor.cpp b/kioslave/network/kded/networkdbusadaptor.cpp deleted file mode 100644 index d3831867..00000000 --- a/kioslave/network/kded/networkdbusadaptor.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "networkdbusadaptor.h" - -// network -#include -// Qt -#include - - -namespace Mollet -{ - -NetworkDBusAdaptor::NetworkDBusAdaptor( NetworkWatcher* parent ) - : QDBusAbstractAdaptor( parent ) -{ - // TODO: best place to do this? - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); -} - -NetDevice NetworkDBusAdaptor::deviceData( const QString& hostAddress ) -{ - return parent()->deviceData( hostAddress ); -} -NetService NetworkDBusAdaptor::serviceData( const QString& hostAddress, const QString& serviceName, const QString& serviceType ) -{ - return parent()->serviceData( hostAddress, serviceName, serviceType ); -} -NetDeviceList NetworkDBusAdaptor::deviceDataList() -{ - return parent()->deviceDataList(); -} -NetServiceList NetworkDBusAdaptor::serviceDataList( const QString& hostAddress ) -{ - return parent()->serviceDataList( hostAddress ); -} - -NetworkDBusAdaptor::~NetworkDBusAdaptor() -{ -} - -} diff --git a/kioslave/network/kded/networkdbusadaptor.h b/kioslave/network/kded/networkdbusadaptor.h deleted file mode 100644 index b0421765..00000000 --- a/kioslave/network/kded/networkdbusadaptor.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORKDBUSADAPTOR_H -#define NETWORKDBUSADAPTOR_H - -// kded -#include "networkwatcher.h" -// -#include -// Qt -#include -#include - - -namespace Mollet -{ - -// TODO: see file networkdbus.h -class NetworkDBusAdaptor: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.network") - - public: - explicit NetworkDBusAdaptor( NetworkWatcher* parent ); - virtual ~NetworkDBusAdaptor(); - - public: - NetworkWatcher* parent() const; - - public Q_SLOTS: - Mollet::NetDevice deviceData( const QString& hostAddress ); - Mollet::NetService serviceData( const QString& hostAddress, const QString& serviceName, const QString& serviceType ); - Mollet::NetDeviceList deviceDataList(); - Mollet::NetServiceList serviceDataList( const QString& hostAddress ); -}; - - -inline NetworkWatcher* NetworkDBusAdaptor::parent() const { return static_cast( QObject::parent() ); } - -} - -#endif diff --git a/kioslave/network/kded/networkwatcher.cpp b/kioslave/network/kded/networkwatcher.cpp deleted file mode 100644 index 8c544b27..00000000 --- a/kioslave/network/kded/networkwatcher.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "networkwatcher.h" - -// module -#include "networkdbusadaptor.h" -#include "kioslavenotifier.h" -// network -#include - - -namespace Mollet -{ - -NetworkWatcher::NetworkWatcher( QObject* parent, const QList& parameters ) - : KDEDModule( parent ) -{ -Q_UNUSED( parameters ) - mNetwork = Network::network(); - - new KioSlaveNotifier( mNetwork ); - - new NetworkDBusAdaptor( this ); - QDBusConnection::sessionBus().registerService( QString::fromLatin1("org.kde.kded") ); - QDBusConnection::sessionBus().registerObject( QString::fromLatin1("/modules/networkwatcher"), this ); -} - -// TODO: instead use networkuri and return QVariant for all these -NetDevice NetworkWatcher::deviceData( const QString& hostAddress ) -{ - NetDevice result; - - const QList deviceList = mNetwork->deviceList(); - foreach( const NetDevice& device, deviceList ) - { - if( device.hostAddress() == hostAddress ) - { - result = device; - break; - } - } - - return result; -} - -NetService NetworkWatcher::serviceData( const QString& hostAddress, const QString& serviceName, const QString& serviceType ) -{ - NetService result; - - const QList deviceList = mNetwork->deviceList(); - foreach( const NetDevice& device, deviceList ) - { - if( device.hostAddress() == hostAddress ) - { - const QList serviceList = device.serviceList(); - - foreach( const NetService& service, serviceList ) - { - if( service.name() == serviceName && service.type() == serviceType ) - { - result = service; - break; - } - } - break; - } - } - - return result; -} - -NetDeviceList NetworkWatcher::deviceDataList() -{ - return mNetwork->deviceList(); -} - -NetServiceList NetworkWatcher::serviceDataList( const QString& hostAddress ) -{ - NetServiceList result; - - const QList deviceList = mNetwork->deviceList(); - foreach( const NetDevice& device, deviceList ) - { - if( device.hostAddress() == hostAddress ) - { - result = device.serviceList(); - break; - } - } - - return result; -} - -NetworkWatcher::~NetworkWatcher() -{ -} - -} diff --git a/kioslave/network/kded/networkwatcher.desktop b/kioslave/network/kded/networkwatcher.desktop deleted file mode 100644 index 714ea7f3..00000000 --- a/kioslave/network/kded/networkwatcher.desktop +++ /dev/null @@ -1,148 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=networkwatcher -X-KDE-DBus-ModuleName=networkwatcher -X-KDE-Kded-autoload=false -X-KDE-Kded-load-on-demand=true -Name=Network Watcher -Name[ar]=مراقب الشبكة -Name[ast]=Visor de redes -Name[bg]=Наблюдение на мрежата -Name[bn]=নেটওয়ার্ক ওয়াচার -Name[bs]=Nadzornik mreže -Name[ca]=Vigilant de la xarxa -Name[ca@valencia]=Vigilant de la xarxa -Name[cs]=Sledování sítě -Name[csb]=Dozérôcz sécë -Name[da]=Netværksovervåger -Name[de]=Netzwerküberwachung -Name[el]=Επόπτης δικτύων -Name[en_GB]=Network Watcher -Name[eo]=Kontrolilo de reto -Name[es]=Observador de redes -Name[et]=Võrgujälgija -Name[eu]=Sare-behatzailea -Name[fa]=دیده‌بان شبکه -Name[fi]=Verkkotilan valvoja -Name[fr]=Surveillance du réseau -Name[fy]=Netwurk sjogger -Name[ga]=Fairtheoir Líonra -Name[gl]=Vixilante da rede -Name[gu]=નેટવર્ક દેખરેખ -Name[he]=מנטר הרשת -Name[hi]=नेटवर्क चौकीदार -Name[hr]=Nadzornik mreže -Name[hu]=Hálózatfigyelő -Name[ia]=Observator de Rete -Name[id]=Pengawas Jaringan -Name[is]=Netskoðunartól -Name[it]=Guardia di rete -Name[ja]=ネットワークウォッチゃ -Name[kk]=Желі бақылауышы -Name[km]=កម្មវិធីមើល​បណ្ដាញ -Name[kn]=ಜಾಲಬಂಧ ನೋಡುಗ(ವಾಚರ್) -Name[ko]=네트워크 모니터 -Name[lt]=Tinklo stebėtojas -Name[lv]=Tīkla novērotājs -Name[mai]=नेटवर्क वाचर -Name[mk]=Анализатор на мрежи -Name[ml]=ശൃംഖല നിരീക്ഷകന്‍ -Name[mr]=संजाळ नोंदकर्ता -Name[nb]=Nettverksovervåker -Name[nds]=Nettwark-Kieker -Name[nl]=Netwerkbewaker -Name[nn]=Nettverksovervakar -Name[pa]=ਨੈੱਟਵਰਕ ਵਾਂਚਰ -Name[pl]=Analizator sieci -Name[pt]=Vigilante da Rede -Name[pt_BR]=Monitor de rede -Name[ro]=Supraveghetor rețea -Name[ru]=Слежение за сетевыми папками -Name[si]=ජාල විශ්ලේෂකය -Name[sk]=Sledovanie siete -Name[sl]=Opazovalnik omrežja -Name[sr]=Надзорник мреже -Name[sr@ijekavian]=Надзорник мреже -Name[sr@ijekavianlatin]=Nadzornik mreže -Name[sr@latin]=Nadzornik mreže -Name[sv]=Nätverksövervakare -Name[tg]=Нигаҳбони шабакаи Интернет -Name[th]=เครื่องมือสอดส่องเครือข่าย -Name[tr]=Ağ İzleyici -Name[ug]=تور كۆزەتچى -Name[uk]=Наглядач мережі -Name[vi]=Trình theo dõi mạng -Name[wa]=Waiteu d' rantoele -Name[x-test]=xxNetwork Watcherxx -Name[zh_CN]=网络监视器 -Name[zh_TW]=網路監控器 -Comment=Keeps track of the network and updates directory listings of the network:/ protocol -Comment[ar]=تعقب لوائح الشبكة وتحديثات الأدلة للشبكة:/ -Comment[ast]=Rexistra la rede y los anovamientos de llistaos de direutorios del protocolu network:/ -Comment[bg]=Наблюдение на мрежата и обновяване на съответните списъци на мрежовия протокол -Comment[bn]=নেটওয়ার্ক-এর ওপর লক্ষ্য রাখে এবং প্রয়োজনমত network:/ প্রোটোকল-এর ডিরেক্টরি তালিকা আপডেট করে -Comment[bs]=Prati mrežu i ažurira ispise fascikli protokola network:/ -Comment[ca]=Fa un seguiment de la xarxa i actualitza els llistats de directoris del protocol network:/ -Comment[ca@valencia]=Fa un seguiment de la xarxa i actualitza els llistats de directoris del protocol network:/ -Comment[cs]=Udržuje přehled o síti a aktualizuje výpisy adresářů protokolu network:/ -Comment[csb]=Dozérô sécë ë aktualizëje wëskrzënianié katalogów sécë:/ protocol -Comment[da]=Holder øje med netværket og opdaterer mappelister for protokollen network:/ -Comment[de]=Überwacht das Netzwerk und aktualisiert Ordnerauflistungen des Protokolls „network:/“ -Comment[el]=Καταγραφή του δικτύου και ενημέρωση της λίστας των φακέλων του δικτύου:/πρωτόκολλο -Comment[en_GB]=Keeps track of the network and updates directory listings of the network:/ protocol -Comment[eo]=Ĝi konservas spuron de la reto kaj ĝisdatigas liston de dosierujoj de la protokolo network:/ -Comment[es]=Registra la red y las actualizaciones de listados de directorios del protocolo network:/ -Comment[et]=Hoiab võrgul silma peal ja uuendab protokolli network:/ kataloogide nimekirja -Comment[eu]=Sarearen segimendua egiten du eta network:/ protokoloaren direktorio-zerrendak eguneratzen ditu -Comment[fi]=Pitää kirjaa verkosta ja päivittää network:/-yhteyskäytännön kansioluettelot -Comment[fr]=Conserve des enregistrements du réseau et met à jour les contenus des dossiers pour le protocole « network:/ » -Comment[fy]=Hâld de netwurk en fernijings triemtafel listen fan it network:/ protocol yn de gaten -Comment[ga]=Coimeádann sé cuntas ar an líonra agus nuashonraíonn comhadlanna den phrótacal network:/ -Comment[gl]=Mantén un rexistro e actualiza as listas de cartafoles do protocolo network:/ -Comment[gu]=નેટવર્કની દેખરેખ રાખે છે અને network:/ પ્રોટોકોલની ડિરેક્ટરી યાદીઓ સુધારે છે -Comment[he]=משמש למעקב אחר הרשת ולעידכון של רשימת התיקיות בפרוטוקול network:/ -Comment[hi]=संजाल की जानकारी रखता है और संजाल के निर्देशिका सूचियाँ का अद्यतन करता है:/ protocol -Comment[hr]=Pazi na mrežu i ažurira popis direktorija protokola network:/ -Comment[hu]=Figyeli a hálózat állapotát és frissíti a mappalistákat a network:/ protokollal -Comment[ia]=Il mantene tracia del rete e il actualisa listas de directorio de le rete:/protocollo -Comment[id]=Pemantauan jaringan dan pemutakhiran pendaftaran direktori dari protokol network:/ -Comment[is]=Fylgist með netvirkni og uppfærir möppubreytingar með network:/ samskiptareglunni -Comment[it]=Tiene traccia della rete e aggiorna la lista delle cartelle del protocollo network:/ -Comment[ja]=ネットワークのトラックを保持し、network:/ プロトコルのディレクトリリスティングを更新します -Comment[kk]=Желіке бақылап отырып network:/ протоколы тізімдерінің қапшығын жаңартып отырады -Comment[km]=តាមដាន​បណ្ដាញ និង​​ធ្វើ​បច្ចុប្បន្នភាព​ថត ​ដោយ​រាយ​ពិធីការ network:/ -Comment[ko]=네트워크의 변경 사항을 추적하며 network:/ 프로토콜의 디렉터리 목록을 업데이트합니다 -Comment[lt]=Seka tinklą ir atnaujina aplankų sąrašą network:/ protokolui -Comment[lv]=Seko līdzi tīkam un atjaunina network:/ protokola mapju sarakstus -Comment[mk]=Ја следи мрежата и ги ажурира приказите на папки од протоколот network:/ -Comment[ml]=network:/ പ്രോട്ടോകോളില്‍ ശൃംഖലയുടേയും തട്ടുകളുടെ പട്ടികകളേയും നിരീക്ഷിയ്ക്കുന്നു -Comment[mr]=संजाळावर लक्ष ठेउन त्यातील संचयीका यादी अद्ययावत ठेवतो -Comment[nb]=Holder øye med nettverket og oppdaterer katalogoppføringer for protokollen network:/ -Comment[nds]=Beluert dat Nettwark un frischt Orner-Oplisten vun't network:/-Protokoll op -Comment[nl]=Bewaakt het netwerk en actualiseert de mappenweergave van het network:/ protocol -Comment[nn]=Held auge med nettverket og oppdaterer kataloglistene i network:/-protokollen -Comment[pa]=network:/ ਪਰੋਟੋਕਾਲ ਰਾਹੀਂ ਦਿੱਤੀਆਂ ਡਾਇਰੈਕਟਰੀਆਂ ਤੇ ਨੈੱਟਵਰਕ ਬਾਰੀ ਜਾਣਕਾਰੀ ਰੱਖੋ -Comment[pl]=Śledzi sieć i uaktualnia zawartości katalogów dla protokołu network:/ -Comment[pt]=Mantém um registo da rede e actualiza as listagens de pastas no protocolo 'network:/' -Comment[pt_BR]=Monitora a rede e atualiza a listagem de diretórios do protocolo network:/ -Comment[ro]=Duce evidența rețelei și actualizează conținutul dosarelor protocolului network:/ -Comment[ru]=Поиск служб и обновление содержимого каталогов по протоколу network:/ -Comment[si]=ජාලය හා ජාලයේ:/ ක්‍රියාපටිපාටියේ යාවත්කාලීනබහාළුම් ලැයිස්තුගත කිරීමගැන විමසිල්ලෙන් සිටින්න -Comment[sk]=Udržuje prehľad o sieti a aktualizuje výpisy adresárov protokolu network:/ -Comment[sl]=Sledi omrežju in posodablja seznam map za protokol network:/ -Comment[sr]=Прати мрежу и ажурира исписе фасцикли протокола network:/ -Comment[sr@ijekavian]=Прати мрежу и ажурира исписе фасцикли протокола network:/ -Comment[sr@ijekavianlatin]=Prati mrežu i ažurira ispise fascikli protokola network:/ -Comment[sr@latin]=Prati mrežu i ažurira ispise fascikli protokola network:/ -Comment[sv]=Håller reda på nätverket och uppdaterar kataloglistningar för protokollet network:/ -Comment[tg]=Фаъолияти шабакаи Интернетро қайд мекунад ва мазмуни феҳрасти шабакаро навсозӣ мекунад:/ қарордод -Comment[th]=คอยติดตามการปรับปรุงของเครือข่าย และการปรับปรุงของไดเรกทอรีผ่านโพรโทคอล network:/ -Comment[tr]=Ağı ve network:/ protokolündeki dizin güncellemelerini izler -Comment[ug]=ئىزلاش تورى ۋە network:/ كېلىشىمى كۆرسەتكەن مۇندەرىجىنىڭ يېڭىلىنىش ئەھۋالى -Comment[uk]=Стежить за мережею і оновлює списки каталогів протоколу network:/ -Comment[vi]=Theo dõi mạng và cập nhật danh sách thư mục trong giao thức network:// -Comment[wa]=Wåde ene trace des djivêyes des ridants del rantoele et des metaedjes a djoû do protocole network:/ -Comment[x-test]=xxKeeps track of the network and updates directory listings of the network:/ protocolxx -Comment[zh_CN]=跟踪网络及 network:/ 协议所列目录的更新情况 -Comment[zh_TW]=保持追蹤此網路,並更新 network:/ 協定中的目錄清單 diff --git a/kioslave/network/kded/networkwatcher.h b/kioslave/network/kded/networkwatcher.h deleted file mode 100644 index 1643bd29..00000000 --- a/kioslave/network/kded/networkwatcher.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of the network kioslave, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORKWATCHER_H -#define NETWORKWATCHER_H - -// KDE -#include - -namespace Mollet -{ -class Network; -class NetDevice; -class NetService; -typedef QList NetDeviceList; -typedef QList NetServiceList; - - -class NetworkWatcher : public KDEDModule -{ - Q_OBJECT - - public: - NetworkWatcher( QObject* parent, const QList& parameters ); - virtual ~NetworkWatcher(); - - public: - Mollet::NetDevice deviceData( const QString& hostAddress ); - Mollet::NetService serviceData( const QString& hostAddress, const QString& serviceName, const QString& serviceType ); - Mollet::NetDeviceList deviceDataList(); - Mollet::NetServiceList serviceDataList( const QString& hostAddress ); - - private: - Network* mNetwork; -}; - -} - -#endif diff --git a/kioslave/network/kded/org.kde.network.kioslavenotifier.xml b/kioslave/network/kded/org.kde.network.kioslavenotifier.xml deleted file mode 100644 index 5d85c1e8..00000000 --- a/kioslave/network/kded/org.kde.network.kioslavenotifier.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/kioslave/network/kded/org.kde.network.xml b/kioslave/network/kded/org.kde.network.xml deleted file mode 100644 index 17c644cf..00000000 --- a/kioslave/network/kded/org.kde.network.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/kioslave/network/network/CMakeLists.txt b/kioslave/network/network/CMakeLists.txt deleted file mode 100644 index a243e4cc..00000000 --- a/kioslave/network/network/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -project( molletnetwork ) - -include_directories( - builder -) - -set( netsystemdriver_SRCS - builder/simpleitemfactory.cpp -) - -set( dnssdnetworkbuilder_SRCS - builder/dnssd/dnssdnetworkbuilder.cpp -) - -set( upnpnetworkbuilder_SRCS - builder/upnp/cagibidevice.cpp - builder/upnp/cagibidbuscodec.cpp - builder/upnp/upnpnetworkbuilder.cpp -) - -set( networkbuilder_SRCS - builder/abstractnetworkbuilder.cpp - builder/abstractnetsystemfactory.cpp -) - -set( networkdbus_LIB_SRCS - networkdbus.cpp -) - -set( molletnetwork_LIB_SRCS - ${netsystemdriver_SRCS} - ${upnpnetworkbuilder_SRCS} - ${dnssdnetworkbuilder_SRCS} - ${networkbuilder_SRCS} - ${networkdbus_LIB_SRCS} - network_p.cpp - network.cpp - netdevice_p.cpp - netdevice.cpp - netservice_p.cpp - netservice.cpp -) - - -set( molletnetwork_LINK_LIBS - ${KDE4_KDECORE_LIBS} - ${KDE4_KDNSSD_LIBS} - ${QT_QTNETWORK_LIBRARY} - ${QT_QTGUI_LIBRARY} -) - -add_library( molletnetwork SHARED ${molletnetwork_LIB_SRCS} ) -target_link_libraries( molletnetwork ${molletnetwork_LINK_LIBS} ) - -set_target_properties(molletnetwork PROPERTIES - VERSION ${GENERIC_LIB_VERSION} - SOVERSION ${GENERIC_LIB_SOVERSION} -) - -generate_export_header(molletnetwork) - -install( TARGETS molletnetwork ${INSTALL_TARGETS_DEFAULT_ARGS} ) diff --git a/kioslave/network/network/README b/kioslave/network/network/README deleted file mode 100644 index 5089726c..00000000 --- a/kioslave/network/network/README +++ /dev/null @@ -1,44 +0,0 @@ -How does the network get constructed? -============================================= - -There are two kind of objects: -a) adapters to the service discovery systems -b) factories to build network items - -Then there are adapter-specific interface for the factories, so a adapter can -handover its system-specific data to the factory. - -The factories understand the data structure the adapters hand over (given they -implement its interface) and construct the matching network items, e.g. a -NetDevice or a NetService of a certain type. -The adapters listen to the discovery systems and on a new item reported by the -system ask those factories which implemented their interface if they could -turn that into an object in terms of the network library and then tell them -to do so if they can. - -Examples: -interface: DNSSDNetSystemAble -adapter: DNSSDNetworkBuilder -factory: SimpleItemFactory (only one so far, anyway) - -Reasoning for this approach: -With a plugin system yet to come, one could install a new factory for a -service type "coffee/tea filling level", which could understand data from two -or three adapters, so you do not need an extra factory for each adapter, but -have a central point of competence. - -So now for a new backend you would need to do add these things: -a) NEWNetSystemAble -b) NEWNetworkBuilder -c) have SimpleItemFactory implement NEWNetSystemAble - -SimpleItemFactory is just, as the name should hint, a simple factory, which -turns a service description into a plain NetService item, without any -additional logic or behaviour. Later on it is planned to have factories which can -create complete proxy objects to services on the network. But that needs some -more thoughts. Stuff for KDE 4.4, including considering a Solid integration - -The device type detection (heuristics based) is currently pretty bogus and -just works for a certain private network, so do not wonder about that part of -the code :) It should be really turned of before the 4.3 release and for the time -given just have one type of device: a device. diff --git a/kioslave/network/network/TODO b/kioslave/network/network/TODO deleted file mode 100644 index 9b457ce7..00000000 --- a/kioslave/network/network/TODO +++ /dev/null @@ -1,97 +0,0 @@ -Add backends for -* SLP -* Jini -* UPnP -* SMB -* manually added devices/services - -> means also support for state not-present -* scanning? - -list of dns-ds service types: http://www.dns-sd.org/ServiceTypes.html - -See if there could be a xdg database of products with device ontology/categories. - -Add a device guesser which tries to estimate the type of device by the services -(or even with a dedicated protocol if there is one?) - -Devices: -* Fileserver/-storage -* Webserver -* Desktop-like Computer (human-interface general purpose) - * wearable - * MID - * Handheld - * E-Book reader (is media renderer?) - * Laptop -* Game server -* Server -* Router -* Internet Gateway Device (IGD) -* Mediaserver -* Mediarenderer -* HVAC -* Scanner -* WLAN Access point -* Digital Security camera -* Wearable -* Augmented-reality device (headmounted) - - -Questions: -What is a (virtual) device, what is a service? -Aren't all servives virtual devices? -So present as device or service? - -Some devices use services as interface utility (e.g. a http server for SOAP). -Separate human/computer-usable services? -Firstlevel service and secondlevel service? - -Physical objects should be represented as physical objects. Perhaps mark with flag. -Which of the virtual machines in a server is the physical one if the vm host doesn't show up? - -How to handle unknown devices? -Who might want to see them? Developers? -Or users, to see it's there but not supported (=without a driver)? -There could be a user editable whitelist/blacklist. - -Support should be plugin-based, so 3-party developers can easily try to develop their own drivers. - - -There need to be servicetype-specific handlers which can create the service proxy object. -Should be able to register to different discovery backends (collision handling by priority perhaps). -For now simple listing with non-funct system items will do. - - - { "_presence._tcp", "presence", "inode/vnd.kde.service.presence", "im-user", false, 0, 0, 0, 0 }, -// presence http://www.xmpp.org/registrar/linklocal.html -// "1st", firstName, "email", emailAddress, "last", lastName, "status", "avail"); -// TODO: make this first non-simple item, showing addressbook entry - - // KDE - { "_knotes._tcp", "knotes", "inode/vnd.kde.service.knotes", "knotes", false, "http", 0, 0, 0 }, - - - - QList& deviceList = mNetworkPrivate->deviceList(); - static const char* DeviceNamen[] = - { - "Datensafe.local", - "Schleuder.local", - "Phlox.local", - "buntekuh.local" - }; - for( int i=0; i<4; ++i ) - { - const QString hostName( DeviceNamen[i] ); - const QString deviceName = hostName.left( hostName.indexOf('.') ); - NetDevicePrivate* d = new NetDevicePrivate( deviceName, hostName ); - d->setType( NetDevice::Workstation ); - - NetDevice device( d ); - deviceList.append( device ); - - QList newDevices; - newDevices.append( device ); - mNetworkPrivate->emitDevicesAdded( newDevices ); - } - diff --git a/kioslave/network/network/builder/abstractnetsystemfactory.cpp b/kioslave/network/network/builder/abstractnetsystemfactory.cpp deleted file mode 100644 index 2a7f946a..00000000 --- a/kioslave/network/network/builder/abstractnetsystemfactory.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "abstractnetsystemfactory.h" diff --git a/kioslave/network/network/builder/abstractnetsystemfactory.h b/kioslave/network/network/builder/abstractnetsystemfactory.h deleted file mode 100644 index 80f5a655..00000000 --- a/kioslave/network/network/builder/abstractnetsystemfactory.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef ABSTRACTNETSYSTEMFACTORY_H -#define ABSTRACTNETSYSTEMFACTORY_H - -// Qt -#include - - -namespace Mollet -{ - -class AbstractNetSystemFactory : public QObject -{ - Q_OBJECT - - public: - virtual ~AbstractNetSystemFactory(); - - public: // API to be implemented -}; - - -inline AbstractNetSystemFactory::~AbstractNetSystemFactory() {} - -} - -#endif diff --git a/kioslave/network/network/builder/abstractnetworkbuilder.cpp b/kioslave/network/network/builder/abstractnetworkbuilder.cpp deleted file mode 100644 index c2b15d41..00000000 --- a/kioslave/network/network/builder/abstractnetworkbuilder.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "abstractnetworkbuilder.h" diff --git a/kioslave/network/network/builder/abstractnetworkbuilder.h b/kioslave/network/network/builder/abstractnetworkbuilder.h deleted file mode 100644 index 1b2ad1ef..00000000 --- a/kioslave/network/network/builder/abstractnetworkbuilder.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef ABSTRACTNETWORKBUILDER_H -#define ABSTRACTNETWORKBUILDER_H - -// Qt -#include - -namespace Mollet -{ -class AbstractNetSystemFactory; - - -class AbstractNetworkBuilder : public QObject -{ - Q_OBJECT - - public: - virtual ~AbstractNetworkBuilder(); - - public: // API to be implemented - // build initial table synch -// virtual void init() = 0; - // build initial table asynch -// virtual void startInit() = 0; - - // TODO: how to handle previously found, but unknown (or now-underpriorized) services? ignore and wait for rescan? - virtual void registerNetSystemFactory( AbstractNetSystemFactory* netSystemFactory ) = 0; - // temporary solution: have all factories set, then call start - virtual void start() = 0; - - - // drop all knowledge and restart -// virtual void rescan() -// virtual void startRescan() - - Q_SIGNALS: - /** initial structure build */ - void initDone(); -}; - - -inline AbstractNetworkBuilder::~AbstractNetworkBuilder() {} - -} - -#endif diff --git a/kioslave/network/network/builder/dnssd/dnssdnetsystemable.h b/kioslave/network/network/builder/dnssd/dnssdnetsystemable.h deleted file mode 100644 index eb4fe7ba..00000000 --- a/kioslave/network/network/builder/dnssd/dnssdnetsystemable.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef DNSSDNETSYSTEMABLE_H -#define DNSSDNETSYSTEMABLE_H - -// KDE -#include -// Qt -#include - -namespace Mollet { -class NetServicePrivate; -class NetDevice; -} -#include - - -namespace Mollet -{ - -class DNSSDNetSystemAble -{ - public: - virtual ~DNSSDNetSystemAble(); - - public: // API to be implemented - virtual bool canCreateNetSystemFromDNSSD( const QString& serviceType ) const = 0; - virtual NetServicePrivate* createNetService( const DNSSD::RemoteService::Ptr& service, const NetDevice& device ) const = 0; - virtual QString dnssdId( const DNSSD::RemoteService::Ptr& dnssdService ) const = 0; -}; - - -inline DNSSDNetSystemAble::~DNSSDNetSystemAble() {} - -} - -Q_DECLARE_INTERFACE( Mollet::DNSSDNetSystemAble, "org.kde.mollet.dnssdnetsystemable/1.0" ) - -#endif diff --git a/kioslave/network/network/builder/dnssd/dnssdnetworkbuilder.cpp b/kioslave/network/network/builder/dnssd/dnssdnetworkbuilder.cpp deleted file mode 100644 index 12deb6fa..00000000 --- a/kioslave/network/network/builder/dnssd/dnssdnetworkbuilder.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009-2010 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "dnssdnetworkbuilder.h" - -// lib -#include "dnssdnetsystemable.h" -#include "abstractnetsystemfactory.h" -#include "network_p.h" -#include "netdevice_p.h" -// KDE -#include -#include -// Qt -#include -#include - -#include - - -namespace Mollet -{ - -DNSSDNetworkBuilder::DNSSDNetworkBuilder( NetworkPrivate* networkPrivate ) - : AbstractNetworkBuilder() - , mNetworkPrivate( networkPrivate ) - , mServiceTypeBrowser( 0 ) -{ -} - - -void DNSSDNetworkBuilder::registerNetSystemFactory( AbstractNetSystemFactory* netSystemFactory ) -{ - DNSSDNetSystemAble* dnssdNetSystemAble = qobject_cast( netSystemFactory ); - - if( dnssdNetSystemAble ) - mNetSystemFactoryList.append( dnssdNetSystemAble ); -} - -void DNSSDNetworkBuilder::start() -{ - mIsInit = true; - mNoOfInitServiceTypes = 0; - - mServiceTypeBrowser = new DNSSD::ServiceTypeBrowser(); - connect( mServiceTypeBrowser, SIGNAL(serviceTypeAdded(QString)), - SLOT(addServiceType(QString)) ); - connect( mServiceTypeBrowser, SIGNAL(serviceTypeRemoved(QString)), - SLOT(removeServiceType(QString)) ); - connect( mServiceTypeBrowser, SIGNAL(finished()), SLOT(onServiceTypeBrowserFinished()) ); -// TODO: add a signal network initialized to Network, so is cleared when first usable - mServiceTypeBrowser->startBrowse(); -} - -void DNSSDNetworkBuilder::addServiceType( const QString& serviceType ) -{ -kDebug()<startBrowse(); -} - -void DNSSDNetworkBuilder::removeServiceType( const QString& serviceType ) -{ -kDebug()<::Iterator it = mServiceBrowserTable.find( serviceType ); - - if( it == mServiceBrowserTable.end() ) - return; - - DNSSD::ServiceBrowser* serviceBrowser = *it; - mServiceBrowserTable.erase( it ); - // TODO: will all servicesRemoved be called before? on test NO! - serviceBrowser->deleteLater(); -#endif -} - -void DNSSDNetworkBuilder::addService( DNSSD::RemoteService::Ptr service ) -{ - QList& deviceList = mNetworkPrivate->deviceList(); - - QString hostName = service->hostName(); - // TODO: this blocks. and the ip address should be delivered from DNS-SD with resolve - const QHostAddress hostAddress = DNSSD::ServiceBrowser::resolveHostName( hostName ); - const QString ipAddress = hostAddress.toString(); - // forget domain name if just ip address - if( hostName == ipAddress ) - hostName.clear(); - - // device TODO: only search for if we can create the service? - NetDevicePrivate* d = 0; - const NetDevice* deviceOfService = 0; - foreach( const NetDevice& device, deviceList ) - { - const QString deviceHostName = device.hostName(); - const bool useIpAddress = ( deviceHostName.isEmpty() || hostName.isEmpty() ); - const bool isSameAddress = useIpAddress ? - ( device.ipAddress() == ipAddress ) : - ( deviceHostName == hostName ); -kDebug()<<"existing device:"<serviceName() is fragile, but matches - // current approach in removeService(...) - QString id; - const QString serviceType = service->type(); - foreach( const DNSSDNetSystemAble* factory, mNetSystemFactoryList ) - { - if( factory->canCreateNetSystemFromDNSSD(serviceType) ) - { - id = factory->dnssdId( service ); - break; - } - } - if( d->hasService(id) ) - return; - - deviceOfService = &device; - break; - } - } - if( !d ) - { - const QString deviceName = hostName.left( hostName.indexOf(QLatin1Char('.')) ); - d = new NetDevicePrivate( deviceName ); - d->setHostName( hostName ); - d->setIpAddress( ipAddress ); - NetDevice device( d ); - deviceList.append( device ); - deviceOfService = &deviceList.last(); - - QList newDevices; - newDevices.append( device ); - // TODO: the new service will be announced two times, once with the new device and once alone. - // what to do about that? which order? okay? for now just do not attach services before. find usecases. - mNetworkPrivate->emitDevicesAdded( newDevices ); -kDebug()<<"new device:"<type(); - } - else - { - if( d->hostName().isEmpty() && ! hostName.isEmpty() ) - d->setHostName( hostName ); - } - - - const QString serviceType = service->type(); - - NetServicePrivate* netServicePrivate = 0; - // do a priority based lookup who can build the object - // TODO: priorisation - foreach( const DNSSDNetSystemAble* factory, mNetSystemFactoryList ) - { - if( factory->canCreateNetSystemFromDNSSD(serviceType) ) - { - // TODO: here we should rather see if this service already exists - netServicePrivate = factory->createNetService( service, *deviceOfService ); - break; - } - } - // TODO: create dummy service -// if( ! netServicePrivate ) -// netServicePrivate = new UnknownService; - - NetService netService( netServicePrivate ); - d->addService( netService ); - - // try guessing the device type by the services on it - // TODO: move into devicefactory - NetDevice::Type deviceTypeByService = NetDevice::Unknown; - QString deviceName; - if( serviceType == QLatin1String("_workstation._tcp") ) - { - deviceTypeByService = NetDevice::Workstation; - deviceName = service->serviceName().left( service->serviceName().lastIndexOf(QLatin1Char('[')) ).trimmed(); - } - else if( serviceType == QLatin1String("_net-assistant._udp") ) - { - deviceTypeByService = NetDevice::Workstation; - deviceName = service->serviceName(); - } - else if( serviceType == QLatin1String("_airport._tcp") ) - deviceTypeByService = NetDevice::Router; - else if( serviceType == QLatin1String("_ipp._tcp") - || serviceType == QLatin1String("_printer._tcp") - || serviceType == QLatin1String("_pdl-datastream._tcp") ) - { - deviceTypeByService = NetDevice::Printer; - deviceName = service->serviceName(); - } - - if( deviceTypeByService != NetDevice::Unknown ) - { - if( deviceTypeByService > d->type() ) - { - d->setType( deviceTypeByService ); - if( ! deviceName.isEmpty() ) - d->setName( deviceName ); - } - } - - QList newServices; - newServices.append( netService ); - mNetworkPrivate->emitServicesAdded( newServices ); -} - -// TODO: each builder should refcount its services, so a shared one does not get removed to early -// (might disappear for one sd because of master breakdown) -void DNSSDNetworkBuilder::removeService( DNSSD::RemoteService::Ptr service ) -{ - QList& deviceList = mNetworkPrivate->deviceList(); - - const QString hostName = service->hostName(); - - // device - QMutableListIterator it( deviceList ); - while( it.hasNext()) - { - const NetDevice& device = it.next(); - if( device.hostName() == hostName ) - { -// kDebug()<type(); - foreach( const DNSSDNetSystemAble* factory, mNetSystemFactoryList ) - { - if( factory->canCreateNetSystemFromDNSSD(serviceType) ) - { - id = factory->dnssdId( service ); - break; - } - } - NetDevicePrivate* d = device.dPtr(); - NetService netService = d->removeService( id ); - if( !netService.isValid() ) - break; - - QList removedServices; - removedServices.append( netService ); - mNetworkPrivate->emitServicesRemoved( removedServices ); - - // remove device on last service - if( d->serviceList().count() == 0 ) - { - QList removedDevices; - removedDevices.append( device ); - // remove only after taking copy from reference into removed list - it.remove(); - - mNetworkPrivate->emitDevicesRemoved( removedDevices ); - } - break; - } - } -} - -void DNSSDNetworkBuilder::onServiceTypeBrowserFinished() -{ -// kDebug(); - if( mIsInit ) - { - mIsInit = false; - if( mNoOfInitServiceTypes == 0 ) - emit initDone(); - } -} - -void DNSSDNetworkBuilder::onServiceBrowserFinished() -{ - --mNoOfInitServiceTypes; -// kDebug()<<"mIsInit="< - - 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 . -*/ - -#ifndef DNSSDNETWORKBUILDER_H -#define DNSSDNETWORKBUILDER_H - -// lib -#include "abstractnetworkbuilder.h" -#include "network.h" -#include "netdevice.h" -// KDE -#include -// Qt -#include - -namespace Mollet { -class DNSSDNetSystemAble; -} - -namespace DNSSD { -class ServiceBrowser; -class ServiceTypeBrowser; -} - - -namespace Mollet -{ - -class DNSSDNetworkBuilder : public AbstractNetworkBuilder -{ - Q_OBJECT - - public: - explicit DNSSDNetworkBuilder( NetworkPrivate* networkPrivate ); - virtual ~DNSSDNetworkBuilder(); - - public: // AbstractNetworkBuilder API - virtual void registerNetSystemFactory( AbstractNetSystemFactory* netSystemFactory ); - virtual void start(); - - private Q_SLOTS: - void addServiceType( const QString& serviceType ); - void addService( DNSSD::RemoteService::Ptr service ); - void removeServiceType( const QString& serviceType ); - void removeService( DNSSD::RemoteService::Ptr service ); - - void onServiceTypeBrowserFinished(); - void onServiceBrowserFinished(); - - private: // data - NetworkPrivate* mNetworkPrivate; - - DNSSD::ServiceTypeBrowser* mServiceTypeBrowser; - QHash mServiceBrowserTable; - - QList mNetSystemFactoryList; - - bool mIsInit; - int mNoOfInitServiceTypes; -}; - -} - -#endif diff --git a/kioslave/network/network/builder/simpleitemfactory.cpp b/kioslave/network/network/builder/simpleitemfactory.cpp deleted file mode 100644 index 4d850d29..00000000 --- a/kioslave/network/network/builder/simpleitemfactory.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009-2010 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "simpleitemfactory.h" - -// lib -#include "netservice_p.h" -// #include "service.h" -#include "upnp/cagibidevice.h" - -// Qt -#include - -// KDE -#include - -#include - -namespace Mollet -{ - -struct DNSSDServiceDatum { - const char* dnssdTypeName; - const char* typeName; - const char* fallbackIconName; - bool isFilesystem; - const char* protocol; // KDE can forward to it - const char* pathField; - const char* iconField; - const char* userField; - const char* passwordField; - - void feedUrl( KUrl* url, const DNSSD::RemoteService* remoteService ) const; -}; - -static const DNSSDServiceDatum DNSSDServiceData[] = -{ - // file services - { "_ftp._tcp", "ftp", "folder-remote", true, "ftp", "path", 0, "u", "p" }, - { "_sftp-ssh._tcp", "sftp-ssh", "folder-remote", true, "sftp", 0, 0, "u", "p" }, - { "_ftps._tcp", "ftps", "folder-remote", true, "ftps", "path", 0, "u", "p" }, - { "_nfs._tcp", "nfs", "folder-remote", true, "nfs", "path", 0, 0, 0 }, - { "_afpovertcp._tcp", "afpovertcp", "folder-remote", true, "afp", "path", 0, 0, 0 }, - { "_smb._tcp", "smb", "folder-remote", true, "smb", "path", 0, "u", "p" }, - - // shell services - { "_ssh._tcp", "ssh", "terminal", false, "ssh", 0, 0, "u", "p" }, - { "_telnet._tcp", "telnet", "terminal", false, "telnet", 0, 0, "u", "p" }, - { "_rfb._tcp", "rfb", "krfb", false, "vnc", "path", 0, "u", "p" }, - { "_rdp._tcp", "rdp", "krfb", false, "rdp", 0, 0, 0, 0 }, - - // other standard services - { "_http._tcp", "http", "folder-html", false, "http", "path", 0, "u", "p" }, - { "_ntp._udp", "ntp", "xclock", false, 0, 0, 0, 0, 0 }, - { "_ldap._tcp", "ldap", "user-group-properties", false, "ldap", 0, 0, 0, 0 }, - - // user2user (chat, collaboration) - { "_xmpp-server._tcp", "xmpp-server", "xchat", false, "jabber", 0, 0, 0, 0 }, - { "_presence._tcp", "presence", "im-user", false, "presence", 0, 0, 0, 0 }, - { "_lobby._tcp", "lobby", "document-edit", false, 0, 0, 0, 0, 0 }, - { "_giver._tcp", "giver", "folder-remote", false, 0, 0, 0, 0, 0 }, - { "_sip._udp", "sip", "phone", false, 0, 0, 0, 0, 0 }, - { "_h323._tcp", "h323", "phone", false, 0, 0, 0, 0, 0 }, - { "_skype._tcp", "skype", "phone", false, 0, 0, 0, 0, 0 }, - - // printing - { "_ipp._tcp", "ipp", "printer", false, "ipp", "path", 0, "u", "p" }, - { "_printer._tcp", "printer", "printer", false, 0, 0, 0, 0, 0 }, - { "_pdl-datastream._tcp", "pdl-datastream", "printer", false, 0, 0, 0, 0, 0 }, - - // KDE workspace - { "_plasma._tcp", "plasma", "plasma", false, "plasma", "name", "icon", 0, 0 }, - - // KDE games - { "_kbattleship._tcp", "kbattleship", "kbattleship", false, "kbattleship", 0, 0, 0, 0 }, - { "_lskat._tcp", "lskat", "lskat", false, 0, 0, 0, 0, 0 }, - { "_kfourinline._tcp", "kfourinline", "kfourinline", false, 0, 0, 0, 0, 0 }, - { "_ksirk._tcp", "ksirk", "ksirk", false, 0, 0, 0, 0, 0 }, - - // hardware - { "_pulse-server._tcp","pulse-server","audio-card", false, 0, 0, 0, 0, 0 }, - { "_pulse-source._tcp","pulse-source","audio-input-line", false, 0, 0, 0, 0, 0 }, - { "_pulse-sink._tcp", "pulse-sink", "speaker", false, 0, 0, 0, 0, 0 }, - { "_udisks-ssh._tcp", "udisks-ssh", "drive-harddisk", false, 0, 0, 0, 0, 0 }, - { "_libvirt._tcp", "libvirt", "computer", false, 0, 0, 0, 0, 0 }, - { "_airmouse._tcp", "airmouse", "input-mouse", false, 0, 0, 0, 0, 0 }, - - // database - { "_postgresql._tcp", "postgresql", "server-database", false, 0, 0, 0, 0, 0 }, - { "_couchdb_location._tcp", "couchdb_location", "server-database", false, 0, 0, 0, 0, 0 }, - - // else - { "_realplayfavs._tcp","realplayfavs","favorites", false, 0, 0, 0, 0, 0 }, - { "_acrobatSRV._tcp", "acrobat-server","application-pdf", false, 0, 0, 0, 0, 0 }, - { "_adobe-vc._tcp", "adobe-vc", "services", false, 0, 0, 0, 0, 0 }, - { "_ggz._tcp", "ggz", "applications-games", false, "ggz", 0, 0, 0, 0 }, - - { "_pgpkey-ldap._tcp", "pgpkey-ldap", "application-pgp-keys", false, 0, 0, 0, 0, 0 }, - { "_pgpkey-hkp._tcp", "pgpkey-hkp", "application-pgp-keys", false, 0, 0, 0, 0, 0 }, - { "_pgpkey-https._tcp", "pgpkey-https", "application-pgp-keys", true, "https", "path", 0, 0, 0 }, - - // Maemo - { "_maemo-inf._tcp", "maemo-inf", "pda", false, 0, 0, 0, 0, 0 }, - // TODO: _maemo-inf._tcp seems to be not a service, just some about info, use to identify device and hide - - // Apple - { "_airport._tcp", "airport", "network-wireless", false, 0, 0, 0, 0, 0 }, - { "_daap._tcp", "daap", "folder-sound", false, 0, 0, 0, 0, 0 }, - { "_dacp._tcp", "dacp", "folder-sound", false, 0, 0, 0, 0, 0 }, - { "_eppc._tcp", "eppc", "network-connect", false, 0, 0, 0, 0, 0 }, - { "_net-assistant._udp", "net-assistant", "services", false, 0, 0, 0, 0, 0 }, - { "_odisk._tcp", "odisk", "media-optical", false, 0, 0, 0, 0, 0 }, - { "_raop._tcp", "raop", "speaker", false, 0, 0, 0, 0, 0 }, - { "_touch-able._tcp", "touch-able", "input-tablet", false, 0, 0, 0, 0, 0 }, - { "_workstation._tcp", "workstation", "network-workgroup", false, 0, 0, 0, 0, 0 }, - { "_sleep-proxy._udp", "sleep-proxy", "services", false, 0, 0, 0, 0, 0 }, - { "_nssocketport._tcp", "nssocketport", "services", false, 0, 0, 0, 0, 0 }, - { "_home-sharing._tcp", "home-sharing", "services", false, 0, 0, 0, 0, 0 }, - { "_appletv-itunes._tcp","appletv-itunes","services", false, 0, 0, 0, 0, 0 }, - { "_appletv-pair._tcp", "appletv-pair", "services", false, 0, 0, 0, 0, 0 } -}; -// result["_ssh._tcp"]= DNSSDNetServiceBuilder(i18n("Remote disk (fish)"), "fish", "service/ftp", QString(), "u", "p"); -// network-server-database icon -// see // SubEthaEdit 2 -// Defined TXT keys: txtvers=1, name=, userid=, version=2 - -static const int DNSSDServiceDataSize = sizeof( DNSSDServiceData ) / sizeof( DNSSDServiceData[0] ); - -static const DNSSDServiceDatum UnknownServiceDatum = { "", "unknown", "unknown", false, 0, 0, 0, 0, 0 }; - -// TODO: -// * find out how ws (webservices, _ws._tcp), upnp (_upnp._tcp) are exactly meant to be used -// * learn about uddi -// * see how the apple specific protocols can be used for devicetype identification (printer, scanner) - - -void DNSSDServiceDatum::feedUrl( KUrl* url, const DNSSD::RemoteService* remoteService ) const -{ - const QMap serviceTextData = remoteService->textData(); - - url->setProtocol( QString::fromLatin1(protocol) ); - if( userField ) - url->setUser( QLatin1String(serviceTextData.value(QLatin1String(userField)).constData()) ); - if( passwordField ) - url->setPass( QLatin1String(serviceTextData.value(QLatin1String(passwordField)).constData()) ); - if( pathField ) - url->setPath( QLatin1String(serviceTextData.value(QLatin1String(pathField)).constData()) ); - - url->setHost( remoteService->hostName() ); - url->setPort( remoteService->port() ); -} - - -SimpleItemFactory::SimpleItemFactory() - : AbstractNetSystemFactory() -{ -} - - -bool SimpleItemFactory::canCreateNetSystemFromDNSSD( const QString& serviceType ) const -{ -Q_UNUSED( serviceType ) - return true; -} - -QString SimpleItemFactory::dnssdId( const DNSSD::RemoteService::Ptr& dnssdService ) const -{ - return dnssdService->type() + QLatin1Char('_') + dnssdService->serviceName(); -} - -NetServicePrivate* SimpleItemFactory::createNetService( const DNSSD::RemoteService::Ptr& dnssdService, const NetDevice& device ) const -{ - NetServicePrivate* result; - - const QString dnssdServiceType = dnssdService->type(); - - const DNSSDServiceDatum* serviceDatum = &UnknownServiceDatum; - for( int i = 0; i< DNSSDServiceDataSize; ++i ) - { - const DNSSDServiceDatum* datum = &DNSSDServiceData[i]; - if( dnssdServiceType == QLatin1String(datum->dnssdTypeName) ) - { - serviceDatum = datum; - break; - } - } - - KUrl url; - if( serviceDatum->protocol ) - serviceDatum->feedUrl( &url, dnssdService.data() ); - - const bool isUnknown = ( serviceDatum == &UnknownServiceDatum ); - const QString typeName = isUnknown ? - dnssdServiceType.mid( 1, dnssdServiceType.lastIndexOf(QLatin1Char('.'))-1 ) : - QString::fromLatin1( serviceDatum->typeName ); - - QString iconName = QString::fromLatin1(serviceDatum->fallbackIconName); - if ( serviceDatum->iconField ) { - const QMap serviceTextData = dnssdService->textData(); - QString serviceIconName = QString::fromUtf8(serviceTextData[QString::fromLatin1(serviceDatum->iconField)]); - if ( QIcon::hasThemeIcon(serviceIconName) ) { - iconName = serviceIconName; - } - } - - result = new NetServicePrivate( dnssdService->serviceName(), iconName, - typeName, device, url.url(), SimpleItemFactory::dnssdId(dnssdService) ); - - return result; -} - -bool SimpleItemFactory::canCreateNetSystemFromUpnp( const Cagibi::Device& upnpDevice ) const -{ -Q_UNUSED( upnpDevice ) - return true; -} - -QString SimpleItemFactory::upnpId( const Cagibi::Device& upnpDevice ) const -{ - return upnpDevice.udn(); -} - -// TODO: add KIcon with specialiced KIconLoader (fetches Icons via D-Bus) -NetServicePrivate* SimpleItemFactory::createNetService( const Cagibi::Device& upnpDevice, const NetDevice& device ) const -{ - NetServicePrivate* result; - - QString url = upnpDevice.presentationUrl(); - if( url.isEmpty() ) - { - url = QString::fromLatin1( "upnp://" ); - url.append( upnpDevice.udn() ); - } - result = new NetServicePrivate( upnpDevice.friendlyName(), - QString::fromLatin1("unknown"), - QString::fromLatin1("upnp.")+upnpDevice.type(), device, url, SimpleItemFactory::upnpId(upnpDevice) ); - - return result; -} - -SimpleItemFactory::~SimpleItemFactory() {} - -} diff --git a/kioslave/network/network/builder/simpleitemfactory.h b/kioslave/network/network/builder/simpleitemfactory.h deleted file mode 100644 index 043105f4..00000000 --- a/kioslave/network/network/builder/simpleitemfactory.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef SIMPLEITEMFACTORY_H -#define SIMPLEITEMFACTORY_H - -// lib -#include -#include -#include - - -namespace Mollet -{ - -class SimpleItemFactory : public AbstractNetSystemFactory, - public DNSSDNetSystemAble, - public UpnpNetSystemAble -{ - Q_OBJECT - Q_INTERFACES( - Mollet::DNSSDNetSystemAble - Mollet::UpnpNetSystemAble - ) - - public: - SimpleItemFactory(); - virtual ~SimpleItemFactory(); - - public: // DNSSDNetSystemAble API - virtual bool canCreateNetSystemFromDNSSD( const QString& serviceType ) const; - virtual NetServicePrivate* createNetService( const DNSSD::RemoteService::Ptr& service, const NetDevice& device ) const; - virtual QString dnssdId( const DNSSD::RemoteService::Ptr& dnssdService ) const; - - public: // UpnpNetSystemAble API - virtual bool canCreateNetSystemFromUpnp( const Cagibi::Device& upnpDevice ) const; - virtual NetServicePrivate* createNetService( const Cagibi::Device& upnpDevice, const NetDevice& device ) const; - virtual QString upnpId( const Cagibi::Device& upnpDevice ) const; - - private: -}; - -} - -#endif diff --git a/kioslave/network/network/builder/upnp/cagibidbuscodec.cpp b/kioslave/network/network/builder/upnp/cagibidbuscodec.cpp deleted file mode 100644 index 2d44b0ce..00000000 --- a/kioslave/network/network/builder/upnp/cagibidbuscodec.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - This file is part of the KUPnP library, part of the KDE project. - - Copyright 2010-2011 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "cagibidbuscodec.h" - -// network -#include "cagibidevice_p.h" -// Qt -#include - -#include - -static const QString type = QLatin1String( "deviceType" ); -static const QString friendlyName = QLatin1String( "friendlyName" ); -static const QString manufacturerName = QLatin1String( "manufacturer" ); -static const QString modelDescription = QLatin1String( "modelDescription" ); -static const QString modelName = QLatin1String( "modelName" ); -static const QString modelNumber = QLatin1String( "modelNumber" ); -static const QString serialNumber = QLatin1String( "serialNumber" ); -static const QString udn = QLatin1String( "UDN" ); -static const QString presentationUrl = QLatin1String( "presentationURL" ); -static const QString ipAddress = QLatin1String( "ipAddress" ); -static const QString portNumber = QLatin1String( "ipPortNumber" ); -static const QString parentDeviceUdn = QLatin1String( "parentDeviceUDN" ); - -QT_BEGIN_NAMESPACE -QDBusArgument& operator<<( QDBusArgument& argument, const Cagibi::Device& device ) -{ - Q_UNUSED( device ) - // not used in code at the moment, so do not stream anything - // QtDBus marshaller still uses it to calculate the D-Bus argument signature - argument.beginMap( QVariant::String, QVariant::String ); - argument.endMap(); - - return argument; -} - -const QDBusArgument& operator>>( const QDBusArgument& argument, - Cagibi::Device& device ) -{ - Cagibi::DevicePrivate* const devicePrivate = device.d.data(); - - argument.beginMap(); - - QString key; - QString value; - while( ! argument.atEnd() ) - { - argument.beginMapEntry(); - argument >> key; - - if( key == type ) - { - QString type; - argument >> type; - const QStringList typeParts = type.split( QLatin1Char(':') ); -qDebug()<=5 ) - devicePrivate->mType = typeParts[3]+typeParts[4]; - } - else if( key == friendlyName ) - argument >> devicePrivate->mFriendlyName; - else if( key == manufacturerName ) - argument >> devicePrivate->mManufacturerName; -// const QString& manufacturerUrl() const; - else if( key == modelDescription ) - argument >> devicePrivate->mModelDescription; - else if( key == modelName ) - argument >> devicePrivate->mModelName; - else if( key == modelNumber ) - argument >> devicePrivate->mModelNumber; - else if( key == serialNumber ) - argument >> devicePrivate->mSerialNumber; - else if( key == udn ) - argument >> devicePrivate->mUdn; -// const QString upc() const; - else if( key == presentationUrl ) - argument >> devicePrivate->mPresentationUrl; - else if( key == ipAddress ) - argument >> devicePrivate->mIpAddress; - else if( key == portNumber ) - argument >> devicePrivate->mIpPortNumber; - else if( key == parentDeviceUdn ) - argument >> devicePrivate->mParentDeviceUdn; -// const QList& icons() const; -// const QList& services() const; -// const QList& devices() const; - // unknown key - else - argument >> value; - argument.endMapEntry(); - } - - argument.endMap(); - - return argument; -} -QT_END_NAMESPACE diff --git a/kioslave/network/network/builder/upnp/cagibidbuscodec.h b/kioslave/network/network/builder/upnp/cagibidbuscodec.h deleted file mode 100644 index 638917f5..00000000 --- a/kioslave/network/network/builder/upnp/cagibidbuscodec.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - This file is part of the KUPnP library, part of the KDE project. - - Copyright 2010 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef CAGIBIDBUSCODEC_H -#define CAGIBIDBUSCODEC_H - -// lib -#include "cagibidevice.h" -// Qt -#include -#include -#include - -QT_BEGIN_NAMESPACE -QDBusArgument& operator<<( QDBusArgument& argument, - const Cagibi::Device& device ); -const QDBusArgument& operator>>( const QDBusArgument& argument, - Cagibi::Device& device ); -QT_END_NAMESPACE - -Q_DECLARE_METATYPE( Cagibi::Device ) - -#endif diff --git a/kioslave/network/network/builder/upnp/cagibidevice.cpp b/kioslave/network/network/builder/upnp/cagibidevice.cpp deleted file mode 100644 index 7314a208..00000000 --- a/kioslave/network/network/builder/upnp/cagibidevice.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - This file is part of the KUPnP library, part of the KDE project. - - Copyright 2009-2010 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "cagibidevice.h" -#include "cagibidevice_p.h" - - -namespace Cagibi -{ - -Device::Device() - : d( new DevicePrivate() ) -{ -} - -Device::Device( DevicePrivate* _d ) - : d( _d ) -{ -} - -Device::Device( const Device& other ) - : d( other.d ) -{ -} - -const QString& Device::type() const { return d->type(); } -const QString& Device::friendlyName() const { return d->friendlyName(); } -const QString& Device::manufacturerName() const { return d->manufacturerName(); } -const QString& Device::modelDescription() const { return d->modelDescription(); } -const QString& Device::modelName() const { return d->modelName(); } -const QString& Device::modelNumber() const { return d->modelNumber(); } -const QString& Device::serialNumber() const { return d->serialNumber(); } -const QString& Device::udn() const { return d->udn(); } -const QString& Device::presentationUrl() const { return d->presentationUrl(); } -const QString& Device::ipAddress() const { return d->ipAddress(); } -int Device::ipPortNumber() const { return d->ipPortNumber(); } - -bool Device::hasParentDevice() const { return d->hasParentDevice(); } -const QString& Device::parentDeviceUdn() const { return d->parentDeviceUdn(); } - -Device& Device::operator=( const Device& other ) -{ - d = other.d; - return *this; -} - -Device::~Device() -{ -} - -} diff --git a/kioslave/network/network/builder/upnp/cagibidevice.h b/kioslave/network/network/builder/upnp/cagibidevice.h deleted file mode 100644 index 3da31bcb..00000000 --- a/kioslave/network/network/builder/upnp/cagibidevice.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - This file is part of the KUPnP library, part of the KDE project. - - Copyright 2009-2010 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef CAGIBIDEVICE_H -#define CAGIBIDEVICE_H - -// Qt -#include -#include -#include - -namespace Cagibi { class Device; } - -QT_BEGIN_NAMESPACE -extern QDBusArgument& operator<<( QDBusArgument& argument, - const Cagibi::Device& device ); -extern const QDBusArgument& operator>>( const QDBusArgument& argument, - Cagibi::Device& device ); -QT_END_NAMESPACE - -namespace Cagibi -{ -class DevicePrivate; - -class Device -{ -#ifndef QT_NAMESPACE - friend QDBusArgument& ::operator<<( QDBusArgument& argument, const Cagibi::Device& device ); - friend const QDBusArgument& ::operator>>( const QDBusArgument& argument, Cagibi::Device& device ); -#else - friend QDBusArgument& ::QT_NAMESPACE::operator<<( QDBusArgument& argument, const Cagibi::Device& device ); - friend const QDBusArgument& ::QT_NAMESPACE::operator>>( const QDBusArgument& argument, Cagibi::Device& device ); -#endif - - protected: - explicit Device( DevicePrivate* _d ); - - public: - Device(); - Device( const Device& other ); - - ~Device(); - - public: - Device& operator=( const Device& other ); - - public: - const QString& type() const; - const QString& friendlyName() const; - const QString& manufacturerName() const; -// QString manufacturerUrl() const; - const QString& modelDescription() const; - const QString& modelName() const; - const QString& modelNumber() const; - const QString& serialNumber() const; - const QString& udn() const; -// QString upc() const; - const QString& presentationUrl() const; - const QString& ipAddress() const; - int ipPortNumber() const; - - bool hasParentDevice() const; - const QString& parentDeviceUdn() const; - - protected: - QExplicitlySharedDataPointer d; -}; - -} - -#endif diff --git a/kioslave/network/network/builder/upnp/cagibidevice_p.h b/kioslave/network/network/builder/upnp/cagibidevice_p.h deleted file mode 100644 index d3489480..00000000 --- a/kioslave/network/network/builder/upnp/cagibidevice_p.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - This file is part of the KUPnP library, part of the KDE project. - - Copyright 2009-2010 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef CAGIBIDEVICE_P_H -#define CAGIBIDEVICE_P_H - -// lib -#include "cagibidevice.h" -// Qt -#include -#include - - -namespace Cagibi -{ - -class DevicePrivate : public QSharedData -{ -#ifndef QT_NAMESPACE - friend const QDBusArgument& ::operator>>( const QDBusArgument& argument, Cagibi::Device& device ); -#else - friend const QDBusArgument& ::QT_NAMESPACE::operator>>( const QDBusArgument& argument, Cagibi::Device& device ); -#endif - - public: - DevicePrivate(); - - public: - const QString& type() const; - const QString& friendlyName() const; - const QString& manufacturerName() const; -// const QString& manufacturerUrl() const; - const QString& modelDescription() const; - const QString& modelName() const; - const QString& modelNumber() const; - const QString& serialNumber() const; - const QString& udn() const; -// const QString upc() const; - const QString& presentationUrl() const; - const QString& ipAddress() const; - int ipPortNumber() const; - - bool hasParentDevice() const; - const QString& parentDeviceUdn() const; - - protected: - QString mType; - /// short user-friendly title - QString mFriendlyName; - QString mManufacturerName; -// QString mManufacturerUrl; - /// long user-friendly title - QString mModelDescription; - QString mModelName; - QString mModelNumber; - QString mSerialNumber; - QString mUdn; -// QString mUpc; Universal Product Code; - QString mPresentationUrl; - - QString mIpAddress; - int mIpPortNumber; - - QString mParentDeviceUdn; -}; - - -inline DevicePrivate::DevicePrivate() {} -inline const QString& DevicePrivate::type() const { return mType; } -inline const QString& DevicePrivate::friendlyName() const { return mFriendlyName; } -inline const QString& DevicePrivate::manufacturerName() const { return mManufacturerName; } -inline const QString& DevicePrivate::modelDescription() const { return mModelDescription; } -inline const QString& DevicePrivate::modelName() const { return mModelName; } -inline const QString& DevicePrivate::modelNumber() const { return mModelNumber; } -inline const QString& DevicePrivate::serialNumber() const { return mSerialNumber; } -inline const QString& DevicePrivate::udn() const { return mUdn; } -inline const QString& DevicePrivate::presentationUrl() const { return mPresentationUrl; } -inline const QString& DevicePrivate::ipAddress() const { return mIpAddress; } -inline int DevicePrivate::ipPortNumber() const { return mIpPortNumber; } -inline bool DevicePrivate::hasParentDevice() const { return (! mParentDeviceUdn.isEmpty() ); } -inline const QString& DevicePrivate::parentDeviceUdn() const { return mParentDeviceUdn; } - -} - -#endif diff --git a/kioslave/network/network/builder/upnp/upnpnetsystemable.h b/kioslave/network/network/builder/upnp/upnpnetsystemable.h deleted file mode 100644 index bc95dbd5..00000000 --- a/kioslave/network/network/builder/upnp/upnpnetsystemable.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef UPNPNETSYSTEMABLE_H -#define UPNPNETSYSTEMABLE_H - -// Qt -#include - -namespace Cagibi { -class Device; -} -#include - - -namespace Mollet -{ -class NetServicePrivate; -class NetDevice; - - -class UpnpNetSystemAble -{ - public: - virtual ~UpnpNetSystemAble(); - - public: // API to be implemented - virtual bool canCreateNetSystemFromUpnp( const Cagibi::Device& upnpDevice ) const = 0; - virtual NetServicePrivate* createNetService( const Cagibi::Device& upnpDevice, const NetDevice& device ) const = 0; - virtual QString upnpId( const Cagibi::Device& upnpDevice ) const = 0; -}; - - -inline UpnpNetSystemAble::~UpnpNetSystemAble() {} - -} - -Q_DECLARE_INTERFACE( Mollet::UpnpNetSystemAble, "org.kde.mollet.upnpnetsystemable/1.0" ) - -#endif diff --git a/kioslave/network/network/builder/upnp/upnpnetworkbuilder.cpp b/kioslave/network/network/builder/upnp/upnpnetworkbuilder.cpp deleted file mode 100644 index 8b5b7809..00000000 --- a/kioslave/network/network/builder/upnp/upnpnetworkbuilder.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009-2011 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "upnpnetworkbuilder.h" - -// lib -#include "upnpnetsystemable.h" -#include "abstractnetsystemfactory.h" -#include "network_p.h" -#include "netdevice_p.h" -#include "netservice_p.h" -#include "cagibidevice.h" -#include "cagibidbuscodec.h" -// Qt -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace Mollet -{ -static const char cagibiServiceName[] = "org.kde.Cagibi"; -static const char cagibiDeviceListObjectPath[] = "/org/kde/Cagibi/DeviceList"; -static const char cagibiDeviceListInterface[] = "org.kde.Cagibi.DeviceList"; - -UpnpNetworkBuilder::UpnpNetworkBuilder( NetworkPrivate* networkPrivate ) - : AbstractNetworkBuilder() - , mNetworkPrivate( networkPrivate ) - , mCagibiDeviceListDBusProxy( 0 ) -{ -} - -void UpnpNetworkBuilder::registerNetSystemFactory( AbstractNetSystemFactory* netSystemFactory ) -{ - UpnpNetSystemAble* upnpNetSystemAble = qobject_cast( netSystemFactory ); - - if( upnpNetSystemAble ) - mNetSystemFactoryList.append( upnpNetSystemAble ); -} - -void UpnpNetworkBuilder::start() -{ - QMetaObject::invokeMethod( this, "startBrowse", Qt::QueuedConnection ); -} - -void UpnpNetworkBuilder::startBrowse() -{ - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - - QDBusConnection dbusConnection = QDBusConnection::systemBus(); - - const QString serviceName = QLatin1String( cagibiServiceName ); - const QString deviceListObjectPath = QLatin1String( cagibiDeviceListObjectPath ); - const QString deviceListInterface = QLatin1String( cagibiDeviceListInterface ); - - // install service watcher - QDBusServiceWatcher* cagibiServiceWatcher = - new QDBusServiceWatcher( serviceName, - dbusConnection, - QDBusServiceWatcher::WatchForOwnerChange, - this ); - connect( cagibiServiceWatcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - SLOT(onCagibiServiceOwnerChanged(QString,QString,QString)) ); - - // create devicelist proxy - mCagibiDeviceListDBusProxy = - new QDBusInterface( serviceName, - deviceListObjectPath, - deviceListInterface, - dbusConnection, this ); - connect( mCagibiDeviceListDBusProxy, SIGNAL(devicesAdded(DeviceTypeMap)), - SLOT(onDevicesAdded(DeviceTypeMap)) ); - connect( mCagibiDeviceListDBusProxy, SIGNAL(devicesRemoved(DeviceTypeMap)), - SLOT(onDevicesRemoved(DeviceTypeMap)) ); - - // query current devicelist - queryCurrentDevices(); - - emit initDone(); -} - -void UpnpNetworkBuilder::queryCurrentDevices() -{ - // query current devicelist - QDBusPendingCall allDevicesCall = - mCagibiDeviceListDBusProxy->asyncCall( QLatin1String("allDevices") ); - - QDBusPendingCallWatcher* allDevicesCallWatcher = - new QDBusPendingCallWatcher( allDevicesCall, this ); - connect( allDevicesCallWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - SLOT(onAllDevicesCallFinished(QDBusPendingCallWatcher*)) ); -} - -void UpnpNetworkBuilder::onAllDevicesCallFinished( QDBusPendingCallWatcher* allDevicesCallWatcher ) -{ - QDBusReply reply = *allDevicesCallWatcher; - - if( reply.isValid() ) - { -kDebug() << "Connected to Cagibi, listing of UPnP devices/services started."; - const DeviceTypeMap deviceTypeMap = reply; - onDevicesAdded( deviceTypeMap ); - } - else - { - kDebug() << "Could not connect to Cagibi, no listing of UPnP devices/services."; - kDebug() << "Error: " << reply.error().name(); - } - - delete allDevicesCallWatcher; -} - -void UpnpNetworkBuilder::addUPnPDevices( const QList& upnpDevices ) -{ - QList addedDevices; - QList addedServices; - - QList& deviceList = mNetworkPrivate->deviceList(); - foreach( const Cagibi::Device& upnpDevice, upnpDevices ) - { - if( upnpDevice.hasParentDevice() ) - continue; - - const QString ipAddress = upnpDevice.ipAddress(); - - NetDevicePrivate* d = 0; - const NetDevice* deviceOfService = 0; - foreach( const NetDevice& device, deviceList ) - { - const bool isSameAddress = ( device.ipAddress() == ipAddress ); -kDebug()<<"existing device:"<setIpAddress( ipAddress ); - - NetDevice device( d ); - addedDevices.append( device ); - deviceList.append( device ); - deviceOfService = &deviceList.last(); -kDebug()<<"new device:"<canCreateNetSystemFromUpnp(upnpDevice) ) - { - // TODO: here we should rather see if this service already exists - netServicePrivate = factory->createNetService( upnpDevice, *deviceOfService ); - break; - } - } - - NetService netService( netServicePrivate ); - d->addService( netService ); - - addedServices.append( netService ); -kDebug()<<"new service:"< d->type() ) - { - d->setType( deviceTypeByService ); - if( ! deviceName.isEmpty() ) - d->setName( deviceName ); - } - } - } - - if( ! addedDevices.isEmpty() ) - mNetworkPrivate->emitDevicesAdded( addedDevices ); - if( ! addedServices.isEmpty() ) - mNetworkPrivate->emitServicesAdded( addedServices ); -} - - -void UpnpNetworkBuilder::removeUPnPDevices( const QList& upnpDevices ) -{ - QList removedDevices; - QList removedServices; - - QList& deviceList = mNetworkPrivate->deviceList(); - foreach( const Cagibi::Device& upnpDevice, upnpDevices ) - { - const QString ipAddress = upnpDevice.ipAddress(); - - QMutableListIterator it( deviceList ); - while( it.hasNext()) - { - const NetDevice& device = it.next(); - if( device.ipAddress() == ipAddress ) - { - QString id; - foreach( const UpnpNetSystemAble* factory, mNetSystemFactoryList ) - { - if( factory->canCreateNetSystemFromUpnp(upnpDevice) ) - { - id = factory->upnpId( upnpDevice ); - break; - } - } - NetDevicePrivate* d = device.dPtr(); - NetService netService = d->removeService( id ); - if( ! netService.isValid() ) - break; - - removedServices.append( netService ); - - // remove device on last service - if( d->serviceList().count() == 0 ) - { - removedDevices.append( device ); - // remove only after taking copy from reference into removed list - it.remove(); - } - break; - } - } - } - if( ! removedServices.isEmpty() ) - mNetworkPrivate->emitServicesRemoved( removedServices ); - if( ! removedDevices.isEmpty() ) - mNetworkPrivate->emitDevicesRemoved( removedDevices ); -} - - -void UpnpNetworkBuilder::onDevicesAdded( const DeviceTypeMap& deviceTypeMap ) -{ - DeviceTypeMap::ConstIterator it = deviceTypeMap.constBegin(); - DeviceTypeMap::ConstIterator end = deviceTypeMap.constEnd(); - for( ; it != end; ++it ) - { - const QString udn = it.key(); - QList args; - args << udn; - mCagibiDeviceListDBusProxy->callWithCallback( - QLatin1String("deviceDetails"), args, - this, SLOT(onAddedDeviceDetails(Cagibi::Device)), 0 ); - } -} - -void UpnpNetworkBuilder::onDevicesRemoved( const DeviceTypeMap& deviceTypeMap ) -{ - QList upnpDevices; - - DeviceTypeMap::ConstIterator it = deviceTypeMap.constBegin(); - DeviceTypeMap::ConstIterator end = deviceTypeMap.constEnd(); - for( ; it != end; ++it ) - { - QHash::Iterator adIt = - mActiveDevices.find( it.key() ); - if( adIt != mActiveDevices.end() ) - { -kDebug()<<"removing UPnP device" << adIt.value().friendlyName(); - upnpDevices.append( adIt.value() ); - mActiveDevices.erase( adIt ); - } - } - - removeUPnPDevices( upnpDevices ); -} - -void UpnpNetworkBuilder::onAddedDeviceDetails( const Cagibi::Device& device ) -{ - // currently only root devices are shown - if( device.hasParentDevice() ) - return; - - mActiveDevices.insert( device.udn(), device ); - - QList devices; - devices.append( device ); - addUPnPDevices( devices ); -} - -void UpnpNetworkBuilder::onCagibiServiceOwnerChanged( const QString& serviceName, - const QString& oldOwner, - const QString& newOwner ) -{ - Q_UNUSED(serviceName); - Q_UNUSED(newOwner); - - // old service disappeared? - if( ! oldOwner.isEmpty() ) - { -kDebug()<<"Cagibi disappeared, removing all UPnP devices"; - - // remove all registered UPnP devices - QList upnpDevices = mActiveDevices.values(); - mActiveDevices.clear(); - - removeUPnPDevices( upnpDevices ); - } - - if( ! newOwner.isEmpty() ) - queryCurrentDevices(); -} - -UpnpNetworkBuilder::~UpnpNetworkBuilder() -{ -} - -} diff --git a/kioslave/network/network/builder/upnp/upnpnetworkbuilder.h b/kioslave/network/network/builder/upnp/upnpnetworkbuilder.h deleted file mode 100644 index 4360e26d..00000000 --- a/kioslave/network/network/builder/upnp/upnpnetworkbuilder.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef UPNPNETWORKBUILDER_H -#define UPNPNETWORKBUILDER_H - -// lib -#include -#include -#include -// Qt -#include -#include - -namespace Cagibi { class Device; } - -#include -#include - -typedef QHash DeviceTypeMap; -Q_DECLARE_METATYPE( DeviceTypeMap ) - - -namespace Mollet -{ -class UpnpNetSystemAble; - - -class UpnpNetworkBuilder : public AbstractNetworkBuilder -{ - Q_OBJECT - - public: - explicit UpnpNetworkBuilder( NetworkPrivate* networkPrivate ); - virtual ~UpnpNetworkBuilder(); - - public: // AbstractNetworkBuilder API - virtual void registerNetSystemFactory( AbstractNetSystemFactory* netSystemFactory ); - virtual void start(); - //TODO: void stop(); ? why needed, what to do? - - protected: - void addUPnPDevices( const QList& devices ); - void removeUPnPDevices( const QList& devices ); - - private Q_SLOTS: - void startBrowse(); - - void onDevicesAdded( const DeviceTypeMap& deviceTypeMap ); - void onDevicesRemoved( const DeviceTypeMap& deviceTypeMap ); - void onAddedDeviceDetails( const Cagibi::Device& device ); - void onCagibiServiceOwnerChanged( const QString& serviceName, - const QString& oldOwner, const QString& newOwner ); - - void onAllDevicesCallFinished( QDBusPendingCallWatcher* allDevicesCallWatcher ); - - private: - void queryCurrentDevices(); - - private: // data - NetworkPrivate* mNetworkPrivate; - - QList mNetSystemFactoryList; - - QHash mActiveDevices; - - QDBusInterface* mCagibiDeviceListDBusProxy; -}; - -} - -#endif diff --git a/kioslave/network/network/netdevice.cpp b/kioslave/network/network/netdevice.cpp deleted file mode 100644 index 4642c6b5..00000000 --- a/kioslave/network/network/netdevice.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "netdevice.h" -#include "netdevice_p.h" - -// KDE -#include - -namespace Mollet -{ - -K_GLOBAL_STATIC_WITH_ARGS(KSharedPtr< NetDevicePrivate >, dummyNetDevicePrivate, ( new NetDevicePrivate(QString()) )) - - -QString NetDevice::iconName( Type type ) -{ - static const char* const IconName[] = - { - /*"unknown"*/"network-server", "scanner", "printer", "network-server-database", "network-server", "computer" - }; - - return QLatin1String(IconName[type]); -} - -NetDevice::NetDevice() - : d( *dummyNetDevicePrivate ) -{ -} - -NetDevice::NetDevice( NetDevicePrivate* _d ) - : d( _d ) -{ -} - -NetDevice::NetDevice( const NetDevice& other ) - : d( other.d ) -{ -} - -QString NetDevice::name() const { return d->name(); } -QString NetDevice::hostName() const { return d->hostName(); } -QString NetDevice::ipAddress() const { return d->ipAddress(); } -QString NetDevice::hostAddress() const { return d->hostAddress(); } -NetDevice::Type NetDevice::type() const { return d->type(); } -QList NetDevice::serviceList() const { return d->serviceList(); } - - -NetDevice& NetDevice::operator =( const NetDevice& other ) -{ - d = other.d; - return *this; -} - -void NetDevice::setDPtr( NetDevicePrivate* _d ) -{ - d = _d; -} - -NetDevice::~NetDevice() -{ -} - -} diff --git a/kioslave/network/network/netdevice.h b/kioslave/network/network/netdevice.h deleted file mode 100644 index d8b250ab..00000000 --- a/kioslave/network/network/netdevice.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETDEVICE_H -#define NETDEVICE_H - -// lib -#include "molletnetwork_export.h" -// KDE -#include - -namespace Mollet { -class NetService; -class NetDevice; -} -#include -#include -#include - -QT_BEGIN_NAMESPACE -extern MOLLETNETWORK_EXPORT QDBusArgument& operator<<( QDBusArgument& argument, const Mollet::NetDevice& device ); -extern MOLLETNETWORK_EXPORT const QDBusArgument& operator>>( const QDBusArgument& argument, Mollet::NetDevice& device ); -QT_END_NAMESPACE - -namespace Mollet -{ - -class NetDevicePrivate; - - -class MOLLETNETWORK_EXPORT NetDevice -{ - friend class DNSSDNetworkBuilder; - friend class UpnpNetworkBuilder; -#ifndef QT_NAMESPACE - friend QDBusArgument& ::operator<<( QDBusArgument& argument, const NetDevice& device ); - friend const QDBusArgument& ::operator>>( const QDBusArgument& argument, NetDevice& device ); -#else - friend QDBusArgument& ::QT_NAMESPACE::operator<<( QDBusArgument& argument, const NetDevice& device ); - friend const QDBusArgument& ::QT_NAMESPACE::operator>>( const QDBusArgument& argument, NetDevice& device ); -#endif - - public: - // later has priority - enum Type { Unknown = 0, Scanner, Printer, FileServer, Router, Workstation }; - static QString iconName( Type type ); - - public: - NetDevice(); - NetDevice( const NetDevice& other ); - virtual ~NetDevice(); - - public: - QString name() const; - QString hostName() const; - /// if hostName is not set, use ipAddress to identify device - QString ipAddress() const; - /// returns hostName if set, otherwise ipAddress TODO: find better name - QString hostAddress() const; - Type type() const; - QList serviceList() const; - - public: - NetDevice& operator =( const NetDevice& other ); - - private: - NetDevice( NetDevicePrivate* _d ); - void setDPtr( NetDevicePrivate* _d ); - NetDevicePrivate* dPtr() const; - - private: - KSharedPtr d; -}; - -typedef QList NetDeviceList; - - -inline NetDevicePrivate* NetDevice::dPtr() const { return const_cast( d.data() ); } - -} - -#endif diff --git a/kioslave/network/network/netdevice_p.cpp b/kioslave/network/network/netdevice_p.cpp deleted file mode 100644 index 56eb689b..00000000 --- a/kioslave/network/network/netdevice_p.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "netdevice_p.h" - -// library -#include "netservice_p.h" -// Qt -#include - - -namespace Mollet -{ - -NetDevicePrivate::NetDevicePrivate( const QString& name ) - : mName( name ) - , mType( NetDevice::Unknown ) -{ -} - -bool NetDevicePrivate::hasService( const QString& id ) const -{ - bool result = false; - - foreach( const NetService& service, mServiceList ) - { - const NetServicePrivate* const d = service.dPtr(); - if( d->id() == id ) - { - result = true; - break; - } - } - - return result; -} - -NetService NetDevicePrivate::removeService( const QString& id ) -{ - NetService result; - QMutableListIterator it( mServiceList ); - while( it.hasNext()) - { - const NetService& service = it.next(); - const NetServicePrivate* const d = service.dPtr(); - if( d->id() == id ) - { - result = service; - it.remove(); - break; - } - } - return result; -} - -NetDevicePrivate::~NetDevicePrivate() -{ -} - -} diff --git a/kioslave/network/network/netdevice_p.h b/kioslave/network/network/netdevice_p.h deleted file mode 100644 index 2f8d4a55..00000000 --- a/kioslave/network/network/netdevice_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETDEVICE_P_H -#define NETDEVICE_P_H - -// lib -#include "netdevice.h" -#include "netservice.h" -// Qt -#include -#include -#include - - -namespace Mollet -{ - -class NetDevicePrivate : public QSharedData -{ - public: - explicit NetDevicePrivate( const QString& name ); - virtual ~NetDevicePrivate(); - - public: - const QString& name() const; - const QString& hostName() const; - const QString& ipAddress() const; - const QString& hostAddress() const; - NetDevice::Type type() const; - const QList& serviceList() const; - bool hasService( const QString& id ) const; - - public: - void setName( const QString& name ); - void setHostName( const QString& hostName ); - void setIpAddress( const QString& ipAddress ); - void setType( NetDevice::Type type ); - void addService( const NetService& service ); - NetService removeService( const QString& id ); - - private: - QString mName; - QString mHostName; - QString mIpAddress; - NetDevice::Type mType; - QList mServiceList; -}; - - -inline const QString& NetDevicePrivate::name() const { return mName; } -inline const QString& NetDevicePrivate::hostName() const { return mHostName; } -inline const QString& NetDevicePrivate::ipAddress() const { return mIpAddress; } -inline NetDevice::Type NetDevicePrivate::type() const { return mType; } -inline const QList& NetDevicePrivate::serviceList() const { return mServiceList; } -inline const QString& NetDevicePrivate::hostAddress() const { return mHostName.isEmpty() ? mIpAddress : mHostName; } - -inline void NetDevicePrivate::setName( const QString& name ) { mName = name; } -inline void NetDevicePrivate::setHostName( const QString& hostName ) { mHostName = hostName; } -inline void NetDevicePrivate::setIpAddress( const QString& ipAddress ) { mIpAddress = ipAddress; } -inline void NetDevicePrivate::setType( NetDevice::Type type ) { mType = type; } -inline void NetDevicePrivate::addService( const NetService& service ) { mServiceList.append( service ); } - -} - -#endif diff --git a/kioslave/network/network/netservice.cpp b/kioslave/network/network/netservice.cpp deleted file mode 100644 index 99f1b0dd..00000000 --- a/kioslave/network/network/netservice.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "netservice.h" -#include "netservice_p.h" - -// lib -#include "netdevice.h" -// KDE -#include - - -namespace Mollet -{ - -// -K_GLOBAL_STATIC_WITH_ARGS(KSharedPtr< NetServicePrivate >, - defaultEmptyNetServicePrivate, - ( new NetServicePrivate(QString(),QString(),QString(),NetDevice(),QString(),QString()) )) - - -NetService::NetService() - : d( *defaultEmptyNetServicePrivate ) -{ -} - -NetService::NetService( NetServicePrivate* _d ) - : d( _d ) -{ -} - -NetService::NetService( const NetService& other ) - : d( other.d ) -{ -} - -QString NetService::name() const { return d->name(); } -QString NetService::iconName() const { return d->iconName(); } -QString NetService::type() const { return d->type(); } -NetDevice NetService::device() const { return d->device(); } -bool NetService::isValid() const { return !d->type().isEmpty(); } // was !d.isNull() -QString NetService::url() const { return d->url(); } - - -NetService& NetService::operator =( const NetService& other ) -{ - d = other.d; - return *this; -} - -void NetService::setDPtr( NetServicePrivate* _d ) -{ - d = _d; -} - -NetService::~NetService() -{ -} - -} diff --git a/kioslave/network/network/netservice.h b/kioslave/network/network/netservice.h deleted file mode 100644 index 7af92a89..00000000 --- a/kioslave/network/network/netservice.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETSERVICE_H -#define NETSERVICE_H - -// lib -#include "molletnetwork_export.h" -// KDE -#include - -namespace Mollet { -class NetDevice; -class NetService; -} -#include -#include -#include - -QT_BEGIN_NAMESPACE -extern MOLLETNETWORK_EXPORT QDBusArgument& operator<<( QDBusArgument& argument, const Mollet::NetService& service ); -extern MOLLETNETWORK_EXPORT const QDBusArgument& operator>>( const QDBusArgument& argument, Mollet::NetService& service ); -QT_END_NAMESPACE - -namespace Mollet -{ - -class NetServicePrivate; - - -class MOLLETNETWORK_EXPORT NetService -{ - friend class DNSSDNetworkBuilder; - friend class UpnpNetworkBuilder; - friend class NetDevicePrivate; -#ifndef QT_NAMESPACE - friend QDBusArgument& ::operator<<( QDBusArgument& argument, const NetService& service ); - friend const QDBusArgument& ::operator>>( const QDBusArgument& argument, NetService& service ); -#else - friend QDBusArgument& ::QT_NAMESPACE::operator<<( QDBusArgument& argument, const NetService& service ); - friend const QDBusArgument& ::QT_NAMESPACE::operator>>( const QDBusArgument& argument, NetService& service ); -#endif - - public: - NetService(); - NetService( const NetService& other ); - virtual ~NetService(); - - public: - QString name() const; - QString iconName() const; - QString type() const; - NetDevice device() const; - bool isValid() const; - - // TODO: not sure all services come down to one url - QString url() const; - - public: - NetService& operator =( const NetService& other ); - - private: - NetService( NetServicePrivate* _d ); - void setDPtr( NetServicePrivate* _d ); - NetServicePrivate* dPtr() const; - - private: - KSharedPtr d; -}; - -typedef QList NetServiceList; - - -inline NetServicePrivate* NetService::dPtr() const { return const_cast( d.data() ); } - -} - -#endif diff --git a/kioslave/network/network/netservice_p.cpp b/kioslave/network/network/netservice_p.cpp deleted file mode 100644 index 2a5a7ff2..00000000 --- a/kioslave/network/network/netservice_p.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009,2011 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "netservice_p.h" - - -namespace Mollet -{ - -NetServicePrivate::NetServicePrivate( const QString& name, const QString& iconName, const QString& type, - const NetDevice& device, const QString& url, const QString& id ) - : mName( name ) - , mIconName( iconName ) - , mType( type ) - , mDevice( device ) - , mUrl( url ) - , mId( id ) -{ -} - - -NetServicePrivate::~NetServicePrivate() -{ -} - -} diff --git a/kioslave/network/network/netservice_p.h b/kioslave/network/network/netservice_p.h deleted file mode 100644 index 4cc6e774..00000000 --- a/kioslave/network/network/netservice_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009,2011 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETSERVICE_P_H -#define NETSERVICE_P_H - -// lib -#include "netdevice.h" -#include "netservice.h" -// Qt -#include -#include - - -namespace Mollet -{ - -class NetServicePrivate : public QSharedData -{ - public: - explicit NetServicePrivate( const QString& name, const QString& iconName, const QString& type, - const NetDevice& device, const QString& url, const QString& id ); - virtual ~NetServicePrivate(); - - public: - const QString& name() const; - const QString& iconName() const; - const QString& type() const; - const NetDevice& device() const; - const QString& url() const; - const QString& id() const; - - private: - QString mName; - QString mIconName; - QString mType; - NetDevice mDevice; - QString mUrl; - QString mId; -}; - - -inline const QString& NetServicePrivate::name() const { return mName; } -inline const QString& NetServicePrivate::iconName() const { return mIconName; } -inline const QString& NetServicePrivate::type() const { return mType; } -inline const NetDevice& NetServicePrivate::device() const { return mDevice; } -inline const QString& NetServicePrivate::url() const { return mUrl; } -inline const QString& NetServicePrivate::id() const { return mId; } - -} - -#endif diff --git a/kioslave/network/network/network.cpp b/kioslave/network/network/network.cpp deleted file mode 100644 index 7748628f..00000000 --- a/kioslave/network/network/network.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "network.h" -#include "network_p.h" -#include "moc_network.cpp" - -// KDE -#include -// Qt -#include - - -namespace Mollet -{ - -Network* Network::network() -{ - K_GLOBAL_STATIC( Network, networkSingleton ) - return networkSingleton; -} - -Network::Network() - : d( new NetworkPrivate(this) ) -{ - d->init(); -} - -QList Network::deviceList() const { return d->deviceList(); } - -Network::~Network() -{ -} - -} diff --git a/kioslave/network/network/network.h b/kioslave/network/network/network.h deleted file mode 100644 index bfece985..00000000 --- a/kioslave/network/network/network.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORK_H -#define NETWORK_H - -// lib -#include "molletnetwork_export.h" -// Qt -#include - -namespace Mollet { -class NetDevice; -class NetService; -} -#include - - -namespace Mollet -{ -class NetworkPrivate; - -class MOLLETNETWORK_EXPORT Network : public QObject -{ - Q_OBJECT - - friend class NetworkPrivate; - - public: - static Network* network(); - - public: - virtual ~Network(); - - public: - QList deviceList() const; - - Q_SIGNALS: - void devicesAdded( const QList& deviceList ); - void devicesRemoved( const QList& deviceList ); - void servicesAdded( const QList& serviceList ); - void servicesRemoved( const QList& serviceList ); - - void initDone(); - - private: - Network(); - Q_PRIVATE_SLOT( d, void onBuilderInit() ) - - private: - NetworkPrivate* const d; -}; - -// void connect( Network& network, const char* signal, QObject* object, const char* slot ); - -} - -#endif diff --git a/kioslave/network/network/network_p.cpp b/kioslave/network/network/network_p.cpp deleted file mode 100644 index ff24d30e..00000000 --- a/kioslave/network/network/network_p.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "network_p.h" - -// lib -#include "builder/dnssd/dnssdnetworkbuilder.h" -#include "builder/upnp/upnpnetworkbuilder.h" -#include "builder/simpleitemfactory.h" - -#include - -namespace Mollet -{ - -NetworkPrivate::NetworkPrivate( Network* parent ) - : p( parent ) -{ -} - -void NetworkPrivate::init() -{ - SimpleItemFactory* simpleItemFactory = new SimpleItemFactory(); - mNetSystemFactoryList.append( simpleItemFactory ); - - DNSSDNetworkBuilder* dnssdBuilder = new DNSSDNetworkBuilder( this ); - UpnpNetworkBuilder* upnpBuilder = new UpnpNetworkBuilder( this ); - mNetworkBuilderList.append( dnssdBuilder ); - mNetworkBuilderList.append( upnpBuilder ); - mNoOfInitBuilders = mNetworkBuilderList.count(); - - foreach( AbstractNetworkBuilder* builder, mNetworkBuilderList ) - { - foreach( AbstractNetSystemFactory* factory, mNetSystemFactoryList ) - builder->registerNetSystemFactory( factory ); - p->connect( builder, SIGNAL(initDone()), SLOT(onBuilderInit()) ); - builder->start(); - } -} - -void NetworkPrivate::onBuilderInit() -{ - --mNoOfInitBuilders; -kDebug()<initDone(); -} - -NetworkPrivate::~NetworkPrivate() -{ - qDeleteAll( mNetworkBuilderList ); - qDeleteAll( mNetSystemFactoryList ); -} - -} diff --git a/kioslave/network/network/network_p.h b/kioslave/network/network/network_p.h deleted file mode 100644 index 4757cbf2..00000000 --- a/kioslave/network/network/network_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORK_P_H -#define NETWORK_P_H - -// lib -#include "network.h" -#include "netdevice.h" - - -namespace Mollet -{ - -class AbstractNetworkBuilder; -class AbstractNetSystemFactory; - -class NetworkPrivate -{ - public: - explicit NetworkPrivate( Network* parent ); - virtual ~NetworkPrivate(); - - public: - const QList& deviceList() const; - QList& deviceList(); - - public: - void init(); - void onBuilderInit(); - - public: - void emitDevicesAdded( const QList& deviceList ); - void emitDevicesRemoved( const QList& deviceList ); - void emitServicesAdded( const QList& serviceList ); - void emitServicesRemoved( const QList& serviceList ); - - private: // data - Network* p; - QList mDeviceList; - QList mNetworkBuilderList; - QList mNetSystemFactoryList; - - int mNoOfInitBuilders; -}; - - -inline const QList& NetworkPrivate::deviceList() const { return mDeviceList; } -inline QList& NetworkPrivate::deviceList() { return mDeviceList; } - -inline void NetworkPrivate::emitDevicesAdded( const QList& deviceList ) { emit p->devicesAdded( deviceList ); } -inline void NetworkPrivate::emitDevicesRemoved( const QList& deviceList ) { emit p->devicesRemoved( deviceList ); } -inline void NetworkPrivate::emitServicesAdded( const QList& serviceList ) { emit p->servicesAdded( serviceList ); } -inline void NetworkPrivate::emitServicesRemoved( const QList& serviceList ) { emit p->servicesRemoved( serviceList ); } - -} - -#endif diff --git a/kioslave/network/network/networkdbus.cpp b/kioslave/network/network/networkdbus.cpp deleted file mode 100644 index bcc2378b..00000000 --- a/kioslave/network/network/networkdbus.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#include "networkdbus.h" - -// network -#include "netdevice_p.h" -#include "netservice_p.h" -// Qt -#include - - -// TODO: Attention, we currently do not stream any references to other items, just the direct data! -QT_BEGIN_NAMESPACE -QDBusArgument& operator<<( QDBusArgument& argument, const Mollet::NetDevice& device ) -{ - Mollet::NetDevicePrivate* devicePrivate = device.dPtr(); - - argument.beginStructure(); - argument << devicePrivate->name(); - argument << devicePrivate->hostName(); - argument << devicePrivate->ipAddress(); - argument << (int) devicePrivate->type(); - argument.endStructure(); - - return argument; -} -const QDBusArgument& operator>>( const QDBusArgument& argument, Mollet::NetDevice& device ) -{ - QString name; - QString hostName; - QString ipAddress; - int type; - - argument.beginStructure(); - argument >> name; - argument >> hostName; - argument >> ipAddress; - argument >> type; - argument.endStructure(); - - Mollet::NetDevicePrivate* d = new Mollet::NetDevicePrivate( name ); - d->setHostName( hostName ); - d->setIpAddress( ipAddress ); - d->setType( (Mollet::NetDevice::Type)type ); - - device.setDPtr( d ); - - return argument; -} - -QDBusArgument& operator<<( QDBusArgument& argument, const Mollet::NetService& service ) -{ - Mollet::NetServicePrivate* servicePrivate = service.dPtr(); - - argument.beginStructure(); - argument << servicePrivate->name(); - argument << servicePrivate->iconName(); - argument << servicePrivate->type(); - argument << servicePrivate->url(); - argument << servicePrivate->id(); - argument.endStructure(); - - return argument; -} -const QDBusArgument& operator>>( const QDBusArgument& argument, Mollet::NetService& service ) -{ - QString name; - QString iconName; - QString type; - QString url; - QString id; - - argument.beginStructure(); - argument >> name; - argument >> iconName; - argument >> type; - argument >> url; - argument >> id; - argument.endStructure(); - - Mollet::NetServicePrivate* d = new Mollet::NetServicePrivate( name, iconName, type, Mollet::NetDevice(), url, id ); - - service.setDPtr( d ); - - return argument; -} -QT_END_NAMESPACE \ No newline at end of file diff --git a/kioslave/network/network/networkdbus.h b/kioslave/network/network/networkdbus.h deleted file mode 100644 index 2f867b14..00000000 --- a/kioslave/network/network/networkdbus.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - This file is part of the Mollet network library, part of the KDE project. - - Copyright 2009 Friedrich W. H. Kossebau - - 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 . -*/ - -#ifndef NETWORKDBUS_H -#define NETWORKDBUS_H - -// lib -#include "molletnetwork_export.h" -#include "netdevice.h" -#include "netservice.h" -// Qt -#include - - -// TODO: copying single items out of an interlinked structure does not work -// classical problem with different address spaces. -// instead just the item data is transferred for now. Perhaps this should become another data structure -// which uses ids as reference to the linked data. Needs more use cases to get a better picture. -// also needed: xml description for introspection and automagical creation of adaptor and interface - -QT_BEGIN_NAMESPACE -MOLLETNETWORK_EXPORT QDBusArgument& operator<<( QDBusArgument& argument, const Mollet::NetDevice& device ); -MOLLETNETWORK_EXPORT const QDBusArgument& operator>>( const QDBusArgument& argument, Mollet::NetDevice& device ); - -MOLLETNETWORK_EXPORT QDBusArgument& operator<<( QDBusArgument& argument, const Mollet::NetService& service ); -MOLLETNETWORK_EXPORT const QDBusArgument& operator>>( const QDBusArgument& argument, Mollet::NetService& service ); -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Mollet::NetDevice) -Q_DECLARE_METATYPE(Mollet::NetService) -Q_DECLARE_METATYPE(Mollet::NetDeviceList) -Q_DECLARE_METATYPE(Mollet::NetServiceList) - -#endif