summaryrefslogtreecommitdiffstats
path: root/KMFSysTray
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 /KMFSysTray
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 'KMFSysTray')
-rw-r--r--KMFSysTray/Makefile.am22
-rw-r--r--KMFSysTray/README4
-rw-r--r--KMFSysTray/app.cpp63
-rw-r--r--KMFSysTray/app.h27
-rw-r--r--KMFSysTray/details.cpp109
-rw-r--r--KMFSysTray/details.h54
-rw-r--r--KMFSysTray/details_designer.ui484
-rw-r--r--KMFSysTray/kmfiptwatcher.cpp306
-rw-r--r--KMFSysTray/kmfiptwatcher.h73
-rw-r--r--KMFSysTray/kmfsystray.cpp166
-rw-r--r--KMFSysTray/kmfsystray.desktop36
-rw-r--r--KMFSysTray/kmfsystray.h80
-rw-r--r--KMFSysTray/main.cpp57
-rw-r--r--KMFSysTray/mainwidget.cpp74
-rw-r--r--KMFSysTray/mainwidget.h61
-rw-r--r--KMFSysTray/mainwidget_designer.ui88
16 files changed, 1704 insertions, 0 deletions
diff --git a/KMFSysTray/Makefile.am b/KMFSysTray/Makefile.am
new file mode 100644
index 0000000..a1fb991
--- /dev/null
+++ b/KMFSysTray/Makefile.am
@@ -0,0 +1,22 @@
+INCLUDES= -I$(srcdir)/../kmyfirewall/core -I$(srcdir)/../kmyfirewall/kmfwidgets -I$(srcdir)/../kmyfirewall/interfaces $(all_includes)
+METASOURCES = AUTO
+
+bin_PROGRAMS = kmfsystray
+
+
+
+
+
+kmfsystray_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+kmfsystray_LDADD = ../kmyfirewall/core/libkmfcore.la ../kmyfirewall/kmfwidgets/libkmfwidgets.la $(LIB_KDEUI) $(LIB_KPARTS)
+
+kmfsystray_DATA = kmfsystray.desktop
+kmfsystraydir = $(kde_datadir)/kicker/applets
+
+messages: rc.cpp
+ $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kmfsystray.pot
+
+
+kmfsystray_SOURCES = kmfsystray.cpp app.cpp mainwidget.cpp \
+ mainwidget_designer.ui details.cpp details_designer.ui kmfiptwatcher.cpp main.cpp
diff --git a/KMFSysTray/README b/KMFSysTray/README
new file mode 100644
index 0000000..8aadbd2
--- /dev/null
+++ b/KMFSysTray/README
@@ -0,0 +1,4 @@
+KMFSysTray
+----------
+
+Systray applet that show the running iptables configuration in KMF's iptables rule view. It communicates with the KMFIPTInterface to fetch the running iptables configuration.
diff --git a/KMFSysTray/app.cpp b/KMFSysTray/app.cpp
new file mode 100644
index 0000000..bacfda0
--- /dev/null
+++ b/KMFSysTray/app.cpp
@@ -0,0 +1,63 @@
+//
+// C++ Implementation: app
+//
+// Description:
+//
+//
+// Author: Christian Hubinger <[email protected]>, (C) 2005
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "app.h"
+
+// #include <qlcdnumber.h>
+// #include <qlayout.h>
+//
+// // KDE includes
+// #include <kglobal.h>
+// #include <klocale.h>
+// #include <kaboutdata.h>
+// #include <kconfig.h>
+// #include <kapplication.h>
+// #include <kmessagebox.h>
+// #include <kapplication.h>
+// #include <kmessagebox.h>
+// #include <dcopclient.h>
+// #include <kaboutapplication.h>
+
+
+/*
+#include "kmfsystray.h"
+#include "kmfiptwatcher.h"
+#include "mainwidget.h"
+*/
+
+MainApp::MainApp() : KApplication() {
+
+
+ // Get the current application configuration handle
+// KMessageBox::information( 0, i18n( "Starting Deamon" ) );
+
+// KConfig *ksConfig = config();
+// KMFIPTWatcher *watch = new KMFIPTWatcher( this, "KMFIPTWatcher" );
+// MainWidget *mainWid = new MainWidget( 0 );
+// connect( watch, SIGNAL( sigUpdateActive( bool ) ), mainWid, SLOT( slotSetRunningStatus( bool ) ) );
+// connect( watch, SIGNAL( sigUpdateRuleCount( const QString&, const QString&, int ) ),
+// mainWid, SIGNAL( sigUpdateRuleCount( const QString&, const QString&, int ) ) );
+
+// connect( mainWid, SIGNAL( sigQueryDetails( bool ) ), watch, SLOT( slotQueryDetails( bool ) ) );
+/*
+ QHBoxLayout *_layout = new QHBoxLayout(this);
+ _layout->add(mainWid);*/
+
+
+
+
+
+}
+
+
+MainApp::~MainApp() {}
+
+
diff --git a/KMFSysTray/app.h b/KMFSysTray/app.h
new file mode 100644
index 0000000..2056072
--- /dev/null
+++ b/KMFSysTray/app.h
@@ -0,0 +1,27 @@
+//
+// C++ Interface: app
+//
+// Description:
+//
+//
+// Author: Christian Hubinger <[email protected]>, (C) 2005
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef APP_H
+#define APP_H
+
+#include <kapplication.h>
+
+/**
+@author Christian Hubinger
+*/
+class MainApp : public KApplication {
+public:
+ MainApp();
+ ~MainApp();
+
+};
+
+#endif
diff --git a/KMFSysTray/details.cpp b/KMFSysTray/details.cpp
new file mode 100644
index 0000000..067d697
--- /dev/null
+++ b/KMFSysTray/details.cpp
@@ -0,0 +1,109 @@
+/***************************************************************************
+* Copyright (C) 2005 by Christian Hubinger *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+
+
+#include "details.h"
+
+// QT includes
+#include <qlcdnumber.h>
+
+// KDE includes
+#include <kdebug.h>
+#include <kpushbutton.h>
+
+Details::Details( QWidget* parent, const char* name, WFlags fl )
+ : DetailsDesigner( parent, name, fl ) {
+
+ QObject::connect( m_cmd_close, SIGNAL( clicked() ), this, SLOT ( close() ) );
+
+}
+
+Details::~Details() {}
+
+/*$SPECIALIZATION$*/
+
+void Details::close() {
+ kdDebug() << "void Details::close()" << endl;
+ emit closing();
+ QWidget::close();
+}
+
+void Details::show() {
+ kdDebug() << "void Details::show()" << endl;
+ emit showing();
+ QWidget::show();
+}
+
+void Details::hide() {
+ kdDebug() << "void Details::hide()" << endl;
+ emit closing();
+ QWidget::hide();
+}
+
+void Details::slotUpdateRuleCount( const QString& table, const QString& chain, int num ) {
+ kdDebug() << "slotUpdateRuleCount( const QString& " << table << ", const QString& " << chain << ", int " << num << " )" << endl;
+ QLCDNumber *lcd = 0;
+ if ( table == "filter" ) {
+ if ( chain == "INPUT" ) {
+ lcd = m_lcd_numRulesIn_Filter_Input;
+ }
+ if ( chain == "OUTPUT" ) {
+ lcd = m_lcd_numRulesIn_Filter_Output;
+ }
+ if ( chain == "FORWARD" ) {
+ lcd = m_lcd_numRulesIn_Filter_Forward;
+ }
+ } else if ( table == "nat" ) {
+ if ( chain == "OUTPUT" ) {
+ lcd = m_lcd_numRulesIn_Nat_Output;
+ }
+ if ( chain == "PREROUTING" ) {
+ lcd = m_lcd_numRulesIn_Nat_Prerouting;
+ }
+ if ( chain == "POSTROUTING" ) {
+ lcd = m_lcd_numRulesIn_Nat_Postrouting;
+ }
+ } else if ( table == "mangle" ) {
+ if ( chain == "INPUT" ) {
+ lcd = m_lcd_numRulesIn_Mangle_Input;
+ }
+ if ( chain == "OUTPUT" ) {
+ lcd = m_lcd_numRulesIn_Mangle_Output;
+ }
+ if ( chain == "FORWARD" ) {
+ lcd = m_lcd_numRulesIn_Mangle_Forward;
+ }
+ if ( chain == "PREROUTING" ) {
+ lcd = m_lcd_numRulesIn_Mangle_Prerouting;
+ }
+ if ( chain == "POSTROUTING" ) {
+ lcd = m_lcd_numRulesIn_Mangle_Postrouting;
+ }
+
+ }
+ if ( ! lcd ) {
+ kdDebug() << "ERROR unknown chain or table" << endl;
+ return;
+ }
+ lcd->display( num );
+}
+
+#include "details.moc"
+
diff --git a/KMFSysTray/details.h b/KMFSysTray/details.h
new file mode 100644
index 0000000..b468f09
--- /dev/null
+++ b/KMFSysTray/details.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+* Copyright (C) 2005 by Christian Hubinger *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+
+#ifndef DETAILS_H
+#define DETAILS_H
+
+#include "details_designer.h"
+
+class Details : public DetailsDesigner {
+ Q_OBJECT
+
+public:
+ Details( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~Details();
+ /*$PUBLIC_FUNCTIONS$*/
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ void close();
+ void show();
+ void hide();
+ void slotUpdateRuleCount( const QString&, const QString&, int );
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+
+
+signals:
+ void closing();
+ void showing();
+
+};
+
+#endif
+
diff --git a/KMFSysTray/details_designer.ui b/KMFSysTray/details_designer.ui
new file mode 100644
index 0000000..9a5b1f9
--- /dev/null
+++ b/KMFSysTray/details_designer.ui
@@ -0,0 +1,484 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>DetailsDesigner</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>DetailsDesigner</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>314</width>
+ <height>217</height>
+ </rect>
+ </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="KPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>m_cmd_close</cstring>
+ </property>
+ <property name="text">
+ <string>Close &amp;Window</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>m_cmd_help</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ </widget>
+ <widget class="QWidgetStack" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>widgetStack1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRules_Filter_Input</cstring>
+ </property>
+ <property name="text">
+ <string>INPUT:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="0" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Filter_Input</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRules_Filter_Output</cstring>
+ </property>
+ <property name="text">
+ <string>OUTPUT:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="1" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Filter_Output</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRules_Filter_Forward</cstring>
+ </property>
+ <property name="text">
+ <string>FORWARD:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="2" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Filter_Forward</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2_3_5_3</cstring>
+ </property>
+ <property name="text">
+ <string>POLICY:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2_3_5_2</cstring>
+ </property>
+ <property name="text">
+ <string>POLICY:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="3">
+ <property name="name">
+ <cstring>m_lbl_policy_filter_output</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;Policy&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="3">
+ <property name="name">
+ <cstring>m_lbl_policy_filter_forward</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;Policy&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2_3_5</cstring>
+ </property>
+ <property name="text">
+ <string>POLICY:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>m_lbl_policy_filter_input</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;Policy&gt;</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2</cstring>
+ </property>
+ <property name="text">
+ <string>OUTPUT:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>m_lbl_policy_nat_output</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;Policy&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="0" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Nat_Output</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2_3</cstring>
+ </property>
+ <property name="text">
+ <string>POLICY:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>POLICY:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="1" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Nat_Prerouting</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRulesInNat_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>PREROUTING:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="3">
+ <property name="name">
+ <cstring>m_lbl_policy_nat_prerouting</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;Policy&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="2" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Nat_Postrouting</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2_3_3</cstring>
+ </property>
+ <property name="text">
+ <string>POLICY:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="3">
+ <property name="name">
+ <cstring>m_lbl_policy_filter_nat_postrouting</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;Policy&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRulesInNat_2</cstring>
+ </property>
+ <property name="text">
+ <string>POSTROUTING:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>2</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLCDNumber" row="0" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Mangle_Input</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="1" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Mangle_Output</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="2" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Mangle_Forward</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRulesInMangle_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>FORWARD:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>OUTPUT:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRulesInfilter_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>INPUT:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRulesInNat_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>PREROUTING:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="4" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Mangle_Postrouting</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>m_lbl_numRulesInNat_2_3</cstring>
+ </property>
+ <property name="text">
+ <string>POSTROUTING:</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="3" column="1">
+ <property name="name">
+ <cstring>m_lcd_numRulesIn_Mangle_Prerouting</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lbl_table</cstring>
+ </property>
+ <property name="text">
+ <string>Table:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1" rowspan="1" colspan="2">
+ <item>
+ <property name="text">
+ <string>Filter</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Nat</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mangle</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>kComboBox1</cstring>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>kComboBox1</sender>
+ <signal>activated(int)</signal>
+ <receiver>widgetStack1</receiver>
+ <slot>raiseWidget(int)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kcombobox.h</includehint>
+</includehints>
+</UI>
diff --git a/KMFSysTray/kmfiptwatcher.cpp b/KMFSysTray/kmfiptwatcher.cpp
new file mode 100644
index 0000000..c2f8c1a
--- /dev/null
+++ b/KMFSysTray/kmfiptwatcher.cpp
@@ -0,0 +1,306 @@
+/***************************************************************************
+* Copyright (C) 2005 by Christian Hubinger *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+#include "kmfiptwatcher.h"
+
+
+// QT includes
+#include <qtimer.h>
+
+// KDE includes
+#include <kdebug.h>
+#include <klocale.h>
+#include <kapp.h>
+#include <kapplication.h>
+#include <kmessagebox.h>
+#include <kapplication.h>
+#include <kmessagebox.h>
+#include <dcopclient.h>
+
+// Project includes
+#include "../core/kmfiptdoc.h"
+#include "../core/kmferror.h"
+#include "../core/iptable.h"
+#include "../core/iptchain.h"
+#include "../core/iptrule.h"
+#include "../core/iptruleoption.h"
+
+KMFIPTWatcher::KMFIPTWatcher( QObject *parent, const char *name )
+ : QObject( parent, name ) {
+ m_queryExtendedInfo = true;
+ m_doc = new KMFIPTDoc( 0, "iptdoc" );
+ go();
+}
+
+
+KMFIPTWatcher::~KMFIPTWatcher() {}
+
+
+void KMFIPTWatcher::go() {
+ // KMessageBox::information( 0, i18n( "go()" ) );
+ m_timer = new QTimer();
+ QObject::connect( m_timer, SIGNAL( timeout() ), this, SLOT( timeout() ) );
+ m_timer->start( 3000, false );
+}
+
+void KMFIPTWatcher::timeout() {
+// kdDebug() << "timeout()" << endl;
+
+
+ DCOPClient *client = kapp->dcopClient();
+ QCString reply_type;
+ QByteArray params;
+ QDataStream stream( params, IO_WriteOnly );
+ QString arg = "filter";
+ stream << arg;
+ QByteArray reply_data;
+
+ if ( ! client->call( *( new QCString( "kmfiptinterface" ) ),
+ *( new QCString( "KMFIPTInterface" ) ),
+ *( new QCString( "numChainsInTable(QString)" ) ), params,
+ reply_type, reply_data, false, 10000 ) ) {
+
+ // KMessageBox::information( 0, i18n( "Error with DCOP: %1" ).arg( kapp->dcopClient() ->appId() ) );
+ emit sigUpdateActive( false );
+ } else {
+ QDataStream answer( reply_data, IO_ReadOnly );
+ if ( reply_type == "int" ) {
+ int result;
+ answer >> result;
+ // KMessageBox::information( 0, i18n( "Got answer %1" ).arg(result) );
+ emit sigUpdateActive( result > 0 );
+ } else
+ KMessageBox::information( 0, i18n( "Calling over DCOP succeeded, but the answer had wrong type!" ) );
+ }
+
+ if ( m_queryExtendedInfo ) {
+ queryExtendedInfo();
+ }
+}
+
+void KMFIPTWatcher::queryExtendedInfo() {
+ queryChainsInTable( "filter", m_doc );
+ queryChainsInTable( "nat", m_doc );
+ queryChainsInTable( "mangle", m_doc );
+ kdDebug() << "emit sigUpdateIPTDoc( m_doc )" << endl;
+ emit sigUpdateIPTDoc( m_doc );
+}
+
+void KMFIPTWatcher::queryChainsInTable( const QString& table, KMFIPTDoc* iptdoc ) {
+ kdDebug() << "queryNumRulesInChain( const QString& table, const QString& chain )" << endl;
+ DCOPClient *client = kapp->dcopClient();
+ QCString reply_type;
+ QByteArray params;
+ QDataStream stream( params, IO_WriteOnly );
+ stream << table;
+ QByteArray reply_data;
+
+ if ( ! client->call( *( new QCString( "kmfiptinterface" ) ),
+ *( new QCString( "KMFIPTInterface" ) ),
+ *( new QCString( "getChainsInTable(QString)" ) ), params,
+ reply_type, reply_data, false, 10000 ) ) {
+ emit sigUpdateActive( false );
+ } else {
+ QDataStream answer( reply_data, IO_ReadOnly );
+ if ( reply_type == "QStringList" ) {
+ QStringList result;
+ answer >> result;
+ IPTable *tableObj = iptdoc->table( table );
+ kdDebug() << "Filling Table: " << tableObj->name() << endl;
+ QPtrList<IPTChain> *used = new QPtrList<IPTChain>;
+ for ( QStringList::Iterator it = result.begin(); it != result.end(); ++it ) {
+ kdDebug() << "Found Chain" << *it << endl;
+ IPTChain *chain = tableObj->chainForName( *it );
+ if ( ! chain ) {
+ QString tg = "ACCEPT";
+ tableObj->addChain( *it, tg, false, new KMFError() );
+ }
+ fetchChainPolicy( tableObj->chainForName( *it ) );
+ fetchRulesInChain( tableObj->chainForName( *it ) );
+ used->append( tableObj->chainForName( *it ) );
+ }
+
+ QPtrListIterator<IPTChain> it_chains( tableObj->chains() );
+ IPTChain* found_chain = 0;
+ while ( it_chains.current() ) {
+ found_chain = it_chains.current();
+ bool found = false;
+ for ( QStringList::Iterator it_all = result.begin(); it_all != result.end(); ++it_all ) {
+ if ( *it_all == found_chain->name() ) {
+ found = true;
+ }
+ }
+ kdDebug() << "Found chain: " << found_chain->name() << " " << found << endl;
+ if ( ! found ) {
+ tableObj->delChain( found_chain );
+ }
+ ++it_chains;
+ }
+
+
+ } else {
+ KMessageBox::information( 0, i18n( "Calling over DCOP succeeded, but the answer had wrong type!" ) );
+ }
+ }
+}
+
+void KMFIPTWatcher::fetchChainPolicy( IPTChain* chain ) {
+ DCOPClient *client = kapp->dcopClient();
+ QCString reply_type;
+ QByteArray params;
+ QDataStream stream( params, IO_WriteOnly );
+ stream << chain->table()->name() << chain->name();
+ QByteArray reply_data;
+
+ if ( ! client->call( *( new QCString( "kmfiptinterface" ) ),
+ *( new QCString( "KMFIPTInterface" ) ),
+ *( new QCString( "getChainPolicy(QString,QString)" ) ), params,
+ reply_type, reply_data, false, 10000 ) ) {
+ emit sigUpdateActive( false );
+ } else {
+ QDataStream answer( reply_data, IO_ReadOnly );
+ if ( reply_type == "QString" ) {
+ QString result;
+ answer >> result;
+ kdDebug() << "Found Chain Policy: " << chain->table()->name() << " " << chain->name() << " " << result << endl;
+ chain->setDefaultTarget( result );
+ }
+ }
+}
+
+void KMFIPTWatcher::fetchRulesInChain( IPTChain* chain ) {
+ kdDebug() << "fetchRulesInChain( const QString& table, const QString& chain )" << endl;
+ DCOPClient *client = kapp->dcopClient();
+ QCString reply_type;
+ QByteArray params;
+ QDataStream stream( params, IO_WriteOnly );
+ stream << chain->table()->name() << chain->name();
+ QByteArray reply_data;
+
+ if ( ! client->call( *( new QCString( "kmfiptinterface" ) ),
+ *( new QCString( "KMFIPTInterface" ) ),
+ *( new QCString( "numRulesInChain(QString,QString)" ) ), params,
+ reply_type, reply_data, false, 10000 ) ) {
+ emit sigUpdateActive( false );
+ } else {
+ QDataStream answer( reply_data, IO_ReadOnly );
+ if ( reply_type == "int" ) {
+ int result;
+ answer >> result;
+ QPtrList<IPTRule> *used = new QPtrList<IPTRule>;
+ for ( int i = 0; i < result; i++ ) {
+ QString rn = QString("rule_%1").arg( i );
+ IPTRule *rule = 0;
+ rule = chain->ruleForName( rn );
+ if ( ! rule ) {
+ rule = chain->addRule( rn , new KMFError() );
+ }
+ fetchRulesProperties( rule, i );
+ used->append( rule );
+ }
+
+ QPtrListIterator<IPTRule> it_rules( chain->chainRuleset() );
+ IPTRule* found_rule = 0;
+ while ( it_rules.current() ) {
+ found_rule = it_rules.current();
+ bool found = false;
+ for ( int i = 0; i < result; i++ ) {
+ QString rn = QString("rule_%1").arg( i );
+ if ( rn == found_rule->name() ) {
+ found = true;
+ }
+ }
+ if ( ! found ) {
+ chain->delRule( found_rule );
+ }
+ ++it_rules;
+ }
+ } else {
+ KMessageBox::information( 0, i18n( "Calling over DCOP succeeded, but the answer had wrong type!" ) );
+ }
+ }
+}
+
+void KMFIPTWatcher::fetchRulesProperties( IPTRule* rule, int index ) {
+ kdDebug() << "queryNumRulesInChain( const QString& table, const QString& chain )" << endl;
+ DCOPClient *client = kapp->dcopClient();
+ QCString reply_type;
+ QByteArray params;
+ QDataStream stream( params, IO_WriteOnly );
+ stream << rule->chain()->table()->name() << rule->chain()->name() << index;
+ QByteArray reply_data;
+
+ if ( ! client->call( *( new QCString( "kmfiptinterface" ) ),
+ *( new QCString( "KMFIPTInterface" ) ),
+ *( new QCString( "getRuleProperties(QString,QString,int)" ) ), params,
+ reply_type, reply_data, false, 10000 ) ) {
+ emit sigUpdateActive( false );
+ } else {
+ QDataStream answer( reply_data, IO_ReadOnly );
+ if ( reply_type == "QStringList" ) {
+ QStringList result;
+ answer >> result;
+ if ( *result.at( 0 ) == "ERROR" ) {
+ return;
+ }
+ rule->setTarget( *result.at( 0 ) );
+
+
+ } else {
+ KMessageBox::information( 0, i18n( "Calling over DCOP succeeded, but the answer had wrong type!" ) );
+ }
+ }
+
+}
+
+
+void KMFIPTWatcher::queryNumRulesInChain( const QString& table, const QString& chain, KMFIPTDoc* doc ) {
+ kdDebug() << "queryNumRulesInChain( const QString& table, const QString& chain )" << endl;
+ DCOPClient *client = kapp->dcopClient();
+ QCString reply_type;
+ QByteArray params;
+ QDataStream stream( params, IO_WriteOnly );
+ stream << table << chain;
+ QByteArray reply_data;
+
+ if ( ! client->call( *( new QCString( "kmfiptinterface" ) ),
+ *( new QCString( "KMFIPTInterface" ) ),
+ *( new QCString( "numRulesInChain(QString,QString)" ) ), params,
+ reply_type, reply_data, false, 10000 ) ) {
+ emit sigUpdateActive( false );
+ } else {
+ QDataStream answer( reply_data, IO_ReadOnly );
+ if ( reply_type == "int" ) {
+ int result;
+ answer >> result;
+
+ } else
+ KMessageBox::information( 0, i18n( "Calling over DCOP succeeded, but the answer had wrong type!" ) );
+ }
+}
+
+void KMFIPTWatcher::worked() {
+ KMessageBox::information( 0, i18n( "Callback Worked" ) );
+}
+
+void KMFIPTWatcher::slotQueryDetails( bool on ) {
+ kdDebug() << "slotQueryDetails( bool " << on << " )" << endl;
+ m_queryExtendedInfo = on;
+}
+#include "kmfiptwatcher.moc"
diff --git a/KMFSysTray/kmfiptwatcher.h b/KMFSysTray/kmfiptwatcher.h
new file mode 100644
index 0000000..c6c27f8
--- /dev/null
+++ b/KMFSysTray/kmfiptwatcher.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Christian Hubinger *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef KMFIPTWATCHER_H
+#define KMFIPTWATCHER_H
+
+#include <qobject.h>
+
+/**
+@author Christian Hubinger
+*/
+
+class QTimer;
+class KMFIPTDoc;
+class IPTChain;
+class IPTable;
+class IPTRule;
+class IPTRuleOption;
+
+class KMFIPTWatcher : public QObject
+{
+Q_OBJECT
+public:
+ KMFIPTWatcher(QObject *parent = 0, const char *name = 0);
+
+ ~KMFIPTWatcher();
+
+public slots:
+ void slotQueryDetails( bool );
+
+private slots:
+ void timeout();
+ void worked();
+
+
+private:
+ void go();
+ void queryExtendedInfo();
+ void queryNumRulesInChain( const QString& /*table*/, const QString& /*Chain*/, KMFIPTDoc* /* doc */ );
+ void queryChainsInTable( const QString& /*table*/, KMFIPTDoc* /* doc */ );
+
+ QTimer *m_timer;
+ bool m_queryExtendedInfo;
+
+ void fetchChainPolicy( IPTChain* );
+ void fetchRulesInChain( IPTChain* );
+ void fetchRulesProperties( IPTRule*, int );
+
+ KMFIPTDoc *m_doc;
+signals:
+ void sigUpdateIPTDoc( KMFIPTDoc* );
+ void sigUpdateActive( bool );
+ void sigUpdateRuleCount( const QString& /*table*/, const QString& /*Chain*/, int );
+
+};
+
+#endif
diff --git a/KMFSysTray/kmfsystray.cpp b/KMFSysTray/kmfsystray.cpp
new file mode 100644
index 0000000..bea6399
--- /dev/null
+++ b/KMFSysTray/kmfsystray.cpp
@@ -0,0 +1,166 @@
+/**************************************************************************
+* Copyright (C) 2005 by Christian Hubinger *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+
+
+// QT includes
+#include <qlcdnumber.h>
+#include <qlayout.h>
+
+// KDE includes
+#include <kglobal.h>
+#include <klocale.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+#include <kapplication.h>
+#include <kmessagebox.h>
+#include <dcopclient.h>
+#include <kdebug.h>
+#include <kpopupmenu.h>
+#include <kiconloader.h>
+#include <kprocess.h>
+
+// Project includes
+#include "kmfsystray.h"
+#include "kmfiptwatcher.h"
+#include "mainwidget.h"
+
+#include "../core/kmfiptdoc.h"
+#include "../core/kmfappstate.h"
+
+KMFSysTray::KMFSysTray( QWidget* w ) : KSystemTray ( w ) , DCOPObject( "KMFSysTray" ) {
+ mainView = w;
+ ksConfig = kapp->config();
+ KMFIPTWatcher *watch = new KMFIPTWatcher( this, "KMFIPTWatcher" );
+
+ baseIcon = KSystemTray::loadIcon( "kmyfirewall" );
+ setPixmap( baseIcon );
+
+ // Connect the watch deamon
+ connect( watch, SIGNAL( sigUpdateActive( bool ) ), this, SLOT( slotSetRunningStatus( bool ) ) );
+ connect( watch, SIGNAL( sigUpdateRuleCount( const QString&, const QString&, int ) ),
+ this, SIGNAL( sigUpdateRuleCount( const QString&, const QString&, int ) ) );
+
+ connect( watch, SIGNAL( sigUpdateIPTDoc( KMFIPTDoc* ) ),
+ this, SIGNAL( sigUpdateIPTDoc( KMFIPTDoc* ) ) );
+
+ connect( this, SIGNAL( sigQueryDetails( bool ) ), watch, SLOT( slotQueryDetails( bool ) ) );
+
+ // Connect view
+ connect( w, SIGNAL( closing() ), this, SLOT ( slotDetailsClosed() ) );
+ connect( w, SIGNAL( showing() ), this, SLOT ( slotQueryDetails() ) );
+ connect( this, SIGNAL( sigUpdateIPTDoc( KMFIPTDoc* ) ), w, SLOT( slotLoadDoc( KMFIPTDoc* ) ) );
+
+
+ initMenu();
+
+ show();
+ emit sigQueryDetails( false );
+ KMFAppState::setUpAndRunning( true );
+ KMFAppState::setHasOpenDoc( true );
+}
+
+
+KMFSysTray::~KMFSysTray() {}
+
+void KMFSysTray::initMenu() {
+ KPopupMenu* menu = contextMenu ();
+ menu->insertItem( KGlobal::iconLoader()->loadIcon( "kmyfirewall", KIcon::Small ), i18n( "Launch KMyFirewall..."), this, SLOT( slotLaunchKMF() ), CTRL+Key_K );
+
+}
+
+void KMFSysTray::slotSetRunningStatus( bool on ) {
+ if ( on ) {
+ baseIcon = KSystemTray::loadIcon( "kmyfirewall" );
+ } else {
+ baseIcon = KSystemTray::loadIcon( "kmyfirewall" );
+ }
+ setPixmap( baseIcon );
+}
+
+
+
+void KMFSysTray::slotLaunchKMF () {
+ KProcess *childproc = new KProcess();
+ *childproc << "kdesu";
+ *childproc << "kmyfirewall";
+ childproc->start( KProcess:: DontCare, KProcess::NoCommunication );
+}
+
+void KMFSysTray::slotShowDetails() {
+ kdDebug() << "MFSysTray::slotshowDetails()" << endl;
+ slotQueryDetails();
+ mainView->show();
+
+}
+
+void KMFSysTray::slotQueryDetails() {
+ emit sigQueryDetails( true );
+}
+
+void KMFSysTray::slotDetailsClosed() {
+ kdDebug() << "KMFSysTray::slotDetailsClosed()" << endl;
+ emit sigQueryDetails( false );
+}
+
+void KMFSysTray::about() {
+/* if(!_aboutData) {
+ _aboutData = new KAboutData("KMFSysTray", I18N_NOOP("KMFSysTray"),
+ "1.0", I18N_NOOP("KMyFirewall Pannel Applet.\n\n"
+ "Some basic inform<tion about your running iptables rules"),
+ KAboutData::License_GPL_V2, "(c) 2005, Christian Hubinger");
+ _aboutData->addAuthor("Christian Hubinger", 0, "[email protected]");
+
+ }
+ KAboutApplication dialog(_aboutData);
+ dialog.show();*/
+}
+
+
+void KMFSysTray::help() {
+ KMessageBox::information( 0, i18n( "This is a help box" ) );
+}
+
+
+void KMFSysTray::preferences() {
+ KMessageBox::information( 0, i18n( "This is a preferences box" ) );
+}
+
+int KMFSysTray::widthForHeight( int ) const {
+ return width();
+}
+
+int KMFSysTray::heightForWidth( int ) const {
+ return height();
+}
+
+void KMFSysTray::resizeEvent( QResizeEvent *e ) {}
+
+
+// extern "C" {
+// KPanelApplet * init( QWidget * parent, const QString & configFile ) {
+// KGlobal::locale() ->insertCatalogue( "kmfsystray" );
+// return new KMFSysTray( configFile, KPanelApplet::Normal,
+// KPanelApplet::About | KPanelApplet::Help | KPanelApplet::Preferences,
+// parent, "kmfsystray" );
+// }
+// }
+
+
diff --git a/KMFSysTray/kmfsystray.desktop b/KMFSysTray/kmfsystray.desktop
new file mode 100644
index 0000000..6c6d0b7
--- /dev/null
+++ b/KMFSysTray/kmfsystray.desktop
@@ -0,0 +1,36 @@
+[Desktop Entry]
+Encoding=UTF-8
+Comment=A panel applet called $NAME$
+Comment[bg]=Аплет с име $NAME$
+Comment[br]=Un arloadig panell a vez graet $NAME$
+Comment[ca]=Un applet del plafó anomenat $NAME$
+Comment[cs]=Applet panelu $NAME$
+Comment[cy]=Rhaglennig panel o'r enw $NAME$
+Comment[da]=En applet for panelet som hedder $NAME$
+Comment[de]=Eine Bedienfläche mit dem Namen $NAME$
+Comment[el]=Μία μικροεφαρμογή πίνακα με όνομα $NAME$
+Comment[es]=Una miniaplicación para el panel llamada $NAME$
+Comment[et]=Paneeliaplett $NAME$
+Comment[fr]=Une applet appelée $NAME$
+Comment[ga]=Feidhmchláirín painéil darbh ainm $NAME$
+Comment[gl]=Unha applet do painel chamada $NAME$
+Comment[it]=Un applet per il pannello chiamato $NAME$
+Comment[ka]=პანელის აპლეტი სახელად $NAME$
+Comment[lt]=Pulto įskiepis, vadinamas $NAME$
+Comment[nl]=Een paneelapplet genaamd $NAME$
+Comment[pt]=Um 'applet' para o painel chamado $NAME$
+Comment[pt_BR]=Um mini-aplicativo para o painel chamado $NAME$
+Comment[sr]=Аплет за панел назван $NAME$
+Comment[sr@Latn]=Aplet za panel nazvan $NAME$
+Comment[sv]=Ett miniprogram för panelen som heter $NAME$
+Comment[tr]=$NAME$ isimli panel küçük uygulaması
+Comment[uk]=Аплет панелі $NAME$
+Comment[xx]=xxA panel applet called $NAME$xx
+Name=KMFSysTray
+Name[da]=KFTPGrabber
+Name[pt_BR]=Mini-aplicativo de painel
+Name[sv]=Min brandväggs systembricka
+Name[tr]=KMF Sistem Çekmecesi
+Name[xx]=xxKMFSysTrayxx
+X-KDE-Library=kmfsystray_panelapplet
+X-KDE-UniqueApplet = true
diff --git a/KMFSysTray/kmfsystray.h b/KMFSysTray/kmfsystray.h
new file mode 100644
index 0000000..9eb4b8a
--- /dev/null
+++ b/KMFSysTray/kmfsystray.h
@@ -0,0 +1,80 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Christian Hubinger *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+
+#ifndef KMFSYSTRAY_H
+#define KMFSYSTRAY_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// QT includes
+#include <qstring.h>
+#include <qpixmap.h>
+
+// KDE Includes
+#include <kpanelapplet.h>
+#include <ksystemtray.h>
+#include <kconfig.h>
+#include <dcopobject.h>
+
+class KAboutData;
+class KMFIPTDoc;
+
+class KMFSysTray : public KSystemTray, public DCOPObject
+{
+ Q_OBJECT
+
+public:
+ KMFSysTray( QWidget * );
+ virtual ~KMFSysTray();
+ virtual int widthForHeight(int height) const;
+ virtual int heightForWidth(int width) const;
+ virtual void about();
+ virtual void help();
+ virtual void preferences();
+
+public slots:
+ void slotSetRunningStatus( bool on );
+ void slotLaunchKMF();
+ void slotShowDetails();
+ void slotQueryDetails();
+ void slotDetailsClosed();
+
+protected:
+ void resizeEvent(QResizeEvent *);
+
+private: // Methods
+ void initMenu();
+
+private:
+ KAboutData *_aboutData;
+ KConfig *ksConfig;
+ QWidget *mainView;
+ QPixmap baseIcon;
+
+signals:
+ void sigUpdateIPTDoc( KMFIPTDoc* );
+ void sigQueryDetails( bool );
+ void sigUpdateRuleCount( const QString&, const QString&, int );
+};
+
+#endif
diff --git a/KMFSysTray/main.cpp b/KMFSysTray/main.cpp
new file mode 100644
index 0000000..fe24ce8
--- /dev/null
+++ b/KMFSysTray/main.cpp
@@ -0,0 +1,57 @@
+//
+// C++ Implementation: main
+//
+// Description:
+//
+//
+// Author: Christian Hubinger <[email protected]>, (C) 2005
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include <qwidget.h>
+
+#include <kapplication.h>
+#include <kaboutapplication.h>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <klocale.h>
+#include <kconfig.h>
+#include <kdebug.h>
+
+
+#include "../kmyfirewall/version.h"
+#include "../kmyfirewall/kmfwidgets/kmfiptdocview.h"
+
+
+#include "kmfsystray.h"
+#include "kmfiptwatcher.h"
+#include "details.h"
+
+
+static const char description[] = I18N_NOOP( "KMFSysTray - IPTables monitor" );
+
+
+static KCmdLineOptions options[] = {
+ { "+[URL]", I18N_NOOP( "Files/URLs to Open." ), 0 },
+ { "--test ", I18N_NOOP("A short option which takes an argument."), 0 },
+ { 0, 0, 0}
+};
+
+int main( int argc, char *argv[] ) {
+ KAboutData aboutData( "kmfsystray", I18N_NOOP( "KMFSysTray" ),
+ KMYFIREWALL_VERSION, description, KAboutData::License_GPL,
+ COPYRIGHT_STRING, 0, 0, "[email protected]" );
+ aboutData.addAuthor( "Christian Hubinger", 0, "[email protected]" );
+ aboutData.setHomepage( "http://kmyfirewall.sourceforge.net" );
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
+
+ KApplication a;
+ // Details *mainWid = new Details( 0 );
+
+ KMFIPTDocView *mainWid = new KMFIPTDocView( 0 );
+ KMFSysTray *st = new KMFSysTray( mainWid );
+ return a.exec();
+}
diff --git a/KMFSysTray/mainwidget.cpp b/KMFSysTray/mainwidget.cpp
new file mode 100644
index 0000000..5eeded9
--- /dev/null
+++ b/KMFSysTray/mainwidget.cpp
@@ -0,0 +1,74 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Christian Hubinger *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+
+#include "mainwidget.h"
+
+// QT includes
+#include <qcolor.h>
+#include <qpushbutton.h>
+#include <qwidget.h>
+
+// KDE includes
+#include <kled.h>
+#include <kpushbutton.h>
+
+// Project Includes
+#include "details.h"
+
+MainWidget::MainWidget(QWidget* parent, const char* name, WFlags fl)
+: MainWidgetDesigner(parent,name,fl)
+{
+ m_ledActive->off();
+ m_cmd_info->setEnabled( false );
+ m_wid_details = new Details( 0 );
+ connect( m_wid_details, SIGNAL( closing() ), this, SLOT ( slotDetailsClosed() ) );
+ connect( this, SIGNAL( sigUpdateRuleCount( const QString&, const QString&, int ) ),
+ m_wid_details, SLOT( slotUpdateRuleCount( const QString&, const QString&, int ) ) );
+ connect( m_cmd_info, SIGNAL( clicked() ), this, SLOT( slotShowDetails() ) ) ;
+}
+
+MainWidget::~MainWidget()
+{
+}
+
+void MainWidget::slotSetRunningStatus( bool on ) {
+ m_ledActive->on();
+ m_cmd_info->setEnabled( on );
+ if ( on ) {
+ m_ledActive -> setColor( QColor(0, 255, 0) );
+ } else {
+ m_ledActive -> setColor( QColor(255, 0, 0) );
+ }
+}
+
+
+void MainWidget::slotDetailsClosed() {
+ emit sigQueryDetails( false );
+}
+
+void MainWidget::slotShowDetails() {
+ emit sigQueryDetails( true );
+ m_wid_details->show();
+ m_wid_details->raise();
+}
+
+#include "mainwidget.moc"
+
diff --git a/KMFSysTray/mainwidget.h b/KMFSysTray/mainwidget.h
new file mode 100644
index 0000000..aeae571
--- /dev/null
+++ b/KMFSysTray/mainwidget.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Christian Hubinger *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef MAINWIDGET_H
+#define MAINWIDGET_H
+
+#include "mainwidget_designer.h"
+
+class Details;
+
+
+class MainWidget : public MainWidgetDesigner
+{
+ Q_OBJECT
+
+public:
+ MainWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~MainWidget();
+ /*$PUBLIC_FUNCTIONS$*/
+
+public slots:
+ void slotSetRunningStatus( bool );
+ void slotDetailsClosed();
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+
+private slots:
+ void slotShowDetails();
+
+private:
+ Details *m_wid_details;
+
+
+signals:
+ void sigQueryDetails( bool );
+ void sigUpdateRuleCount( const QString&, const QString&, int );
+};
+
+#endif
+
diff --git a/KMFSysTray/mainwidget_designer.ui b/KMFSysTray/mainwidget_designer.ui
new file mode 100644
index 0000000..abdb834
--- /dev/null
+++ b/KMFSysTray/mainwidget_designer.ui
@@ -0,0 +1,88 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>MainWidgetDesigner</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>MainWidgetDesigner</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>124</width>
+ <height>34</height>
+ </rect>
+ </property>
+ <property name="backgroundOrigin">
+ <enum>ParentOrigin</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>m_ledActive</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="state">
+ <enum>On</enum>
+ </property>
+ <property name="shape">
+ <enum>Circular</enum>
+ </property>
+ <property name="look">
+ <enum>Flat</enum>
+ </property>
+ <property name="darkFactor">
+ <number>300</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_cmd_info</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Info</string>
+ </property>
+ </widget>
+ </hbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kled.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>