summaryrefslogtreecommitdiffstats
path: root/kmyfirewall/ipteditor
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 01:04:17 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 01:04:17 +0000
commitc3b707c026782768bd8c0e6ae6b574fe8a36802d (patch)
tree5ca6782031b1546c788290cc0b95524369ff01ea /kmyfirewall/ipteditor
downloadkmyfirewall-c3b707c026782768bd8c0e6ae6b574fe8a36802d.tar.gz
kmyfirewall-c3b707c026782768bd8c0e6ae6b574fe8a36802d.zip
Added old abandoned KDE3 version of kmyfirewall
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmyfirewall@1091559 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmyfirewall/ipteditor')
-rw-r--r--kmyfirewall/ipteditor/Makefile.am34
-rw-r--r--kmyfirewall/ipteditor/kmfchainedit.cpp252
-rw-r--r--kmyfirewall/ipteditor/kmfchainedit.h48
-rw-r--r--kmyfirewall/ipteditor/kmfipteditorpart.cpp308
-rw-r--r--kmyfirewall/ipteditor/kmfipteditorpart.desktop15
-rw-r--r--kmyfirewall/ipteditor/kmfipteditorpart.h124
-rw-r--r--kmyfirewall/ipteditor/kmfipteditorpartui.rc29
-rw-r--r--kmyfirewall/ipteditor/kmfnewchaindlg.cpp115
-rw-r--r--kmyfirewall/ipteditor/kmfnewchaindlg.h60
-rw-r--r--kmyfirewall/ipteditor/kmfruleedit.cpp1517
-rw-r--r--kmyfirewall/ipteditor/kmfruleedit.h171
-rw-r--r--kmyfirewall/ipteditor/kmfruleoption_frag_option.xml7
-rw-r--r--kmyfirewall/ipteditor/kmyfirewallchaineditor.ui893
-rw-r--r--kmyfirewall/ipteditor/kmyfirewallchaineditornewchain.ui263
-rw-r--r--kmyfirewall/ipteditor/kmyfirewallruleeditor.ui757
15 files changed, 4593 insertions, 0 deletions
diff --git a/kmyfirewall/ipteditor/Makefile.am b/kmyfirewall/ipteditor/Makefile.am
new file mode 100644
index 0000000..3c83753
--- /dev/null
+++ b/kmyfirewall/ipteditor/Makefile.am
@@ -0,0 +1,34 @@
+# set the include path for X, qt and KDE
+INCLUDES = $(all_includes) -I../kmfwidgets -I../core
+
+METASOURCES = AUTO
+#########################################################################
+# KPART SECTION
+#########################################################################
+
+
+# this is where the desktop file will go
+partdesktopdir = $(kde_servicesdir)
+partdesktop_DATA = kmfipteditorpart.desktop
+
+# this is where the part's XML-GUI resource file goes
+partrcdir = $(kde_datadir)/kmfipteditorpart
+partrc_DATA = kmfipteditorpartui.rc
+kde_module_LTLIBRARIES = libkmfipteditorpart.la
+
+libkmfipteditorpart_la_SOURCES = kmfchainedit.cpp kmfnewchaindlg.cpp kmfruleedit.cpp kmfipteditorpart.cpp kmyfirewallchaineditor.ui kmyfirewallchaineditornewchain.ui kmyfirewallruleeditor.ui
+
+noinst_HEADERS = kmfchainedit.h kmfnewchaindlg.h kmfruleedit.h kmfipteditorpart.h
+
+libkmfipteditorpart_la_LDFLAGS = -module -no-undefined $(all_libraries) \
+ $(KDE_PLUGIN)
+libkmfipteditorpart_la_LIBADD = \
+ $(LIB_KPARTS) ../kmfwidgets/libkmfwidgets.la ../core/libkmfcore.la
+
+install-data-local:
+ $(mkinstalldirs) $(DESTDIR)$(kde_datadir)/kmyfirewall/ruleoptions/
+ $(INSTALL_DATA) $(srcdir)/kmfruleoption_frag_option.xml $(DESTDIR)$(kde_datadir)/kmyfirewall/ruleoptions/kmfruleoption_frag_option.xml
+
+uninstall-local:
+ -rm -f $(DESTDIR)$(kde_datadir)/kmyfirewall/ruleoptions/kmfruleoption_frag_option.xml
+
diff --git a/kmyfirewall/ipteditor/kmfchainedit.cpp b/kmyfirewall/ipteditor/kmfchainedit.cpp
new file mode 100644
index 0000000..5518019
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfchainedit.cpp
@@ -0,0 +1,252 @@
+/***************************************************************************
+ begin : Sat Mar 2 2002
+ copyright : (C) 2002 by Christian Hubinger
+ email : chubinger@irrsinnig.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 "kmfchainedit.h"
+#include "kmfchainedit.moc"
+
+
+//QT includes
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qframe.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qlistbox.h>
+#include <qlcdnumber.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qinputdialog.h>
+#include <qtabwidget.h>
+
+// KDE includes
+#include <klocale.h>
+#include <kdebug.h>
+#include <kapplication.h>
+#include <kmessagebox.h>
+
+// Project Includes
+#include "../core/xmlnames.h"
+#include "../core/kmfiptdoc.h"
+#include "../core/kmfnetwork.h"
+#include "../core/kmfundoengine.h"
+
+// #include "../kmyfirewall.h"
+
+
+
+
+
+namespace KMF {
+KMFChainEdit::KMFChainEdit( QWidget* parent, const char* name, WFlags fl )
+ : KMyFirewallChainEditor( parent, name, fl ) {}
+KMFChainEdit::~KMFChainEdit() {}
+
+void KMFChainEdit::loadChain( IPTChain* chain ) {
+ kdDebug() << "void KMFChainEdit::editChain(IPTChain* ch)" << endl;
+ c_has_default_target->setChecked( false );
+ c_enable_log->setChecked( false );
+ c_log_limit->setChecked( false );
+ c_log_burst->setChecked( false );
+ c_log_prefix ->setChecked( false );
+ // t_log_prefix->clear();
+ m_tabWidget->setCurrentPage( 0 );
+
+ if ( ! chain ) {
+ setEnabled(false);
+ } else {
+ setEnabled(true);
+ m_chain = chain;
+ l_chain_name->setText( m_chain->name() );
+ l_chain_table->setText( m_chain->table() ->name() );
+ QPtrList<IPTRule> list_rules = m_chain->chainRuleset();
+ QPtrList<IPTRule> list_feeds = m_chain->chainFeeds();
+ QPtrList<IPTRule> list_fwds = m_chain->chainFwds();
+
+ int num_rules = list_rules.count();
+ int num_feeds = list_feeds.count();
+ int num_fwds = list_fwds.count();
+
+ kdDebug() << "num_rules = " << num_rules << endl;
+ kdDebug() << "num_FEEDS = " << num_feeds << endl;
+ kdDebug() << "num_fwds = " << num_fwds << endl;
+
+ lcd_rules->display( num_rules );
+ lcd_feeds->display( num_feeds );
+ lcd_fwds->display( num_fwds );
+
+ kdDebug() << "Found Chain " << m_chain->name() << endl;
+ // show default target
+ if ( m_chain->isBuildIn() ) {
+ cb_target->clear();
+ cb_target->insertItem( "ACCEPT" );
+ cb_target->insertItem( "DROP" );
+ QString tg = m_chain->defaultTarget();
+ if ( tg == "ACCEPT" )
+ cb_target->setCurrentItem( 0 );
+ if ( tg == "DROP" )
+ cb_target->setCurrentItem( 1 );
+ c_has_default_target->setChecked( false );
+ } else if ( m_chain->hasDefaultTarget() ) {
+ cb_target->clear();
+ cb_target->insertItem( "ACCEPT" );
+ cb_target->insertItem( "DROP" );
+ c_has_default_target->setEnabled( true );
+ c_has_default_target->setChecked( true );
+ QString tg = m_chain->defaultTarget();
+ if ( tg == "ACCEPT" )
+ cb_target->setCurrentItem( 0 );
+ if ( tg == "DROP" )
+ cb_target->setCurrentItem( 1 );
+ } else {
+ c_has_default_target->setEnabled( true );
+ c_has_default_target->setChecked( false );
+ connect( c_has_default_target, SIGNAL( toggled( bool ) ), cb_target, SLOT( setEnabled( bool ) ) );
+ cb_target->clear();
+ cb_target->insertItem( "ACCEPT" );
+ cb_target->insertItem( "DROP" );
+ cb_target->setEnabled( false );
+ }
+ // show logging settings
+ bool logging = false;
+ QString log_limit = "";
+ QString log_prefix = "";
+ QString log_burst = "";
+ logging = m_chain->logging();
+ log_limit = m_chain->logLimit();
+ log_prefix = m_chain->logPrefix();
+ log_burst = m_chain->logBurst();
+ if ( logging ) {
+ c_enable_log->setChecked( true );
+ if ( ! log_prefix.isEmpty() && log_prefix != XML::Undefined_Value ) {
+ kdDebug() << "Found Log Prefix: " << log_prefix << endl;
+ c_log_prefix->setChecked( true );
+ t_log_prefix->setText( log_prefix );
+ } else {
+ c_log_prefix->setChecked( false );
+ }
+ if ( !log_limit.isEmpty() && log_limit != XML::Undefined_Value ) {
+ c_log_limit->setChecked( true );
+ int i = log_limit.find( "/" );
+ QString str_num = log_limit.left( i );
+ QString interval = log_limit.remove( 0, i + 1 );
+ if ( interval == "second" ) {
+ cb_interval->setCurrentItem( 0 );
+ } else if ( interval == "minute" ) {
+ cb_interval->setCurrentItem( 1 );
+ } else if ( interval == "hour" ) {
+ cb_interval->setCurrentItem( 2 );
+ } else {
+ KMessageBox::sorry( this, i18n( "Your config is not valid; it appears to be a bug." ) );
+ c_log_limit->setChecked( false );
+ }
+ sb_limit->setValue( str_num.toInt() );
+ kdDebug() << "Found Log Limit: " << str_num << "/" << interval << endl;
+ if ( ! log_burst.isEmpty() && log_burst != XML::Undefined_Value ) {
+ c_log_burst->setChecked( true );
+ sb_burst->setValue( log_burst.toInt() );
+ } else {
+ c_log_burst->setChecked( false );
+ // sb_burst->setValue( 5 );
+ }
+ } else {
+ c_log_limit->setChecked( false );
+ }
+ } else {
+ c_enable_log->setChecked( false );
+ c_log_prefix->setChecked( false );
+ c_log_limit->setChecked( false );
+ c_log_burst->setChecked( false );
+ }
+ }
+}
+
+
+
+void KMFChainEdit::accept() {
+ kdDebug() << "KMyFirewallChainEditor::slotSaveChainChanges()" << endl;
+ KMFUndoEngine::instance()->startTransaction(
+ m_chain,
+ i18n( "Edit Chain: %1 properties" ).arg( m_chain->name() )
+ );
+ bool log = c_enable_log->isChecked();
+ bool log_limit = c_log_limit->isChecked();
+ bool log_prefix = c_log_prefix->isChecked();
+ bool log_burst = c_log_burst->isChecked();
+
+ QString target = cb_target->currentText();
+ kdDebug() << "Try to set Target to : " << target << endl;
+
+ if ( m_chain->isBuildIn() ) {
+ m_chain->setDefaultTarget( target );
+ } else if ( c_has_default_target->isChecked() ) {
+ m_chain->hasCustomDefaultTarget( true );
+ m_chain->setDefaultTarget( target );
+ } else
+ m_chain->hasCustomDefaultTarget( false );
+
+ QString str_log_limit = XML::Undefined_Value;
+ QString str_log_prefix = XML::Undefined_Value;
+ QString str_log_burst = XML::Undefined_Value;
+ if ( log ) {
+ kdDebug() << "You wanna Loga a little bit" << endl;
+ // set log limit
+ if ( log_prefix && ! t_log_prefix->text().isEmpty() ) {
+ str_log_prefix = t_log_prefix->text();
+ kdDebug() << "You wanna have as log prefix: " << str_log_prefix << endl;
+ }
+ if ( log_limit ) { // set log limit
+ QString str_limit_num = sb_limit->text();
+ QString str_interval = cb_interval->currentText();
+ str_log_limit = str_limit_num + "/" + str_interval;
+ kdDebug() << "You wanna have " << str_log_limit << " as Logging limit" << endl;
+
+ if ( log_burst ) {
+ str_log_burst = sb_burst->text();
+ } else {
+ str_log_burst = XML::Undefined_Value;
+ }
+ } else {
+ str_log_limit = XML::Undefined_Value;
+ }
+ m_chain->setDropLogging( true, str_log_limit, str_log_burst, str_log_prefix );
+ } else { // disable chain_logging
+ str_log_limit = XML::Undefined_Value;
+ str_log_prefix = XML::Undefined_Value;
+ str_log_burst = XML::Undefined_Value;
+ m_chain->setDropLogging( false, str_log_limit, str_log_burst, str_log_prefix );
+ }
+
+ m_chain->table()->changed();
+ emit sigDocumentChanged();
+ KMFUndoEngine::instance()->endTransaction();
+ emit sigHideMe();
+}
+
+void KMFChainEdit::slotHelp() {
+ kdDebug() << "void KMFChainEdit::slotHelp()" << endl;
+ kapp->invokeHelp( "chains" );
+}
+void KMFChainEdit::reject() {
+ kdDebug() << "void KMFChainEdit::reject()" << endl;
+ emit sigHideMe();
+}
+
+}
diff --git a/kmyfirewall/ipteditor/kmfchainedit.h b/kmyfirewall/ipteditor/kmfchainedit.h
new file mode 100644
index 0000000..f0ee87c
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfchainedit.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ begin : Sat Mar 2 2002
+ copyright : (C) 2002 by Christian Hubinger
+ email : chubinger@irrsinnig.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 KMFCHAINEDIT_H
+#define KMFCHAINEDIT_H
+#include <qobject.h>
+#include <qwidget.h>
+#include "../core/kmfdoc.h"
+#include "../core/iptchain.h"
+#include "kmyfirewallchaineditor.h"
+/**
+ *@author Christian Hubinger
+ */
+
+namespace KMF {
+class KMFChainEdit : public KMyFirewallChainEditor {
+ Q_OBJECT
+public:
+ KMFChainEdit( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~KMFChainEdit();
+
+ void loadChain( IPTChain* );
+public slots:
+ void accept();
+ void reject();
+ void slotHelp();
+private:
+ IPTChain* m_chain;
+
+signals:
+ void documentChanged( KMFIPTDoc& );
+ void sigDocumentChanged();
+ void sigHideMe();
+};
+}
+#endif
diff --git a/kmyfirewall/ipteditor/kmfipteditorpart.cpp b/kmyfirewall/ipteditor/kmfipteditorpart.cpp
new file mode 100644
index 0000000..f4956d9
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfipteditorpart.cpp
@@ -0,0 +1,308 @@
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+/*
+Author: Christian Hubinger <chubinger@irrsinnig.org>, (C) 2001
+*/
+
+#include "kmfipteditorpart.h"
+
+
+// QT includes
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qmultilineedit.h>
+
+
+// KDE includes
+#include <kinstance.h>
+#include <kaction.h>
+#include <kstdaction.h>
+#include <kaccel.h>
+#include <kfiledialog.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+#include <kiconloader.h>
+#include <kaboutdata.h>
+#include <klocale.h>
+
+// Project includes
+#include "kmfruleedit.h"
+#include "../core/kmyfirewallinterface.h"
+#include "../kmfwidgets/kmfmainwindow.h"
+#include "../kmfwidgets/kmfiptdocoptions.h"
+#include "../core/kmfnetwork.h"
+#include "../core/kmfdoc.h"
+#include "../core/kmfiptdoc.h"
+namespace KMF {
+KMFIPTEditorPart::KMFIPTEditorPart( QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name )
+ : KParts::ReadWritePart( parent, name ) {
+ KMFMainWindow *app = 0;
+ // we need an instance
+ setInstance( KMFIPTEditorPartFactory::instance() );
+
+
+ app = dynamic_cast<KMFMainWindow*>( parent );
+ if ( ! app ) {
+ KMessageBox::error(0,"Oops wrong parent class found for kmfinstallerplugin!!!");
+ }
+
+ // this should be your custom internal widget
+ m_ruleedit = new KMFRuleEdit( parentWidget, widgetName );
+ m_ruleedit->setKMFMainWindow( app );
+ m_ruleedit->setFocusPolicy( QWidget::ClickFocus );
+
+ m_editdoc = new KMFIPTDocOptions( parentWidget , "m_editdoc" );
+ m_editdoc->hide();
+
+ m_ruleedit->loadDoc( app->network() );
+ m_editdoc->loadDoc( app->network()->currentDocAsIPTDoc() );
+
+ connect( app, SIGNAL( sigUpdateView() ),
+ m_ruleedit, SLOT( slotUpdateView() ) );
+
+ connect( app, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_ruleedit, SIGNAL( sigUpdateView( NetfilterObject* ) ) );
+
+ connect( app, SIGNAL( sigEnableActions( bool ) ),
+ this, SLOT( slotEnableActions( bool ) ) );
+
+ connect ( m_editdoc, SIGNAL( sigConfigChanged() ),
+ m_ruleedit, SLOT( slotUpdateView() ) );
+
+ // notify the part that this is our internal widget
+ setWidget( m_ruleedit );
+
+ m_actionEditChain = new KAction( i18n( "&Edit Chain" ), QIconSet( BarIcon( "configure_toolbars", KMFIPTEditorPartFactory::instance() ) ),
+ 0 , this, SLOT( slotEditChain() ), actionCollection(), "edit_chain" );
+
+ m_actionNewChain = new KAction( i18n( "Add New Chain..." ), QIconSet( BarIcon( "view_tree", KMFIPTEditorPartFactory::instance() ) ),
+ 0 , this, SLOT( slotNewChain() ), actionCollection(), "new_chain" );
+
+ m_actionDelChain = new KAction( i18n( "Delete Chain" ), QIconSet( BarIcon( "editdelete", KMFIPTEditorPartFactory::instance() ) ),
+ 0 , this, SLOT( slotDelChain() ), actionCollection(), "del_chain" );
+
+
+ m_actionNewRule = new KAction( i18n( "Add New Rule..." ), QIconSet( KGlobal:: iconLoader()->loadIcon( "rule", KIcon::Toolbar ) ) ,
+ KStdAccel::shortcut(KStdAccel::New) , this, SLOT( slotNewRule() ), actionCollection(), "new_rule" );
+
+// m_actionNewRule->setIconSet( QIconSet( loader->loadIcon( "rule-22", KIcon::User ) ) );
+
+ m_actionDelRule = new KAction( i18n( "Delete Rule" ), QIconSet( BarIcon( "editdelete", KMFIPTEditorPartFactory::instance() ) ),
+ KStdAccel::shortcut(KStdAccel::DeleteWordBack), this, SLOT( slotDelRule() ), actionCollection(), "del_rule" );
+
+ m_actionEditDocOptions = new KAction( i18n( "&Configure Firewall Options..." ), "configure", 0 , this, SLOT( slotEditDocOptions() ),
+ actionCollection(), "edit_doc_options" );
+
+
+ m_actionEditNetwork = new KAction( i18n( "&Configure the Network" ), QIconSet( BarIcon( "configure_toolbars", KMFIPTEditorPartFactory::instance() ) ), 0 , this, SLOT( slotEditNetwork() ),
+ actionCollection(), "edit_network" );
+
+
+ // set our XML-UI resource file
+ setXMLFile( "kmfipteditorpartui.rc" );
+
+ // we are read-write by default
+ setReadWrite( true );
+
+ // we are not modified since we haven't done anything yet
+ setModified( false );
+}
+
+KMFIPTEditorPart::~KMFIPTEditorPart() {}
+
+void KMFIPTEditorPart::setReadWrite( bool rw ) {
+ // notify your internal widget of the read-write state
+
+ ReadWritePart::setReadWrite( rw );
+}
+
+void KMFIPTEditorPart::slotEditDocOptions() {
+ KMFMainWindow* app = dynamic_cast<KMFMainWindow*>( parent() );
+ if ( ! app ) {
+ KMessageBox::error(0,"Oops wrong parent class found for KMFIPTEditorPart!!!");
+ return;
+ }
+ m_editdoc->loadDoc( app->network()->currentDocAsIPTDoc() );
+ m_editdoc ->show();
+}
+
+
+void KMFIPTEditorPart::slotEditChain() {
+ m_ruleedit->slotEditChain();
+}
+
+void KMFIPTEditorPart::slotNewChain() {
+ m_ruleedit->slotAddChain();
+}
+
+void KMFIPTEditorPart::slotDelChain() {
+ m_ruleedit->slotDelChain();
+}
+
+void KMFIPTEditorPart::slotNewRule() {
+ m_ruleedit->slotAddRule();
+}
+
+void KMFIPTEditorPart::slotDelRule() {
+ m_ruleedit->slotDelRule();
+}
+
+void KMFIPTEditorPart::slotEditNetwork() {
+ kdDebug() << "KMFIPTEditorPart::slotEditNetwork()" << endl;
+ m_ruleedit->slotEditNetwork();
+}
+
+
+//###########################################
+void KMFIPTEditorPart::setModified( bool modified ) {
+ // get a handle on our Save action and make sure it is valid
+ KAction * save = actionCollection() ->action( KStdAction::stdName( KStdAction::Save ) );
+ if ( !save )
+ return ;
+
+ // if so, we either enable or disable it based on the current
+ // state
+ if ( modified )
+ save->setEnabled( true );
+ else
+ save->setEnabled( false );
+
+ // in any event, we want our parent to do it's thing
+ ReadWritePart::setModified( modified );
+}
+
+bool KMFIPTEditorPart::openFile() {
+ // m_file is always local so we can use QFile on it
+ // QFile file(m_file);
+ // if (file.open(IO_ReadOnly) == false)
+ // return false;
+ //
+ // // our example widget is text-based, so we use QTextStream instead
+ // // of a raw QDataStream
+ // QTextStream stream(&file);
+ // QString str;
+ // while (!stream.eof())
+ // str += stream.readLine() + "\n";
+ //
+ // file.close();
+ //
+ // // now that we have the entire file, display it
+ // // m_widget->setText(str);
+ //
+ // // just for fun, set the status bar
+ // emit setStatusBarText( m_url.prettyURL() );
+
+ return true;
+}
+
+bool KMFIPTEditorPart::saveFile() {
+ // if we aren't read-write, return immediately
+ /* if (isReadWrite() == false)
+ return false;
+
+ // m_file is always local, so we use QFile
+ QFile file(m_file);
+ if (file.open(IO_WriteOnly) == false)
+ return false;
+
+ // use QTextStream to dump the text to the file
+ QTextStream stream(&file);
+ stream << m_widget->text();
+
+ file.close();
+ */
+ return true;
+}
+
+void KMFIPTEditorPart::fileOpen() {
+ // this slot is called whenever the File->Open menu is selected,
+ // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar
+ // button is clicked
+ /* QString file_name = KFileDialog::getOpenFileName();
+
+ if (file_name.isEmpty() == false)
+ openURL(file_name);*/
+}
+
+void KMFIPTEditorPart::fileSaveAs() {
+ // this slot is called whenever the File->Save As menu is selected,
+ /* QString file_name = KFileDialog::getSaveFileName();
+ if (file_name.isEmpty() == false)
+ saveAs(file_name);*/
+}
+
+void KMFIPTEditorPart::slotEnableActions( bool on ) {
+ if ( on ) {
+ m_actionEditChain->setEnabled( true );
+ m_actionNewChain->setEnabled( true );
+ m_actionNewRule->setEnabled( true );
+ m_actionDelChain->setEnabled( true );
+ m_actionDelRule->setEnabled( true );
+ m_actionEditDocOptions->setEnabled( true );
+ } else {
+ m_actionEditChain->setEnabled( false );
+ m_actionNewChain->setEnabled( false );
+ m_actionNewRule->setEnabled( false );
+ m_actionDelChain->setEnabled( false );
+ m_actionDelRule->setEnabled( false );
+ m_actionEditDocOptions->setEnabled( false );
+
+ }
+}
+
+
+// It's usually safe to leave the factory code alone.. with the
+// notable exception of the KAboutData data
+
+KInstance* KMFIPTEditorPartFactory::s_instance = 0L;
+KAboutData* KMFIPTEditorPartFactory::s_about = 0L;
+
+KMFIPTEditorPartFactory::KMFIPTEditorPartFactory()
+ : KParts::Factory() {}
+
+KMFIPTEditorPartFactory::~KMFIPTEditorPartFactory() {
+ delete s_instance;
+ delete s_about;
+
+ s_instance = 0L;
+}
+
+KParts::Part* KMFIPTEditorPartFactory::createPartObject( QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name,
+ const char *classname, const QStringList& ) {
+ // Create an instance of our Part
+ KMFIPTEditorPart * obj = new KMFIPTEditorPart( parentWidget, widgetName, parent, name );
+
+ // See if we are to be read-write or not
+ if ( QCString( classname ) == "KParts::ReadOnlyPart" )
+ obj->setReadWrite( false );
+
+ return obj;
+}
+
+KInstance* KMFIPTEditorPartFactory::instance() {
+ if ( !s_instance ) {
+ s_about = new KAboutData( "kmfipteditorpart", I18N_NOOP( "kmfipteditorpartPart" ), "0.1" );
+ s_about->addAuthor( "Christian Hubinger", 0, "chubinger@irrsinnig.org" );
+ s_instance = new KInstance( s_about );
+ }
+ return s_instance;
+}
+
+extern "C" {
+ void* init_libkmfipteditorpart() {
+ return new KMFIPTEditorPartFactory;
+ }
+}
+
+}
+
+#include "kmfipteditorpart.moc"
diff --git a/kmyfirewall/ipteditor/kmfipteditorpart.desktop b/kmyfirewall/ipteditor/kmfipteditorpart.desktop
new file mode 100644
index 0000000..2c87a25
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfipteditorpart.desktop
@@ -0,0 +1,15 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Name=KMFIPTEditorPart
+Name[fr]=Module d'éditeur KMFIPT
+Name[hi]=केएमएफ़आईपीटी-एडिटर-पार्ट
+Name[pt_BR]=Componente Editor KMFIP
+Name[sv]=IPT-editordel för Min brandvägg
+Name[ta]=KMFIPTதொகுபி பகுதி
+Name[tr]=KMF IPT Düzenleyici Parçası
+Name[xx]=xxKMFIPTEditorPartxx
+Name[zh_CN]=KMFip 规则表编辑器组件
+MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
+ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart
+X-KDE-Library=libkkmfipteditoprat
diff --git a/kmyfirewall/ipteditor/kmfipteditorpart.h b/kmyfirewall/ipteditor/kmfipteditorpart.h
new file mode 100644
index 0000000..c188a52
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfipteditorpart.h
@@ -0,0 +1,124 @@
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+/*
+Author: Christian Hubinger <chubinger@irrsinnig.org>, (C) 2001
+*/
+
+#ifndef _KMFIPTEDITORPART_H_
+#define _KMFIPTEDITORPART_H_
+
+#include <kparts/part.h>
+#include <kparts/factory.h>
+
+class QWidget;
+class QPainter;
+class KURL;
+class KAction;
+class KActionMenu;
+class KInstance;
+class KAboutData;
+
+namespace KMF {
+class KMFRuleEdit;
+class KMFIPTDoc;
+class KMFIPTDocOptions;
+
+/**
+ * This is a "Part". It that does all the real work in a KPart
+ * application.
+ *
+ * @short Main Part
+ * @author Chris <chubinger@irrsinnig.org>
+ * @version 0.1
+ */
+
+class KMFIPTEditorPart : public KParts::ReadWritePart
+{
+ Q_OBJECT
+public:
+ /**
+ * Default constructor
+ */
+ KMFIPTEditorPart(QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name);
+
+ /**
+ * Destructor
+ */
+ virtual ~KMFIPTEditorPart();
+
+ /**
+ * This is a virtual function inherited from KParts::ReadWritePart.
+ * A shell will use this to inform this Part if it should act
+ * read-only
+ */
+ virtual void setReadWrite(bool rw);
+
+ /**
+ * Reimplemented to disable and enable Save action
+ */
+ virtual void setModified(bool modified);
+
+protected:
+ /**
+ * This must be implemented by each part
+ */
+ virtual bool openFile();
+
+ /**
+ * This must be implemented by each read-write part
+ */
+ virtual bool saveFile();
+
+public slots:
+ void slotEnableActions( bool );
+
+protected slots:
+ void fileOpen();
+ void fileSaveAs();
+ void slotEditChain();
+ void slotNewChain();
+ void slotDelChain();
+ void slotNewRule();
+ void slotDelRule();
+ void slotEditDocOptions();
+ void slotEditNetwork();
+
+private:
+ KMFRuleEdit *m_ruleedit;
+ KMFIPTDoc* m_doc;
+ KMFIPTDocOptions *m_editdoc;
+ KAction* m_actionEditNetwork;
+ KAction* m_actionEditChain;
+ KAction* m_actionNewChain;
+ KAction* m_actionNewRule;
+ KAction* m_actionDelChain;
+ KAction* m_actionDelRule;
+ KAction* m_actionEditDocOptions;
+};
+
+
+class KMFIPTEditorPartFactory : public KParts::Factory
+{
+ Q_OBJECT
+public:
+ KMFIPTEditorPartFactory();
+ virtual ~KMFIPTEditorPartFactory();
+ virtual KParts::Part* createPartObject( QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name,
+ const char *classname, const QStringList &args );
+ static KInstance* instance();
+
+private:
+ static KInstance* s_instance;
+ static KAboutData* s_about;
+};
+
+}
+#endif // _KMFRULEEDITPART_H_
diff --git a/kmyfirewall/ipteditor/kmfipteditorpartui.rc b/kmyfirewall/ipteditor/kmfipteditorpartui.rc
new file mode 100644
index 0000000..4321120
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfipteditorpartui.rc
@@ -0,0 +1,29 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="kmfipteditorpart" version="1">
+<MenuBar>
+ <Menu name="network"><text>&amp;My Network</text>
+ <Action name="edit_network" />
+ </Menu>
+ <Menu name="iptables"><text>&amp;IPTables</text>
+ <Action name="new_rule"/>
+ <Action name="del_rule"/>
+ <Separator lineSeparator="true"/>
+ <Action name="new_chain"/>
+ <Action name="del_chain"/>
+ <Separator lineSeparator="true"/>
+ <Action name="edit_chain"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar">
+ <Action name="edit_network" />
+ <Separator lineSeparator="true"/>
+ <Action name="edit_doc_options"/>
+ <Action name="new_rule"/>
+ <Separator lineSeparator="true"/>
+ <Action name="new_chain"/>
+ <Action name="edit_chain"/>
+</ToolBar>
+</kpartgui>
+
+
+
diff --git a/kmyfirewall/ipteditor/kmfnewchaindlg.cpp b/kmyfirewall/ipteditor/kmfnewchaindlg.cpp
new file mode 100644
index 0000000..feff7ce
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfnewchaindlg.cpp
@@ -0,0 +1,115 @@
+/***************************************************************************
+ begin : Sat Mar 9 2002
+ copyright : (C) 2002 by Christian Hubinger
+ email : chubinger@irrsinnig.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 "kmfnewchaindlg.h"
+
+// qt includes
+#include <qstring.h>
+#include <qradiobutton.h>
+#include <qlineedit.h>
+#include <qnamespace.h>
+#include <qevent.h>
+
+// kde includes
+#include <klocale.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+
+// my includes
+#include "../core/xmlnames.h"
+#include "../core/kmfdoc.h"
+#include "../core/kmfiptdoc.h"
+#include "../core/kmferror.h"
+#include "../core/kmfcheckinput.h"
+#include "../core/kmferrorhandler.h"
+#include "../core/kmfnetwork.h"
+#include "../core/kmfundoengine.h"
+namespace KMF {
+KMFNewChainDlg::KMFNewChainDlg ( QWidget *parent, const char *name, bool modal, WFlags fl ) : KMyFirewallChainEditorNewChain ( parent, name, modal, fl ) {
+ kmfdoc = 0;
+ m_err = new KMFError();
+ m_err_handler = new KMFErrorHandler ( "KMFNewChainDlg" );
+ m_check_input = new KMFCheckInput();
+}
+
+KMFNewChainDlg::~KMFNewChainDlg() {}
+
+void KMFNewChainDlg::keyPressEvent ( QKeyEvent * e ) {
+ // kdDebug() << "KMFNewChainDlg::keyPressEvent ( QKeyEvent * " << e->key() << ")" << endl;
+ if ( e->key() == Qt::Key_Enter ||
+ e->key() == Qt::Key_Return ) {
+ accept();
+ e-> accept();
+ }
+ if ( e->key() == Qt::Key_Escape ||
+ e->key() == Qt::Key_Backspace ) {
+ QDialog::reject();
+ e-> accept();
+ }
+}
+
+void KMFNewChainDlg::loadDoc ( KMFIPTDoc* doc ) {
+ kmfdoc = doc;
+}
+/** No descriptions */
+void KMFNewChainDlg::accept() {
+ if ( kmfdoc == 0 ) {
+ KMessageBox::error ( 0, i18n ( "KMFNewChainDlg: kmfdoc = 0. This happened because of a bug." ) );
+ return ;
+ }
+ QStringList StringList;
+ QString name = t_name->text();
+ QString target = "DROP";
+ if ( !name.isEmpty() ) {
+ m_check_input->checkInput ( name, "CHAINNAME", m_err );
+ if ( ! m_err_handler->showError ( m_err ) ) {
+ return;
+ }
+
+ IPTChain* chain = 0;
+ QString table = Constants::FilterTable_Name;
+ if ( c_filter->isChecked() ) {
+ table = Constants::FilterTable_Name;
+ } else if ( c_nat->isChecked() ) {
+ table = Constants::NatTable_Name;
+ } else if ( c_mangle->isChecked() ) {
+ table = Constants::MangleTable_Name;
+ } else {
+ return;
+ }
+
+ KMFUndoEngine::instance()->startTransaction (
+ kmfdoc->table ( table ),
+ i18n ( "Added Chain: %1 to Table: %1" ).arg ( name ).arg ( table )
+ );
+ chain = kmfdoc->table ( table )->addChain ( name, target, false, m_err );
+ if ( m_err_handler->showError ( m_err ) ) {
+ kmfdoc->table ( table )->changed();
+ KMFUndoEngine::instance()->endTransaction();
+ emit sigUpdateView();
+ } else {
+ KMFUndoEngine::instance()->abortTransaction();
+ return;
+ }
+ QDialog::accept();
+ } else {
+ KMessageBox::sorry ( 0, i18n ( "You must set a name for your chain." ) );
+ return;
+ }
+}
+
+}
+
+#include "kmfnewchaindlg.moc"
diff --git a/kmyfirewall/ipteditor/kmfnewchaindlg.h b/kmyfirewall/ipteditor/kmfnewchaindlg.h
new file mode 100644
index 0000000..e5c09bc
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfnewchaindlg.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+ begin : Sat Mar 9 2002
+ copyright : (C) 2002 by Christian Hubinger
+ email : chubinger@irrsinnig.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 KMFNEWCHAINDLG_H
+#define KMFNEWCHAINDLG_H
+
+#include <qwidget.h>
+#include <qstringlist.h>
+#include "kmyfirewallchaineditornewchain.h"
+#include <qevent.h>
+/**
+ *@author Christian Hubinger
+ */
+
+
+namespace KMF {
+class KMFIPTDoc;
+class KMFError;
+class KMFErrorHandler;
+class KMFCheckInput;
+
+class KMFNewChainDlg : public KMyFirewallChainEditorNewChain {
+ Q_OBJECT
+public:
+ KMFNewChainDlg( QWidget *parent = 0, const char *name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~KMFNewChainDlg();
+ void loadDoc( KMFIPTDoc* doc );
+
+public slots: // Public slots
+ /** No descriptions */
+ void accept();
+
+private:
+ KMFIPTDoc* kmfdoc;
+ KMFError* m_err;
+ KMFErrorHandler* m_err_handler;
+ KMFCheckInput* m_check_input;
+
+protected:
+ virtual void keyPressEvent ( QKeyEvent * e );
+
+
+signals:
+ void sigUpdateView();
+
+};
+}
+#endif
diff --git a/kmyfirewall/ipteditor/kmfruleedit.cpp b/kmyfirewall/ipteditor/kmfruleedit.cpp
new file mode 100644
index 0000000..39a95a2
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfruleedit.cpp
@@ -0,0 +1,1517 @@
+/***************************************************************************
+begin : Thu Feb 7 2002
+copyright : (C) 2002 by Christian Hubinger
+email : chubinger@irrsinnig.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 "kmfruleedit.h"
+
+//KDE includes
+#include <kled.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <klistview.h>
+#include <kpopupmenu.h>
+#include <kmessagebox.h>
+#include <kapplication.h>
+#include <klistbox.h>
+#include <kpushbutton.h>
+#include <kcombobox.h>
+#include <ktrader.h>
+#include <kparts/part.h>
+#include <kparts/plugin.h>
+#include <kparts/factory.h>
+
+//QT includes
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qheader.h>
+#include <qsplitter.h>
+
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qptrlist.h>
+#include <qstring.h>
+#include <qinputdialog.h>
+#include <qlabel.h>
+#include <qmessagebox.h>
+#include <qgroupbox.h>
+#include <qsize.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qwidgetstack.h>
+
+// project includes
+#include "../core/xmlnames.h"
+#include "../core/kmfdoc.h"
+#include "../core/kmfiptdoc.h"
+#include "../core/kmfnetwork.h"
+#include "../core/iptchain.h"
+#include "../core/iptrule.h"
+#include "../core/kmfcheckinput.h"
+#include "../core/kmferror.h"
+#include "../core/kmferrorhandler.h"
+#include "../core/kmfconfig.h"
+#include "../core/kmfpluginfactory.h"
+#include "../core/kmfappstate.h"
+#include "../core/kmyfirewallinterface.h"
+#include "../core/kmfruleoptioneditinterface.h"
+#include "../core/kmfruletargetoptioneditinterface.h"
+
+
+#include "../kmfwidgets/kmflistview.h"
+#include "../kmfwidgets/kmfmynetworkwidget.h"
+#include "../kmfwidgets/kmflistviewitem.h"
+#include "../kmfwidgets/kmfobjectinfo.h"
+#include "../kmfwidgets/kmfmainwindow.h"
+
+#include "kmfchainedit.h"
+#include "kmfnewchaindlg.h"
+namespace KMF {
+KMFRuleEdit::KMFRuleEdit( QWidget* parent, const char* name, WFlags fl )
+ : KMyFirewallRuleEditor( parent, name, fl ), KMFRuleEditInterface() {
+ if ( !name )
+ setName( "KMFRuleEdit" );
+ m_lastDisplayDoc = 0;
+ loadIcons();
+ m_editPlugins.clear();
+ b_move_up->setPixmap( icon_up );
+ b_move_down->setPixmap( icon_down );
+ // need to remove dummy page from QTDesigner ;-)
+ m_ws_target_opt->removeWidget( page );
+
+ m_err = new KMFError();
+ m_err_handler = new KMFErrorHandler( "KMFRuleEdit" );
+ kb_optSelect->clear();
+ connect( kb_optSelect, SIGNAL( activated( int ) ) , this, SLOT( slotNewOptionType( int ) ) );
+
+ m_lv_table_filter = new KMFListView( m_widgetStack, "m_lv_table_filter" );
+ m_lv_table_filter->show();
+
+ connect( m_lv_table_filter, SIGNAL( contextMenuRequested ( QListViewItem*, const QPoint&, int ) ),
+ this, SLOT( slotRuleRBM( QListViewItem*, const QPoint&, int ) ) );
+
+ connect( m_lv_table_filter, SIGNAL( itemRenamed ( QListViewItem*, int, const QString& ) ),
+ this, SLOT( slotRenameRule( QListViewItem*, int, const QString& ) ) );
+
+ connect( m_lv_table_filter, SIGNAL( clicked( QListViewItem* ) ),
+ this, SLOT( slotNewItemSelected( QListViewItem* ) ) );
+
+// connect( this, SIGNAL( sigUpdateView() ),
+// m_lv_table_filter, SLOT( slotUpdateView() ) );
+
+ m_widgetStack->addWidget( m_lv_table_filter );
+
+
+ m_lv_table_nat = new KMFListView( m_widgetStack, "m_lv_table_nat" );
+ m_lv_table_nat->show();
+
+ connect( m_lv_table_nat, SIGNAL( contextMenuRequested ( QListViewItem*, const QPoint&, int ) ),
+ this, SLOT( slotRuleRBM( QListViewItem*, const QPoint&, int ) ) );
+
+ connect( m_lv_table_nat, SIGNAL( itemRenamed ( QListViewItem*, int, const QString& ) ),
+ this, SLOT( slotRenameRule( QListViewItem*, int, const QString& ) ) );
+
+ connect( m_lv_table_nat, SIGNAL( clicked( QListViewItem* ) ),
+ this, SLOT( slotNewItemSelected( QListViewItem* ) ) );
+
+ m_widgetStack->addWidget( m_lv_table_nat );
+
+ m_lv_table_mangle = new KMFListView( m_widgetStack, "m_lv_table_mangle" );
+ m_lv_table_mangle->show();
+
+ connect( m_lv_table_mangle, SIGNAL( contextMenuRequested ( QListViewItem*, const QPoint&, int ) ),
+ this, SLOT( slotRuleRBM( QListViewItem*, const QPoint&, int ) ) );
+
+ connect( m_lv_table_mangle, SIGNAL( itemRenamed ( QListViewItem*, int, const QString& ) ),
+ this, SLOT( slotRenameRule( QListViewItem*, int, const QString& ) ) );
+
+ connect( m_lv_table_mangle, SIGNAL( clicked( QListViewItem* ) ),
+ this, SLOT( slotNewItemSelected( QListViewItem* ) ) );
+
+
+
+ m_widgetStack->addWidget( m_lv_table_mangle );
+
+ m_splitter->setResizeMode( gb_options, QSplitter::KeepSize );
+
+ m_editchain = new KMFChainEdit( this, "chianditor", 0 );
+ kdDebug() << "CONNECTING CHAINEDITOR" << endl;
+ connect( m_editchain, SIGNAL( sigHideMe() ),
+ this, SLOT( slotShowOverview() ) );
+ m_widgetStack->addWidget( m_editchain );
+
+
+ m_object_info = new KMFObjectInfo( this, "rule info" );
+ connect( m_object_info, SIGNAL( sigHideMe() ),
+ this, SLOT( slotShowOverview() ) );
+
+ m_widgetStack->addWidget( m_object_info );
+
+ m_new_chain = new KMFNewChainDlg();
+ connect( m_new_chain, SIGNAL( sigUpdateView() ),
+ this, SIGNAL( sigUpdateView() ) );
+
+ m_myNetworkWidget = new KMFMyNetworkWidget( this, "KMFMyNetworkWidget" );
+ connect( this, SIGNAL( sigUpdateView() ),
+ m_myNetworkWidget, SLOT( slotUpdateView() ) );
+ connect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_myNetworkWidget, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ connect( m_myNetworkWidget, SIGNAL( sigActiveTargetChanged() ), this, SLOT( slotUpdateView() ) );
+ m_myNetworkWidget->hide(); //close( false );
+
+ m_check_input = new KMFCheckInput();
+ m_contextMenu = new KPopupMenu( this );
+
+ connect( cb_log_rule, SIGNAL( clicked() ),
+ this, SLOT( slotLogRuleChanged() ) );
+ connect( cb_disable_rule, SIGNAL( clicked() ),
+ this, SLOT( slotEnableRuleChanged() ) );
+ rb_filter->setChecked( true );
+
+ loadPlugins();
+
+ m_rule = 0;
+ m_chain = 0;
+ m_table = 0;
+ m_network = 0;
+ m_widgetStack->show();
+ // slotNewTableSelected();
+ // slotShowOverview();
+ adjustSize();
+ show();
+}
+
+KMFRuleEdit::~KMFRuleEdit() {}
+
+void KMFRuleEdit::setKMFMainWindow( KMFMainWindow* win ) {
+ m_app = win;
+}
+
+void KMFRuleEdit::slotSelectionInvalid() {
+ m_rule = 0;
+ m_chain = 0;
+ m_table = 0;
+}
+
+void KMFRuleEdit::loadDoc( KMFNetwork* network ) {
+ kdDebug() << "void KMFRuleEdit::loadDoc(KMFIPTDoc* doc)" << endl;
+ if ( network == 0 ) {
+ m_err->setErrType(KMFError::NORMAL );
+ const QString& msg = i18n( "KMFRuleEdit:::loadDoc(KMFIPTDoc* doc)\n"
+ "KMFIPTDoc* doc == 0. This is a bug." );
+ m_err->setErrMsg( msg );
+ m_err_handler->showError( m_err );
+ setEnabled( false );
+ return ;
+ }
+
+ if ( !isEnabled() ) {
+ setEnabled( true );
+ }
+ m_network = network;
+ m_myNetworkWidget->setNetwork( m_network );
+
+ rb_filter->setEnabled( m_network->currentDocAsIPTDoc()->useFilter() );
+ rb_mangle->setEnabled( m_network->currentDocAsIPTDoc()->useMangle() );
+ rb_nat->setEnabled( m_network->currentDocAsIPTDoc()->useNat() );
+ if ( m_network->currentDocAsIPTDoc()->useModules() ) {
+ m_led_modules->setColor( green );
+ m_led_modules->on();
+ } else {
+ m_led_modules->setColor( red );
+ m_led_modules->off();
+ }
+
+ if ( m_network->currentDocAsIPTDoc()->useIPFwd() ) {
+ m_led_fwd->setColor( green );
+ m_led_fwd->on();
+ } else {
+ m_led_fwd->setColor( red );
+ m_led_fwd->off();
+ }
+
+ if ( m_network->currentDocAsIPTDoc()->useSynCookies() ) {
+ m_led_syn->setColor( green );
+ m_led_syn->on();
+ } else {
+ m_led_syn->setColor( red );
+ m_led_syn->off();
+ }
+
+ if ( m_network->currentDocAsIPTDoc()->useRPFilter() ) {
+ m_led_rp->setColor( green );
+ m_led_rp->on();
+ } else {
+ m_led_rp->setColor( red );
+ m_led_rp->off();
+ }
+
+ if ( m_network->currentDocAsIPTDoc()->useMartians() ) {
+ m_led_martians->setColor( green );
+ m_led_martians->on();
+ } else {
+ m_led_martians->setColor( red );
+ m_led_martians->off();
+ }
+
+
+
+ IPTable *filter = 0;
+ filter = m_network->currentDocAsIPTDoc()->table( Constants::FilterTable_Name );
+ if ( filter ) {
+ m_lv_table_filter->clearAllItems();
+ m_lv_table_filter->slotLoadNode( filter );
+ }
+
+// IPTable *def = 0;
+ IPTable *nat = 0;
+ nat = m_network->currentDocAsIPTDoc()->table( Constants::NatTable_Name );
+ if ( nat ) {
+ m_lv_table_nat->clearAllItems();
+ m_lv_table_nat->slotLoadNode( nat );
+ }
+
+ IPTable *mangle = 0;
+ mangle = m_network->currentDocAsIPTDoc()->table( Constants::MangleTable_Name );
+ if ( mangle ) {
+ m_lv_table_mangle->clearAllItems();
+ m_lv_table_mangle->slotLoadNode( mangle );
+ }
+
+ m_rule = 0;
+ m_chain = 0;
+ m_table = 0;
+
+ enableRuleEdit( false );
+ slotShowOverview();
+ // if ( KMFAppState::upAndRunning() ) {
+ rb_filter->setChecked( true );
+ slotNewTableSelected();
+ emit sigUpdateView();
+ //}
+}
+
+void KMFRuleEdit::slotLoadDocument( KMFNetwork* network ) {
+ kdDebug() << "KMFRuleEdit::slotLoadDocument( KMFNetwork* network )" << endl;
+ slotShowOverview();
+ loadDoc( network );
+}
+
+
+void KMFRuleEdit::loadPlugins() {
+ kdDebug() << "KMFRuleEdit::loadPlugins()" << endl;
+
+ QPtrListIterator<KMFRuleOptionEditInterface> it( *KMFPluginFactory::KMFRuleOptionEditors( this ) );
+ while( it.current() ) {
+ registerRuleOptionPlugin( it.current() );
+ ++it;
+ }
+
+ QPtrListIterator<KMFRuleTargetOptionEditInterface> it2( *KMFPluginFactory::KMFRuleTargetOptionEditors( this ) );
+ while( it2.current() ) {
+ registerRuleTargetOptionPlugin( it2.current() );
+ ++it2;
+ }
+
+}
+
+void KMFRuleEdit::registerRuleOptionPlugin( KMFRuleOptionEditInterface* edit ) {
+ m_widgetStack->addWidget( edit->editWidget() );
+ m_editPlugins.append( edit );
+ kb_optSelect->insertItem( i18n("Edit %1").arg( edit->optionEditName() ) );
+}
+
+void KMFRuleEdit::registerRuleTargetOptionPlugin( KMFRuleTargetOptionEditInterface* edit ) {
+ m_ws_target_opt->addWidget( edit->editWidget() );
+ m_editTargetPlugins.append( edit );
+}
+
+
+
+KMFListView* KMFRuleEdit::currTableView() {
+ if ( rb_filter->isChecked() && rb_filter->isEnabled() ) {
+ return m_lv_table_filter;
+ } else if ( rb_nat->isChecked() && rb_nat->isEnabled() ) {
+ return m_lv_table_nat;
+ } else if ( rb_mangle->isChecked() && rb_mangle->isEnabled() ) {
+ return m_lv_table_mangle;
+ } else {
+ kdDebug() << "ERROR: currTableView() returning fallbvack table: filter !!!" << endl;
+ return m_lv_table_filter;
+ }
+}
+
+
+
+
+
+void KMFRuleEdit::slotNewTableSelected() {
+ kdDebug() << "void KMFRuleEdit::slotNewTableSelected()" << endl;
+ if ( ! m_network->currentDocAsIPTDoc() ) {
+ setEnabled( false );
+ return ;
+ }
+ QString table = Constants::FilterTable_Name;
+ if ( !rb_filter->isEnabled() )
+ rb_filter->setChecked( false );
+ if ( !rb_nat->isEnabled() )
+ rb_nat->setChecked( false );
+ if ( !rb_mangle->isEnabled() )
+ rb_mangle->setChecked( false );
+
+
+ if ( rb_filter->isChecked() && rb_filter->isEnabled() ) {
+ table = Constants::FilterTable_Name;
+ kdDebug() << "Enabling Filter View" << endl;
+ setCurrTableView( m_lv_table_filter );
+ } else if ( rb_nat->isChecked() && rb_nat->isEnabled() ) {
+ setEnabled( true );
+ table = Constants::NatTable_Name;
+ setCurrTableView( m_lv_table_nat );
+ } else if ( rb_mangle->isChecked() && rb_mangle->isEnabled() ) {
+ setEnabled( true );
+ table = Constants::MangleTable_Name;
+ setCurrTableView( m_lv_table_mangle );
+ } else {
+ setEnabled( true );
+ table = Constants::FilterTable_Name;
+ setCurrTableView( m_lv_table_filter );
+ return;
+ }
+
+ IPTable *tab = m_network->currentDocAsIPTDoc()->table( table );
+ if ( tab == 0 ) {
+ setEnabled( false );
+ kdDebug() << "Table: " << table << " not found in document!!" << table << endl;
+ return ;
+ }
+
+ m_table = tab;
+ slotShowOverview();
+}
+void KMFRuleEdit::setCurrTableView( KMFListView* lv ) {
+ kdDebug() << "void KMFRuleEdit::setCurrTableView( KMFListView* lv )" << endl;
+ if ( lv == m_lv_table_filter ) {
+ setEnabled( true );
+ kdDebug() << "Enabling Filter View" << endl;
+ m_lv_table_filter->setEnabled( true );
+ connect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_filter, SLOT( slotUpdateView() ) );
+
+ connect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_filter, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ kdDebug() << "Disabling Nat View" << endl;
+ m_lv_table_nat->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_nat, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_nat, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ kdDebug() << "Disabling Mangle View" << endl;
+ m_lv_table_mangle->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_mangle, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_mangle, SLOT( slotUpdateView( NetfilterObject* ) ) );
+ } else if ( lv == m_lv_table_nat ) {
+ setEnabled( true );
+ kdDebug() << "Disabling Filter View" << endl;
+ m_lv_table_filter->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_filter, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_filter, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ kdDebug() << "Enabling Nat View" << endl;
+ m_lv_table_nat->setEnabled( true );
+ connect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_nat, SLOT( slotUpdateView() ) );
+ connect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_nat, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ kdDebug() << "Disabling Mangle View" << endl;
+ m_lv_table_mangle->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_mangle, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_mangle, SLOT( slotUpdateView( NetfilterObject* ) ) );
+ } else if ( lv == m_lv_table_mangle ) {
+ setEnabled( true );
+
+ kdDebug() << "Disabling Filter View" << endl;
+ m_lv_table_filter->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_filter, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_filter, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ kdDebug() << "Disabling Nat View" << endl;
+ m_lv_table_nat->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_mangle, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_mangle, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ kdDebug() << "Enabling Mangle View" << endl;
+ m_lv_table_mangle->setEnabled( true );
+ connect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_mangle, SLOT( slotUpdateView() ) );
+ connect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_mangle, SLOT( slotUpdateView( NetfilterObject* ) ) );
+ } else if ( ! lv ){
+ kdDebug() << "Disabling Filter View" << endl;
+ m_lv_table_filter->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_filter, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_filter, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ kdDebug() << "Disabling Nat View" << endl;
+ m_lv_table_nat->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_mangle, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_mangle, SLOT( slotUpdateView( NetfilterObject* ) ) );
+
+ kdDebug() << "Disabling Mangle View" << endl;
+ m_lv_table_mangle->setEnabled( false );
+ disconnect( this, SIGNAL( sigUpdateView() ),
+ m_lv_table_mangle, SLOT( slotUpdateView() ) );
+ disconnect( this, SIGNAL( sigUpdateView( NetfilterObject* ) ),
+ m_lv_table_mangle, SLOT( slotUpdateView( NetfilterObject* ) ) );
+ }
+}
+
+void KMFRuleEdit::slotNewItemSelected( QListViewItem* item ) {
+ kdDebug() << "KMFRuleEdit::slotNewItemSelected( QListViewItem* item )" << endl;
+ if ( ! item )
+ return ;
+ if ( KMFListViewItem * kmf_item = dynamic_cast<KMFListViewItem*>( item ) ) {
+ IPTRuleOption * opt = 0;
+ switch( kmf_item->type() ) {
+ case NetfilterObject::TABLE:
+ m_rule = 0;
+ m_chain = 0;
+ m_table = kmf_item->table();
+ slotEditRule();
+ break;
+ case NetfilterObject::CHAIN:
+ m_rule = 0;
+ m_chain = kmf_item->chain();
+ m_table = m_chain->table();
+ slotEditRule();
+ break;
+ case NetfilterObject::RULE:
+ m_rule = kmf_item->rule();
+ m_chain = m_rule->chain();
+ m_table = m_rule->chain() ->table();
+ slotEditRule();
+ break;
+ case NetfilterObject::RULEOPTION:
+ opt = kmf_item->ruleOption();
+ m_rule = opt->rule();
+ m_chain = opt->rule() ->chain();
+ m_table = opt->rule() ->chain() ->table();
+ slotEditRule();
+ break;
+ default:
+ kdDebug() << "Strange? KMFListViewItem * kmf_item>type() NOT VALID" << endl;
+ m_rule = 0;
+ m_chain = 0;
+ m_table = 0;
+ break;
+ }
+ }
+}
+
+void KMFRuleEdit::slotAddRule() {
+ kdDebug() << "KMFRuleEdit::slotAddRule()" << endl;
+ if ( ! m_chain ) {
+ KMessageBox::sorry( this, i18n( "<qt>No Chain Found to add the Rule.<br>"
+ "Please make sure that you selected a Chain or Rule before you try to add a Rule." ),
+ i18n( "Sorry" ) );
+ return ;
+ }
+ bool ok = FALSE;
+ const QString greeting = i18n( "New Rule" );
+ const QString label = i18n( "Please enter a name for the new rule:" );
+ QString text = QInputDialog::getText( greeting, label, QLineEdit::Normal, QString::null, &ok, this, "dsa" );
+ if ( ok && !text.isEmpty() ) {
+ kdDebug() << "Adding Rule Named: " << text << endl;
+ QString ch = m_chain->name();
+ kdDebug() << "For Chain: " << ch << endl;
+ QString tab = m_chain->table() ->name();
+ kdDebug() << "In Table: " << tab << endl;
+ QString target = "ACCEPT";
+ kdDebug() << "With Target: " << target << endl;
+ if ( !text.isEmpty() && !ch.isEmpty() && !tab.isEmpty() && !target.isEmpty() ) {
+ m_check_input->checkInput( text, "RULENAME", m_err );
+ if ( m_err_handler->showError( m_err ) ) {
+ KMFUndoEngine::instance()->startTransaction(
+ m_chain,
+ i18n( "Add Rule: %1 to Chain: %2" ).arg( text ).arg( m_chain->name() )
+ );
+
+ IPTRule *inserted = m_chain->addRule( text, m_err );
+ if ( m_err_handler->showError( m_err ) ) {
+ if ( m_rule ) {
+ m_chain->moveRule( inserted, ( m_rule->ruleNum() ) -inserted->ruleNum() );
+ }
+// m_network->changed();
+ KMFUndoEngine::instance()->endTransaction();
+ } else {
+ KMFUndoEngine::instance()->abortTransaction();
+ }
+
+ m_rule = inserted;
+ emit sigUpdateView( m_chain );
+ }
+ } else {
+ KMessageBox::sorry( this, i18n( "An error occurred while trying to setup a new rule." ), i18n( "Rule Editor" ) );
+ }
+ }
+}
+
+void KMFRuleEdit::slotAddChain() {
+ if ( m_table ) {
+ m_new_chain->loadDoc( m_table->kmfDoc() );
+ m_new_chain->exec();
+ }
+}
+
+void KMFRuleEdit::slotDelChain() {
+ kdDebug() << "void KMFView::slotDelChain()" << endl;
+ if ( ! m_chain ) {
+ KMessageBox::sorry( this, i18n( "<qt>No Chain Found for deleting.<br>"
+ "Please make sure that you selected a Chain or Rule before you try to delete the current chain." ),
+ i18n( "Sorry" ) );
+ return ;
+ }
+
+ if ( m_chain->isBuildIn() ) {
+ KMessageBox::sorry( this, i18n( "<qt><b>Cannot delete built-in chain: %1</b><br>"
+ "Built-in chains cannot be deleted; you can only delete chains "
+ "that you have defined yourself." ).arg( m_chain->name() ),
+ i18n( "Sorry" ) );
+ return ;
+ }
+ int doit = KMessageBox::questionYesNo ( this , i18n( "<p>Are you sure that you want to delete "
+ "chain: <b>%1</b> from table: <b>%2</b>?<br>"
+ "<b>Note:</b> By deleting the chain all rules that belong "
+ "to the chain will be deleted too." ).arg( m_chain ->name() ).arg( m_chain ->table() ->name() ),
+ i18n( "Delete Chain" ), KStdGuiItem::yes(), KStdGuiItem::no(), "main_view_delete_chain" );
+ kdDebug() << "Message Box returned: " << doit << endl;
+ if ( doit == 3 ) {
+ kdDebug() << "Try to delete Chain" << endl;
+ KMFUndoEngine::instance()->startTransaction(
+ m_table,
+ i18n( "Delete Chain: %1 from Table: %2").arg( m_chain->name() ).arg( m_chain->table()->name() )
+ );
+ m_err = m_network->currentDocAsIPTDoc()->table( m_chain->table()->name() )->delChain( m_chain );
+ if ( m_err_handler ->showError( m_err ) ) {
+ emit sigUpdateView( m_chain->table() );
+ m_chain = 0;
+ m_rule = 0;
+ m_table = 0;
+ KMFUndoEngine::instance()->endTransaction();
+ } else {
+ KMFUndoEngine::instance()->abortTransaction();
+ }
+
+ }
+}
+
+void KMFRuleEdit::slotEditRule() {
+ m_ws_target_opt->setEnabled(false);
+ if ( ! KMFAppState::upAndRunning() /* || ! KMFAppState::hasOpenDoc() */ ) {
+ slotSelectionInvalid();
+ return;
+ }
+
+
+ if ( m_rule ) {
+ l_editing_rule->setText( "<b>Chain: </b>" + m_rule->chain()->name() + "<br><b>Rule: </b>" + m_rule->name() );
+ kb_optSelect->setEnabled( true );
+ cb_log_rule ->setEnabled( true );
+ cb_disable_rule ->setEnabled( true );
+ cb_target ->setEnabled( true );
+ cb_frag ->setEnabled( true );
+ QString target = m_rule->target();
+ cb_target->clear();
+ const QStringList& list = m_rule->availableTargets();
+ cb_target->insertStringList( list );
+ bool found = false;
+ for ( int i = 0; i < cb_target->count() && ! found; i++ ) {
+ if ( !cb_target->text( i ).isNull() && cb_target->text( i ) == m_rule->target( ) ) {
+ cb_target->setCurrentItem( i );
+ found = true;
+ }
+ }
+
+ slotEditTargetOption();
+ IPTRuleOption *opt = m_rule->getOptionForName( "frag_opt" );
+ if ( !opt->isEmpty() ) {
+ QStringList vals = opt->getValues();
+ if ( *vals.at( 0 ) == XML::BoolOn_Value && *vals.at( 0 ) == XML::BoolOff_Value ) {
+ cb_frag->setChecked( true );
+ cb_frag_inv->setChecked( false );
+ } else if ( *vals.at( 0 ) == XML::BoolOff_Value && *vals.at( 1 ) == XML::BoolOn_Value ) {
+ cb_frag->setChecked( true );
+ cb_frag_inv->setChecked( true );
+ } else {
+ cb_frag->setChecked( false );
+ cb_frag_inv->setChecked( false );
+ }
+ } else {
+ cb_frag->setChecked( false );
+ cb_frag_inv->setChecked( false );
+ }
+
+ cb_disable_rule->setChecked( ! m_rule->enabled() );
+ cb_log_rule->setChecked( m_rule->logging() );
+ enableRuleEdit( true );
+
+ //*********************************
+ } else if ( m_chain ) {
+ l_editing_rule->setText( "<b>Chain: </b>" + m_chain->name() + "<br><b>Rule: </b>No rule selected" );
+ kb_optSelect->setEnabled( false );
+ cb_log_rule ->setEnabled( false );
+ cb_disable_rule ->setEnabled( false );
+ cb_target ->setEnabled( false );
+ cb_frag ->setEnabled( false );
+ m_ws_target_opt->setEnabled( false );
+ enableRuleEdit( false );
+ } else {
+ l_editing_rule->setText( "<b>Chain: </b>No chain selected<br><b>Rule: </b>No rule selected" );
+ kb_optSelect->setEnabled( false );
+ cb_log_rule ->setEnabled( false );
+ cb_disable_rule ->setEnabled( false );
+ cb_target ->setEnabled( false );
+ cb_frag ->setEnabled( false );
+ m_ws_target_opt->setEnabled( false );
+ enableRuleEdit( false );
+ }
+}
+
+void KMFRuleEdit::enableRuleEdit( bool on ) {
+ if ( on ) {
+ b_move_up->setEnabled( true );
+ b_move_down->setEnabled( true );
+ kb_optSelect->setEnabled( true );
+ cb_log_rule ->setEnabled( true );
+ cb_disable_rule ->setEnabled( true );
+ cb_target ->setEnabled( true );
+ cb_frag ->setEnabled( true );
+ } else {
+ kb_optSelect->setEnabled( false );
+ b_move_up->setEnabled( false );
+ b_move_down->setEnabled( false );
+ cb_log_rule ->setEnabled( false );
+ cb_disable_rule ->setEnabled( false );
+ cb_target ->setEnabled( false );
+ cb_frag ->setEnabled( false );
+ m_ws_target_opt->setEnabled( false );
+ }
+}
+
+void KMFRuleEdit::slotMoveRuleDown() {
+ kdDebug() << "KMFRuleEdit::slotMoveRuleDown()" << endl;
+ moveRuleInChain( 1 );
+// if ( m_rule && kb_optSelect->isEnabled() ) {
+// KMFUndoEngine::instance()->startTransaction(
+// m_chain,
+// i18n("Move Rule: %1 down").arg( m_rule->name() )
+// );
+// m_chain->saveState();
+// if ( m_chain->moveRule( m_rule, 1 ) ) {
+// m_rule->chain()->changed();
+// KMFListViewItem* item = currTableView()->findKMFItem( m_rule->name(), 2, m_rule->uuid() );
+// if ( item ) {
+// currTableView()->setSelected( item, true );
+// }
+// item->loadNetfilterObject( m_rule );
+// emit sigUpdateView( m_rule->chain() );
+// KMFUndoEngine::instance()->endTransaction();
+// } else {
+// KMFUndoEngine::instance()->abortTransaction();
+// }
+//
+// }
+}
+
+void KMFRuleEdit::slotMoveRuleUp() {
+ kdDebug() << "KMFRuleEdit::slotMoveRuleUp()" << endl;
+ moveRuleInChain( -1 );
+// if ( m_rule && kb_optSelect->isEnabled() ) {
+// KMFListViewItem* item = currTableView() ->findKMFItem( m_rule->name(),2, m_rule->uuid() );
+// if ( item ) {
+// KMFUndoEngine::instance()->startTransaction(
+// m_chain,
+// i18n("Move Rule: %1 up").arg( m_rule->name() )
+// );
+// m_chain->saveState();
+// if ( m_chain->moveRule( m_rule, -1 ) ) {
+// m_rule->chain()->changed();
+// currTableView()->setSelected( item, true );
+// item->loadNetfilterObject( m_rule );
+// emit sigUpdateView( m_rule->chain() );
+// }
+// KMFUndoEngine::instance()->endTransaction();
+// }
+// }
+}
+
+void KMFRuleEdit::moveRuleInChain( int amount ) {
+ if ( m_rule && kb_optSelect->isEnabled() ) {
+ const QString& transMsg = i18n("Move Rule: %1 %2").arg( m_rule->name() ).arg( amount > 0 ? "down" : "up" );
+ KMFListViewItem* item = currTableView()->findKMFItem( m_rule->name(),2, m_rule->uuid() );
+ if ( item ) {
+ KMFUndoEngine::instance()->startTransaction(
+ m_chain,
+ transMsg.arg( m_rule->name() )
+ );
+ if ( m_chain->moveRule( m_rule, -1 ) ) {
+ m_rule->chain()->changed();
+ currTableView()->setSelected( item, true );
+ item->loadNetfilterObject( m_rule );
+ KMFUndoEngine::instance()->endTransaction();
+ emit sigUpdateView( m_rule->chain() );
+ } else {
+ KMFUndoEngine::instance()->abortTransaction();
+ }
+
+ }
+ }
+}
+
+void KMFRuleEdit::slotDelRule() {
+ kdDebug() << "KMFRuleEdit::slotDelRule()" << endl;
+ if ( ! m_rule || ! m_chain ) {
+ KMessageBox::sorry( this, i18n( "<qt>No Rule defined to delete.<br>"
+ "Please make sure that you selected a Rule before you try to delete one." ),
+ i18n( "Sorry" ) );
+ return ;
+ } else {
+ int doit = KMessageBox::questionYesNo ( this , i18n( "<p>Are you sure that you want to delete "
+ "rule: <b>%1</b> from chain: <b>%2</b>?</p>").arg( m_rule->name() ).arg( m_rule->chain() ->name() ),
+ i18n( "Delete Rule" ), KStdGuiItem::yes(), KStdGuiItem::no(), "rule_edit_delete_rule" );
+ kdDebug() << "Message Box returned: " << doit << endl;
+ if ( doit == 3 ) { // OK clicked
+ kdDebug() << "clicked ok" << endl;
+ KMFUndoEngine::instance()->startTransaction(
+ m_chain,
+ i18n("Delete Rule: %1 from Chain: %2").arg( m_rule->name() ).arg( m_chain->name() )
+ );
+ m_err = m_chain->delRule( m_rule );
+ if ( m_err_handler->showError( m_err ) ) {
+ kdDebug() << "KMFRuleEdit::slotDelRule()\nCalling: m_network->currentDocAsIPTDoc()->updateView()" << endl;
+ m_rule = 0;
+ slotEditRule();
+ KMFUndoEngine::instance()->endTransaction();
+ if ( m_chain ) {
+ emit sigUpdateView( m_chain );
+ } else {
+ emit sigUpdateView();
+ }
+ } else {
+ KMFUndoEngine::instance()->abortTransaction();
+ }
+ }
+ }
+}
+void KMFRuleEdit::showOverview() {
+ slotShowOverview();
+}
+
+void KMFRuleEdit::slotShowOverview() {
+ kdDebug() << "KMFRuleEdit::slotShowOverview()" << endl;
+ if ( rb_filter->isChecked() ) {
+ m_widgetStack->raiseWidget( m_lv_table_filter );
+ } else if ( rb_nat->isChecked() ) {
+ m_widgetStack->raiseWidget( m_lv_table_nat );
+ } else if ( rb_mangle->isChecked() ) {
+ m_widgetStack->raiseWidget( m_lv_table_mangle );
+ }
+/* if ( m_network->currentDocAsIPTDoc() ) {
+ KMFUndoEngine::instance()->endTransaction();
+ }*/
+ if ( m_table ) {
+ kdDebug() << "emit KMFRuleEdit::sigUpdateView()" << endl;
+ emit sigUpdateView();
+ }
+ slotEditRule();
+}
+
+void KMFRuleEdit::slotNewOptionType( int index ) {
+ kdDebug() << "KMFRuleEdit::slotNewOptionType( index " << index << " )" << endl;
+ if ( index > -1 ) {
+ slotEditRule();
+ if ( ! m_rule )
+ return;
+ m_editPlugins.at( index )->loadRule( m_rule );
+ m_widgetStack->raiseWidget( m_editPlugins.at( index )->editWidget() );
+ }
+}
+
+
+
+// void KMFRuleEdit::slotEditCustomOpt() {
+/* kdDebug() << "KMFRuleEdit::slotEditTosOpt()" << endl;
+ slotEditRule();
+ if ( ! m_rule )
+ return;
+ KMessageBox::information ( this , i18n( "<qt><p>You are about to define custom options for this rule.<br>"
+ "There will be <b>no sanity checks</b> for your input, so please make sure "
+ "that your options are working and the syntax is correct.</p></qt>" ),
+ i18n( "Information" ), "custom_option_warning" );
+ m_custom_opt->loadRule( m_rule );
+ m_widgetStack->raiseWidget( m_custom_opt );*/
+// }
+
+void KMFRuleEdit::slotEditRuleInfo() {
+ slotEditRule();
+ if ( ! m_rule )
+ return;
+ m_object_info->loadNetfilterObject( m_rule );
+ m_widgetStack->raiseWidget( m_object_info );
+}
+
+void KMFRuleEdit::slotEditChainInfo() {
+ slotEditRule();
+ if ( ! m_chain )
+ return;
+ m_object_info->loadNetfilterObject( m_chain );
+ m_widgetStack->raiseWidget( m_object_info );
+}
+
+void KMFRuleEdit::slotEditTargetOption() {
+ kdDebug() << "void KMFRuleEdit::slotEditTargetOption()\n Target: " << cb_target->currentText() << endl;
+ if ( ! m_rule )
+ return;
+ QString target = cb_target->currentText();
+ QPtrListIterator<KMFRuleTargetOptionEditInterface> it( m_editTargetPlugins );
+ m_ws_target_opt->setEnabled( false );
+ while ( it.current() ) {
+ KMFRuleTargetOptionEditInterface *edit = it.current();
+ ++it;
+ if ( edit->manageTarget( target ) ) {
+ m_ws_target_opt->setEnabled( true );
+ edit->setTarget( target );
+ edit->loadRule( m_rule );
+ m_ws_target_opt->raiseWidget( edit->editWidget() );
+ return;
+ }
+ }
+
+
+
+
+
+// if ( target == "LOG" ) {
+// m_ws_target_opt->setEnabled( true );
+// m_tglog ->loadRule( m_rule );
+// m_ws_target_opt->raiseWidget( m_tglog );
+// } else if ( target == "SNAT" ) {
+// m_ws_target_opt->setEnabled( true );
+// m_tgnat ->setMode( true );
+// m_tgnat ->loadRule( m_rule );
+// m_ws_target_opt->raiseWidget( m_tgnat );
+// } else if ( target == "DNAT" ) {
+// m_ws_target_opt->setEnabled( true );
+// m_tgnat ->setMode( false );
+// m_tgnat ->loadRule( m_rule );
+// m_ws_target_opt->raiseWidget( m_tgnat );
+// } else if ( target == "TOS" ) {
+// m_ws_target_opt->setEnabled( true );
+// m_tosed->setType( "SETTOS" );
+// m_tosed->loadRule( m_rule );
+// m_ws_target_opt->raiseWidget( m_tosed );
+// } else if ( target == "REJECT" ) {
+// m_ws_target_opt->setEnabled( true );
+// m_tosed->setType( "REJECTTYPE" );
+// m_tosed->loadRule( m_rule );
+// m_ws_target_opt->raiseWidget( m_tosed );
+// } else if ( target == "MARK" ) {
+// m_ws_target_opt->setEnabled( true );
+// m_tgmark->loadRule( m_rule );
+// m_ws_target_opt->raiseWidget( m_tgmark );
+// } else {
+// m_ws_target_opt->setEnabled( false );
+// }
+}
+
+
+void KMFRuleEdit::slotEditChain() {
+ kdDebug() << "void KMFRuleEdit::slotEditChain()" << endl;
+ if ( ! m_chain )
+ return;
+ m_editchain -> loadChain( m_chain );
+ m_widgetStack->raiseWidget( m_editchain );
+}
+
+void KMFRuleEdit::slotEditNetwork() {
+ kdDebug() << "void KMFRuleEdit::slotEditNewtwork()" << endl;
+ // kdDebug() << "Parent is: " << parent()->className() << endl;
+// KMFMyNetworkWidget *wid = new KMFMyNetworkWidget( this, "name" );
+// wid->setNetwork( m_network );
+// wid->slotUpdateView();
+/* connect( wid, SIGNAL( sigActiveTargetChanged() ), this, SLOT( slotUpdateView() ) );*/
+ m_myNetworkWidget->slotUpdateView();
+ m_app->setOutputWidget( m_myNetworkWidget );
+ m_app->showOutput();
+}
+
+// Slots For Rule Edit Changes
+void KMFRuleEdit::slotFragChanged() {
+ kdDebug() << "KMFRuleEdit::slotFragChanged(bool frag)" << endl;
+ if ( !m_rule )
+ return ;
+ bool frag = cb_frag->isChecked();
+ bool frag_inv = cb_frag_inv->isChecked();
+
+ QPtrList<QString>* vals = new QPtrList<QString>;
+ QString* cmd = new QString( "frag_opt" );
+ if ( frag ) {
+ if ( frag_inv ) {
+ vals->append( new QString( XML::BoolOff_Value ) );
+ vals->append( new QString( XML::BoolOn_Value ) );
+ } else {
+ vals->append( new QString( XML::BoolOn_Value ) );
+ vals->append( new QString( XML::BoolOff_Value ) );
+ }
+ } else {
+ vals->append( new QString( XML::BoolOff_Value ) );
+ vals->append( new QString( XML::BoolOff_Value ) );
+ }
+ KMFUndoEngine::instance()->startTransaction(
+ m_rule,
+ i18n( "Edit Rule: %1 Fragment option" ).arg( m_rule->name() )
+ );
+ m_rule->addRuleOption( *cmd, *vals );
+ KMFUndoEngine::instance()->endTransaction();
+ emit sigUpdateView( m_rule );
+}
+
+void KMFRuleEdit::slotLogRuleChanged() {
+ if ( !m_rule )
+ return ;
+ KMFUndoEngine::instance()->startTransaction(
+ m_rule,
+ i18n( "Edit Rule: %1 Log option" ).arg( m_rule->name() )
+ );
+ if ( cb_log_rule->isChecked() ) {
+ m_rule->setLogging( true );
+ } else {
+ m_rule->setLogging( false );
+ }
+// m_network->changed();
+ KMFUndoEngine::instance()->endTransaction();
+ emit sigUpdateView( m_rule );
+}
+
+void KMFRuleEdit::slotEnableRuleChanged() {
+ if ( !m_rule )
+ return ;
+ KMFUndoEngine::instance()->startTransaction(
+ m_rule,
+ i18n( "Edit Rule: %1 enabled state" ).arg( m_rule->name() )
+ );
+ if ( cb_disable_rule->isChecked() ) {
+ m_rule->setEnabled( false );
+ } else {
+ m_rule->setEnabled( true );
+ }
+// m_network->changed();
+ KMFUndoEngine::instance()->endTransaction();
+ emit sigUpdateView( m_rule );
+ slotEditRule();
+}
+
+void KMFRuleEdit::slotTargetChanged( const QString & tg ) {
+ kdDebug() << "KMFRuleEdit::slotTargetChanged(const QString&)" << endl;
+ if ( !m_rule )
+ return ;
+
+ if ( !tg.isEmpty() ) {
+ if ( tg == m_rule->chain() ->name() ) {
+ KMessageBox::sorry( this, i18n( "<qt><p>Sorry, you <b>cannot</b> set the target of this rule to be its own chain. "
+ "Constructing endless loops is not allowed.</qt>" ) );
+ return ;
+ }
+ if ( m_rule->target() == "LOG" || m_rule->target() == "REJECT" ||
+ m_rule->target() == "SNAT" || m_rule->target() == "DNAT" ||
+ m_rule->target() == "MARK" || m_rule->target() == "TOS" ) {
+ int ans = KMessageBox::questionYesNo( this, i18n( "<qt>By changing the Target of the Rule all previous"
+ " defined <b>Target Options</b> will be deleted.<br>"
+ "Click <b>Continue</b> to change the Target.<br>"
+ "Click <b>Cancel</b> keep your current Target. </qt>" ), i18n( "Warning" ), KStdGuiItem::cont(), KStdGuiItem::cancel(), "change_target_option_warning" );
+ kdDebug() << "KMessageBox:: Returned" << ans << endl;
+ switch ( ans ) {
+
+ case 3:
+ kdDebug() << "Clicked Continue" << endl;
+ if ( m_rule->target() != tg ) {
+ KMFUndoEngine::instance()->startTransaction(
+ m_rule,
+ i18n( "Change Rule: %1 target from: %2 to: %3" ).arg( m_rule->name() ).arg( m_rule->target() ).arg( tg )
+ );
+ m_rule->setTarget( tg );
+ emit sigUpdateView( m_rule->chain()->table() );
+ KMFUndoEngine::instance()->endTransaction();
+ }
+ break;
+ case 2:
+ kdDebug() << "Canceled Target Change" << endl;
+ slotEditRule();
+ slotEditTargetOption();
+ return ;
+ break;
+ }
+ } else {
+ if ( m_rule->target() != tg ) {
+ KMFUndoEngine::instance()->startTransaction(
+ m_rule,
+ i18n( "Change Rule: %1 target from: %2 to: %3" ).arg( m_rule->name() ).arg( m_rule->target() ).arg( tg )
+ );
+ m_rule->setTarget( tg );
+ emit sigUpdateView( m_rule->chain()->table() );
+ KMFUndoEngine::instance()->endTransaction();
+ }
+ }
+ slotEditTargetOption();
+ }
+}
+
+void KMFRuleEdit::addRuleOption(QString* name, QPtrList< QString >* values){
+ slotAddRuleOption( name, values );
+}
+
+void KMFRuleEdit::slotAddRuleOption( QString * name, QPtrList<QString>* values ) {
+ kdDebug() << "KMFRuleEdit::slotAddRuleOption(QString* name, QPtrList<QString>* values)" << endl;
+ m_rule->addRuleOption( *name, *values );
+ emit sigUpdateView( m_rule );
+}
+
+void KMFRuleEdit::addRuleTargetOption(QString* name, QPtrList< QString >* values ){
+ slotAddTargetOption( name, values );
+}
+
+void KMFRuleEdit::slotAddTargetOption( QString * name, QPtrList<QString>* values ) {
+ kdDebug() << "KMFRuleEdit::slotAddTargetOption(QString* name, QPtrList<QString>* values)" << endl;
+ m_rule->addTargetOption( *name, *values );
+ emit sigUpdateView( m_rule );
+}
+
+void KMFRuleEdit::slotRuleRBM( QListViewItem * item, const QPoint & point, int ) {
+ kdDebug() << "void KMFRuleEdit::RBM(QListViewItem* item, const QPoint & point, int)" << endl;
+ if ( ! item ) {
+ if ( m_table ) {
+ createRBM( m_table );
+ m_contextMenu->popup( point );
+ } else {
+ return ;
+ }
+ }
+ if ( KMFListViewItem * tmp_item = dynamic_cast<KMFListViewItem*>( item ) ) {
+ slotNewItemSelected( item );
+ if ( ( tmp_item->type() == NetfilterObject::RULE || tmp_item->type() == NetfilterObject::RULEOPTION )&& m_rule ) {
+ createRBM( m_rule );
+ m_contextMenu->popup( point );
+ } else if ( tmp_item->type() == NetfilterObject::CHAIN && m_chain ) {
+ createRBM( m_chain );
+ m_contextMenu->popup( point );
+ } else if ( tmp_item->type() == NetfilterObject::TABLE && m_table ) {
+ createRBM( m_table );
+ m_contextMenu->popup( point );
+ } else {
+ m_contextMenu->clear();
+ }
+ } else {
+ kdDebug() << "CAST ERROR: KMFRuleEdit::slotRuleRBM(...) " << endl;
+ }
+}
+
+
+void KMFRuleEdit::createRBM( NetfilterObject* obj ) {
+ kdDebug() << "void createRBM( IPTChain* ){" << endl;
+ if ( ! obj )
+ return;
+ switch( obj->type() ) {
+ case NetfilterObject::TABLE:
+ if ( IPTable* table = dynamic_cast<IPTable*> ( obj ) ) {
+ m_contextMenu->clear();
+ QString name = table->name();
+ QString lab_str = i18n("Table: %1").arg( name );
+
+ m_contextMenu->insertTitle( lab_str );
+ m_contextMenu->insertItem( icon_new, i18n( "Add Chain..." ), this, SLOT( slotAddChain() ) );
+ }
+ break;
+ case NetfilterObject::CHAIN:
+ if ( IPTChain* chain = dynamic_cast<IPTChain*> ( obj ) ) {
+ m_contextMenu->clear();
+ QString name = chain->name();
+ QString lab_str = i18n("Chain: %1").arg( name );
+
+ m_contextMenu->insertTitle( icon_chain, lab_str );
+ m_contextMenu->insertItem( icon_new, i18n( "Add Rule..." ), this, SLOT( slotAddRule() ) );
+ m_contextMenu->insertSeparator();
+ if ( ! chain->isBuildIn() )
+ m_contextMenu->insertItem( icon_edit, i18n( "Chain Documentation" ), this, SLOT( slotEditChainInfo() ) );
+ m_contextMenu->insertItem( icon_new, i18n( "Add Chain..." ), this, SLOT( slotAddChain() ) );
+ m_contextMenu->insertItem( icon_edit, i18n( "Edit Chain" ), this, SLOT( slotEditChain() ) );
+ if ( ! chain->isBuildIn() )
+ m_contextMenu->insertItem( icon_del, i18n( "Delete Chain" ), this, SLOT( slotDelChain() ) );
+ }
+ case NetfilterObject::RULE:
+ if ( IPTRule* rule = dynamic_cast<IPTRule*> ( obj ) ) {
+ m_contextMenu->clear();
+ QString name = rule->name();
+ QString lab_str = i18n("Rule: %1").arg( name );
+ m_contextMenu->insertTitle( icon_rule, lab_str );
+
+ KPopupMenu *sub_edit = new KPopupMenu( m_contextMenu );
+ sub_edit->insertTitle( i18n( "Edit Rule Option" ) );
+ for( uint i = 0; i < m_editPlugins.count(); i++ ) {
+ sub_edit->insertItem( icon_edit, i18n( "Edit %1" ).arg(m_editPlugins.at(i)->optionEditName() ), i );
+ }
+ connect( sub_edit,SIGNAL(activated( int ) ),
+ this,SLOT(slotNewOptionType( int ) ) );
+ m_contextMenu->insertItem( i18n( "Edit Rule Option" ), sub_edit );
+ // m_contextMenu->insertItem( icon_new, i18n( "Add Rule..." ), this, SLOT( slotAddRule() ) );
+ m_contextMenu->insertItem( icon_new, i18n( "Insert Rule..." ), this, SLOT( slotAddRule() ) );
+// m_contextMenu->insertSeparator();
+ m_contextMenu->insertItem( icon_del, i18n( "Delete Rule" ), this, SLOT( slotDelRule() ) );
+ m_contextMenu->insertSeparator();
+ m_contextMenu->insertItem( icon_rename, i18n( "Rename Rule" ), this, SLOT( slotRenameRule() ) );
+ m_contextMenu->insertItem( icon_edit, i18n( "Rule Documentation" ), this, SLOT( slotEditRuleInfo() ) );
+ m_contextMenu->insertItem( icon_up, i18n( "Move Up" ), this, SLOT( slotMoveRuleUp() ) );
+ m_contextMenu->insertItem( icon_down, i18n( "Move Down" ), this, SLOT( slotMoveRuleDown() ) );
+ m_contextMenu->insertSeparator();
+ m_contextMenu->insertItem( icon_edit, i18n( "Edit Chain" ), this, SLOT( slotEditChain() ) );
+ if ( ! rule->chain()->isBuildIn() )
+ m_contextMenu->insertItem( icon_del, i18n( "Delete Chain" ), this, SLOT( slotDelChain() ) );
+ m_contextMenu->insertSeparator();
+
+ KPopupMenu *sub_copy = new KPopupMenu( m_contextMenu );
+ connect( sub_copy, SIGNAL( activated( int ) ), this, SLOT( slotCopyRule( int ) ) );
+ sub_copy->insertTitle( i18n( "Copy to Chain" ) );
+ QPtrList<IPTChain> chains = m_table ->chains();
+ for ( uint i = 0; i < chains.count(); i++ ) {
+ QString tmp_name = chains.at( i ) ->name();
+ sub_copy->insertItem( tmp_name, i );
+ }
+ m_contextMenu->insertItem( icon_copy, i18n( "Copy Rule" ), sub_copy );
+
+ KPopupMenu *sub_move = new KPopupMenu( m_contextMenu );
+ connect( sub_move, SIGNAL( activated( int ) ), this, SLOT( slotMoveRule( int ) ) );
+ sub_move->insertTitle( i18n( "Move to Chain" ) );
+ QPtrList<IPTChain> chains2 = m_table->chains();
+ for ( uint i = 0; i < chains2.count(); i++ ) {
+ QString tmp_name = chains2.at( i ) ->name();
+ sub_move->insertItem( tmp_name, i );
+ }
+ m_contextMenu->insertItem( icon_move, i18n( "Move Rule" ), sub_move );
+ }
+ }
+}
+
+
+void KMFRuleEdit::slotMoveRule( int index ) {
+ kdDebug() << "void KMFRuleEdit::slotCopyRule( int )" << endl;
+ kdDebug() << "Move Rule to Chain Nr: " << index << endl;
+ IPTChain *chain_target = 0;
+ chain_target = m_network->currentDocAsIPTDoc()->table( m_table->name() ) ->chains().at( index );
+ if ( chain_target ) {
+ KMFUndoEngine::instance()->startTransaction(
+ m_rule->chain()->table(),
+ i18n( "Move Rule: %1 from Chain: %2 to Chain: %3" ).arg( m_rule->name() ).arg( m_rule->chain()->name() ).arg( chain_target->name() )
+ );
+ m_err = m_rule->chain()->table()->moveRuleToChain( m_rule, chain_target );
+ if ( m_err_handler->showError( m_err ) ) {
+ KMFUndoEngine::instance()->endTransaction();
+ emit sigUpdateView( chain_target->table() );
+ } else {
+ KMFUndoEngine::instance()->abortTransaction();
+ }
+ }
+}
+
+void KMFRuleEdit::slotCopyRule( int index ) {
+ kdDebug() << "void KMFRuleEdit::slotCopyRule( int )" << endl;
+ kdDebug() << "Move Rule to Chain Nr: " << index << endl;
+ IPTChain *chain_target = 0;
+ chain_target = m_network->currentDocAsIPTDoc()->table( m_table->name() ) ->chains().at( index );
+ if ( chain_target ) {
+ KMFUndoEngine::instance()->startTransaction(
+ m_rule->chain() ->table(),
+ i18n( "Copy Rule: %1 from Chain: %2 to Chain: %3" ).arg( m_rule->name() ).arg( m_rule->chain()->name() ).arg( chain_target->name() )
+ );
+ m_err = m_rule->chain() ->table() ->copyRuleToChain( m_rule, chain_target );
+ if ( m_err_handler->showError( m_err ) ) {
+ KMFUndoEngine::instance()->endTransaction();
+ emit sigUpdateView( chain_target->table() );
+ } else {
+ KMFUndoEngine::instance()->abortTransaction();
+ }
+ }
+}
+
+void KMFRuleEdit::slotRenameRule() {
+ if ( ! m_rule )
+ return;
+ if ( KMFListViewItem* rule_item = currTableView()->findKMFItem( m_rule->name(),2,m_rule->uuid() ) ) {
+
+ rule_item->startRename(2);
+ }
+}
+
+void KMFRuleEdit::slotRenameRule( QListViewItem* , int, const QString& name ) {
+ kdDebug() << "void KMFRuleEdit::slotRenameRule( QListViewItem* item, int, const QString& name )" << endl;
+ if ( name.isNull() || name.isEmpty() ) {
+ kdDebug() << "Rename rejected: Name was NULL or empty" << endl;
+ return;
+ }
+
+// if ( ! m_rule ) {
+// kdDebug() << "Rename rejected: m_rule == 0:" << endl;
+// return;
+// }
+
+ if ( KMFListViewItem* rule_item = currTableView()->findKMFItem( name ,2,m_rule->uuid() ) ) {
+ kdDebug() << "Found Rule Item: " << name << " ID " << m_rule->uuid() << endl;
+ QPtrList<IPTRule>& rules = rule_item->rule()->chain()->chainRuleset();
+ IPTRule *rule = 0;
+ for ( rule = rules.first(); rule; rule = rules.next() ) {
+ if ( rule->name() == name ) {
+ KMessageBox::sorry( this, i18n( "<qt><p>Sorry, there is already a rule named: <b>%1</b> in the chain.<br>"
+ "Please make sure that the new rule name is unique in its chain.</qt>" ).arg( name ) );
+ rule_item->setText( 2, rule_item->rule()->name() );
+ emit sigUpdateView( rule_item->rule()->chain() );
+ return ;
+ }
+ }
+ KMFUndoEngine::instance()->startTransaction(
+ rule_item->rule(),
+ i18n( "Rename Rule: %1 to %2").arg( rule_item->rule()->name() ).arg( name )
+ );
+
+ QString origName = rule_item->rule()->name();
+ m_err = rule_item->rule()->setRuleName( name );
+ if ( m_err_handler->showError( m_err ) ) {
+ KMFUndoEngine::instance()->endTransaction();
+ } else {
+ rule_item->setText( 2, origName );
+ KMFUndoEngine::instance()->abortTransaction();
+ }
+
+ emit sigUpdateView( rule_item->rule()->chain()->table() );
+ }
+}
+
+void KMFRuleEdit::slotUpdateView() {
+ kdDebug() << "void KMFRuleEdit::slotUpdateView()" << endl;
+ if ( ! m_network ) {
+ kdDebug() << "ERROR: m_network is null" << endl;
+ return;
+ }
+
+ kdDebug() << "upAndRunning(): " << KMFAppState::upAndRunning() << endl;
+ slotSelectionInvalid();
+
+ bool reload = true;
+ if ( ! m_lastDisplayDoc ) {
+ m_lastDisplayDoc = m_network->currentDocAsIPTDoc();
+ }
+ if ( m_lastDisplayDoc == m_network->currentDocAsIPTDoc() ) {
+ if ( ! m_network->newSavePathNeeded() ) {
+ kdDebug() << "IPTDoc still the same." << endl;
+ reload = false;
+ }
+ } else {
+ kdDebug() << "IPTDoc changed." << endl;
+ m_lastDisplayDoc = m_network->currentDocAsIPTDoc();
+ // reload = true;
+ }
+
+ IPTable *filter = 0;
+ filter = m_network->currentDocAsIPTDoc()->table( Constants::FilterTable_Name );
+ if ( filter ) {
+ if ( reload ) m_lv_table_filter->clearAllItems();
+ m_lv_table_filter->slotLoadNode( filter );
+ }
+
+ IPTable *nat = 0;
+ nat = m_network->currentDocAsIPTDoc()->table( Constants::NatTable_Name );
+ if ( nat ) {
+ if ( reload ) m_lv_table_nat->clearAllItems();
+ m_lv_table_nat->slotLoadNode( nat );
+ }
+
+ IPTable *mangle = 0;
+ mangle = m_network->currentDocAsIPTDoc()->table( Constants::MangleTable_Name );
+ if ( mangle ) {
+ if ( reload ) m_lv_table_mangle->clearAllItems();
+ m_lv_table_mangle->slotLoadNode( mangle );
+ }
+
+ rb_filter->setEnabled( m_network->currentDocAsIPTDoc()->useFilter() );
+ rb_mangle->setEnabled( m_network->currentDocAsIPTDoc()->useMangle() );
+ rb_nat->setEnabled( m_network->currentDocAsIPTDoc()->useNat() );
+
+
+ if ( m_network->currentDocAsIPTDoc()->useModules() ) {
+ m_led_modules->setColor( green );
+ m_led_modules->on();
+ } else {
+ m_led_modules->setColor( red );
+ m_led_modules->off();
+ }
+
+ if ( m_network->currentDocAsIPTDoc()->useIPFwd() ) {
+ m_led_fwd->setColor( green );
+ m_led_fwd->on();
+ } else {
+ m_led_fwd->setColor( red );
+ m_led_fwd->off();
+ }
+
+ if ( m_network->currentDocAsIPTDoc()->useSynCookies() ) {
+ m_led_syn->setColor( green );
+ m_led_syn->on();
+ } else {
+ m_led_syn->setColor( red );
+ m_led_syn->off();
+ }
+
+ if ( m_network->currentDocAsIPTDoc()->useRPFilter() ) {
+ m_led_rp->setColor( green );
+ m_led_rp->on();
+ } else {
+ m_led_rp->setColor( red );
+ m_led_rp->off();
+ }
+
+ if ( m_network->currentDocAsIPTDoc()->useMartians() ) {
+ m_led_martians->setColor( green );
+ m_led_martians->on();
+ } else {
+ m_led_martians->setColor( red );
+ m_led_martians->off();
+ }
+
+// setCurrTableView( currTableView() );
+
+ if ( ! rb_filter->isEnabled() && ! rb_nat->isEnabled() ) {
+ rb_mangle->setChecked( true );
+ setCurrTableView( m_lv_table_mangle );
+ } else if ( ! rb_filter->isEnabled() && ! rb_mangle->isEnabled() ) {
+ rb_nat->setChecked( true );
+ setCurrTableView( m_lv_table_nat );
+ } else if ( ! rb_nat->isEnabled() && ! rb_mangle->isEnabled() ) {
+ rb_filter->setChecked( true );
+ setCurrTableView( m_lv_table_filter );
+ }
+
+ emit sigUpdateView();
+ m_app->updateCaption();
+// slotEditRule();
+}
+
+/*
+ * Main event handler. Reimplemented to handle application
+ * font changes
+ */
+bool KMFRuleEdit::event( QEvent* ev ) {
+ bool ret = QWidget::event( ev );
+ if ( ev->type() == QEvent::ApplicationFontChange ) {}
+ return ret;
+}
+
+void KMFRuleEdit::slotHelp() {
+ kdDebug() << "void KMFRuleEdit::slotHelp()" << endl;
+ kapp->invokeHelp( "rules" );
+}
+void KMFRuleEdit::loadIcons() {
+ kdDebug() << "void KMFRuleEdit::loadIcons()" << endl;
+ KIconLoader *loader = KGlobal:: iconLoader();
+ QString icon_name;
+
+ icon_name = "up";
+ icon_up = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "down";
+ icon_down = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "editdelete";
+ icon_del = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "filenew";
+ icon_new = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "edit";
+ icon_edit = loader->loadIcon( icon_name, KIcon::Small );
+
+
+ icon_name = "filter";
+ icon_filter = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "text";
+ icon_rename = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "rule-22";
+ icon_rule = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "view_tree";
+ icon_chain = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "reject";
+ icon_reject = loader->loadIcon( icon_name, KIcon::User );
+
+ icon_name = "target";
+ icon_target = loader->loadIcon( icon_name, KIcon::User );
+
+ icon_name = "stop";
+ icon_drop = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "button_ok";
+ icon_accept = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "filesaveas";
+ icon_log = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "undo";
+ icon_return = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "editclear";
+ icon_cmd = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "filter";
+ icon_filter = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "pipe";
+ icon_queue = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "editcopy";
+ icon_copy = loader->loadIcon( icon_name, KIcon::Small );
+
+ icon_name = "forward";
+ icon_move = loader->loadIcon( icon_name, KIcon::Small );
+
+}
+
+}
+
+#include "kmfruleedit.moc"
diff --git a/kmyfirewall/ipteditor/kmfruleedit.h b/kmyfirewall/ipteditor/kmfruleedit.h
new file mode 100644
index 0000000..d524c0c
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfruleedit.h
@@ -0,0 +1,171 @@
+/***************************************************************************
+ begin : Thu Feb 7 2002
+ copyright : (C) 2002 by Christian Hubinger
+ email : chubinger@irrsinnig.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 KMFRULEEDIT_H
+#define KMFRULEEDIT_H
+#include "kmyfirewallruleeditor.h"
+
+// qt includes
+#include <qvariant.h>
+#include <qdialog.h>
+#include <qpixmap.h>
+#include <qstring.h>
+#include <qvaluelist.h>
+#include <qguardedptr.h>
+
+// kde includes
+#include <kconfig.h>
+#include <kiconloader.h>
+#include <kstandarddirs.h>
+
+// project includes
+#include "../core/kmfruleeditinterface.h"
+class QListViewItem;
+class KListViewItem;
+class QString;
+class KPopupMenu;
+
+namespace KMF {
+class KMFIPTDoc;
+class KMFNetwork;
+class KMFListView;
+class KMFListViewItem;
+class NetfilterObject;
+class IPTRule;
+class IPTChain;
+class IPTable;
+class KMFErrorHandler;
+class KMFError;
+class KMFCheckInput;
+class KMFChainEdit;
+class KMFNewChainDlg;
+class KMFObjectInfo;
+class KMFRuleOptionEditInterface;
+class KMFRuleTargetOptionEditInterface;
+class KMFMainWindow;
+class KMFMyNetworkWidget;
+
+class KMFRuleEdit : public KMyFirewallRuleEditor, public KMFRuleEditInterface {
+ Q_OBJECT
+
+public:
+ KMFRuleEdit( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~KMFRuleEdit();
+ IPTRule* currRule() const {
+ return m_rule;
+ };
+
+ void loadDoc( KMFNetwork* network );
+ void editChain( IPTChain* );
+ void addRuleOption(QString*, QPtrList< QString >* );
+ void addRuleTargetOption(QString*, QPtrList< QString >* );
+ void showOverview();
+ void setKMFMainWindow( KMFMainWindow* win );
+
+public slots:
+ void slotAddRule();
+ void slotEditRule();
+ void slotDelRule();
+ void slotAddChain();
+ void slotDelChain();
+ void slotEditChain();
+ void slotEditNetwork();
+ void slotLoadDocument( KMFNetwork* network );
+ void slotUpdateView();
+ void slotSelectionInvalid();
+
+protected:
+ bool event( QEvent* );
+
+private:
+ // members
+ void createRBM( NetfilterObject* );
+ void loadIcons();
+ void enableRuleEdit( bool on );
+ KMFListView* currTableView();
+ void setCurrTableView( KMFListView* );
+ void loadPlugins();
+ void registerRuleOptionPlugin( KMFRuleOptionEditInterface* );
+ void registerRuleTargetOptionPlugin( KMFRuleTargetOptionEditInterface* );
+
+ // data
+ KMFIPTDoc *m_lastDisplayDoc;
+
+ KMFMyNetworkWidget *m_myNetworkWidget;
+ KMFObjectInfo *m_object_info;
+ KMFChainEdit *m_editchain;
+ KMFNewChainDlg *m_new_chain;
+ KMFListView *m_lv_table_filter, *m_lv_table_nat, *m_lv_table_mangle;
+ QGuardedPtr<KMFNetwork> m_network;
+ QGuardedPtr<IPTRule> m_rule;
+ QGuardedPtr<IPTChain> m_chain;
+ QGuardedPtr<IPTable> m_table;
+
+
+ QPtrList<KMFRuleOptionEditInterface> m_editPlugins;
+ QPtrList<KMFRuleTargetOptionEditInterface> m_editTargetPlugins;
+
+ KMFError *m_err;
+ KMFErrorHandler *m_err_handler;
+ KMFCheckInput *m_check_input;
+ KMFMainWindow *m_app;
+ KPopupMenu *m_contextMenu;
+ QPixmap icon_up, icon_down, icon_del, icon_edit, icon_rule, icon_filter, icon_rename,
+ icon_chain, icon_log, icon_accept, icon_drop, icon_cmd, icon_reject, icon_return,
+ icon_target, icon_queue, icon_new, icon_copy, icon_move;
+
+
+private slots:
+ void slotNewItemSelected( QListViewItem* );
+
+
+ void slotRuleRBM( QListViewItem*, const QPoint &, int );
+ void slotRenameRule();
+ void slotRenameRule( QListViewItem*, int, const QString& );
+ void slotNewOptionType( int index );
+ void slotShowOverview();
+
+ void slotEditRuleInfo();
+ void slotEditChainInfo();
+ void slotEditTargetOption();
+
+
+ void slotFragChanged();
+ void slotLogRuleChanged();
+ void slotEnableRuleChanged();
+ void slotTargetChanged( const QString& );
+
+ void slotNewTableSelected();
+
+ void slotAddRuleOption( QString*, QPtrList<QString>* );
+ void slotAddTargetOption( QString*, QPtrList<QString>* );
+
+ void slotMoveRuleUp();
+ void slotMoveRuleDown();
+ void slotMoveRule( int );
+ void slotCopyRule( int );
+
+ void slotHelp();
+
+private:
+ void moveRuleInChain( int );
+
+ signals:
+ void sigFragToggled();
+ void sigUpdateView();
+ void sigUpdateView( NetfilterObject* );
+};
+}
+#endif // KMFRULEEDIT_H
diff --git a/kmyfirewall/ipteditor/kmfruleoption_frag_option.xml b/kmyfirewall/ipteditor/kmfruleoption_frag_option.xml
new file mode 100644
index 0000000..6e8906d
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmfruleoption_frag_option.xml
@@ -0,0 +1,7 @@
+<!DOCTYPE kmyfirewall-kmfruleoptiondefinition>
+<ruleoptiondefinitionset>
+ <ruleoptiondefinition name="frag_opt" guiName="Match Fragments" >
+ <option guiName="Match First Fragment" command=" -f" />
+ <option guiName="Match Other Fragments" command=" ! -f" />
+</ruleoptiondefinition>
+</ruleoptiondefinitionset>
diff --git a/kmyfirewall/ipteditor/kmyfirewallchaineditor.ui b/kmyfirewall/ipteditor/kmyfirewallchaineditor.ui
new file mode 100644
index 0000000..b79ddcf
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmyfirewallchaineditor.ui
@@ -0,0 +1,893 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>KMyFirewallChainEditor</class>
+<author>Christian Hubinger</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KMyFirewallChainEditor</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>500</width>
+ <height>572</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Chain Editor</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>GroupBox6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>GroupBoxPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>Chain Properties</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>Layout9</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>TextLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Working on chain:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>l_chain_name</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>CHAINNAME</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>in table:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>l_chain_table</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>filter</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1_5_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Chain rules:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="1" column="1">
+ <property name="name">
+ <cstring>lcd_rules</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="numDigits">
+ <number>2</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>Flat</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>TextLabel1_5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Chain feeds:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="1" column="3">
+ <property name="name">
+ <cstring>lcd_feeds</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="numDigits">
+ <number>2</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>Flat</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="4">
+ <property name="name">
+ <cstring>TextLabel1_4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Chain forwards:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="1" column="5">
+ <property name="name">
+ <cstring>lcd_fwds</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="numDigits">
+ <number>2</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>Flat</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>layout36</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kPushButton5</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>110</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>b_help</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <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>110</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>b_ok</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Apply</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QTabWidget" row="1" column="0">
+ <property name="name">
+ <cstring>m_tabWidget</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Policy</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>gb_target</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>Configure Default Policy</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cb_target</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="insertionPolicy">
+ <enum>NoInsertion</enum>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>c_has_default_target</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Define default policy</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Please set the default policy for your chain:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignLeft</set>
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>User defined chains do not have any "Default Policy" set because the packets return to the chain from which this chain is fed, right after the rule that fed the chain. If you want your user defined chains to act like built-in chains, enable the option "Define Default Policy" and set the policy to your needs.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignLeft</set>
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>The Default Policy decides what to do with Packets that do not match any of the rules defined for the Chain.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignLeft</set>
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Logging</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>gb_logging</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Logging</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignBottom|AlignTop|AlignLeft</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>c_enable_log</cstring>
+ </property>
+ <property name="text">
+ <string>Enable chain drop logging</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>l_logging_2</cstring>
+ </property>
+ <property name="text">
+ <string>Here you can decide whether you would like to log all packets that did not match any rule at the end of the chain.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop|AlignLeft</set>
+ </property>
+ <property name="vAlign" stdset="0">
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>c_log_prefix</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Use a log prefix:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>t_log_prefix</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxLength">
+ <number>29</number>
+ </property>
+ <property name="frame">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>c_log_burst</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Burst limit:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>c_log_limit</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Limit logging: </string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>sb_burst</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>5</number>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>sb_limit</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>60</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel8_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>/</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>second</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>minute</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>hour</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cb_interval</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>c_enable_log</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>c_log_limit</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>b_help</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallChainEditor</receiver>
+ <slot>slotHelp()</slot>
+ </connection>
+ <connection>
+ <sender>b_ok</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallChainEditor</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>kPushButton5</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallChainEditor</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>c_enable_log</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>c_log_burst</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>c_enable_log</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>c_log_prefix</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>c_log_limit</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>sb_limit</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>c_log_limit</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>cb_interval</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>c_log_burst</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>sb_burst</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>c_log_prefix</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>t_log_prefix</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>c_log_limit</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel8_2</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>c_enable_log</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>groupBox4</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>kPushButton5</tabstop>
+ <tabstop>b_help</tabstop>
+ <tabstop>b_ok</tabstop>
+ <tabstop>m_tabWidget</tabstop>
+ <tabstop>c_has_default_target</tabstop>
+ <tabstop>cb_target</tabstop>
+ <tabstop>c_enable_log</tabstop>
+ <tabstop>c_log_limit</tabstop>
+ <tabstop>c_log_burst</tabstop>
+ <tabstop>c_log_prefix</tabstop>
+ <tabstop>t_log_prefix</tabstop>
+ <tabstop>sb_burst</tabstop>
+ <tabstop>sb_limit</tabstop>
+ <tabstop>cb_interval</tabstop>
+</tabstops>
+<slots>
+ <slot>slotHelp()</slot>
+ <slot>accept()</slot>
+ <slot>reject()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kmyfirewall/ipteditor/kmyfirewallchaineditornewchain.ui b/kmyfirewall/ipteditor/kmyfirewallchaineditornewchain.ui
new file mode 100644
index 0000000..77e221b
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmyfirewallchaineditornewchain.ui
@@ -0,0 +1,263 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>KMyFirewallChainEditorNewChain</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KMyFirewallChainEditorNewChain</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>385</width>
+ <height>174</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New Chain</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Please define a unique (in the table) name and decide which table this chain should be added to.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout2</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="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox13</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Name</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLineEdit" row="0" column="0">
+ <property name="name">
+ <cstring>t_name</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxLength">
+ <number>33</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Table</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </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="QRadioButton">
+ <property name="name">
+ <cstring>c_filter</cstring>
+ </property>
+ <property name="text">
+ <string>filter</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>c_nat</cstring>
+ </property>
+ <property name="text">
+ <string>nat</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>c_mangle</cstring>
+ </property>
+ <property name="text">
+ <string>mangle</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>Layout28</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="QPushButton">
+ <property name="name">
+ <cstring>b_cancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</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>79</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>b_ok</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>b_cancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallChainEditorNewChain</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>b_ok</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallChainEditorNewChain</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>slotOk()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmyfirewall/ipteditor/kmyfirewallruleeditor.ui b/kmyfirewall/ipteditor/kmyfirewallruleeditor.ui
new file mode 100644
index 0000000..0049086
--- /dev/null
+++ b/kmyfirewall/ipteditor/kmyfirewallruleeditor.ui
@@ -0,0 +1,757 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>KMyFirewallRuleEditor</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KMyFirewallRuleEditor</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>483</width>
+ <height>447</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Rule Editor</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <widget class="QSplitter" row="0" column="0">
+ <property name="name">
+ <cstring>m_splitter</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>gb_options</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>l_editing_rule</cstring>
+ </property>
+ <property name="text">
+ <string>Editing Rule</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="1">
+ <property name="name">
+ <cstring>buttonGroup6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>rb_filter</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>filter</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>rb_nat</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>nat</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>rb_mangle</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>mangle</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Table:&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLed" row="1" column="1">
+ <property name="name">
+ <cstring>m_led_modules</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="look">
+ <enum>Sunken</enum>
+ </property>
+ <property name="darkFactor">
+ <number>600</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>textLabel1_2_3_2_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Log martians:</string>
+ </property>
+ </widget>
+ <widget class="KLed" row="1" column="3">
+ <property name="name">
+ <cstring>m_led_rp</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="look">
+ <enum>Sunken</enum>
+ </property>
+ <property name="darkFactor">
+ <number>600</number>
+ </property>
+ </widget>
+ <widget class="KLed" row="2" column="1">
+ <property name="name">
+ <cstring>m_led_fwd</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="look">
+ <enum>Sunken</enum>
+ </property>
+ <property name="darkFactor">
+ <number>600</number>
+ </property>
+ </widget>
+ <widget class="KLed" row="2" column="3">
+ <property name="name">
+ <cstring>m_led_martians</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="look">
+ <enum>Sunken</enum>
+ </property>
+ <property name="darkFactor">
+ <number>600</number>
+ </property>
+ </widget>
+ <widget class="KLed" row="0" column="3">
+ <property name="name">
+ <cstring>m_led_syn</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="look">
+ <enum>Sunken</enum>
+ </property>
+ <property name="darkFactor">
+ <number>600</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>textLabel1_2_3_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Syncookies:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>textLabel1_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>RP-Filter:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_2_8</cstring>
+ </property>
+ <property name="text">
+ <string>IP forwarding:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;FW options:&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Load modules:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="7" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout23</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>TextLabel8</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Fragments:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cb_frag</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Invert:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cb_frag_inv</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KComboBox" row="6" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kb_optSelect</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>cb_disable_rule</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>cb_log_rule</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Disable rule:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Log matching packets:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Move rule in chain:</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>b_move_up</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>b_move_down</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="8" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout21</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>TextLabel10</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Target:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>cb_target</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="autoResize">
+ <bool>true</bool>
+ </property>
+ <property name="insertionPolicy">
+ <enum>NoInsertion</enum>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QWidgetStack" row="9" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_ws_target_opt</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>page</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ </widget>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidgetStack">
+ <property name="name">
+ <cstring>m_widgetStack</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>cb_frag</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallRuleEditor</receiver>
+ <slot>slotFragChanged()</slot>
+ </connection>
+ <connection>
+ <sender>cb_frag_inv</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallRuleEditor</receiver>
+ <slot>slotFragChanged()</slot>
+ </connection>
+ <connection>
+ <sender>cb_target</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>KMyFirewallRuleEditor</receiver>
+ <slot>slotTargetChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>cb_frag</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>cb_frag_inv</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>rb_filter</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallRuleEditor</receiver>
+ <slot>slotNewTableSelected()</slot>
+ </connection>
+ <connection>
+ <sender>rb_nat</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallRuleEditor</receiver>
+ <slot>slotNewTableSelected()</slot>
+ </connection>
+ <connection>
+ <sender>rb_mangle</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallRuleEditor</receiver>
+ <slot>slotNewTableSelected()</slot>
+ </connection>
+ <connection>
+ <sender>b_move_down</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallRuleEditor</receiver>
+ <slot>slotMoveRuleDown()</slot>
+ </connection>
+ <connection>
+ <sender>b_move_up</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyFirewallRuleEditor</receiver>
+ <slot>slotMoveRuleUp()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>rb_filter</tabstop>
+ <tabstop>cb_disable_rule</tabstop>
+ <tabstop>cb_log_rule</tabstop>
+ <tabstop>kb_optSelect</tabstop>
+ <tabstop>cb_frag</tabstop>
+ <tabstop>cb_frag_inv</tabstop>
+ <tabstop>cb_target</tabstop>
+</tabstops>
+<slots>
+ <slot>slotAddRule()</slot>
+ <slot>slotDelRule()</slot>
+ <slot>slotEditIPopt()</slot>
+ <slot>slotEditIntOpt()</slot>
+ <slot>slotEditLimitOpt()</slot>
+ <slot>slotEditMacOpt()</slot>
+ <slot>slotEditProtOpt()</slot>
+ <slot>slotEditRule()</slot>
+ <slot>slotEditStateOpt()</slot>
+ <slot>slotEditTargetOpt()</slot>
+ <slot>slotEditTargetOption()</slot>
+ <slot>slotEditTosOpt()</slot>
+ <slot>slotFragChanged()</slot>
+ <slot>slotHelp()</slot>
+ <slot>slotMoveRuleDown()</slot>
+ <slot>slotMoveRuleUp()</slot>
+ <slot>slotNewChainSelected( int )</slot>
+ <slot>slotNewTableSelected()</slot>
+ <slot>slotSaveConfig()</slot>
+ <slot>slotSaveRuleChanges()</slot>
+ <slot>slotTargetChanged( const QString &amp; )</slot>
+ <slot>accept()</slot>
+ <slot>reject()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kled.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>