summaryrefslogtreecommitdiffstats
path: root/kcontrol/dnssd
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kcontrol/dnssd
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/dnssd')
-rw-r--r--kcontrol/dnssd/Makefile.am12
-rw-r--r--kcontrol/dnssd/configdialog.ui304
-rw-r--r--kcontrol/dnssd/kcm_kdnssd.desktop154
-rw-r--r--kcontrol/dnssd/kcmdnssd.cpp142
-rw-r--r--kcontrol/dnssd/kcmdnssd.h49
5 files changed, 661 insertions, 0 deletions
diff --git a/kcontrol/dnssd/Makefile.am b/kcontrol/dnssd/Makefile.am
new file mode 100644
index 000000000..892244300
--- /dev/null
+++ b/kcontrol/dnssd/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = kcm_kdnssd.la
+kcm_kdnssd_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries)
+kcm_kdnssd_la_SOURCES = configdialog.ui kcmdnssd.cpp kcmdnssd.h
+
+xdg_apps_DATA = kcm_kdnssd.desktop
+kcm_kdnssd_la_LIBADD = $(LIB_KDNSSD) $(LIB_KDEUI)
+
+messages: rc.cpp
+ $(EXTRACTRC) *.ui *.rc >> rc.cpp
+ $(XGETTEXT) $(kcm_kdnssd_la_SOURCES) rc.cpp -o $(podir)/kcmkdnssd.pot
diff --git a/kcontrol/dnssd/configdialog.ui b/kcontrol/dnssd/configdialog.ui
new file mode 100644
index 000000000..83808d1bb
--- /dev/null
+++ b/kcontrol/dnssd/configdialog.ui
@@ -0,0 +1,304 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConfigDialog</class>
+<widget class="KCModule">
+ <property name="name">
+ <cstring>ConfigDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>571</width>
+ <height>486</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>tabs</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;General</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_BrowseLocal</cstring>
+ </property>
+ <property name="text">
+ <string>Browse local networ&amp;k</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Browse local network (domain .local) using multicast DNS.</string>
+ </property>
+ </widget>
+ <widget class="KEditListBox">
+ <property name="name">
+ <cstring>kcfg_DomainList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Additional Domains</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>List of Internet domains that will be browsed for services. Do not put .local here - it
+is configured with 'Browse local network' option above.</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>kcfg_PublishType</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Publishing Mode</string>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>LANButtor</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>23</y>
+ <width>618</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Loc&amp;al network</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Advertise services on local network (in domain .local) using multicast DNS.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>WANButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>51</y>
+ <width>618</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&amp;Wide area network</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Advertise services on Internet domain using public IP. To have this option working you need to configure wide area operation in using administrator mode</string>
+ </property>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>W&amp;ide area</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Shared secret:</string>
+ </property>
+ </widget>
+ <spacer row="1" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>130</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit" row="1" column="3">
+ <property name="name">
+ <cstring>hostedit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Name of this machine. Must be in fully qualified form (host.domain)</string>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="2" column="3">
+ <property name="name">
+ <cstring>secretedit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Optional shared secret used for authorization of DNS dynamic updates.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>domainLabel</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Domain:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Hostname:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="3">
+ <property name="name">
+ <cstring>domainedit</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="2">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>90</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>50</width>
+ <height>110</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<slots>
+ <slot>radioButton2_2_toggled(bool)</slot>
+</slots>
+<includes>
+ <include location="global" impldecl="in declaration">kcmodule.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcmodule.h</includehint>
+ <includehint>keditlistbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpassdlg.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kcontrol/dnssd/kcm_kdnssd.desktop b/kcontrol/dnssd/kcm_kdnssd.desktop
new file mode 100644
index 000000000..8b949e370
--- /dev/null
+++ b/kcontrol/dnssd/kcm_kdnssd.desktop
@@ -0,0 +1,154 @@
+[Desktop Entry]
+Comment=Configure service discovery
+Comment[af]=Stel dienste ontdekker op
+Comment[ar]=إعداد إكتشاف الخدمات
+Comment[be]=Настаўленні пошуку сервісаў
+Comment[bg]=Настройване откриването на услуги
+Comment[bn]=সার্ভিস উদ্ঘাটন কনফিগার করুন
+Comment[bs]=Podesite otkrivanje servisa
+Comment[ca]=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[eo]=Agordu servo-seĉadon
+Comment[es]=Configura el buscador de servicios
+Comment[et]=Teenuste tuvastamise seadistamine
+Comment[eu]=Konfiguratu igartze zerbitzua
+Comment[fa]=پیکربندی کشف خدمت
+Comment[fi]=Asetuspalvelimen löytäminen
+Comment[fr]=Configuration de la découverte de service
+Comment[fy]=Tsjinst waarnimming ynstellen
+Comment[ga]=Cumraigh fionnachtain seirbhísí
+Comment[gl]=Configurar o descubremento de servizos
+Comment[he]=הגדרת זיהוי השירותים
+Comment[hi]=सेवा डिस्कवरी कॉन्फ़िगर करें
+Comment[hr]=Konfiguriranje usluge discovery
+Comment[hu]=A szolgáltatásdetektálás beállításai
+Comment[is]=Stilla uppgötvun þjónustna
+Comment[it]=Configura scoperta servizi
+Comment[ja]=サービスディスカバリの設定
+Comment[ka]=სერვისის არმოჩენის კონფიგურირება
+Comment[kk]=Қызыметтерді байқауды баптау
+Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ការ​រកឃើញ​សេវា
+Comment[ko]=서비스 발견 설정
+Comment[lt]=Konfigūruoti tarnybų radimą
+Comment[lv]=Konfigurē servisu atrašanu
+Comment[mk]=Конфигурирајте го откривањето сервиси
+Comment[ms]=Konfigur penemuan servis
+Comment[nb]=Sett opp oppdagingstjenesten
+Comment[nds]=Dat Finnen vun Deensten inrichten
+Comment[ne]=पत्ता लगाउने कार्य कन्फिगर गर्नुहोस्
+Comment[nl]=Dienstwaarneming instellen
+Comment[nn]=Set opp oppdagingstenesta
+Comment[pa]=ਸੇਵਾ ਖੋਜ ਸੰਰਚਨਾ
+Comment[pl]=Konfiguracja wykrywania usług
+Comment[pt]=Configurar a descoberta de serviços
+Comment[pt_BR]=Configurar o serviço discovery
+Comment[ro]=Configurează serviciul de descoperire
+Comment[ru]=Настройка обнаружения сервисов
+Comment[rw]=Kuboneza ivumbura serivisi
+Comment[se]=Heivet bálvalusáicama
+Comment[sk]=Nastavenie služby Discovery
+Comment[sl]=Nastavi odkrivanje storitev
+Comment[sr]=Подешавање откривања сервиса
+Comment[sr@Latn]=Podešavanje otkrivanja servisa
+Comment[sv]=Anpassa tjänstupptäckt
+Comment[ta]=சர்வீஸ் டிஸ்கவரியை வடிவமை
+Comment[tg]=Танзими хизмати ихтироъ
+Comment[th]=ปรับแต่งการค้นพบบริการ
+Comment[tr]=Hizmet araştırmasını yapılandır
+Comment[tt]=Xezmätlär tabu caylawı
+Comment[uk]=Налаштування знаходження служб
+Comment[uz]=Tarmoqdagi xizmatlarni qidirishni moslash
+Comment[uz@cyrillic]=Тармоқдаги хизматларни қидиришни мослаш
+Comment[vi]=Cấu hình dịch vụ khám phá
+Comment[wa]=Apontiaedjes do discovraedje do siervice
+Comment[zh_CN]=配置探索服务
+Comment[zh_TW]=設定服務偵測
+Exec=kcmshell kcm_kdnssd
+GenericName=
+GenericName[ko]=일반
+Icon=blockdevice
+MimeType=
+Name=Service Discovery
+Name[af]=Dienste ontdekker
+Name[ar]=إكتشاف الخدمات
+Name[be]=Пошук сервісаў
+Name[bg]=Откриване на услуги
+Name[bn]=সার্ভিস উদ্ঘাটন
+Name[bs]=Otkrivanje servisa
+Name[ca]=Descobriment de serveis
+Name[cs]=Hledání služeb
+Name[csb]=Wëkrëwanié ùsłëżnotów
+Name[da]=Opdagelse af tjenester
+Name[de]=Dienste-Suche
+Name[el]=Εύρεση υπηρεσιών
+Name[eo]=Servo-Serĉado
+Name[es]=Buscador de servicios
+Name[et]=Teenuste tuvastamine
+Name[eu]=Igartze zerbitzua
+Name[fa]=کشف خدمت
+Name[fi]=Palvelut
+Name[fr]=Découverte de service
+Name[fy]=Tsjinst warskôging
+Name[ga]=Fionnachtain Seirbhísí
+Name[gl]=Descubremento de Servizos
+Name[he]=זיהוי שירותים
+Name[hi]=सेवा डिस्कवरी
+Name[hr]=Usluga Discovery
+Name[hu]=Zeroconf-beállítások
+Name[is]=Uppgötvun þjónustu
+Name[it]=Scoperta servizi
+Name[ja]=サービスディスカバリ
+Name[ka]=სერვისის აღმოჩენა
+Name[kk]=Қызметтерді байқау
+Name[km]=ការ​រកឃើញ​សេវា
+Name[ko]=서비스 발견
+Name[lt]=Tarnybų radimas
+Name[lv]=Servisu atklāšana
+Name[mk]=Откривање сервиси
+Name[ms]=Penemuan Servis
+Name[nb]=Oppdaging av tjenester
+Name[nds]=Deensten finnen
+Name[ne]=पत्ता लगाउने कार्य
+Name[nl]=Dienstwaarneming
+Name[nn]=Oppdaging av tenester
+Name[pa]=ਸੇਵਾ ਖੋਜ
+Name[pl]=Wykrywanie usług
+Name[pt]=Descoberta de Serviços
+Name[pt_BR]=Serviço Discovery
+Name[ro]=Descoperire servicii
+Name[ru]=Обнаружение служб
+Name[rw]=Ivumbura rya Serivisi
+Name[se]=Bálvalusáican
+Name[sk]=Služba Discovery
+Name[sl]=Odkrivanje storitev
+Name[sr]=Откривање сервиса
+Name[sr@Latn]=Otkrivanje servisa
+Name[sv]=Tjänstupptäckt
+Name[ta]=சர்வீஸ் டிஸ்கவரி
+Name[tg]=Хизмати ихтироъ
+Name[th]=การค้นพบบริการ
+Name[tr]=Hizmet Araştırması
+Name[tt]=Xezmätlär Tabu
+Name[uk]=Знаходження служб
+Name[uz]=Tarmoqdagi xizmatlarni qidirish
+Name[uz@cyrillic]=Тармоқдаги хизматларни қидириш
+Name[vi]=Dịch vụ Khám phá
+Name[wa]=Discovraedje di siervices
+Name[zh_CN]=服务探索
+Name[zh_TW]=服務偵測
+Path=
+StartupNotify=true
+Terminal=false
+Type=Application
+X-DCOP-ServiceType=
+X-KDE-HasReadOnlyMode=false
+X-KDE-Library=kdnssd
+X-KDE-ModuleType=Library
+X-KDE-ParentApp=kcontrol
+X-KDE-SubstituteUID=false
+X-KDE-RootOnly=true
+Categories=Qt;KDE;X-KDE-settings-network;
diff --git a/kcontrol/dnssd/kcmdnssd.cpp b/kcontrol/dnssd/kcmdnssd.cpp
new file mode 100644
index 000000000..d86cc2897
--- /dev/null
+++ b/kcontrol/dnssd/kcmdnssd.cpp
@@ -0,0 +1,142 @@
+/***************************************************************************
+ * Copyright (C) 2004,2005 by Jakub Stachowski *
+ * *
+ * 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 <sys/stat.h>
+#include <config.h>
+
+#include <qlayout.h>
+#include <qfile.h>
+#include <qgroupbox.h>
+#include <qradiobutton.h>
+#include <qtimer.h>
+#include <qtabwidget.h>
+
+#include <klocale.h>
+#include <kglobal.h>
+#include <kparts/genericfactory.h>
+#include <kprocess.h>
+#include <klineedit.h>
+#include <kpassdlg.h>
+#include <ksimpleconfig.h>
+
+#include "kcmdnssd.h"
+#include <dnssd/settings.h>
+#include <dnssd/domainbrowser.h>
+#include <kipc.h>
+
+#define MDNSD_CONF "/etc/mdnsd.conf"
+#define MDNSD_PID "/var/run/mdnsd.pid"
+
+typedef KGenericFactory<KCMDnssd, QWidget> KCMDnssdFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kdnssd, KCMDnssdFactory("kcmkdnssd"))
+
+KCMDnssd::KCMDnssd(QWidget *parent, const char *name, const QStringList&)
+ : ConfigDialog(parent, name), m_wdchanged(false)
+{
+ setAboutData(new KAboutData(I18N_NOOP("kcm_kdnssd"),
+ I18N_NOOP("ZeroConf configuration"),0,0,KAboutData::License_GPL,
+ I18N_NOOP("(C) 2004,2005 Jakub Stachowski")));
+ setQuickHelp(i18n("Setup services browsing with ZeroConf"));
+ if (geteuid()!=0) tabs->removePage(tab_2); // normal user cannot change wide-area settings
+ // show only global things in 'administrator mode' to prevent confusion
+ else if (getenv("KDESU_USER")!=0) tabs->removePage(tab);
+ addConfig(DNSSD::Configuration::self(),this);
+ // it is host-wide setting so it has to be in global config file
+ domain = new KSimpleConfig( QString::fromLatin1( KDE_CONFDIR "/kdnssdrc" ));
+ domain->setGroup("publishing");
+ load();
+ connect(hostedit,SIGNAL(textChanged(const QString&)),this,SLOT(wdchanged()));
+ connect(secretedit,SIGNAL(textChanged(const QString&)),this,SLOT(wdchanged()));
+ connect(domainedit,SIGNAL(textChanged(const QString&)),this,SLOT(wdchanged()));
+ if (DNSSD::Configuration::self()->publishDomain().isEmpty()) WANButton->setEnabled(false);
+}
+
+KCMDnssd::~KCMDnssd()
+{
+ delete domain;
+}
+
+void KCMDnssd::save()
+{
+ KCModule::save();
+ if (geteuid()==0 && m_wdchanged) saveMdnsd();
+ domain->setFileWriteMode(0644); // this should be readable for everyone
+ domain->writeEntry("PublishDomain",domainedit->text());
+ domain->sync();
+ KIPC::sendMessageAll((KIPC::Message)KIPCDomainsChanged);
+}
+
+void KCMDnssd::load()
+{
+ KCModule::load();
+ if (geteuid()==0) loadMdnsd();
+}
+
+// hack to work around not working isModified() for KPasswordEdit
+void KCMDnssd::wdchanged()
+{
+ WANButton->setEnabled(!domainedit->text().isEmpty() && !hostedit->text().isEmpty());
+ changed();
+ m_wdchanged=true;
+}
+
+void KCMDnssd::loadMdnsd()
+{
+ QFile f(MDNSD_CONF);
+ if (!f.open(IO_ReadWrite)) return;
+ QTextStream stream(&f);
+ QString line;
+ while (!stream.atEnd()) {
+ line = stream.readLine();
+ mdnsdLines.insert(line.section(' ',0,0,QString::SectionSkipEmpty),
+ line.section(' ',1,-1,QString::SectionSkipEmpty));
+ }
+ if (!mdnsdLines["zone"].isNull()) domainedit->setText(mdnsdLines["zone"]);
+ if (!mdnsdLines["hostname"].isNull()) hostedit->setText(mdnsdLines["hostname"]);
+ if (!mdnsdLines["secret-64"].isNull()) secretedit->setText(mdnsdLines["secret-64"]);
+}
+
+bool KCMDnssd::saveMdnsd()
+{
+ mdnsdLines["zone"]=domainedit->text();
+ mdnsdLines["hostname"]=hostedit->text();
+ if (!secretedit->text().isEmpty()) mdnsdLines["secret-64"]=QString(secretedit->password());
+ else mdnsdLines.remove("secret-64");
+ QFile f(MDNSD_CONF);
+ bool newfile=!f.exists();
+ if (!f.open(IO_WriteOnly)) return false;
+ QTextStream stream(&f);
+ for (QMap<QString,QString>::ConstIterator it=mdnsdLines.begin();it!=mdnsdLines.end();
+ ++it) stream << it.key() << " " << (*it) << "\n";
+ f.close();
+ // if it is new file, then make it only accessible for root as it can contain shared
+ // secret for dns server.
+ if (newfile) chmod(MDNSD_CONF,0600);
+ f.setName(MDNSD_PID);
+ if (!f.open(IO_ReadOnly)) return true; // it is not running so no need to signal
+ QString line;
+ if (f.readLine(line,16)<1) return true;
+ unsigned int pid = line.toUInt();
+ if (pid==0) return true; // not a pid
+ kill(pid,SIGHUP);
+ return true;
+}
+
+#include "kcmdnssd.moc"
diff --git a/kcontrol/dnssd/kcmdnssd.h b/kcontrol/dnssd/kcmdnssd.h
new file mode 100644
index 000000000..2e66f6a8f
--- /dev/null
+++ b/kcontrol/dnssd/kcmdnssd.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2004,2005 by Jakub Stachowski *
+ * *
+ * 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 <qmap.h>
+
+#include <configdialog.h>
+#include <kaboutdata.h>
+
+class KSimpleConfig;
+class KCMDnssd: public ConfigDialog
+{
+ Q_OBJECT
+
+public:
+ KCMDnssd( QWidget *parent=0, const char *name=0, const QStringList& = QStringList() );
+ ~KCMDnssd();
+ virtual void save();
+ virtual void load();
+private slots:
+ void wdchanged();
+private:
+ void loadMdnsd();
+ bool saveMdnsd();
+ QMap<QString,QString> mdnsdLines;
+ bool m_wdchanged;
+ KSimpleConfig* domain;
+};
+
+#endif