[PC-BSD Commits] r2615 - in pcbsd/trunk/kcmPFManager: . config
svn at pcbsd.org
svn at pcbsd.org
Tue Aug 19 14:42:24 PDT 2008
Author: kris
Date: 2008-08-19 14:42:24 -0700 (Tue, 19 Aug 2008)
New Revision: 2615
Modified:
pcbsd/trunk/kcmPFManager/adddlg.ui
pcbsd/trunk/kcmPFManager/config/packetfilter.cpp
pcbsd/trunk/kcmPFManager/config/rcconfig.cpp
pcbsd/trunk/kcmPFManager/config/services.cpp
pcbsd/trunk/kcmPFManager/kcm.cpp
pcbsd/trunk/kcmPFManager/pfaddlg.cpp
pcbsd/trunk/kcmPFManager/pfaddlg.hpp
pcbsd/trunk/kcmPFManager/pfmanagerdlg.cpp
pcbsd/trunk/kcmPFManager/pfmanagerdlg.hpp
Log:
Fixed the Firewall manager, now it doesn't crash and seems to work as it did
on QT3 before.
Modified: pcbsd/trunk/kcmPFManager/adddlg.ui
===================================================================
--- pcbsd/trunk/kcmPFManager/adddlg.ui 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/adddlg.ui 2008-08-19 21:42:24 UTC (rev 2615)
@@ -96,7 +96,7 @@
<widget class="QLineEdit" name="txPort" />
</item>
<item row="0" column="1" colspan="2" >
- <widget class="QComboBox" name="cbServices" >
+ <widget class="Q3ComboBox" name="cbServices" >
<property name="editable" >
<bool>true</bool>
</property>
@@ -106,13 +106,13 @@
</widget>
</item>
<item row="4" column="2" >
- <widget class="QComboBox" name="cbDirection" />
+ <widget class="Q3ComboBox" name="cbDirection" />
</item>
<item row="5" column="2" >
- <widget class="QComboBox" name="cbProtocol" />
+ <widget class="Q3ComboBox" name="cbProtocol" />
</item>
<item rowspan="2" row="6" column="2" >
- <widget class="QComboBox" name="cbInterfaces" />
+ <widget class="Q3ComboBox" name="cbInterfaces" />
</item>
<item row="4" column="0" colspan="2" >
<widget class="QLabel" name="txDirection" >
Modified: pcbsd/trunk/kcmPFManager/config/packetfilter.cpp
===================================================================
--- pcbsd/trunk/kcmPFManager/config/packetfilter.cpp 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/config/packetfilter.cpp 2008-08-19 21:42:24 UTC (rev 2615)
@@ -9,6 +9,8 @@
#include <qtextstream.h>
#include <Q3Process>
#include <Q3UrlOperator>
+#include <qmessagebox.h>
+#include <Q3TextStream>
#include <iostream>
@@ -107,6 +109,7 @@
void PacketFilter::init ( void )
{
+
RcConfig *config = RcConfig::fromDefault();
// Retrieve rules file
@@ -130,9 +133,9 @@
_lines.clear();
_rules.clear();
- if ( file.open(IO_ReadOnly) )
+ if ( file.open(QIODevice::ReadOnly) )
{
- QTextStream stream(&file);
+ Q3TextStream stream(&file);
QString line;
while ( !file.atEnd() )
@@ -155,7 +158,7 @@
if ( file.open(IO_WriteOnly) )
{
- QTextStream stream(&file);
+ Q3TextStream stream(&file);
for ( size_t i = 0; i < _lines.size(); ++i )
{ // Write the non parse files first
Modified: pcbsd/trunk/kcmPFManager/config/rcconfig.cpp
===================================================================
--- pcbsd/trunk/kcmPFManager/config/rcconfig.cpp 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/config/rcconfig.cpp 2008-08-19 21:42:24 UTC (rev 2615)
@@ -4,6 +4,7 @@
#include <qtextstream.h>
#include <iostream>
#include <QRegExp>
+#include <Q3TextStream>
RcConfig::RcConfig ( void )
: _modified(false)
@@ -26,7 +27,7 @@
if ( file.open(IO_ReadOnly) )
{ // It went good
- QTextStream stream(&file);
+ Q3TextStream stream(&file);
QString line;
while ( !stream.atEnd() )
@@ -92,7 +93,7 @@
{ // We only save if the _modified flag is true
if ( file.open(IO_WriteOnly) )
{
- QTextStream stream(&file);
+ Q3TextStream stream(&file);
for ( qstr_vector_cit it = _lines.begin();
it != _lines.end();
Modified: pcbsd/trunk/kcmPFManager/config/services.cpp
===================================================================
--- pcbsd/trunk/kcmPFManager/config/services.cpp 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/config/services.cpp 2008-08-19 21:42:24 UTC (rev 2615)
@@ -4,12 +4,14 @@
#include <qtextstream.h>
#include <qstringlist.h>
#include <qregexp.h>
+#include <Q3TextStream>
const QString services::_service_file = "/etc/services";
services *services::_instance = 0;
services::services ( void )
{
+ load();
}
services::~services ( void )
@@ -25,7 +27,7 @@
if ( serv.open(IO_ReadOnly) )
{
- QTextStream stream(&serv);
+ Q3TextStream stream(&serv);
QString line;
while ( !stream.atEnd() )
Modified: pcbsd/trunk/kcmPFManager/kcm.cpp
===================================================================
--- pcbsd/trunk/kcmPFManager/kcm.cpp 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/kcm.cpp 2008-08-19 21:42:24 UTC (rev 2615)
@@ -32,7 +32,7 @@
if ( isRoot() )
{ // Show our dialog
_dlg = new PFManagerDlg();
-
+ _dlg->load();
_dlg->reparent(this, QPoint());
load();
}
Modified: pcbsd/trunk/kcmPFManager/pfaddlg.cpp
===================================================================
--- pcbsd/trunk/kcmPFManager/pfaddlg.cpp 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/pfaddlg.cpp 2008-08-19 21:42:24 UTC (rev 2615)
@@ -6,11 +6,13 @@
#include <qradiobutton.h>
#include <qlineedit.h>
#include <qpushbutton.h>
+#include <QMessageBox>
#include <Q3ListBox>
-PFAddDlg::PFAddDlg ( QWidget *parent, rule *rules )
- : AddDlg()
+void PFAddDlg::init(void)
{
+ rule *rules = 0;
+
// Well: The incoming thing must always be the first item
// Otherwise it won't work
cbDirection->insertItem(tr("incoming"));
Modified: pcbsd/trunk/kcmPFManager/pfaddlg.hpp
===================================================================
--- pcbsd/trunk/kcmPFManager/pfaddlg.hpp 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/pfaddlg.hpp 2008-08-19 21:42:24 UTC (rev 2615)
@@ -9,7 +9,6 @@
#include <qobject.h>
class PFAddDlg : public QDialog, private Ui::AddDlg
-
{
Q_OBJECT
@@ -21,7 +20,11 @@
public:
- PFAddDlg ( QWidget *parent = 0, rule *rules = 0);
+ PFAddDlg() : QDialog()
+ {
+ setupUi(this);
+ }
+
~PFAddDlg ( void );
inline rule *rules ( void ) const
@@ -40,6 +43,7 @@
void serviceClicked ( const QString& index );
void okClicked ( void );
void cancelClicked ( void );
+ void init(void );
};
#endif
Modified: pcbsd/trunk/kcmPFManager/pfmanagerdlg.cpp
===================================================================
--- pcbsd/trunk/kcmPFManager/pfmanagerdlg.cpp 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/pfmanagerdlg.cpp 2008-08-19 21:42:24 UTC (rev 2615)
@@ -85,11 +85,12 @@
void PFManagerDlg::addClicked ( void )
{
- PFAddDlg dlg(this);
+ PFAddDlg *dlg = new PFAddDlg();
+ dlg->init();
- if ( dlg.exec() == QDialog::Accepted )
+ if ( dlg->exec() == QDialog::Accepted )
{
- _firewall.add_rule(*dlg.rules());
+ _firewall.add_rule(* dlg->rules());
// Save content
_firewall.save();
// Refresh the list
@@ -104,7 +105,8 @@
cur = lvExceptions->currentItem();
if (cur != 0)
{
- PFAddDlg dlg(this);
+ PFAddDlg *dlg = new PFAddDlg();
+ dlg->init();
size_t tag = 0;
rule *rule = 0;
@@ -114,8 +116,8 @@
tag = reinterpret_cast<TaggedListViewItem*>(cur)->tag();
rule = &_firewall.rules()[tag];
// Show
- dlg.rules(rule);
- if ( dlg.exec() == QDialog::Accepted )
+ dlg->rules(rule);
+ if ( dlg->exec() == QDialog::Accepted )
{ // Refresh the list
_firewall.save();
refreshList();
Modified: pcbsd/trunk/kcmPFManager/pfmanagerdlg.hpp
===================================================================
--- pcbsd/trunk/kcmPFManager/pfmanagerdlg.hpp 2008-08-19 20:27:31 UTC (rev 2614)
+++ pcbsd/trunk/kcmPFManager/pfmanagerdlg.hpp 2008-08-19 21:42:24 UTC (rev 2615)
@@ -11,8 +11,6 @@
{
Q_OBJECT
- PacketFilter _firewall;
-
public:
PFManagerDlg () : QDialog()
@@ -48,6 +46,9 @@
}
+ // Create the _firewall object
+ PacketFilter _firewall;
+
~PFManagerDlg ( void );
public slots:
More information about the Commits
mailing list