diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /lanbrowsing/kcmlisa | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.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/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lanbrowsing/kcmlisa')
-rw-r--r-- | lanbrowsing/kcmlisa/Makefile.am | 18 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/configure.in.in | 4 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/findnic.cpp | 298 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/findnic.h | 69 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmkiolan.cpp | 103 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmkiolan.desktop | 140 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmkiolan.h | 53 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmlisa.cpp | 394 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmlisa.desktop | 122 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmlisa.h | 79 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmreslisa.cpp | 250 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmreslisa.desktop | 123 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/kcmreslisa.h | 67 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/main.cpp | 49 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/portsettingsbar.cpp | 51 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/portsettingsbar.h | 45 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/setupwizard.cpp | 569 | ||||
-rw-r--r-- | lanbrowsing/kcmlisa/setupwizard.h | 103 |
18 files changed, 2537 insertions, 0 deletions
diff --git a/lanbrowsing/kcmlisa/Makefile.am b/lanbrowsing/kcmlisa/Makefile.am new file mode 100644 index 00000000..cd9750e9 --- /dev/null +++ b/lanbrowsing/kcmlisa/Makefile.am @@ -0,0 +1,18 @@ +kde_module_LTLIBRARIES = kcm_lanbrowser.la + +kcm_lanbrowser_la_SOURCES = main.cpp setupwizard.cpp kcmlisa.cpp kcmreslisa.cpp kcmkiolan.cpp portsettingsbar.cpp findnic.cpp + +kcm_lanbrowser_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kcm_lanbrowser_la_LIBADD = -lkdeui + +INCLUDES= $(all_includes) + +SUBDIRS = + +kcm_lanbrowser_la_METASOURCES = AUTO + +messages: + $(XGETTEXT) $(kcm_lanbrowser_la_SOURCES) -o $(podir)/kcmlanbrowser.pot + +apps_DATA = kcmkiolan.desktop kcmlisa.desktop kcmreslisa.desktop +appsdir = $(kde_appsdir)/.hidden diff --git a/lanbrowsing/kcmlisa/configure.in.in b/lanbrowsing/kcmlisa/configure.in.in new file mode 100644 index 00000000..e08832eb --- /dev/null +++ b/lanbrowsing/kcmlisa/configure.in.in @@ -0,0 +1,4 @@ +AC_CHECK_FUNCS(getifaddrs getnameinfo) +AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[ +#include <sys/types.h> +#include <sys/socket.h>]) diff --git a/lanbrowsing/kcmlisa/findnic.cpp b/lanbrowsing/kcmlisa/findnic.cpp new file mode 100644 index 00000000..75f40f0e --- /dev/null +++ b/lanbrowsing/kcmlisa/findnic.cpp @@ -0,0 +1,298 @@ +/* + * findnic.cpp + * + * Copyright (c) 2001 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <config.h> + +#ifdef HAVE_SYS_SOCKIO_H +#include <sys/sockio.h> +#endif + +#include <sys/types.h> +#include <sys/param.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <stdio.h> +#include <unistd.h> +#include <sys/socket.h> + +#ifdef USE_SOLARIS +/* net/if.h is incompatible with STL on Solaris 2.6 - 2.8, redefine + map in the header file because we don't need it. -- Simon Josefsson */ +#define map junkmap +#endif +# include <net/if.h> +#ifdef USE_SOLARIS +#undef map +#endif + +#include <sys/ioctl.h> + +#ifndef HAVE_STRUCT_SOCKADDR_SA_LEN + #undef HAVE_GETNAMEINFO + #undef HAVE_GETIFADDRS +#endif + +#if defined(HAVE_GETNAMEINFO) && defined(HAVE_GETIFADDRS) + #include <ifaddrs.h> + #include <netdb.h> + #include <qstring.h> + + QString flags_tos (unsigned int flags); +#endif + +#include "findnic.h" + +#include <klocale.h> +#include <ksockaddr.h> + +NICList* findNICs() +{ + NICList* nl=new NICList; + nl->setAutoDelete(true); + +#if !defined(HAVE_GETIFADDRS) && !defined(HAVE_GETNAMEINFO) + + int sockfd = socket(AF_INET, SOCK_DGRAM, 0); + + char buf[8*1024]; + struct ifconf ifc; + ifc.ifc_len = sizeof(buf); + ifc.ifc_req = (struct ifreq *) buf; + int result=ioctl(sockfd, SIOCGIFCONF, &ifc); + + for (char* ptr = buf; ptr < buf + ifc.ifc_len; ) + { + struct ifreq *ifr =(struct ifreq *) ptr; + int len = sizeof(struct sockaddr); +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN + if (ifr->ifr_addr.sa_len > len) + len = ifr->ifr_addr.sa_len; /* length > 16 */ +#endif + ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */ + + int flags; + struct sockaddr_in *sinptr; + MyNIC *tmp=0; + switch (ifr->ifr_addr.sa_family) + { + case AF_INET: + sinptr = (struct sockaddr_in *) &ifr->ifr_addr; + flags=0; + + struct ifreq ifcopy; + ifcopy=*ifr; + result=ioctl(sockfd,SIOCGIFFLAGS,&ifcopy); + flags=ifcopy.ifr_flags; + + tmp=new MyNIC; + tmp->name=ifr->ifr_name; + if ((flags & IFF_UP) == IFF_UP) + tmp->state=i18n("Up"); + else + tmp->state=i18n("Down"); + + if ((flags & IFF_BROADCAST) == IFF_BROADCAST) + tmp->type=i18n("Broadcast"); + else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) + tmp->type=i18n("Point to Point"); +#ifndef _AIX + else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) + tmp->type=i18n("Multicast"); +#endif + else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) + tmp->type=i18n("Loopback"); + else + tmp->type=i18n("Unknown"); + + tmp->addr=inet_ntoa(sinptr->sin_addr); + + ifcopy=*ifr; + result=ioctl(sockfd,SIOCGIFNETMASK,&ifcopy); + if (result==0) + { + sinptr = (struct sockaddr_in *) &ifcopy.ifr_addr; + tmp->netmask=inet_ntoa(sinptr->sin_addr); + } + else + tmp->netmask=i18n("Unknown"); + nl->append(tmp); + break; + + default: + break; + } + } +#else + struct ifaddrs *ifap, *ifa; + if (getifaddrs(&ifap) != 0) { + return nl; + } + + MyNIC *tmp=0; + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { + switch (ifa->ifa_addr->sa_family) { + case AF_INET6: + case AF_INET: { + tmp = new MyNIC; + tmp->name = ifa->ifa_name; + + char buf[128]; + + bzero(buf, 128); + getnameinfo(ifa->ifa_addr, ifa->ifa_addr->sa_len, buf, 127, 0, 0, NI_NUMERICHOST); + tmp->addr = buf; + + if (ifa->ifa_netmask != NULL) { +#ifdef Q_OS_FREEBSD + struct sockaddr_in *sinptr = (struct sockaddr_in *)ifa->ifa_netmask; + tmp->netmask=inet_ntoa(sinptr->sin_addr); +#else + bzero(buf, 128); + getnameinfo(ifa->ifa_netmask, ifa->ifa_netmask->sa_len, buf, 127, 0, 0, NI_NUMERICHOST); + tmp->netmask = buf; +#endif + } + + if (ifa->ifa_flags & IFF_UP) + tmp->state=i18n("Up"); + else + tmp->state=i18n("Down"); + + tmp->type = flags_tos(ifa->ifa_flags); + + nl->append(tmp); + break; + } + default: + break; + } + } + + freeifaddrs(ifap); +#endif + return nl; +} + +void suggestSettingsForAddress(const QString& addrMask, LisaConfigInfo& lci) +{ + QString ip=addrMask.left(addrMask.find("/")); + QString mask=addrMask.mid(addrMask.find("/")+1); + + if (mask[mask.length()-1]==';') + mask=mask.left(mask.length()-1); + MyNIC tmpNic; + KInetSocketAddress::stringToAddr(AF_INET, mask.latin1(), &tmpNic.netmask); + KInetSocketAddress::stringToAddr(AF_INET, ip.latin1(), &tmpNic.addr); + suggestSettingsForNic(&tmpNic,lci); +} + +void suggestSettingsForNic(MyNIC* nic, LisaConfigInfo& lci) +{ + lci.clear(); + if (nic==0) + return; + QString address = nic->addr; + QString netmask = nic->netmask; + + QString addrMask(address+"/"+netmask+";"); + struct in_addr tmpaddr; + inet_aton(nic->netmask.latin1(), &tmpaddr); + unsigned int tmp= ntohl(tmpaddr.s_addr); + + //if the host part is less than 20 bits simply take it + //this might be a problem on 64 bit machines + if (tmp>0xfffff000) + { + lci.pingAddresses=addrMask; + lci.broadcastNetwork=addrMask; + lci.allowedAddresses=addrMask; + lci.secondWait=0; + lci.secondScan=false; + lci.firstWait=30; + lci.maxPingsAtOnce=256; + lci.updatePeriod=300; + lci.useNmblookup=false; + lci.unnamedHosts=false; + } + else + { + lci.pingAddresses=""; + lci.broadcastNetwork=addrMask; + lci.allowedAddresses=addrMask; + lci.secondWait=0; + lci.secondScan=false; + lci.firstWait=30; + lci.maxPingsAtOnce=256; + lci.updatePeriod=300; + lci.useNmblookup=true; + lci.unnamedHosts=false; + } +} + +LisaConfigInfo::LisaConfigInfo() +{ + clear(); +} + +void LisaConfigInfo::clear() +{ + pingAddresses=""; + broadcastNetwork=""; + allowedAddresses=""; + secondWait=0; + firstWait=0; + secondScan=false; + maxPingsAtOnce=256; + updatePeriod=0; + useNmblookup=false; + unnamedHosts=false; +} + +#if defined(HAVE_GETNAMEINFO) && defined(HAVE_GETIFADDRS) +QString flags_tos (unsigned int flags) +{ + QString tmp; + if (flags & IFF_POINTOPOINT) { + tmp += i18n("Point to Point"); + } + + if (flags & IFF_BROADCAST) { + if (tmp.length()) { + tmp += QString::fromLatin1(", "); + } + tmp += i18n("Broadcast"); + } + + if (flags & IFF_MULTICAST) { + if (tmp.length()) { + tmp += QString::fromLatin1(", "); + } + tmp += i18n("Multicast"); + } + + if (flags & IFF_LOOPBACK) { + if (tmp.length()) { + tmp += QString::fromLatin1(", "); + } + tmp += i18n("Loopback"); + } + return tmp; +} +#endif diff --git a/lanbrowsing/kcmlisa/findnic.h b/lanbrowsing/kcmlisa/findnic.h new file mode 100644 index 00000000..45273749 --- /dev/null +++ b/lanbrowsing/kcmlisa/findnic.h @@ -0,0 +1,69 @@ +/* + * findnic.h + * + * Copyright (c) 2001 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef FINDNIC_H +#define FINDNIC_H + +#include <qptrlist.h> +#include <qstring.h> + +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +struct MyNIC +{ + QString name; + QString addr; + QString netmask; + QString state; + QString type; +}; + +struct LisaConfigInfo +{ + LisaConfigInfo(); + void clear(); + QString pingAddresses; + QString broadcastNetwork; + QString allowedAddresses; + int secondWait; + bool secondScan; + int firstWait; + int maxPingsAtOnce; + int updatePeriod; + bool useNmblookup; + bool unnamedHosts; +}; + + +typedef QPtrList<MyNIC> NICList; + +//some plain C-like helper functions + +///Return a list with all NIC, which are up and broadcast-able +NICList* findNICs(); +///Enter some settings into lci which might be appropriate for nic +void suggestSettingsForNic(MyNIC* nic, LisaConfigInfo& lci); + +void suggestSettingsForAddress(const QString& addrMask, LisaConfigInfo& lci); + +#endif + diff --git a/lanbrowsing/kcmlisa/kcmkiolan.cpp b/lanbrowsing/kcmlisa/kcmkiolan.cpp new file mode 100644 index 00000000..89ae761e --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmkiolan.cpp @@ -0,0 +1,103 @@ +/* + * kcmkiolan.cpp + * + * Copyright (c) 2000 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "kcmkiolan.h" + +#include <qcheckbox.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qhbox.h> +#include <qlabel.h> +#include <qgroupbox.h> + +#include <klocale.h> +#include <kdebug.h> +#include <kdialog.h> + +IOSlaveSettings::IOSlaveSettings(const QString& config, QWidget *parent) +:KCModule(parent) +,m_config(config,false,true) +{ + QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QGroupBox* group=new QGroupBox(1, Horizontal, i18n("Show Links for Following Services"), this); + + m_ftpSettings=new PortSettingsBar(i18n("FTP (TCP, port 21): "), group); + m_httpSettings=new PortSettingsBar(i18n("HTTP (TCP, port 80): "),group); + m_nfsSettings=new PortSettingsBar(i18n("NFS (TCP, port 2049): "),group); + m_smbSettings=new PortSettingsBar(i18n("Windows shares (TCP, ports 445 and 139):"),group); + m_fishSettings=new PortSettingsBar(i18n("Secure Shell/Fish (TCP, port 22): "),group); + m_shortHostnames = new QCheckBox(i18n("Show &short hostnames (without domain suffix)"),this); + + QHBox *hbox=new QHBox(this); + QLabel *label=new QLabel(i18n("Default LISa server host: "), hbox); + m_defaultLisaHostLe=new QLineEdit(hbox); + label->setBuddy(m_defaultLisaHostLe); + + QWidget *w=new QWidget(this); + layout->setStretchFactor(m_ftpSettings,0); + layout->setStretchFactor(m_httpSettings,0); + layout->setStretchFactor(m_nfsSettings,0); + layout->setStretchFactor(m_smbSettings,0); + layout->setStretchFactor(m_shortHostnames,0); + layout->setStretchFactor(hbox,0); + layout->setStretchFactor(w,1); + + connect(m_ftpSettings,SIGNAL(changed()),this,SIGNAL(changed())); + connect(m_httpSettings,SIGNAL(changed()),this,SIGNAL(changed())); + connect(m_nfsSettings,SIGNAL(changed()),this,SIGNAL(changed())); + connect(m_smbSettings,SIGNAL(changed()),this,SIGNAL(changed())); + connect(m_fishSettings,SIGNAL(changed()),this,SIGNAL(changed())); + connect(m_shortHostnames,SIGNAL(clicked()),this,SIGNAL(changed())); + connect(m_defaultLisaHostLe, SIGNAL(textChanged(const QString&)),this,SIGNAL(changed())); +} + +void IOSlaveSettings::load() +{ + kdDebug()<<"IOSlaveSettings::load()"<<endl; + m_ftpSettings->setChecked(m_config.readNumEntry("Support_FTP", PORTSETTINGS_CHECK)); + m_httpSettings->setChecked(m_config.readNumEntry("Support_HTTP", PORTSETTINGS_CHECK)); + m_nfsSettings->setChecked(m_config.readNumEntry("Support_NFS", PORTSETTINGS_CHECK)); + m_smbSettings->setChecked(m_config.readNumEntry("Support_SMB", PORTSETTINGS_CHECK)); + m_fishSettings->setChecked(m_config.readNumEntry("Support_FISH", PORTSETTINGS_CHECK)); + m_shortHostnames->setChecked(m_config.readBoolEntry("ShowShortHostnames",false)); +// m_rlanSidebar->setChecked(m_config.readEntry("sidebarURL", "lan:/") == "rlan:/" ? true : false ); + m_defaultLisaHostLe->setText(m_config.readEntry("DefaultLisaHost", "localhost")); +} + +void IOSlaveSettings::save() +{ + kdDebug()<<"IOSlaveSettings::save()"<<endl; + m_config.writeEntry("AlreadyConfigured",true); + m_config.writeEntry("Support_FTP", m_ftpSettings->selected()); + m_config.writeEntry("Support_HTTP", m_httpSettings->selected()); + m_config.writeEntry("Support_NFS", m_nfsSettings->selected()); + m_config.writeEntry("Support_SMB", m_smbSettings->selected()); + m_config.writeEntry("Support_FISH", m_fishSettings->selected()); + m_config.writeEntry("ShowShortHostnames",m_shortHostnames->isChecked()); +// m_config.writeEntry("sidebarURL", m_rlanSidebar->isChecked() ? "rlan:/" : "lan:/"); + m_config.writeEntry("DefaultLisaHost", m_defaultLisaHostLe->text()); + + m_config.sync(); +} + +#include "kcmkiolan.moc" + diff --git a/lanbrowsing/kcmlisa/kcmkiolan.desktop b/lanbrowsing/kcmlisa/kcmkiolan.desktop new file mode 100644 index 00000000..c15e9724 --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmkiolan.desktop @@ -0,0 +1,140 @@ +[Desktop Entry] +Type=Application +Icon=samba +Exec=kcmshell kcmkiolan + +X-KDE-ModuleType=Library +X-KDE-Library=lanbrowser +X-KDE-FactoryName=kiolan + +Name=LAN KIO Slave +Name[ar]=الشبكة المحلية KIO Slave +Name[be]=Модуль kioslave для мясцовай сетцы +Name[bn]=ল্যান কে-আই-ও স্লেভ +Name[br]=Sklav LAN evit KIO +Name[bs]=LAN KIO slave +Name[cs]=LAN KIO slave +Name[cy]=Gwas KIO LAN +Name[da]=LAN KIO-slave +Name[de]=Ein-/Ausgabemodul für LAN +Name[eo]=LAN-enel-sklavo +Name[es]=Esclavo de LAN KIO +Name[et]=Kohtvõrgu KIO moodul +Name[eu]=LAN KIO morroia +Name[fi]=LAN-siirräntätyöskentelijä +Name[fr]=Module KIO LAN +Name[ga]=Sclábhaí KIO LAN +Name[gl]=Escravo KIO para redes locáis +Name[hi]=लैन केआईओ स्लेव +Name[hu]=Hálózatböngészés +Name[is]=LAN KIO þræll +Name[it]=Slave LAN KIO +Name[ja]=LAN KIO スレーブ +Name[km]=KIO Slave បណ្ដាញមូលដ្ឋាន +Name[lt]=LAN antrinė KDE programa +Name[mn]=Протокол IO LAN +Name[ms]=Hamba LAN KIO +Name[nb]=KIO-slave for LAN +Name[nds]=Nettwark-In-/Utgaavdeenst +Name[ne]=LAN KIO स्लाभ +Name[nl]=LAN IO Slave +Name[nn]=LAN-iuslave +Name[nso]=Lekgoba la LAN KIO +Name[pa]=LAN KIO ਸਲੇਵ +Name[pl]=Procedura we/wy dla sieci lokalnej +Name[pt]='Kioslave' LAN +Name[ru]=Протокол IO LAN +Name[se]=LAN KIO-šláva +Name[sk]=LAN KIO slave +Name[sl]=KIO Slave za LAN +Name[sv]=I/O-slav för lokalt nätverk +Name[ta]=LAN KIO அடிமை +Name[tg]=Фармонбари Шабакаи Маҳаллии KIO +Name[uk]=Підлеглий KIO ЛОМ +Name[zh_CN]=LAN KIO 从属进程 + +Comment=lan: and rlan: setup +Comment[ar]=lan: و rlan: تنصيب +Comment[be]=Настаўленне lan: і rlan: +Comment[bg]=Настройване на протоколите lan: и rlan: +Comment[bn]=ল্যান: এবং আর-ল্যান: ব্যবস্থাপনা +Comment[br]=kefluniañ lan: ha rlan: +Comment[bs]=Podešavanje lan: i rlan: URLova +Comment[ca]=Per l'arranjament de lan: i rlan: +Comment[cs]=Nastavení lan: and rlan: +Comment[cy]=gosod lan: a rlan: +Comment[da]=lan: og rlan: opsætning +Comment[de]=lan: und rlan: einrichten +Comment[el]=Ρύθμιση lan: και rlan: +Comment[eo]=lan kaj rlan: agordo +Comment[es]=lan: y rlan: configuración +Comment[et]=lan: ja rlan: seadistamine +Comment[eu]=lan: eta rlan: konfigurazioa +Comment[fa]=شبکۀ محلی: و شبکۀ محلی راه دور: برپایی +Comment[fi]=lan: ja rlan: asetukset +Comment[fr]=configuration pour lan: et rlan: +Comment[ga]=Cumraíocht lan: agus rlan: +Comment[gl]=Configuración de lan: e rlan: +Comment[he]=שינוי הגדרות :lan ו-:rlan +Comment[hi]=लैन: तथा आर-लैन: सेटअप +Comment[hr]=Podešavanje lan-a i rlan-a +Comment[hu]=A lan: és az rlan: protokoll beállítása +Comment[is]=lan: og rlan: uppsetning +Comment[it]=Configurazione lan: e rlan: +Comment[ja]=lan と rlan のセットアップ +Comment[ka]=lan: და rlan: გამართვა +Comment[kk]=lan: мен rlan: параметрлерді орнату +Comment[km]=រៀបចំ lan: និង rlan: +Comment[lt]=lan: ir rlan: nustatymas +Comment[mk]=Поставување на lan: и rlan: +Comment[mn]=lan: ба rlan: тохируулга +Comment[ms]=lan: dan rlan: pemasangan +Comment[nb]=Oppsett for lan: og rlan: +Comment[nds]=lan: un rlan: instellen +Comment[ne]=lan: र rlan: सेटअप +Comment[nl]=Instellen van lan: en rlan: +Comment[nn]=Oppsett av lan: og rlan: +Comment[nso]=peakanyo ya lan: le rlan: +Comment[pl]=ustawienia lan: i rlan: +Comment[pt]=Configuração do lan: e do rlan: +Comment[pt_BR]=lan: e rlan: configuração +Comment[ru]=параметры lan: и rlan: +Comment[se]=Heivet lan: ja rlan: +Comment[sk]=lan: a rlan: nastavenie +Comment[sl]=Nastavitve lan: in rlan: +Comment[sr]=Подешавање lan:-а и rlan:-а +Comment[sr@Latn]=Podešavanje lan:-a i rlan:-a +Comment[sv]=Inställning av lan: och rlan: +Comment[ta]=lan: மற்றும் rlan: அமைப்பு +Comment[tg]=барпосозии шабакаи маҳаллӣ: ва rlan: +Comment[tr]=lan: ve rlan: ayarları +Comment[uk]=Налаштування lan: і rlan: +Comment[ven]=lan: na rlan: mavhekanyele +Comment[xh]=lan: kunye ne rlan: ucwangciso +Comment[zh_CN]=lan: 和 rlan: 设置 +Comment[zh_HK]=lan: 與 rlan: 設定 +Comment[zh_TW]=lan: 與 rlan: 設定 +Comment[zu]=Ilayini yokuyalela ye applet + +Keywords=lan +Keywords[bg]=настройки, локална, мрежа, lan +Keywords[bn]=ল্যান +Keywords[de]=LAN +Keywords[eo]=reto +Keywords[fa]=شبکۀ داخلی +Keywords[fr]=lan,réseau local,réseau +Keywords[gl]=lan,redes locáis +Keywords[he]=lan,רשת מקומית +Keywords[hi]=लैन +Keywords[lt]=lan,vietinis tinklas +Keywords[nds]=lan,nettwark +Keywords[ne]=ल्यान +Keywords[nl]=lan,lokaal netwerk,netwerk +Keywords[pl]=lan,LAN +Keywords[ru]=lan, локальная сеть +Keywords[sk]=lan,sieť +Keywords[tg]=шабакаи маҳаллӣ +Keywords[uk]=lan, локальна мережа +Keywords[uz]=lokal tarmoq +Keywords[uz@cyrillic]=локал тармоқ +Keywords[zh_CN]=lan,局域网 diff --git a/lanbrowsing/kcmlisa/kcmkiolan.h b/lanbrowsing/kcmlisa/kcmkiolan.h new file mode 100644 index 00000000..8711deab --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmkiolan.h @@ -0,0 +1,53 @@ +/* + * kcmkiolan.h + * + * Copyright (c) 2000 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef KCMKIOLAN_H +#define KCMKIOLAN_H + +#include "portsettingsbar.h" +#include <kcmodule.h> +#include <kconfig.h> + +class QCheckBox; +class QLineEdit; + +class IOSlaveSettings:public KCModule +{ + Q_OBJECT + public: + IOSlaveSettings(const QString& config, QWidget *parent=0); + virtual ~IOSlaveSettings() {}; + void load(); + void save(); + signals: + void changed(); + protected: + KConfig m_config; + QCheckBox *m_shortHostnames; + QCheckBox *m_rlanSidebar; + PortSettingsBar *m_ftpSettings; + PortSettingsBar *m_httpSettings; + PortSettingsBar *m_nfsSettings; + PortSettingsBar *m_smbSettings; + PortSettingsBar *m_fishSettings; + QLineEdit *m_defaultLisaHostLe; +}; + +#endif diff --git a/lanbrowsing/kcmlisa/kcmlisa.cpp b/lanbrowsing/kcmlisa/kcmlisa.cpp new file mode 100644 index 00000000..654c5848 --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmlisa.cpp @@ -0,0 +1,394 @@ +/* + * kcmlisa.cpp + * + * Copyright (c) 2000,2001 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "kcmlisa.h" + +#include "findnic.h" +#include "setupwizard.h" + +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <pwd.h> +#include <time.h> + +#include <qtooltip.h> +#include <qfile.h> +#include <qspinbox.h> +#include <qcheckbox.h> +#include <qpushbutton.h> +#include <qgrid.h> +#include <qvbuttongroup.h> + +#include <kapplication.h> +#include <kprocess.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <keditlistbox.h> +#include <krestrictedline.h> +#include <kdialogbase.h> +#include <ktempfile.h> + +#include <kdebug.h> + +LisaSettings::LisaSettings(const QString& config, QWidget *parent) +: KCModule(parent, "kcmlanbrowser") +,m_config(config,false,true) +,m_wizard(0) +,m_configFilename(config) +,m_changed(false) +{ + QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QWidget *dummy(0); + + QVButtonGroup *gb=new QVButtonGroup(i18n("Tell LISa Daemon How to Search for Hosts"),this); + gb->setInsideSpacing(10); + + m_useNmblookup=new QCheckBox(i18n("Send &NetBIOS broadcasts using nmblookup"), gb); + QToolTip::add(m_useNmblookup,i18n("Only hosts running SMB servers will answer")); + + m_sendPings=new QCheckBox(i18n("Send &pings (ICMP echo packets)"), gb); + QToolTip::add(m_sendPings,i18n("All hosts running TCP/IP will answer")); + + QHBox *hbox=new QHBox(gb); + hbox->setSpacing(10); + + dummy=new QWidget(hbox); + dummy->setMinimumWidth(10); + QLabel *label=new QLabel(i18n("To these &IP addresses:"),hbox); + QString comment = i18n("Enter all ranges to scan, using the format '192.168.0.1/255.255.255.0;10.0.0.1;255.0.0.0'"); + QToolTip::add(label,comment); + m_pingAddresses=new KRestrictedLine(hbox,"a","0123456789.-/;"); + QToolTip::add(m_pingAddresses, comment); + label->setBuddy(m_pingAddresses); + + QGrid *addressesGrid = new QGrid(2, Qt::Horizontal, this); + addressesGrid->setSpacing(10); + layout->setStretchFactor(addressesGrid,0); + + label=new QLabel(i18n("&Broadcast network address:"),addressesGrid); + comment=i18n("Your network address/subnet mask (e.g. 192.168.0.0/255.255.255.0;)"); + QToolTip::add(label, comment); + + m_broadcastNetwork=new KRestrictedLine(addressesGrid,"a","0123456789./;"); + QToolTip::add(m_broadcastNetwork,comment); + label->setBuddy(m_broadcastNetwork); + + label=new QLabel(i18n("&Trusted IP addresses:"),addressesGrid); + comment = i18n("Usually your network address/subnet mask (e.g. 192.168.0.0/255.255.255.0;)"); + QToolTip::add(label, comment); + + m_allowedAddresses=new KRestrictedLine(addressesGrid,"a","0123456789./;"); + QToolTip::add(m_allowedAddresses, comment); + label->setBuddy(m_allowedAddresses); + + dummy=new QWidget(this); + layout->setStretchFactor(dummy,10); + + hbox = new QHBox(this); + hbox->setSpacing(10); +// m_autoSetup=new QPushButton(i18n("&Guided LISa Setup..."),hbox); + m_autoSetup=new QPushButton(i18n("Setup Wizard..."),hbox); + m_autoSetup->setFixedWidth( m_autoSetup->sizeHint().width() ); + + m_suggestSettings=new QPushButton(i18n("&Suggest Settings"),hbox); + + new QWidget(hbox); + + m_advancedSettingsButton=new QPushButton(i18n("Ad&vanced Settings..."),hbox); + + m_lisaAdvancedDlg=new KDialogBase(0,0,true,i18n("Advanced Settings for LISa"),KDialogBase::Close, KDialogBase::Close); + connect(m_advancedSettingsButton,SIGNAL(clicked()),m_lisaAdvancedDlg,SLOT(show())); + + QVBox *vbox=m_lisaAdvancedDlg->makeVBoxMainWidget(); + + m_pingNames=new KEditListBox(i18n("&Additionally Check These Hosts"),vbox,"a",false, KEditListBox::Add|KEditListBox::Remove); + m_pingNames->setMinimumHeight(180); + QToolTip::add(m_pingNames,i18n("The hosts listed here will be pinged")); + + dummy=new QWidget(vbox); + dummy->setMinimumHeight(10); + m_deliverUnnamedHosts=new QCheckBox(i18n("Show &hosts without DNS names"),vbox); + + QGrid *advGrid = new QGrid(2, Qt::Horizontal, vbox); + advGrid->setSpacing(10); + + label=new QLabel(i18n("Host list update interval:"),advGrid); + QToolTip::add(label,i18n("Search hosts after this number of seconds")); + m_updatePeriod=new QSpinBox(30,1800,10,advGrid); + m_updatePeriod->setSuffix(i18n(" sec")); + QToolTip::add(m_updatePeriod,i18n("Search hosts after this number of seconds")); + + m_secondScan=new QCheckBox(i18n("Always check twice for hosts when searching"),advGrid); + new QWidget(advGrid); + + label=new QLabel(i18n("Wait for replies from hosts after first scan:"),advGrid); + QToolTip::add(label,i18n("How long to wait for replies to the ICMP echo requests from hosts")); + m_firstWait=new QSpinBox(10,1000,50,advGrid); + m_firstWait->setSuffix(i18n(" ms")); + QToolTip::add(m_firstWait,i18n("How long to wait for replies to the ICMP echo requests from hosts")); + + label=new QLabel(i18n("Wait for replies from hosts after second scan:"),advGrid); + QToolTip::add(label,i18n("How long to wait for replies to the ICMP echo requests from hosts")); + m_secondWait=new QSpinBox(0,1000,50,advGrid); + m_secondWait->setSuffix(i18n(" ms")); + QToolTip::add(m_secondWait,i18n("How long to wait for replies to the ICMP echo requests from hosts")); + + label=new QLabel(i18n("Max. number of ping packets to send at once:"),advGrid); + m_maxPingsAtOnce=new QSpinBox(8,1024,5,advGrid); + + dummy=new QWidget(advGrid); + dummy->setMinimumHeight(10); + + connect(m_secondScan,SIGNAL(toggled(bool)),m_secondWait,SLOT(setEnabled(bool))); + connect(m_sendPings,SIGNAL(toggled(bool)),m_pingAddresses,SLOT(setEnabled(bool))); + + connect(m_pingAddresses,SIGNAL(textChanged(const QString&)),this,SIGNAL(changed())); + connect(m_allowedAddresses,SIGNAL(textChanged(const QString&)),this,SIGNAL(changed())); + connect(m_broadcastNetwork,SIGNAL(textChanged(const QString&)),this,SIGNAL(changed())); + + connect(m_pingAddresses,SIGNAL(returnPressed()),this,SIGNAL(changed())); + connect(m_allowedAddresses,SIGNAL(returnPressed()),this,SIGNAL(changed())); + connect(m_broadcastNetwork,SIGNAL(returnPressed()),this,SIGNAL(changed())); + + connect(m_sendPings,SIGNAL(toggled(bool)),this,SIGNAL(changed())); + connect(m_firstWait,SIGNAL(valueChanged(int)),this,SIGNAL(changed())); + connect(m_secondWait,SIGNAL(valueChanged(int)),this,SIGNAL(changed())); + connect(m_maxPingsAtOnce,SIGNAL(valueChanged(int)),this,SIGNAL(changed())); + connect(m_secondScan,SIGNAL(toggled(bool)),this,SIGNAL(changed())); + connect(m_deliverUnnamedHosts,SIGNAL(toggled(bool)),this,SIGNAL(changed())); + connect(m_updatePeriod,SIGNAL(valueChanged(int)),this,SIGNAL(changed())); + connect(m_pingNames,SIGNAL(changed()),this,SIGNAL(changed())); + connect(m_useNmblookup,SIGNAL(toggled(bool)),this,SIGNAL(changed())); + connect(m_autoSetup,SIGNAL(clicked()),this,SLOT(autoSetup())); + connect(m_suggestSettings,SIGNAL(clicked()),this,SLOT(suggestSettings())); + connect(this, SIGNAL(changed()), SLOT(slotChanged())); +} + +void LisaSettings::load() +{ + int secondWait=m_config.readNumEntry("SecondWait",-1); + if (secondWait<0) + { + m_secondWait->setValue(300); + m_secondScan->setChecked(FALSE); + m_secondWait->setEnabled(FALSE); + } + else + { + m_secondWait->setValue(secondWait*10); + m_secondScan->setChecked(TRUE); + m_secondWait->setEnabled(TRUE); + } + m_deliverUnnamedHosts->setChecked(m_config.readNumEntry("DeliverUnnamedHosts",0)); + + m_firstWait->setValue(m_config.readNumEntry("FirstWait",30)*10); + m_maxPingsAtOnce->setValue(m_config.readNumEntry("MaxPingsAtOnce",256)); + m_updatePeriod->setValue(m_config.readNumEntry("UpdatePeriod",300)); + m_pingAddresses->setText(m_config.readEntry("PingAddresses","192.168.0.0/255.255.255.0;192.168.100.0-192.168.100.254")); + m_sendPings->setChecked(!m_pingAddresses->text().isEmpty()); + m_allowedAddresses->setText(m_config.readEntry("AllowedAddresses","192.168.0.0/255.255.255.0")); + m_broadcastNetwork->setText(m_config.readEntry("BroadcastNetwork","192.168.0.0/255.255.255.0")); + m_pingNames->clear(); + m_pingNames->insertStringList(m_config.readListEntry("PingNames",';')); + int i=m_config.readNumEntry("SearchUsingNmblookup",1); + m_useNmblookup->setChecked(i!=0); + m_changed = false; +} + +void LisaSettings::save() +{ + if (!m_changed) return; + + if ( getuid()==0) + { + if (m_secondScan->isChecked()) + m_config.writeEntry("SecondWait",(m_secondWait->value()+5)/10); + else + m_config.writeEntry("SecondWait",-1); + + if (m_useNmblookup->isChecked()) + m_config.writeEntry("SearchUsingNmblookup",1); + else + m_config.writeEntry("SearchUsingNmblookup",0); + + if (m_deliverUnnamedHosts->isChecked()) + m_config.writeEntry("DeliverUnnamedHosts",1); + else + m_config.writeEntry("DeliverUnnamedHosts",0); + + m_config.writeEntry("FirstWait",(m_firstWait->value()+5)/10); + m_config.writeEntry("MaxPingsAtOnce",m_maxPingsAtOnce->value()); + m_config.writeEntry("UpdatePeriod",m_updatePeriod->value()); + m_config.writeEntry("PingAddresses",m_sendPings->isChecked()?m_pingAddresses->text():""); + m_config.writeEntry("AllowedAddresses",m_allowedAddresses->text()); + m_config.writeEntry("BroadcastNetwork",m_broadcastNetwork->text()); + QStringList writeStuff; + for (int i=0; i<m_pingNames->count(); i++) + writeStuff.append(m_pingNames->text(i)); + m_config.writeEntry("PingNames",writeStuff,';'); + + m_config.sync(); + chmod(QFile::encodeName(m_configFilename),S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + } + else + { + //ok, now it gets harder + //we are not root but we want to write into /etc .... + //any idea how to do it better ? + KTempFile tmp; + + if (tmp.status() == 0 && tmp.textStream()) + { + m_tmpFilename = tmp.name(); + QTextStream &confStream = *(tmp.textStream()); + if (m_secondScan->isChecked()) + confStream<<"SecondWait = "<<(m_secondWait->value()+5)/10<<"\n"; + else + confStream<<"SecondWait = -1\n"; + + if (m_useNmblookup->isChecked()) + confStream<<"SearchUsingNmblookup = 1\n"; + else + confStream<<"SearchUsingNmblookup = 0\n"; + + if (m_deliverUnnamedHosts->isChecked()) + confStream<<"DeliverUnnamedHosts = 1\n"; + else + confStream<<"DeliverUnnamedHosts = 0\n"; + + confStream<<"FirstWait = "<< (m_firstWait->value()+5)/10 <<"\n"; + confStream<<"MaxPingsAtOnce = "<<m_maxPingsAtOnce->value()<<"\n"; + confStream<<"UpdatePeriod = "<<m_updatePeriod->value()<<"\n"; + confStream<<"PingAddresses = "<<m_pingAddresses->text().latin1()<<"\n"; + confStream<<"AllowedAddresses = "<<m_allowedAddresses->text().latin1()<<"\n"; + confStream<<"BroadcastNetwork = "<<m_broadcastNetwork->text().latin1()<<"\n"; + QString writeStuff; + for (int i=0; i<m_pingNames->count(); i++) + writeStuff=writeStuff+m_pingNames->text(i).latin1()+";"; + + confStream<<"PingNames = "<<writeStuff.latin1()<<"\n"; + tmp.close(); + QString suCommand=QString("cp '%1' '%2'; chmod 644 '%3'; rm -f '%4'").arg(m_tmpFilename).arg(m_configFilename).arg(m_configFilename).arg(m_tmpFilename); + KProcess *proc = new KProcess(); + connect(proc, SIGNAL(processExited(KProcess *)), this, SLOT(saveDone(KProcess *))); + *proc<<"kdesu"<<"-c"<<suCommand; + KApplication::setOverrideCursor(Qt::waitCursor); + setEnabled(false); + if ( !proc->start() ) + delete proc; + } + else + KMessageBox::sorry(0,i18n("Saving the results to %1 failed.").arg(m_configFilename)); + } +} + +void LisaSettings::suggestSettings() +{ + NICList *nics=findNICs(); + if (nics->count()==0) + { + KMessageBox::sorry(0,i18n("No network interface cards found.")); + delete nics; + return; + } + MyNIC *nic=nics->first(); + LisaConfigInfo lci; + suggestSettingsForNic(nic,lci); + m_pingAddresses->setText(lci.pingAddresses); + m_sendPings->setChecked(!m_pingAddresses->text().isEmpty()); + m_broadcastNetwork->setText(lci.broadcastNetwork); + m_allowedAddresses->setText(lci.allowedAddresses); + m_secondWait->setValue(lci.secondWait*10); + m_secondScan->setChecked(lci.secondScan); + m_secondWait->setEnabled(lci.secondScan); + m_firstWait->setValue(lci.firstWait*10); + m_maxPingsAtOnce->setValue(lci.maxPingsAtOnce); + m_updatePeriod->setValue(lci.updatePeriod); + m_useNmblookup->setChecked(lci.useNmblookup); + m_deliverUnnamedHosts->setChecked(lci.unnamedHosts); + + if (nics->count()>1) + { + QString msg(i18n("You have more than one network interface installed.<br>" + "Please make sure the suggested settings are correct.<br>" + "<br>The following interfaces were found:<br><br>")); + //not that easy to handle + for (MyNIC* tmp=nics->first(); tmp!=0; tmp=nics->next()) + { + msg+="<b>"+tmp->name+": </b>"+tmp->addr+"/"+tmp->netmask+";<br>"; + } + KMessageBox::information(0,QString("<html>%1</html>").arg(msg)); + } + + emit changed(); + delete nics; +} + +void LisaSettings::autoSetup() +{ + LisaConfigInfo lci; + if (m_wizard==0) + m_wizard=new SetupWizard(this,&lci); + else + m_wizard->clearAll(); + int result=m_wizard->exec(); + + if (result!=QDialog::Accepted) + return; + + m_pingAddresses->setText(lci.pingAddresses); + m_sendPings->setChecked(!m_pingAddresses->text().isEmpty()); + m_broadcastNetwork->setText(lci.broadcastNetwork); + m_allowedAddresses->setText(lci.allowedAddresses); + m_secondWait->setValue(lci.secondWait*10); + m_secondScan->setChecked(lci.secondScan); + m_secondWait->setEnabled(lci.secondScan); + m_firstWait->setValue(lci.firstWait*10); + m_maxPingsAtOnce->setValue(lci.maxPingsAtOnce); + m_updatePeriod->setValue(lci.updatePeriod); + m_useNmblookup->setChecked(lci.useNmblookup); + m_deliverUnnamedHosts->setChecked(lci.unnamedHosts); + + emit changed(); + return; +} + +void LisaSettings::saveDone(KProcess *proc) +{ + unlink(QFile::encodeName(m_tmpFilename)); + KApplication::restoreOverrideCursor(); + setEnabled(true); + KMessageBox::information(0,i18n("The configuration has been saved to /etc/lisarc.\n" + "Make sure that the LISa daemon is started,\n e.g. using an init script when booting.\n" + "You can find examples and documentation at http://lisa-home.sourceforge.net .")); + + delete(proc); +} + +void LisaSettings::slotChanged() +{ + m_changed = true; +} + +#include "kcmlisa.moc" + diff --git a/lanbrowsing/kcmlisa/kcmlisa.desktop b/lanbrowsing/kcmlisa/kcmlisa.desktop new file mode 100644 index 00000000..f995a9cf --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmlisa.desktop @@ -0,0 +1,122 @@ +[Desktop Entry] +Type=Application +Icon=samba +Exec=kcmshell kcmlisa + +X-KDE-ModuleType=Library +X-KDE-Library=lanbrowser +X-KDE-FactoryName=lisa + +Name=LISa +Name[hi]=लिसा +Name[sv]=Lisa +Name[th]=ลิซา + +Comment=Setup LISa +Comment[ar]=تنصيب LISa +Comment[be]=Настаўленны LISы +Comment[bg]=Настройване на LISa +Comment[bn]=LISa ব্যবস্থাপনা +Comment[br]=Kefluniañ LISa +Comment[bs]=Podešavanje LISe +Comment[ca]=Per l'arranjament de LISa +Comment[cs]=Nastavit LISa +Comment[cy]=Gosod LISa +Comment[da]=Opsætning af LISa +Comment[de]=LISa einrichten +Comment[el]=Ρύθμιση LISa +Comment[eo]=Agordo de LISa +Comment[es]=Configuración LISa +Comment[et]=LISa seadistamine +Comment[eu]=LISa konfiguratu +Comment[fa]=برپایی LISa +Comment[fi]=Aseta LISa +Comment[fr]=Configuration de LISa +Comment[ga]=Cumraigh LISa +Comment[gl]=Configuración de LISa +Comment[he]=שינוי הגדרות LISa +Comment[hi]=लिसा सेटअप +Comment[hr]=Podešavanje LISa-e +Comment[hu]=A LISa szolgáltatás beállítása +Comment[is]=Stillingar LISa +Comment[it]=Impostazioni LISa +Comment[ja]=LISa のセットアップ +Comment[ka]=LISa-ს გამართვა +Comment[kk]=LISa баптауы +Comment[km]=រៀបចំ LISa +Comment[lt]=Nustatyti LISa +Comment[mk]=Поставување на LISa +Comment[mn]=LISa тохируулга +Comment[ms]=Pasang LISa +Comment[nb]=Tilpass LISa +Comment[nds]=LISa instellen +Comment[ne]=LISa सेटअप गर्नुहोस् +Comment[nl]=LISa instellen +Comment[nn]=LISa-oppsett +Comment[nso]=Beakanya LISa +Comment[pl]=Ustawienia programu LISa +Comment[pt]=Configuração do LISa +Comment[pt_BR]=Configuração de LISa +Comment[ru]=Параметры LISa +Comment[se]=Heivet LISa +Comment[sk]=Nastavenie LISy +Comment[sl]=Nastavi LISa +Comment[sr]=Подесите LISa-у +Comment[sr@Latn]=Podesite LISa-u +Comment[sv]=Anpassa Lisa +Comment[ta]=LISa அமைப்புகள் +Comment[tg]=Барпосозии LISa +Comment[th]=ตั้งค่าลิซา +Comment[tr]=LISa'yı yapılandır +Comment[uk]=Налаштування LISa +Comment[uz]=LISa'ni oʻrnatish +Comment[uz@cyrillic]=LISa'ни ўрнатиш +Comment[ven]=Vhekanyani LISa +Comment[wa]=Apontiaedje di LISa +Comment[xh]=Cwangcis i LISa +Comment[zh_CN]=设置 LISa +Comment[zh_HK]=設定 LISa +Comment[zh_TW]=設定 LISa +Comment[zu]=Lungisa i-LISa + +Keywords=lisa,network,smb,ftp,fish,http +Keywords[be]=сетка,lisa,network,smb,ftp,fish,http +Keywords[bg]=мрежа, самба, настройки, локална, споделяне, lisa, network, smb, ftp, fish, http +Keywords[br]=lisa,rouedad,smb,ftp,fish,http +Keywords[ca]=lisa,xarxa,smb,ftp,fish,http +Keywords[cs]=lisa,síť,smb,ftp,fish,http +Keywords[cy]=lisa,rhwydwaith,smb,ftp,fish,http +Keywords[da]=lisa,netværk,smb,ftp,fish,http +Keywords[de]=lisa,Netzwerk,smb,ftp,fish,http +Keywords[el]=lisa,δίκτυο,smb,ftp,fish,http +Keywords[et]=lisa,võrk,smb,ftp,fish,http +Keywords[eu]=lisa,sarea,smb,ftp,fish,http +Keywords[fa]=lisa، شبکه، smb، قاپ، fish، قام +Keywords[fi]=lisa,verkko,smb,ftp,fish,http +Keywords[fr]=lisa,réseau,smb,ftp,fish,http +Keywords[gl]=lisa,rede,smb,ftp,fish,http +Keywords[he]=lisa,רשת,smb,ftp,fish,http +Keywords[hi]=लिसा,नेटवर्क,एसएमबी,एफटीपी,फिश,एचटीटीपी +Keywords[hu]=lisa,hálózat,smb,ftp,fish,http +Keywords[it]=lisa,rete,smb,ftp,fish,http +Keywords[ja]=lisa,ネットワーク,smb,ftp,fish,http +Keywords[km]=lisa,បណ្ដាញ,smb,ftp,fish,http +Keywords[lt]=lisa,network,smb,ftp,fish,http,tinklas +Keywords[mk]=lisa,network,smb,ftp,fish,http,мрежа +Keywords[nb]=lisa,nettverk,smb,ftp,fish,http +Keywords[nds]=lisa,nettwark,smb,ftp,fish,http +Keywords[ne]=लिसा,सञ्जाल,smb,ftp,fish,http +Keywords[nl]=lisa,netwerk,smb,ftp,fish,http,samba +Keywords[nn]=lisa,nettverk,smb,ftp,fish,http +Keywords[pl]=lisa,sieć,smb,ftp,fish,http +Keywords[pt]=lisa,rede,smb,ftp,fish,http +Keywords[pt_BR]=lisa,rede,smb,ftp,fish,http +Keywords[ru]=lisa,сеть,smb,ftp,fish,http +Keywords[sk]=lisa,sieť,smb,ftp,fish,http +Keywords[sl]=lisa,omrežje,smb,ftp,fish,http +Keywords[sv]=lisa,nätverk,smb,ftp,fish,http +Keywords[tr]=lisa,ağ,smb,ftp,fish,http +Keywords[uk]=lisa,мережа,smb,ftp,fish,http +Keywords[uz]=lisa,tarmoq,smb,ftp,fish,http +Keywords[uz@cyrillic]=lisa,тармоқ,smb,ftp,fish,http +Keywords[zh_CN]=lisa,network,smb,ftp,fish,http,网络 diff --git a/lanbrowsing/kcmlisa/kcmlisa.h b/lanbrowsing/kcmlisa/kcmlisa.h new file mode 100644 index 00000000..fcda0a89 --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmlisa.h @@ -0,0 +1,79 @@ +/* + * kcmlisa.h + * + * Copyright (c) 2000-2002 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef KCMLISA_H +#define KCMLISA_H + +#include <kconfig.h> +#include <kcmodule.h> + +class QPushButton; +class QCheckBox; +class QSpinBox; +class QPushButton; +class KProcess; +class KDialogBase; +class KRestrictedLine; +class KEditListBox; +class SetupWizard; + +class LisaSettings:public KCModule +{ + Q_OBJECT + public: + LisaSettings(const QString& config, QWidget *parent=0); + virtual ~LisaSettings() {}; + void load(); + void save(); + signals: + void changed(); + protected slots: + void slotChanged(); + void autoSetup(); + void saveDone(KProcess *); // called after the kdesud returns (on save) + void suggestSettings(); + protected: + KConfig m_config; + QPushButton *m_autoSetup; + QCheckBox *m_useNmblookup; + QCheckBox *m_sendPings; + KRestrictedLine *m_pingAddresses; + KEditListBox *m_pingNames; + KRestrictedLine *m_allowedAddresses; + KRestrictedLine *m_broadcastNetwork; + QSpinBox *m_firstWait; + QCheckBox *m_secondScan; + QSpinBox *m_secondWait; + QSpinBox *m_updatePeriod; + QCheckBox *m_deliverUnnamedHosts; + QSpinBox *m_maxPingsAtOnce; + QPushButton* m_suggestSettings; + QPushButton *m_advancedSettingsButton; + KDialogBase *m_lisaAdvancedDlg; + + SetupWizard *m_wizard; + private: + QString m_tmpFilename; + QString m_configFilename; + bool m_changed; +}; + +#endif + diff --git a/lanbrowsing/kcmlisa/kcmreslisa.cpp b/lanbrowsing/kcmlisa/kcmreslisa.cpp new file mode 100644 index 00000000..c4f14d1a --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmreslisa.cpp @@ -0,0 +1,250 @@ +/* + * kcmreslisa.cpp + * + * Copyright (c) 2000-2002 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#include "kcmreslisa.h" +#include "findnic.h" + +#include <qspinbox.h> +#include <qcheckbox.h> +#include <qvbox.h> +#include <qpushbutton.h> +#include <qgrid.h> +#include <qlabel.h> +#include <qtooltip.h> +#include <qlayout.h> +#include <qvbuttongroup.h> + +#include <kdialogbase.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <krestrictedline.h> +#include <keditlistbox.h> + +ResLisaSettings::ResLisaSettings(const QString& config, QWidget *parent) +: KCModule(parent) +,m_config(config,false,true) +,m_kiolanConfig("kio_lanrc",false,true) +,m_advancedSettingsButton(0) +,m_suggestSettings(0) +,m_useNmblookup(0) +,m_pingNames(0) +,m_allowedAddresses(0) +,m_firstWait(0) +,m_secondScan(0) +,m_secondWait(0) +,m_updatePeriod(0) +,m_deliverUnnamedHosts(0) +,m_maxPingsAtOnce(0) +,m_reslisaAdvancedDlg(0) +{ + QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QVButtonGroup *gb=new QVButtonGroup(i18n("Tell ResLISa Daemon How to Search for Hosts"),this); + gb->setInsideSpacing(10); + + m_useNmblookup=new QCheckBox(i18n("Send &NetBIOS broadcasts using &nmblookup"),gb); + QToolTip::add(m_useNmblookup,i18n("Only hosts running SMB servers will answer")); + + m_pingNames=new KEditListBox(i18n("A&dditionally Check These Hosts"),gb,"a",false, KEditListBox::Add|KEditListBox::Remove); + QToolTip::add(m_pingNames,i18n("The hosts listed here will be pinged.")); + + QHBox *hbox=new QHBox(this); + hbox->setSpacing(10); + QLabel *label=new QLabel(i18n("&Trusted addresses:"),hbox); + QString comment = i18n("Usually your network address/subnet mask (e.g. 192.168.0.0/255.255.255.0;)"); + QToolTip::add(label, comment); + m_allowedAddresses=new KRestrictedLine(hbox,"a","0123456789./;"); + QToolTip::add(m_allowedAddresses,comment); + label->setBuddy(m_allowedAddresses); + + m_rlanSidebar = new QCheckBox(i18n("Use &rlan:/ instead of lan:/ in Konqueror's navigation panel"), this); + + hbox = new QHBox(this); + m_suggestSettings=new QPushButton(i18n("&Suggest Settings"),hbox); + + new QWidget(hbox); + + m_advancedSettingsButton=new QPushButton(i18n("Ad&vanced Settings"),hbox); + + + m_reslisaAdvancedDlg=new KDialogBase(0,0,true,i18n("Advanced Settings for ResLISa"),KDialogBase::Close, KDialogBase::Close); + connect(m_advancedSettingsButton,SIGNAL(clicked()),m_reslisaAdvancedDlg,SLOT(show())); + + QVBox *vbox=m_reslisaAdvancedDlg->makeVBoxMainWidget(); + + m_deliverUnnamedHosts=new QCheckBox(i18n("Show &hosts without DNS names"),vbox); + + QGrid *advGrid = new QGrid(2, Qt::Horizontal, vbox); + advGrid->setSpacing(10); + + label=new QLabel(i18n("Host list update interval:"),advGrid); + QToolTip::add(label,i18n("Search hosts after this number of seconds")); + m_updatePeriod=new QSpinBox(30,1800,10,advGrid); + m_updatePeriod->setSuffix(i18n(" sec")); + QToolTip::add(m_updatePeriod,i18n("Search hosts after this number of seconds")); + + m_secondScan=new QCheckBox(i18n("Always check twice for hosts when searching"),advGrid); + new QWidget(advGrid); + + label=new QLabel(i18n("Wait for replies from hosts after first scan:"),advGrid); + QToolTip::add(label,i18n("How long to wait for replies to the ICMP echo requests from hosts")); + m_firstWait=new QSpinBox(10,1000,50,advGrid); + m_firstWait->setSuffix(i18n(" ms")); + QToolTip::add(m_firstWait,i18n("How long to wait for replies to the ICMP echo requests from hosts")); + + label=new QLabel(i18n("Wait for replies from hosts after second scan:"),advGrid); + QToolTip::add(label,i18n("How long to wait for replies to the ICMP echo requests from hosts")); + m_secondWait=new QSpinBox(0,1000,50,advGrid); + m_secondWait->setSuffix(i18n(" ms")); + QToolTip::add(m_secondWait,i18n("How long to wait for replies to the ICMP echo requests from hosts")); + + label=new QLabel(i18n("Max. number of ping packets to send at once:"),advGrid); + m_maxPingsAtOnce=new QSpinBox(8,1024,5,advGrid); + + QWidget *dummy=new QWidget(advGrid); + dummy->setMinimumHeight(10); + + connect(m_secondScan,SIGNAL(toggled(bool)),m_secondWait,SLOT(setEnabled(bool))); + + connect(m_allowedAddresses,SIGNAL(textChanged(const QString&)),this,SIGNAL(changed())); + + connect(m_allowedAddresses,SIGNAL(returnPressed()),this,SIGNAL(changed())); + + connect(m_firstWait,SIGNAL(valueChanged(int)),this,SIGNAL(changed())); + connect(m_secondWait,SIGNAL(valueChanged(int)),this,SIGNAL(changed())); + connect(m_maxPingsAtOnce,SIGNAL(valueChanged(int)),this,SIGNAL(changed())); + connect(m_secondScan,SIGNAL(toggled(bool)),this,SIGNAL(changed())); + connect(m_deliverUnnamedHosts,SIGNAL(toggled(bool)),this,SIGNAL(changed())); + connect(m_updatePeriod,SIGNAL(valueChanged(int)),this,SIGNAL(changed())); + connect(m_pingNames,SIGNAL(changed()),this,SIGNAL(changed())); + connect(m_useNmblookup,SIGNAL(toggled(bool)),this,SIGNAL(changed())); + connect(m_suggestSettings,SIGNAL(clicked()),this,SLOT(suggestSettings())); + connect(m_rlanSidebar,SIGNAL(clicked()),this,SIGNAL(changed())); + + load(); +} + +void ResLisaSettings::load() +{ + int secondWait=m_config.readNumEntry("SecondWait",-1); + if (secondWait<0) + { + m_secondWait->setValue(300); + m_secondScan->setChecked(FALSE); + m_secondWait->setEnabled(FALSE); + } + else + { + m_secondWait->setValue(secondWait*10); + m_secondScan->setChecked(TRUE); + m_secondWait->setEnabled(TRUE); + }; + m_deliverUnnamedHosts->setChecked(m_config.readNumEntry("DeliverUnnamedHosts",0)); + + m_firstWait->setValue(m_config.readNumEntry("FirstWait",30)*10); + m_maxPingsAtOnce->setValue(m_config.readNumEntry("MaxPingsAtOnce",256)); + m_updatePeriod->setValue(m_config.readNumEntry("UpdatePeriod",300)); + m_allowedAddresses->setText(m_config.readEntry("AllowedAddresses","192.168.0.0/255.255.255.0")); + + int i=m_config.readNumEntry("SearchUsingNmblookup",1); + m_useNmblookup->setChecked(i!=0); + m_pingNames->clear(); + m_pingNames->insertStringList(m_config.readListEntry("PingNames",';')); + + m_rlanSidebar->setChecked(m_kiolanConfig.readEntry("sidebarURL", "lan:/") == "rlan:/" ? true : false ); +} + +void ResLisaSettings::save() +{ + if (m_secondScan->isChecked()) + m_config.writeEntry("SecondWait",(m_secondWait->value()+5)/10); + else + m_config.writeEntry("SecondWait",-1); + + if (m_useNmblookup->isChecked()) + m_config.writeEntry("SearchUsingNmblookup",1); + else + m_config.writeEntry("SearchUsingNmblookup",0); + + if (m_deliverUnnamedHosts->isChecked()) + m_config.writeEntry("DeliverUnnamedHosts",1); + else + m_config.writeEntry("DeliverUnnamedHosts",0); + + m_config.writeEntry("FirstWait",(m_firstWait->value()+5)/10); + m_config.writeEntry("MaxPingsAtOnce",m_maxPingsAtOnce->value()); + m_config.writeEntry("UpdatePeriod",m_updatePeriod->value()); + m_config.writeEntry("AllowedAddresses",m_allowedAddresses->text()); + //m_config.writeEntry("BroadcastNetwork",m_broadcastNetwork->text()); + QStringList writeStuff; + for (int i=0; i<m_pingNames->count(); i++) + writeStuff.append(m_pingNames->text(i)); + m_config.writeEntry("PingNames",writeStuff,';'); + + m_config.sync(); + + m_kiolanConfig.writeEntry("sidebarURL", m_rlanSidebar->isChecked() ? "rlan:/" : "lan:/"); + m_kiolanConfig.sync(); + +} + +void ResLisaSettings::suggestSettings() +{ + NICList* nics=findNICs(); + if (nics->count()==0) + { + //ok, easy one :-) + KMessageBox::sorry(0,i18n("It appears you do not have any network interfaces installed on your system.")); + delete nics; + return; + } + + MyNIC *nic=nics->first(); + QString address = nic->addr; + QString netmask = nic->netmask; + m_allowedAddresses->setText(address+"/"+netmask+";"); + m_secondWait->setValue(0); + m_secondScan->setChecked(FALSE); + m_secondWait->setEnabled(FALSE); + m_firstWait->setValue(300); + m_maxPingsAtOnce->setValue(256); + m_updatePeriod->setValue(300); + m_useNmblookup->setChecked(true); + if (nics->count()>1) + { + QString msg(i18n("You have more than one network interface installed.<br>" + "Please make sure the suggested settings are correct.<br>" + "<br>The following interfaces were found:<br><br>")); + //not that easy to handle + for (MyNIC* tmp=nics->first(); tmp!=0; tmp=nics->next()) + { + msg+="<b>"+tmp->name+": </b>"+tmp->addr+"/"+tmp->netmask+";<br>"; + } + KMessageBox::information(0,QString("<html>%1</html>").arg(msg)); + } + KMessageBox::information(0,QString("<html>%1</html>").arg(i18n("The ResLISa daemon is now configured " + "correctly, hopefully.<br>Make sure that the reslisa binary is installed <i>suid root</i>."))); + + emit changed(); + delete nics; +} + +#include "kcmreslisa.moc" + diff --git a/lanbrowsing/kcmlisa/kcmreslisa.desktop b/lanbrowsing/kcmlisa/kcmreslisa.desktop new file mode 100644 index 00000000..47d54652 --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmreslisa.desktop @@ -0,0 +1,123 @@ +[Desktop Entry] +Type=Application +Icon=samba +Exec=kcmshell kcmreslisa + +X-KDE-ModuleType=Library +X-KDE-Library=lanbrowser +X-KDE-FactoryName=reslisa + +Name=ResLISa +Name[hi]=रेस-लिसा +Name[sv]=ResLisa +Name[zh_TW]=ResLISaName=ResLISa + +Comment=Setup ResLISa +Comment[ar]=تنصيب ResLISa +Comment[be]=Настаўленне ResLISы +Comment[bg]=Настройване на ResLISa +Comment[bn]=ResLISa ব্যবস্থাপনা +Comment[br]=Kefluniañ ResLISa +Comment[bs]=Podešavanje ResLISe +Comment[ca]=Per l'arranjament de ResLISa +Comment[cs]=Nastavit ResLISa +Comment[cy]=Gosod ResLISa +Comment[da]=Opsætning af ResLISa +Comment[de]=ResLISa einrichten +Comment[el]=Ρύθμιση ResLISa +Comment[eo]=Agordo de ResLISa +Comment[es]=Configuración ResLISa +Comment[et]=ResLISa seadistamine +Comment[eu]=ResLISa konfiguratu +Comment[fa]=برپایی ResLISa +Comment[fi]=Aseta ResLISa +Comment[fr]=Configuration de ResLISa +Comment[ga]=Cumraigh ResLISa +Comment[gl]=Configuración de ResLISa +Comment[he]=שינוי הגדרות ResLISa +Comment[hi]=सेटअप रेस-लिसा +Comment[hr]=Podešavanje ResLISa-e +Comment[hu]=A ResLISa szolgáltatás beállítása +Comment[is]=Stillingar ResLISa +Comment[it]=Impostazioni ResLISa +Comment[ja]=ResLISa のセットアップ +Comment[ka]=ResLISa გამართვა +Comment[kk]=ResLISa баптауы +Comment[km]=រៀបចំ ResLISa +Comment[lt]=Nustatyti ResLISa +Comment[mk]=Поставување на ResLISa +Comment[mn]=ResLISa тохируулга +Comment[ms]=Pasang ResLISa +Comment[nb]=Tilpass ResLISa +Comment[nds]=ResLISa instellen +Comment[ne]=ResLIsa सेटअप गर्नुहोस् +Comment[nl]=ResLISa instellen +Comment[nn]=ResLISa-oppsett +Comment[nso]=Beakanya ResLISa +Comment[pl]=Ustawienia programu ResLISa +Comment[pt]=Configuração do ResLISa +Comment[pt_BR]=Configuração de ResLISa +Comment[ru]=Параметры ResLISa +Comment[se]=Heivet ResLISa +Comment[sk]=Nastavenie ResLISy +Comment[sl]=Nastavi ResLISa +Comment[sr]=Подесите ResLISa-у +Comment[sr@Latn]=Podesite ResLISa-u +Comment[sv]=Anpassa ResLisa +Comment[ta]=ResLISa அமைப்பு +Comment[tg]=Барпосозии ResLISa +Comment[th]=ตั้งค่า ResLISa +Comment[tr]=ResLISa'yı yapılandır +Comment[uk]=Налаштування ResLISa +Comment[uz]=ResLISa'ni oʻrnatish +Comment[uz@cyrillic]=ResLISa'ни ўрнатиш +Comment[ven]=Vhekanyani ResLISa +Comment[wa]=Apontiaedje di ResLISa +Comment[xh]=Cwangcisa ResLISa +Comment[zh_CN]=设置 ResLISa +Comment[zh_HK]=設定 ResLISa +Comment[zh_TW]=設定 ResLISa +Comment[zu]=Lungisa i-ResLISa + + +Keywords=reslisa,network,smb,ftp,fish,http +Keywords[be]=сетка,reslisa,network,smb,ftp,fish,http +Keywords[bg]=мрежа, самба, настройки, локална, споделяне, reslisa, network, smb, ftp, fish, http +Keywords[br]=reslisa,rouedad,smb,ftp,fish,http +Keywords[ca]=reslisa,xarxa,smb,ftp,fish,http +Keywords[cs]=reslisa,síť,smb,ftp,fish,http +Keywords[cy]=reslisa,rhwydwaith,smb,ftp,fish,http +Keywords[da]=reslisa,netværk,smb,ftp,fish,http +Keywords[de]=reslisa,Netzwerk,smb,ftp,fish,http +Keywords[el]=reslisa,δίκτυο,smb,ftp,fish,http +Keywords[et]=reslisa,võrk,smb,ftp,fish,http +Keywords[eu]=reslisa,sarea,smb,ftp,fish,http +Keywords[fa]=reslisa، شبکه، smb، قاپ، fish، قام +Keywords[fi]=reslisa,verkko,smb,ftp,fish,http +Keywords[fr]=reslisa,réseau,smb,ftp,fish,http +Keywords[gl]=reslisa,redes,smb,ftp,fish,http +Keywords[he]=reslisa,רשת,smb,ftp,fish,http +Keywords[hi]=रेसलिसा,नेटवर्क,एसएमबी,एफटीपी,फिश,एचटीटीपी +Keywords[hu]=reslisa,hálózat,smb,ftp,fish,http +Keywords[it]=reslisa,rete,smb,ftp,fish,http +Keywords[ja]=reslisa,ネットワーク,smb,ftp,fish,http +Keywords[km]=reslisa,បណ្ដាញ,smb,ftp,fish,http +Keywords[lt]=reslisa,network,smb,ftp,fish,http,tinklas +Keywords[mk]=reslisa,network,smb,ftp,fish,http,мрежа +Keywords[nb]=reslisa,nettverk,smb,ftp,fish,http +Keywords[nds]=reslisa,nettwark,smb,ftp,fish,http +Keywords[ne]=रेसलिसा,सञ्जाल,smb,ftp,fish,http +Keywords[nl]=reslisa,netwerk,smb,ftp,fish,http,samba +Keywords[nn]=reslisa,nettverk,smb,ftp,fish,http +Keywords[pl]=reslisa,sieć,smb,ftp,fish,http +Keywords[pt]=reslisa,rede,smb,ftp,fish,http +Keywords[pt_BR]=reslisa,rede,smb,ftp,fish,http +Keywords[ru]=reslisa,сеть,smb,ftp,fish,http +Keywords[sk]=reslisa,sieť,smb,ftp,fish,http +Keywords[sl]=reslisa,omrežje,smb,ftp,fish,http +Keywords[sv]=reslisa,nätverk,smb,ftp,fish,http +Keywords[tr]=reslisa,ağ,smb,ftp,fish,http +Keywords[uk]=reslisa,мережа,smb,ftp,fish,http +Keywords[uz]=reslisa,tarmoq,smb,ftp,fish,http +Keywords[uz@cyrillic]=reslisa,тармоқ,smb,ftp,fish,http +Keywords[zh_CN]=reslisa,network,smb,ftp,fish,http,网络 diff --git a/lanbrowsing/kcmlisa/kcmreslisa.h b/lanbrowsing/kcmlisa/kcmreslisa.h new file mode 100644 index 00000000..ee8734df --- /dev/null +++ b/lanbrowsing/kcmlisa/kcmreslisa.h @@ -0,0 +1,67 @@ +/* + * kcmreslisa.h + * + * Copyright (c) 2000-2002 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef KCMRESLISA_H +#define KCMRESLISA_H + +#include <kcmodule.h> +#include <kconfig.h> + + +class QSpinBox; +class QCheckBox; +class QPushButton; +class KEditListBox; +class KDialogBase; +class KRestrictedLine; + +class ResLisaSettings:public KCModule +{ + Q_OBJECT + public: + ResLisaSettings(const QString& config, QWidget *parent=0); + virtual ~ResLisaSettings() {} + void load(); + void save(); + signals: + void changed(); + protected slots: + void suggestSettings(); + protected: + KConfig m_config; + KConfig m_kiolanConfig; + QPushButton* m_advancedSettingsButton; + QPushButton* m_suggestSettings; + QCheckBox* m_useNmblookup; + KEditListBox *m_pingNames; + + KRestrictedLine *m_allowedAddresses; + QSpinBox *m_firstWait; + QCheckBox *m_secondScan; + QSpinBox *m_secondWait; + QSpinBox *m_updatePeriod; + QCheckBox *m_deliverUnnamedHosts; + QSpinBox *m_maxPingsAtOnce; + QCheckBox* m_rlanSidebar; + KDialogBase* m_reslisaAdvancedDlg; +}; + +#endif + diff --git a/lanbrowsing/kcmlisa/main.cpp b/lanbrowsing/kcmlisa/main.cpp new file mode 100644 index 00000000..c9d9b6b2 --- /dev/null +++ b/lanbrowsing/kcmlisa/main.cpp @@ -0,0 +1,49 @@ +/* + * main.cpp for lisa,reslisa,kio_lan and kio_rlan kcm module + * + * Copyright (C) 2000,2001,2005 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <klocale.h> +#include <kdebug.h> + +#include <qdir.h> +#include <qdatetime.h> + +#include <unistd.h> +#include <sys/types.h> + +#include "kcmlisa.h" +#include "kcmreslisa.h" +#include "kcmkiolan.h" + +extern "C" +{ + KDE_EXPORT KCModule *create_lisa(QWidget *parent, const char *) + { + return new LisaSettings("/etc/lisarc", parent); + } + KDE_EXPORT KCModule *create_reslisa(QWidget *parent, const char *) + { + return new ResLisaSettings(QDir::homeDirPath()+"/.reslisarc", parent); + } + KDE_EXPORT KCModule *create_kiolan(QWidget *parent, const char *) + { + return new IOSlaveSettings("kio_lanrc", parent); + } +} + diff --git a/lanbrowsing/kcmlisa/portsettingsbar.cpp b/lanbrowsing/kcmlisa/portsettingsbar.cpp new file mode 100644 index 00000000..a6bc94d9 --- /dev/null +++ b/lanbrowsing/kcmlisa/portsettingsbar.cpp @@ -0,0 +1,51 @@ +/* + * portsettingsbar.cpp + * + * Copyright (c) 2000, 2005 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "portsettingsbar.h" +#include <klocale.h> + +#include <qlabel.h> + +PortSettingsBar::PortSettingsBar(const QString& title, QWidget *parent) +:QHBox(parent) +{ + QLabel* label=new QLabel(title, this); + m_box=new QComboBox(this); + label->setBuddy(m_box); + + m_box->insertItem(i18n("Check Availability")); + m_box->insertItem(i18n("Always")); + m_box->insertItem(i18n("Never")); + + connect(m_box,SIGNAL(activated(int)),this,SIGNAL(changed())); +} + +int PortSettingsBar::selected() const +{ + return m_box->currentItem(); +} + +void PortSettingsBar::setChecked(int what) +{ + m_box->setCurrentItem(what); +} + +#include "portsettingsbar.moc" + diff --git a/lanbrowsing/kcmlisa/portsettingsbar.h b/lanbrowsing/kcmlisa/portsettingsbar.h new file mode 100644 index 00000000..9cc92e02 --- /dev/null +++ b/lanbrowsing/kcmlisa/portsettingsbar.h @@ -0,0 +1,45 @@ +/* + * portsettingsbar.h + * + * Copyright (c) 2000, 2005 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef PORTSETTINGSBAR_H +#define PORTSETTINGSBAR_H + +#include <qhbox.h> +#include <qcombobox.h> + +#define PORTSETTINGS_CHECK 0 +#define PORTSETTINGS_PROVIDE 1 +#define PORTSETTINGS_DISABLE 2 + +class PortSettingsBar:public QHBox +{ + Q_OBJECT + public: + PortSettingsBar(const QString& title, QWidget *parent=0); + virtual ~PortSettingsBar() {}; + int selected() const; + void setChecked(int what); + signals: + void changed(); + protected: + QComboBox *m_box; +}; + +#endif diff --git a/lanbrowsing/kcmlisa/setupwizard.cpp b/lanbrowsing/kcmlisa/setupwizard.cpp new file mode 100644 index 00000000..7ff91f8f --- /dev/null +++ b/lanbrowsing/kcmlisa/setupwizard.cpp @@ -0,0 +1,569 @@ +/* + * setupwizard.cpp + * + * Copyright (C) 2001 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "setupwizard.h" + +#include <qregexp.h> + +#include <klocale.h> +#include <kdialog.h> +#include <ksockaddr.h> +#include <kdebug.h> + +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +SetupWizard::SetupWizard(QWidget* parent, LisaConfigInfo* configInfo) + :QWizard(parent,"hallo",true) + ,m_page1(0) + ,m_noNicPage(0) + ,m_multiNicPage(0) + ,m_searchPage(0) + ,m_addressesPage(0) + ,m_allowedAddressesPage(0) + ,m_bcastPage(0) + ,m_intervalPage(0) + ,m_advancedPage(0) + ,m_finalPage(0) + ,m_nicListBox(0) + ,m_trustedHostsLabel(0) + ,m_ping(0) + ,m_nmblookup(0) + ,m_pingAddresses(0) + ,m_allowedAddresses(0) + ,m_bcastAddress(0) + ,m_manualAddress(0) + ,m_updatePeriod(0) + ,m_deliverUnnamedHosts(0) + ,m_firstWait(0) + ,m_maxPingsAtOnce(0) + ,m_secondScan(0) + ,m_secondWait(0) + ,m_nics(0) + ,m_configInfo(configInfo) +{ + QString title( i18n("LISa Network Neighborhood Setup") ); + setCaption(title); + + m_configInfo->clear(); + setupPage1(); + addPage( m_page1, title); + + setupAdvancedSettingsPage(); + addPage( m_advancedPage, i18n("Advanced Settings")); + +} + +SetupWizard::~SetupWizard() +{} + +void SetupWizard::clearAll() +{ + showPage(m_page1); + if (m_nicListBox) + m_nicListBox->clear(); + + if (m_manualAddress) + m_manualAddress->setText(""); + + if (m_ping) + m_ping->setChecked(false); + if (m_nmblookup) + m_nmblookup->setChecked(false); + + if (m_pingAddresses) + m_pingAddresses->setText(""); + if (m_allowedAddresses) + m_allowedAddresses->setText(""); + if (m_bcastAddress) + m_bcastAddress->setText(""); + if (m_updatePeriod) + m_updatePeriod->setValue(300); + + if (m_deliverUnnamedHosts) + m_deliverUnnamedHosts->setChecked(false); + if (m_firstWait) + m_firstWait->setValue(10); + if (m_maxPingsAtOnce) + m_maxPingsAtOnce->setValue(256); + if (m_secondScan) + m_secondScan->setChecked(false); + if (m_secondWait) + { + m_secondWait->setEnabled(false); + m_secondWait->setValue(0); + } + + if (m_nics) + { + delete m_nics; + m_nics=0; + } +} + +void SetupWizard::setupPage1() +{ + m_page1 = new QVBox( this ); + + new QLabel(i18n("<qt><p>This wizard will ask you a few questions about your network.</p> " + "<p>Usually you can simply keep the suggested settings.</p> " + "<p>After you have finished the wizard, you will be able to browse and use " + "shared resources on your LAN, not only Samba/Windows shares, but also " + "FTP, HTTP and NFS resources exactly the same way.</p> " + "<p>Therefore you need to setup the <i>LAN Information Server</i> (LISa) on your machine. " + "Think of the LISa server as an FTP or HTTP server; " + "it has to be run by root, it should be started during the boot process and " + "only one LISa server can run on one machine.</qt>"), + m_page1); + + QWidget *dummy=new QWidget(m_page1); + m_page1->setStretchFactor(dummy,10); + m_page1->setSpacing(KDialog::spacingHint()); + m_page1->setMargin(KDialog::marginHint()); + + setNextEnabled( m_page1, true ); + setHelpEnabled( m_page1, false ); +} + +void SetupWizard::setupMultiNicPage() +{ + m_multiNicPage=new QVBox(this); + new QLabel(i18n("<qt><p>More than one network interface card was found on your system.</p>" + "<p>Please choose the one to which your LAN is connected.</p></qt>"), + m_multiNicPage); + + m_multiNicPage->setMargin(KDialog::marginHint()); + m_multiNicPage->setSpacing(KDialog::spacingHint()); + + m_nicListBox=new QListBox(m_multiNicPage); + m_nicListBox->setSelectionMode(QListBox::Single); + setHelpEnabled( m_multiNicPage, false ); +} + +void SetupWizard::setupNoNicPage() +{ + m_noNicPage=new QVBox(this); + new QLabel(i18n("<qt><p><b>No network interface card was found on your system.</b></p>" + "<p>Possible reason: no network card is installed. You probably want to cancel now " + "or enter your IP address and network manually</p>" + "Example: <code>192.168.0.1/255.255.255.0</code>.</qt>"), + m_noNicPage); + + m_noNicPage->setMargin(KDialog::marginHint()); + m_noNicPage->setSpacing(KDialog::spacingHint()); + m_manualAddress=new KRestrictedLine(m_noNicPage,"0123456789./"); + connect(m_manualAddress,SIGNAL(textChanged(const QString&)),this,SLOT(checkIPAddress(const QString&))); + QWidget *dummy=new QWidget(m_noNicPage); + m_noNicPage->setStretchFactor(dummy,10); + + setNextEnabled(m_noNicPage, false); + setHelpEnabled(m_noNicPage, false); +} + + +void SetupWizard::setupSearchPage() +{ + m_searchPage=new QVBox(this); + QLabel *info=new QLabel(i18n("There are two ways LISa can search hosts on your network."),m_searchPage); + info->setTextFormat(Qt::RichText); + m_ping=new QCheckBox(i18n("Send pings"), m_searchPage); + info=new QLabel(i18n("All hosts with TCP/IP will respond,<br>" + "whether or not they are samba servers.<br>" + "Don\'t use it if your network is very large, i.e. more than 1000 hosts.<br>"),m_searchPage); + m_nmblookup=new QCheckBox(i18n("Send NetBIOS broadcasts"),m_searchPage); + info=new QLabel(i18n("You need to have the samba package (nmblookup) installed.<br>" + "Only samba/windows servers will respond.<br>" + "This method is not very reliable.<br>" + "You should enable it if you are part of a large network."),m_searchPage); + info->setTextFormat(Qt::RichText); + QWidget *dummy=new QWidget(m_searchPage); + m_searchPage->setStretchFactor(dummy,10); + m_searchPage->setSpacing(KDialog::spacingHint()); + m_searchPage->setMargin(KDialog::marginHint()); + info=new QLabel(i18n("<b>If unsure, keep it as is.</b>"),m_searchPage); + info->setAlignment(AlignRight|AlignVCenter); + + setHelpEnabled( m_searchPage, false ); +} + +void SetupWizard::setupAddressesPage() +{ + m_addressesPage=new QVBox(this); + QLabel *info=new QLabel(i18n("All IP addresses included in the specified range will be pinged.<br>" + "If you are part of a small network, e.g. with network mask 255.255.255.0<br>" + "use your IP address/network mask.<br>"),m_addressesPage); + info->setTextFormat(Qt::RichText); + m_pingAddresses=new KRestrictedLine(m_addressesPage,"0123456789./;-"); + info=new QLabel(i18n("<br>There are four ways to specify address ranges:<br>" + "1. IP address/network mask, like <code>192.168.0.0/255.255.255.0;</code><br>" + "2. single IP addresses, like <code>10.0.0.23;</code><br>" + "3. continuous ranges, like <code>10.0.1.0-10.0.1.200;</code><br>" + "4. ranges for each part of the address, like <code>10-10.1-5.1-25.1-3;</code><br>" + "You can also enter combinations of 1 to 4, separated by \";\", like<br>" + "<code>192.168.0.0/255.255.255.0;10.0.0.0;10.0.1.1-10.0.1.100;</code><br>"),m_addressesPage); + info->setAlignment(AlignLeft|AlignVCenter|WordBreak); + QWidget *dummy=new QWidget(m_addressesPage); + m_addressesPage->setStretchFactor(dummy,10); + m_addressesPage->setSpacing(KDialog::spacingHint()); + m_addressesPage->setMargin(KDialog::marginHint()); + info=new QLabel(i18n("<b>If unsure, keep it as is.</b>"), m_addressesPage); + info->setAlignment(AlignRight|AlignVCenter); + + setHelpEnabled( m_addressesPage, false ); +} + +void SetupWizard::setupAllowedPage() +{ + m_allowedAddressesPage=new QVBox(this); + QLabel* info=new QLabel(i18n("This is a security related setting.<br>" + "It provides a simple IP address based way to specify \"trusted\" hosts.<br>" + "Only hosts which fit into the addresses given here are accepted by LISa as clients. " + "The list of hosts published by LISa will also only contain hosts which fit into this scheme.<br>" + "Usually you enter your IP address/network mask here."),m_allowedAddressesPage); + info->setAlignment(AlignLeft|AlignVCenter|WordBreak); + m_allowedAddresses=new KRestrictedLine(m_allowedAddressesPage,"0123456789./-;"); + m_trustedHostsLabel=new QLabel(m_allowedAddressesPage); + + QWidget *dummy=new QWidget(m_allowedAddressesPage); + m_allowedAddressesPage->setStretchFactor(dummy,10); + m_allowedAddressesPage->setSpacing(KDialog::spacingHint()); + m_allowedAddressesPage->setMargin(KDialog::marginHint()); + info=new QLabel(i18n("<b>If unsure, keep it as is.</b>"), m_allowedAddressesPage); + info->setAlignment(AlignRight|AlignVCenter); + + setHelpEnabled( m_allowedAddressesPage, false ); +} + +void SetupWizard::setupBcastPage() +{ + m_bcastPage=new QVBox(this); + QLabel *info=new QLabel(i18n("<br>Enter your IP address and network mask here, like <code>192.168.0.1/255.255.255.0</code>"),m_bcastPage); + info->setAlignment(AlignLeft|AlignVCenter|WordBreak); + m_bcastAddress=new KRestrictedLine(m_bcastPage,"0123456789./"); + info=new QLabel(i18n("<br>To reduce the network load, the LISa servers in one network<br>" + "cooperate with each other. Therefore you have to enter the broadcast<br>" + "address here. If you are connected to more than one network, choose <br>" + "one of the broadcast addresses."),m_bcastPage); + info->setAlignment(AlignLeft|AlignVCenter|WordBreak); + QWidget *dummy=new QWidget(m_bcastPage); + m_bcastPage->setStretchFactor(dummy,10); + m_bcastPage->setSpacing(KDialog::spacingHint()); + info=new QLabel(i18n("<b>If unsure, keep it as is.</b>"), m_bcastPage); + info->setAlignment(AlignRight|AlignVCenter); + + m_bcastPage->setSpacing(KDialog::spacingHint()); + m_bcastPage->setMargin(KDialog::marginHint()); + setHelpEnabled( m_bcastPage, false ); +} + +void SetupWizard::setupUpdateIntervalPage() +{ + m_intervalPage=new QVBox(this); + QLabel *info=new QLabel(i18n("<br>Enter the interval after which LISa, if busy, will update its host list."),m_intervalPage); + info->setTextFormat(Qt::RichText); + + m_updatePeriod=new QSpinBox(300,1800,10,m_intervalPage); + m_updatePeriod->setSuffix(i18n(" sec")); + + info=new QLabel(i18n("<br>Please note that the update interval will grow automatically by " + "up to 16 times the value you enter here, if nobody accesses the LISa server. " + "So if you enter 300 sec = 5 min here, this does not mean that LISa will ping " + "your whole network every 5 minutes. The interval will increase up to 16 x 5 min = 80 min."),m_intervalPage); + info->setAlignment(AlignLeft|AlignVCenter|WordBreak); + QWidget *dummy=new QWidget(m_intervalPage); + m_intervalPage->setStretchFactor(dummy,10); + m_intervalPage->setSpacing(KDialog::spacingHint()); + m_intervalPage->setMargin(KDialog::marginHint()); + info=new QLabel(i18n("<b>If unsure, keep it as is.</b>"), m_intervalPage); + info->setAlignment(AlignRight|AlignVCenter); + info->setTextFormat(Qt::RichText); + + setHelpEnabled( m_intervalPage, false ); +} + +void SetupWizard::setupAdvancedSettingsPage() +{ + m_advancedPage=new QVBox(this); + QLabel *info=new QLabel(i18n("This page contains several settings you usually only<br>" + "need if LISa doesn't find all hosts in your network."),m_advancedPage); + info->setTextFormat(Qt::RichText); + m_deliverUnnamedHosts=new QCheckBox(i18n("Re&port unnamed hosts"),m_advancedPage); + info=new QLabel(i18n("Should hosts for which LISa can\'t resolve the name be included in the host list?<br>"),m_advancedPage); + + QHBox* hbox=new QHBox(m_advancedPage); + + info=new QLabel(i18n("Wait for replies after first scan"),hbox); + m_firstWait=new QSpinBox(10,1000,50,hbox); + m_firstWait->setSuffix(i18n(" ms")); + info=new QLabel(i18n("How long should LISa wait for answers to pings?<br>" + "If LISa doesn\'t find all hosts, try to increase this value.<br>"),m_advancedPage); + + hbox=new QHBox(m_advancedPage); + info=new QLabel(i18n("Max. number of pings to send at once"),hbox); + info->setTextFormat(Qt::RichText); + m_maxPingsAtOnce=new QSpinBox(8,1024,5,hbox); + info=new QLabel(i18n("How many ping packets should LISa send at once?<br>" + "If LISa doesn't find all hosts you could try to decrease this value.<br>"),m_advancedPage); + + m_secondScan=new QCheckBox(i18n("Al&ways scan twice"),m_advancedPage); + + hbox=new QHBox(m_advancedPage); +// hbox->setSpacing(10); // WTF? + info=new QLabel(i18n("Wait for replies after second scan"),hbox); + info->setTextFormat(Qt::RichText); + m_secondWait=new QSpinBox(0,1000,50,hbox); + m_secondWait->setSuffix(i18n(" ms")); + info=new QLabel(i18n("If LISa doesn't find all hosts, enable this option."),m_advancedPage); + + //this would make the dialog to large + //m_advancedPage->setSpacing(KDialog::spacingHint()); + //m_advancedPage->setMargin(KDialog::marginHint()); + + info=new QLabel(i18n("<b>If unsure, keep it as is.</b>"), m_advancedPage); + info->setAlignment(AlignRight|AlignVCenter); + + connect(m_secondScan,SIGNAL(toggled(bool)),m_secondWait,SLOT(setEnabled(bool))); + setHelpEnabled( m_advancedPage, false ); +} + +void SetupWizard::setupFinalPage() +{ + m_finalPage=new QVBox(this); + QLabel *info=new QLabel(i18n("<br>Your LAN browsing has been successfully set up.<br><br>" + "Make sure that the LISa server is started during the " + "boot process. How this is done depends on your " + "distribution and OS. Usually you have to insert it somewhere " + "in a boot script under <code>/etc</code>.<br>" + "Start the LISa server as root and without any command line options.<br>" + "The config file will now be saved to <code>/etc/lisarc</code>.<br>" + "To test the server, try <code>lan:/</code> in Konqueror.<br><br>" + "If you have problems or suggestions, visit http://lisa-home.sourceforge.net."),m_finalPage); + info->setTextFormat(Qt::RichText); + QWidget *dummy=new QWidget(m_finalPage); + m_finalPage->setStretchFactor(dummy,10); + m_finalPage->setSpacing(KDialog::spacingHint()); + m_finalPage->setMargin(KDialog::marginHint()); + + setHelpEnabled( m_finalPage, false ); +} + +void SetupWizard::next() +{ + if (currentPage()==m_page1) + { + if (m_noNicPage==0) + setupRest(); + + setAppropriate(m_noNicPage,false); + setAppropriate(m_multiNicPage,false); + if (m_nics!=0) + delete m_nics; + m_nics=findNICs(); + + if (m_nics->count()==0) + { + setAppropriate(m_noNicPage,true); + } + else if (m_nics->count()==1) + { + //still easy + //if the host part is less than 20 bits simply take it + MyNIC *nic=m_nics->first(); + LisaConfigInfo lci; + suggestSettingsForNic(nic,lci); + applyLisaConfigInfo(lci); + } + else + { + //more than one nic + setAppropriate(m_multiNicPage,true); + m_nicListBox->clear(); + for (MyNIC *nic=m_nics->first(); nic!=0; nic=m_nics->next()) + { + QString tmp=nic->name+": "+nic->addr+"/"+nic->netmask+";"; + m_nicListBox->insertItem(tmp); + } + m_nicListBox->setSelected(0,true); + } + } + else if (currentPage()==m_multiNicPage) + { + QString nic=m_nicListBox->currentText(); + unsigned int i=0; + for (i=0; i<m_nicListBox->count(); i++) + { + if (m_nicListBox->isSelected(i)) + { + nic=m_nicListBox->text(i); + break; + } + } + MyNIC* thisNic=m_nics->at(i); + LisaConfigInfo lci; + suggestSettingsForNic(thisNic,lci); + applyLisaConfigInfo(lci); + } + else if (currentPage()==m_noNicPage) + { + LisaConfigInfo lci; + suggestSettingsForAddress(m_manualAddress->text(),lci); + applyLisaConfigInfo(lci); + } + else if (currentPage()==m_searchPage) + setAppropriate(m_addressesPage, m_ping->isChecked()); + else if (currentPage()==m_intervalPage) + { + if (m_finalPage==0) + { + setupFinalPage(); + addPage( m_finalPage, i18n("Congratulations!")); + } + setAppropriate(m_advancedPage, m_ping->isChecked()); + } + QWizard::next(); +} + +void SetupWizard::showPage(QWidget* page) +{ + if (page==m_noNicPage) + { + m_manualAddress->setFocus(); + setNextEnabled(m_noNicPage, false); + setHelpEnabled(m_noNicPage, false); + } + else if (page==m_multiNicPage) + m_nicListBox->setFocus(); + else if ( page == m_searchPage) + m_ping->setFocus(); + else if (page==m_addressesPage) + m_pingAddresses->setFocus(); + else if (page==m_allowedAddressesPage) + { + QString text; + if (m_ping->isChecked()) + text+=i18n("You can use the same syntax as on the previous page.<br>"); + else + text+=i18n("There are three ways to specify IP addresses:<br>" + "1. IP address/network mask, like<code> 192.168.0.0/255.255.255.0;</code><br>" + "2. continuous ranges, like<code> 10.0.1.0-10.0.1.200;</code><br>" + "3. single IP addresses, like<code> 10.0.0.23;</code><br>" + "You can also enter combinations of 1 to 3, separated by \";\", <br>" + "like<code> 192.168.0.0/255.255.255.0;10.0.0.0;10.0.1.1-10.0.1.100;</code><br>"); + m_trustedHostsLabel->setText(text); + m_allowedAddresses->setFocus(); + } + else if (page==m_bcastPage) + m_bcastAddress->setFocus(); + else if (page==m_intervalPage) + m_updatePeriod->setFocus(); + else if (page==m_advancedPage) + m_deliverUnnamedHosts->setFocus(); + else if (page==m_finalPage) + setFinishEnabled(m_finalPage,true); + + QWizard::showPage(page); +} + +void SetupWizard::setupRest() +{ + removePage(m_advancedPage); + + setupMultiNicPage(); + addPage( m_multiNicPage, i18n("Multiple Network Interfaces Found")); + + setupNoNicPage(); + addPage( m_noNicPage, i18n("No Network Interface Found")); + setNextEnabled(m_noNicPage, false); + setHelpEnabled(m_noNicPage, false); + + setupSearchPage(); + addPage( m_searchPage, i18n("Specify Search Method")); + + setupAddressesPage(); + addPage( m_addressesPage, i18n("Specify Address Range LISa Will Ping")); + + setupAllowedPage(); + addPage( m_allowedAddressesPage, i18n("\"Trusted\" Hosts")); + + setupBcastPage(); + addPage( m_bcastPage, i18n("Your Broadcast Address")); + + setupUpdateIntervalPage(); + addPage( m_intervalPage, i18n("LISa Update Interval")); + + addPage( m_advancedPage, i18n("Advanced Settings")); +} + +void SetupWizard::accept() +{ + if (m_ping->isChecked()) + { + m_configInfo->pingAddresses=m_pingAddresses->text(); + m_configInfo->secondScan=m_secondScan->isChecked(); + if (m_configInfo->secondScan) + m_configInfo->secondWait=(m_secondWait->value()+5)/10; + else + m_configInfo->secondWait=0; + m_configInfo->firstWait=(m_firstWait->value()+5)/10; + } + else + { + m_configInfo->pingAddresses=""; + m_configInfo->secondScan=false; + m_configInfo->secondWait=0; + m_configInfo->firstWait=30; + } + + m_configInfo->broadcastNetwork=m_bcastAddress->text(); + m_configInfo->allowedAddresses=m_allowedAddresses->text(); + m_configInfo->maxPingsAtOnce=m_maxPingsAtOnce->value(); + m_configInfo->updatePeriod=m_updatePeriod->value(); + m_configInfo->useNmblookup=m_nmblookup->isChecked(); + m_configInfo->unnamedHosts=m_deliverUnnamedHosts->isChecked(); + QWizard::accept(); +} + +void SetupWizard::checkIPAddress(const QString& addr) +{ + QString address=addr.simplifyWhiteSpace(); + QRegExp regex("^\\d+\\.\\d+\\.\\d+\\.\\d+\\s*/\\s*\\d+\\.\\d+\\.\\d+\\.\\d+$"); + setNextEnabled(m_noNicPage, (regex.search(address,0)!=-1)); +// setNextEnabled(m_noNicPage, (regex.find(address,0)!=-1)); +} + +void SetupWizard::applyLisaConfigInfo(LisaConfigInfo& lci) +{ + m_ping->setChecked(!lci.pingAddresses.isEmpty()); + m_pingAddresses->setText(lci.pingAddresses); + m_nmblookup->setChecked(lci.useNmblookup); + m_allowedAddresses->setText(lci.allowedAddresses); + m_bcastAddress->setText(lci.broadcastNetwork); + m_updatePeriod->setValue(lci.updatePeriod); + m_deliverUnnamedHosts->setChecked(lci.unnamedHosts); + m_firstWait->setValue(lci.firstWait*10); + m_maxPingsAtOnce->setValue(lci.maxPingsAtOnce); + m_secondWait->setValue(lci.secondWait*10); + m_secondScan->setChecked(lci.secondScan); + m_secondWait->setEnabled(lci.secondScan); +} + +#include "setupwizard.moc" + diff --git a/lanbrowsing/kcmlisa/setupwizard.h b/lanbrowsing/kcmlisa/setupwizard.h new file mode 100644 index 00000000..a64cfaa2 --- /dev/null +++ b/lanbrowsing/kcmlisa/setupwizard.h @@ -0,0 +1,103 @@ +/* + * main.cpp for lisa,reslisa,kio_lan and kio_rlan kcm module + * + * Copyright (C) 2000 Alexander Neundorf <neundorf@kde.org> + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef LISA_SETUPWIZARD_H +#define LISA_SETUPWIZARD_H + +#include "kcmlisa.h" +#include "kcmreslisa.h" +#include "kcmkiolan.h" + +#include "findnic.h" + +#include <qspinbox.h> +#include <qcheckbox.h> +#include <krestrictedline.h> +#include <qwizard.h> +#include <kglobal.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qlistbox.h> +#include <qvbox.h> + +#include <kcmodule.h> + + +class SetupWizard:public QWizard +{ + Q_OBJECT + public: + SetupWizard(QWidget* parent, LisaConfigInfo* configInfo); + ~SetupWizard(); + virtual void showPage(QWidget* page); + void clearAll(); + protected slots: + virtual void next(); + virtual void accept(); + void checkIPAddress(const QString& address); + protected: + void applyLisaConfigInfo(LisaConfigInfo& lci); + + void setupPage1(); + void setupNoNicPage(); + void setupMultiNicPage(); + void setupSearchPage(); + void setupAddressesPage(); + void setupAllowedPage(); + void setupBcastPage(); + void setupUpdateIntervalPage(); + void setupAdvancedSettingsPage(); + void setupFinalPage(); + void setupRest(); + + QVBox* m_page1; + QVBox* m_noNicPage; + QVBox* m_multiNicPage; + QVBox* m_searchPage; + QVBox* m_addressesPage; + QVBox* m_allowedAddressesPage; + QVBox* m_bcastPage; + QVBox* m_intervalPage; + QVBox* m_advancedPage; + QVBox* m_finalPage; + + + QListBox *m_nicListBox; + QLabel *m_trustedHostsLabel; + QCheckBox *m_ping; + QCheckBox *m_nmblookup; + KRestrictedLine* m_pingAddresses; + KRestrictedLine* m_allowedAddresses; + KRestrictedLine* m_bcastAddress; + KRestrictedLine* m_manualAddress; + QSpinBox* m_updatePeriod; + QCheckBox* m_deliverUnnamedHosts; + QSpinBox* m_firstWait; + QSpinBox* m_maxPingsAtOnce; + QCheckBox* m_secondScan; + QSpinBox* m_secondWait; + + NICList* m_nics; + LisaConfigInfo* m_configInfo; +}; + + +#endif + |