From 10e41144596fc9ced40fc349d9ecd099b1c2ea19 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 11 Dec 2009 20:21:27 +0000 Subject: Initial import of Trinity 3.5.11 to kdebase Extends krandrtray, adds iccconfig kcontrol module, adds run dialog autocomplete and lots of bugfixes Will need to check for commit warnings and repair as encountered Also needs full compile test git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1061475 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/dnssd/configdialog.ui | 120 +++++++++++++++++++++++--------------- kcontrol/dnssd/kcm_kdnssd.desktop | 9 +-- kcontrol/dnssd/kcmdnssd.cpp | 54 ++++++++++++++++- kcontrol/dnssd/kcmdnssd.h | 2 + 4 files changed, 133 insertions(+), 52 deletions(-) (limited to 'kcontrol/dnssd') diff --git a/kcontrol/dnssd/configdialog.ui b/kcontrol/dnssd/configdialog.ui index 83808d1bb..848457a44 100644 --- a/kcontrol/dnssd/configdialog.ui +++ b/kcontrol/dnssd/configdialog.ui @@ -44,45 +44,17 @@ &General - + unnamed - - - kcfg_BrowseLocal - - - Browse local networ&k - - - Browse local network (domain .local) using multicast DNS. - - - - - kcfg_DomainList - - - - 7 - 7 - 0 - 0 - - - - Additional Domains - - - List of Internet domains that will be browsed for services. Do not put .local here - it -is configured with 'Browse local network' option above. - - - + kcfg_PublishType + + true + 5 @@ -96,50 +68,104 @@ is configured with 'Browse local network' option above. - LANButtor + WANButton + + + true 11 - 23 + 51 618 22 - Loc&al network + &Wide area network - - false + + Alt+W - Advertise services on local network (in domain .local) using multicast DNS. + Advertise services on Internet domain using public IP. To have this option working you need to configure wide area operation in using administrator mode - WANButton - - - true + LANButtor 11 - 51 + 23 618 22 - &Wide area network + Loc&al network + + + Alt+A + + + false - Advertise services on Internet domain using public IP. To have this option working you need to configure wide area operation in using administrator mode + Advertise services on local network (in domain .local) using multicast DNS. - + + + kcfg_BrowseLocal + + + Browse local networ&k + + + Alt+K + + + Browse local network (domain .local) using multicast DNS. + + + + + enableZeroconf + + + Enable &Zeroconf network browsing + + + Alt+Z + + + Browse local network (domain .local) using multicast DNS. + + + + + kcfg_DomainList + + + + 7 + 7 + 0 + 0 + + + + Additional Domains + + + List of Internet domains that will be browsed for services. Do not put .local here - it +is configured with 'Browse local network' option above. + + + diff --git a/kcontrol/dnssd/kcm_kdnssd.desktop b/kcontrol/dnssd/kcm_kdnssd.desktop index 8b949e370..b0d731098 100644 --- a/kcontrol/dnssd/kcm_kdnssd.desktop +++ b/kcontrol/dnssd/kcm_kdnssd.desktop @@ -70,9 +70,9 @@ Comment[zh_TW]=設定服務偵測 Exec=kcmshell kcm_kdnssd GenericName= GenericName[ko]=일반 -Icon=blockdevice +Icon=network_local MimeType= -Name=Service Discovery +Name=Zeroconf Service Discovery Name[af]=Dienste ontdekker Name[ar]=إكتشاف الخدمات Name[be]=Пошук сервісаў @@ -149,6 +149,7 @@ X-KDE-HasReadOnlyMode=false X-KDE-Library=kdnssd X-KDE-ModuleType=Library X-KDE-ParentApp=kcontrol -X-KDE-SubstituteUID=false -X-KDE-RootOnly=true +#root parts unused with Avahi +#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 index d86cc2897..d754f0025 100644 --- a/kcontrol/dnssd/kcmdnssd.cpp +++ b/kcontrol/dnssd/kcmdnssd.cpp @@ -27,6 +27,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -35,6 +39,8 @@ #include #include #include +#include +#include #include "kcmdnssd.h" #include @@ -65,7 +71,10 @@ KCMDnssd::KCMDnssd(QWidget *parent, const char *name, const QStringList&) 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())); + connect(enableZeroconf,SIGNAL(toggled(bool)),this,SLOT(enableZeroconfChanged(bool))); + m_enableZeroconfChanged=false; if (DNSSD::Configuration::self()->publishDomain().isEmpty()) WANButton->setEnabled(false); + kcfg_PublishType->hide(); //unused with Avahi } KCMDnssd::~KCMDnssd() @@ -75,18 +84,55 @@ KCMDnssd::~KCMDnssd() void KCMDnssd::save() { + setCursor(QCursor(Qt::BusyCursor)); 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); + if (m_enableZeroconfChanged) { + + QString scaryMessage = i18n("Enabling local network browsing will open a network port (5353) on your computer. If security problems are discovered in the zeroconf server, remote attackers could access your computer as the \"avahi\" user."); + + KProcess *proc = new KProcess; + + *proc << "kdesu"; + + if (enableZeroconf->isChecked()) { + if (KMessageBox::warningYesNo( this, scaryMessage, i18n("Enable Zeroconf Network Browsing"), KGuiItem(i18n("Enable Browsing")), KGuiItem(i18n("Don't Enable Browsing")) ) == KMessageBox::Yes) { + + *proc << "/usr/share/avahi/enable_avahi 1"; + proc->start(KProcess::Block); + } else { + enableZeroconf->setChecked(false); + } + } else { + *proc << "/usr/share/avahi/enable_avahi 0"; + proc->start(KProcess::Block); + } + } + setCursor(QCursor(Qt::ArrowCursor)); } void KCMDnssd::load() { - KCModule::load(); if (geteuid()==0) loadMdnsd(); + enableZeroconf->setChecked(false); + QProcess avahiStatus(QString("/usr/share/avahi/avahi_status"), this, "avahiStatus"); + avahiStatus.start(); + while (avahiStatus.isRunning()) { + kapp->processEvents(); + } + int exitStatus = avahiStatus.exitStatus(); + if (exitStatus == 0) { // disabled + enableZeroconf->setChecked(false); + } else if (exitStatus == 1) { // enabled + enableZeroconf->setChecked(true); + } else if (exitStatus == 2) { // custom setup + enableZeroconf->setEnabled(false); + } + KCModule::load(); } // hack to work around not working isModified() for KPasswordEdit @@ -97,6 +143,12 @@ void KCMDnssd::wdchanged() m_wdchanged=true; } +void KCMDnssd::enableZeroconfChanged(bool) +{ + changed(); + m_enableZeroconfChanged=true; +} + void KCMDnssd::loadMdnsd() { QFile f(MDNSD_CONF); diff --git a/kcontrol/dnssd/kcmdnssd.h b/kcontrol/dnssd/kcmdnssd.h index 2e66f6a8f..384f7b625 100644 --- a/kcontrol/dnssd/kcmdnssd.h +++ b/kcontrol/dnssd/kcmdnssd.h @@ -38,12 +38,14 @@ public: virtual void load(); private slots: void wdchanged(); + void enableZeroconfChanged(bool); private: void loadMdnsd(); bool saveMdnsd(); QMap mdnsdLines; bool m_wdchanged; KSimpleConfig* domain; + bool m_enableZeroconfChanged; }; #endif -- cgit v1.2.1