diff options
Diffstat (limited to 'knetworkconf/knetworkconf')
50 files changed, 8044 insertions, 0 deletions
diff --git a/knetworkconf/knetworkconf/Makefile.am b/knetworkconf/knetworkconf/Makefile.am new file mode 100644 index 0000000..f72b527 --- /dev/null +++ b/knetworkconf/knetworkconf/Makefile.am @@ -0,0 +1,41 @@ +# set the include path for X, qt and KDE +#INCLUDES= $(all_includes) +AM_CPPFLAGS = $(all_includes) + +# We use deprecated routines in QButton, undefine QT_NO_COMPAT. +KDE_CXXFLAGS = -UQT_NO_COMPAT + +METASOURCES = AUTO +#bin_PROGRAMS = knetworkconf + +kde_module_LTLIBRARIES = kcm_knetworkconfmodule.la + +kcm_knetworkconfmodule_la_LIBADD = $(LIB_KDEUI) + +# the library search path. +kcm_knetworkconfmodule_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined + +## INCLUDES were found outside kdevelop specific part + +kcm_knetworkconfmodule_la_SOURCES = kselectdistrodlg.ui kknownhostinfo.cpp \ + kinterfaceupdowndlg.ui kaddknownhostdlg.ui kdetectdistrodlg.ui knetworkconfmodule.cpp \ + kroutinginfo.cpp kreloadnetworkdlg.ui kaddressvalidator.cpp kdnsinfo.cpp \ + knetworkinfo.cpp kadddevicedlg.ui kadddnsserverdlg.ui knetworkconfigparser.cpp \ + knetworkinterface.cpp knetworkconfdlg.ui knetworkconf.cpp main.cpp kadddevicedlgextension.ui \ + knetworkconfiface.skel kwirelessinterface.cpp kadddevicewifiext.ui kadddevicecontainer.cpp \ + kprofileslistviewtooltip.cpp + + +EXTRA_DIST = main.cpp knetworkconf.cpp knetworkconf.h knetworkconf.desktop cr16-app-knetworkconf.png cr22-app-knetworkconf.png cr32-app-knetworkconf.png knetworkconfdlg.ui knetworkinterface.cpp knetworkinterface.h knetworkconfigparser.cpp knetworkconfigparser.h kadddnsserverdlg.ui kadddevicedlg.ui knetworkinfo.cpp knetworkinfo.h kdnsinfo.cpp kdnsinfo.h kaddressvalidator.cpp kaddressvalidator.h kreloadnetworkdlg.ui network_card.png kroutinginfo.cpp kroutinginfo.h knetworkconfmodule.cpp knetworkconfmodule.h kdetectdistrodlg.ui kaddknownhostdlg.ui kinterfaceupdowndlg.ui kadddnsserverdlg.ui.h kadddevicedlg.ui.h kaddknownhostdlg.ui.h kknownhostinfo.cpp kknownhostinfo.h kselectdistrodlg.ui kcm_knetworkconfmodule version.h + +xdg_apps_DATA = kcm_knetworkconfmodule.desktop + +KDE_ICON = AUTO + +messages: rc.cpp + LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + if test -n "$$LIST"; then \ + $(XGETTEXT) $$LIST -o $(podir)/knetworkconf.pot; \ + fi + +noinst_HEADERS = kprofileslistviewtooltip.h diff --git a/knetworkconf/knetworkconf/hi16-app-knetworkconf.png b/knetworkconf/knetworkconf/hi16-app-knetworkconf.png Binary files differnew file mode 100644 index 0000000..34a5b4b --- /dev/null +++ b/knetworkconf/knetworkconf/hi16-app-knetworkconf.png diff --git a/knetworkconf/knetworkconf/hi22-app-knetworkconf.png b/knetworkconf/knetworkconf/hi22-app-knetworkconf.png Binary files differnew file mode 100644 index 0000000..aabf851 --- /dev/null +++ b/knetworkconf/knetworkconf/hi22-app-knetworkconf.png diff --git a/knetworkconf/knetworkconf/hi32-app-knetworkconf.png b/knetworkconf/knetworkconf/hi32-app-knetworkconf.png Binary files differnew file mode 100644 index 0000000..0aba00e --- /dev/null +++ b/knetworkconf/knetworkconf/hi32-app-knetworkconf.png diff --git a/knetworkconf/knetworkconf/kadddevicecontainer.cpp b/knetworkconf/knetworkconf/kadddevicecontainer.cpp new file mode 100644 index 0000000..7ed7e0f --- /dev/null +++ b/knetworkconf/knetworkconf/kadddevicecontainer.cpp @@ -0,0 +1,205 @@ + +/*************************************************************************** + kadddevicecontainer.cpp - description + ------------------- + begin : Wed Jun 15 00:40:33 UTC 2005 + copyright : (C) 2005 by Juan Luis Baptiste + email : juan.baptiste@kdemail.net + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#include "kadddevicecontainer.h" + +KAddDeviceContainer::KAddDeviceContainer(QWidget *parent, const char *name) + : KDialog(parent, name) +{ + _modified = false; + _advanced = false; + + //Setup extension dialog + setExtension( new KAddDeviceDlgExtension( this ) ); + setOrientation( Vertical ); + + //Create dialog that contains the KAddDeviceDlg and KAddDeviceWifiExt (when + //configuring a wireless interface) widgets + QPixmap activeEthernetDeviceImg(BarIcon("network_connected_lan_knc")); + setIcon(activeEthernetDeviceImg); + //First create a main QHBoxLayout + mainLayout = new QVBoxLayout( this, 10, 2, "mainLayout"); + + //Create the Addvanced settings, Ok and Cancel buttons and add them to a QHBoxLayout + buttonsLayout = new QHBoxLayout( 0, 0, 4, "buttonsLayout"); + kpbAdvanced = new KPushButton( this, "kpbAdvanced" ); + buttonsLayout->addWidget( kpbAdvanced ); + buttonsSpacer = new QSpacerItem( 70, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + buttonsLayout->addItem( buttonsSpacer ); + + kpbApply = new KPushButton( this, "kpbApply" ); + kpbApply->setEnabled( FALSE ); + kpbApply->setDefault( TRUE ); + buttonsLayout->addWidget( kpbApply ); + + kpbCancel = new KPushButton( this, "kpbCancel" ); + buttonsLayout->addWidget( kpbCancel ); + + setCaption( QString::null ); + kpbAdvanced->setText( i18n( "&Advanced Settings" ) ); + QToolTip::add( kpbAdvanced, i18n( "Toggle between advanced and basic settings" ) ); + QWhatsThis::add( kpbAdvanced, i18n( "Toggle between advanced and basic settings" ) ); + kpbApply->setText( i18n( "&OK" ) ); + QToolTip::add( kpbApply, i18n( "Apply changes" ) ); + kpbCancel->setText( i18n( "&Cancel" ) ); + QToolTip::add( kpbCancel, i18n( "Forget changes" ) ); + + //Creat and add the KAddDeviceDlg widget to the main layout + addDlg = new KAddDeviceDlg(this); + mainLayout->addWidget(addDlg); + mainLayout->setResizeMode(QLayout::Auto); + + //Setup connections + connect((KAddDeviceDlgExtension*)extension(),SIGNAL(valueChangedSignal(int)),this,SLOT(toggleApplyButtonSlot(int))); + connect(addDlg->kleIPAddress,SIGNAL(textChanged(const QString&)),this,SLOT(toggleApplyButtonSlot(const QString&))); +// connect(addDlg->kleGateway,SIGNAL(textChanged(const QString&)),this,SLOT(toggleApplyButtonSlot(const QString&))); + connect(addDlg->kcbNetmask,SIGNAL(activated(int)),this,SLOT(toggleApplyButtonSlot(int))); + connect(addDlg->kcbAutoBootProto,SIGNAL(activated(const QString&)),this,SLOT(toggleApplyButtonSlot(const QString&))); + connect(addDlg->kcbstartAtBoot,SIGNAL(stateChanged(int)),this,SLOT(toggleApplyButtonSlot(int))); + connect(addDlg->rbBootProtoAuto,SIGNAL(toggled(bool)),this,SLOT(toggleAdvancedOptionsSlot(bool))); + connect(addDlg->rbBootProtoAuto,SIGNAL(toggled(bool)),kpbAdvanced,SLOT(setDisabled(bool))); + connect(addDlg->rbBootProtoAuto,SIGNAL(stateChanged(int)),this,SLOT(toggleApplyButtonSlot(int))); + // connect(addDlg->rbBootProtoAuto,SIGNAL(toggled(bool)),addDlg->kleIPAddress,SLOT(setDisabled(bool))); + // connect(addDlg->rbBootProtoAuto,SIGNAL(toggled(bool)),addDlg->kcbNetmask,SLOT(setDisabled(bool))); + // connect(addDlg->rbBootProtoManual,SIGNAL(toggled(bool)),addDlg->kcbAutoBootProto,SLOT(setDisabled(bool))); + connect(kpbCancel,SIGNAL(clicked()),this,SLOT(cancelSlot())); + connect(kpbApply,SIGNAL(clicked()),this,SLOT(verifyDeviceInfoSlot())); + connect(kpbAdvanced,SIGNAL(clicked()),this,SLOT(advancedOptionsSlot())); + +} + +void KAddDeviceContainer::addWirelessWidget(){ + extDlg = new KAddDeviceWifiExt(this); + mainLayout->addWidget( extDlg ); + connect(extDlg->kleEssid,SIGNAL(textChanged(const QString&)),this,SLOT(toggleApplyButtonSlot(const QString&))); + connect(extDlg->kleWepKey,SIGNAL(textChanged(const QString&)),this,SLOT(toggleApplyButtonSlot(const QString&))); + connect(extDlg->qcbKeyType,SIGNAL(activated(const QString&)),this,SLOT(toggleApplyButtonSlot(const QString&))); +} +void KAddDeviceContainer::toggleApplyButtonSlot( const QString & ) +{ + toggleApplyButtonSlot(0); +} + +void KAddDeviceContainer::toggleApplyButtonSlot( int ) +{ + _modified = true; + kpbApply->setEnabled(true); +} + +void KAddDeviceContainer::toggleAdvancedOptionsSlot(bool enabled ) +{ + KAddDeviceDlgExtension *advancedOptions = (KAddDeviceDlgExtension *)this->extension(); + + if (enabled) + advancedOptions->gbAdvancedDeviceInfo->setEnabled(false); + else + advancedOptions->gbAdvancedDeviceInfo->setEnabled(true); + + _modified = true; + kpbApply->setEnabled(true); +} + +void KAddDeviceContainer::verifyDeviceInfoSlot() +{ + KAddDeviceDlgExtension *advancedOptions = (KAddDeviceDlgExtension *)this->extension(); + + if (addDlg->rbBootProtoManual->isChecked()) + { + QString ipAddress = addDlg->kleIPAddress->text(); + QString netmask = addDlg->kcbNetmask->currentText(); + QString broadcast = advancedOptions->kleBroadcast->text(); + QString gateway = advancedOptions->kleGateway->text(); + + if (!KAddressValidator::isValidIPAddress(ipAddress)) + { + KMessageBox::error(this,i18n("The format of the specified IP address is not valid."),i18n("Invalid IP Address")); + } + else if (_advanced && !KAddressValidator::isNetmaskValid(netmask)) + KMessageBox::error(this,i18n("The format of the specified netmask is not valid."),i18n("Invalid IP Address")); + + else if (!broadcast.isEmpty() && _advanced && !KAddressValidator::isBroadcastValid(broadcast)) + KMessageBox::error(this,i18n("The format of the specified broadcast is not valid."),i18n("Invalid IP Address")); + + else if (!gateway.isEmpty() && _advanced && !KAddressValidator::isValidIPAddress(gateway)) + KMessageBox::error(this,i18n("The format of the specified Gateway is not valid."),i18n("Invalid IP Address")); + + else + { + _modified = true; + close(); + } + } + else if (addDlg->rbBootProtoAuto->isChecked()) + { + _modified = true; + close(); + } +} + +void KAddDeviceContainer::makeButtonsResizeable() +{ + kpbApply->setAutoResize(true); + kpbAdvanced->setAutoResize(true); + kpbCancel->setAutoResize(true); +} + +bool KAddDeviceContainer::modified() +{ + return _modified; +} +bool KAddDeviceContainer::advanced() +{ + return _advanced; +} + + +void KAddDeviceContainer::advancedOptionsSlot() +{ + if (!_advanced) + { + kpbAdvanced->setText(i18n("Basic Settings")); + addDlg->kcbNetmask->setEditable(true); + } + else + { + kpbAdvanced->setText(i18n("Advanced Settings")); + addDlg->kcbNetmask->setEditable(false); + } + _advanced = !_advanced; + showExtension(_advanced ); +} + + +void KAddDeviceContainer::cancelSlot() +{ + _modified = false; + close(); +} + + +KAddDeviceContainer::~KAddDeviceContainer() +{ +} + +void KAddDeviceContainer::addButtons() +{ + widgetHSpacer = new QSpacerItem( 20, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + mainLayout->addItem( widgetHSpacer ); + mainLayout->addLayout( buttonsLayout ); +} + +#include "kadddevicecontainer.moc" diff --git a/knetworkconf/knetworkconf/kadddevicecontainer.h b/knetworkconf/knetworkconf/kadddevicecontainer.h new file mode 100644 index 0000000..5b1f6a6 --- /dev/null +++ b/knetworkconf/knetworkconf/kadddevicecontainer.h @@ -0,0 +1,83 @@ +/*************************************************************************** + kadddevicecontainer.h - description + ------------------- + begin : Wed Jun 15 00:40:33 UTC 2005 + copyright : (C) 2005 by Juan Luis Baptiste + email : juan.baptiste@kdemail.net + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#ifndef KADDDEVICECONTAINER_H +#define KADDDEVICECONTAINER_H + +#include <qcheckbox.h> +#include <qgroupbox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qradiobutton.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <kcombobox.h> +#include <kdialog.h> +#include <kiconloader.h> +#include <klineedit.h> +#include <kpassdlg.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kpushbutton.h> + +#include "kadddevicedlg.h" +#include "kadddevicedlgextension.h" +#include "kadddevicewifiext.h" +#include "kaddressvalidator.h" + +/** +Network interface configuration dialog. This dialog contains the KAddDeviceDlg and KAddDeviceWifiExt widgets. + +@author Juan Luis Baptiste +*/ +class KAddDeviceContainer : public KDialog +{ + Q_OBJECT + public: + KAddDeviceContainer(QWidget *parent = 0, const char *name = 0); + + ~KAddDeviceContainer(); + KPushButton* kpbAdvanced; + KPushButton* kpbApply; + KPushButton* kpbCancel; + void addButtons(); + KAddDeviceDlg *addDlg; + KAddDeviceWifiExt *extDlg; + void addWirelessWidget(); + bool modified(); + bool advanced(); + + private: + void makeButtonsResizeable(); + + protected: + QVBoxLayout* mainLayout; + QHBoxLayout* buttonsLayout; + QSpacerItem* buttonsSpacer; + QSpacerItem* widgetHSpacer; + bool _modified; + bool _advanced; + + protected slots: + void toggleApplyButtonSlot( const QString & ); + void toggleApplyButtonSlot( int ); + void toggleAdvancedOptionsSlot(bool enabled ); + void verifyDeviceInfoSlot(); + void advancedOptionsSlot(); + void cancelSlot(); +}; + +#endif diff --git a/knetworkconf/knetworkconf/kadddevicedlg.ui b/knetworkconf/knetworkconf/kadddevicedlg.ui new file mode 100644 index 0000000..eecf497 --- /dev/null +++ b/knetworkconf/knetworkconf/kadddevicedlg.ui @@ -0,0 +1,411 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KAddDeviceDlg</class> +<comment>Dialog to add/configure an network device.</comment> +<author>Juan Luis Baptiste</author> +<widget class="QWidget"> + <property name="name"> + <cstring>KAddDeviceDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>299</width> + <height>167</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="caption"> + <string>Configure Interface</string> + </property> + <property name="icon"> + <pixmap>image0</pixmap> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>gbBasicDeviceInfo</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="title"> + <string>TCP/IP Address</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="1" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>130</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KComboBox" row="0" column="3"> + <item> + <property name="text"> + <string>dhcp</string> + </property> + </item> + <item> + <property name="text"> + <string>bootp</string> + </property> + </item> + <property name="name"> + <cstring>kcbAutoBootProto</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The boot protocol this network device should use</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The boot protocol this network device should use</string> + </property> + </widget> + <spacer row="0" column="4"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>50</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>rbBootProtoManual</cstring> + </property> + <property name="text"> + <string>Manual:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Use a static IP address. Use the fields below to enter the values</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>Sets this interface to use static IP settings.</p> +<p>In this case, please use the fields below to enter the desired values manually.</p></string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>rbBootProtoAuto</cstring> + </property> + <property name="text"> + <string>Automatic:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Use a dynamic IP address</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>Using an dynamic IP address causes this device to get a free IP address automatically.</p> +<p>The interface will try to contact an DHCP- or BOOTP-Server during the boot process.</p> +<p>Rendevouz is not supported yet.</p></string> + </property> + </widget> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>kcbstartAtBoot</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Activate when the computer starts</string> + </property> + <property name="toolTip" stdset="0"> + <string>Ensures that this interface gets activated during boot time</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>Ensures that this interface gets activated during boot time.</p> +<p>Otherwise, you will have to active the interface manually after you have logged in after the boot process.</p></string> + </property> + </widget> + <widget class="KComboBox" row="3" column="3" rowspan="1" colspan="2"> + <item> + <property name="text"> + <string>255.255.255.0</string> + </property> + </item> + <item> + <property name="text"> + <string>255.255.0.0</string> + </property> + </item> + <item> + <property name="text"> + <string>255.0.0.0</string> + </property> + </item> + <item> + <property name="text"> + <string>255.255.255.128</string> + </property> + </item> + <item> + <property name="text"> + <string>255.255.255.192</string> + </property> + </item> + <item> + <property name="text"> + <string>255.255.255.240</string> + </property> + </item> + <item> + <property name="text"> + <string>255.255.255.248</string> + </property> + </item> + <property name="name"> + <cstring>kcbNetmask</cstring> + </property> + <property name="editable"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Subnetmask of the network device</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>Please enter the desired subnetmask for the interface here.</p> +<p>For small private networks, 255.255.255.0 will most often be a reasonable default value.</p> +<p>This field will change from a popup box to a combo box as soon as you enable the advanced settings below.</p></string> + </property> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>spacer11_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="3" column="2"> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="3" column="1"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>Netmask:</string> + </property> + <property name="toolTip" stdset="0"> + <string>The netmask defines a range of IP numbers which will build a subnet inside the network.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The netmask defines a range of IP numbers which will build a subnet inside the network.</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kleIPAddress</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>IP address for the network device</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>Here you should enter the IP address for the network interface.</p> +<p>Please note: If your network is connected to the internet, you should only enter IP addresses you have been given by your provider.</p> +<p>Otherwise, you should enter one of the IP addresses which are explicitly reserved for private use.</p> +<p>Most small private networks use class C networks, which allow up to 255 computers in your network. So simply use addresses like 192.168.1.1, 192.168.1.2, 192.168.1.171 and so on for your computers.</p> +<p>Cass C networks: 192.168.0.0 to 192.168.255.25, for example 192.168.0.13.</p> +<p>Class B networks: 172.16.0.0 to 172.31.255.255, for example 172.28.2.5</p> +<p>Class A networks: 10.0.0.0 to 10.255.255.255, for example 10.5.12.14</p> +<p>Please ensure that all IP addresses you give to your computers are unique; you will have many problems if the same address is assigned to more than one network device.</p></string> + </property> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="2" column="1"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>IP address:</string> + </property> + <property name="toolTip" stdset="0"> + <string>An IP address is an unique identifier of a networking device in an TCP/IP network</string> + </property> + <property name="whatsThis" stdset="0"> + <string>An IP address is an unique identifier of a networking device in an TCP/IP network</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer10_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </hbox> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="789">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000002dc49444154388ded953f881c551cc73f77f79417988419509807296e20ca2d88ba7b09648514b7100857990b69fc53b8d7e5fc53d819cb04d28be99254bb6062568c70290e6ebb150cdca231792709cc6a1666c4c179c5c0fe8a81b5b88b4ad8d1e2c0ca5ff378ff3e7ce1f37e3cf8bff66bae6ae3cb9b0f7e9547327de7e2f29bfa0c0ffcf380ec6faabd410394fbf3727fa1603afa8842558125499f88a797c333fa4aeb93f0e5e8858038138c179167101413b6551fe3415ef868df479c90e0042567e7abc0ddadce9d9008b43efcf1a90dd3f2eba613d7ccc6589b8dc50b66722f32fa1826f1306f9f5c35c68b4cebf89a914c4794bc5699b87df65335ca7234ba8c49894c83db2706049ecf4ed9a3f19ec1954d5afe2adc3548d921a9a704be4f8a9bab04bb3227442308068d9b68dc31b0ce214ab099a5ee19e251423e8ab1654cf39421cf0414d34a70e81946ce42a0f11f251c5a6cb29d399ab2862d2c511861b39895a36f30aa3b1a5e0351b0e96d4209aacabe2d769e078394b2108c5336a58b3e1a32bc95607d8bff529343bacd30ed93f427586d59fd601529f65e89aab2efbceb87f331ac47f557cfc936c669f2b1263a61885d82b63bb8dd75e47487c92b201a821f03b4af01165477ab73e7c2e94bcb4fedbbc4d2bae78803c897da5cbbd17b8e77fbc485b0bef416837142ebf526d7ee77496f5cfe81afb88f621ea0470f4ae6814c1dc87ee6be23e3c3bf5a06d86bbaa93aa0fd9f2999cc92af0e68ff97a7099f05cfa7454248888860c68ec1e32ebeb788fd26c70e2d761482b4198e863cec3fa4b3759b899efc697f16f46f8973b486eda508e3d588b301adf3357abb97a98fdb0c9fa4b8da6cfb557da0f6126b2858386742c8635a51037efb96c1ca452eddfa9cab9ff5ef02bfcfb25f098e5eac69eb864842b17ef57a5153a8b8d0d348fba40a06630b8fb9097c31cb7e1578ae79726dc53979dfee6e7e0da4c091672e2c003f01df5741fea98e00c1bf9ca9fc14fed3fa03e75097599478d74a0000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>rbBootProtoManual</sender> + <signal>toggled(bool)</signal> + <receiver>kcbAutoBootProto</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>rbBootProtoAuto</sender> + <signal>toggled(bool)</signal> + <receiver>kleIPAddress</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>rbBootProtoAuto</sender> + <signal>toggled(bool)</signal> + <receiver>kcbNetmask</receiver> + <slot>setDisabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>rbBootProtoAuto</tabstop> + <tabstop>kcbAutoBootProto</tabstop> + <tabstop>rbBootProtoManual</tabstop> + <tabstop>kleIPAddress</tabstop> + <tabstop>kcbNetmask</tabstop> + <tabstop>kcbstartAtBoot</tabstop> +</tabstops> +<includes> + <include location="local" impldecl="in implementation">kadddevicedlg.ui.h</include> +</includes> +<functions> + <function access="private" specifier="non virtual">init()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcombobox.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/kadddevicedlg.ui.h b/knetworkconf/knetworkconf/kadddevicedlg.ui.h new file mode 100644 index 0000000..bf3f21b --- /dev/null +++ b/knetworkconf/knetworkconf/kadddevicedlg.ui.h @@ -0,0 +1,13 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** Qt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + + +void KAddDeviceDlg::init() +{ +} diff --git a/knetworkconf/knetworkconf/kadddevicedlgextension.ui b/knetworkconf/knetworkconf/kadddevicedlgextension.ui new file mode 100644 index 0000000..35d4927 --- /dev/null +++ b/knetworkconf/knetworkconf/kadddevicedlgextension.ui @@ -0,0 +1,156 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KAddDeviceDlgExtension</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KAddDeviceDlgExtension</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>298</width> + <height>131</height> + </rect> + </property> + <property name="caption"> + <string>Advanced Options</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>gbAdvancedDeviceInfo</cstring> + </property> + <property name="title"> + <string>Advanced Device Information</string> + </property> + <property name="toolTip" stdset="0"> + <string>Set advanced setting for the network device</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Description:</string> + </property> + <property name="toolTip" stdset="0"> + <string>IP address of the network device</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>kleDescription</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Simply enter a short human-readable description for this device</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Simply enter a short human-readable description for this device</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>kleBroadcast</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>IP address of the network device</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The Broadcast is a special address. All devices of a network respond if packages are sent to this address.</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel1_3</cstring> + </property> + <property name="text"> + <string>Gateway:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kleGateway</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>An IP address is an unique identifier of a networking device in an TCP/IP network</string> + </property> + <property name="whatsThis" stdset="0"> + <string>An IP address is an unique identifier of a networking device in an TCP/IP network</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1"> + <property name="name"> + <cstring>kleGateway</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Default gateway for the network device</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>Here you should enter the default gateway for the network device.</p></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_2_2</cstring> + </property> + <property name="text"> + <string>Broadcast:</string> + </property> + </widget> + </grid> + </widget> + </hbox> +</widget> +<connections> + <connection> + <sender>kleBroadcast</sender> + <signal>textChanged(const QString&)</signal> + <receiver>KAddDeviceDlgExtension</receiver> + <slot>valueChanged(const QString&)</slot> + </connection> + <connection> + <sender>kleDescription</sender> + <signal>textChanged(const QString&)</signal> + <receiver>KAddDeviceDlgExtension</receiver> + <slot>valueChanged(const QString&)</slot> + </connection> + <connection> + <sender>kleGateway</sender> + <signal>textChanged(const QString&)</signal> + <receiver>KAddDeviceDlgExtension</receiver> + <slot>valueChanged(const QString&)</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">kadddevicedlgextension.ui.h</include> +</includes> +<signals> + <signal>valueChangedSignal(int)</signal> +</signals> +<slots> + <slot access="private">valueChanged( const QString & s )</slot> +</slots> +<functions> + <function access="private" specifier="non virtual">init()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/kadddevicedlgextension.ui.h b/knetworkconf/knetworkconf/kadddevicedlgextension.ui.h new file mode 100644 index 0000000..455cabf --- /dev/null +++ b/knetworkconf/knetworkconf/kadddevicedlgextension.ui.h @@ -0,0 +1,18 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** Qt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ +void KAddDeviceDlgExtension::init() +{ + +} + + +void KAddDeviceDlgExtension::valueChanged( const QString &s ) +{ + emit valueChangedSignal(0); +} diff --git a/knetworkconf/knetworkconf/kadddevicewifiext.ui b/knetworkconf/knetworkconf/kadddevicewifiext.ui new file mode 100644 index 0000000..d8d728a --- /dev/null +++ b/knetworkconf/knetworkconf/kadddevicewifiext.ui @@ -0,0 +1,96 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KAddDeviceWifiExt</class> +<comment>Extension to the KAddDeviceDlg dialog to configure wireless settings.</comment> +<author>Juan Luis Baptiste</author> +<widget class="QWidget"> + <property name="name"> + <cstring>KAddDeviceWifiExt</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>186</width> + <height>104</height> + </rect> + </property> + <property name="caption"> + <string>Wireless Settings</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>gbWirelessSettings</cstring> + </property> + <property name="title"> + <string>Wireless Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>WEP key:</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>kleEssid</cstring> + </property> + </widget> + <widget class="KPasswordEdit" row="1" column="1"> + <property name="name"> + <cstring>kleWepKey</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>ESSID:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Key type:</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <item> + <property name="text"> + <string>ASCII</string> + </property> + </item> + <item> + <property name="text"> + <string>Hexadecimal</string> + </property> + </item> + <property name="name"> + <cstring>qcbKeyType</cstring> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>kpassdlg.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/kadddnsserverdlg.ui b/knetworkconf/knetworkconf/kadddnsserverdlg.ui new file mode 100644 index 0000000..2df997e --- /dev/null +++ b/knetworkconf/knetworkconf/kadddnsserverdlg.ui @@ -0,0 +1,166 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KAddDNSServerDlg</class> +<widget class="KDialog"> + <property name="name"> + <cstring>KAddDNSServerDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>234</width> + <height>81</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="caption"> + <string>Add New DNS Server</string> + </property> + <property name="icon"> + <pixmap>image0</pixmap> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="KLineEdit" row="0" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kleNewServer</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>IP address of the new DNS server</string> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>lIPAddress</cstring> + </property> + <property name="text"> + <string>IP address:</string> + </property> + </widget> + <widget class="KPushButton" row="2" column="2"> + <property name="name"> + <cstring>kpbAddServer</cstring> + </property> + <property name="text"> + <string>&Add</string> + </property> + <property name="toolTip" stdset="0"> + <string>Add the server to the list</string> + </property> + </widget> + <widget class="KPushButton" row="2" column="3"> + <property name="name"> + <cstring>kpbCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="toolTip" stdset="0"> + <string>Forget it</string> + </property> + </widget> + <spacer row="1" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>spacer13</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + </grid> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="1073">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003f84944415418959d9541681d4518c7ff9b6e9aefc9a6cec0537645211b5aec8ba2264dc13cad90e2a9a508f556bc786cf0a2201e8a88470d150a012dbc8b20b9350791d04349413116f56541db6eb1f18dd887b34d9ebb2359df7ed66dc743c84b2d496afd6018e6303fbef9ff8619586bb1d50080993333e3692b6da6ad2ea7bf75396d75b9bb72ef6cb9fb6b97bba92d9a8bcd85e977a7f701808b1d6aa83ab49709e1fc4533a0fb19a1ef834b862f249276067209baa3505913a0c104c7c76b23a69c1b02707d473083fb842b9db96b8b205143a4196120b1a8015991d0ab05500aa85f140eef0fc0861d4162d77d3b968312096b14b980ce154435042b052281a43440299019059313545b030890e40900a06f2770c6197c0a608c823680e928a024e80ea3e0f518c012fa860281a0730ddff371df8e032f80e10c4401b8a3912104b30251006334c0eb27412991e409248530b959073b8e83993333e3278e9d380bd05320000c7457bae01c7d44e86fbc5943e08d015c80bc0ae6be5fc27c14203680f44264a5c2900851e480f0c466c7ffc5fefcb54dfb479eab61fec70841b586cc28a0eac3200348f63276ff8f7d62c6a94901788074c3db9c33e0c251edf84fe18a6e0ffca0f61901544761c4abd8a56b573bacf9eba44c7466b2388aa3b8772b1edc7e86117f04c215ced1178f3e1c8e8603c4f4e9c2c585c6a9b74e757ae07fd9cf353243506d05ce1949a2c086a092bbecbb15e85c833c82326a1781a4326a776d5fedd681970ed85e14599961d493208a51f343b05b81a84a8033480aa10cdf6bdf6637b23f66afcf4654d295e872f4b9beae7f983d3f6b37ae6a1f0048928ee10c52046062045501e931023f04bcf5b5a00cb2671fb7e376dc8e2fab8f55477f32397efce7daa13a4d7ff099b301760140adaaac4ef5b57327e59ec20d2d180e48f6b12900f2a10d43baa1edd94fe25df5d1fa934aeb8f0219ac162edf098cb8b07069e17d00c52678597d77eec2b90f032fa8e95c0f8ded1d3b04c2a02001ddd1a8b815bb7879e92fbec1bfeb52134adc61e69c725a8dca6f5ae4893b6a39be69564d2f0a00406bb1e54cbd3e35d038db984c5be95776c5deb2a9b576c55a9b5a9bfe945a9bdaa2f96df38bc6e9c6c1c99727079a5f361d005bbee5d6daf58c87ebc3367c3afcdbf77c28a3060a148ece350a145046ed687fbb72ee5e4c9d9c1a1cdb3ff63c08af848f84cf0a219e61668e757ce52efb9766cfcfae6decd9f86db6054f9f6ef405108fc2c7434830a8cbe485578f1d7f63fee2fcaa5a5633a22aae8e3e5e2fa276b446aee8bcfdce6b7627f0e6b39973c554cd7b134f4c1cd483dc5ff3c2c70acec49189c3c38bded2f076f6b7ab1e385a5eba2d3a52e944ef1190bb233703111994000cd21ded6f51ff00b4d6ba80c75184550000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>kpbAddServer</sender> + <signal>clicked()</signal> + <receiver>KAddDNSServerDlg</receiver> + <slot>validateAddressSlot()</slot> + </connection> + <connection> + <sender>kpbCancel</sender> + <signal>clicked()</signal> + <receiver>KAddDNSServerDlg</receiver> + <slot>close()</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">kadddnsserverdlg.ui.h</include> +</includes> +<slots> + <slot access="private">validateAddressSlot()</slot> + <slot access="private">makeButtonsResizeable()</slot> +</slots> +<functions> + <function specifier="non virtual">setAddingAlias( bool add )</function> + <function returnType="bool">modified()</function> + <function access="private" specifier="non virtual">init()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kdialog.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/kadddnsserverdlg.ui.h b/knetworkconf/knetworkconf/kadddnsserverdlg.ui.h new file mode 100644 index 0000000..0d34f67 --- /dev/null +++ b/knetworkconf/knetworkconf/kadddnsserverdlg.ui.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** Qt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ +#include "kaddressvalidator.h" +#include <kmessagebox.h> + +bool _modified2; +bool addingAlias; + +void KAddDNSServerDlg::setAddingAlias(bool add) +{ + addingAlias = add; +} + +bool KAddDNSServerDlg::modified() +{ + return _modified2; +} +void KAddDNSServerDlg::init() +{ + _modified2 = false; + addingAlias = false; + makeButtonsResizeable(); +} + +void KAddDNSServerDlg::validateAddressSlot() +{ + if (!addingAlias) + { + if (KAddressValidator::isValidIPAddress(kleNewServer->text())) + { + _modified2 = true; + close(); + } + else + { + KMessageBox::error(this,i18n("The format of the specified IP address is not valid."),i18n("Invalid IP Address")); + } + } + else + { + if (kleNewServer->text() !="") + { + _modified2 = true; + close(); + } + else + { + KMessageBox::error(this,i18n("You have to type an alias first."),i18n("Invalid Text")); + } + } +} + + +void KAddDNSServerDlg::makeButtonsResizeable() +{ + kpbAddServer->setAutoResize(true); + kpbCancel->setAutoResize(true); +} diff --git a/knetworkconf/knetworkconf/kaddknownhostdlg.ui b/knetworkconf/knetworkconf/kaddknownhostdlg.ui new file mode 100644 index 0000000..22782ba --- /dev/null +++ b/knetworkconf/knetworkconf/kaddknownhostdlg.ui @@ -0,0 +1,303 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KAddKnownHostDlg</class> +<widget class="KDialog"> + <property name="name"> + <cstring>KAddKnownHostDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>324</width> + <height>210</height> + </rect> + </property> + <property name="caption"> + <string>Add New Static Host</string> + </property> + <property name="icon"> + <pixmap>image0</pixmap> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>IP address:</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Preferred</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>kleIpAddress</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer16</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>180</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton" row="3" column="2"> + <property name="name"> + <cstring>kpbCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + <spacer row="2" column="1"> + <property name="name"> + <cstring>spacer51</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="KPushButton" row="3" column="1"> + <property name="name"> + <cstring>kpbAdd</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer51_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Aliases</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListBox"> + <property name="name"> + <cstring>klbAliases</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout25</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbAddHost</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Add...</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbEditHost</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Edit...</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbRemoveHost</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Remove</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </grid> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="1012">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003bb49444154189595954f681d451cc73f9b6c9adf93973a0b0f794f3cf495886eeb9f1a5a685a7a48f0d25c84debd14415a4490209e8a781215052120855c04cf39a83c7a90f4505ac55a1525ddd204b7d092599b676724ebdb9f75dbf590e6352d49205f1866e630dff9f1fd0cbf09aaaa62330541c0cce733074f1c3f719650f61302258880eac659a05410a9d2a5e4fbce379d37cf7c786631dcd4f5819a8de6287569cf9df7c36e085a0d0380a90b5e1500e7335815a211cfd481f63e45f700db1b030382049d6b16ea6dc42acd8641011912bc5354057bcb72643462725403096510605b63a909bef414b9e0738b69b450cd1011b4542805e72d3e079b392823bcfab58ab633d65231a1c17b8bed2abe6b29146c572972b05d8be682bd69a104a70e236b716d5b7124115a2a2211da7538df42d52262f0a507155c9e4159c3ab47c226fa20fb702bfa7796efa0ca80840ccdbe13133da02f22747e4d98bb6c487388a4892b339af5e6c357b25ef14ee94fbed0a6f37b424bda386fa161d05021947ec6eb51ec88fed4f3caf431410cd468dd2bd62e0fb22cfd47905edf78a7f4b58cb0ded2ae4b75f546daf5d65ff4a5b7cebb24594c92feabd839fd8276a34d2451307978f2c9f89578989c2fe7cfcfcf4ebf3ddded1b3f425f1dce439659342fc8ba16f560bb1be8c3da2c42966783944436b7bbe267e3bb47278f56fd280a0a442244a0dd688108c6445016d4c216362f1ea75fd9d4fe9d2c26bfa02c24d792afd3c5f4b7b97373fdc61302d4c25aa0a52332069f2b2d13217545c2165a7a5a123d4eff5e9aa5b7b2cc7f611ae6eaf8c1a9c23413199f98cadf7def8d87155b67dd7838befad5a9f66e858a92809001cd154283cb951aadaa4fbf9b0e8ebd38f69c6dbacfcc48b482703feaca77977ebaf40150f48dd3a5f47267a8f3712451ecd4ed89f7c4c76af5da888482cb1d40f5f352f2afbfe9ff72a5134aeeab6a4ece8a2ffd1f5237f7d3a5e44fbfe21fedc10b97168293af9f1c9e3d3b3bb17c7df942ef76ef6eef76af5a1fcbd797abdeed5e71e5c72bdfce7c347368e2d589e18bf3170380aaaa361d0300fb8fecafe203f17fa66eb0b91dd65203af1e2d952ccfb6a5bf95828d9bd3a74e8fec1bdd7758eaf25a336abe1c35a29734574d57d2850df47f983b37b7ba7e66cb1f687df1c9a7b30311f29434e509cd74c495fee8d4f1a9b7ce5f985f4997d219d33057e367c68ae456b22aa174d7e96f65dc6f9bea5d4d9bd1fb712b3ee4467428169ea62cccc4a1f1bda66ef66e457f2bf58d931bc93de3a3d46676b720bb081511f194a05eef6c4b7f13fd0f228d8a497c524ca50000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>kpbCancel</sender> + <signal>clicked()</signal> + <receiver>KAddKnownHostDlg</receiver> + <slot>close()</slot> + </connection> + <connection> + <sender>kpbAdd</sender> + <signal>clicked()</signal> + <receiver>KAddKnownHostDlg</receiver> + <slot>validateAddressSlot()</slot> + </connection> + <connection> + <sender>klbAliases</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>KAddKnownHostDlg</receiver> + <slot>editHostSlot()</slot> + </connection> + <connection> + <sender>kpbAddHost</sender> + <signal>clicked()</signal> + <receiver>KAddKnownHostDlg</receiver> + <slot>addHostSlot()</slot> + </connection> + <connection> + <sender>kpbEditHost</sender> + <signal>clicked()</signal> + <receiver>KAddKnownHostDlg</receiver> + <slot>editHostSlot()</slot> + </connection> + <connection> + <sender>kpbRemoveHost</sender> + <signal>clicked()</signal> + <receiver>KAddKnownHostDlg</receiver> + <slot>removeHostSlot()</slot> + </connection> +</connections> +<tabstops> + <tabstop>kleIpAddress</tabstop> + <tabstop>kpbAdd</tabstop> + <tabstop>kpbCancel</tabstop> +</tabstops> +<includes> + <include location="local" impldecl="in implementation">kaddknownhostdlg.ui.h</include> +</includes> +<slots> + <slot access="private">validateAddressSlot()</slot> + <slot access="private">makeButtonsResizeable()</slot> + <slot access="private">editHostSlot()</slot> + <slot access="private">removeHostSlot()</slot> + <slot access="private">addHostSlot()</slot> +</slots> +<functions> + <function access="private" specifier="non virtual">init()</function> + <function specifier="non virtual" returnType="bool">modified()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kdialog.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistbox.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/kaddknownhostdlg.ui.h b/knetworkconf/knetworkconf/kaddknownhostdlg.ui.h new file mode 100644 index 0000000..49ea4b7 --- /dev/null +++ b/knetworkconf/knetworkconf/kaddknownhostdlg.ui.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** Qt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ +#include "kaddressvalidator.h" +#include "kadddnsserverdlg.h" + +#include <kmessagebox.h> + +bool _modifiedhost; + +void KAddKnownHostDlg::init() +{ + _modifiedhost = false; + makeButtonsResizeable(); +} +void KAddKnownHostDlg::validateAddressSlot() +{ + if (!KAddressValidator::isValidIPAddress(kleIpAddress->text())) + { + KMessageBox::error(this,i18n("The format of the specified IP address is not valid."),i18n("Invalid IP Address")); + } + else if ((klbAliases->firstItem() == 0)) + { + KMessageBox::error(this,i18n("You must add at least one alias for the specified IP address."),i18n("Insufficient Aliases")); + } + else + { + _modifiedhost = true; + close(); + } + +} + + +void KAddKnownHostDlg::makeButtonsResizeable() +{ + kpbAdd->setAutoResize(true); + kpbCancel->setAutoResize(true); + kpbAddHost->setAutoResize(true); + kpbEditHost->setAutoResize(true); + kpbRemoveHost->setAutoResize(true); +} + + +bool KAddKnownHostDlg::modified() +{ + return _modifiedhost; +} + + +void KAddKnownHostDlg::editHostSlot() +{ + KAddDNSServerDlg dlg(this, 0); + + if (klbAliases->currentItem() >= 0) + { + int currentPos = klbAliases->currentItem(); + dlg.setCaption(i18n("Edit Alias")); + dlg.lIPAddress->setText(i18n("Alias:")); + dlg.setAddingAlias(true); + QListBoxItem *item = klbAliases->item(currentPos); + QString currentText = item->text(); + dlg.kleNewServer->setText(currentText); + dlg.kpbAddServer->setText(i18n("&OK")); + dlg.exec(); + + if(dlg.modified()) + { + klbAliases->changeItem(dlg.kleNewServer->text(),currentPos); +// enableApplyButtonSlot(); + } + } +} + + +void KAddKnownHostDlg::removeHostSlot() +{ + if (klbAliases->currentItem() >= 0) + klbAliases->removeItem(klbAliases->currentItem()); +} + + +void KAddKnownHostDlg::addHostSlot() +{ + KAddDNSServerDlg addDlg(this, 0); + addDlg.setCaption(i18n("Add New Alias")); + addDlg.lIPAddress->setText(i18n("Alias:")); + addDlg.setAddingAlias(true); + + addDlg.exec(); + if(addDlg.modified()) + { + klbAliases->insertItem(addDlg.kleNewServer->text()); +// enableApplyButtonSlot(); + } + +} diff --git a/knetworkconf/knetworkconf/kaddressvalidator.cpp b/knetworkconf/knetworkconf/kaddressvalidator.cpp new file mode 100644 index 0000000..b80e737 --- /dev/null +++ b/knetworkconf/knetworkconf/kaddressvalidator.cpp @@ -0,0 +1,240 @@ +/*************************************************************************** + kaddressvalidator.cpp - description + ------------------- + begin : Wed Jan 22 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#include "kaddressvalidator.h" + +/* + Class for validating IP address and netmasks, and to calculate network and broadcast values. + The functions to do the last two things where taken from the code of ipcalc.c, made by + Erik Troan <ewt@redhat.com> and Preston Brown <pbrown@redhat.com> from Red Hat Inc. . +*/ + +KAddressValidator::KAddressValidator(){ +} +KAddressValidator::~KAddressValidator(){ +} +/** Validates if the address written by the user is a valid one. Return true if it is and false if not. */ +bool KAddressValidator::isValidIPAddress(QString addr){ + QString s = ""; + int i; + int number; + bool ok; + if ((addr.contains('.') > 3) || (addr.length() > 15)) + return false; + for (i = 0; i < 4; i++) + { + s = addr.section('.',i,i); + number = s.toInt(&ok); + if (!ok) + return false; + if ((i == 0) && (number == 0)) + return false; + if ((number < 0) || (number > 255)) + return false; + if ((i == 3) && (number == 0)) + return false; + } + if (i == 4) + return true; + else + return false; +} +bool KAddressValidator::isNetmaskValid(QString addr){ + QString s = ""; + int i; + int number; + bool ok; + for (i = 0; i < 4; i++) + { + s = addr.section('.',i,i); + number = s.toInt(&ok); + if (!ok) + return false; + if ((i == 0) && (number == 0)) + return false; + if ((number < 0) || (number > 255)) + return false; + } + if (i == 4) + return true; + else + return false; + +} + +bool KAddressValidator::isNetworkValid(const QString &addr){ + QString s = ""; + int i; + int number; + bool ok; + for (i = 0; i < 4; i++) + { + s = addr.section('.',i,i); + number = s.toInt(&ok); + if (!ok) + return false; + if ((i == 0) && (number == 0)) + return false; + if ((number < 0) || (number >= 255)) + return false; + } + if (i == 4) + return true; + else + return false; + +} +bool KAddressValidator::isBroadcastValid(QString addr){ + QString s = ""; + int i; + int number; + bool ok; + for (i = 0; i < 4; i++) + { + s = addr.section('.',i,i); + number = s.toInt(&ok); + if (!ok) + return false; + if ((i == 0) && (number == 0)) + return false; + if ((number < 0) || (number > 255)) + return false; + if ((i == 3) && (number == 0)) + return false; + } + if (i == 4) + return true; + else + return false; + +} + +/** \fn unsigned long int prefix2mask(int bits) + \brief creates a netmask from a specified number of bits + + This function converts a prefix length to a netmask. As CIDR (classless + internet domain internet domain routing) has taken off, more an more IP + addresses are being specified in the format address/prefix + (i.e. 192.168.2.3/24, with a corresponding netmask 255.255.255.0). If you + need to see what netmask corresponds to the prefix part of the address, this + is the function. See also \ref mask2prefix. + + \param prefix is the number of bits to create a mask for. + \return a network mask, in network byte order. + */ +unsigned long int KAddressValidator::prefix2mask(int prefix){ + return htonl(~((2 << (31 - prefix)) - 1)); +} +/** \fn int mask2prefix(unsigned long int mask) + \brief calculates the number of bits masked off by a netmask. + + This function calculates the significant bits in an IP address as specified by + a netmask. See also \ref prefix2mask. + + \param mask is the netmask, specified as an unsigned long integer in network byte order. + \return the number of significant bits. */ +int KAddressValidator::mask2prefix(unsigned long int mask){ + unsigned i; + int count = IPBITS; + + for (i = 0; i < IPBITS; i++) + { + if (!(ntohl(mask) & ((2 << i) - 1))) + count--; + } + + return count; +} +/*! + \fn unsigned long int calc_broadcast(unsigned long int addr, int prefix) + + \brief calculate broadcast address given an IP address and a prefix length. + + \param addr an IP address in network byte order. + \param prefix a prefix length. + + \return the calculated broadcast address for the network, in network byte + order. */ +unsigned long int KAddressValidator::calc_broadcast(unsigned long int addr, int prefix){ + return (addr & prefix2mask(prefix)) | ~prefix2mask(prefix); +} +/** \fn unsigned long int calc_network(unsigned long int addr, int prefix) + \brief calculates the network address for a specified address and prefix. + + \param addr an IP address, in network byte order + \param prefix the network prefix + \return the base address of the network that addr is associated with, in + network byte order. */ +unsigned long int KAddressValidator::calc_network(unsigned long int addr, int prefix){ + return (addr & prefix2mask(prefix)); +} +/** Is a wrapper function to calc_network that receives the IP address and netsmask as QString and +returns the network value also as a QString, or NULL if it couldn't be calculated. */ +QString KAddressValidator::calculateNetwork(QString addr,QString netmask){ + struct in_addr _addr, _netmask, _network; + int prefix = 0; + QString s; + if (addr.isNull() || netmask.isNull()) + return NULL; //bad address + if (!inet_pton(AF_INET,addr.latin1(),&_addr)) + return NULL; //bad address + else + { + if (!inet_pton(AF_INET,netmask.latin1(),&_netmask)) + return NULL; //bad address + else + { + prefix = mask2prefix(_netmask.s_addr); + _network.s_addr = calc_network(_addr.s_addr, prefix); + char * char_network = new char[20]; + if (!inet_ntop(AF_INET,&_network,char_network,20)) + return NULL; + else + s = char_network; + } + } + return s; +} + +/** Is a wrapper function to calc_broadcast that receives the IP address and netsmask as QString and +returns the broadcast value also as a QString, or NULL if it couldn't be calculated. */ +QString KAddressValidator::calculateBroadcast(QString addr, QString netmask){ + struct in_addr _addr, _netmask, _network; + int prefix = 0; + QString s; + if (addr.isNull() || netmask.isNull()) + return NULL; //bad address + if (!inet_pton(AF_INET,addr.latin1(),&_addr)) + return NULL; //bad address + else + { + if (!inet_pton(AF_INET,netmask.latin1(),&_netmask)) + return NULL; //bad address + else + { + prefix = mask2prefix(_netmask.s_addr); + _network.s_addr = calc_broadcast(_addr.s_addr, prefix); + char * char_network = new char[20]; + if (!inet_ntop(AF_INET,&_network,char_network,20)) + return NULL; + else + s = char_network; + } + } + return s; + +} diff --git a/knetworkconf/knetworkconf/kaddressvalidator.h b/knetworkconf/knetworkconf/kaddressvalidator.h new file mode 100644 index 0000000..32dcc37 --- /dev/null +++ b/knetworkconf/knetworkconf/kaddressvalidator.h @@ -0,0 +1,116 @@ +/*************************************************************************** + kaddressvalidator.h - description + ------------------- + begin : Wed Jan 22 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#ifndef KADDRESSVALIDATOR_H +#define KADDRESSVALIDATOR_H + +/* + Class for validating IP address and netmasks, and to calculate network and broadcast values. + The functions to do the last two things where taken from the code of ipcalc.c, made by + Erik Troan <ewt@redhat.com> and Preston Brown <pbrown@redhat.com> from Red Hat Inc. +*/ + + + +/*! + \def IPBITS + \brief the number of bits in an IP address. +*/ +#define IPBITS (sizeof(Q_UINT32) * 8) +/*! + \def IPBYTES + \brief the number of bytes in an IP address. +*/ +#define IPBYTES (sizeof(Q_UINT32)) + +#include <sys/types.h> +#include <sys/socket.h> +#include <arpa/inet.h> +#include <netinet/in.h> +#include <qstring.h> + +/**Class that has simple methods for validating IP addresses, netmasks, calculating + broadcast and network addresses. + + *@author Juan Luis Baptiste + */ + +class KAddressValidator { +public: + KAddressValidator(); + ~KAddressValidator(); + /** Validates if the address written by the user is a valid one. Return true if it is and false if not. */ + static bool isValidIPAddress(QString addr); + /** Validates if the Netmask written by the user is a valid one. Return true if it is and false if not. */ + static bool isNetmaskValid(QString addr); +/** Validates if the Network written by the user is a valid one. Return true if it is and false if not. */ + static bool isNetworkValid(const QString &addr); +/** Validates if the Broadcast written by the user is a valid one. Return true if it is and false if not. */ + static bool isBroadcastValid(QString addr); + + /** Is a wrapper function to calc_network that receives the IP address and netsmask as QString and + returns the network value also as a QString, or NULL if it couldn't be calculated. */ + static QString calculateNetwork(QString addr,QString netmask); +/** Is a wrapper function to calc_broadcast that receives the IP address and netsmask as QString and +returns the broadcast value also as a QString, or NULL if it couldn't be calculated. */ + static QString calculateBroadcast(QString addr, QString netmask); + +private: // Private methods +/** \fn unsigned long int calc_broadcast(unsigned long int addr, int prefix) + + \brief calculate broadcast address given an IP address and a prefix length. + + \param addr an IP address in network byte order. + \param prefix a prefix length. + + \return the calculated broadcast address for the network, in network byte + order. */ + static unsigned long int calc_broadcast(unsigned long int addr, int prefix); + /** \fn unsigned long int calc_network(unsigned long int addr, int prefix) + \brief calculates the network address for a specified address and prefix. + + \param addr an IP address, in network byte order + \param prefix the network prefix + \return the base address of the network that addr is associated with, in + network byte order. */ + static unsigned long int calc_network(unsigned long int addr, int prefix); + /** \fn unsigned long int prefix2mask(int bits) + \brief creates a netmask from a specified number of bits + + This function converts a prefix length to a netmask. As CIDR (classless + internet domain internet domain routing) has taken off, more an more IP + addresses are being specified in the format address/prefix + (i.e. 192.168.2.3/24, with a corresponding netmask 255.255.255.0). If you + need to see what netmask corresponds to the prefix part of the address, this + is the function. See also \ref mask2prefix. + + \param prefix is the number of bits to create a mask for. + \return a network mask, in network byte order. + */ + static unsigned long int prefix2mask(int prefix); + /** \fn int mask2prefix(unsigned long int mask) + \brief calculates the number of bits masked off by a netmask. + + This function calculates the significant bits in an IP address as specified by + a netmask. See also \ref prefix2mask. + + \param mask is the netmask, specified as an unsigned long integer in network byte order. + \return the number of significant bits. */ + static int mask2prefix(unsigned long int mask); +}; + +#endif diff --git a/knetworkconf/knetworkconf/kcm_knetworkconfmodule b/knetworkconf/knetworkconf/kcm_knetworkconfmodule new file mode 100644 index 0000000..857c4a2 --- /dev/null +++ b/knetworkconf/knetworkconf/kcm_knetworkconfmodule @@ -0,0 +1 @@ +?package(local.kcm_knetworkconfmodule.desktop):needs="x11" kde_filename="kcm_knetworkconfmodule" section="System/Configuration/KDE/Network" command="kcmshell kcm_knetworkconfmodule" icon="locolor/32x32/apps/knetworkconf.png" longtitle="Configure your Network settings" title="Network Settings" kde_opt="Encoding=UTF-8\\nX-KDE-RootOnly=true\\nX-KDE-ModuleType=Library\\nX-KDE-Library=knetworkconfmodule\\nX-KDE-FactoryName=knetworkconfmodule\\nX-KDE-ParentApp=kcontrol\\nType=Application\\nDocPath=knetworkconf/index.docbook\\nComment[es]=Configurar las propiedades de Red\\nComment[de]=Netzwerkschnittstellen konfigurieren\\nTerminal=0\\nName[es]=Propiedades de Red\\nName[de]=Netzwerkschnittstellen konfigurieren\\nGenericName=Configure TCP/IP settings\\nGenericName[es]=Configurar las propiedades de red\\nKeywords=Network,DNS,routes,interfaces\\n" diff --git a/knetworkconf/knetworkconf/kcm_knetworkconfmodule.desktop b/knetworkconf/knetworkconf/kcm_knetworkconfmodule.desktop new file mode 100644 index 0000000..e648042 --- /dev/null +++ b/knetworkconf/knetworkconf/kcm_knetworkconfmodule.desktop @@ -0,0 +1,178 @@ +# KDE Config File +[Desktop Entry] +X-KDE-RootOnly=true +Categories=Qt;KDE;Settings;X-KDE-settings-network; +X-KDE-ModuleType=Library +X-KDE-Library=knetworkconfmodule +X-KDE-FactoryName=knetworkconfmodule +Type=Application +Exec=kcmshell kcm_knetworkconfmodule +Icon=knetworkconf +DocPath=knetworkconf/index.html + +Comment=Configure Network Settings +Comment[ar]=إعداد تعيينات الشبكة +Comment[be]=Наставіць сетку +Comment[bg]=Настройване на мрежата +Comment[bn]=নেটওয়ার্ক মানসমূহ কনফিগার করে +Comment[br]=Kefluniañ dibarzhoù ar rouedad +Comment[bs]=Podesi postavke mreže +Comment[ca]=Configura els paràmetres de la xarxa +Comment[cs]=Nastavení sítě +Comment[da]=Indstil netværksopsætning +Comment[de]=Netzwerkeinstellungen einrichten +Comment[el]=Διαμόρφωση ρυθμίσεων δικτύου +Comment[es]=Configure los parámetros de red +Comment[et]=Võrguseadistuste seadistamine +Comment[eu]=Konfiguratu sareko ezarpenak +Comment[fa]=پیکربندی تنظیمات شبکه +Comment[fi]=Aseta tietoverkon asetukset +Comment[fr]=Configuration des paramètres réseau +Comment[ga]=Cumraigh na Socruithe Líonra +Comment[gl]=Configuración da Rede +Comment[he]=שינוי הגדרות רשת +Comment[hr]=Konfiguriranje mrežnih postavki +Comment[hu]=A hálózat beállításai +Comment[is]=Umsjón netstillinga +Comment[it]=Configura le impostazioni di rete +Comment[ja]=ネットワーク設定 +Comment[ka]=ქსელის პარამეტრების კონფიგურაცია +Comment[kk]=Желінің параметрлерін баптау +Comment[km]=កំណត់រចនាសម្ព័ន្ធការកំណត់បណ្ដាញ +Comment[ko]=네트워크 설정 +Comment[lt]=Konfigūruoti tinklo nustatymus +Comment[mk]=Конфигурирајте ги поставуањата за мрежата +Comment[nb]=Sett opp nettverksinnstillinger +Comment[nds]=Nettwark-Instellen fastleggen +Comment[ne]=सञ्जाल सेटिङ कन्फिगर गर्नुहोस् +Comment[nl]=Netwerk instellen +Comment[nn]=Set opp nettverket +Comment[pa]=ਨੈੱਟਵਰਕ ਸਥਾਪਨ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja ustawień sieci +Comment[pt]=Configurar Opções de Rede +Comment[pt_BR]=Configurar rede +Comment[ro]=Configurează setările de reţea +Comment[ru]=Утилита настройки сети +Comment[se]=Heivet fierpmádaga +Comment[sk]=Konfigurácia sieťových nastavení +Comment[sl]=Nastavite omrežne nastavitve +Comment[sr]=Подешавање поставки мреже +Comment[sr@Latn]=Podešavanje postavki mreže +Comment[sv]=Anpassa nätverksinställningar +Comment[th]=ตั้งค่าการปรับแต่งเครือข่าย +Comment[tr]=Ağ Ayarlarını Yapılandır +Comment[uk]=Налаштувати мережні параметри +Comment[vi]=Cấu hình thiết lập mạng +Comment[wa]=Apontiaedjes del rantoele +Comment[zh_CN]=配置网络设置 +Comment[zh_HK]=設定網絡設置 +Comment[zh_TW]=設定網路 +Terminal=false +Name=Network Settings +Name[ar]=تعيينات الشبكة +Name[be]=Наставіць сетку +Name[bg]=Мрежови настройки +Name[bn]=নেটওয়ার্ক মানসমূহ +Name[br]=Kefluniadur ar Rouedad +Name[bs]=Postavke mreže +Name[ca]=Paràmetres de xarxa +Name[cs]=Nastavení sítě +Name[cy]=Gosodiadau Rhwydwaith +Name[da]=Netværksopsætning +Name[de]=Netzwerkeinstellungen +Name[el]=Ρυθμίσεις δικτύου +Name[es]=Parámetros de red +Name[et]=Võrguseadistused +Name[eu]=Sareko ezarpenak +Name[fa]=تنظیمات شبکه +Name[fi]=Verkkoasetukset +Name[fr]=Paramètres réseau +Name[ga]=Socruithe Líonra +Name[gl]=Configuración da Rede +Name[he]=הגדרות רשת +Name[hr]=Mrežne postavke +Name[hu]=Hálózati beállítások +Name[is]=Netstillingar +Name[it]=Impostazioni di rete +Name[ja]=ネットワーク設定 +Name[ka]=ქსელის პარამეტრები +Name[kk]=Желінің параметрлері +Name[km]=ការកំណត់បណ្ដាញ +Name[ko]=네트워크 설정 +Name[lt]=Tinklo nustatymai +Name[mk]=Поставувања на мрежа +Name[nb]=Nettverksoppsett +Name[nds]=Nettwark-Instellen +Name[ne]=सञ्जाल सेटिङ +Name[nl]=Netwerkinstellingen +Name[nn]=Nettverksinnstillingar +Name[pa]=ਨੈੱਟਵਰਕ ਸਥਾਪਨ +Name[pl]=Ustawienia sieci +Name[pt]=Configuração da Rede +Name[pt_BR]=Configurações de Rede +Name[ro]=Setări de reţea +Name[ru]=Настройка сети +Name[se]=Fierpmádatheivehusat +Name[sk]=Sieťové nastavenia +Name[sl]=Omrežne nastavitve +Name[sr]=Поставке мреже +Name[sr@Latn]=Postavke mreže +Name[sv]=Nätverksinställningar +Name[th]=ตั้งค่าเครือข่าย +Name[tr]=Ağ Ayarları +Name[uk]=Мережні параметри +Name[vi]=Thiết lập mạng +Name[wa]=Apontiaedjes del rantoele +Name[zh_CN]=网络设置 +Name[zh_HK]=網絡設置 +Name[zh_TW]=網路設定 +Keywords=Network,DNS,routes,interfaces +Keywords[ar]=الشبكة,خادم اسماء المجال,الطرق,الواجهات +Keywords[bg]=мрежа, рутер, интерфейс, мрежова, карта, Network, DNS, routes, interfaces +Keywords[br]=Rouedad,DNS,hentoù,etrefasoù +Keywords[bs]=Network,DNS,routes,interfaces,mreža,interfejsi +Keywords[ca]=Xarxa,DNS,rutes,interfícies +Keywords[cs]=síť,DNS,route,rozhraní +Keywords[da]=Netværk,DNS,routes,grænseflader +Keywords[de]=Netzwerk,DNS,Routen,Schnittstellen +Keywords[el]=Δίκτυο,DNS,routes,διεπαφές +Keywords[es]=Red, DNS, rutas, interfaces +Keywords[et]=Võrk,DNS,marsruudid,liidesed +Keywords[eu]=Sarea,DNS,bideak, iterfazeak +Keywords[fa]=شبکه، خدمت نام دامنه، مسیرها، واسطها +Keywords[fi]=tietoverkko,DNS,reitit,rajapinnat +Keywords[fr]=réseau,DNS,serveur de noms,routes,interfaces +Keywords[ga]=Líonra,DNS,róid,comhéadain +Keywords[gl]=Rede,DNS,rutas,interfaces +Keywords[he]=Network,DNS,routes,interfaces,רשת,כתובתשמות,ממשקים,נתיבים +Keywords[hr]=Network,DNS,routes,interfaces,mreža,preusmjeravanje,sučelja +Keywords[hu]=Hálózat,DNS,útvonalak,hálózati csatolók +Keywords[it]=Rete,DNS,route,interfacce +Keywords[ja]=ネットワーク,DNS,ルート,インターフェース +Keywords[ka]=ქსელი,DNS,ბილიკები,ინტერფეისი +Keywords[km]=បណ្ដាញ,DNS,ផ្លូវ,ចំណុចប្រទាក់ +Keywords[ko]=네트워크,DNS,인터페이스 +Keywords[lt]=Network,DNS,routes,interfaces,tinklas,DNS,maršrutai,sąsajos +Keywords[mk]=Network,DNS,routes,interfaces,Мрежа,рути,интерфејси +Keywords[nb]=Nettverk,DNS,ruter,grensesnitt +Keywords[nds]=Nettwark,DNS,route,Anslüss,Koppelsteed,Nettweg +Keywords[ne]=सञ्जाल, डीएनएस, मार्ग, इन्टरफेस +Keywords[nl]=netwerk,DNS,routes,interfaces,netwerkkaart +Keywords[nn]=nettverk,DNS,ruter,grensesnitt +Keywords[pa]=ਨੈੱਟਵਰਕ,DNS,ਰੂਟ,ਇੰਟਰਫੇਸ +Keywords[pl]=sieć,Internet,DNS,trasy,routowanie,rutowanie,interfejsy +Keywords[pt]=Rede,DNS,rotas,interfaces +Keywords[pt_BR]=Rede,DNS,rotas,interfaces +Keywords[ro]=Reţea,DNS,rute,interfeţe +Keywords[se]=Fierpmádat,DNS,routes,lavttat +Keywords[sl]=Network,DNS,routes,interfaces,omrežje,vmesniki,poti,usmerjanje +Keywords[sr]=Мрежа,DNS,руте,интерфејси +Keywords[sr@Latn]=Mreža,DNS,rute,interfejsi +Keywords[sv]=Nätverk,DNS,route,gränssnitt +Keywords[th]=เครือข่าย,DNS,routes,interfaces +Keywords[tr]=Ağ,DNS,routes,arayüzler +Keywords[uk]=Network,DNS,routes,interfaces,мережа,інтерфейси +Keywords[vi]=Network,mạng,DNS,routes,tuyến,interfaces,giao diện +Keywords[zh_CN]=Network,DNS,routes,interfaces,网络,路由,接口 +Keywords[zh_HK]=Network,DNS,routes,interfaces,網絡,路由,介面 +Keywords[zh_TW]=網路,DNS,路由,介面 diff --git a/knetworkconf/knetworkconf/kdetectdistrodlg.ui b/knetworkconf/knetworkconf/kdetectdistrodlg.ui new file mode 100644 index 0000000..bb97b4c --- /dev/null +++ b/knetworkconf/knetworkconf/kdetectdistrodlg.ui @@ -0,0 +1,73 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KDetectDistroDlg</class> +<widget class="QDialog"> + <property name="name"> + <cstring>KDetectDistroDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>415</width> + <height>56</height> + </rect> + </property> + <property name="caption"> + <string>Detecting Your Current Platform</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>pixmapLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>text</cstring> + </property> + <property name="text"> + <string>Please wait while detecting your current platform...</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="983">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000039e4944415418959595cd6b1d5518c67f934e9a776452cf40948e74915b2af6aa2897a6602a2e6e6a5d74e3dafe03d28f8d0b71292eba312808052964e34297154442119b2e44234aaca8ed151332c586ccd85cef1cc9e8bcd6938e8b9b7b136b6e4b5e18e683f33ef39ce77738c7abaa8a9dcaf33c2ebc7761e2e48993171179aaf75d7c50b7fd2e80822f557a3399bff4f1a557cf4f9f5ff47754dd2c33660e8931b50fafa6233a1c1019417c41a42baa4e290b8bae433caa4c3d1d3f89cf38707f6141867078577fb6941210858a31029b5d5a802d20cf721ae3c2e4213c600ff4870ca8615094b2005be44084aaed3bc6416e736ca1d876371175ca8385bbaeb13627d5a0eb3214284000ab8a1690decaa99b685be60f10ee0d1209d0a224b742a08a88609d82425e28b89e5301d7edf507d15ffd7515750c810ecfbc5627d8a42fbe30f753c247f342aa10f942eec088e9c6b369d587ddd39f3c1c33fb6302614ceee75da7b209747bc6bba53f7518ce4e8219035cb4a1ae048767dbd99f38fedaca7897f44b85bcc89150aa74256d6769f6a53a4d739bb7922469010cfd8f7e66b1ed9cbc2849db25a52d49db39d676e9ab2aea203631511879c7268e3ddc6834464a5b7e3077756ee6ec99b3edad28764bdf29eaba20adda3daa1a59b57beb8fd7ef1c7fe978b515850ff88288101b4142c184d29f8b55bd977e952c267fb4165bd7b4d0ebc952f2496bb1f5c3ece5d9fec6d35bc71e289111ac0fb18990b03b13754aa0c1bdf437d276ba9265f67d33666e34269aa5d95f9366f364f1fa1be7b61cdb759b0baccf9caeed5347d5fd1143aadd455faa828baa3e7d9beda9d7eb4fc4fbf55d09644dc2e0ae647c7eedfbefde02cabe70b2947c3b373cf7b6f85257a7e3b503b51722138d0294ae449d56c9cde4efec56f67be94ac17157550b2d744d9d2e4b68ee264baddfec9afdef1ebcf0d58277ea9553233317679acb3796bfe8dceedce9ac76aaceed4ed559ed54cbbf2c579dd54eb9f0cdc2a7d3e7a78f365f6c8e5cf9ec8a075055d58ed710c0916347aac644e31f09855cf31155f5d429aa8a557b5ffa83cadbfe72e6f499d1da78edb9c8442f9bd03c1bc5d133a52d35cbb3ebdbe87f3d7b7976bdd733f004ea3d4cbf333314c0a366bf79c86676b474fafcd489e6b9f9f9f9b56429b960c6cc8dda817a99acdc5c179f768ffe20e1feb669db69101c88df8c1f898f9ad16838f0794cc04c361a074d680e0ea23fa8fac2c94ab291173649b3741fb0577c10118b036b6de7bef477a87f018b9f681dd4db618a0000000049454e44ae426082</data> + </image> +</images> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/knetworkconf/knetworkconf/kdnsinfo.cpp b/knetworkconf/knetworkconf/kdnsinfo.cpp new file mode 100644 index 0000000..357bc49 --- /dev/null +++ b/knetworkconf/knetworkconf/kdnsinfo.cpp @@ -0,0 +1,61 @@ +/*************************************************************************** + kdnsinfo.cpp - description + ------------------- + begin : Sat Jan 18 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#include "kdnsinfo.h" + +KDNSInfo::KDNSInfo(){ +} +KDNSInfo::~KDNSInfo(){ +} +QStringList KDNSInfo::getNameServers(){ + return nameServers; +} +QString KDNSInfo::getDomainName(){ + return domainName; +} +QString KDNSInfo::getMachineName(){ + return machineName; +} + +QStringList KDNSInfo::getSearchDomains(){ + return searchDomains; +} +void KDNSInfo::setNameServers(const QStringList &nameServers){ + KDNSInfo::nameServers = nameServers; +} +void KDNSInfo::setDomainName(const QString &domain){ + KDNSInfo::domainName = domain; +} +void KDNSInfo::setMachineName(const QString &machine){ + KDNSInfo::machineName = machine; +} + +void KDNSInfo::setSearchDomains(const QStringList &searchDomains){ + KDNSInfo::searchDomains = searchDomains; +} +QPtrList<KKnownHostInfo> KDNSInfo::getKnownHostsList(){ + return knownHosts; +} +void KDNSInfo::addKnownHost(KKnownHostInfo *host){ + knownHosts.append(host); +} +bool KDNSInfo::removeKnownHost(int index){ + return knownHosts.remove(index); +} +void KDNSInfo::setKnownHostsList(QPtrList<KKnownHostInfo> hostsList){ + KDNSInfo::knownHosts = hostsList; +} diff --git a/knetworkconf/knetworkconf/kdnsinfo.h b/knetworkconf/knetworkconf/kdnsinfo.h new file mode 100644 index 0000000..e81a7cb --- /dev/null +++ b/knetworkconf/knetworkconf/kdnsinfo.h @@ -0,0 +1,55 @@ +/*************************************************************************** + kdnsinfo.h - description + ------------------- + begin : Sat Jan 18 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#ifndef KDNSINFO_H +#define KDNSINFO_H + +#include <qstring.h> +#include <qstringlist.h> +#include <qptrlist.h> +#include "kknownhostinfo.h" + +/** + *@author Juan Luis Baptiste + */ + +class KDNSInfo { +public: + KDNSInfo(); + ~KDNSInfo(); + QString getDomainName(); + QString getMachineName(); + QStringList getNameServers(); + QStringList getSearchDomains(); + void setNameServers(const QStringList &nameServer); + void setSearchDomains(const QStringList &searchDomains); + void setDomainName(const QString &domain); + void setMachineName(const QString &machine); + QPtrList<KKnownHostInfo> getKnownHostsList(); + void addKnownHost(KKnownHostInfo *host); + bool removeKnownHost(int index); + void setKnownHostsList(QPtrList<KKnownHostInfo> hostsList); +private: // Private attributes + QStringList nameServers; + QStringList searchDomains; + QString domainName; + QString machineName; + /** List of known hosts (/etc/hosts). */ + QPtrList<KKnownHostInfo> knownHosts; +}; + +#endif diff --git a/knetworkconf/knetworkconf/kinterfaceupdowndlg.ui b/knetworkconf/knetworkconf/kinterfaceupdowndlg.ui new file mode 100644 index 0000000..68285c4 --- /dev/null +++ b/knetworkconf/knetworkconf/kinterfaceupdowndlg.ui @@ -0,0 +1,104 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KInterfaceUpDownDlg</class> +<widget class="KDialog"> + <property name="name"> + <cstring>KInterfaceUpDownDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>253</width> + <height>44</height> + </rect> + </property> + <property name="caption"> + <string>Changing Interface State</string> + </property> + <property name="icon"> + <pixmap>image0</pixmap> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>pixmapLabel1</cstring> + </property> + <property name="pixmap"> + <pixmap>image1</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer12</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>label</cstring> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Bringing up interface <b>eth0</b>...</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="1012">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003bb49444154189595954f681d451cc73f9b6c9adf93973a0b0f794f3cf495886eeb9f1a5a685a7a48f0d25c84debd14415a4490209e8a781215052120855c04cf39a83c7a90f4505ac55a1525ddd204b7d092599b676724ebdb9f75dbf590e6352d49205f1866e630dff9f1fd0cbf09aaaa62330541c0cce733074f1c3f719650f61302258880eac659a05410a9d2a5e4fbce379d37cf7c786631dcd4f5819a8de6287569cf9df7c36e085a0d0380a90b5e1500e7335815a211cfd481f63e45f700db1b030382049d6b16ea6dc42acd8641011912bc5354057bcb72643462725403096510605b63a909bef414b9e0738b69b450cd1011b4542805e72d3e079b392823bcfab58ab633d65231a1c17b8bed2abe6b29146c572972b05d8be682bd69a104a70e236b716d5b7124115a2a2211da7538df42d52262f0a507155c9e4159c3ab47c226fa20fb702bfa7796efa0ca80840ccdbe13133da02f22747e4d98bb6c487388a4892b339af5e6c357b25ef14ee94fbed0a6f37b424bda386fa161d05021947ec6eb51ec88fed4f3caf431410cd468dd2bd62e0fb22cfd47905edf78a7f4b58cb0ded2ae4b75f546daf5d65ff4a5b7cebb24594c92feabd839fd8276a34d2451307978f2c9f89578989c2fe7cfcfcf4ebf3ddded1b3f425f1dce439659342fc8ba16f560bb1be8c3da2c42966783944436b7bbe267e3bb47278f56fd280a0a442244a0dd688108c6445016d4c216362f1ea75fd9d4fe9d2c26bfa02c24d792afd3c5f4b7b97373fdc61302d4c25aa0a52332069f2b2d13217545c2165a7a5a123d4eff5e9aa5b7b2cc7f611ae6eaf8c1a9c23413199f98cadf7def8d87155b67dd7838befad5a9f66e858a92809001cd154283cb951aadaa4fbf9b0e8ebd38f69c6dbacfcc48b482703feaca77977ebaf40150f48dd3a5f47267a8f3712451ecd4ed89f7c4c76af5da888482cb1d40f5f352f2afbfe9ff72a5134aeeab6a4ece8a2ffd1f5237f7d3a5e44fbfe21fedc10b97168293af9f1c9e3d3b3bb17c7df942ef76ef6eef76af5a1fcbd797abdeed5e71e5c72bdfce7c347368e2d589e18bf3170380aaaa361d0300fb8fecafe203f17fa66eb0b91dd65203af1e2d952ccfb6a5bf95828d9bd3a74e8fec1bdd7758eaf25a336abe1c35a29734574d57d2850df47f983b37b7ba7e66cb1f687df1c9a7b30311f29434e509cd74c495fee8d4f1a9b7ce5f985f4997d219d33057e367c68ae456b22aa174d7e96f65dc6f9bea5d4d9bd1fb712b3ee4467428169ea62cccc4a1f1bda66ef66e457f2bf58d931bc93de3a3d46676b720bb081511f194a05eef6c4b7f13fd0f228d8a497c524ca50000000049454e44ae426082</data> + </image> + <image name="image1"> + <data format="PNG" length="762">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000002c1494441541895ed9531885c451880bfbb1be53fd80bf3e08a3770c53d30920d415d63c08da4b80521ac08e6c4c2159b9c9da28556c6d280bd90ee62212798e813536c0ae1b6bb8045163de28be4e0ad26304f387c532cec5f3c588bdb88987b5a1c58f9373f33ffccc70fdffc0cfc1fb398ab2b7c75edce6fe15e98be75e98557e43c77ec6b80ce8ae6200940355b57b38d31d3d17b8c4d1d38dccfefd3884ec7e7e593ce87f193ce46f8a05889d1b0888409b764801550b548c3a263c55741317a61be0e9c0ed21b1607224b6f9fdb70dde596dbca9bee8322721b2b171dc3c4c92a2e58dcfa735de76ce23acfac3b0d9250f1746dc7bd97df37452811a4f204dc7293afcf0c111132fa9c7c3322d0e66ca3837c971074137fa6206a580ac25c2d5851ec2c47085a4514ab508e1545c9aa8ca671f80725e5c893579ef85c4219140cd35ab09588821c96047bcf232b2db643a035ee926b8e5b8ec943413b7e96a2a59c9426c8227de94305a6ce7eae3f3d0e118a2e44a3826d4d913826bb5992d90c7bbccda2e9908d6fe1071332c9e89ee8a27af04a4c9dfd42ae2c4d0aa1b7d27aea8d6a9b685f983c105ccb918f3decde46f736d0b52d26a7400d447723a421000b261da4372ebef8d1e987f6d5e77486813c02ff448fadcffb8ff1fa00af4aef448f61e1e9acb6d9dcfd82e2b3cb3ff20dbb18e6015252a89807f6cd91ecef87efd9e75dfe1c19e060e8a6e688f67fa16272987c7344fbbf3eecf01170d0128b452bc58d02db558a8d57c9af4fc86c46d45c03eaed533d0afd4bc7256260e7548295843cdce6ec858474ef32cd518fcc07c2f1c3edd7cdc1ac63405978d5c5507a5e5a694218b2b376898faf6f72f5d3c14de0f7c3ecd782e3289151c850cf78e3cad57102c6ab4c9d1182083ba30cf6b8067c7998fd3af05cfbf9f5b510f49dec6eff5ba0008efdedc202f033f0431de49fe21810fdcb99da4fe13f8d3f00866a861c3ad7f9ad0000000049454e44ae426082</data> + </image> +</images> +<includes> + <include location="local" impldecl="in implementation">kinterfaceupdowndlg.ui.h</include> +</includes> +<slots> + <slot>close()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kdialog.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/kinterfaceupdowndlg.ui.h b/knetworkconf/knetworkconf/kinterfaceupdowndlg.ui.h new file mode 100644 index 0000000..4a5fc41 --- /dev/null +++ b/knetworkconf/knetworkconf/kinterfaceupdowndlg.ui.h @@ -0,0 +1,16 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** Qt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + + + + +void KInterfaceUpDownDlg::close() +{ + accept(); +} diff --git a/knetworkconf/knetworkconf/kknownhostinfo.cpp b/knetworkconf/knetworkconf/kknownhostinfo.cpp new file mode 100644 index 0000000..7e779f1 --- /dev/null +++ b/knetworkconf/knetworkconf/kknownhostinfo.cpp @@ -0,0 +1,42 @@ +/*************************************************************************** + KKnownHostInfo.cpp - description + ------------------- + begin : Sun May 11 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : juancho@linuxmail.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. * + * * + ***************************************************************************/ + +#include "kknownhostinfo.h" + +KKnownHostInfo::KKnownHostInfo(){ +} +KKnownHostInfo::~KKnownHostInfo(){ +} +/** No descriptions */ +QString KKnownHostInfo::getIpAddress(){ + return ipAddress; +} + +QStringList KKnownHostInfo::getAliases(){ + return aliases; +} +void KKnownHostInfo::setIpAddress(QString ipAddress){ + KKnownHostInfo::ipAddress = ipAddress; +} + +void KKnownHostInfo::addAlias(QString alias){ + KKnownHostInfo::aliases.append(alias); +} + +void KKnownHostInfo::setAliases(QStringList aliases){ + KKnownHostInfo::aliases = aliases; +} diff --git a/knetworkconf/knetworkconf/kknownhostinfo.h b/knetworkconf/knetworkconf/kknownhostinfo.h new file mode 100644 index 0000000..584639e --- /dev/null +++ b/knetworkconf/knetworkconf/kknownhostinfo.h @@ -0,0 +1,44 @@ +/*************************************************************************** + KKnownHostInfo.h - description + ------------------- + begin : Sun May 11 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : juancho@linuxmail.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. * + * * + ***************************************************************************/ + +#ifndef KKNOWNHOSTINFO_H +#define KKNOWNHOSTINFO_H + +#include <qstring.h> +#include <qstringlist.h> + +/**Class that represents an entry in the /etc/hosts file. + *@author Juan Luis Baptiste + */ + +class KKnownHostInfo { +public: + KKnownHostInfo(); + ~KKnownHostInfo(); + QStringList getAliases(); + QString getIpAddress(); + void setAliases(QStringList aliases); + void addAlias(QString alias); + void setIpAddress(QString ipAddress); +private: // Private attributes + /** IP address of the known Host. */ + QString ipAddress; + /** Lists of aliases of the known host. */ + QStringList aliases; +}; + +#endif diff --git a/knetworkconf/knetworkconf/knetworkconf.cpp b/knetworkconf/knetworkconf/knetworkconf.cpp new file mode 100644 index 0000000..bc39c0e --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconf.cpp @@ -0,0 +1,1186 @@ +/*************************************************************************** + knetworkconf.cpp - description + ------------------- + begin : Sun Jan 12 8:54:19 UTC 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#include <kiconloader.h> + +#include "knetworkconf.h" + +KNetworkConf::KNetworkConf(QWidget *parent, const char *name) : DCOPObject("KNetworkConfIface"), KNetworkConfDlg(parent, name) +{ + netInfo = 0L; + makeButtonsResizeable(); + config = new KNetworkConfigParser(); + klvCardList->setAllColumnsShowFocus(true); + klvKnownHosts->setAllColumnsShowFocus(true); + klvProfilesList->setAllColumnsShowFocus(true); + klvProfilesList->setRenameable(0,true); + klvProfilesList->setRenameable(1,true); + QToolTip::remove( &(QListView)klvProfilesList ); + tooltip = new KProfilesListViewToolTip(klvProfilesList); + + //Connect signals emmitted by the backend to know when data is ready to be painted. + connect(config,SIGNAL(readyLoadingNetworkInfo()),this,SLOT(getNetworkInfoSlot())); + connect(config,SIGNAL(readyLoadingNetworkInfo()),this,SLOT(showMainWindow())); + connect(config,SIGNAL(readyLoadingNetworkInfo()),this,SLOT(enableSignals())); + connect(config, SIGNAL(setReadOnly(bool)),this,SLOT(setReadOnlySlot(bool))); + connect(klvCardList, + SIGNAL(contextMenu(KListView*,QListViewItem*,const QPoint&)), + this, + SLOT(showInterfaceContextMenuSlot(KListView*,QListViewItem*, const QPoint&))); + + // Register with DCOP - No longer needed as now we are a kcontrol module? + if ( !kapp->dcopClient()->isRegistered() ) { + kapp->dcopClient()->registerAs( "knetworkconf" ); + kapp->dcopClient()->setDefaultObject( objId() ); + } + + //Temporarly added while gst supports routing option. +// cbEnableRouting->hide(); +} + +KNetworkConf::~KNetworkConf() +{ + delete config; +} + +void KNetworkConf::getNetworkInfoSlot() +{ + netInfo = config->getNetworkInfo(); + if (netInfo == NULL) + { + KMessageBox::error(this, + i18n("Could not load network configuration information."), + i18n("Error Reading Configuration File")); + //kapp->quit(); + //exit(1); + } + else + { + //QPtrList<KNetworkInterface> deviceList; + routingInfo = netInfo->getRoutingInfo(); + dnsInfo = netInfo->getDNSInfo(); + profilesList = netInfo->getProfilesList(); + + loadNetworkDevicesInfo(); + loadRoutingInfo(); + loadDNSInfo(); + loadNetworkProfiles(); + nameServersModified = false; + devicesModified = false; + modified = false; +// kpbApply->setEnabled(false); + } + +} + +/** + Fill the Listview with the info of the network interfaces. +*/ +void KNetworkConf::loadNetworkDevicesInfo() +{ + KNetworkInterface *device; + QPixmap activeEthernetDeviceImg(locate("icon","hicolor/22x22/actions/network_connected_lan_knc.png")); + QPixmap inactiveEthernetDeviceImg(locate("icon","hicolor/22x22/actions/network_disconnected_lan.png")); + QPixmap activeWirelessDeviceImg(locate("icon","hicolor/22x22/actions/network_traffic_wlan.png")); + QPixmap inactiveWirelessDeviceImg(locate("icon","hicolor/22x22/actions/network_disconnected_wlan.png")); + + klvCardList->clear(); + QPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList(); + for (device = deviceList.first(); device; device = deviceList.next()) + { + if ( device->getType() != "loopback" ) + { + if (klvCardList->findItem(device->getDeviceName(),0,CaseSensitive|ExactMatch) == 0) + { + QListViewItem * item = new QListViewItem( klvCardList, 0 ); + + if (device->isActive()) + { + if (device->getType() == "ethernet") + item->setPixmap(0,activeEthernetDeviceImg); + else if (device->getType() == "wireless") + item->setPixmap(0,activeWirelessDeviceImg); + + item->setText(3,i18n("Enabled")); + item->setPixmap(3,SmallIcon("ok")); + } + else + { + if (device->getType() == "ethernet") + item->setPixmap(0,inactiveEthernetDeviceImg); + else if (device->getType() == "wireless") + item->setPixmap(0,inactiveWirelessDeviceImg); + + item->setText(3,i18n("Disabled")); + item->setPixmap(3,SmallIcon("stop")); + if (device->getBootProto().lower() == "dhcp") + item->setText(1,""); + } + + item->setText(0,device->getDeviceName()); + item->setText(1,device->getIpAddress()); + if (device->getBootProto() == "none") + item->setText(2,i18n("Manual")); + else + item->setText(2,device->getBootProto()); + item->setText(4,device->getDescription()); + QStringList l = deviceNamesList.grep(device->getDeviceName()); + if (l.size() == 0) + deviceNamesList.append(device->getDeviceName()); + } + } + } +} + + +/** Terminates the application + */ +void KNetworkConf::quitSlot(){ + int code = 0; + connect( config, SIGNAL(readyLoadingNetworkInfo()), this, SLOT(quitSlot()) ); + if (modified) + { + code = KMessageBox::warningYesNoCancel(this, + i18n("The new configuration has not been saved.\nDo you want to apply changes before quitting?"), + i18n("New Configuration Not Saved"),KStdGuiItem::apply(),KStdGuiItem::quit()); + if (code == KMessageBox::Yes) + saveInfoSlot(); + else if (code == KMessageBox::No) + kapp->quit(); + } + else + kapp->quit(); +} +/** Enables the configure and remove buttons. */ +void KNetworkConf::enableButtonsSlot(){ + if (!readOnly) + { + kpbConfigureNetworkInterface->setEnabled(true); + QListViewItem *item = klvCardList->currentItem(); + QString currentDevice = item->text(0); + KNetworkInterface *dev = getDeviceInfo(currentDevice); + + if (dev->isActive()) + { + kpbUpButton->setEnabled(false); + kpbDownButton->setEnabled(true); + } + else + { + kpbUpButton->setEnabled(true); + kpbDownButton->setEnabled(false); + } + } +} +/** opens the add server dialog. */ +void KNetworkConf::addServerSlot(){ + KAddDNSServerDlg addDlg(this, 0); + addDlg.exec(); + if(addDlg.modified()) + { + klbDomainServerList->insertItem(addDlg.kleNewServer->text()); + nameServersModified = true; + enableApplyButtonSlot(); + } +} +/** opens the edit server dialog. */ +void KNetworkConf::editServerSlot(){ + KAddDNSServerDlg dlg(this, 0); + if (klbDomainServerList->currentItem() >= 0) + { + int currentPos = klbDomainServerList->currentItem(); + dlg.setCaption(i18n("Edit Server")); + QListBoxItem *item = klbDomainServerList->item(currentPos); + QString currentText = item->text(); + dlg.kleNewServer->setText(currentText); + dlg.kpbAddServer->setText(i18n("&OK")); + dlg.exec(); + + if(dlg.modified()) + { + klbDomainServerList->changeItem(dlg.kleNewServer->text(),currentPos); + nameServersModified = true; + enableApplyButtonSlot(); + } + } +} + +/** Pops up the window for adding a new interface. */ +void KNetworkConf::configureDeviceSlot(){ + QListViewItem *item = klvCardList->currentItem(); + KWirelessInterface *wifiDev = NULL; + + //KAddDeviceContainer *configDlg = new KAddDeviceContainer(this,0); + KAddDeviceContainer configDlg(this,0); + + if (item != NULL) + { + QString currentDevice = item->text(0); + configDlg.setCaption(i18n("Configure Device %1").arg(currentDevice)); + KNetworkInterface *dev = getDeviceInfo(currentDevice); + KAddDeviceDlgExtension *advancedOptions = (KAddDeviceDlgExtension *)configDlg.extension(); + + if (dev->getBootProto() == "none") + { + configDlg.addDlg->rbBootProtoManual->setChecked(true); + configDlg.addDlg->rbBootProtoAuto->setChecked(false); + } + else if (dev->getBootProto().lower() == "dhcp") + { + configDlg.addDlg->kcbAutoBootProto->setCurrentItem(0); + configDlg.addDlg->rbBootProtoManual->setChecked(false); + configDlg.addDlg->rbBootProtoAuto->setChecked(true); + configDlg.addDlg->kleIPAddress->setEnabled(false); + configDlg.addDlg->kcbNetmask->setEnabled(false); + configDlg.kpbAdvanced->setEnabled(false); + } + else if (dev->getBootProto().lower() == "bootp") + { + configDlg.addDlg->kcbAutoBootProto->setCurrentItem(1); + configDlg.addDlg->rbBootProtoManual->setChecked(false); + configDlg.addDlg->rbBootProtoAuto->setChecked(true); + configDlg.kpbAdvanced->setEnabled(false); + } + if (dev->getOnBoot() == "yes") + configDlg.addDlg->kcbstartAtBoot->setChecked(true); + else + { + configDlg.addDlg->kcbstartAtBoot->setChecked(false); + } + configDlg.addDlg->kleIPAddress->setText(dev->getIpAddress()); + advancedOptions->kleDescription->setText(dev->getDescription()); + if (!dev->getBroadcast().isEmpty()) + advancedOptions->kleBroadcast->setText(dev->getBroadcast()); + else + advancedOptions->kleBroadcast->setText(KAddressValidator::calculateBroadcast(dev->getIpAddress(),dev->getNetmask())); + + advancedOptions->kleGateway->setText(dev->getGateway()); + + if (!dev->getNetmask().isEmpty()) + configDlg.addDlg->kcbNetmask->setCurrentText(dev->getNetmask()); + + if (readOnly) + { + configDlg.addDlg->kcbAutoBootProto->setEnabled(false); + configDlg.addDlg->kcbstartAtBoot->setEnabled(false); + advancedOptions->gbAdvancedDeviceInfo->setEnabled(false); + } + + //If the interface is wireless, then add the wireless configuration widget + if (dev->getType() == WIRELESS_IFACE_TYPE){ + wifiDev = static_cast<KWirelessInterface*>(dev); + configDlg.addWirelessWidget(); + configDlg.extDlg->kleEssid->setText(wifiDev->getEssid()); + configDlg.extDlg->kleWepKey->setText(wifiDev->getWepKey()); + if (wifiDev->getKeyType() == WIRELESS_WEP_KEY_TYPE_ASCII) + configDlg.extDlg->qcbKeyType->setCurrentItem(0); + else if (wifiDev->getKeyType() == WIRELESS_WEP_KEY_TYPE_HEXADECIMAL) + configDlg.extDlg->qcbKeyType->setCurrentItem(1); + } + + configDlg.addButtons(); + //Disable Apply button so it only is enabled when a change is made + configDlg.kpbApply->setEnabled(false); + configDlg.exec(); + + if (configDlg.modified()) + { + if(configDlg.addDlg->rbBootProtoManual->isChecked()) + { + item->setText(2,i18n("Manual")); + dev->setBootProto("none"); + } + //If the selected boot protocol is dhcp or bootp (Auto), then we don't need the + //past IP address, netmask, network and broadcast, as a new one will be assigned by + //the dhcp server. + else if (configDlg.addDlg->rbBootProtoAuto->isChecked()) + { + if (configDlg.addDlg->kcbAutoBootProto->currentText() != dev->getBootProto()) + { + dev->setIpAddress(""); + configDlg.addDlg->kleIPAddress->setText(""); + dev->setGateway(""); + dev->setNetmask(""); + dev->setNetwork(""); + dev->setBroadcast(""); + } + item->setText(2,configDlg.addDlg->kcbAutoBootProto->currentText()); + dev->setBootProto(configDlg.addDlg->kcbAutoBootProto->currentText()); + } + item->setText(1,configDlg.addDlg->kleIPAddress->text()); + item->setText(4,advancedOptions->kleDescription->text()); + + if (valuesChanged(dev, + configDlg.addDlg->kcbAutoBootProto->currentText(), + configDlg.addDlg->kcbNetmask->currentText(), + configDlg.addDlg->kleIPAddress->text(), + advancedOptions->kleGateway->text(), + configDlg.addDlg->kcbstartAtBoot->isChecked(), + advancedOptions->kleDescription->text(), + advancedOptions->kleBroadcast->text())) + { + dev->setIpAddress(configDlg.addDlg->kleIPAddress->text().stripWhiteSpace()); + dev->setGateway(advancedOptions->kleGateway->text().stripWhiteSpace()); + dev->setNetmask(configDlg.addDlg->kcbNetmask->currentText().stripWhiteSpace()); + QString network = KAddressValidator::calculateNetwork(dev->getIpAddress().stripWhiteSpace(),dev->getNetmask().stripWhiteSpace()); + dev->setNetwork(network); + QString broadcast = advancedOptions->kleBroadcast->text().stripWhiteSpace(); + if (broadcast.isEmpty()) + broadcast = KAddressValidator::calculateBroadcast(dev->getIpAddress().stripWhiteSpace(),dev->getNetmask().stripWhiteSpace()); + dev->setBroadcast(broadcast); + dev->setDescription(advancedOptions->kleDescription->text()); + + if (configDlg.addDlg->kcbstartAtBoot->isChecked()) + dev->setOnBoot("yes"); + else + dev->setOnBoot("no"); + } + //If the interface is wireless, then save the wireless configuration options + if (dev->getType() == WIRELESS_IFACE_TYPE){ + wifiDev->setEssid(configDlg.extDlg->kleEssid->text()); + wifiDev->setWepKey(configDlg.extDlg->kleWepKey->password()); + wifiDev->setKeyType(configDlg.extDlg->qcbKeyType->currentText()); + dev = wifiDev; + } + devicesModified = true; + enableApplyButtonSlot(); + } + } +} + +/**Returns the info of the network device 'device or NULL if not found.'*/ +KNetworkInterface * KNetworkConf::getDeviceInfo(QString device){ + QPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList(); + QPtrListIterator<KNetworkInterface> i(deviceList); + KNetworkInterface *temp; + while ((temp = i.current()) != 0) + { + if (temp->getDeviceName() == device) + { + return temp; + } + ++i; + } + return NULL; +} + +/**Returns the name of the network device that corresponds to the IP address 'ipAddr' or NULL if not found.'*/ +QString KNetworkConf::getDeviceName(QString ipAddr){ + QPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList(); + QPtrListIterator<KNetworkInterface> i(deviceList); + KNetworkInterface *temp; + while ((temp = i.current()) != 0) + { + if (temp->getIpAddress().compare(ipAddr) == 0) + { + return temp->getDeviceName(); + } + ++i; + } + return NULL; +} + + +/** Looks in the output returned by ifconfig to see if there are the devices up or down.*/ +void KNetworkConf::readFromStdout(){ + commandOutput = ""; + commandOutput += procUpdateDevice->readStdout(); +} + +/** Loads the info about the default gateway and host and domain names. */ +void KNetworkConf::loadRoutingInfo(){ + //routingInfo = config->getNetworkInfoSlot(); + if (!routingInfo->getGateway().isEmpty()) + kleDefaultRoute->setText(routingInfo->getGateway()); + else + { + //Take the default gateway from the gateway field of the default gateway interface + //because some platforms (Debian-like ones) seems that don't handle the concept of a default + //gateway, instead a gateway per interface. + KNetworkInterface *device; + QString defaultGwDevice = routingInfo->getGatewayDevice(); + QPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList(); + for (device = deviceList.first(); device; device = deviceList.next()) + { + if ( device->getDeviceName() == defaultGwDevice ) + { + if ( !device->getGateway().isEmpty() ) + { + kleDefaultRoute->setText(device->getGateway()); + } + } + } + } + + kcbGwDevice->clear(); + kcbGwDevice->insertStringList(deviceNamesList); + if (!routingInfo->getGatewayDevice().isEmpty()) + kcbGwDevice->setCurrentText(routingInfo->getGatewayDevice()); +/* if (routingInfo->isForwardIPv4Enabled().compare("yes") == 0) + cbEnableRouting->setChecked(true); + else + cbEnableRouting->setChecked(false);*/ +} + +void KNetworkConf::loadDNSInfo(){ + QStringList nameServers; + if (dnsInfo == NULL) + KMessageBox::error(this,i18n("Could not open file '/etc/resolv.conf' for reading."), + i18n("Error Loading Config Files")); + else + { + kleHostName->setText(dnsInfo->getMachineName()); + kleDomainName->setText(dnsInfo->getDomainName()); + klbDomainServerList->clear(); + nameServers = dnsInfo->getNameServers(); + for ( QStringList::Iterator it = nameServers.begin(); it != nameServers.end(); ++it) + { + klbDomainServerList->insertItem(*it); + } + klvKnownHosts->clear(); + knownHostsList = dnsInfo->getKnownHostsList(); + QPtrListIterator<KKnownHostInfo> it(knownHostsList); + KKnownHostInfo *host; + while ((host = it.current()) != 0) + { + ++it; + if (!(host->getIpAddress().isEmpty())) + { + QListViewItem * item = new QListViewItem( klvKnownHosts, 0 ); + item->setText(0,host->getIpAddress()); + QStringList aliasesList = host->getAliases(); + QString aliases; + for ( QStringList::Iterator it = aliasesList.begin(); it != aliasesList.end(); ++it ) + { + aliases += *it+" "; + } + item->setText(1,aliases); + } + } + } +} + +void KNetworkConf::loadNetworkProfiles(){ + QPtrListIterator<KNetworkInfo> it(profilesList); + KNetworkInfo *profile = NULL; + + klvProfilesList->clear(); + while ((profile = it.current()) != 0) + { + ++it; + if (!profile->getProfileName().isEmpty()) + { + QListViewItem * item = new QListViewItem( klvProfilesList, 0 ); + item->setText(0,profile->getProfileName()); + } + } +} + +/** Shows the help browser. Hopefully some day it will be one :-). */ +void KNetworkConf::helpSlot(){ + kapp->invokeHelp(); +} + +/** No descriptions */ +void KNetworkConf::aboutSlot(){ + KAboutApplication *about = new KAboutApplication(kapp->aboutData(),0); + + // about->setLogo(locate("icon","knetworkconf.png")); + //qDebug("locate icon= %s",locate("icon","knetworkconf.png").latin1()); + + about->show(); +} +/** No descriptions */ +void KNetworkConf::enableApplyButtonSlot(){ + //if (!readOnly) + //kpbApply->setEnabled(true); + modified = true; + emit networkStateChanged(true); +} +/** Puts the application in read-only mode. This happens when the user runing +the application t root. */ +void KNetworkConf::setReadOnly(bool state){ + KNetworkConf::readOnly = state; +} +/** No descriptions */ +void KNetworkConf::enableApplyButtonSlot(const QString &text){ + enableApplyButtonSlot(); +} +/** No descriptions */ +void KNetworkConf::enableApplyButtonSlot(bool){ + enableApplyButtonSlot(); +} +/** No descriptions */ +void KNetworkConf::removeServerSlot(){ + if (klbDomainServerList->currentItem() >= 0) + { + klbDomainServerList->removeItem(klbDomainServerList->currentItem()); + enableApplyButtonSlot(); + } +} +void KNetworkConf::moveUpServerSlot(){ + int curPos = klbDomainServerList->currentItem(); + int antPos = klbDomainServerList->currentItem() - 1; + + if (antPos >= 0) + { + QListBoxItem *current = klbDomainServerList->item(curPos); + QListBoxItem *ant = current->prev(); + QString antText = ant->text(); + klbDomainServerList->removeItem(antPos); + klbDomainServerList->insertItem(antText,curPos); + enableApplyButtonSlot(); + } +} +void KNetworkConf::moveDownServerSlot(){ + int curPos = klbDomainServerList->currentItem(); + unsigned nextPos = klbDomainServerList->currentItem() + 1; + + if (curPos != -1) + { + if (klbDomainServerList->count() >= nextPos) + { + QListBoxItem *current = klbDomainServerList->item(curPos); + QString curText = current->text(); + klbDomainServerList->removeItem(curPos); + klbDomainServerList->insertItem(curText,nextPos); + klbDomainServerList->setSelected(nextPos,true); + enableApplyButtonSlot(); + } + } +} +/** Disables all buttons a line edit widgets when the user has read only access. */ +void KNetworkConf::disableAll(){ + kleHostName->setReadOnly(true); + kleDomainName->setReadOnly(true); + tlDomainName->setEnabled(false); + tlHostName->setEnabled(false); + disconnect(klvCardList,SIGNAL(doubleClicked(QListViewItem *)),this,SLOT(configureDeviceSlot())); + klvCardList->setEnabled(false); + kpbUpButton->setEnabled(false); + kpbDownButton->setEnabled(false); + kpbConfigureNetworkInterface->setEnabled(false); + gbDefaultGateway->setEnabled(false); + gbDNSServersList->setEnabled(false); + gbKnownHostsList->setEnabled(false); +// gbNetworkOptions->setEnabled(false); +} + +/** Saves all the modified info of devices, routes,etc. */ +void KNetworkConf::saveInfoSlot(){ + config->setProgramVersion(getVersion()); + + if (!KAddressValidator::isValidIPAddress(kleDefaultRoute->text()) && (!(kleDefaultRoute->text().isEmpty()))) + { + KMessageBox::error(this,i18n("The default Gateway IP address is invalid."),i18n("Invalid IP Address")); + } + else + { + //Update DNS info + routingInfo->setDomainName(kleDomainName->text()); + routingInfo->setHostName(kleHostName->text()); + dnsInfo->setDomainName(kleDomainName->text()); + dnsInfo->setMachineName(kleHostName->text()); + dnsInfo->setNameServers(getNamserversList(klbDomainServerList)); + dnsInfo->setKnownHostsList(getKnownHostsList(klvKnownHosts)); + + //Update routing info + routingInfo->setGateway(kleDefaultRoute->text()); + if (routingInfo->getGateway().isEmpty()) + routingInfo->setGatewayDevice(""); + + if (!kleDefaultRoute->text().isEmpty()) + routingInfo->setGatewayDevice(kcbGwDevice->currentText()); + + //Save all info + //netInfo->setDeviceList(deviceList); + netInfo->setRoutingInfo(routingInfo); + netInfo->setDNSInfo(dnsInfo); + + //Add the default gateway to the gateway field of the default gateway interface + //because some platforms (Debian-like ones) get the default gateway from there + //instead from the default gateway field. funny huh? + KNetworkInterface *device; + QString defaultGwDevice = routingInfo->getGatewayDevice(); + QString defaultGwAddress = routingInfo->getGateway(); + QPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList(); + for (device = deviceList.first(); device; device = deviceList.next()) + { + if ( device->getGateway().length() == 0 ) + { + if ( device->getDeviceName() == defaultGwDevice ) + { + device->setGateway(defaultGwAddress); + } + } + } + + config->saveNetworkInfo(netInfo); + modified = false; + } +} +/** Creates a QStringList with the IP addresses contained in the QListBox of name servers. */ +QStringList KNetworkConf::getNamserversList(KListBox * serverList){ + QStringList list; + for (unsigned i = 0; i < serverList->count(); i++) + { + list.append(serverList->text(i)); + } + return list; +} +/** Creates a QPtrList<KKownHostInfo> with the info contained in the KListView of name servers. */ +QPtrList<KKnownHostInfo> KNetworkConf::getKnownHostsList(KListView * hostsList){ + QPtrList<KKnownHostInfo> list; + QListViewItem *it = hostsList->firstChild(); + for (int i = 0; i < hostsList->childCount(); i++) + { + KKnownHostInfo *host = new KKnownHostInfo(); + + if (!(it->text(0).isEmpty())) + { + host->setIpAddress(it->text(0)); +// host->setHostName(it->text(1)); + host->setAliases(QStringList::split(" ",it->text(1))); + it = it->nextSibling(); + list.append(host); + } + } + return list; +} + +QString KNetworkConf::getVersion(){ + return version; +} +void KNetworkConf::setVersion(QString ver){ + KNetworkConf::version = ver; +} + +/** Changes the state of device 'dev' to DEVICE_UP or DEVICE_DOWN. +Return true on success, false on failure. */ +void KNetworkConf::changeDeviceState(const QString &dev, int state){ + // If the text "Changing device state" is user visible it cannot be the + // name parameter to the constructor. + KInterfaceUpDownDlg* dialog = new KInterfaceUpDownDlg(this,"Changing device state"); + + if (state == DEVICE_UP) + dialog->label->setText(i18n("Enabling interface <b>%1</b>").arg(dev)); + else + dialog->label->setText(i18n("Disabling interface <b>%1</b>").arg(dev)); + + dialog->setModal(true); + dialog->show(); + + procDeviceState = new QProcess(this); + QString cmd; + procDeviceState->addArgument( locate("data",BACKEND_PATH) ); + + //If the platform couldn't be autodetected specify it manually + if (netInfo->getPlatformName() != QString::null) + { + procDeviceState->addArgument( "--platform" ); + procDeviceState->addArgument( netInfo->getPlatformName() ); + } + procDeviceState->addArgument( "-d" ); + + if (state == DEVICE_UP) + procDeviceState->addArgument("enable_iface::"+dev+"::1" ); + else if (state == DEVICE_DOWN) + procDeviceState->addArgument("enable_iface::"+dev+"::0" ); + + connect( procDeviceState, SIGNAL(readyReadStdout()),this, SLOT(readFromStdoutUpDown()) ); + connect( procDeviceState, SIGNAL(readyReadStderr()),this, SLOT(readFromStdErrUpDown()) ); + connect( procDeviceState, SIGNAL(processExited()),this, SLOT(verifyDeviceStateChanged()) ); + connect( procDeviceState, SIGNAL(processExited()), dialog, SLOT(close()) ); + + currentDevice = dev; + commandOutput = ""; + + if ( !procDeviceState->start() ) + { + // error handling + KMessageBox::error(this, + i18n("Could not launch backend to change network device state. You will have to do it manually."), + i18n("Error")); + dialog->close(); + } + +} +void KNetworkConf::readFromStdoutUpDown(){ + commandOutput.append(procDeviceState->readStdout()); +} + +void KNetworkConf::verifyDeviceStateChanged(){ + KNetworkInterface *dev; + QPixmap activeEthernetDeviceImg(BarIcon("network_connected_lan_knc")); + QPixmap inactiveEthernetDeviceImg(BarIcon("network_disconnected_lan")); + QPixmap activeWirelessDeviceImg(BarIcon("network_traffic_wlan")); + QPixmap inactiveWirelessDeviceImg(BarIcon("network_disconnected_wlan")); + + commandOutput = commandOutput.section('\n',1); + if (commandErrOutput.length() > 0) + { + KMessageBox::error(this, + i18n("There was an error changing the device's state. You will have to do it manually."), + i18n("Could Not Change Device State")); + + } + else if (commandOutput == "\n<!-- GST: end of request -->") + { + QListViewItem *item = klvCardList->findItem(currentDevice,0,ExactMatch); + if (item != NULL) + { + dev = getDeviceInfo(currentDevice); + if (!dev->isActive()) + { + dev->setActive(true); + if (dev->getType() == "ethernet") + item->setPixmap(0,activeEthernetDeviceImg); + else if (dev->getType() == "wireless") + item->setPixmap(0,activeWirelessDeviceImg); + + item->setText(3,i18n("Enabled")); + item->setPixmap(3,SmallIcon("ok")); +// config->runDetectionScript(netInfo->getPlatformName()); + config->listIfaces(netInfo->getPlatformName()); +// item->setText(1,dev->getIpAddress()); + } + else + { + dev->setActive(false); + if (dev->getType() == "ethernet") + item->setPixmap(0,inactiveEthernetDeviceImg); + else if (dev->getType() == "wireless") + item->setPixmap(0,inactiveWirelessDeviceImg); + + item->setText(3,i18n("Disabled")); + item->setPixmap(3,SmallIcon("stop")); + if (dev->getBootProto().lower() == "dhcp") + item->setText(1,""); + } + enableButtonsSlot(); + } + } +} +/** Returns a list of strings of all the configured devices. */ +QStringList KNetworkConf::getDeviceList(){ + QStringList list; + KNetworkInterface * device; + QPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList(); + for (device = deviceList.first(); device; device = deviceList.next()) + { + list.append(device->getDeviceName()); + } + return list; +} +/** No descriptions */ +bool KNetworkConf::valuesChanged(KNetworkInterface *dev, + QString bootProto, + QString netmask, + QString ipAddr, + QString gateway, + bool onBoot, + QString desc, + QString broadcast){ + if ((dev->getBootProto() != bootProto) || + (dev->getNetmask() != netmask) || + (dev->getIpAddress() != ipAddr) || + (dev->getGateway() != gateway) || + ((dev->getOnBoot() == "yes") && !(onBoot)) || + ((dev->getOnBoot() == "no") && (onBoot)) || + (dev->getDescription() != desc) || + (dev->getBroadcast() != broadcast)) + return true; + else + return false; +} + +/** Sets the QPushButton::autoResize() in true for all buttons. */ +void KNetworkConf::makeButtonsResizeable(){ + kpbConfigureNetworkInterface->setAutoResize(true); + kcbGwDevice->setAutoResize(true); + kpbAddDomainServer->setAutoResize(true); + kpbEditDomainServer->setAutoResize(true); + kpbRemoveDomainServer->setAutoResize(true); + kpbUpButton->setAutoResize(true); + kpbDownButton->setAutoResize(true); + kpbAddKnownHost->setAutoResize(true); + kpbEditKnownHost->setAutoResize(true); + kpbRemoveKnownHost->setAutoResize(true); +} + +void KNetworkConf::enableInterfaceSlot() +{ + if (modified) { + if (KMessageBox::warningContinueCancel(this, + i18n("The new configuration has not been saved.\nApply changes?"), + i18n("New Configuration Not Saved"), + KStdGuiItem::apply()) == KMessageBox::Continue) + saveInfoSlot(); + else + return; + } + + KNetworkInterface *dev = getDeviceInfo(klvCardList->currentItem()->text(0)); + if (dev->isActive()) + changeDeviceState(dev->getDeviceName(),DEVICE_DOWN); + else + changeDeviceState(dev->getDeviceName(),DEVICE_UP); +} + +void KNetworkConf::disableInterfaceSlot() +{ + if (modified) { + if (KMessageBox::warningContinueCancel(this, + i18n("The new configuration has not been saved.\nApply changes?"), + i18n("New Configuration Not Saved"), + KStdGuiItem::apply()) == KMessageBox::Continue) + saveInfoSlot(); + else + return; + } + + KNetworkInterface *dev = getDeviceInfo(klvCardList->currentItem()->text(0)); + if (dev->isActive()) + changeDeviceState(dev->getDeviceName(),DEVICE_DOWN); + else + changeDeviceState(dev->getDeviceName(),DEVICE_UP); +} + +/** Adds a new host to the KListView that has the known hosts. */ +void KNetworkConf::addKnownHostSlot(){ + KAddKnownHostDlg dlg(this,0); + dlg.setCaption(i18n("Add New Static Host")); + QString aliases; + + dlg.exec(); + + if (!dlg.kleIpAddress->text().isEmpty() && dlg.klbAliases->firstItem() > 0 ) + { + QListViewItem * item = new QListViewItem( klvKnownHosts, 0 ); + + item->setText(0,dlg.kleIpAddress->text()); + + for ( uint i = 0; i < dlg.klbAliases->count(); i++ ) + aliases += dlg.klbAliases->text(i) + " "; + + item->setText(1,aliases); + enableApplyButtonSlot(); + } +} + +/** Removes a known host from the list view */ +void KNetworkConf::removeKnownHostSlot() +{ + if (klvKnownHosts->currentItem() != 0) + { + klvKnownHosts->removeItem(klvKnownHosts->currentItem()); + enableApplyButtonSlot(); + } +} + +/** Edits the info about a known host. */ +void KNetworkConf::editKnownHostSlot() +{ + KAddKnownHostDlg dlg(this,0); + dlg.setCaption(i18n("Edit Static Host")); + QListViewItem *item = klvKnownHosts->currentItem(); + dlg.kleIpAddress->setText(item->text(0)); + + QStringList aliases = QStringList::split( " ", item->text(1) ); + int n = 0; + for ( QStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it, ++n ) + { + QString alias = *it; + dlg.klbAliases->insertItem(alias,n); + } + + dlg.exec(); + + QString _aliases; + if (!dlg.kleIpAddress->text().isEmpty() && dlg.klbAliases->firstItem() > 0 ) + { + QListViewItem * item = klvKnownHosts->currentItem(); + + item->setText(0,dlg.kleIpAddress->text()); + + for ( uint i = 0; i < dlg.klbAliases->count(); i++ ) + _aliases += dlg.klbAliases->text(i) + " "; + + item->setText(1,_aliases); + enableApplyButtonSlot(); + } + +} + +/** Shows the main window after the network info has been loaded. */ +void KNetworkConf::showMainWindow() +{ + show(); +} +/** No descriptions */ +void KNetworkConf::readFromStdErrUpDown() +{ + commandErrOutput.append(procDeviceState->readStderr()); +} +/** Sees if a device is active or not in the ifconfig output. Not very nice, but it works. Inthe future, this has to be managed by gst. */ +bool KNetworkConf::isDeviceActive(const QString &device, const QString &ifconfigOutput){ + QString temp = ifconfigOutput.section(device,1,1); + if (temp.isEmpty()) + return false; + else + { + QString temp2 = temp.section("UP",0,0); //two firts lines of the device info. + QString temp3 = temp2.section("\n",0,0); //Link encap:Ethernet HWaddr 00:00:21:C5:99:A0 + QString temp4 = temp2.section("\n",1,1); //inet addr:192.168.1.1 Bcast:192.255.255.255 Mask:255.0.0.0 + temp3 = temp3.stripWhiteSpace(); + temp4 = temp4.stripWhiteSpace(); + QString temp5 = temp3.section(" ",4,4); //00:00:21:C5:99:A0 + QString temp6 = temp4.section(" ",1,1); // addr:192.168.1.1 + temp6 = temp6.section(":",1,1); //192.168.1.1 + QString temp7 = temp4.section(" ",3,3); //Bcast:192.255.255.255 + temp7 = temp7.section(":",1,1); //192.255.255.255 + QString temp8 = temp4.section(" ",5,5); // Mask:255.0.0.0 + temp8 = temp8.section(":",1,1); //255.0.0.0 + + //If the ip address is empty it must be a dhcp interface, so fill these fields: + if (temp6.isEmpty()) + return false; + } + return true; +} +void KNetworkConf::setReadOnlySlot(bool state) +{ + state = !state; + gbDefaultGateway->setEnabled(state); + kleDomainName->setEnabled(state); + kleHostName->setEnabled(state); + gbDNSServersList->setEnabled(state); + gbKnownHostsList->setEnabled(state); + klvCardList->setEnabled(state); + kpbUpButton->setEnabled(state); + kpbDownButton->setEnabled(state); + kpbConfigureNetworkInterface->setEnabled(state); +} + +/*Shows a context menu when right-clicking in the interface list*/ +void KNetworkConf::showInterfaceContextMenuSlot(KListView* lv, QListViewItem* lvi, const QPoint& pt) +{ + KPopupMenu *context = new KPopupMenu( this ); + Q_CHECK_PTR( context ); + context->insertItem( "&Enable Interface", this, SLOT(enableInterfaceSlot())); + context->insertItem( "&Disable Interface", this, SLOT(disableInterfaceSlot())); + QListViewItem *item = klvCardList->currentItem(); + QString currentDevice = item->text(0); + KNetworkInterface *dev = getDeviceInfo(currentDevice); + + if (dev->isActive()) + { + context->setItemEnabled(0,false); + context->setItemEnabled(1,true); + } + else + { + context->setItemEnabled(0,true); + context->setItemEnabled(1,false); + } + context->insertSeparator(2); + context->insertItem( "&Configure Interface...", this, SLOT(configureDeviceSlot())); + context->popup(pt); + //context->insertItem( "About &Qt", this, SLOT(aboutQt()) ); +} + +void KNetworkConf::enableSignals() +{ + tooltip->setProfiles(netInfo->getProfilesList()); + connect(kleDefaultRoute,SIGNAL(textChanged(const QString&)),this,SLOT(enableApplyButtonSlot(const QString&))); + connect(kleDomainName,SIGNAL(textChanged(const QString&)),this,SLOT(enableApplyButtonSlot(const QString&))); + connect(kleHostName,SIGNAL(textChanged(const QString&)),this,SLOT(enableApplyButtonSlot(const QString&))); +} + +void KNetworkConf::enableProfileSlot() +{ + //Get selected profile + QListViewItem *item = klvProfilesList->currentItem(); + + if (item != NULL) + { + QString selectedProfile = item->text(0); + + //And search for it in the profiles list + KNetworkInfo *profile = getProfile(netInfo->getProfilesList(),selectedProfile); + if (profile != NULL) + { + profile->setProfilesList(netInfo->getProfilesList()); + config->saveNetworkInfo(profile); + modified = false; + //connect( config, SIGNAL(readyLoadingNetworkInfo()), this, SLOT(showSelectedProfile(selectedProfile)) ); + } + else + KMessageBox::error(this, + i18n("Could not load the selected Network Profile."), + i18n("Error Reading Profile")); + } +} + +KNetworkInfo *KNetworkConf::getProfile(QPtrList<KNetworkInfo> profilesList, QString selectedProfile) +{ + QPtrListIterator<KNetworkInfo> it(profilesList); + KNetworkInfo *net = NULL; + + while ((net = it.current()) != 0) + { + ++it; + if (net->getProfileName() == selectedProfile) + break; + } + return net; +} + +void KNetworkConf::createProfileSlot() +{ + if (!netInfo) + return; + bool ok; + QString newProfileName = KInputDialog::getText(i18n("Create New Network Profile"), + i18n("Name of new profile:"), + QString::null, &ok, this ); + if ( ok && !newProfileName.isEmpty() ) + { + QPtrList<KNetworkInfo> profiles = netInfo->getProfilesList(); + KNetworkInfo *currentProfile = getProfile(profiles,newProfileName); + KNetworkInfo *newProfile = new KNetworkInfo(); + + //If there isn't a profile with the new name we add it to the list. + if (currentProfile == NULL) + { + QListViewItem *newItem = new QListViewItem( klvProfilesList,newProfileName); + + //memcpy(newProfile,netInfo,sizeof(netInfo) + sizeof(KRoutingInfo) + sizeof(KDNSInfo)); + //Is there a better way to copy an object? the above memcpy doesn't do the trick + newProfile->setProfileName(newProfileName); + newProfile->setDNSInfo(netInfo->getDNSInfo()); + newProfile->setDeviceList(netInfo->getDeviceList()); + newProfile->setNetworkScript(netInfo->getNetworkScript()); + newProfile->setPlatformName(netInfo->getPlatformName()); + newProfile->setProfilesList(netInfo->getProfilesList()); + newProfile->setRoutingInfo(netInfo->getRoutingInfo()); + + profiles.append(newProfile); + netInfo->setProfilesList(profiles); + enableApplyButtonSlot(); + } + else + KMessageBox::error(this, + i18n("There is already another profile with that name."), + i18n("Error")); + } + +} + +/*void KNetworkConf::updateProfileNameSlot(QListViewItem *item) +{ + QString newName = item->text(0); + + if (newName.isEmpty()) + KMessageBox::error(this, + i18n("The profile name can't be left blank."), + i18n("Error")); + else + { + KNetworkInfo *currentProfile = getProfile(netInfo->getProfilesList(),newName); + KNetworkInfo *newProfile = new KNetworkInfo(); + + //If there is a profile with that name we rename it to the new name. + if (currentProfile != NULL) + { + currentProfile->setProfileName(item->text(0)); + modified = false; + enableApplyButtonSlot(); + } + } +}*/ + +void KNetworkConf::removeProfileSlot() +{ + QListViewItem *item= klvProfilesList->selectedItem(); + if (item != NULL) + { +/* if (KMessageBox::warningContinueCancel(this, + i18n("Are you sure you want to delete the selected network profile?"), + i18n("Delete Profile"),KStdGuiItem::del()) == KMessageBox::Continue)*/ + { + QString selectedProfile = item->text(0); + QPtrList<KNetworkInfo> profiles = netInfo->getProfilesList(); + KNetworkInfo *profileToDelete = NULL; + + for ( profileToDelete = profiles.first(); profileToDelete; profileToDelete = profiles.next() ) + { + QString profileName = profileToDelete->getProfileName(); + if (profileName == selectedProfile) + { + profiles.remove(profileToDelete); + netInfo->setProfilesList(profiles); + klvProfilesList->takeItem(item); + modified = false; + enableApplyButtonSlot(); + break; + } + } + } + } +} + +void KNetworkConf::updateProfileSlot() +{ + QListViewItem *item= klvProfilesList->selectedItem(); + if (item != NULL) + { + QString selectedProfile = item->text(0); + QPtrList<KNetworkInfo> profiles = netInfo->getProfilesList(); + KNetworkInfo *profileToUpdate = NULL; + KNetworkInfo *newProfile = new KNetworkInfo(); + + for ( profileToUpdate = profiles.first(); profileToUpdate; profileToUpdate = profiles.next() ) + { + QString profileName = profileToUpdate->getProfileName(); + if (profileName == selectedProfile) + { + qDebug("profile updated"); + newProfile->setProfileName(profileName); + newProfile->setDNSInfo(netInfo->getDNSInfo()); + newProfile->setDeviceList(netInfo->getDeviceList()); + newProfile->setNetworkScript(netInfo->getNetworkScript()); + newProfile->setPlatformName(netInfo->getPlatformName()); + newProfile->setProfilesList(netInfo->getProfilesList()); + newProfile->setRoutingInfo(netInfo->getRoutingInfo()); + + + profileToUpdate = netInfo; + int curPos = profiles.at(); + // profileToUpdate->setProfileName(profileName); + profiles.remove(); + profiles.insert(curPos,newProfile); + netInfo->setProfilesList(profiles); + modified = false; + enableApplyButtonSlot(); + break; + } + } + } +} + +#include "knetworkconf.moc" diff --git a/knetworkconf/knetworkconf/knetworkconf.desktop b/knetworkconf/knetworkconf/knetworkconf.desktop new file mode 100644 index 0000000..31b113f --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconf.desktop @@ -0,0 +1,128 @@ +# KDE Config File +[Desktop Entry] +Type=Application +Exec=kdesu knetworkconf -caption "%c" %i %m +Icon=knetworkconf +DocPath=knetworkconf/index.html +Comment=Configure TCP/IP settings +Comment[ar]=إعداد تعيينات ميفاق التحكم بلنقل/ميفاق الإنترنت +Comment[be]=Наставіць TCP/IP +Comment[bg]=Настройване настройките на TCP/IP +Comment[bn]=টিসিপি/আইপি মানসমূহ কনফিগার করে +Comment[br]=Kefluniañ an dibarzhoù TCP/IP +Comment[bs]=Podesi postavke TCP/IP +Comment[ca]=Configura els paràmetres TCP/IP +Comment[cs]=Nastavení TCP/IP +Comment[da]=Indstil opsætning af TCP/IP +Comment[de]=TCP/IP-Einstellungen einrichten +Comment[el]=Διαμόρφωση των ρυθμίσεων TCP/IP +Comment[es]=Configure los parámetros TCP/IP +Comment[et]=TCP/IP seadistuste seadistamine +Comment[eu]=Konfiguratu TCP/IP ezarpenak +Comment[fa]=پیکربندی تنظیمات TCP/IP +Comment[fi]=Aseta TCP/IP-asetukset +Comment[fr]=Configuration des paramètres TCP/IP +Comment[ga]=Cumraigh Socruithe TCP/IP +Comment[gl]=Configuración de TCP/IP +Comment[he]=שינוי הגדרות TCP/IP +Comment[hr]=Konfiguriranje TCP/IP postavki +Comment[hu]=A TCP/IP beállításai +Comment[is]=Umsjón TCP/IP stillinga +Comment[it]=Configura le impostazioni TCP/IP +Comment[ja]=TCP/IP の設定 +Comment[ka]=TCP/IP პარამეტრების კონფიგურაცია +Comment[kk]=TCP/IP параметрлерін баптау +Comment[km]=កំណត់រចនាសម្ព័ន្ធការកំណត់ TCP/IP +Comment[ko]=TCP/IP 설정 +Comment[lt]=Konfigūruoti TCP/IP nustatymus +Comment[mk]=Конфигурирајте поставувања за TCP/IP +Comment[nb]=Sett opp TCP/IP-innstillinger +Comment[nds]=TCP/IP-Instellen fastleggen +Comment[ne]=टीसीपी/आईपी सेटिङ कन्फिगर गर्नुहोस् +Comment[nl]=TCP/IP instellen +Comment[nn]=Set opp TCP/IP +Comment[pa]=TCP/IP ਸਥਾਪਨ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja ustawień TCP/IP +Comment[pt]=Configurar opções TCP/IP +Comment[pt_BR]=Configura os ajustes TCP/IP +Comment[ro]=Configurează setările TCP/IP +Comment[ru]=Настройка параметров TCP/IP +Comment[se]=Heivet TCP/IP:a +Comment[sk]=Konfigurácia nastavení TCP/IP +Comment[sl]=Nastavite TCP/IP nastavitve +Comment[sr]=Подесите TCP/IP поставке +Comment[sr@Latn]=Podesite TCP/IP postavke +Comment[sv]=Anpassa TCP/IP-inställningar +Comment[th]=ปรับแต่งการตั้งค่า TCP/IP +Comment[tr]=TCP /IP Ayarlarını Yapılandır +Comment[uk]=Налаштувати параметри TCP/IP +Comment[vi]=Cấu hình thiết lập TCP/IP +Comment[wa]=Apontiaedjes TCP/IP +Comment[zh_CN]=配置 TCP/IP 设置 +Comment[zh_HK]=設定 TCP/IP 設置 +Comment[zh_TW]=設定 TCP/IP +Terminal=false +Name=KNetworkConf +Name[ar]=برنامج KNetworkConf +Name[bn]=কে-নেটওয়ার্ক-কন্ফ +Name[ne]=केडीई सञ्जाल कन्फिगरेसन +Name[pa]=ਕੇ-ਨੈੱਟਵਰਕ-ਸੰਰਚਨਾ +Name[pt_BR]=KNetworkConf +Name[sv]=Knetworkconf +Name[th]=ปรับแต่งเครือข่าย - K +GenericName=Configure TCP/IP Settings +GenericName[ar]=إعداد تعيينات ميفاق التحكم بلنقل/ميفاق الإنترنت +GenericName[bg]=Настройване на TCP/IP +GenericName[bn]=টিসিপি/আইপি মানসমূহ কনফিগারেশন +GenericName[br]=Kefluniañ an dibarzhoù TCP/IP +GenericName[bs]=Podesi TCP/IP postavke +GenericName[ca]=Configura els paràmetres TCP/IP +GenericName[cs]=Nastavení TCP/IP možností +GenericName[da]=Indstil opsætning af TCP/IP +GenericName[de]=TCP/IP-Einstellungen einrichten +GenericName[el]=Διαμορφώστε τις ρυθμίσεις TCP/IP +GenericName[es]=Configure los parámetros TCP/IP +GenericName[et]=TCP/IP seadistuste seadistamine +GenericName[eu]=Konfiguratu TCP/IP ezarpenak +GenericName[fa]=پیکربندی تنظیمات TCP/IP +GenericName[fi]=Aseta TCP/IP-asetukset +GenericName[fr]=Configuration des paramètres TCP/IP +GenericName[ga]=Cumraigh Socruithe TCP/IP +GenericName[gl]=Configuración de TCP/IP +GenericName[he]=שינוי הגדרות TCP/IP +GenericName[hr]=Konfiguriranje TCP/IP postavki +GenericName[hu]=TCP/IP-beállítások +GenericName[is]=Umsjón TCP/IP stillinga +GenericName[it]=Configura le impostazioni TCP/IP +GenericName[ja]=TCP/IP の設定 +GenericName[ka]=TCP/IP პარამეტრების კონფიგურაცია +GenericName[kk]=TCP/IP параметрлерін баптау +GenericName[km]=កំណត់រចនាសម្ព័ន្ធការកំណត់ TCP/IP +GenericName[ko]=TCP/IP 설정 +GenericName[lt]=Konfigūruoti TCP/IP nustatymus +GenericName[mk]=Конфигурирајте поставувања за TCP/IP +GenericName[nb]=Sett opp TCP/IP-innstillinger +GenericName[nds]=TCP/IP-Instellen setten +GenericName[ne]=टीसीपी/आईपी सेटिङ कन्फिगर गर्नुहोस् +GenericName[nl]=TCP/IP instellen +GenericName[nn]=Set opp TCP/IP +GenericName[pa]=TCP/IP ਸਥਾਪਨ ਸੰਰਚਨਾ +GenericName[pl]=Konfiguracja ustawień TCP/IP +GenericName[pt]=Configurar opções TCP/IP +GenericName[pt_BR]=Configura os ajustes TCP/IP +GenericName[ro]=Configurează setările TCP/IP +GenericName[ru]=Конфигурация TCP/IP +GenericName[se]=Heivet TCP/IP:a +GenericName[sk]=Konfigurácia nastavení TCP/IP +GenericName[sl]=Nastavite TCP/IP nastavitve +GenericName[sr]=Подеси TCP/IP поставке +GenericName[sr@Latn]=Podesi TCP/IP postavke +GenericName[sv]=Anpassa TCP/IP-inställningar +GenericName[th]=ปรับแต่งการตั้งค่า TCP/IP +GenericName[tr]=TCP /IP Ayarları Yapılandırıcı +GenericName[uk]=Налаштувати параметри TCP/IP +GenericName[vi]=Cấu hình thiết lập TCP/IP +GenericName[wa]=Apontiaedjes TCP/IP +GenericName[zh_CN]=配置 TCP/IP 设置 +GenericName[zh_HK]=設定 TCP/IP 設置 +GenericName[zh_TW]=設定 TCP/IP diff --git a/knetworkconf/knetworkconf/knetworkconf.h b/knetworkconf/knetworkconf/knetworkconf.h new file mode 100644 index 0000000..3416776 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconf.h @@ -0,0 +1,211 @@ +/*************************************************************************** + knetworkconf.h - description + ------------------- + begin : Sun Jan 12 00:54:19 UTC 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#ifndef KNETWORKCONF_H +#define KNETWORKCONF_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#define DEVICE_UP 0 +#define DEVICE_DOWN 1 + +#include <unistd.h> +#include <sys/types.h> + +#include <kapp.h> +#include <qwidget.h> +#include <qpixmap.h> +#include <qprocess.h> +#include <qptrlist.h> +#include <qstringlist.h> +#include <qstring.h> +#include <qcheckbox.h> +#include <qgroupbox.h> +#include <qlabel.h> +#include <qradiobutton.h> +#include <qlayout.h> +#include <kdialog.h> +#include <kinputdialog.h> +#include <kpopupmenu.h> +#include <kpushbutton.h> +#include <klistview.h> +#include <klineedit.h> +#include <klistbox.h> +#include <kcombobox.h> +#include <kmessagebox.h> +#include <kaboutapplication.h> +#include <klocale.h> +#include <kstandarddirs.h> +#include <kapplication.h> + +#include <dcopclient.h> + +#include "knetworkconfdlg.h" +#include "kadddnsserverdlg.h" +#include "kadddevicecontainer.h" +#include "kadddevicedlg.h" +#include "kadddevicewifiext.h" +#include "knetworkinfo.h" +#include "kroutinginfo.h" +#include "knetworkconfigparser.h" +#include "kdnsinfo.h" +#include "kaddknownhostdlg.h" +#include "kknownhostinfo.h" +#include "knetworkinterface.h" +#include "kadddevicedlgextension.h" +#include "knetworkconfiface.h" +#include "kprofileslistviewtooltip.h" + +/** KNetworkConf is the base class of the project */ +class KNetworkConf : public KNetworkConfDlg, virtual public KNetworkConfIface +{ + Q_OBJECT + public: + /** construtor */ + KNetworkConf(QWidget* parent=0, const char *name=0); + /** destructor */ + ~KNetworkConf(); + /** Puts the application in read-only mode. This happens when the user runing the application isn't root. */ + void setReadOnly(bool state); + void setVersion(QString ver); + QString getVersion(); + /** Disables all buttons a line edit widgets when the user has read only access. */ + void disableAll(); + + /** + Fill the Listview with the info of the network interfaces. + */ + void loadNetworkDevicesInfo(); + void loadRoutingInfo(); + void loadDNSInfo(); + void loadNetworkProfiles(); + + private: // Private attributes + /** */ + KNetworkConfigParser *config; + KNetworkInterface * getDeviceInfo(QString device); + QString getDeviceName(QString ipAddr); + /** Creates a QStringList with the IP addresses contained in the QListBox of name servers. */ + QStringList getNamserversList(KListBox * serverList); +/** Creates a QPtrList<KKownHostInfo> with the info contained in the KListView of name servers. */ + QPtrList<KKnownHostInfo> getKnownHostsList(KListView * hostsList); + QString currentDevice; + KRoutingInfo *routingInfo; + KDNSInfo *dnsInfo; + bool reloaded; + QString commandOutput; + QProcess *procUpdateDevice; + QProcess *procDeviceState; + QStringList deviceNamesList; + bool devicesModified; + bool readOnly; + QPtrList<KKnownHostInfo> knownHostsList; + QPtrList<KNetworkInfo> profilesList; + bool nameServersModified; + /** The program's version. */ + QString version; + bool modified; + bool devStateChanged; + /** */ + KNetworkInfo * netInfo; + /** Has the errors throwed by GST when executed. */ + QString commandErrOutput; + /** Changes the state of device 'dev' to DEVICE_UP or DEVICE_DOWN. + Return true on success, false on failure. */ + void changeDeviceState(const QString &dev, int state); + KNetworkInfo *getProfile(QPtrList<KNetworkInfo> profilesList, QString selectedProfile); + void showSelectedProfile(QString profile); + KProfilesListViewToolTip *tooltip; + + public slots: + virtual void saveInfoSlot(); +/** Puts the application in read-only mode. This happens when the user runing the application isn't root. */ + void setReadOnlySlot(bool state); + + private slots: + /** Enables the configure and remove buttons. */ + virtual void enableButtonsSlot(); + /** opens the add server dialog. */ + virtual void addServerSlot(); + /** opens the edit server dialog. */ + virtual void editServerSlot(); + /** Terminates the application*/ + virtual void quitSlot(); + virtual void readFromStdout(); + virtual void readFromStdoutUpDown(); + virtual void enableInterfaceSlot(); + virtual void disableInterfaceSlot(); + /** Pops up the window for adding a new interface. */ + virtual void configureDeviceSlot(); + void enableApplyButtonSlot(); + /** Shows the help browser. Hopefully some day it will be one :-). */ + virtual void helpSlot(); + virtual void enableApplyButtonSlot(bool); + virtual void enableApplyButtonSlot(const QString &text); + /** Saves all the modified info of devices, routes,etc. */ + virtual void moveDownServerSlot(); + virtual void moveUpServerSlot(); + virtual void removeServerSlot(); + bool valuesChanged(KNetworkInterface *dev, + QString bootProto, + QString netmask, + QString ipAddr, + QString gateway, + bool onBoot, + QString desc, + QString broadcast); + /** Returns a list of strings of all the configured devices. */ + QStringList getDeviceList(); + /** Sets the QPushButton::autoResize() in true for all buttons. */ + void makeButtonsResizeable(); + + /** Adds a new host to the KListView that has the known hosts. */ + void addKnownHostSlot(); + void aboutSlot(); + /** Edits the info about a known host. */ + void editKnownHostSlot(); + /** Removes a known host from the list view */ + void removeKnownHostSlot(); + /** No descriptions */ + void readFromStdErrUpDown(); + void getNetworkInfoSlot(); + /** Shows the main window after the network info has been loaded. */ + void showMainWindow(); + void verifyDeviceStateChanged(); + /** Sees if a device is active or not in the ifconfig output. Not very nice, but it works. Inthe future, this has to be managed by gst. */ + bool isDeviceActive(const QString &device, const QString &ifconfigOutput); + + /*Shows a context menu when right-clicking in the interface list*/ + void showInterfaceContextMenuSlot(KListView*, QListViewItem*, const QPoint&); + + /** Enable some signals in the GUI that need to be enabled *after* the loading of the network info is done.*/ + void enableSignals (); + virtual void enableProfileSlot(); + virtual void createProfileSlot(); + //virtual void updateProfileNameSlot(QListViewItem *item); + virtual void removeProfileSlot(); + virtual void updateProfileSlot(); + + signals: + //Signal used to tell kcontrol that the network configuration has been changed. + void networkStateChanged(bool); + +}; + +#endif diff --git a/knetworkconf/knetworkconf/knetworkconfdlg.ui b/knetworkconf/knetworkconf/knetworkconfdlg.ui new file mode 100644 index 0000000..d738479 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconfdlg.ui @@ -0,0 +1,1101 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KNetworkConfDlg</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KNetworkConfDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>510</width> + <height>410</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>510</width> + <height>410</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="caption"> + <string>Network Settings</string> + </property> + <property name="icon"> + <pixmap>image0</pixmap> + </property> + <property name="iconText"> + <string>Configure your TCP/IP settings</string> + </property> + <property name="toolTip" stdset="0"> + <string>Change TCP/IP settings</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <property name="tabShape"> + <enum>Rounded</enum> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Network Interfaces</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout16</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Available Network Interfaces</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer24</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>301</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="KListView"> + <column> + <property name="text"> + <string>Interface</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>IP Address</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Protocol</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>State</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Comment</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>klvCardList</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>List of configured network devices</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbConfigureNetworkInterface</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Configure Interface...</string> + </property> + <property name="toolTip" stdset="0"> + <string>Change the settings of the selected device</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbUpButton</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Enable Interface</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbDownButton</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Disable Interface</string> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer23</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>230</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Routes</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>gbDefaultGateway</cstring> + </property> + <property name="title"> + <string>Default Gateway</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>IP address:</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>181</width> + <height>0</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout27</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KLineEdit"> + <property name="name"> + <cstring>kleDefaultRoute</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Default Gateway IP address</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer12</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>Device:</string> + </property> + </widget> + <widget class="KComboBox"> + <property name="name"> + <cstring>kcbGwDevice</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>70</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>65</width> + <height>32767</height> + </size> + </property> + <property name="toolTip" stdset="0"> + <string>Network device where to send packets</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>90</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Domain Name System</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>gbDNSServersList</cstring> + </property> + <property name="title"> + <string>Domain Name Servers</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KListBox"> + <property name="name"> + <cstring>klbDomainServerList</cstring> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout23</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>Spacer10</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbUpDomainServerList</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="pixmap"> + <pixmap>image1</pixmap> + </property> + <property name="toolTip" stdset="0"> + <string>Move up the selected server on the list (higher priority)</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbDownDomainServerList</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="pixmap"> + <pixmap>image2</pixmap> + </property> + <property name="toolTip" stdset="0"> + <string>Move down the selected server on the list (less priority)</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer11</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout25</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer27</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbAddDomainServer</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Add...</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbEditDomainServer</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Edit...</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbRemoveDomainServer</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Remove</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer27_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>21</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QGroupBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>gbKnownHostsList</cstring> + </property> + <property name="title"> + <string>Static Hosts</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>IP Address</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Aliases</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>klvKnownHosts</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout20</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbAddKnownHost</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Add...</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbEditKnownHost</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Edit...</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbRemoveKnownHost</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>&Remove</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>tlHostName</cstring> + </property> + <property name="text"> + <string>Host name:</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>kleHostName</cstring> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>kleDomainName</cstring> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>tlDomainName</cstring> + </property> + <property name="text"> + <string>Domain name:</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Network Profiles</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>buttonGroup2</cstring> + </property> + <property name="title"> + <string>Available Network Profiles</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView" row="0" column="0" rowspan="2" colspan="1"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>klvProfilesList</cstring> + </property> + <property name="itemsRenameable"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout28</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbEnableProfile</cstring> + </property> + <property name="text"> + <string>&Load Selected</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbSaveProfile</cstring> + </property> + <property name="text"> + <string>&Save Selected</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbCreateProfile</cstring> + </property> + <property name="text"> + <string>&Create New...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbDeleteProfile</cstring> + </property> + <property name="text"> + <string>&Delete Selected</string> + </property> + </widget> + </vbox> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer25</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>51</height> + </size> + </property> + </spacer> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer18</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>150</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + </hbox> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="1108">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000041b49444154388d9d956148a3751cc7bff3ecb6bb149e8186c2f56290912b38f6908417058b043d7b9504a5f522f5459d16c8cda2d45e9441748b38721dd2f6227208ea2c74d338ce5d4c9ca0ee913aa671ca1ed263cfdcd69ee76ae9d2e9b717534f421df58387df9b872f9fe7fbf93fcf039238ee0280beeb7d4f930c31c20cc9cc897b8d19925ba160c8cf9bac008063430f82e9e6abd1682a4537f9c9508424e9f4a7723b90dbd7c622a49b748e454832d6f541574ddee011f7482349f572cf0c4373e4cbd7c954946c7693a938d9d84f867f21ab3b43dcbc4b72891bf4b316000a70ca34d435405e57b095be84d641096a1a78fd3b195a727f6b40eba0042d2da27550022a01dba40d79833db73c303d5a0e4df341794a849694d0556d829204b6aa4c509212baaa4428eb3ef43e27429a9760afb3e70f6ea86d80b2aec260a847e6471f544d44eb60109934101b0e22a389681df603d97ab44ffa215689e89eec7e10708afd6d920cdf656e72fe3830116238405a3ac9ca51b2ec952946032483ffeab8ada4ed3145514d9885be7758d6c304bdebb6aa87090fb9a655982b00fbb80ccc02ae71194d75223e9d0da2bc0410e625184b5e806d5a02aa1f74fcffecef3f4178892499a5c42cc9dda989a90827f83c00e800802936ca69c5d1f265b9a041825022e25ca10c83c1844c5606b226a89a044d13612993e0fe48846fd287faba7afac67df17aa57ec6917528aaa62e2fce2f0e8dfe309ac8110fe5882d6f7a59e6222d1d21ce04c8ea1ed21a202d9d217a4749e1252f237e32248573c839f2add05cc8cb3956595fb4ea49ea0e3bfecff62d6604a783400520cbf219b14a34768f779fadaca8dcd6e9743cecd83be66d24a95a3b66e81d222d1d39526b4f98a1e3edef718daad3e5f473895f5d7de76a4db8365c7cf4a8e63ade6493a2a97deddf1805392da15c106128926128cc759cc91ce9f88204f78762d6feb9fdd7584cfb58281196ba2fd8b67aef39fe3414b6253bdf3f423ce01eb84c728d71ee92cc32cadda3e776dffe1e25ee91e4d4cda93d6e727be0db9175a6287927a61628f1b3c6d79acf1d649e0100cb458b968827ee9b9f30ffe619f3fc6e7ec65c2e2fcb7a6385114b7796607eb2949eef3d7f9bef98e3f619fb8e1255fef207fcc9f67b6f6dd87eb2adc6e289a4cbdbbfa22592f32b9195ec213183d4455d51bdb3df692539cd78ee8d639c79ed9ff4752c0000dd251ddd9a7ba7a5a805d2a2a4472974caba029402b22ce7b79f6faebc7da598126b9cfdce3ec6394d3feff30f6e9c66ff2462ddc10dd7be7016d8d0f288bbcc73be29d6506ccf3a9eb5bdd7d6eef8da959057e5be93ec1ffc144e1cfaf9709fc37983e482778c3f739b89b014de219939cd7e5ee2c6379a0d82607cd72808177bd17db6b7b0f77183c1701e59c0a6d952b6ac2d622812f6e4d5e5052da1dd98b83591398df81f24eff65ce00de8ce0000000049454e44ae426082</data> + </image> + <image name="image1"> + <data format="PNG" length="989">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003a449444154388d759541485c5714863fed13e6818579904266d185d0453320e5cd6e062cb5e0c2580b66c8a2912e7498c2d8a690362d485da5d2459a2e52e8a2c5879bd82c125d8cc68245179679598d168bcf454b84363812429e94c1199a81bf8b3b4ee68de66cfe7bee39f7dcff9e7bef394842be9044c92fd1aebb855d955725b720b9ab925b281b3d2fb945a9d3bf5def2af92532e90cfe433f82a9a940900402a2b805a40c3652b8e4f07ef2ba3ad79fdac930db55794d4a7f213d0ba4294f92a4b95549ff4a57be931ef9cd93142537bf2e15a576e6ada025bf845b3041ddabd2e4ed6792a4477f1f4b928e0db4707de758f2a4f4b547720b523abfaec9fc642b3da798ee6e4a5f2f99c57ad244b387ee6f46751d18b8386dee20ddc6bc95e3d45420ac24970642662e3b04ffd448be6eb7b0533aed99cff6a957fb70c9190773fb6595d7a4c9db86413968323ac1ff74b634eda51d733af7aa942e4a93f949bd527cf2be20c5dae37d8a330e1bdb21997e9b8ded90be7e9bda73e8e93945d8c86bb0b11df2f65b36de66853f0f5fa5fabb4f57e3084edee9c18e7467ad23972f63da21577e30af273d2d958bd2e0c41d75b985b22085fb6688f7a983f74b85dc70825a0decd3a93d25b5e760f740e606d080fad32de28d14dd8ca680006fcce1d63dc8bd93808ea08bbf45832db4e976334deb13cd89d114b04837cb5b4092f17b21d743b87eb7026d41677eaeb1fa4734f0fe008cdc8cce8ddc6d0e9603204bf7dc680a80ca9043b60a5fa513646f42b807ef7e03b97e9bc36ac7f997211c32c70fb60dd6878c696e38092cd0e5e6cbc24a41bc46bcf7eca4da163cf8323a97b9f1621cb30c1e5581688eb7981bb2b12d581823828c9ede6876d9d86316c4dafca99b1c3bcc989ff7c97c46c40212e793c47b6b9824bfc09865e34d45838f7f1ff53baa86541e3bc4ea8b5cb056e9cea433e61b0e27a91d052c5cb649f4c2c207516c17efd7a83d1e83da80030d1f7f2c0bd0562b3ef2859521712ee0c11b4966ad0a90002acc90c0734272c30e8b0f43b2fb0eb3187bbd5161fbaf0495439f7823439fd5562b4a7e0915a5747e45eeaa74717a573a90be5d32bfef65f8f98fd2812fb9f9920e964c8d50b3b3443a8837ef698f4bd41921d6bb45e25c8a0be7f7897fd887bd12f2f17b0eb7562a1c8509f60e032a4f93d4ab51a6b9895c57ab83447a56b33aa58b8649b9686ac9e08634782ddaf3d213f775e2af8e1e7866cff3e63d011c36faa8d107d638b008648105688ce33043dcaab42ef484e9499cff01b1f34611a3ab60c70000000049454e44ae426082</data> + </image> + <image name="image2"> + <data format="PNG" length="1020">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003c349444154388d75954d481c6718c77fca1e1cf0b00316b2d01e8404e242a133b75928d4d01c4c2bd4480e4de821bb6c41f30121ed21d45e9adc620f1642697190827b091acad66e20a91e5276bc74152cbb425a0cd8b22325b812c45dcac2bf87776775347d2eff79bf9ef9bdcffbbecf832414084994833247dbce44559592e44c484e4972262aa69d979ca2747cfed1764f392893f13204ab414cddc99a200dd488eb1ae01a6dbb38e4f0bff77b8eaf3ff127435655e589e47d2eedd6a4495f92a4d992a457d2e5afa5ada0b393a2e4e497a5a27494bcebb41c9471268c53e786949dd995246d6d1f48920e8c747579e340f225efd6969c09c9cb2f2b9bcf76c37382b4fa4cbafbc82cd63f715d0a8ef5d78d5cb863cec03b42de258e48ef3e34a4d50e69a4bbaf8c93adfac16bc7bd5b5b72f252369f55369f8d4ebfa2ca13293b6316576a1da2483b6491559ec7c7cb1b6617ce0dc92b1ae7bdeee49ac0e5fad317f8376165bd813b64944853c4cc3d131fcfbc0dfe6f21c97e68fd14b0d31e84e89ed637a4f9278660e1595cf55c315be8c47a7e45d2bfd2e507e6f67877a44a511abe3aaf1e67a2227071ce36f06fdaf88f4372efa798feb1011fd9d8bf84e4468e2103fee390f0bd14ebdf3609f72dd3d986d6cb35926d97ee6dd0b674ffa1a457d2ec4a87e899a40369792d4efcc50f92b6256d98f6c519a9ba26795f9adb319c5f38241e3adda0d06f33fd4683cfc6ec2ed9e26a9371cf8ad18e7f03b7472073e6b02ff355445c23d94ed33b3bea02109eb719df876befd8f0c711279e057fc5c3b0381a77fae029306abe6747d240811e275f110917924d92fd86cc4ac0ed5138377422b4276cfa3194d6cdf7de3ed089712fa326a1cc9eb7b012501833939c0431f2d7d983a7507a93c3752d60d4c566ca64b7eb7319d15723752a4db2bf09584093649f456ed8dcdbe356f8b5c9caef16adb699bfb7df20fcdba6afb5c850a2446fc6cbe090839134cdbd1a854b16a97e287c6c76e00e7032c6ab70e5ac85dd67e625fba0f9ae0ded80606c1ce0301fbb9f062291213550e3e7d369ee2542cc930b99ba94a2b6d324fd96c5ca7a93739b16f730e3ad76c8fa9f29c29d80643bc3602267feae281f17252fbf24a7245db85395ead2fd47e665fd9fdefe4eaa0792932fabfec8e408752a4bac82f873be36b9488b0fe8eb5f2335e03274ea05c94f06b1961a5cfbd0667a2964af916273a746f8324d6b3f4e9abb9aebe9569058cdea6427af68482a45934b8657a4e15bf19ae75d5d50345fc76ae06b6b9e3fe70b60a73d489341485c01168171a000ed2bd84c914c84dd038d48233fff01da21be2465fed86a0000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>kpbDownButton</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>disableInterfaceSlot()</slot> + </connection> + <connection> + <sender>kpbUpButton</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>enableInterfaceSlot()</slot> + </connection> + <connection> + <sender>kpbConfigureNetworkInterface</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>configureDeviceSlot()</slot> + </connection> + <connection> + <sender>klvCardList</sender> + <signal>rightButtonClicked(QListViewItem*,const QPoint&,int)</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>showInterfaceContextMenuSlot()</slot> + </connection> + <connection> + <sender>klvCardList</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>configureDeviceSlot()</slot> + </connection> + <connection> + <sender>klvCardList</sender> + <signal>selectionChanged()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>enableButtonsSlot()</slot> + </connection> + <connection> + <sender>klbDomainServerList</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>editServerSlot()</slot> + </connection> + <connection> + <sender>kpbEditDomainServer</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>editServerSlot()</slot> + </connection> + <connection> + <sender>kpbUpDomainServerList</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>moveUpServerSlot()</slot> + </connection> + <connection> + <sender>kpbRemoveKnownHost</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>removeKnownHostSlot()</slot> + </connection> + <connection> + <sender>kpbRemoveDomainServer</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>removeServerSlot()</slot> + </connection> + <connection> + <sender>kpbEditKnownHost</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>editKnownHostSlot()</slot> + </connection> + <connection> + <sender>kpbDownDomainServerList</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>moveDownServerSlot()</slot> + </connection> + <connection> + <sender>kpbAddKnownHost</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>addKnownHostSlot()</slot> + </connection> + <connection> + <sender>kpbAddDomainServer</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>addServerSlot()</slot> + </connection> + <connection> + <sender>klvKnownHosts</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>editKnownHostSlot()</slot> + </connection> + <connection> + <sender>kcbGwDevice</sender> + <signal>activated(const QString&)</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>enableApplyButtonSlot(const QString&)</slot> + </connection> + <connection> + <sender>klvProfilesList</sender> + <signal>itemRenamed(QListViewItem*)</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>updateProfileNameSlot(QListViewItem*)</slot> + </connection> + <connection> + <sender>kpbCreateProfile</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>createProfileSlot()</slot> + </connection> + <connection> + <sender>klvProfilesList</sender> + <signal>itemRenamed(QListViewItem*)</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>updateProfileNameSlot(QListViewItem*)</slot> + </connection> + <connection> + <sender>kpbDeleteProfile</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>removeProfileSlot()</slot> + </connection> + <connection> + <sender>kpbEnableProfile</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>enableProfileSlot()</slot> + </connection> + <connection> + <sender>kpbSaveProfile</sender> + <signal>clicked()</signal> + <receiver>KNetworkConfDlg</receiver> + <slot>updateProfileSlot()</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">knetworkconfdlg.ui.h</include> +</includes> +<slots> + <slot access="private">enableButtonsSlot()</slot> + <slot access="private">quitSlot()</slot> + <slot access="private">moveUpServerSlot()</slot> + <slot access="private">moveDownServerSlot()</slot> + <slot>helpSlot()</slot> + <slot access="private">configureDeviceSlot()</slot> + <slot access="private">enableApplyButtonSlot( bool )</slot> + <slot access="private">enableApplyButtonSlot( const QString & )</slot> + <slot>aboutSlot()</slot> + <slot access="private">addServerSlot()</slot> + <slot access="private">removeServerSlot()</slot> + <slot access="private">saveInfoSlot()</slot> + <slot access="private">upDownInterfaceSlot()</slot> + <slot access="private">addKnownHostSlot()</slot> + <slot access="private">removeKnownHostSlot()</slot> + <slot access="private">editKnownHostSlot()</slot> + <slot access="private">startNetworkSlot()</slot> + <slot access="private">stopNetworkSlot()</slot> + <slot access="private">enableInterfaceSlot()</slot> + <slot access="private">disableInterfaceSlot()</slot> + <slot access="private">editServerSlot()</slot> + <slot access="private">showInterfaceContextMenuSlot()</slot> + <slot access="private">enableProfileSlot()</slot> + <slot access="private">createProfileSlot()</slot> + <slot>updateProfileNameSlot()</slot> + <slot access="private">updateProfileNameSlot(QListViewItem *item)</slot> + <slot access="private">removeProfileSlot()</slot> + <slot access="private">updateProfileSlot()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>klistbox.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/knetworkconfdlg.ui.h b/knetworkconf/knetworkconf/knetworkconfdlg.ui.h new file mode 100644 index 0000000..69a1275 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconfdlg.ui.h @@ -0,0 +1,168 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + + +void KNetworkConfDlg::enableButtonsSlot() +{ + +} + +void KNetworkConfDlg::quitSlot() +{ + +} + + +void KNetworkConfDlg::moveUpServerSlot() +{ + +} + +void KNetworkConfDlg::moveDownServerSlot() +{ + +} + +void KNetworkConfDlg::helpSlot() +{ + +} + +void KNetworkConfDlg::configureDeviceSlot() +{ + +} + +void KNetworkConfDlg::enableApplyButtonSlot( bool ) +{ + +} + +void KNetworkConfDlg::enableApplyButtonSlot( const QString & ) +{ + +} + +void KNetworkConfDlg::aboutSlot() +{ + +} + +void KNetworkConfDlg::addServerSlot() +{ + +} + +void KNetworkConfDlg::removeServerSlot() +{ + +} + +void KNetworkConfDlg::saveInfoSlot() +{ + +} + + + + + + +void KNetworkConfDlg::upDownInterfaceSlot() +{ + +} + + +void KNetworkConfDlg::addKnownHostSlot() +{ + +} + +void KNetworkConfDlg::removeKnownHostSlot() +{ + +} + +void KNetworkConfDlg::editKnownHostSlot() +{ + +} + + + +void KNetworkConfDlg::startNetworkSlot() +{ + +} + + +void KNetworkConfDlg::stopNetworkSlot() +{ + +} + + +void KNetworkConfDlg::enableInterfaceSlot() +{ + +} + + +void KNetworkConfDlg::disableInterfaceSlot() +{ + +} + + +void KNetworkConfDlg::editServerSlot() +{ + +} + + +void KNetworkConfDlg::showInterfaceContextMenuSlot() +{ + +} + + +void KNetworkConfDlg::enableProfileSlot() +{ + +} + + +void KNetworkConfDlg::createProfileSlot() +{ + +} + + +void KNetworkConfDlg::updateProfileNameSlot() +{ + +} + + +void KNetworkConfDlg::updateProfileNameSlot( QListViewItem *item ) +{ + +} + + +void KNetworkConfDlg::removeProfileSlot() +{ + +} + + +void KNetworkConfDlg::updateProfileSlot() +{ + +} diff --git a/knetworkconf/knetworkconf/knetworkconfiface.h b/knetworkconf/knetworkconf/knetworkconfiface.h new file mode 100644 index 0000000..2e6106e --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconfiface.h @@ -0,0 +1,34 @@ +/* -*- c++ -*- + * + * knetworkconfiface.h + * + * Copyright (C) 2004 Juan Luis Baptiste <juan.baptiste@kdemail.net> + * + * 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 knetworkconf_iface_h +#define knetworkconf_iface_h + +#include <dcopobject.h> + +class KNetworkConfIface: virtual public DCOPObject +{ + K_DCOP + k_dcop: +}; + +#endif diff --git a/knetworkconf/knetworkconf/knetworkconfigparser.cpp b/knetworkconf/knetworkconf/knetworkconfigparser.cpp new file mode 100644 index 0000000..2e2351d --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconfigparser.cpp @@ -0,0 +1,1239 @@ +/*************************************************************************** + knetworkconfigparser.cpp - description + ------------------- + begin : Mon Jan 13 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#include "knetworkconfigparser.h" +#include "knetworkconfigparser.moc" + +KNetworkConfigParser::KNetworkConfigParser(){ + networkInfo = new KNetworkInfo(); + + QString platform; + bool askAgain = readAskAgain(platform); + + if (!askAgain || platform.length() > 0) + runDetectionScript(platform); + else + runDetectionScript(QString::null); +} +/** Runs the gst backend to get network values. You can pass to the script a specific platform to load using the platform parameter. */ +void KNetworkConfigParser::runDetectionScript(QString platform){ + KDetectDistroDlg* dialog = new KDetectDistroDlg(0, 0); + dialog->show(); + procDetect = new QProcess(this); + QString pathToProgram = locate("data",BACKEND_PATH); + if (pathToProgram.isEmpty()) + { + KMessageBox::error(0, + i18n("Could not find the backend script for the network configuration detection. Something is wrong with your installation.\n Please check that \n{KDE_PATH}/%1 \nfile is present.").arg(BACKEND_PATH), + i18n("Could Not Find Network Configuration Backend Script")); + dialog->close(); + //kapp->quit(); + } + else + { + procDetect->addArgument( pathToProgram ); + if (platform != QString::null) + { + procDetect->addArgument( "--platform" ); + procDetect->addArgument( platform ); + } + procDetect->addArgument( "--get" ); + connect( this, SIGNAL(readyLoadingNetworkInfo()), dialog, SLOT(close()) ); + connect( this, SIGNAL(errorDetectingPlatform()), dialog, SLOT(close()) ); + connect( procDetect, SIGNAL(processExited()), this, SLOT(readNetworkInfo()) ); + connect( procDetect, SIGNAL(readyReadStdout()),this, SLOT(concatXMLOutputSlot())); + connect( procDetect, SIGNAL(readyReadStderr()),this, SLOT(readXMLErrSlot())); + + if ( !procDetect->start() ) + { + // error handling + KMessageBox::error(0, + i18n("Could not execute backend script for the network configuration detection. Something is wrong with your installation."), + i18n("Could Not Launch Network Configuration Backend Script")); + dialog->close(); + } + } +} +/** runs gst to find out the state of network devices.It runs the command: +$knetworkconf_home/backends/networkconf [--platform platform] -d list_ifaces. */ +void KNetworkConfigParser::listIfaces(const QString &platform){ + procDetect = new QProcess(this); + procDetect->addArgument( locate("data",BACKEND_PATH) ); + if (platform != QString::null) + { + procDetect->addArgument( "--platform" ); + procDetect->addArgument( platform ); + } + //procDetect->addArgument( "--get" ); + procDetect->addArgument( "-d" ); + procDetect->addArgument( "list_ifaces" ); + + connect( procDetect, SIGNAL(processExited()), this, SLOT(readListIfacesSlot()) ); + connect( procDetect, SIGNAL(readyReadStdout()),this, SLOT(concatXMLOutputSlot())); + connect( procDetect, SIGNAL(readyReadStderr()),this, SLOT(readXMLErrSlot())); + + xmlOuput = ""; + xmlErr = ""; + if ( !procDetect->start() ) + { +// error handling + KMessageBox::error(0, + i18n("Could not execute backend script for the network configuration detection. Something is wrong with your installation."), + i18n("Could Not Launch Network Configuration Backend Script")); + } +} + +void KNetworkConfigParser::readListIfacesSlot(){ + QPtrList<KNetworkInterface> tempDeviceList; + + //The gst backend puts a \n at the beginning of the xml output, so + //we have to erase it first before we parse it. + xmlOuput = xmlOuput.section('\n',1); + qDebug("XML -d list_ifaces: %s",xmlOuput.latin1()); + QString err; + int x,y; + QDomDocument doc( "network-ifaces"); + if ( !doc.setContent( xmlOuput.utf8(),false,&err,&x,&y ) ) + { + KMessageBox::error(0, + i18n("Could not parse the XML output from the network configuration backend."), + i18n("Error While Listing Network Interfaces")); +// qDebug("error: %s %d,%d",err.latin1(),x,y); + } + QDomElement root = doc.documentElement(); + QDomNode node = root.firstChild(); + + while( !node.isNull() ) + { + if ( node.isElement() && node.nodeName() == "interface" ) + { + QDomElement interface = node.toElement(); + KNetworkInterface *tempDevice = new KNetworkInterface(); + tempDevice = getInterfaceInfo(interface,QString::null); + + if (tempDevice->getType().lower() != LOOPBACK_IFACE_TYPE) + { + KNetworkInterface *originalDevice = getDeviceInfo(tempDevice->getDeviceName()); + if (originalDevice == NULL) + { + node = node.nextSibling(); + continue; + } + originalDevice->setActive(tempDevice->isActive()); + if (!tempDevice->getBroadcast().isEmpty()) + originalDevice->setBroadcast(tempDevice->getBroadcast()); + if (!tempDevice->getDescription().isEmpty()) + originalDevice->setDescription(tempDevice->getDescription()); + if (!tempDevice->getIpAddress().isEmpty()) + originalDevice->setIpAddress(tempDevice->getIpAddress()); + if (!tempDevice->getMacAddress().isEmpty()) + originalDevice->setMacAddress(tempDevice->getMacAddress()); + if (!tempDevice->getNetmask().isEmpty()) + originalDevice->setNetmask(tempDevice->getNetmask()); + if (!tempDevice->getNetwork().isEmpty()) + originalDevice->setNetwork(tempDevice->getNetwork()); + } + } + node = node.nextSibling(); + } + //networkInfo->setDeviceList(deviceList); + //Tell to interested parties when the network info is ready. + emit readyLoadingNetworkInfo(); +} + +KNetworkConfigParser::~KNetworkConfigParser(){ +} + +/** return tyhe number of configured devices. */ +unsigned KNetworkConfigParser::numDevices(){ + return _numDevices; +} + +void KNetworkConfigParser::setProgramVersion(QString ver) +{ + KNetworkConfigParser::programVersion = ver; +} + + +void KNetworkConfigParser::readIfconfigOutput(){ + QString s = proc->readStdout(); + ifconfigOutput = s; +} + +/** + Reads /proc/net/route looking for the default gateway. + + NOTE:We should use the gateway reported by gst, but if there's a + gw in a config file and one of the network interfaces is + configured to use dhcp, gst returns the value of the config + file instead of the gw configured by dhcp. +*/ +void KNetworkConfigParser::loadRoutingInfo( KRoutingInfo *routingInfo){ +#ifndef Q_OS_FREEBSD + QFile f( "/proc/net/route"); + if ( !f.open(IO_ReadOnly) ) + { + KMessageBox::error(0, + i18n("Could not open file /proc/net/route."), + i18n("Could Not Open File")); + } + else + { + QTextStream t( &f ); // use a text stream + QString s; + while (!t.eof()) + { + s = t.readLine(); // line of text excluding '\n' + QString interface = s.section('\t',0,0); + QString destination = s.section('\t',1,1); + QString gw = s.section('\t',2,2); + + if (destination == "00000000") + { + routingInfo->setGateway(hexIPv4ToDecIPv4(gw)); + routingInfo->setGatewayDevice(interface); + } + } + } + f.close(); +#endif +} +QString +KNetworkConfigParser::hexIPv4ToDecIPv4(const QString &hex) +{ + bool ok; + QString dec = ""; + QString dec2 = ""; + QString temp = ""; + QString temp2 = ""; + +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + temp = hex.mid(6,2); + temp2 = temp2.setNum(temp.toInt(&ok,16)); + dec.append(temp2); + dec.append('.'); + temp = hex.mid(4,2); + temp2 = temp2.setNum(temp.toInt(&ok,16)); + dec.append(temp2); + dec.append('.'); + temp = hex.mid(2,2); + temp2 = temp2.setNum(temp.toInt(&ok,16)); + dec.append(temp2); + dec.append('.'); + temp = hex.mid(0,2); + temp2 = temp2.setNum(temp.toInt(&ok,16)); + dec.append(temp2); +#else + temp = hex.mid(0,2); + temp2 = temp2.setNum(temp.toInt(&ok,16)); + dec.append(temp2); + dec.append('.'); + temp = hex.mid(2,2); + temp2 = temp2.setNum(temp.toInt(&ok,16)); + dec.append(temp2); + dec.append('.'); + temp = hex.mid(4,2); + temp2 = temp2.setNum(temp.toInt(&ok,16)); + dec.append(temp2); + dec.append('.'); + temp = hex.mid(6,2); + temp2 = temp2.setNum(temp.toInt(&ok,16)); + dec.append(temp2); +#endif + + dec2 = dec; + if (ok) + return dec2; + else + return ""; +} + +void KNetworkConfigParser::saveNetworkInfo(KNetworkInfo *networkInfo) +{ + this->networkInfo = networkInfo; + QPtrList<KNetworkInterface> devList = networkInfo->getDeviceList(); + QPtrList<KNetworkInfo> profileList = networkInfo->getProfilesList(); + dnsInfo = networkInfo->getDNSInfo(); + routingInfo = networkInfo->getRoutingInfo(); + + //Start xml file + QDomDocument doc( "network []" ); + QDomProcessingInstruction instr = doc.createProcessingInstruction("xml","version=\"1.0\" "); + doc.appendChild(instr); + QDomElement root = doc.createElement( "network" ); + doc.appendChild( root ); + + addRoutingInfoToXMLDoc(&doc, &root, routingInfo); + addDNSInfoToXMLDoc(&doc, &root, dnsInfo); + addNetworkInterfacesToXMLDoc(&doc, &root, devList); + addNetworkProfilesToXMLDoc(&doc, &root, profileList); + + //If we don't add this comment to the end of the xml file, the gst process never exits! + QDomComment endComment = doc.createComment(" GST: end of request "); + doc.appendChild( endComment ); + + QString xml = doc.toString(); + qDebug("--set XML:\n%s",xml.latin1()); + procSaveNetworkInfo = new QProcess(this); + procSaveNetworkInfo->addArgument( locate("data",BACKEND_PATH) ); + + if (!networkInfo->getPlatformName().isEmpty()) + { + procSaveNetworkInfo->addArgument( "--platform" ); + procSaveNetworkInfo->addArgument( networkInfo->getPlatformName() ); + } + procSaveNetworkInfo->addArgument( "--set" ); + +// KDetectDistroDlg* dialog = new KDetectDistroDlg(0, 0, true,QDialog::WStyle_Customize|QDialog::WStyle_NormalBorder|QDialog::WStyle_Title|QDialog::WStyle_SysMenu); //made it semi-modal + KDetectDistroDlg* dialog = new KDetectDistroDlg((QWidget*)parent(), 0, true); + dialog->setCaption(i18n("Reloading Network")); + dialog->text->setText(i18n("%1Please wait while saving the network settings...%2").arg("<center>").arg("</center>")); + dialog->show(); + + xmlOuput = ""; + + connect( this, SIGNAL(readyLoadingNetworkInfo()), dialog, SLOT(close()) ); + connect(procSaveNetworkInfo,SIGNAL(readyReadStdout()),this,SLOT(readFromStdoutSaveNetworkInfo())); + connect(procSaveNetworkInfo,SIGNAL(wroteToStdin()),this,SLOT(sendNetworkInfoSavedSignalSlot())); + connect(procSaveNetworkInfo,SIGNAL(processExited()),this,SLOT(listIfacesSlot())); + + processRunning = true; + connect( procSaveNetworkInfo, SIGNAL(processExited()), this, SLOT(processExitedSlot()) ); + + if ( !procSaveNetworkInfo->start() ) + { + KMessageBox::error(0, + i18n("Could not execute backend script for the network configuration detection. Something is wrong with your installation."), + i18n("Could Not Launch Network Configuration Backend Script")); + } + + procSaveNetworkInfo->writeToStdin(xml); + + //wait around until the process has finished, otherwise it becomes a zombie + while (processRunning) { + kapp->processEvents(); + } +} + +void KNetworkConfigParser::processExitedSlot() { + processRunning = false; +} + +void KNetworkConfigParser::addNetworkProfilesToXMLDoc(QDomDocument *doc, QDomNode *root, QPtrList<KNetworkInfo> profileList) +{ + QPtrListIterator<KNetworkInfo> profileIt(profileList); + KNetworkInfo *profile; + QDomElement tag = doc->createElement( "profiledb" ); + root->appendChild( tag ); + + while ( (profile = profileIt.current()) != 0) + { + ++profileIt; + QPtrList<KNetworkInterface> devList = profile->getDeviceList(); + KDNSInfo *dnsInfo = profile->getDNSInfo(); + KRoutingInfo *routingInfo = profile->getRoutingInfo(); + + QDomElement profileTag = doc->createElement( "profile" ); + tag.appendChild( profileTag ); + QDomElement innerTag = doc->createElement( "name" ); + profileTag.appendChild( innerTag ); + QDomText t = doc->createTextNode( profile->getProfileName() ); + innerTag.appendChild( t ); + + addRoutingInfoToXMLDoc(doc, &profileTag, routingInfo); + addDNSInfoToXMLDoc(doc, &profileTag, dnsInfo); + addNetworkInterfacesToXMLDoc(doc, &profileTag, devList); + } +} + +void KNetworkConfigParser::addNetworkInterfacesToXMLDoc(QDomDocument *doc, QDomNode *root, QPtrList<KNetworkInterface> devList) +{ + KNetworkInterface *device; + QPtrListIterator<KNetworkInterface> devIt(devList); + + //Save in the configuration file the description of the interfaces as + //the backend no longer handles this + KSimpleConfig cfg("knetworkconfrc"); + cfg.setGroup("Interfaces"); + + //Add the network interfaces list + while ( (device = devIt.current()) != 0 ) + { + ++devIt; + // if protocol is not specified, then should not have entry in config + if (device->getBootProto().isEmpty()) + continue; + + QDomElement tag = doc->createElement( "interface" ); + tag.setAttribute("type",device->getType()); + root->appendChild( tag ); + QDomElement configurationTag; + configurationTag = doc->createElement( "configuration" ); + tag.appendChild( configurationTag ); + + QDomElement innerTag; + QDomText t; + if ((device->getBootProto().lower() != "dhcp") && (device->getBootProto().lower() != "bootp")) + { + if (!device->getIpAddress().isEmpty()) + { + innerTag = doc->createElement( "address" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( device->getIpAddress() ); + innerTag.appendChild( t ); + } + if (!device->getGateway().isEmpty()) + { + innerTag = doc->createElement( "gateway" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( device->getGateway() ); + innerTag.appendChild( t ); + } + if (!device->getBroadcast().isEmpty()) + { + innerTag = doc->createElement( "broadcast" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( device->getBroadcast() ); + innerTag.appendChild( t ); + } + if (!device->getNetmask().isEmpty()) + { + innerTag = doc->createElement( "netmask" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( device->getNetmask() ); + innerTag.appendChild( t ); + } + if (!device->getNetwork().isEmpty()) + { + innerTag = doc->createElement( "network" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( device->getNetwork() ); + innerTag.appendChild( t ); + } + } + innerTag = doc->createElement( "auto" ); + configurationTag.appendChild( innerTag ); + + if (device->getOnBoot().lower() == "yes") + t = doc->createTextNode( "1" ); + else + t = doc->createTextNode( "0" ); + + innerTag.appendChild( t ); + + innerTag = doc->createElement( "bootproto" ); + configurationTag.appendChild( innerTag ); + if (device->getBootProto().lower() == "manual") + t = doc->createTextNode( "none" ); + else + t = doc->createTextNode( device->getBootProto().lower() ); + innerTag.appendChild( t ); + + innerTag = doc->createElement( "file" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( device->getDeviceName() ); + innerTag.appendChild( t ); + + innerTag = doc->createElement( "dev" ); + tag.appendChild( innerTag ); + t = doc->createTextNode( device->getDeviceName() ); + innerTag.appendChild( t ); + + innerTag = doc->createElement( "enabled" ); + tag.appendChild( innerTag ); + if (device->isActive()) + t = doc->createTextNode( "1" ); + else + t = doc->createTextNode( "0" ); + innerTag.appendChild( t ); + + innerTag = doc->createElement( "hwaddr" ); + tag.appendChild( innerTag ); + t = doc->createTextNode( device->getMacAddress() ); + innerTag.appendChild( t ); + + //Wireless settings + + if (device->getType() == WIRELESS_IFACE_TYPE) + { + KWirelessInterface *wifiDev = static_cast<KWirelessInterface*>(device); + + if (!wifiDev->getEssid().isEmpty()) + { + innerTag = doc->createElement( "essid" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( wifiDev->getEssid() ); + innerTag.appendChild( t ); + } + if (!wifiDev->getWepKey().isEmpty()) + { + innerTag = doc->createElement( "key" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( wifiDev->getWepKey() ); + innerTag.appendChild( t ); + } + if (!wifiDev->getKeyType().isEmpty()) + { + innerTag = doc->createElement( "key_type" ); + configurationTag.appendChild( innerTag ); + t = doc->createTextNode( wifiDev->getKeyType().lower() ); + innerTag.appendChild( t ); + } + + } + if (!device->getDescription().isEmpty() && device->getDeviceName()!= "lo") + cfg.writeEntry(device->getDeviceName(),device->getDescription()); + + cfg.sync(); + } +} + +void KNetworkConfigParser::addDNSInfoToXMLDoc(QDomDocument *doc, QDomNode *root, KDNSInfo *dnsInfo) +{ + QStringList nameServerList = dnsInfo->getNameServers(); + QPtrList<KKnownHostInfo> knownHostsList = dnsInfo->getKnownHostsList(); + QPtrListIterator<KKnownHostInfo> knownHostsIt(knownHostsList); + KKnownHostInfo *host; + + QDomElement tag = doc->createElement( "hostname" ); + root->appendChild( tag ); + QDomText t = doc->createTextNode( dnsInfo->getMachineName() ); + tag.appendChild( t ); + tag = doc->createElement( "domain" ); + root->appendChild( tag ); + t = doc->createTextNode( dnsInfo->getDomainName() ); + tag.appendChild( t ); + + //Add the list of name servers + for ( QStringList::Iterator it = nameServerList.begin(); it != nameServerList.end(); ++it ) { + tag = doc->createElement( "nameserver" ); + root->appendChild( tag ); + t = doc->createTextNode( *it ); + tag.appendChild( t ); + } + + //Add the list of static hosts + while ( (host = knownHostsIt.current()) != 0 ) + { + ++knownHostsIt; + tag = doc->createElement( "statichost" ); + root->appendChild( tag ); + QDomElement innerTag; + if (!host->getIpAddress().isEmpty()) + { + innerTag = doc->createElement( "ip" ); + tag.appendChild( innerTag ); + t = doc->createTextNode( host->getIpAddress() ); + innerTag.appendChild( t ); + } + QStringList aliases = host->getAliases(); + + for ( QStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it ) + { + innerTag = doc->createElement( "alias" ); + tag.appendChild( innerTag ); + t = doc->createTextNode( *it ); + innerTag.appendChild( t ); + } + } +} + +void KNetworkConfigParser::addRoutingInfoToXMLDoc(QDomDocument *doc, QDomNode *root, KRoutingInfo *routingInfo) +{ + QDomElement tag = doc->createElement( "gateway" ); + root->appendChild( tag ); + QDomText t = doc->createTextNode( routingInfo->getGateway() ); + tag.appendChild( t ); + + tag = doc->createElement( "gatewaydev" ); + root->appendChild( tag ); + t = doc->createTextNode( routingInfo->getGatewayDevice() ); + tag.appendChild( t ); +} +/** Loads the network info from a xml file generated by the gnome system tools +network backends that are included with this app. */ +KNetworkInfo * KNetworkConfigParser::getNetworkInfo(){ + + return networkInfo; +} + +/** Parses all of the <interface>...</interface> entries in the xml configuration file. Returns a KWirelessInterface + object that contains all the info of the wireless interface. */ +KWirelessInterface * KNetworkConfigParser::getWirelessInterfaceInfo(QDomElement interface, const QString &type){ + KWirelessInterface *wifiDevice = new KWirelessInterface(); + KNetworkInterface *tempDevice = NULL; + + //first we get the standard network information + tempDevice = getInterfaceInfo(interface,type); + //Then we copy the network interface info to the wireless object. I don't + //know why it doesn't work with static_cast, after doing the cast, I can't + //write to the KWirelessInterface memebers. + memcpy(wifiDevice,tempDevice,sizeof(KNetworkInterface)); + //wifiDevice = static_cast<KWirelessInterface*>(tempDevice); + + QDomNode node = interface.firstChild(); + + while ( !node.isNull() ) + { + if ( node.isElement() ) + { + QString nodeName =node.nodeName(); + + //Parsing --get interfaces configuration + if ( node.isElement() && node.nodeName() == "configuration" ) + { + QDomNode configNode = node.firstChild(); + while ( !configNode.isNull() ) + { + if ( configNode.isElement() ) + { + QString configNodeName =configNode.nodeName(); + + if ( configNodeName == "key" ) + { + QDomElement e = configNode.toElement(); + wifiDevice->setWepKey(e.text()); + } + else if ( configNodeName == "essid" ) + { + QDomElement e = configNode.toElement(); + wifiDevice->setEssid(e.text()); + } + else if ( configNodeName == "key_type" ) + { + QDomElement e = configNode.toElement(); + wifiDevice->setKeyType(e.text()); + } + configNode = configNode.nextSibling(); + } + } + } + } + node = node.nextSibling(); + } + + return wifiDevice; +} + +/** Parses all of the <interface>...</interface> entries in the xml configuration file. Returns a KNetworkInterface + object with all the info of the interface.*/ +KNetworkInterface * KNetworkConfigParser::getInterfaceInfo(QDomElement interface, const QString &type){ + QDomNode node = interface.firstChild(); + KNetworkInterface *tempDevice = new KNetworkInterface(); + //tempDevice->setDescription(i18n("Ethernet Network Device")); + + while ( !node.isNull() ) + { + if ( node.isElement() ) + { + QString nodeName =node.nodeName(); + + //Parsing --get interfaces configuration + if ( node.isElement() && node.nodeName() == "configuration" ) + { + QDomNode configNode = node.firstChild(); + while ( !configNode.isNull() ) + { + if ( configNode.isElement() ) + { + QString configNodeName =configNode.nodeName(); + + if ( configNodeName == "auto" ) + { + QDomElement e = configNode.toElement(); + if (e.text() == "1") + tempDevice->setOnBoot("yes"); + else + tempDevice->setOnBoot("no"); + } + else if ( configNodeName == "bootproto" ) + { + QDomElement e = configNode.toElement(); + tempDevice->setBootProto(e.text()); + } + if ( configNodeName == "address" || configNodeName == "addr") + { + QDomElement e = configNode.toElement(); + if (!e.text().isEmpty()) + tempDevice->setIpAddress(e.text()); + } + else if ( configNodeName == "gateway") + { + QDomElement e = configNode.toElement(); + if (!e.text().isEmpty()) + tempDevice->setGateway(e.text()); + } + else if ( configNodeName == "netmask" || configNodeName == "mask") + { + QDomElement e = configNode.toElement(); + if (!e.text().isEmpty()) + tempDevice->setNetmask(e.text()); + } + else if ( configNodeName == "network" ) + { + QDomElement e = configNode.toElement(); + if (!e.text().isEmpty()) + tempDevice->setNetwork(e.text()); + } + else if ( configNodeName == "broadcast" || configNodeName == "bdcast") + { + QDomElement e = configNode.toElement(); + if (!e.text().isEmpty()) + tempDevice->setBroadcast(e.text()); + } + configNode = configNode.nextSibling(); + } + } + } + + //Parse -d list_ifaces interfaces configuration + if ( nodeName == "addr") + { + QDomElement e = node.toElement(); + if (!e.text().isEmpty()) + tempDevice->setIpAddress(e.text()); + } + else if ( nodeName == "mask") + { + QDomElement e = node.toElement(); + if (!e.text().isEmpty()) + tempDevice->setNetmask(e.text()); + } + else if ( nodeName == "bdcast") + { + QDomElement e = node.toElement(); + if (!e.text().isEmpty()) + tempDevice->setBroadcast(e.text()); + } + + + //These ones are common for both --get and -d list_ifaces + else if ( nodeName == "dev" ) + { + QDomElement e = node.toElement(); + tempDevice->setDeviceName(e.text()); + } + //we had to add the OR because the xml sintax when listing the interfaces + //is different than when loading the network info. ie.: enabled->active + //address->addr, etc... + else if ( nodeName == "enabled" || nodeName == "active") + { + QDomElement e = node.toElement(); + if (e.text() == "1") + tempDevice->setActive(true); + else + tempDevice->setActive(false); + } + else if ( nodeName == "hwaddr" ) + { + QDomElement e = node.toElement(); + if (!e.text().isEmpty()) + tempDevice->setMacAddress(e.text()); + } + } + node = node.nextSibling(); + } + if (type != QString::null) + tempDevice->setType(type); + + QString description; + KSimpleConfig cfg("knetworkconfrc"); + cfg.setGroup("Interfaces"); + description = cfg.readEntry(tempDevice->getDeviceName()); + if (!description.isEmpty()) + tempDevice->setDescription(description); + else + { + if (tempDevice->getType() == ETHERNET_IFACE_TYPE) + tempDevice->setDescription(i18n("Ethernet Network Device")); + else if (tempDevice->getType() == WIRELESS_IFACE_TYPE) + tempDevice->setDescription(i18n("Wireless Network Device")); + } + + //Clear IP address settings if boot protocol is dhcp or bootp, in case that they are + //setted in the config files. + if ((tempDevice->getBootProto().lower() == "dhcp") || (tempDevice->getBootProto().lower() == "bootp")) + { + tempDevice->setIpAddress(""); + tempDevice->setNetmask(""); + tempDevice->setNetwork(""); + tempDevice->setBroadcast(""); + } + + return tempDevice; +} + +/** Parses all of the <statichost>...</statichost> entries in the xml configuration file. */ +KKnownHostInfo * KNetworkConfigParser::getStaticHostInfo(QDomElement host) +{ + QDomNode node = host.firstChild(); + KKnownHostInfo *tempHost = new KKnownHostInfo(); + + while ( !node.isNull() ) + { + if ( node.isElement() ) + { + QString nodeName =node.nodeName(); + + if ( nodeName == "ip") + { + QDomElement e = node.toElement(); + if (!e.text().isEmpty()) + tempHost->setIpAddress(e.text()); + } + else if ( nodeName == "alias") + { + QDomElement e = node.toElement(); + if (!e.text().isEmpty()) + tempHost->addAlias(e.text()); + } + } + node = node.nextSibling(); + } + + return tempHost; +} + +/** Reads the xml with the network info. */ +void KNetworkConfigParser::readNetworkInfo() +{ + QPtrList<KNetworkInfo> profilesList; + //deviceList.clear(); + //The gst backend puts a \n at the beginning of the xml output, so + //we have to erase it first before we can parse it. + xmlOuput = xmlOuput.section('\n',1); + qDebug("--get XML:\n%s",xmlOuput.latin1()); + + //If the platform where knetworkconf is running isn't supported, show the + //user a dialog with all the supported platforms to choose. + if (xmlErr.contains("platform_unsup::")) + { + connect( this, SIGNAL(readyLoadingSupportedPlatforms()), this, SLOT(showSupportedPlatformsDialogSlot()) ); + loadSupportedPlatforms(); + emit errorDetectingPlatform(); + } + else //parse the XML file + { + QString err; + int x,y; + QDomDocument doc( "network"); + if ( !doc.setContent( xmlOuput.utf8(),false,&err,&x,&y ) ) + { + KMessageBox::error(0, + i18n("Could not parse the XML output from the network configuration backend."), + i18n("Error Loading The Network Configuration")); +// qDebug("error: %s %d,%d",err.latin1(),x,y); + } + + QDomElement root = doc.documentElement(); + QDomNode node = root.firstChild(); + + //Load first the network information + parseNetworkInfo(node, networkInfo, false); + + //Then, load the network profiles + node = root.firstChild(); + while( !node.isNull() ) + { + if ( node.isElement()) + { + QString nodeName = node.nodeName(); + + if ( nodeName == "profiledb" ) + { + QDomNode profileNode = node.firstChild(); + + while( !profileNode.isNull() ) + { + if ( profileNode.isElement()) + { + QString profileName = profileNode.nodeName(); + + if (profileNode.isElement() && profileName == "profile") + { + KNetworkInfo * networkProfile = new KNetworkInfo(); + QDomNode profileConfigurationNode = profileNode.firstChild(); + parseNetworkInfo(profileConfigurationNode, networkProfile, true); + profilesList.append(networkProfile); + } + } + profileNode = profileNode.nextSibling(); + } + } + } + node = node.nextSibling(); + } + networkInfo->setProfilesList(profilesList); + } +} + +void KNetworkConfigParser::parseNetworkInfo(QDomNode node, KNetworkInfo *_networkInfo, bool isProfile){ + QPtrList<KNetworkInterface> deviceList; + KDNSInfo *_dnsInfo = new KDNSInfo(); + KRoutingInfo *_routingInfo = new KRoutingInfo(); + QStringList serverList; + QPtrList<KNetworkInterface> tempDeviceList; + QPtrList<KKnownHostInfo> knownHostsList; + + while( !node.isNull() ) + { + if ( node.isElement()) + { + QString nodeName = node.nodeName(); + + //Get the gatway + if ( nodeName == "gateway" ) + { + QDomElement gateway = node.toElement(); + _routingInfo->setGateway(gateway.text()); + } + else if ( nodeName == "gatewaydev" ) + { + QDomElement gatewaydev = node.toElement(); + _routingInfo->setGatewayDevice(gatewaydev.text()); + } + //The name of the profile, in the case it's a profile ;) + else if ( nodeName == "name" && isProfile) + { + QDomElement profileName = node.toElement(); + _networkInfo->setProfileName(profileName.text()); + } + + //Get the network interfaces + else if ( nodeName == "interface" ) + { + QDomElement interface = node.toElement(); + + QString attr = interface.attribute("type").lower(); + //We have hardcoded to load only the supported interface types, + //for now, ethernet, loopback and wireless, thus loopback interfaces + //aren't shown. + if ( attr == ETHERNET_IFACE_TYPE || attr == LOOPBACK_IFACE_TYPE ) + { + KNetworkInterface *tempDevice = NULL; + tempDevice = getInterfaceInfo(interface,attr); + deviceList.append(tempDevice); + } + else if (attr == WIRELESS_IFACE_TYPE) + { + KWirelessInterface *wifiDevice = NULL; + wifiDevice = getWirelessInterfaceInfo(interface,attr); + deviceList.append(wifiDevice); + } + } + + //Get domain and host names + else if ( nodeName == "hostname" ) + { + QDomElement hostname = node.toElement(); + _dnsInfo->setMachineName(hostname.text()); + } + else if ( nodeName == "domain" ) + { + QDomElement domainname = node.toElement(); + _dnsInfo->setDomainName(domainname.text()); + } + + //Get the nameServers + else if ( nodeName == "nameserver" ) + { + QDomElement nameserver = node.toElement(); + serverList.append(nameserver.text()); + } + + //Get the static hosts + else if ( nodeName == "statichost" ) + { + QDomElement host = node.toElement(); + KKnownHostInfo *tempHost = getStaticHostInfo(host); + knownHostsList.append(tempHost); + } + } + node = node.nextSibling(); + } + _dnsInfo->setNameServers(serverList); + _dnsInfo->setKnownHostsList(knownHostsList); + + _networkInfo->setDeviceList(deviceList); + loadRoutingInfo(_routingInfo); + _networkInfo->setRoutingInfo(_routingInfo); + _networkInfo->setDNSInfo(_dnsInfo); + + //if we are loading a profile, don't try to find the IP address of DHCP + //interfaces and their states + if (!isProfile) + { + listIfaces(_networkInfo->getPlatformName()); + } + //return _networkInfo; +} +void KNetworkConfigParser::readFromStdoutReloadScript(){ + QString s = procReloadNetwork->readStdout(); + reloadScriptOutput.append(s); +} +/** emits a signal when the network changes have benn saved. */ +void KNetworkConfigParser::sendNetworkInfoSavedSignalSlot(){ + procSaveNetworkInfo->closeStdin(); +} + +/** Concatenates into a QString the xml output of the network backend. */ +void KNetworkConfigParser::concatXMLOutputSlot(){ + xmlOuput.append(procDetect->readStdout()); +} + +void KNetworkConfigParser::readXMLErrSlot(){ + xmlErr.append(procDetect->readStderr()); +} +/** lists all platforms supported by GST. */ +void KNetworkConfigParser::loadSupportedPlatforms(){ + procDetect = new QProcess(this); + procDetect->addArgument( locate("data",BACKEND_PATH) ); + procDetect->addArgument( "-d" ); + procDetect->addArgument( "platforms" ); + connect( procDetect, SIGNAL(processExited()), this, SLOT(readSupportedPlatformsSlot()) ); + xmlOuput = ""; + connect( procDetect, SIGNAL(readyReadStdout()),this, SLOT(concatXMLOutputSlot())); +// connect( procDetect, SIGNAL(readyReadStderr()),this, SLOT(readXMLErrSlot())); + + if ( !procDetect->start() ) + { +// error handling + KMessageBox::error(0, + i18n("Could not execute backend script for the network configuration detection. Something is wrong with your installation."), + i18n("Could Not Launch Network Configuration Backend Script")); + } + +} +/** Parses the xml ouput generated by GST that has all the supported platforms. */ +void KNetworkConfigParser::readSupportedPlatformsSlot(){ + //The gst backend puts a \n at the beginning of the xml output, so + //we have to erase it first before we parse it. + xmlOuput = xmlOuput.section('\n',1); + QDomDocument doc( "platforms" ); + if ( !doc.setContent( xmlOuput.utf8() ) ) + { + KMessageBox::error(0, + i18n("Could not parse the list of supported platforms from the network configuration backend."), + i18n("Error Obtaining Supported Platforms List")); + } + QDomElement root = doc.documentElement(); + QDomNode node = root.firstChild(); + QString s; + while( !node.isNull() ) + { + if ( node.isElement() && node.nodeName() == "platform" ) + { + QDomElement platform = node.toElement(); + s = getPlatformInfo(platform); + } + supportedPlatformsList << s; + node = node.nextSibling(); + } + emit readyLoadingSupportedPlatforms(); +} +/** Returns the info of a platform in the form of 'key:value' . */ +QString KNetworkConfigParser::getPlatformInfo(QDomElement platform){ + QDomNode node = platform.firstChild(); + QString s; + while ( !node.isNull() ) + { + if ( node.isElement() ) + { + if ( node.nodeName() == "key" ) + { + QDomElement e = node.toElement(); + s += e.text(); + s += ":"; + } + else if ( node.nodeName() == "name" ) + { + QDomElement e = node.toElement(); + s += e.text(); + } + + } + node = node.nextSibling(); + } + + return s; +} +/** Shows the dialog with all the supported platforms by GST. */ +void KNetworkConfigParser::showSupportedPlatformsDialogSlot(){ + KSelectDistroDlg* dialog = new KSelectDistroDlg(0, 0); + + for ( QStringList::Iterator it = supportedPlatformsList.begin(); it != supportedPlatformsList.end(); ++it ) + { + QString key = (*it); + key = key.section(":",0,0); + QString name = (*it); + name = name.section(":",1,1); + if (key.contains("debian")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/debian.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("mandriva")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/mandriva.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("conectiva")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/conectiva.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("pld")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/pld.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("redhat")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/redhat.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("suse")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/suse.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("turbolinux")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/turbolinux.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("fedora")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/fedora.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("openna")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/openna.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("slackware")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/slackware.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("freebsd")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/freebsd.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("gentoo")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/gentoo.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("blackpanther")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/blackpanther.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("rpath")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/rpath.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("vine")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/vine.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("ubuntu")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/kubuntu.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("yoper")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/yoper.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + else if (key.contains("ark")) + { + QPixmap distroImg(locate("data","knetworkconf/pixmaps/ark.png")); + dialog->klbDistroList->insertItem(distroImg, name); + } + } + + if (!dialog->exec()) + emit setReadOnly(true); + else + { + int i = 0; + QStringList::Iterator it = supportedPlatformsList.begin(); + while (i < dialog->klbDistroList->currentItem()) + { + i++; + ++it; + } + QString key = (*it); + key = key.section(":",0,0); + //clean variables and run again the detection script but now don't + //auto-detect. + xmlErr = ""; + xmlOuput = ""; + networkInfo->setPlatformName(key); + runDetectionScript(key); + if (dialog->cbAskAgain->isChecked()) + saveAskAgain(key,!dialog->cbAskAgain->isChecked()); + } +} + +void KNetworkConfigParser::saveAskAgain(const QString &platform, bool askAgain) +{ + KSimpleConfig cfg("knetworkconfrc"); + cfg.setGroup("General"); + cfg.writeEntry("detectedPlatform",platform); + cfg.writeEntry("askAgainPlatform",askAgain); + cfg.sync(); +} + +bool KNetworkConfigParser::readAskAgain(QString &platform) +{ + KSimpleConfig cfg("knetworkconfrc"); + cfg.setGroup("General"); + platform = cfg.readEntry("detectedPlatform"); + return cfg.readBoolEntry("askAgainPlatform"); +} + +/** No descriptions */ +void KNetworkConfigParser::readFromStdoutSaveNetworkInfo(){ + xmlOuput.append(procSaveNetworkInfo->readStdout()); +} +/** Calls runDetectionScript(). */ +void KNetworkConfigParser::listIfacesSlot(){ + listIfaces(networkInfo->getPlatformName()); +} +/**Returns the info of the network device 'device or NULL if not found.'*/ +KNetworkInterface * KNetworkConfigParser::getDeviceInfo(QString device){ + QPtrList<KNetworkInterface> deviceList = networkInfo->getDeviceList(); + QPtrListIterator<KNetworkInterface> i(deviceList); + KNetworkInterface *temp; + while ((temp = i.current()) != 0) + { + if (temp->getDeviceName() == device) + { + return temp; + } + ++i; + } + return NULL; +} diff --git a/knetworkconf/knetworkconf/knetworkconfigparser.h b/knetworkconf/knetworkconf/knetworkconfigparser.h new file mode 100644 index 0000000..0c2254e --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconfigparser.h @@ -0,0 +1,181 @@ +/*************************************************************************** + knetworkconfigparser.h - description + ------------------- + begin : Mon Jan 13 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#ifndef KNETWORKCONFIGPARSER_H +#define KNETWORKCONFIGPARSER_H + +#define BACKEND_PATH "knetworkconf/backends/network-conf" +#define ETHERNET_IFACE_TYPE "ethernet" +#define WIRELESS_IFACE_TYPE "wireless" +#define LOOPBACK_IFACE_TYPE "loopback" + +#define WIRELESS_WEP_KEY_TYPE_ASCII "ascii" +#define WIRELESS_WEP_KEY_TYPE_HEXADECIMAL "hexadecimal" + +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> + +#include <kapp.h> +#include <kmessagebox.h> +#include <klocale.h> +#include <qobject.h> +#include <qdir.h> +#include <qfile.h> +#include <qstring.h> +#include <qprocess.h> +#include <qdom.h> +#include <qlabel.h> +#include <qcheckbox.h> + +#include <klistbox.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> +#include <kdebug.h> + +#include "knetworkinfo.h" +#include "kdetectdistrodlg.h" +#include "kreloadnetworkdlg.h" +#include "kinterfaceupdowndlg.h" +#include "kselectdistrodlg.h" + +/** + *@author Juan Luis Baptiste + */ + +class KNetworkConfigParser : public QObject { + Q_OBJECT + public: + KNetworkConfigParser(); + ~KNetworkConfigParser(); + /** return tyhe number of configured devices. */ + unsigned numDevices(); + void setProgramVersion(QString ver); + /** Reads /proc/net/route looking for the default gateway. */ + void loadRoutingInfo(KRoutingInfo *routingInfo); + /** Saves the new network configuration. */ + void saveNetworkInfo(KNetworkInfo *networkInfo); + /** Loads the network info from a xml file generated by the gnome system tools + network backends that are included with this app. */ + KNetworkInfo * getNetworkInfo(); + QProcess * proc; + QProcess * procDetect; + QProcess * procSaveNetworkInfo; + /** Variable to know if there is an dhcp device configured, so we can know if we need to save the defauilt gw info or not. */ + bool dhcpDevice; + KNetworkInterface * getDeviceInfo(QString device); + + + public slots: + /** runs gst to find out the state of network devices.It runs the command: + $knetworkconf_home/backends/networkconf [--platform platform] -d list_ifaces */ + void listIfaces(const QString &platform); + + private slots: + /** Runs the gst backend to get network values. You can pass to the script a specific platform to load using the platform parameter. */ + void runDetectionScript(QString platform); + void readIfconfigOutput(); + void readNetworkInfo(); + void readFromStdoutReloadScript(); + /** emits a signal when the network changes have benn saved. */ + void sendNetworkInfoSavedSignalSlot(); + /** Concatenates into a QString the xml output of the network backend. */ + void concatXMLOutputSlot(); + void readXMLErrSlot(); + /** Shows the dialog with all the supported platforms by GST. */ + void showSupportedPlatformsDialogSlot(); + /** Parses the xml ouput generated by GST that has all the supported platforms. */ + void readSupportedPlatformsSlot(); + /** No descriptions */ + void readListIfacesSlot(); + void readFromStdoutSaveNetworkInfo(); + /** Calls runDetectionScript(). */ + void listIfacesSlot(); + /** save process has exited */ + void processExitedSlot(); + + private: + //QPtrList<KNetworkInterface> deviceList; + QPtrList<KNetworkInterface> tempList; + KNetworkInterface *newDevice; + bool isUp; + /** Counts the number of configured devices that had been found. */ + unsigned _numDevices; + KRoutingInfo *routingInfo; + KDNSInfo *dnsInfo; + QString programVersion; + /** The output of ifconfig command that needs to be parsed in readIfconfigOutput()*/ + QString ifconfigOutput; + KNetworkInfo * networkInfo; + QPtrList<KKnownHostInfo> knownHostsList; + QString hexIPv4ToDecIPv4(const QString &hex); + /** lists all platforms supported by GST. */ + void loadSupportedPlatforms(); + /** Returns the info of a platform in the form of 'key:value' . */ + QString getPlatformInfo(QDomElement platform); + /** save process is running */ + bool processRunning; + + /** Shows a progress dialog while the networl is being reloaded. */ + KInterfaceUpDownDlg * kpdReloadStatusDlg; + QProcess *procReloadNetwork; + QString reloadScriptOutput; + /** Contains the network configuration en xml format. */ + /** List of supported platforms. */ + QStringList supportedPlatformsList; + QString xmlOuput; + QString xmlErr; + /** Temporal device list to be used when loading the dhcp devices info */ + QPtrList<KNetworkInterface> tempDevList; + /** Parses all of the <statichost>...</statichost> entries in the xml configuration file. */ + KKnownHostInfo * getStaticHostInfo(QDomElement host); + /** Saves the option to show again or not the platform using KSimpleConfig*/ + void saveAskAgain(const QString &platform, bool askAgain); + /**Returns if the show platform should be shown again or not and the saved platform*/ + bool readAskAgain(QString &platform); + void parseNetworkInfo(QDomNode node, KNetworkInfo *networkInfo, bool isProfile); + void addRoutingInfoToXMLDoc(QDomDocument *doc, QDomNode *root, KRoutingInfo *routingInfo); + void addDNSInfoToXMLDoc(QDomDocument *doc, QDomNode *root, KDNSInfo *dnsInfo); + void addNetworkInterfacesToXMLDoc(QDomDocument *doc, QDomNode *root, QPtrList<KNetworkInterface> devList); + void addNetworkProfilesToXMLDoc(QDomDocument *doc, QDomNode *root, QPtrList<KNetworkInfo> profileList); + + protected: // Protected methods + /** Parses all of the <interface>...</interface> entries in the xml configuration file. */ + virtual KNetworkInterface *getInterfaceInfo(QDomElement interface, const QString &type); + /** Parses all of the <interface>...</interface> entries in the xml configuration file. Returns a KWirelessInterface + object that contains all the info of the wireless interface. */ + virtual KWirelessInterface *getWirelessInterfaceInfo(QDomElement interface, const QString &type); + + signals: // Signals + /** emmited when the xml file is finished reading. */ + void readyLoadingNetworkInfo(); + + /** emmited when the xml file saved and the backend has finished executing. */ +// void readySavingNetworkInfo(); + + /** Signal that is sent when fillDevices() has finished fllind the dhcp devices. */ + void readyIfconfigOutputSignal(); + /** Signal emmited when the platform can't be auto-detected. */ + void errorDetectingPlatform(); + /** signal emmited when the parsing of the xml of the supported platform list. */ + void readyLoadingSupportedPlatforms(); + /** signal emmited when the config parser needs to set read only the GUI because + some error in the parsing, or the platform isn't supported.*/ + void setReadOnly(bool); +}; + +#endif diff --git a/knetworkconf/knetworkconf/knetworkconfmodule.cpp b/knetworkconf/knetworkconf/knetworkconfmodule.cpp new file mode 100644 index 0000000..03b8554 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconfmodule.cpp @@ -0,0 +1,118 @@ +/*************************************************************************** + knetworkconfmodule.cpp - description + ------------------- + begin : Tue Apr 1 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : juancho@linuxmail.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. * + * * + ***************************************************************************/ + +#include <klocale.h> +#include <kcmodule.h> +#include <qlayout.h> +#include <version.h> +#include "knetworkconfmodule.h" + + + +KNetworkConfModule::KNetworkConfModule(QWidget* parent, const char *name/*, QStringList list*/) + : KCModule(parent,name) +{ + QVBoxLayout *top = new QVBoxLayout(this); + + conf = new KNetworkConf(this); + conf->setVersion(QString(VERSION)); + conf->setReadOnly(false); + + top->addWidget(conf); + + if (getuid() != 0){ + conf->setReadOnlySlot(true); + conf->setReadOnly(true); + } + + connect(conf,SIGNAL(networkStateChanged(bool)),SLOT(configChanged(bool))); + setButtons(KCModule::Apply|KCModule::Help); +} + +KNetworkConfModule::~KNetworkConfModule() +{ +} + +void KNetworkConfModule::configChanged(bool b) +{ + emit changed(b); +} + +void KNetworkConfModule::load() +{ + // conf->loadNetworkDevicesInfo(); + //conf->loadRoutingAndDNSInfo(); + //conf->loadDNSInfoTab(); +} + +void KNetworkConfModule::save() +{ + conf->saveInfoSlot(); +} +/* +int KNetworkConfModule::buttons() +{ + return KCModule::Ok|KCModule::Apply|KCModule::Help; +} +*/ +bool KNetworkConfModule::useRootOnlyMsg() const +{ + return true; +} + +QString KNetworkConfModule::rootOnlyMsg() const +{ + return "Changing the network configuration requires root access"; +} + +KAboutData* KNetworkConfModule::aboutData() const +{ + /*KAboutData* data = new KAboutData( "knetworkconf", I18N_NOOP("KNetworkConf"), + VERSION, description, KAboutData::License_GPL, + "(c) 2003, Juan Luis Baptiste", 0, "http://www.merlinux.org/knetworkconf/", "jbaptiste@merlinux.org"); + data->addAuthor("Juan Luis Baptiste",I18N_NOOP("Lead Developer"), + "jbaptiste@merlinux.org"); + data->addCredit("David Sansome",I18N_NOOP("Various bugfixes and features"), + "me@davidsansome.com"); + + return data; // Memory leak, oh well...*/ + +KAboutData *aboutData = new KAboutData( "knetworkconf", I18N_NOOP("KNetworkConf"), + VERSION, description, KAboutData::License_GPL, + "(c) 2003 - 2005, Juan Luis Baptiste", 0, "http://www.merlinux.org/knetworkconf/", "juan.baptiste@kdemail.net"); + aboutData->addAuthor("Juan Luis Baptiste",I18N_NOOP("Lead Developer"), + "juan.baptiste@kdemail.net"); + aboutData->addCredit("Carlos Garnacho and the Gnome System Tools Team",I18N_NOOP("Provided the Network backend which KNetworkConf relies on."), + "garnacho@tuxerver.net","http://www.gnome.org/projects/gst/"); + aboutData->addCredit("Helio Chissini de Castro",I18N_NOOP("Conectiva Linux Support"), + "helio@conectiva.com.br"); + aboutData->addCredit("Christoph Eckert",I18N_NOOP("Documentation maintainer, and German translator"), + "mchristoph.eckert@t-online.de "); + aboutData->addCredit("David Sansome",I18N_NOOP("Various bugfixes and features"), + "me@davidsansome.com"); + aboutData->addCredit("Gustavo Pichorim Boiko",I18N_NOOP("Various bugfixes and Brazilian Portuguese translator"),"gustavo.boiko@kdemail.net"); + return aboutData;// Memory leak, oh well... +} + +QString KNetworkConfModule::quickHelp() const +{ + return i18n("%1Network configuration%2This module allows you to configure your TCP/IP settings.%3").arg("<h1>").arg("</h1><p>").arg("</p>"); +} + +//#include "knetworkconfmodule.moc" + +#include "knetworkconfmodule.moc" diff --git a/knetworkconf/knetworkconf/knetworkconfmodule.h b/knetworkconf/knetworkconf/knetworkconfmodule.h new file mode 100644 index 0000000..424dc94 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkconfmodule.h @@ -0,0 +1,49 @@ +/*************************************************************************** + knetworkconfmodule.h - description + ------------------- + begin : Tue Apr 1 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : juancho@linuxmail.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. * + * * + ***************************************************************************/ + +#ifndef KNETWORKCONFMODULE_H +#define KNETWORKCONFMODULE_H + +#include "knetworkconf.h" +#include <kaboutdata.h> +#include <kcmodule.h> + +class KNetworkConfModule : public KCModule +{ + Q_OBJECT + +public: + KNetworkConfModule(QWidget* parent, const char *name/*, QStringList list*/); + ~KNetworkConfModule(); + + void load(); + void save(); + int buttons(); + + bool useRootOnlyMsg() const; + QString rootOnlyMsg() const; + KAboutData* aboutData() const; + QString quickHelp() const; + +private slots: + void configChanged(bool); + +private: + KNetworkConf* conf; +}; + +#endif diff --git a/knetworkconf/knetworkconf/knetworkinfo.cpp b/knetworkconf/knetworkconf/knetworkinfo.cpp new file mode 100644 index 0000000..182bc14 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkinfo.cpp @@ -0,0 +1,76 @@ +/*************************************************************************** + knetworkinfo.cpp - description + ------------------- + begin : Fri Jan 17 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#include "knetworkinfo.h" + +KNetworkInfo::KNetworkInfo(){ +} +KNetworkInfo::~KNetworkInfo(){ +} +void KNetworkInfo::setDeviceList(QPtrList<KNetworkInterface> deviceList){ + KNetworkInfo::deviceList = deviceList; +} +void KNetworkInfo::setRoutingInfo(KRoutingInfo *routingInfo){ + KNetworkInfo::routingInfo = routingInfo; +} +void KNetworkInfo::setDNSInfo(KDNSInfo *dnsInfo){ + KNetworkInfo::dnsInfo = dnsInfo; + +} +QPtrList<KNetworkInterface> KNetworkInfo::getDeviceList(){ + return deviceList; +} +KRoutingInfo * KNetworkInfo::getRoutingInfo(){ + return routingInfo; +} +KDNSInfo * KNetworkInfo::getDNSInfo(){ + return dnsInfo; +} + +void KNetworkInfo::setNetworkScript(QString script){ + KNetworkInfo::networkScript = script; +} +QString KNetworkInfo::getNetworkScript(){ + return networkScript; +} +/** Returns the platform name KnetworkConf is running on. */ +QString KNetworkInfo::getPlatformName(){ + return platformName; +} +/** Sets the platform name KNetworkConf is running on. */ +void KNetworkInfo::setPlatformName(QString name){ + KNetworkInfo::platformName = name; +} + +void KNetworkInfo::setProfilesList(QPtrList<KNetworkInfo> profilesList){ + KNetworkInfo::profilesList = profilesList; +} + +QPtrList<KNetworkInfo> KNetworkInfo::getProfilesList(){ + return profilesList; +} + +/** Returns the platform name KnetworkConf is running on. */ +QString KNetworkInfo::getProfileName(){ + return profileName; +} +/** Sets the platform name KNetworkConf is running on. */ +void KNetworkInfo::setProfileName(QString profileName){ + KNetworkInfo::profileName = profileName; +} + + diff --git a/knetworkconf/knetworkconf/knetworkinfo.h b/knetworkconf/knetworkconf/knetworkinfo.h new file mode 100644 index 0000000..7ae8b25 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkinfo.h @@ -0,0 +1,68 @@ +/*************************************************************************** + knetworkinfo.h - description + ------------------- + begin : Fri Jan 17 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#ifndef KNETWORKINFO_H +#define KNETWORKINFO_H + +#include <qstring.h> +#include <qptrlist.h> +#include "knetworkinterface.h" +#include "kwirelessinterface.h" +#include "kaddressvalidator.h" +#include "kroutinginfo.h" +#include "kdnsinfo.h" + +/**Represents the network information + *@author Juan Luis Baptiste + */ + +class KNetworkInfo { + public: + KNetworkInfo(); + ~KNetworkInfo(); + private: // Private attributes + QPtrList<KNetworkInterface> deviceList; + KRoutingInfo *routingInfo; + /** Path to the network script that permits starting/stopping/reloading the + network. */ + QString networkScript; + KDNSInfo *dnsInfo; + /** Platform name. */ + QString platformName; + QPtrList<KNetworkInfo> profilesList; + QString profileName; + + public: // Public attributes + void setDeviceList(QPtrList<KNetworkInterface> deviceList); + void setRoutingInfo(KRoutingInfo *routingInfo); + void setDNSInfo(KDNSInfo *dnsInfo); + QPtrList<KNetworkInterface> getDeviceList(); + KRoutingInfo *getRoutingInfo(); + KDNSInfo *getDNSInfo(); + QString getNetworkScript(); + void setNetworkScript(QString script); + /** Returns the platform name KnetworkConf is running on. */ + QString getPlatformName(); + /** Sets the platform name KNetworkConf is running on. */ + void setPlatformName(QString name); + void setProfilesList(QPtrList<KNetworkInfo> profilesList); + QPtrList<KNetworkInfo> getProfilesList(); + void setProfileName(QString profileName); + QString getProfileName(); +}; + +#endif diff --git a/knetworkconf/knetworkconf/knetworkinterface.cpp b/knetworkconf/knetworkconf/knetworkinterface.cpp new file mode 100644 index 0000000..4e48c27 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkinterface.cpp @@ -0,0 +1,104 @@ +/*************************************************************************** + knetworkinterface.cpp - description + ------------------- + begin : Mon Jan 13 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#include "knetworkinterface.h" + +KNetworkInterface::KNetworkInterface(){ +} +KNetworkInterface::~KNetworkInterface(){ +} + +QString KNetworkInterface::getBootProto(){ + return bootProto; +} +QString KNetworkInterface::getBroadcast(){ + return broadcast; +} +QString KNetworkInterface::getDeviceName(){ + return deviceName; +} +QString KNetworkInterface::getIpAddress(){ + return ipAddress; +} +QString KNetworkInterface::getNetmask(){ + return netmask; +} +QString KNetworkInterface::getNetwork(){ + return network; +} +QString KNetworkInterface::getOnBoot(){ + return onBoot; +} +QString KNetworkInterface::getGateway(){ + return gateway; +} + +void KNetworkInterface::setBootProto(const QString &bootProto){ + KNetworkInterface::bootProto = bootProto; +} +void KNetworkInterface::setBroadcast(const QString &broadcast){ + KNetworkInterface::broadcast = broadcast; +} +void KNetworkInterface::setDeviceName(const QString &deviceName){ + KNetworkInterface::deviceName = deviceName; +} +void KNetworkInterface::setIpAddress(const QString &ipAddress){ + KNetworkInterface::ipAddress = ipAddress; +} +void KNetworkInterface::setNetmask(const QString &netmask){ + KNetworkInterface::netmask = netmask; +} +void KNetworkInterface::setNetwork(const QString &network){ + KNetworkInterface::network = network; +} +void KNetworkInterface::setOnBoot(const QString &onBoot){ + KNetworkInterface::onBoot = onBoot; +} +void KNetworkInterface::setGateway(const QString &gateway){ + KNetworkInterface::gateway = gateway; +} +bool KNetworkInterface::isActive(){ + return active; +} +void KNetworkInterface::setActive(bool active){ + KNetworkInterface::active = active; +} +/** No descriptions */ +QString KNetworkInterface::getMacAddress(){ + return hwAddress; +} +/** No descriptions */ +void KNetworkInterface::setMacAddress(const QString &addr){ + KNetworkInterface::hwAddress = addr; +} +/** No descriptions */ +QString KNetworkInterface::getDescription(){ + return description; +} +/** No descriptions */ +void KNetworkInterface::setDescription(const QString &desc){ + KNetworkInterface::description = desc; +} + +/** No descriptions */ +QString KNetworkInterface::getType(){ + return type; +} +/** No descriptions */ +void KNetworkInterface::setType(const QString &type){ + KNetworkInterface::type = type; +} diff --git a/knetworkconf/knetworkconf/knetworkinterface.h b/knetworkconf/knetworkconf/knetworkinterface.h new file mode 100644 index 0000000..859afc6 --- /dev/null +++ b/knetworkconf/knetworkconf/knetworkinterface.h @@ -0,0 +1,83 @@ +/*************************************************************************** + knetworkinterface.h - description + ------------------- + begin : Mon Jan 13 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ + +#ifndef KNETWORKINTERFACE_H +#define KNETWORKINTERFACE_H + +#include <qstring.h> + +/**This class has all the values associated with a network interface. + *@author Juan Luis Baptiste + */ + +class KNetworkInterface { + public: + KNetworkInterface(); + ~KNetworkInterface(); + + QString getBootProto(); + QString getBroadcast(); + QString getDeviceName(); + QString getIpAddress(); + QString getNetmask(); + QString getNetwork(); + QString getOnBoot(); + QString getGateway(); + void setBootProto(const QString &bootProto); + void setBroadcast(const QString &broadcast); + void setDeviceName(const QString &deviceName); + void setIpAddress(const QString &ipAddress); + void setNetmask(const QString &netmask); + void setNetwork(const QString &network); + void setOnBoot(const QString &onBoot); + void setGateway(const QString &gateway); + bool isActive(); + void setActive(bool active); + void setMacAddress(const QString &addr); + QString getMacAddress(); + void setDescription(const QString &desc); + QString getDescription(); + void setType(const QString &type); + QString getType(); + + private: // Private attributes + /** Interface name (i.e. eth0, eth1, etc). */ + QString deviceName; + /** Boot protocol of the device (static, dhcp). */ + QString bootProto; + /** IPv4 address of the interface. */ + QString ipAddress; + /** The Netmask. */ + QString netmask; + /** The network. */ + QString network; + /** The broadcast. */ + QString broadcast; + /** thetermines if this device is configured at boot time. */ + QString onBoot; + /** default gateway for this device. */ + QString gateway; + bool active; + /** The MAC address. */ + QString hwAddress; + /** A little description about the network device. */ + QString description; + /** Type of interface (ethernet,wireless,loopback or modem)*/ + QString type; +}; + +#endif diff --git a/knetworkconf/knetworkconf/kprofileslistviewtooltip.cpp b/knetworkconf/knetworkconf/kprofileslistviewtooltip.cpp new file mode 100644 index 0000000..a326e23 --- /dev/null +++ b/knetworkconf/knetworkconf/kprofileslistviewtooltip.cpp @@ -0,0 +1,16 @@ +// +// C++ Implementation: %{MODULE} +// +// Description: +// +// +// Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR} +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "kprofileslistviewtooltip.h" + +KProfilesListViewToolTip::~KProfilesListViewToolTip() +{ +} diff --git a/knetworkconf/knetworkconf/kprofileslistviewtooltip.h b/knetworkconf/knetworkconf/kprofileslistviewtooltip.h new file mode 100644 index 0000000..c0c6bce --- /dev/null +++ b/knetworkconf/knetworkconf/kprofileslistviewtooltip.h @@ -0,0 +1,139 @@ +/*************************************************************************** + kprofileslistviewtooltip.h - description + ------------------- + begin : Wed Aug 24 2005 + copyright : (C) 2005 by Juan Luis Baptiste + email : juan.baptiste@kdemail.net + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#ifndef KPROFILESLISTVIEWTOOLTIP_H +#define KPROFILESLISTVIEWTOOLTIP_H + +#include <qtooltip.h> +#include <qlistview.h> +#include <qheader.h> +#include <qptrlist.h> + +#include "knetworkinfo.h" +#include "knetworkconfigparser.h" + +class KProfilesListViewToolTip : public QToolTip +{ +public: + KProfilesListViewToolTip(QListView* parent); + void setProfiles(QPtrList<KNetworkInfo> profiles_); + ~KProfilesListViewToolTip(); + +protected: + void maybeTip( const QPoint& p ); + KNetworkInfo *getProfile(QPtrList<KNetworkInfo> profilesList, QString selectedProfile); +private: + QListView* listView; + //KNetworkConf* conf; + QPtrList<KNetworkInfo> profiles; + +}; + +inline void KProfilesListViewToolTip::setProfiles(QPtrList<KNetworkInfo> profiles_) +{ + profiles = profiles_; +} + +inline KProfilesListViewToolTip::KProfilesListViewToolTip( QListView* parent ):QToolTip( parent->viewport() ), listView( parent ) {} + +inline void KProfilesListViewToolTip::maybeTip( const QPoint& p ) +{ + + if ( !listView ) + return; + + const QListViewItem* item = listView->itemAt( p ); + + if ( !item ) + return; + + const QRect itemRect = listView->itemRect( item ); + + if ( !itemRect.isValid() ) + return; + + const int col = listView->header()->sectionAt( p.x() ); + + if ( col == -1 ) + return; + + const QRect headerRect = listView->header()->sectionRect( col ); + + if ( !headerRect.isValid() ) + return; + + const QRect cellRect( headerRect.left(), itemRect.top(),headerRect.width() + 60, itemRect.height() ); + + QString tipStr; + + if( col == 0 ) + { + tipStr = QString(i18n("<b>Network Configuration of this Profile:</b>" )); + KNetworkInfo *profile = getProfile(profiles,item->text(0)); + if (profile != NULL) + { + QPtrList<KNetworkInterface> devices = profile->getDeviceList(); + KNetworkInterface *device = NULL; + for (device = devices.first(); device; device = devices.next()) + { + if (device->getType() != LOOPBACK_IFACE_TYPE) + { + tipStr.append(i18n("<p><b>Interface:</b> %1").arg(device->getDeviceName().latin1())); + tipStr.append(i18n("<br><b>Type:</b> %1").arg(device->getType())); + QString bootProto; + if (device->getBootProto() == "none") + bootProto = "Manual"; + else + bootProto = device->getBootProto(); + tipStr.append(i18n("<br><b>Boot Protocol:</b> %1").arg(bootProto)); + if (bootProto != "dhcp") + { + tipStr.append(i18n("<br><b>IP Address:</b> %1").arg(device->getIpAddress())); + tipStr.append(i18n("<br><b>Broadcast Address:</b> %1").arg(device->getBroadcast())); + } + tipStr.append(i18n("<br><b>On Boot:</b> %1").arg(device->getOnBoot())); + } + } + KRoutingInfo *route = profile->getRoutingInfo(); + tipStr.append(i18n("</p><p><b>Default Gateway:</b> %1").arg(route->getGateway())); + KDNSInfo *dns = profile->getDNSInfo(); + tipStr.append(i18n("<br><b>Domain Name:</b> %1").arg(dns->getDomainName())); + tipStr.append(i18n("<br><b>Machine Name:</b> %1").arg(dns->getMachineName())); + QStringList nameServers = dns->getNameServers(); + for ( QStringList::Iterator it = nameServers.begin(); it != nameServers.end(); ++it) + { + tipStr.append(i18n("<br><b>DNS Name Server:</b> %1").arg((*it))); + } + } + } + tip( cellRect, tipStr ); +} + +inline KNetworkInfo *KProfilesListViewToolTip::getProfile(QPtrList<KNetworkInfo> profilesList, QString selectedProfile) +{ + QPtrListIterator<KNetworkInfo> it(profilesList); + KNetworkInfo *net = NULL; + + while ((net = it.current()) != 0) + { + ++it; + if (net->getProfileName() == selectedProfile) + break; + } + return net; +} + +#endif diff --git a/knetworkconf/knetworkconf/kreloadnetworkdlg.ui b/knetworkconf/knetworkconf/kreloadnetworkdlg.ui new file mode 100644 index 0000000..3041186 --- /dev/null +++ b/knetworkconf/knetworkconf/kreloadnetworkdlg.ui @@ -0,0 +1,137 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KReloadNetworkDlg</class> +<widget class="KDialog"> + <property name="name"> + <cstring>KReloadNetworkDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>2</x> + <y>0</y> + <width>342</width> + <height>130</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>342</width> + <height>130</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>342</width> + <height>130</height> + </size> + </property> + <property name="caption"> + <string>Reloading Network</string> + </property> + <property name="icon"> + <pixmap>image0</pixmap> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>tlNetworkStatus</cstring> + </property> + <property name="geometry"> + <rect> + <x>40</x> + <y>72</y> + <width>273</width> + <height>20</height> + </rect> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string></string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kpbOk</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="geometry"> + <rect> + <x>139</x> + <y>96</y> + <width>58</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="autoResize"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>PixmapLabel1</cstring> + </property> + <property name="geometry"> + <rect> + <x>20</x> + <y>20</y> + <width>40</width> + <height>40</height> + </rect> + </property> + <property name="pixmap"> + <pixmap>image1</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="geometry"> + <rect> + <x>73</x> + <y>20</y> + <width>291</width> + <height>46</height> + </rect> + </property> + <property name="text"> + <string>Please wait while the network is reloaded so +the changes can take effect.</string> + </property> + </widget> +</widget> +<images> + <image name="image0"> + <data format="XPM.GZ" length="8846">789cedd8596f23b91107f0f7fd1483e1db22e04a2d75ab1b411e7cdff7ed200f7550be0fd996652bc8774f8bf52fcd6633bb3b405e331e60fc1b36c962f1684abffcfce57c7fe7cbcfbffcf4fa466f37f245aee9e5cbcf3a7e78f8fcfb3ffef6cf9fbef68a2feddf7eb7ffa5f8fa979fbe1ebc7d912fbb4f8f6906aa5a844efe3333776031cbe6dcf5cc71dd3c5029670e1b66ae86c35cae664d6659300f876635d7f3fe2ee07e373b8de0dafa4b7730fa971b73b763e67518cf478bbf1e944d3f8f2fd76f4b3b858d67df3cfbc9f5afcc45dfca696a2e1b8b2f26f33cfe9d998b4ea76fe57a6eee623cfa08633cbc060bfabf35178887d05ed1b77868d7dcc3f371c33c24f49ff353346dbc4d6e7fd5ddcb4e6fb0a0fcdcddeb663f9b7b5ebe64aebb66da9eb9d79db7a7708dfa2bb0f4b3b534f7fa562e57735bfb5d18fdc5a9b9eff3b1067bfbcbb058fdc0e6b263e5f1186e10efc85c299ecff9e8353e1f6cf59ba263f1ca078cf6e9d2dc43fbfc34772e9737779f723ebcbc8ff676e01ae35518f98927e63ed657b870e37981519f3ae612fdd32d5c9a756c1e74b1be97ccbe3e25e7afdff5f8f9d66df1f0238cf84263ee77b01fc85de6f1c62318e30d4b708df6a6ee321f2e7a3777ae4f7bb0207f8f6e2be70573595a7b74012bfa5373d5c08bb0cf37e21da09c7ae6baa19c9f78062b49f6b9799eaf836c6ae733c72387b0603c7d731ff32f2b6e8b3fbdc3a81fc45c22dfa1823dde64ae4a3c3f86d54c9fe601c62f23b7c54336bfd4746d7ce1c69c70fe6ace4f59f46a9c1f0b73db7a2acdbebed2d88df11670698e87e6aa6be30da8eff90e6fe6ba8b78cfdd03cef50fe006ed2d9ba914cdf5afe0a4f97d42d65e9bdf2a3f2feb70bfb2fe0730d61b6dbaad9cb761ac3749e612f345fb6e6b9f0ee0d2cc616e9bdf09dca07ed76dcfc74f18f393d2dc168fcd07555edff24903cf6734d75d8ce71946fbe1de4c5dcef9a23e4c9adfdf71094ec8e79a990bf801aecc11f16b81f592df375551e07d96a2b98ff390c6e6365f16ff03dc0c7af9f96b18e3a57b379e3f73d7f979be33fb7ad22537c6bbe2b6f66908fb7aab61b5f5c5886780fcf1b51bf3f939b79d67886f80fd2727b0cfcf861bf15f996b9c4f710fc67c33ea37180f217f4dc9763e239ea6b1fea29813d97a171bff7c3dc92aac18ff87d9f3131f60bc0fd2d48d781760c4cf43b7b5271b30da677880f54f4f6eec5ff45f7b3e0fdd563f7cc2a81fd07fad7030371eff9b993c5f182f119ecff10e7a25cedbb00c37160f1d9bab12eb29c24d9dcbc339ece32bcd3eff3c7263fd0a5c223f9f73e7f6e4d5dde4f707ddc0982ffe30d7bebed01f91c51776e064fb372e9a7d7ff29b59fd7eb762f6f71359ffecfb497ae6aab4fcc991dbfa936d18eb996fdc584f8f6ebb3f6817f6fd94dc964fb9300f709ea70f18f9a1018cf9119b1ff6f38c37dde8ff1cf6f576eac6fb0cf1d41eef96dbe289964f6ed05f1cc3c84fdc3793cf47e5b6fc68ce4fddf3f1f0115cda799716ddc8e7c45c7b7d85514e276edc2f6ad8e35f3737a81f0ad8d7ef018c7c47f447fefebc857d7d2eba6d3d09c309eb7f646e27d8ce1f9433d9e7b57803276b5fd1be909d57e1da3cbf1fe5f74dddae07acb78e7980fdcd369e76feb05eae61df8fa85f637da9b8ad9cefcd8daf2f86fdfe7607a33e356eb46ff967c2fe0c5b6eecb76d9890cf7737e6e3d5cc15fc31b78da7326b61f949397f4ddfdf47fa60f6f345a76eac9fdaecf9d0037383fb7be8c1d88ff1d46deb890a5871feac9809eb270ee6b67c5cbad15e0327ab1f9fcced7ab0f583fea4b2724de6f9e7ddbcff1be9fbe75d32fb7a50eb4f067eff2b60ac7f3d83fdfd3f36fb79905e611fdf9ab969b0df96dd562e258cf6b463f6fb911ec378ffc65d3317964f41fc4c582f2fe6f6e36936231ef5ef337a30f247c19c8a6195dbc3f88615eeafb9bdf63aeae76b03fb793a343738eff818c6fb2a4ccd84fbbd3ec164f1f33e8c78c29eb97d9fd8febe8231bff1024ef8bee6d0ecf31dfb6eecb72db312fc684eb82fcac03c447e388f9fdaf9407c3b66c2fae67737c613619c973481d11f5fc2c9cab572dbfc865d335736bf7a0de3fce25338e13cdb364b81f3600857767f0e4f30fa0ffb6edcaf6d3ec5bf7f4979feb93f28f1792a99fdbc123113ee3bf40e633da60518f1a54f33e37cd12bd8c7378131fff2ecb6727934cfe76fd56deb31ac9be7fb39af17d6c6cfa30d73db9f7dbe588409fbe9c82c95ad1f79715bfbfa0a63bd8503b326cb1f9179de7f3e0fa5f4f7b7bc9bfdfdc43d18eb55d7cde2f7a5018c78f5d08dfe6fdd88ef1e46bea89e3b3f9f866ed43f36abe7ffc68d7c6ec2ed27eeec2373427be1d13cf4f97c8131fe94f321eaf7115137d64f6366e45b8730d68baeb9311fddb9ed3cdf327b3e640f46791cb96d3c3c312bce0f798291df18cca948793ed5e6a79d4f9cafd76e9c0ff97dd8be1c70bec99dd9cf5ffd304b81f14f617c1ed25518eb273e9bb5302bc3d8bfe90af6f9c0f3a932c7c23c1c22fe7c3eb4a77983ef2befdd781f4fcc8cfd1fdecd52587b5cc3c88fec9a3dbef40c233e0d3059ffe905f6fd71644e783ebe9a3ddec86eec9fbcfe52c515eeaf7b66cf5fe8c0685fdfcc1e1f57b0e77be0c6f85e60d4e72db3cf7f7a70dbfb2f9cc29eef1518dfffc735f3d0bf6fc8f7b594c4cfe73bf33cbe06f6fbc9a51bf37b0627eb5f9fcdf3f5f90e57660970b2fabaefc6e7abbcff86957f7f96ee61c2fb3dc2e82f6e9ae7f391f3331c6a81fbf02eecf7ed4b7342fc24e621f2c7fdb9adbd4f18efa374eb463ce3b92dbf04239e83b7ffede7ff6dfc771b31448af4a33566cfb63f1c256a4cf33686f1aafddfeb1faa4bf126dec6bb781f1fe2a3d5c96d3cc5e7388a2f7f52ff35bec5717c8f93f8113fe3342ec4c5b814156d2cc795b81ad7e27adcf86eedcdb815b7e34edc8d7b713f1ec4c378148fe3493c8d67f1dc73da8eee225ec64eecfe26f222f6623f96b18a8358c726c41002050e1234a4300c57e1dadb0837e136dc85fbf0e0a30e8fe1293c87517809afe12d8cc37b98848ff019a661212c86a5b01c56c26a580bebf33636c266d80adb6127ec86bdb01f0ec261380ac7e1249c86b3701e2ec265e8846e28422ff44319aa30087568669d7d5b1fedddb3bd7e507bc4d090aee89a6ee896ee82d23d3dd0233dd1338de8855ee98dc6f44e13faa04f9ad2022dfeaa8d255a8ea7b442abb446ebb4419bb445dbb443bbb447fb7440877444c77442a774d6d63ca70bbaa44efbd62fbeb511957aedcdbea48a065453c391437b0f63169ebdff877cc5d77c430b7ccb777ccf0ffcc84ffccc237ef9551bd7fcca6f3ce6f7483ce10ffee4292ff0222ff132aff02aafcd4adab275de085ddee4adac6dde99cfedccbb7193f76c56789f0ff8908ff8984ff894cff89c2ff8329774b8dbde5b7bf9f73e975c7d6b8307dc7e488f2471562aa1bd5fb1c8ecde913d942bb9cebfddc8ad451489166c9f791b7227f7d2ae0e7a97477992679ac8485ee455de667dca58de6592dbf8904f6b41a66deeaa6f7b5f16c2baed4659942559961559953559a74dd9904dbe932d5a90ed5c734776f3bf7bb2ff7be74758a77d399043399263399153399373b9903617d299ef5c92aec7f0dd36aedb9b6c4ffaf9c63a68efcd75fbd1296a7bc268aead9cdb186b9b2a556be9b76db4efe6a15ee9b5dee8added9f3dcd3fbb676de4bfaa84ff9df671db56513d9fade59a82ffaaa6d96754c95e619d0897ee8a74ef3ef0bba184ef36f5197e2912e7fb78d155dd5b57686665f283fb731aceb866eea96e69cea8eeeea9eeee7bd7ddeb671f0bd36a2eaa11ef9f94aedbd4a8ff5444ff52cb771ae177aa939bfe154bb5a7c378e9ee51eeae7fbe1406b6d66ff9b620a69f6017290d55e8dfefcddd0de50c669186ed355ba9e8d2edda45bde928d74a7a3ff5c637fd0c67d9e9b771d259c71e9313da5e7bcd67fb00d1ee9527b1bde4f7769945ed26b7a4bed7ca5f734491f3f1cc747fae44276da7a5369f77b9af2e3ec8c490b61fa7bebf40f5a5be4914cdafcecfcb6e4ebbffefad3bf0156bfa7ba</data> + </image> + <image name="image1"> + <data format="XPM.GZ" length="8910">789cedd9c992e4b61106e0bb9e6262705338a02a56914586c387def77d6f870f8904d8fbbeb7c3ef6e16fe3f39b23c9226c2576ba498f9064422b1126cfdf2f397e3ed8d2f3ffff2d3d3b33c5fe8173d97c72f3fc7979b9b8fbfffe36ffffce9eba8f8d2fd3b1ed65f8aaf7ff9e9ebcef317fdb279779ba690b2831be47fa60e035a615ded5d4fed97e1ba8ce5d48e0ea96d737984232d433855b07ec26d0bc799ecba6fff841e0fb3d3035da3fd7449331f3d878703382cd37cde9fc293b219e77cf2f35de9a040ffb6e1e9af5cbf858b31cae50dae86c8cf27b8cf7f63ea623018a33c1ec143f627ded2ec4f58a495ed5fc005f391357a8c7c641d1ef179bf02b7c2f6f3f8144d976f93e32f9847d9e99956961f9b47c3ec3b7864e5b3703d8425cfff6868f1c23cade35c3f8ee1d118f1b4ed8de78734e3fb4f786ce3bf44d7cc678e56d47702970394fb3db8b2fc6ee9c8e773ff478d8d7f40fda618205f3986478c176e7be7faba41d7cc5f69f6d7efc363ae0f776cc6f37202978c27677409c717783214ac478c4763eb29e5fd331e1635dad379d8f24b7334f371353c1e70fd3a732539df5d7acce76769c60f1fe6321f0ef1d28cfab241eb383bdd9acbecf0099725c7f7888e6c4fe1aaa167e009c7c331df09cba580eb06e3e30fe9289acdf8365e9af7e7580ae6a7cff06880fcd21d3d46ff7497567a011edbf3aff418f142a06bd8d125d7932b695b7f983fa94a3ecf7caa080be34f383efa60463e82f191661872ffdd396ce767c8e7455974fdc37ccdd235cf8799de58bf3734fb2b63d8d6677a3133de902e61c7e76d7ef408ae879390dbdba61b3edfc2a14a557e7e277b3afeb9ff7104db78eb323dc67a7315cdf52856cef518d6699bef08978c279be60af5b7e8120ebe37e6fb8d6e58ffd48ce7fd07cdf949a937f2c1784b65f5311e3219c2be81eb21c767110e85c6ec6bba82fd9c39e6f7b31fc0d1cefbdcbfaa28f8bee95ef5d925f7bb5cd2cd6494f33da799af1c98eb5c1ef87cc57ce39c19fd77f366c413a5b91efc8e99f337a1639dd747b88627ec7f3833733ede7b23bf25dae23dc1b5b5c7fed79c0fd7c04da9f93e22896eb03e3cf397c4f164fe6d81f52979ff55dd7a44ff14fdefe75f17e988728ffe74fb9bfb67c6ccfcdf69e61f9299f15768c60bf484eb53aecddc5f8c57db78ed9a51df5939ebbb4f3ad21e6e585f6ecceccf332c9c7f99a785f5afcc589f32824391f278c63cfe93d1d8cec30477e723e25dc015fb23bb66ac3f7744db788c615b0fe1deccf5ac74c9f17cef9de3eb93b9c1fbe28ab6fdfa06d7b6de22cdf5140ee086f3e7998f08f2f5b370bf7fd769eedfc0f6fbfdba00dbfb4ad09f5046c4d702ae4a8eff0b6dfb77968ee85f427f83f5572aba61fff7613b6fc2aa99fbd7ca4bbc5fdd80667bb262c6fef5e85f6818df33bf86f9bbbc5fea5135c4f3711d9ef0fd208d19f311b769cebfb4b0e5a7af669447a5f9bc9fd096ef22dcf07937a4f9bccec252863c3f2a70a890afbb37f3fbc0d182f3c49fd309fd8917b00adfcf67707f1f41ff83bd0fe280e679a87b66b417103f4c98bf5c99313f21d25ccf7a4c737ef494e67e4f1f6694cb216ce7839ed1ac1f03cde713c6a79b6fdebf2e69ae3fa9cd5c1f252c43f4c7edd325ef6b5bb470fdbc9a395f8f70371f982fc68b1cff94c7bb19dbfb26dec0763ea4459adf77618fe6fd4ae8dae67f42b3ffae809b86f33f6b46fe32a023cf933758b8de7d45978c7762663e3bbd519ffd91c4f55c9b597e07079eb77a006bc5f9cfe76fa315cfb388f67432e4f9cb729bcf5098513f5cc18dcdffbc99f1c734ef0711e3a7ddfec1fcae9a795f598343c1f5e868413cf7465bff984fa4c5c3a968f3fb38e6f79774f38bf18b356cfd893bb0adcfb04ff3fd911660e1fef10766ccbfccd19c9f78470be63b6cd396ef196cf3e18fe984f5e9988fcd8f5f85a3a07dade096f7f71869fbf901e2e9d87e7ee0609b5f1dc2139e77f190b6fbdb336ce7677aa2f9bd24188fe97ce3f90dd8f66b783123df786ae6fa6b68ee67617bc2fe057b3ea1dc317ea8b05ee219cdf3d26ff4c6fb92fd0989eb6b0dd602e5ee96667beea137dadb32e37e171e61fbf993327edbe2be97f27a0bdd79c19f1fdcc10dfbaf89e67ad7008bdd873f68f6277dc2a1607fdf68e6a77766f66fd38c9f9fe90dac15d7eb88e678789627de277406b6f513f27db93b2ef9bd188e683befeee13ebf92e67d253ec16aebbba513ee77fe11eeef2f793cba8f7fb6274f34f7439a87bbf8d9b1a5591e9761e5fd295474857ce3ae99f95dd336dead99f92ed209f3ebf6e0c8f5e7566861f912dcefbfbc7eb41b3fde4ff07cecf2c579f1015bbecae795e5fec1ccf97c34a3bdf00ac782f7090727de9fdd365d71bc6fe13ebffcbeea0e03be6fd2356ceb278c686bff05d6028e5774c59fd75ed0cc4f183fb27f51687e7fa6339ae317cf691bef5db8b5fbf00dcdf7777ca4ad3ff93cee4eff863f2f54d8d65372b4f07c4eb09d0f5a9bd9df41ef9cafaec16abe8523e72b3d9a511e0bb86db9df8299fb2d8f77aac4dabf84edfc8aefb0f23ea31f668ed7221c6d7eef6981c31adcaf87039a3f3f717774c2fbd10fe13ebf3cbf29d9fdc5bdc281f1dd0bac82fa6142db78209f64f9859ab6fbc7a699df7b1eeeded7380f76683b2f9ee07ebef3fbb0ad4285fb5fd8826d7cdc296cedc767dadaabccccbf8413bfdf5330a33cddf4c6f9f8405bff1adac673a137feffc512dcb2becbf3ddb6d1be77f7693bdfd668e1f7eba619e57a62e6fd06f15bcbcf1dd2763fb8a7edfbf195b6fc18afb5fe5ef5c67af074c5f63e68be3f45cc8c67e67ced3cff6fbffe1fe3bf6378e7c5cb8fd6983edbfd0a5e7df4a98fd1fab3e9dffe505df1e7fec25ffa2b7fed6ffc6d1fe3cedffb07fff827f59ffcb37ff1affecdbffb0fffe967fcac9ff39131e6fd825ff44b7ed9affc4eebab7ecdaffb0dbfe9b7fcb6dff1bb7ecfeffb037fe88f6c4cbb368efd893ff583dfd41dfac28ffcd897bef2135ffbc679e79cb8e0d445975cebce2c863b7717eed25db96bebb5bb71b7eeceddbb07f7e89edcb37b71afeecdbdbb0ff7e966dcac9b73f36ec12dbaa53ec6b25b71ab6ecdadbb0db7e9b6dcb6db71bb6ecfedbb0377e88edcb13b71a76ee086ae70233776a5abdcc4d5ae11ff6d7df85b7122ee50ba8f04e90e2e69e54cce9dca855cca955ccb8ddcca9ddccb833cca933ccb8bbcca9bbccbc7b718f22933322b73322f0bb2284bb22c2bb22a6bb22e1bb2295bb22d3bb22b7bb22f075dcd4339926339915319fc2ac6500a194dbf6da49289d4d2041f5cf7a60a41bb1b5f0a6d380be7f21e2ec265b80ad7e126dc86bb701f1e7edd97f0189ec27378f1125ec35b780f1fe133cc84d93017e6c342580c4bd3b10ecb61c50dc26a58cb5a0f1bfddc4ebdd9fdb7855909db6127ec86bdb01f0ec261380ac7e1249ce692411876f7d2d1f4cfd3fb7428bfc5e8be1f26a1ee7e6fa6a5eab51b4e0daa1ab393b67a96ff74ae17d35c738c77ec338ba1977aa5ddea9027bdd15bbdd37b7dd0477dd2e7699bdd05fd455f738c377d4704fde8c6aefcb6f7f55367b0277456e7745e17745197745996754557c3a5aec9bbaee79a1bba997fdfd2eddf3b3fdc926cea8eeeea9eee87373dd0433dd2633de96a9df63b577460397c37c6990ebbbbe848c7f9ceac3ad1bafb58f75e623e6522a3c46ec2a322d26f63c4d8dd7eda7816cfe345bcc4e8c7abd88d54bcc9756fe35dfefd3e3e74f9bceadaf7cec2f8189f6237caf145ca98c731bec5f7f8113ff39f67e2ac3bc8b37c14e7fc6e9cff6e8c85b8a8dd2c4ff38c4b5d0ecb7125aec6b598c7346ec4cdb8c5d8db5d8c9defc59061dced4e359eafdd778fc6bdb81f0fe261ae77148fe349cce3eb0ee2200ebf9b478151a346719c6fc0dd47768ed1249f5ceaae80534daf967ffe6e48a97bb27517e92c9d4f7b972eba9158d39574191ffe738dfd418cabdcde757c4837c82fdda6bb749f67ec076384fb3817c7ba9d2ed3437a4c4fe93975f3955ed35b7affe13c3ed2672874a3ab37a3dd7e4fb3696e7ac6a4f9b4f07bebf40fa22d867b7ded6ea01bbf2df9faafbffef46f0190bec5</data> + </image> +</images> +<connections> + <connection> + <sender>kpbOk</sender> + <signal>clicked()</signal> + <receiver>KReloadNetworkDlg</receiver> + <slot>close()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kdialog.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/kroutinginfo.cpp b/knetworkconf/knetworkconf/kroutinginfo.cpp new file mode 100644 index 0000000..ebf8380 --- /dev/null +++ b/knetworkconf/knetworkconf/kroutinginfo.cpp @@ -0,0 +1,60 @@ +/*************************************************************************** + kroutinginfo.cpp - description + ------------------- + begin : Mon Mar 3 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : juancho@linuxmail.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. * + * * + ***************************************************************************/ + +#include "kroutinginfo.h" + +KRoutingInfo::KRoutingInfo(){ +} +KRoutingInfo::~KRoutingInfo(){ +} +QString KRoutingInfo::isNetworkingEnabled(){ + return networking; +} +QString KRoutingInfo::isForwardIPv4Enabled(){ + return forwardIPv4; +} +QString KRoutingInfo::getHostName(){ + return hostName; +} +QString KRoutingInfo::getDomainName(){ + return domainName; +} +QString KRoutingInfo::getGateway(){ + return gateway; +} +QString KRoutingInfo::getGatewayDevice(){ + return gatewayDevice; +} +void KRoutingInfo::setNetworkingEnabled(const QString &networking){ + KRoutingInfo::networking = networking; +} +void KRoutingInfo::setForwardIPv4Enabled(const QString &forwardIPv4){ + KRoutingInfo::forwardIPv4 = forwardIPv4; +} +void KRoutingInfo::setHostName(const QString &hostName){ + KRoutingInfo::hostName = hostName; +} +void KRoutingInfo::setDomainName(const QString &domainName){ + KRoutingInfo::domainName = domainName; +} +void KRoutingInfo::setGateway(const QString &gateway){ + KRoutingInfo::gateway = gateway; +} +void KRoutingInfo::setGatewayDevice(const QString &gatewayDevice){ + KRoutingInfo::gatewayDevice = gatewayDevice; +} + diff --git a/knetworkconf/knetworkconf/kroutinginfo.h b/knetworkconf/knetworkconf/kroutinginfo.h new file mode 100644 index 0000000..1092f88 --- /dev/null +++ b/knetworkconf/knetworkconf/kroutinginfo.h @@ -0,0 +1,58 @@ +/*************************************************************************** + kroutinginfo.h - description + ------------------- + begin : Mon Mar 3 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : juancho@linuxmail.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. * + * * + ***************************************************************************/ + +#ifndef KROUTINGINFO_H +#define KROUTINGINFO_H + +#include <qstring.h> + + +/**Has all the routing info of the machine, like default gateway, default gateway device, + routes to other hosts and networks, etc. + + *@author Juan Luis Baptiste + */ + +class KRoutingInfo { +public: + KRoutingInfo(); + ~KRoutingInfo(); +private: // Private attributes + QString networking; + QString forwardIPv4; + QString hostName; + QString domainName; + QString gateway; + QString gatewayDevice; + +public: // Public attributes + QString isNetworkingEnabled(); + QString isForwardIPv4Enabled(); + QString getHostName(); + QString getGatewayDevice(); + QString getGateway(); + QString getDomainName(); + void setNetworkingEnabled(const QString &networking); + void setForwardIPv4Enabled(const QString &forwardIPv4); + void setHostName(const QString &hostName); + void setDomainName(const QString &domainName); + void setGateway(const QString &gateway); + void setGatewayDevice(const QString &gatewayDevice); + +}; + +#endif diff --git a/knetworkconf/knetworkconf/kselectdistrodlg.ui b/knetworkconf/knetworkconf/kselectdistrodlg.ui new file mode 100644 index 0000000..4bed8ea --- /dev/null +++ b/knetworkconf/knetworkconf/kselectdistrodlg.ui @@ -0,0 +1,142 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KSelectDistroDlg</class> +<widget class="KDialog"> + <property name="name"> + <cstring>KSelectDistroDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>372</width> + <height>499</height> + </rect> + </property> + <property name="caption"> + <string>Unsupported Platform</string> + </property> + <property name="icon"> + <pixmap>image0</pixmap> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListBox" row="2" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>klbDistroList</cstring> + </property> + </widget> + <widget class="KPushButton" row="3" column="2"> + <property name="name"> + <cstring>kpbOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="KPushButton" row="3" column="3"> + <property name="name"> + <cstring>kpbCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>cbAskAgain</cstring> + </property> + <property name="text"> + <string>Do not ask again</string> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>130</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><font size="+1"><p align="center"><b>Your Platform is Not Supported</b></p></font></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>You may choose one of the following supported platforms if you are <b>sure</b> your platform behaves the same as the chosen one. Please be sure, because your current network configuration could be damaged.</string> + </property> + </widget> + </grid> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="983">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000039e4944415418959595cd6b1d5518c67f934e9a776452cf40948e74915b2af6aa2897a6602a2e6e6a5d74e3dafe03d28f8d0b71292eba312808052964e34297154442119b2e44234aaca8ed151332c586ccd85cef1cc9e8bcd6938e8b9b7b136b6e4b5e18e683f33ef39ce77738c7abaa8a9dcaf33c2ebc7761e2e48993171179aaf75d7c50b7fd2e80822f557a3399bff4f1a557cf4f9f5ff47754dd2c33660e8931b50fafa6233a1c1019417c41a42baa4e290b8bae433caa4c3d1d3f89cf38707f6141867078577fb6941210858a31029b5d5a802d20cf721ae3c2e4213c600ff4870ca8615094b2005be44084aaed3bc6416e736ca1d876371175ca8385bbaeb13627d5a0eb3214284000ab8a1690decaa99b685be60f10ee0d1209d0a224b742a08a88609d82425e28b89e5301d7edf507d15ffd7515750c810ecfbc5627d8a42fbe30f753c247f342aa10f942eec088e9c6b369d587ddd39f3c1c33fb6302614ceee75da7b209747bc6bba53f7518ce4e8219035cb4a1ae048767dbd99f38fedaca7897f44b85bcc89150aa74256d6769f6a53a4d739bb7922469010cfd8f7e66b1ed9cbc2849db25a52d49db39d676e9ab2aea203631511879c7268e3ddc6834464a5b7e3077756ee6ec99b3edad28764bdf29eaba20adda3daa1a59b57beb8fd7ef1c7fe978b515850ff88288101b4142c184d29f8b55bd977e952c267fb4165bd7b4d0ebc952f2496bb1f5c3ece5d9fec6d35bc71e289111ac0fb18990b03b13754aa0c1bdf437d276ba9265f67d33666e34269aa5d95f9366f364f1fa1be7b61cdb759b0baccf9caeed5347d5fd1143aadd455faa828baa3e7d9beda9d7eb4fc4fbf55d09644dc2e0ae647c7eedfbefde02cabe70b2947c3b373cf7b6f85257a7e3b503b51722138d0294ae449d56c9cde4efec56f67be94ac17157550b2d744d9d2e4b68ee264baddfec9afdef1ebcf0d58277ea9553233317679acb3796bfe8dceedce9ac76aaceed4ed559ed54cbbf2c579dd54eb9f0cdc2a7d3e7a78f365f6c8e5cf9ec8a075055d58ed710c0916347aac644e31f09855cf31155f5d429aa8a557b5ffa83cadbfe72e6f499d1da78edb9c8442f9bd03c1bc5d133a52d35cbb3ebdbe87f3d7b7976bdd733f004ea3d4cbf333314c0a366bf79c86676b474fafcd489e6b9f9f9f9b56429b960c6cc8dda817a99acdc5c179f768ffe20e1feb669db69101c88df8c1f898f9ad16838f0794cc04c361a074d680e0ea23fa8fac2c94ab291173649b3741fb0577c10118b036b6de7bef477a87f018b9f681dd4db618a0000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>kpbOk</sender> + <signal>clicked()</signal> + <receiver>KSelectDistroDlg</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>kpbCancel</sender> + <signal>clicked()</signal> + <receiver>KSelectDistroDlg</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>klbDistroList</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>KSelectDistroDlg</receiver> + <slot>accept()</slot> + </connection> +</connections> +<slots> + <slot>exitSlot()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kdialog.h</includehint> + <includehint>klistbox.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/knetworkconf/knetworkconf/kwirelessinterface.cpp b/knetworkconf/knetworkconf/kwirelessinterface.cpp new file mode 100644 index 0000000..c24d237 --- /dev/null +++ b/knetworkconf/knetworkconf/kwirelessinterface.cpp @@ -0,0 +1,55 @@ +/*************************************************************************** + kwirelessinterface - description + ------------------- + begin : Thu oct 21 2004 + copyright : (C) 2004 by Juan Luis Baptiste + email : juan.baptiste@kdemail.net + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#include "kwirelessinterface.h" + +KWirelessInterface::KWirelessInterface() + : KNetworkInterface() +{ +} + +KWirelessInterface::~KWirelessInterface() +{ +} + +QString KWirelessInterface::getEssid() +{ + return essid; +} + +QString KWirelessInterface::getWepKey() +{ + return wepKey; +} + +void KWirelessInterface::setWepKey(QString newKey) +{ + wepKey = newKey; +} +void KWirelessInterface::setEssid(QString newEssid) +{ + essid = newEssid; +} + +QString KWirelessInterface::getKeyType() +{ + return keyType; +} + +void KWirelessInterface::setKeyType(QString type) +{ + keyType = type; +} diff --git a/knetworkconf/knetworkconf/kwirelessinterface.h b/knetworkconf/knetworkconf/kwirelessinterface.h new file mode 100644 index 0000000..982d68b --- /dev/null +++ b/knetworkconf/knetworkconf/kwirelessinterface.h @@ -0,0 +1,48 @@ +/*************************************************************************** + kwirelessinterface - description + ------------------- + begin : jue oct 21 2004 + copyright : (C) 2004 by Juan Luis Baptiste + email : juan.baptiste@kdemail.net + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#ifndef KWIRELESSINTERFACE_H +#define KWIRELESSINTERFACE_H + +#include <knetworkinterface.h> +#include <qstring.h> + +/** +Class that represents a wireless network interface. It inherits from KNetworkInterface. + +@author Juan Luis Baptiste +*/ +class KWirelessInterface : public KNetworkInterface +{ + public: + KWirelessInterface(); + + ~KWirelessInterface(); + + QString getEssid(); + QString getWepKey(); + void setEssid(QString newEssid); + void setWepKey(QString newKey); + QString getKeyType(); + void setKeyType(QString type); + + private: + QString essid; + QString wepKey; + QString keyType; +}; + +#endif diff --git a/knetworkconf/knetworkconf/main.cpp b/knetworkconf/knetworkconf/main.cpp new file mode 100644 index 0000000..336d33e --- /dev/null +++ b/knetworkconf/knetworkconf/main.cpp @@ -0,0 +1,49 @@ +/*************************************************************************** + main.cpp - description + ------------------- + begin : Sun Jan 12 00:54:19 UTC 2003 + copyright : (C) 2003 by Juan Luis Baptiste + email : jbaptiste@merlinux.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. * + * * + ***************************************************************************/ +#include <unistd.h> +#include <sys/types.h> +#include <kmessagebox.h> +#include <kcmdlineargs.h> +#include <kaboutdata.h> +#include <klocale.h> +#include <kuniqueapplication.h> +#include <dcopclient.h> +#include <kglobal.h> +#include <kgenericfactory.h> + +//#include "knetworkconf.h" +#include "knetworkconfmodule.h" +#include "version.h" + + +static KCmdLineOptions options[] = +{ + { 0, 0, 0 } + // INSERT YOUR COMMANDLINE OPTIONS HERE +}; +/*typedef KGenericFactory<KNetworkConfModule> KDEDFactory; +K_EXPORT_COMPONENT_FACTORY( knetworkconfmodule, KDEDFactory( "kcm_knetworkconfmodule" ) ); */ + +extern "C" +{ + KDE_EXPORT KCModule *create_knetworkconfmodule(QWidget *parent, const char *name) + { + KGlobal::locale()->insertCatalogue("knetworkconf"); + return new KNetworkConfModule(parent, name); + } +} + diff --git a/knetworkconf/knetworkconf/version.h b/knetworkconf/knetworkconf/version.h new file mode 100644 index 0000000..cfa0b7d --- /dev/null +++ b/knetworkconf/knetworkconf/version.h @@ -0,0 +1,6 @@ +#ifndef KNETWORKVERSION_H +#define KNETWORKVERSION_H + +static const char *description = + I18N_NOOP("KNetworkConf - A KDE Control Center module to configure TCP/IP settings."); +#endif |