[PC-BSD Commits] r7263 - in pcbsd/current: . src-qt4 src-qt4/pc-pfmanager src-qt4/pc-pfmanager/config
svn at pcbsd.org
svn at pcbsd.org
Fri Jul 23 10:08:31 PDT 2010
Author: kris
Date: 2010-07-23 10:08:31 -0700 (Fri, 23 Jul 2010)
New Revision: 7263
Added:
pcbsd/current/src-qt4/pc-pfmanager/
pcbsd/current/src-qt4/pc-pfmanager/pc-pfmanager.pro
Removed:
pcbsd/current/kcmPFManager/
pcbsd/current/src-qt4/pc-pfmanager/kcm.cpp
pcbsd/current/src-qt4/pc-pfmanager/kcm.hpp
pcbsd/current/src-qt4/pc-pfmanager/kcm_pfmanager.la
pcbsd/current/src-qt4/pc-pfmanager/moc_kcm.cpp
pcbsd/current/src-qt4/pc-pfmanager/moc_pfmanagerdlg.cpp
pcbsd/current/src-qt4/pc-pfmanager/notroot.cpp
pcbsd/current/src-qt4/pc-pfmanager/notroot.h
pcbsd/current/src-qt4/pc-pfmanager/notroot.ui
pcbsd/current/src-qt4/pc-pfmanager/pfmanager.pro
Modified:
pcbsd/current/src-qt4/pc-pfmanager/adddlg.ui
pcbsd/current/src-qt4/pc-pfmanager/config/interfaces.cpp
pcbsd/current/src-qt4/pc-pfmanager/config/packetfilter.cpp
pcbsd/current/src-qt4/pc-pfmanager/config/rcconfig.cpp
pcbsd/current/src-qt4/pc-pfmanager/config/services.cpp
pcbsd/current/src-qt4/pc-pfmanager/main.cpp
pcbsd/current/src-qt4/pc-pfmanager/mainwindow.ui
pcbsd/current/src-qt4/pc-pfmanager/pfaddlg.cpp
pcbsd/current/src-qt4/pc-pfmanager/pfmanager.desktop
pcbsd/current/src-qt4/pc-pfmanager/pfmanagerdlg.cpp
pcbsd/current/src-qt4/pc-pfmanager/taggedlistviewitem.hpp
pcbsd/current/src-qt4/src-qt4.pro
Log:
Updated kcmPFManager to 100% QT4 based, no kcmModule anymore, moved it to src-qt4/pc-pfmanager
Modified: pcbsd/current/src-qt4/pc-pfmanager/adddlg.ui
===================================================================
--- pcbsd/current/kcmPFManager/adddlg.ui 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/adddlg.ui 2010-07-23 17:08:31 UTC (rev 7263)
@@ -1,155 +1,142 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>AddDlg</class>
- <widget class="QDialog" name="AddDlg" >
- <property name="geometry" >
+ <widget class="QDialog" name="AddDlg">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>246</width>
- <height>312</height>
+ <width>232</width>
+ <height>291</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Add a port</string>
</property>
- <property name="modal" >
+ <property name="modal">
<bool>true</bool>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" colspan="3" >
- <widget class="Q3ButtonGroup" name="bgInfo" >
- <property name="title" >
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="3">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
<string>Add</string>
</property>
- <property name="frameShape" >
- <enum>Q3GroupBox::GroupBoxPanel</enum>
- </property>
- <property name="frameShadow" >
- <enum>Q3GroupBox::Sunken</enum>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="lbService" >
- <property name="text" >
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lbService">
+ <property name="text">
<string>Service:</string>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="lbPolicy" >
- <property name="text" >
- <string>Policy:</string>
+ <item row="2" column="0">
+ <widget class="QLabel" name="lbPort">
+ <property name="text">
+ <string>Port:</string>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
- <item rowspan="2" row="5" column="0" >
- <widget class="QLabel" name="txProtocol" >
- <property name="text" >
- <string>Protocol:</string>
+ <item row="2" column="1" colspan="2">
+ <widget class="QLineEdit" name="txPort"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="lbPolicy">
+ <property name="text">
+ <string>Policy:</string>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="3" column="1" colspan="2" >
- <widget class="QRadioButton" name="rbBlock" >
- <property name="text" >
- <string>Block</string>
+ <item row="3" column="1" colspan="2">
+ <widget class="QRadioButton" name="rbAllow">
+ <property name="text">
+ <string>Allow</string>
</property>
</widget>
</item>
- <item row="2" column="1" colspan="2" >
- <widget class="QRadioButton" name="rbAllow" >
- <property name="text" >
- <string>Allow</string>
+ <item row="4" column="1" colspan="2">
+ <widget class="QRadioButton" name="rbBlock">
+ <property name="text">
+ <string>Block</string>
</property>
</widget>
</item>
- <item row="7" column="0" >
- <widget class="QLabel" name="lbInterface" >
- <property name="text" >
- <string>Interface:</string>
+ <item row="5" column="0">
+ <widget class="QLabel" name="txDirection">
+ <property name="text">
+ <string>Direction:</string>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="lbPort" >
- <property name="text" >
- <string>Port:</string>
+ <item row="7" column="0" rowspan="3">
+ <widget class="QLabel" name="txProtocol">
+ <property name="text">
+ <string>Protocol:</string>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2" >
- <widget class="QLineEdit" name="txPort" />
- </item>
- <item row="0" column="1" colspan="2" >
- <widget class="Q3ComboBox" name="cbServices" >
- <property name="editable" >
- <bool>true</bool>
+ <item row="10" column="0">
+ <widget class="QLabel" name="lbInterface">
+ <property name="text">
+ <string>Interface:</string>
</property>
- <property name="autoCompletion" >
- <bool>true</bool>
+ <property name="wordWrap">
+ <bool>false</bool>
</property>
</widget>
</item>
- <item row="4" column="2" >
- <widget class="Q3ComboBox" name="cbDirection" />
+ <item row="4" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
</item>
- <item row="5" column="2" >
- <widget class="Q3ComboBox" name="cbProtocol" />
+ <item row="0" column="1" colspan="2">
+ <widget class="QComboBox" name="cbServices"/>
</item>
- <item rowspan="2" row="6" column="2" >
- <widget class="Q3ComboBox" name="cbInterfaces" />
+ <item row="5" column="1" colspan="2">
+ <widget class="QComboBox" name="cbDirection"/>
</item>
- <item row="4" column="0" colspan="2" >
- <widget class="QLabel" name="txDirection" >
- <property name="text" >
- <string>Direction:</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
+ <item row="8" column="1" colspan="2">
+ <widget class="QComboBox" name="cbProtocol"/>
</item>
+ <item row="10" column="1" colspan="2">
+ <widget class="QComboBox" name="cbInterfaces"/>
+ </item>
</layout>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="pbOkay" >
- <property name="text" >
- <string>Ok</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QPushButton" name="pbCancel" >
- <property name="text" >
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <spacer name="spacer1" >
- <property name="orientation" >
+ <item row="1" column="0">
+ <spacer name="spacer1">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType" >
+ <property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>61</width>
<height>21</height>
@@ -157,25 +144,24 @@
</property>
</spacer>
</item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="pbOkay">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QPushButton" name="pbCancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
- <layoutdefault spacing="6" margin="11" />
- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
- <customwidget>
- <class>Q3ButtonGroup</class>
- <extends>Q3GroupBox</extends>
- <header>Qt3Support/Q3ButtonGroup</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
+ <layoutdefault spacing="6" margin="11"/>
<tabstops>
- <tabstop>cbServices</tabstop>
- <tabstop>txPort</tabstop>
- <tabstop>rbAllow</tabstop>
- <tabstop>rbBlock</tabstop>
- <tabstop>cbDirection</tabstop>
- <tabstop>cbProtocol</tabstop>
<tabstop>pbOkay</tabstop>
<tabstop>pbCancel</tabstop>
</tabstops>
Modified: pcbsd/current/src-qt4/pc-pfmanager/config/interfaces.cpp
===================================================================
--- pcbsd/current/kcmPFManager/config/interfaces.cpp 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/config/interfaces.cpp 2010-07-23 17:08:31 UTC (rev 7263)
@@ -36,7 +36,7 @@
}
ifs.setMinimal(true);
// Parse input
- while ( (pos = ifs.search(content, pos)) >= 0 )
+ while ( (pos = ifs.indexIn(content, pos)) >= 0 )
{
QStringList lst = ifs.capturedTexts();
QString device;
Modified: pcbsd/current/src-qt4/pc-pfmanager/config/packetfilter.cpp
===================================================================
--- pcbsd/current/kcmPFManager/config/packetfilter.cpp 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/config/packetfilter.cpp 2010-07-23 17:08:31 UTC (rev 7263)
@@ -7,10 +7,11 @@
#include <qregexp.h>
#include <qstringlist.h>
#include <qtextstream.h>
-#include <Q3Process>
-#include <Q3UrlOperator>
+#include <QProcess>
+#include <QUrl>
#include <qmessagebox.h>
-#include <Q3TextStream>
+#include <QTextStream>
+#include <QDebug>
#include <iostream>
@@ -37,7 +38,8 @@
// Needed for non gready matches
regex.setMinimal(true);
- search = regex.search(line);
+ regex.setPatternSyntax(QRegExp::RegExp2);
+ search = regex.indexIn(line);
if ( search != -1 )
{
QStringList capt = regex.capturedTexts();
@@ -135,13 +137,11 @@
if ( file.open(QIODevice::ReadOnly) )
{
- Q3TextStream stream(&file);
QString line;
while ( !file.atEnd() )
{
- line = stream.readLine();
-
+ line = file.readLine();
// Now check line if it tells us any
// nice information about the rules
if ( !parseLine(line) )
@@ -156,9 +156,9 @@
{
QFile file(_rulefile);
- if ( file.open(IO_WriteOnly) )
+ if ( file.open(QIODevice::WriteOnly) )
{
- Q3TextStream stream(&file);
+ QTextStream stream(&file);
for ( size_t i = 0; i < _lines.size(); ++i )
{ // Write the non parse files first
@@ -178,28 +178,33 @@
void PacketFilter::start ( void )
{
- Q3Process proc;
+ QProcess proc;
- proc.addArgument("pfctl");
- proc.addArgument("-e");
- proc.start();
+ QStringList args;
+ QString prog = "pfctl";
+ args << "-e";
+ proc.start(prog, args);
+ proc.waitForFinished();
+
// Refresh the config file
- proc.clearArguments();
- proc.addArgument("pfctl");
- proc.addArgument("-f");
- proc.addArgument(_rulefile);
- proc.start();
+ args.clear();
+ args << "-f";
+ args << _rulefile;
+ proc.start(prog, args);
+ proc.waitForFinished();
}
void PacketFilter::stop ( void )
{
- Q3Process proc;
+ QProcess proc;
+ QStringList args;
+ QString prog = "pfctl";
// Disable the pf firewall
- proc.addArgument("pfctl");
- proc.addArgument("-d");
- proc.start();
+ args << "-d";
+ proc.start(prog, args);
+ proc.waitForFinished();
}
void PacketFilter::restart ( void )
@@ -217,38 +222,37 @@
void PacketFilter::backup ( void )
{
- Q3UrlOperator *op = new Q3UrlOperator;
- QString file = "file:///" + _rulefile;
- QString backup = "file:///" + _rulefile + "~";
-
- op->copy(file, backup);
+ QString file = _rulefile;
+ QString backup = _rulefile + "~";
+ QFile oldFile(file);
+ oldFile.copy(backup);
}
void PacketFilter::restore ( void )
{
- Q3UrlOperator *op = new Q3UrlOperator;
- QString file = "file:/" + _rulefile;
- QString backup = "file:/" + _rulefile + "~";
-
- op->copy(backup, file);
+ QString file = _rulefile;
+ QString backup = _rulefile + "~";
+ QFile oldFile(backup);
+ oldFile.copy(file);
}
bool PacketFilter::isRunning(void)
{
- Q3Process proc;
+ QProcess proc;
+ QStringList args;
+ QString prog = "pfctl";
// Query pf
- proc.addArgument("pfctl");
- proc.addArgument("-s");
- proc.addArgument("info");
- proc.start();
+ args << "-s";
+ args << "info";
+ proc.start(prog, args);
- while (proc.isRunning() || proc.canReadLineStdout())
+ if (proc.waitForFinished() || proc.canReadLine())
{
- if (proc.canReadLineStdout())
+ if (proc.canReadLine())
{
- QString line = proc.readLineStdout();
- if (line.contains("Enabled") > 0) { return true; }
+ QString line = proc.readLine();
+ if (line.indexOf("Enabled") != -1) { return true; }
}
}
Modified: pcbsd/current/src-qt4/pc-pfmanager/config/rcconfig.cpp
===================================================================
--- pcbsd/current/kcmPFManager/config/rcconfig.cpp 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/config/rcconfig.cpp 2010-07-23 17:08:31 UTC (rev 7263)
@@ -4,7 +4,7 @@
#include <qtextstream.h>
#include <iostream>
#include <QRegExp>
-#include <Q3TextStream>
+#include <QTextStream>
RcConfig::RcConfig ( void )
: _modified(false)
@@ -25,14 +25,13 @@
RcConfig* inst = new RcConfig;
QFile file(filename);
- if ( file.open(IO_ReadOnly) )
+ if ( file.open(QIODevice::ReadOnly) )
{ // It went good
- Q3TextStream stream(&file);
QString line;
- while ( !stream.atEnd() )
+ while ( !file.atEnd() )
{
- line = stream.readLine();
+ line = file.readLine();
// Push back the lines of the file
inst->_lines.push_back(line);
}
@@ -91,9 +90,9 @@
//
if ( _modified )
{ // We only save if the _modified flag is true
- if ( file.open(IO_WriteOnly) )
+ if ( file.open(QIODevice::WriteOnly) )
{
- Q3TextStream stream(&file);
+ QTextStream stream(&file);
for ( qstr_vector_cit it = _lines.begin();
it != _lines.end();
@@ -118,7 +117,10 @@
{ // We have found one... let's see if it's enabled
QString line = (*found);
- enabled = (line.contains("\"yes\"", false));
+ if (line.indexOf("\"yes\"") == -1 && line.indexOf("\"YES\"") == -1 )
+ enabled = false;
+ else
+ enabled = true;
}
return enabled;
}
@@ -134,7 +136,7 @@
if ( found != _lines.end() )
{ // Let's replace the old
QString line = *found;
- if ( !line.contains("\"" + enable + "\"", false) )
+ if ( line.indexOf("\"" + enable + "\"") != -1 )
{ // but only if it does not have the current state
_lines.erase(found);
_lines.insert(found, senable);
@@ -203,7 +205,7 @@
QString line = *it;
int pos = 0;
// Fetch the value
- pos = regex.search(line);
+ pos = regex.indexIn(line);
if ( pos > -1 )
{ // Retrieve capture
retvalue = regex.cap(1);
Modified: pcbsd/current/src-qt4/pc-pfmanager/config/services.cpp
===================================================================
--- pcbsd/current/kcmPFManager/config/services.cpp 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/config/services.cpp 2010-07-23 17:08:31 UTC (rev 7263)
@@ -4,7 +4,7 @@
#include <qtextstream.h>
#include <qstringlist.h>
#include <qregexp.h>
-#include <Q3TextStream>
+#include <QTextStream>
const QString services::_service_file = "/etc/services";
services *services::_instance = 0;
@@ -25,20 +25,19 @@
QStringList lst;
QFile serv(_service_file);
- if ( serv.open(IO_ReadOnly) )
+ if ( serv.open(QIODevice::ReadOnly) )
{
- Q3TextStream stream(&serv);
QString line;
- while ( !stream.atEnd() )
+ while ( !serv.atEnd() )
{
- line = stream.readLine();
+ line = serv.readLine();
if ( line[0] != '#' )
{ // Try to leave out comments, should boost this thing
// a little bit
_file += line + '\n';
- pos = items.search(line);
+ pos = items.indexIn(line);
if ( pos >= 0 )
{ // Find all items
lst = items.capturedTexts();
@@ -64,7 +63,7 @@
sregex = QString("\\s+([a-zA-Z0-9\\-_\\.\\/]+)\\s+\\b%1\\b").arg(port);
regex.setPattern(sregex);
- find = regex.search(_file);
+ find = regex.indexIn(_file);
if ( find != -1 )
{
found = regex.capturedTexts();
Modified: pcbsd/current/src-qt4/pc-pfmanager/main.cpp
===================================================================
--- pcbsd/current/kcmPFManager/main.cpp 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/main.cpp 2010-07-23 17:08:31 UTC (rev 7263)
@@ -1,22 +1,30 @@
#include <qapplication.h>
#include <qtranslator.h>
+#include <QLocale>
#include <qtextcodec.h>
+#include <QFile>
+#include <QDebug>
#include "pfmanagerdlg.hpp"
int main ( int argc, char **argv )
{
QApplication app(argc, argv);
- QTranslator trans(0);
- trans.load(QString("PFManager_") + QTextCodec::locale(), "/PCBSD/LANGS/");
- app.installTranslator(&trans);
-
+ QLocale mylocale;
+ QTranslator translator;
+ QString langCode = mylocale.name();
+ if ( ! QFile::exists("/usr/local/share/apps/pcbsd/i18n/PFManager_" + langCode + ".qm" ) )
+ langCode.truncate(langCode.indexOf("_"));
+ translator.load( QString("PFManager_") + langCode, "/usr/local/share/apps/pcbsd/i18n/" );
+ app.installTranslator( &translator );
+ qDebug() << "Locale:" << langCode;
+
PFManagerDlg wnd;
wnd.load();
- app.setMainWidget(&wnd);
+ //app.setMainWidget(&wnd);
wnd.show();
app.connect(&app, SIGNAL(lastWindowClosed()),
&app, SLOT(quit()));
Modified: pcbsd/current/src-qt4/pc-pfmanager/mainwindow.ui
===================================================================
--- pcbsd/current/kcmPFManager/mainwindow.ui 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/mainwindow.ui 2010-07-23 17:08:31 UTC (rev 7263)
@@ -1,7 +1,8 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>MainDialog</class>
- <widget class="QDialog" name="MainDialog" >
- <property name="geometry" >
+ <widget class="QDialog" name="MainDialog">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -9,50 +10,61 @@
<height>302</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Firewall Manager</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QTabWidget" name="tabWidget4" >
- <property name="currentIndex" >
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QTabWidget" name="tabWidget4">
+ <property name="currentIndex">
<number>0</number>
</property>
- <widget class="QWidget" name="tab" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>387</width>
- <height>255</height>
- </rect>
- </property>
- <attribute name="title" >
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
<string>General</string>
</attribute>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="Q3ButtonGroup" name="bgGeneral" >
- <property name="title" >
- <string>General settings</string>
+ <layout class="QGridLayout">
+ <item row="3" column="0">
+ <spacer name="spacer6">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QCheckBox" name="cbEnable" >
- <property name="text" >
- <string>Enable Firewall on startup</string>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>21</width>
+ <height>70</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Configuration</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="1">
+ <widget class="QPushButton" name="pbRestore">
+ <property name="text">
+ <string>Restore default configuration</string>
</property>
+ <attribute name="buttonGroup">
+ <string/>
+ </attribute>
</widget>
</item>
- <item row="0" column="1" >
- <spacer name="spacer8" >
- <property name="orientation" >
+ <item row="0" column="0">
+ <spacer name="spacer5_2">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType" >
+ <property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>201</width>
<height>21</height>
@@ -63,186 +75,126 @@
</layout>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="Q3ButtonGroup" name="bgFirewall" >
- <property name="title" >
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
<string>Firewall</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QPushButton" name="pbStart" >
- <property name="text" >
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="pbStart">
+ <property name="text">
<string>Start</string>
</property>
+ <attribute name="buttonGroup">
+ <string/>
+ </attribute>
</widget>
</item>
- <item row="0" column="3" >
- <spacer name="spacer7" >
- <property name="orientation" >
+ <item row="0" column="1">
+ <widget class="QPushButton" name="pbStop">
+ <property name="text">
+ <string>Stop</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string/>
+ </attribute>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="pbRestart">
+ <property name="text">
+ <string>Restart</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string/>
+ </attribute>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <spacer name="spacer7">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType" >
+ <property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
- <width>31</width>
+ <width>102</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
- <item row="0" column="2" >
- <widget class="QPushButton" name="pbRestart" >
- <property name="text" >
- <string>Restart</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="pbStop" >
- <property name="text" >
- <string>Stop</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
</item>
- <item row="3" column="0" >
- <spacer name="spacer6" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>General settings</string>
</property>
- <property name="sizeType" >
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>21</width>
- <height>70</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0" >
- <widget class="Q3ButtonGroup" name="bgConfiguration" >
- <property name="title" >
- <string>Configuration</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="1" >
- <spacer name="spacer5_2" >
- <property name="orientation" >
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="cbEnable">
+ <property name="text">
+ <string>Enable Firewall on startup</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string/>
+ </attribute>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <spacer name="spacer8">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType" >
+ <property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
- <width>201</width>
+ <width>156</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
- <item row="0" column="0" >
- <widget class="QPushButton" name="pbRestore" >
- <property name="text" >
- <string>Restore default configuration</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
</item>
</layout>
</widget>
- <widget class="QWidget" name="tab" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>387</width>
- <height>255</height>
- </rect>
- </property>
- <attribute name="title" >
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
<string>Exceptions</string>
</attribute>
- <layout class="QGridLayout" >
- <item row="1" column="0" >
- <widget class="QPushButton" name="pbAdd" >
- <property name="text" >
+ <layout class="QGridLayout">
+ <item row="2" column="0">
+ <widget class="QPushButton" name="pbAdd">
+ <property name="text">
<string>Add entry</string>
</property>
</widget>
</item>
- <item row="0" column="0" colspan="5" >
- <widget class="Q3ListView" name="lvExceptions" >
- <column>
- <property name="text" >
- <string>Service</string>
- </property>
- <property name="clickable" >
- <bool>true</bool>
- </property>
- <property name="resizable" >
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text" >
- <string>Port</string>
- </property>
- <property name="clickable" >
- <bool>true</bool>
- </property>
- <property name="resizable" >
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text" >
- <string>Policy</string>
- </property>
- <property name="clickable" >
- <bool>true</bool>
- </property>
- <property name="resizable" >
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text" >
- <string>Interface</string>
- </property>
- <property name="clickable" >
- <bool>true</bool>
- </property>
- <property name="resizable" >
- <bool>true</bool>
- </property>
- </column>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="pbEdit" >
- <property name="text" >
+ <item row="2" column="1">
+ <widget class="QPushButton" name="pbEdit">
+ <property name="text">
<string>Edit entry</string>
</property>
</widget>
</item>
- <item row="1" column="2" >
- <spacer name="spacer6_2" >
- <property name="orientation" >
+ <item row="2" column="2">
+ <spacer name="spacer6_2">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType" >
+ <property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>21</height>
@@ -250,22 +202,22 @@
</property>
</spacer>
</item>
- <item row="1" column="3" >
- <widget class="QPushButton" name="pbDelete" >
- <property name="text" >
+ <item row="2" column="3">
+ <widget class="QPushButton" name="pbDelete">
+ <property name="text">
<string>Delete entry</string>
</property>
</widget>
</item>
- <item row="1" column="4" >
- <spacer name="spacer5" >
- <property name="orientation" >
+ <item row="2" column="4">
+ <spacer name="spacer5">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType" >
+ <property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>100</width>
<height>21</height>
@@ -273,27 +225,70 @@
</property>
</spacer>
</item>
+ <item row="1" column="0" colspan="5">
+ <widget class="QTreeWidget" name="lvExceptions">
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <attribute name="headerCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerDefaultSectionSize">
+ <number>65</number>
+ </attribute>
+ <attribute name="headerHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerShowSortIndicator" stdset="0">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="headerCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerDefaultSectionSize">
+ <number>65</number>
+ </attribute>
+ <attribute name="headerShowSortIndicator" stdset="0">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Service</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Policy</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Interface</string>
+ </property>
+ </column>
+ </widget>
+ </item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
- <layoutdefault spacing="6" margin="11" />
- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
- <customwidget>
- <class>Q3ButtonGroup</class>
- <extends>Q3GroupBox</extends>
- <header>Qt3Support/Q3ButtonGroup</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>Q3ListView</class>
- <extends>Q3Frame</extends>
- <header>q3listview.h</header>
- </customwidget>
- </customwidgets>
+ <layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
Modified: pcbsd/current/src-qt4/pc-pfmanager/pfaddlg.cpp
===================================================================
--- pcbsd/current/kcmPFManager/pfaddlg.cpp 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/pfaddlg.cpp 2010-07-23 17:08:31 UTC (rev 7263)
@@ -6,8 +6,8 @@
#include <qradiobutton.h>
#include <qlineedit.h>
#include <qpushbutton.h>
+#include <QDebug>
#include <QMessageBox>
-#include <Q3ListBox>
void PFAddDlg::init(void)
{
@@ -15,12 +15,12 @@
// Well: The incoming thing must always be the first item
// Otherwise it won't work
- cbDirection->insertItem(tr("incoming"));
- cbDirection->insertItem(tr("outgoing"));
+ cbDirection->addItem(tr("incoming"));
+ cbDirection->addItem(tr("outgoing"));
// Protocols...
- cbProtocol->insertItem(tr("TCP"));
- cbProtocol->insertItem(tr("UDP"));
+ cbProtocol->addItem(tr("TCP"));
+ cbProtocol->addItem(tr("UDP"));
// Default check the Allow button
rbAllow->setChecked(true);
@@ -29,13 +29,13 @@
for ( services::items_cit it = services::getInstance()->items().begin();
it != services::getInstance()->items().end(); it++ )
{
- cbServices->insertItem(it->first);
+ cbServices->addItem(it->first);
}
// Add all interfaces
for ( interfaces::ifs_cit it = interfaces::getInstance()->ifs().begin();
it != interfaces::getInstance()->ifs().end(); it++ )
{
- cbInterfaces->insertItem(*it);
+ cbInterfaces->addItem(*it);
}
// Rule
@@ -68,10 +68,10 @@
}
else
{ // The 'edit' mode
- qDebug(_rule->to_string());
+ qDebug() << _rule->to_string();
int item = 0;
- cbServices->setCurrentText(_rule->name());
+ cbServices->setItemText(cbServices->currentIndex(), _rule->name());
txPort->setText(_rule->port());
// Check the policy
if ( _rule->policy().compare("block") == 0 )
@@ -84,17 +84,17 @@
rbBlock->setChecked(false);
rbAllow->setChecked(true);
}
- cbDirection->setCurrentItem((_rule->direction().compare("in") == 0) ? 0 : 1);
- cbProtocol->setCurrentItem((_rule->protocol().compare("tcp") == 0) ? 0 : 1);
+ cbDirection->setCurrentIndex((_rule->direction().compare("in") == 0) ? 0 : 1);
+ cbProtocol->setCurrentIndex((_rule->protocol().compare("tcp") == 0) ? 0 : 1);
// Find the item
// I haven't found any better solution than to iterate
// over it on my own. listBox()->findItem() method returns
// only a ListBoxItem object which is pretty useless here
for (; item < cbInterfaces->count(); ++item )
{
- if ( cbInterfaces->text(item).compare(_rule->device()) == 0 )
+ if ( cbInterfaces->itemText(item).compare(_rule->device()) == 0 )
{
- cbInterfaces->setCurrentItem(item);
+ cbInterfaces->setCurrentIndex(item);
break;
}
}
@@ -120,9 +120,9 @@
// Set the information
_rule->port(txPort->text());
_rule->name(cbServices->currentText());
- _rule->protocol(cbProtocol->currentText().lower());
+ _rule->protocol(cbProtocol->currentText().toLower());
_rule->policy( (rbBlock->isChecked() ? "block" : "pass") );
- _rule->direction( (cbDirection->currentItem() == 0) ? "in" : "out" );
+ _rule->direction( (cbDirection->currentIndex() == 0) ? "in" : "out" );
_rule->device( cbInterfaces->currentText() );
// Additional checking here
accept();
Modified: pcbsd/current/src-qt4/pc-pfmanager/pfmanager.desktop
===================================================================
--- pcbsd/current/kcmPFManager/pfmanager.desktop 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/pfmanager.desktop 2010-07-23 17:08:31 UTC (rev 7263)
@@ -1,15 +1,9 @@
[Desktop Entry]
Encoding=UTF-8
-Exec=kcmshell4 pfmanager
+Exec=kdesu pfmanager
Icon=preferences-system-network-sharing
-Type=Service
-ServiceTypes=KCModule
+Type=Application
-X-KDE-Library=kcm_pfmanager
-X-KDE-ParentApp=kcontrol
-X-KDE-System-Settings-Parent-Category=network-and-connectivity
-
-
Name=Firewall
Name[bn]=ফায়ারওয়াল
Name[es]=Cortafuegos
@@ -24,4 +18,6 @@
Name[pt_BR]=Firewall
Name[zh_CN]=防火墙
-Categories=Qt;KDE;System;
+X-KDE-RootOnly=true
+X-KDE-SubstituteUID=true
+Categories=System;
Modified: pcbsd/current/src-qt4/pc-pfmanager/pfmanagerdlg.cpp
===================================================================
--- pcbsd/current/kcmPFManager/pfmanagerdlg.cpp 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/pfmanagerdlg.cpp 2010-07-23 17:08:31 UTC (rev 7263)
@@ -8,8 +8,7 @@
#include <qcheckbox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
-#include <Q3ListView>
-#include <Q3ListViewItem>
+#include <QTreeWidgetItem>
PFManagerDlg::~PFManagerDlg(void)
{
@@ -100,7 +99,7 @@
void PFManagerDlg::editClicked ( void )
{
- Q3ListViewItem *cur = 0;
+ QTreeWidgetItem *cur = 0;
cur = lvExceptions->currentItem();
if (cur != 0)
@@ -127,7 +126,7 @@
void PFManagerDlg::deleteClicked ( void )
{
- Q3ListViewItem *cur = 0;
+ QTreeWidgetItem *cur = 0;
cur = lvExceptions->currentItem();
if (cur != 0)
Modified: pcbsd/current/src-qt4/pc-pfmanager/taggedlistviewitem.hpp
===================================================================
--- pcbsd/current/kcmPFManager/taggedlistviewitem.hpp 2010-07-23 07:04:54 UTC (rev 7257)
+++ pcbsd/current/src-qt4/pc-pfmanager/taggedlistviewitem.hpp 2010-07-23 17:08:31 UTC (rev 7263)
@@ -3,18 +3,18 @@
#define __TAGGED_LISTVIEWITEM
-#include <Q3ListViewItem>
-#include <Q3ListView>
+#include <QTreeWidgetItem>
+#include <QTreeWidget>
template<class _TagT>
-class BasicTaggedListViewItem : public Q3ListViewItem
+class BasicTaggedListViewItem : public QTreeWidgetItem
{
_TagT _tag;
public:
- BasicTaggedListViewItem ( Q3ListView *list )
- : Q3ListViewItem(list), _tag(0)
+ BasicTaggedListViewItem ( QTreeWidget *list )
+ : QTreeWidgetItem(list), _tag(0)
{
}
Modified: pcbsd/current/src-qt4/src-qt4.pro
===================================================================
--- pcbsd/current/src-qt4/src-qt4.pro 2010-07-23 16:12:22 UTC (rev 7262)
+++ pcbsd/current/src-qt4/src-qt4.pro 2010-07-23 17:08:31 UTC (rev 7263)
@@ -3,6 +3,7 @@
SUBDIRS+=life-preserver \
pbreg \
pc-crashhandler \
+ pc-pfmanager \
pc-usermanager \
pc-servicemanager \
pc-sounderror \
More information about the Commits
mailing list