mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-24 12:17:26 +01:00
task 5 done
This commit is contained in:
parent
9aeea7e1b2
commit
b3ae89db0f
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -30,7 +32,6 @@
|
||||
#include "definitions.h"
|
||||
|
||||
#include "ActionsDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
@ -61,10 +62,10 @@ using namespace libfwbuilder;
|
||||
|
||||
void ActionsDialog::loadFWObject(FWObject *o)
|
||||
{
|
||||
setRule(PolicyRule::cast(o));
|
||||
setRule(PolicyRule::cast(o));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ActionsDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -118,7 +119,7 @@ void ActionsDialog::applyChanges()
|
||||
if (rn.contains(QRegExp("[^a-zA-Z0-9_]"))!=0)
|
||||
{
|
||||
QMessageBox::information(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Rule name for accounting is converted to the iptables\nchain name and therefore may not contain white space\nand special characters."),
|
||||
tr("&Continue"), QString::null,QString::null,
|
||||
0, 1 );
|
||||
@ -127,9 +128,9 @@ void ActionsDialog::applyChanges()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
data.saveAll();
|
||||
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
|
||||
if (editor=="BranchChain" || editor=="BranchAnchor")
|
||||
@ -144,7 +145,7 @@ void ActionsDialog::applyChanges()
|
||||
|
||||
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(rule);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(rule);
|
||||
}
|
||||
|
||||
void ActionsDialog::discardChanges()
|
||||
@ -177,19 +178,19 @@ void ActionsDialog::setRule(PolicyRule *r )
|
||||
assert(o!=NULL);
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
|
||||
|
||||
Firewall *f=Firewall::cast(o);
|
||||
firewall=f;
|
||||
|
||||
|
||||
platform=f->getStr("platform");
|
||||
QString title=QString("%1 / %2 (%3)")
|
||||
.arg(QString::fromUtf8(f->getName().c_str()))
|
||||
.arg(rule->getPosition())
|
||||
.arg(rule->getActionAsString().c_str());
|
||||
m_dialog->action->setText(title);
|
||||
|
||||
|
||||
string act=rule->getActionAsString();
|
||||
|
||||
|
||||
QStringList actionsOnReject=getActionsOnReject( platform.c_str() );
|
||||
m_dialog->rejectvalue->clear();
|
||||
m_dialog->rejectvalue->addItems( getScreenNames( actionsOnReject ) );
|
||||
@ -265,16 +266,16 @@ void ActionsDialog::setRule(PolicyRule *r )
|
||||
data.registerOption ( m_dialog->ipf_route_opt_addr , ropt , "ipf_route_opt_addr");
|
||||
|
||||
// pf
|
||||
data.registerOption ( m_dialog->pf_fastroute , ropt , "pf_fastroute" );
|
||||
data.registerOption ( m_dialog->pf_fastroute , ropt , "pf_fastroute" );
|
||||
data.registerOption( m_dialog->pf_route_load_option , ropt , "pf_route_load_option", route_load_options );
|
||||
data.registerOption ( m_dialog->pf_route_option , ropt , "pf_route_option",
|
||||
route_options);
|
||||
data.registerOption ( m_dialog->pf_route_opt_if , ropt , "pf_route_opt_if" );
|
||||
data.registerOption ( m_dialog->pf_route_opt_addr , ropt , "pf_route_opt_addr");
|
||||
route_options);
|
||||
data.registerOption ( m_dialog->pf_route_opt_if , ropt , "pf_route_opt_if" );
|
||||
data.registerOption ( m_dialog->pf_route_opt_addr , ropt , "pf_route_opt_addr");
|
||||
|
||||
// REJECT action:
|
||||
data.registerOption ( m_dialog->rejectvalue , ropt , "action_on_reject");
|
||||
|
||||
data.registerOption ( m_dialog->rejectvalue , ropt , "action_on_reject");
|
||||
|
||||
QWidget *w=m_dialog->NonePage;
|
||||
if (editor=="Reject")
|
||||
{
|
||||
@ -333,10 +334,10 @@ void ActionsDialog::setRule(PolicyRule *r )
|
||||
{
|
||||
w=m_dialog->RoutePFPage;
|
||||
}
|
||||
|
||||
|
||||
m_dialog->widgetStack->setCurrentWidget ( w );
|
||||
|
||||
//rejectvalue->setCurrentText( ropt->getStr("action_on_reject") );
|
||||
|
||||
//rejectvalue->setCurrentText( ropt->getStr("action_on_reject") );
|
||||
data.loadAll();
|
||||
|
||||
iptRouteContinueToggled();
|
||||
@ -346,13 +347,13 @@ void ActionsDialog::fillInterfaces(QComboBox* cb)
|
||||
{
|
||||
cb->clear();
|
||||
cb->addItem("");
|
||||
|
||||
|
||||
FWObjectTypedChildIterator j=firewall->findByType(Interface::TYPENAME);
|
||||
for ( ; j!=j.end(); ++j )
|
||||
{
|
||||
cb->addItem(QString::fromUtf8( (*j)->getName().c_str()) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ActionsDialog::closeEvent(QCloseEvent *e)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "AddressRangeDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/AddressRange.h"
|
||||
@ -44,18 +46,19 @@
|
||||
#include <qpushbutton.h>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
AddressRangeDialog::AddressRangeDialog(QWidget *parent):
|
||||
QWidget(parent)
|
||||
{
|
||||
AddressRangeDialog::AddressRangeDialog(ProjectPanel *project, QWidget *parent):
|
||||
QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::AddressRangeDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
|
||||
obj=NULL;
|
||||
|
||||
|
||||
obj=NULL;
|
||||
|
||||
}
|
||||
|
||||
AddressRangeDialog::~AddressRangeDialog()
|
||||
@ -97,7 +100,7 @@ void AddressRangeDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void AddressRangeDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -164,18 +167,18 @@ void AddressRangeDialog::applyChanges()
|
||||
{
|
||||
|
||||
}
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void AddressRangeDialog::discardChanges()
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
|
||||
class ProjectPanel;
|
||||
class AddressRangeDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -43,8 +44,9 @@ class AddressRangeDialog : public QWidget
|
||||
|
||||
Ui::AddressRangeDialog_q *m_dialog;
|
||||
|
||||
ProjectPanel *m_project;
|
||||
public:
|
||||
AddressRangeDialog(QWidget *parent);
|
||||
AddressRangeDialog(ProjectPanel *project, QWidget *parent);
|
||||
~AddressRangeDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "AddressTableDialog.h"
|
||||
#include "SimpleTextView.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWBSettings.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
@ -51,7 +53,7 @@
|
||||
#include <qcursor.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qfile.h>
|
||||
#include <qtextstream.h>
|
||||
#include <qtextstream.h>
|
||||
#include <qdir.h>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
@ -61,12 +63,12 @@
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
AddressTableDialog::AddressTableDialog(QWidget *parent) : QWidget(parent)
|
||||
AddressTableDialog::AddressTableDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::AddressTableDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
AddressTableDialog::~AddressTableDialog()
|
||||
@ -79,8 +81,8 @@ void AddressTableDialog::loadFWObject(FWObject *o)
|
||||
obj=o;
|
||||
AddressTable *s = dynamic_cast<AddressTable*>(obj);
|
||||
assert(s!=NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
init=true;
|
||||
|
||||
fillLibraries(m_dialog->libs,obj);
|
||||
@ -93,7 +95,7 @@ void AddressTableDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->r_runtime->setChecked(s->isRunTime() );
|
||||
|
||||
//BrowseButton->setEnabled(s->isCompileTime() );
|
||||
|
||||
|
||||
//apply->setEnabled( false );
|
||||
|
||||
m_dialog->obj_name->setEnabled(!o->isReadOnly());
|
||||
@ -110,7 +112,7 @@ void AddressTableDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void AddressTableDialog::changed()
|
||||
{
|
||||
//BrowseButton->setEnabled(r_compiletime->isChecked() );
|
||||
@ -151,19 +153,19 @@ void AddressTableDialog::applyChanges()
|
||||
s->setSourceName( (const char *)cs );
|
||||
s->setRunTime(m_dialog->r_runtime->isChecked() );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if ( ! Interface::isA( obj->getParent() ) &&
|
||||
m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void AddressTableDialog::discardChanges()
|
||||
@ -186,12 +188,12 @@ void AddressTableDialog::browse()
|
||||
dir=st->getWDir();
|
||||
if (dir.isEmpty()) dir=st->getOpenFileDir();
|
||||
if (dir.isEmpty()) dir="~";
|
||||
|
||||
|
||||
QString s = QFileDialog::getOpenFileName(this,
|
||||
"Choose a file",
|
||||
dir,
|
||||
"All files (*.*)");
|
||||
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
m_dialog->filename->setText(s);
|
||||
@ -201,7 +203,7 @@ void AddressTableDialog::preview( void )
|
||||
{
|
||||
SimpleTextView tv(this);
|
||||
tv.setName(m_dialog->obj_name->text());
|
||||
|
||||
|
||||
QFile f;
|
||||
QTextStream ts;
|
||||
QString filePath = m_dialog->filename->text();
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
|
||||
class ProjectPanel;
|
||||
class AddressTableDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -41,9 +42,10 @@ class AddressTableDialog : public QWidget
|
||||
libfwbuilder::FWObject *obj;
|
||||
bool init;
|
||||
Ui::AddressTableDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
AddressTableDialog(QWidget *parent);
|
||||
AddressTableDialog(ProjectPanel *project, QWidget *parent);
|
||||
~AddressTableDialog();
|
||||
virtual void closeEvent(QCloseEvent *e);
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "ColorCheckViewItem.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -47,7 +49,7 @@ ColorLabelMenuItem::ColorLabelMenuItem(QWidget *parent) :
|
||||
{
|
||||
m_widget = new Ui::colorLabelMenuItem_q;
|
||||
m_widget->setupUi(this);
|
||||
|
||||
|
||||
setup( m_widget->noneBtn, "#FFFFFF", tr("no color") );
|
||||
setup( m_widget->redBtn,
|
||||
st->getLabelColor(FWBSettings::RED ),
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -54,7 +56,7 @@ CommentEditorPanel::CommentEditorPanel(QWidget *p,
|
||||
{
|
||||
m_widget = new Ui::CommentEditorPanel_q;
|
||||
m_widget->setupUi(this);
|
||||
|
||||
|
||||
if (enableLoadFromFile) m_widget->inputFromFileButton->show();
|
||||
else m_widget->inputFromFileButton->hide();
|
||||
|
||||
@ -79,11 +81,11 @@ void CommentEditorPanel::setTitle(QString s)
|
||||
void CommentEditorPanel::loadFromFile()
|
||||
{
|
||||
if ( QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Warning: loading from file discards current contents of the script."),
|
||||
"&Load", "&Cancel", QString::null, 0, 1 )==0)
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(
|
||||
QString filename = QFileDialog::getOpenFileName(
|
||||
this, tr("Choose file that contains PIX commands"), st->getWDir());
|
||||
if (filename!="")
|
||||
{
|
||||
@ -91,7 +93,7 @@ void CommentEditorPanel::loadFromFile()
|
||||
if (!ifile)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Could not open file %1").arg(filename),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return;
|
||||
@ -111,16 +113,16 @@ void CommentEditorPanel::changed()
|
||||
}
|
||||
void CommentEditorPanel::applyChanges()
|
||||
{
|
||||
om->updateLastModifiedTimestampForAllFirewalls(rule);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(rule);
|
||||
rule->setComment( string(m_widget->editor->toPlainText().toUtf8().constData()) );
|
||||
|
||||
|
||||
}
|
||||
void CommentEditorPanel::loadFWObject(FWObject *obj)
|
||||
{
|
||||
Rule *r=Rule::cast(obj);
|
||||
|
||||
rule=r;
|
||||
|
||||
|
||||
FWObject *o = r;
|
||||
while (o!=NULL && Firewall::cast(o)==NULL) o=o->getParent();
|
||||
assert(o!=NULL);
|
||||
@ -141,7 +143,7 @@ void CommentEditorPanel::validate(bool* b)
|
||||
}
|
||||
void CommentEditorPanel::isChanged(bool*)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
void CommentEditorPanel::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -53,9 +55,9 @@
|
||||
#include "fwbuilder/Library.h"
|
||||
|
||||
|
||||
//#include <qhbox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlistwidget.h>
|
||||
//#include <qhbox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlistwidget.h>
|
||||
#include <qpixmapcache.h>
|
||||
|
||||
#include <vector>
|
||||
@ -63,14 +65,14 @@
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
ConfirmDeleteObjectDialog::ConfirmDeleteObjectDialog(QWidget*p) : QDialog(p)
|
||||
ConfirmDeleteObjectDialog::ConfirmDeleteObjectDialog(QWidget*p) : QDialog(p)
|
||||
{
|
||||
m_dialog = new Ui::ConfirmDeleteObjectDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
//QVBoxLayout *b=new QVBoxLayout((QWidget*)FrameForList);
|
||||
//fwu = new FindWhereUsedWidget((QWidget*)FrameForList,0,0, true);
|
||||
//b->addWidget(fwu);
|
||||
|
||||
|
||||
//connect(objectsList, SIGNAL(selectionChanged(QListBoxItem *)), this, SLOT(listItemSelected(QListBoxItem *)));
|
||||
}
|
||||
|
||||
@ -82,7 +84,7 @@ ConfirmDeleteObjectDialog::~ConfirmDeleteObjectDialog()
|
||||
void ConfirmDeleteObjectDialog::load(vector<FWObject *> objs)
|
||||
{
|
||||
if (objs.size()==0) return;
|
||||
|
||||
|
||||
vector<FWObject*>::iterator i;
|
||||
for( i=objs.begin(); i!=objs.end(); ++i)
|
||||
{
|
||||
@ -96,7 +98,7 @@ void ConfirmDeleteObjectDialog::findForObject(FWObject *obj)
|
||||
//objectsView->clear();
|
||||
//mapping.clear();
|
||||
//resset.clear();
|
||||
|
||||
|
||||
QPixmap pm0;
|
||||
QString icn_file = (":/Icons/" + obj->getTypeName() + "/icon-tree").c_str();
|
||||
|
||||
@ -132,29 +134,29 @@ void ConfirmDeleteObjectDialog::findForObject(FWObject *obj)
|
||||
fw=NULL;
|
||||
r=NULL;
|
||||
rs=NULL;
|
||||
|
||||
|
||||
if (findRef(obj,o)==NULL) continue;
|
||||
|
||||
if (RuleElement::cast(o)!=NULL)
|
||||
if (RuleElement::cast(o)!=NULL)
|
||||
{
|
||||
fw=o->getParent();
|
||||
|
||||
while (fw!=NULL && !Firewall::isA(fw))
|
||||
|
||||
while (fw!=NULL && !Firewall::isA(fw))
|
||||
{
|
||||
if (Rule::cast(fw))
|
||||
{
|
||||
r=Rule::cast(fw);
|
||||
r=Rule::cast(fw);
|
||||
} else if (RuleSet::cast(fw))
|
||||
{
|
||||
rs=RuleSet::cast(fw);
|
||||
}
|
||||
|
||||
|
||||
fw=fw->getParent();
|
||||
}
|
||||
if (fw==NULL || r==NULL || rs==NULL) continue;
|
||||
|
||||
|
||||
c1=QString::fromUtf8(fw->getName().c_str());
|
||||
|
||||
|
||||
if (NAT::isA(rs))
|
||||
{
|
||||
c2=tr("NAT");
|
||||
@ -169,11 +171,11 @@ void ConfirmDeleteObjectDialog::findForObject(FWObject *obj)
|
||||
c2=tr("Unknown rule set");
|
||||
}
|
||||
c2+=tr("/Rule%1").arg(r->getPosition());
|
||||
|
||||
|
||||
} else if (
|
||||
FWBTree::isSystem(o) ||
|
||||
Rule::cast(o) ||
|
||||
RuleSet::cast(o) ||
|
||||
mw->isSystem(o) ||
|
||||
Rule::cast(o) ||
|
||||
RuleSet::cast(o) ||
|
||||
Firewall::cast(o) ||
|
||||
Library::cast(o))
|
||||
{
|
||||
@ -187,9 +189,9 @@ void ConfirmDeleteObjectDialog::findForObject(FWObject *obj)
|
||||
|
||||
string icn="icon-tree";
|
||||
// FWObject *pixobj=(fw==NULL)?o:fw;
|
||||
// QPixmap pm = QPixmap::fromMimeSource(
|
||||
// QPixmap pm = QPixmap::fromMimeSource(
|
||||
// Resources::global_res->getObjResourceStr(pixobj, icn).c_str() );
|
||||
|
||||
|
||||
QStringList qsl;
|
||||
qsl << QString::fromUtf8( obj->getName().c_str()) << c1 << c2;
|
||||
item = new QTreeWidgetItem(m_dialog->objectsView, qsl);
|
||||
@ -201,7 +203,7 @@ void ConfirmDeleteObjectDialog::findForObject(FWObject *obj)
|
||||
if (itemCounter==0)
|
||||
{
|
||||
QStringList qsl;
|
||||
qsl << QString::fromUtf8( obj->getName().c_str())
|
||||
qsl << QString::fromUtf8( obj->getName().c_str())
|
||||
<< tr("Not used anywhere") << "";
|
||||
item = new QTreeWidgetItem(m_dialog->objectsView, qsl);
|
||||
item->setIcon(0,QIcon(pm0));
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,22 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "CustomServiceDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
@ -45,15 +47,16 @@
|
||||
#include <iostream>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
|
||||
CustomServiceDialog::CustomServiceDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
CustomServiceDialog::CustomServiceDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::CustomServiceDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
CustomServiceDialog::~CustomServiceDialog()
|
||||
@ -117,7 +120,7 @@ void CustomServiceDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void CustomServiceDialog::changed()
|
||||
{
|
||||
if (!init)
|
||||
@ -178,18 +181,18 @@ void CustomServiceDialog::applyChanges()
|
||||
i.key().toLatin1().constData(),code.c_str());
|
||||
s->setCodeForPlatform( i.key().toLatin1().constData(), code );
|
||||
}
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void CustomServiceDialog::discardChanges()
|
||||
|
||||
@ -38,6 +38,7 @@ namespace libfwbuilder {
|
||||
class FWObject;
|
||||
};
|
||||
|
||||
class ProjectPanel;
|
||||
class CustomServiceDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -48,9 +49,10 @@ class CustomServiceDialog : public QWidget
|
||||
QMap<QString, QString> allCodes;
|
||||
QString showPlatform;
|
||||
Ui::CustomServiceDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
CustomServiceDialog(QWidget *parent);
|
||||
CustomServiceDialog(ProjectPanel *project, QWidget *parent);
|
||||
~CustomServiceDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,18 +17,20 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "DNSNameDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/DNSName.h"
|
||||
@ -50,16 +52,17 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
DNSNameDialog::DNSNameDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
DNSNameDialog::DNSNameDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::DNSNameDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
|
||||
obj=NULL;
|
||||
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
DNSNameDialog::~DNSNameDialog()
|
||||
@ -72,8 +75,8 @@ void DNSNameDialog::loadFWObject(FWObject *o)
|
||||
obj=o;
|
||||
DNSName *s = dynamic_cast<DNSName*>(obj);
|
||||
assert(s!=NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
init=true;
|
||||
|
||||
fillLibraries(m_dialog->libs,obj);
|
||||
@ -84,7 +87,7 @@ void DNSNameDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->dnsrec->setText( s->getSourceName().c_str() );
|
||||
m_dialog->r_compiletime->setChecked(s->isCompileTime() );
|
||||
m_dialog->r_runtime->setChecked(s->isRunTime() );
|
||||
|
||||
|
||||
//apply->setEnabled( false );
|
||||
|
||||
m_dialog->obj_name->setEnabled(!o->isReadOnly());
|
||||
@ -103,7 +106,7 @@ void DNSNameDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void DNSNameDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -142,18 +145,18 @@ void DNSNameDialog::applyChanges()
|
||||
s->setSourceName( m_dialog->dnsrec->text().toLatin1().constData() );
|
||||
s->setRunTime(m_dialog->r_runtime->isChecked() );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void DNSNameDialog::discardChanges()
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class ProjectPanel;
|
||||
|
||||
class DNSNameDialog : public QWidget
|
||||
{
|
||||
@ -41,9 +42,10 @@ class DNSNameDialog : public QWidget
|
||||
libfwbuilder::FWObject *obj;
|
||||
bool init;
|
||||
Ui::DNSNameDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
DNSNameDialog(QWidget *parent);
|
||||
DNSNameDialog(ProjectPanel *project, QWidget *parent);
|
||||
~DNSNameDialog();
|
||||
virtual void closeEvent(QCloseEvent *e);
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "utils.h"
|
||||
#include "global.h"
|
||||
@ -108,7 +110,7 @@ void DialogData::loadToWidget( DialogOption &dopt , bool override)
|
||||
QString s = (override) ? dopt.override_str_val : QString(dopt.obj->getStr(dopt.attr.toLatin1().constData()).c_str());
|
||||
|
||||
QStringList slist;
|
||||
|
||||
|
||||
int current_item = 0;
|
||||
if (!dopt.mapping.empty())
|
||||
{
|
||||
@ -126,7 +128,7 @@ void DialogData::loadToWidget( DialogOption &dopt , bool override)
|
||||
* the array from 1).
|
||||
*/
|
||||
slist.clear();
|
||||
|
||||
|
||||
unsigned idx = 0;
|
||||
QStringList::iterator i1 = dopt.mapping.begin();
|
||||
QStringList::iterator i2 = dopt.mapping.begin();
|
||||
@ -159,7 +161,7 @@ void DialogData::loadToWidget( DialogOption &dopt , bool override)
|
||||
{
|
||||
current_item = i; //lbx->index( lbx->findItem(s,Qt::ExactMatch) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
cbx->setCurrentIndex( current_item );
|
||||
}
|
||||
@ -189,7 +191,7 @@ void DialogData::loadToWidget( DialogOption &dopt , bool override)
|
||||
sbx->setValue( (override)?dopt.override_int_val:dopt.obj->getInt(dopt.attr.toLatin1().constData()) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DialogData::loadAll()
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -94,57 +96,58 @@
|
||||
#include "fwbuilder/TagService.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
QWidget *DialogFactory::createDialog(QWidget *parent,const QString &objType)
|
||||
QWidget *DialogFactory::createDialog(ProjectPanel *project, QWidget *parent,const QString &objType)
|
||||
{
|
||||
|
||||
if (objType==Library::TYPENAME) return new LibraryDialog(parent);
|
||||
if (objType==Library::TYPENAME) return new LibraryDialog(project, parent);
|
||||
|
||||
if (objType==IPv4::TYPENAME) return new IPv4Dialog(parent);
|
||||
if (objType==IPv4::TYPENAME) return new IPv4Dialog(project, parent);
|
||||
|
||||
if (objType==physAddress::TYPENAME) return new PhysicalAddressDialog(parent);
|
||||
if (objType==physAddress::TYPENAME) return new PhysicalAddressDialog(project, parent);
|
||||
|
||||
if (objType==DNSName::TYPENAME) return new DNSNameDialog(parent);
|
||||
if (objType==DNSName::TYPENAME) return new DNSNameDialog(project, parent);
|
||||
|
||||
if (objType==AddressTable::TYPENAME) return new AddressTableDialog(parent);
|
||||
if (objType==AddressTable::TYPENAME) return new AddressTableDialog(project, parent);
|
||||
|
||||
if (objType==AddressRange::TYPENAME) return new AddressRangeDialog(parent);
|
||||
if (objType==AddressRange::TYPENAME) return new AddressRangeDialog(project, parent);
|
||||
|
||||
if (objType==Firewall::TYPENAME) return new FirewallDialog(parent);
|
||||
if (objType==Firewall::TYPENAME) return new FirewallDialog(project, parent);
|
||||
|
||||
if (objType==Host::TYPENAME) return new HostDialog(parent);
|
||||
if (objType==Host::TYPENAME) return new HostDialog(project, parent);
|
||||
|
||||
if (objType==Interface::TYPENAME) return new InterfaceDialog(parent);
|
||||
if (objType==Interface::TYPENAME) return new InterfaceDialog(project, parent);
|
||||
|
||||
if (objType==Network::TYPENAME) return new NetworkDialog(parent);
|
||||
if (objType==Network::TYPENAME) return new NetworkDialog(project, parent);
|
||||
|
||||
if (objType==CustomService::TYPENAME) return new CustomServiceDialog(parent);
|
||||
if (objType==CustomService::TYPENAME) return new CustomServiceDialog(project, parent);
|
||||
|
||||
if (objType==IPService::TYPENAME) return new IPServiceDialog(parent);
|
||||
if (objType==IPService::TYPENAME) return new IPServiceDialog(project, parent);
|
||||
|
||||
if (objType==ICMPService::TYPENAME) return new ICMPServiceDialog(parent);
|
||||
if (objType==ICMPService::TYPENAME) return new ICMPServiceDialog(project, parent);
|
||||
|
||||
if (objType==TCPService::TYPENAME) return new TCPServiceDialog(parent);
|
||||
if (objType==TCPService::TYPENAME) return new TCPServiceDialog(project, parent);
|
||||
|
||||
if (objType==UDPService::TYPENAME) return new UDPServiceDialog(parent);
|
||||
if (objType==UDPService::TYPENAME) return new UDPServiceDialog(project, parent);
|
||||
|
||||
if (objType==ObjectGroup::TYPENAME) return new GroupObjectDialog(parent);
|
||||
if (objType==ObjectGroup::TYPENAME) return new GroupObjectDialog(project, parent);
|
||||
|
||||
if (objType==ServiceGroup::TYPENAME) return new GroupObjectDialog(parent);
|
||||
|
||||
if (objType==TagService::TYPENAME) return new TagServiceDialog(parent);
|
||||
if (objType==ServiceGroup::TYPENAME) return new GroupObjectDialog(project, parent);
|
||||
|
||||
if (objType==IntervalGroup::TYPENAME) return new GroupObjectDialog(parent);
|
||||
if (objType==TagService::TYPENAME) return new TagServiceDialog(project, parent);
|
||||
|
||||
if (objType==Interval::TYPENAME) return new TimeDialog(parent);
|
||||
if (objType==IntervalGroup::TYPENAME) return new GroupObjectDialog(project, parent);
|
||||
|
||||
if (objType==RoutingRule::TYPENAME) return new RoutingRuleOptionsDialog(parent);
|
||||
if (objType==Rule::TYPENAME) return new RuleOptionsDialog(parent);
|
||||
if (objType==PolicyRule::TYPENAME) return new RuleOptionsDialog(parent);
|
||||
if (objType==NATRule::TYPENAME) return new NATRuleOptionsDialog(parent);
|
||||
if (objType==Interval::TYPENAME) return new TimeDialog(project, parent);
|
||||
|
||||
if (objType==RoutingRule::TYPENAME) return new RoutingRuleOptionsDialog(project, parent);
|
||||
if (objType==Rule::TYPENAME) return new RuleOptionsDialog(project, parent);
|
||||
if (objType==PolicyRule::TYPENAME) return new RuleOptionsDialog(project, parent);
|
||||
if (objType==NATRule::TYPENAME) return new NATRuleOptionsDialog(project, parent);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -29,12 +29,12 @@ namespace libfwbuilder {
|
||||
class FWObject;
|
||||
class FWException;
|
||||
};
|
||||
|
||||
class ProjectPanel;
|
||||
class DialogFactory {
|
||||
|
||||
public:
|
||||
|
||||
static QWidget *createDialog(QWidget *parent,const QString &objType);
|
||||
static QWidget *createDialog(ProjectPanel *project, QWidget *parent,const QString &objType);
|
||||
static QWidget *createFWDialog(QWidget *parent,libfwbuilder::FWObject *o)
|
||||
throw(libfwbuilder::FWException);
|
||||
static QWidget *createOSDialog(QWidget *parent,libfwbuilder::FWObject *o)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -18,12 +18,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -49,7 +51,7 @@
|
||||
#include <qhostaddress.h>
|
||||
#include <qhostinfo.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#include "DiscoveryDruid.h"
|
||||
|
||||
@ -83,14 +85,14 @@ DiscoveryDruid::DiscoveryDruid(QWidget *parent, bool start_with_import) :
|
||||
{
|
||||
m_dialog = new Ui::DiscoveryDruid_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
m_dialog->nextButton,
|
||||
m_dialog->finishButton,
|
||||
m_dialog->backButton,
|
||||
m_dialog->cancelButton,
|
||||
m_dialog->titleLabel);
|
||||
|
||||
|
||||
dm_method = new QButtonGroup;
|
||||
dm_method->addButton(m_dialog->dm_fromfile,0);
|
||||
dm_method->addButton(m_dialog->dm_importdns,1);
|
||||
@ -102,33 +104,33 @@ DiscoveryDruid::DiscoveryDruid(QWidget *parent, bool start_with_import) :
|
||||
connect(m_dialog->dnscustom, SIGNAL( clicked(bool) ), this, SLOT( changedNameServer() ) );
|
||||
connect(m_dialog->nameserverlist, SIGNAL( editTextChanged(QString) ), this, SLOT( changedNameServer() ) );
|
||||
connect(m_dialog->nameserverline, SIGNAL( textChanged(QString) ), this, SLOT( changedNameServer() ) );
|
||||
|
||||
|
||||
thread=NULL;
|
||||
|
||||
|
||||
timer=new QTimer(this);
|
||||
prg_timer=new QTimer(this);
|
||||
unBar=NULL;
|
||||
unProg=0;
|
||||
|
||||
|
||||
connect(prg_timer,SIGNAL(timeout()),this,SLOT(updatePrg()));
|
||||
|
||||
|
||||
setDiscoveryMethod_file();
|
||||
|
||||
|
||||
flt_obj = new Filter();
|
||||
flt_obj_d = new FilterDialog(this);
|
||||
flt_obj_d->setFilter(flt_obj);
|
||||
|
||||
|
||||
flt_last = new Filter();
|
||||
flt_last_d = new FilterDialog(this);
|
||||
flt_last_d->setFilter(flt_last);
|
||||
|
||||
|
||||
flt_net = new Filter();
|
||||
flt_net_d = new FilterDialog(this);
|
||||
flt_net_d->setFilter(flt_net);
|
||||
|
||||
fillLibraries(m_dialog->libs,mw->db());
|
||||
m_dialog->libs->setEditable(true);
|
||||
m_dialog->libs->lineEdit()->setText(om->getCurrentLib()->getName().c_str());
|
||||
m_dialog->libs->lineEdit()->setText(mw->getCurrentLib()->getName().c_str());
|
||||
|
||||
m_dialog->DNSprogress->hide();
|
||||
m_dialog->DNSprogress_2->hide();
|
||||
@ -137,7 +139,7 @@ DiscoveryDruid::DiscoveryDruid(QWidget *parent, bool start_with_import) :
|
||||
m_dialog->dm_importdns->hide();
|
||||
m_dialog->snmpdnsparameters->hide();
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_LIBSNMP
|
||||
m_dialog->dm_usesnmp->setEnabled(false);
|
||||
#endif
|
||||
@ -192,14 +194,14 @@ void DiscoveryDruid::cancelClicked()
|
||||
DiscoveryDruid::~DiscoveryDruid()
|
||||
{
|
||||
save();
|
||||
|
||||
|
||||
delete flt_obj;
|
||||
delete flt_last;
|
||||
delete flt_net;
|
||||
delete flt_obj_d;
|
||||
delete flt_last_d;
|
||||
delete flt_net_d;
|
||||
|
||||
|
||||
delete m_dialog;
|
||||
delete dm_method;
|
||||
}
|
||||
@ -352,7 +354,7 @@ void DiscoveryDruid::dnsFinish(QHostInfo host)
|
||||
QList<QHostAddress> list = host.addresses();
|
||||
|
||||
unBar->hide();
|
||||
|
||||
|
||||
if (userIsTyping)
|
||||
{
|
||||
//abandon the test result
|
||||
@ -373,7 +375,7 @@ void DiscoveryDruid::dnsFinish(QHostInfo host)
|
||||
QPalette palette = errMessage->palette();
|
||||
palette.setColor(errMessage->foregroundRole(), Qt::darkRed);
|
||||
errMessage->setPalette(palette);
|
||||
|
||||
|
||||
errMessage->setText( "host name not found");
|
||||
isSeedHostOK=false;
|
||||
}
|
||||
@ -382,22 +384,22 @@ void DiscoveryDruid::dnsFinish(QHostInfo host)
|
||||
QPalette palette = errMessage->palette();
|
||||
palette.setColor(errMessage->foregroundRole(), Qt::darkGreen);
|
||||
errMessage->setPalette(palette);
|
||||
|
||||
|
||||
errMessage->setText( "host name verified");
|
||||
isSeedHostOK=true;
|
||||
|
||||
|
||||
}
|
||||
nextButton->setEnabled(isSNMPInclNetOK && isSeedHostOK);
|
||||
nextButton->setEnabled(isSNMPInclNetOK && isSeedHostOK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DiscoveryDruid::changedSelected( const int &page )
|
||||
{
|
||||
switch (page)
|
||||
{
|
||||
|
||||
case 1: // Reading file in hosts format
|
||||
|
||||
case 1: // Reading file in hosts format
|
||||
{
|
||||
setNextEnabled(page,false);
|
||||
changedHostsFileName();
|
||||
@ -441,7 +443,7 @@ void DiscoveryDruid::changedSelected( const int &page )
|
||||
|
||||
isSeedHostOK=false;
|
||||
isSNMPInclNetOK=false;
|
||||
|
||||
|
||||
changedSeedHost();
|
||||
changedInclNet();
|
||||
m_dialog->seedhostname->setFocus();
|
||||
@ -496,7 +498,7 @@ void DiscoveryDruid::changedSelected( const int &page )
|
||||
{
|
||||
if (Networks.size()==0)
|
||||
setBackEnabled(page,false);
|
||||
|
||||
|
||||
fillListOfObjects();
|
||||
fillObjects();
|
||||
nextButton->setEnabled(m_dialog->objectlist->count ()>0 || m_dialog->networklist->count()>0);
|
||||
@ -524,9 +526,9 @@ void DiscoveryDruid::changedSelected( const int &page )
|
||||
finishButton->setFocus();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default : {}
|
||||
|
||||
|
||||
}
|
||||
FromPage=page;
|
||||
}
|
||||
@ -573,18 +575,18 @@ void DiscoveryDruid::browseHostsFile()
|
||||
dir=st->getWDir();
|
||||
if (dir.isEmpty()) dir=st->getOpenFileDir();
|
||||
if (dir.isEmpty()) dir="~";
|
||||
|
||||
|
||||
QString s = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
"Choose a file",
|
||||
dir,
|
||||
"All files (*.*)");
|
||||
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
m_dialog->filename->setText(s);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DiscoveryDruid::browseForImport()
|
||||
@ -593,18 +595,18 @@ void DiscoveryDruid::browseForImport()
|
||||
dir=st->getWDir();
|
||||
if (dir.isEmpty()) dir=st->getOpenFileDir();
|
||||
if (dir.isEmpty()) dir="~";
|
||||
|
||||
|
||||
QString s = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
"Choose a file",
|
||||
dir,
|
||||
"All files (*.*)");
|
||||
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
m_dialog->import_filename->setText(s);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DiscoveryDruid::updatePrg()
|
||||
@ -613,7 +615,7 @@ void DiscoveryDruid::updatePrg()
|
||||
{
|
||||
unBar->setValue(unProg++);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DiscoveryDruid::getNameServers()
|
||||
@ -623,14 +625,14 @@ void DiscoveryDruid::getNameServers()
|
||||
string domain_name=m_dialog->domainname->text().toLatin1().constData();
|
||||
DNS_getNS_query *dns=new DNS_getNS_query(domain_name);
|
||||
int n;
|
||||
try
|
||||
try
|
||||
{
|
||||
NullLogger nl;
|
||||
SyncFlag stop_program(false);
|
||||
ns_records=dns->getNS(domain_name, &nl, &stop_program);
|
||||
m_dialog->dnsfromlist->setChecked(true);
|
||||
|
||||
} catch (FWException &ex)
|
||||
} catch (FWException &ex)
|
||||
{
|
||||
//string(_("Could not find name servers for the domain: '"))+
|
||||
//domain_name+"' ", ex.toString(), this);
|
||||
@ -643,14 +645,14 @@ void DiscoveryDruid::getNameServers()
|
||||
multimap<string,IPAddress>::iterator i;
|
||||
m_dialog->nameserverlist->clear();
|
||||
NameServers.clear();
|
||||
|
||||
for (n=0,i=ns_records.begin(); i!=ns_records.end(); ++n,++i)
|
||||
|
||||
for (n=0,i=ns_records.begin(); i!=ns_records.end(); ++n,++i)
|
||||
{
|
||||
|
||||
string s = (*i).first + " (" + ((*i).second).toString() + ")";
|
||||
QString qs = s.c_str();
|
||||
m_dialog->nameserverlist->addItem(qs);
|
||||
|
||||
|
||||
IPAddress *na=new IPAddress( (*i).second );
|
||||
NameServers[qs] = *na;
|
||||
}
|
||||
@ -683,7 +685,7 @@ void DiscoveryDruid::setDiscoveryMethod_SNMP()
|
||||
for (int i=0;i<WIZARD_PAGES;i++)
|
||||
{
|
||||
setAppropriate( i, WIZARD_SNMP_PAGES[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DiscoveryDruid::setDiscoveryMethod_Import()
|
||||
@ -693,7 +695,7 @@ void DiscoveryDruid::setDiscoveryMethod_Import()
|
||||
for (int i=0;i<WIZARD_PAGES;i++)
|
||||
{
|
||||
setAppropriate( i, WIZARD_IMPORT_PAGES[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -704,17 +706,17 @@ void DiscoveryDruid::changedDiscoveryMethod(int c)
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
case 0:
|
||||
{
|
||||
setDiscoveryMethod_file();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 1:
|
||||
{
|
||||
setDiscoveryMethod_DNS();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 2:
|
||||
{
|
||||
setDiscoveryMethod_SNMP();
|
||||
break;
|
||||
@ -735,14 +737,14 @@ void DiscoveryDruid::saveScanLog()
|
||||
dir=st->getWDir();
|
||||
if (dir.isEmpty()) dir=st->getOpenFileDir();
|
||||
if (dir.isEmpty()) dir="~";
|
||||
|
||||
|
||||
QString s = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
"Choose a file",
|
||||
dir,
|
||||
"Text file (*.txt)");
|
||||
|
||||
|
||||
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
if (s.endsWith(".txt"))
|
||||
@ -766,16 +768,16 @@ void DiscoveryDruid::saveScanLog()
|
||||
qDebug("--------------------------------");
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::startHostsScan()
|
||||
{
|
||||
if (thread!=NULL)
|
||||
{
|
||||
delete thread;
|
||||
}
|
||||
|
||||
|
||||
thread = new HostsFileImport(m_dialog->filename->text());
|
||||
thread->setTargetWidget(this);
|
||||
thread->start();
|
||||
@ -810,7 +812,7 @@ void DiscoveryDruid::startConfigImport()
|
||||
m_dialog->discoveryprogress->setMaximum(line_count);
|
||||
|
||||
// need to pick right platform string based on
|
||||
// m_dialog->import_platform->currentItem()
|
||||
// m_dialog->import_platform->currentItem()
|
||||
string platform = "";
|
||||
switch (m_dialog->import_platform->currentIndex())
|
||||
{
|
||||
@ -836,21 +838,21 @@ void DiscoveryDruid::startConfigImport()
|
||||
IPAddress DiscoveryDruid::getNS()
|
||||
{
|
||||
string ns;
|
||||
if (m_dialog->dnscustom->isChecked())
|
||||
if (m_dialog->dnscustom->isChecked())
|
||||
{
|
||||
ns=m_dialog->nameserverline->text().toLatin1().constData();
|
||||
ns=m_dialog->nameserverline->text().toLatin1().constData();
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
return IPAddress(ns);
|
||||
} catch (FWException &ex)
|
||||
} catch (FWException &ex)
|
||||
{
|
||||
/* perhaps not address but host name */
|
||||
list<IPAddress> addr;
|
||||
try
|
||||
try
|
||||
{
|
||||
addr=DNS::getHostByName(ns);
|
||||
} catch (FWException &ex)
|
||||
} catch (FWException &ex)
|
||||
{
|
||||
return IPAddress();
|
||||
}
|
||||
@ -864,9 +866,9 @@ IPAddress DiscoveryDruid::getNS()
|
||||
|
||||
void DiscoveryDruid::startDNSScan()
|
||||
{
|
||||
IPAddress ns=getNS();
|
||||
IPAddress ns=getNS();
|
||||
string domain_name=m_dialog->domainname->text().toLatin1().constData();
|
||||
|
||||
|
||||
DNS_findA_query *q=new DNS_findA_query();
|
||||
q->init(
|
||||
domain_name, ns,
|
||||
@ -874,13 +876,13 @@ void DiscoveryDruid::startDNSScan()
|
||||
m_dialog->dnstimeout->value()
|
||||
);
|
||||
bop=q;
|
||||
|
||||
|
||||
m_dialog->discoveryprogress->setMaximum(0);
|
||||
unBar=m_dialog->discoveryprogress;
|
||||
try
|
||||
{
|
||||
logger=bop->start_operation();
|
||||
|
||||
|
||||
m_dialog->discoverylog->append("Reading DNS zone ...");
|
||||
|
||||
} catch(const FWException &ex)
|
||||
@ -900,11 +902,11 @@ IPAddress DiscoveryDruid::getSeedHostAddress()
|
||||
{
|
||||
seed_host_addr=IPAddress(m_dialog->seedhostname->text().toLatin1().constData());
|
||||
return seed_host_addr;
|
||||
} catch(const FWException &ex)
|
||||
} catch(const FWException &ex)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
QString a = getAddrByName( m_dialog->seedhostname->text() );
|
||||
return IPAddress( a.toLatin1().constData() );
|
||||
@ -913,16 +915,16 @@ IPAddress DiscoveryDruid::getSeedHostAddress()
|
||||
seed_host_addr = v.front();
|
||||
return seed_host_addr;
|
||||
#endif
|
||||
} catch(const FWException &ex)
|
||||
} catch(const FWException &ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
return seed_host_addr;
|
||||
}
|
||||
|
||||
void DiscoveryDruid::startSNMPScan()
|
||||
{
|
||||
#ifdef HAVE_LIBSNMP
|
||||
#ifdef HAVE_LIBSNMP
|
||||
|
||||
|
||||
bool use_incl=!m_dialog->snmpinaddr->text().isEmpty() && !m_dialog->snmpinmask->text().isEmpty();
|
||||
@ -932,7 +934,7 @@ void DiscoveryDruid::startSNMPScan()
|
||||
{
|
||||
IPNetwork in(
|
||||
IPAddress(m_dialog->snmpinaddr->text().toLatin1().constData()),
|
||||
Netmask(m_dialog->snmpinmask->text().toLatin1().constData())
|
||||
Netmask(m_dialog->snmpinmask->text().toLatin1().constData())
|
||||
);
|
||||
include_networks.push_back(in);
|
||||
}
|
||||
@ -954,26 +956,26 @@ void DiscoveryDruid::startSNMPScan()
|
||||
0,
|
||||
0,
|
||||
(use_incl) ? &include_networks : NULL);
|
||||
|
||||
|
||||
m_dialog->discoveryprogress->setMaximum(0);
|
||||
unBar=m_dialog->discoveryprogress;
|
||||
|
||||
|
||||
bop=q;
|
||||
try
|
||||
{
|
||||
logger=bop->start_operation();
|
||||
m_dialog->discoverylog->append("Collecting data ...");
|
||||
|
||||
|
||||
} catch(const FWException &ex)
|
||||
{
|
||||
delete q;
|
||||
q=NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::changedDomainName()
|
||||
{
|
||||
if (m_dialog->domainname->text().isEmpty())
|
||||
@ -996,26 +998,26 @@ void DiscoveryDruid::changedNameServer()
|
||||
nextButton->setEnabled(false);
|
||||
QString s=m_dialog->nameserverline->text();
|
||||
HostName=s;
|
||||
|
||||
|
||||
if (s.isEmpty())
|
||||
{
|
||||
timer->stop();
|
||||
m_dialog->DNSprogress_2->hide();
|
||||
|
||||
|
||||
QPalette palette = m_dialog->nameserver_error->palette();
|
||||
palette.setColor(m_dialog->nameserver_error->foregroundRole(), Qt::darkRed);
|
||||
m_dialog->nameserver_error->setPalette(palette);
|
||||
|
||||
|
||||
m_dialog->nameserver_error->setText("Enter valid host name or address.");
|
||||
nextButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(isIPAddress(s))
|
||||
{
|
||||
timer->stop();
|
||||
m_dialog->DNSprogress_2->hide();
|
||||
|
||||
|
||||
QString rs=testIPAddress(s);
|
||||
if (rs.isEmpty())
|
||||
{
|
||||
@ -1041,13 +1043,13 @@ void DiscoveryDruid::changedNameServer()
|
||||
timer->start(1000);
|
||||
errMessage=m_dialog->nameserver_error;
|
||||
userIsTyping=false;
|
||||
|
||||
|
||||
QPalette palette = errMessage->palette();
|
||||
palette.setColor(errMessage->foregroundRole(), Qt::black);
|
||||
errMessage->setPalette(palette);
|
||||
|
||||
|
||||
errMessage->setText("DNS resolution in progress...");
|
||||
|
||||
|
||||
unProg = 0;
|
||||
}
|
||||
}
|
||||
@ -1083,7 +1085,7 @@ QString DiscoveryDruid::testIPAddress(const QString s)
|
||||
try
|
||||
{
|
||||
IPAddress(s.toLatin1().constData());
|
||||
} catch(const FWException &ex)
|
||||
} catch(const FWException &ex)
|
||||
{
|
||||
res=ex.toString().c_str();
|
||||
}
|
||||
@ -1108,12 +1110,12 @@ void DiscoveryDruid::changedHostsFileName()
|
||||
setNextEnabled(currentPage(),false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::changedSNMPOptions()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::stopBackgroundProcess()
|
||||
{
|
||||
if (fwbdebug)
|
||||
@ -1123,16 +1125,16 @@ void DiscoveryDruid::stopBackgroundProcess()
|
||||
if (bop!=NULL && bop->isRunning())
|
||||
{
|
||||
m_dialog->discoverylog->append("Terminating task. Please wait...");
|
||||
|
||||
|
||||
bop->stop_operation();
|
||||
m_dialog->discoveryStopButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::addNetwork()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
int count = m_dialog->networkresultlist->count();
|
||||
int upd_max=(count > 10)?count/10:1;
|
||||
int updc=upd_max;
|
||||
@ -1141,23 +1143,23 @@ void DiscoveryDruid::addNetwork()
|
||||
|
||||
QListWidgetItem* item=(QListWidgetItem*)m_dialog->networkresultlist->item(0);
|
||||
int i = 0;
|
||||
|
||||
|
||||
while (item)
|
||||
{
|
||||
|
||||
if (item->isSelected())
|
||||
{
|
||||
QString k=item->text();
|
||||
if (!Networks[k].isSelected)
|
||||
if (!Networks[k].isSelected)
|
||||
{
|
||||
Networks[k].isSelected=true;
|
||||
m_dialog->networklist->addItem(item->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
i++;
|
||||
item=(QListWidgetItem*)m_dialog->networkresultlist->item(i);
|
||||
|
||||
|
||||
if (updc--<=0)
|
||||
{
|
||||
pd.setValue(t);
|
||||
@ -1165,7 +1167,7 @@ void DiscoveryDruid::addNetwork()
|
||||
|
||||
if (pd.wasCanceled())
|
||||
{
|
||||
break;
|
||||
break;
|
||||
}
|
||||
updc=upd_max;
|
||||
}
|
||||
@ -1174,12 +1176,12 @@ void DiscoveryDruid::addNetwork()
|
||||
nextButton->setEnabled(m_dialog->networklist->count ()>0 || Objects.size()>0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::removeNetwork()
|
||||
{
|
||||
QListWidgetItem* item1=m_dialog->networklist->item(0);
|
||||
QListWidgetItem* item2;
|
||||
|
||||
|
||||
while (item1!=0)
|
||||
{
|
||||
item2=m_dialog->networklist->item(
|
||||
@ -1193,19 +1195,19 @@ void DiscoveryDruid::removeNetwork()
|
||||
}
|
||||
nextButton->setEnabled(m_dialog->networklist->count ()>0 || Objects.size()>0);
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::setNetworkFilter()
|
||||
{
|
||||
flt_net_d->exec();
|
||||
flt_net_d->exec();
|
||||
fillListOfNetworks();
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::removeNetworkFilter()
|
||||
{
|
||||
flt_net->clear();
|
||||
flt_net->clear();
|
||||
fillListOfNetworks();
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::addObject()
|
||||
{
|
||||
int count = m_dialog->objectresultlist->count();
|
||||
@ -1217,7 +1219,7 @@ void DiscoveryDruid::addObject()
|
||||
|
||||
QListWidgetItem* item=(QListWidgetItem*)m_dialog->objectresultlist->item(0);
|
||||
int i = 0;
|
||||
|
||||
|
||||
while (item)
|
||||
{
|
||||
if (item->isSelected())
|
||||
@ -1229,7 +1231,7 @@ void DiscoveryDruid::addObject()
|
||||
m_dialog->objectlist->addItem(item->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
i++;
|
||||
item=(QListWidgetItem*)m_dialog->objectresultlist->item(i);
|
||||
|
||||
@ -1240,7 +1242,7 @@ void DiscoveryDruid::addObject()
|
||||
|
||||
if (pd.wasCanceled())
|
||||
{
|
||||
break;
|
||||
break;
|
||||
}
|
||||
updc=upd_max;
|
||||
}
|
||||
@ -1248,7 +1250,7 @@ void DiscoveryDruid::addObject()
|
||||
}
|
||||
nextButton->setEnabled(m_dialog->objectlist->count ()>0 || m_dialog->networklist->count()>0);
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::removeObject()
|
||||
{
|
||||
QListWidgetItem* item1=m_dialog->objectlist->item(0);
|
||||
@ -1267,19 +1269,19 @@ void DiscoveryDruid::removeObject()
|
||||
}
|
||||
nextButton->setEnabled(m_dialog->objectlist->count ()>0 || m_dialog->networklist->count()>0);
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::setLastFilter()
|
||||
{
|
||||
flt_last_d->exec();
|
||||
flt_last_d->exec();
|
||||
fillTypeChangingList();
|
||||
}
|
||||
|
||||
void DiscoveryDruid::setObjectFilter()
|
||||
{
|
||||
flt_obj_d->exec();
|
||||
flt_obj_d->exec();
|
||||
fillListOfObjects();
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::removeLastFilter()
|
||||
{
|
||||
flt_last->clear();
|
||||
@ -1288,7 +1290,7 @@ void DiscoveryDruid::removeLastFilter()
|
||||
|
||||
void DiscoveryDruid::removeObjectFilter()
|
||||
{
|
||||
flt_obj->clear();
|
||||
flt_obj->clear();
|
||||
fillListOfObjects();
|
||||
}
|
||||
|
||||
@ -1338,7 +1340,7 @@ void DiscoveryDruid::fillObjects()
|
||||
ObjectDescriptor buf;
|
||||
|
||||
m_dialog->objectlist->clear();
|
||||
bool f=false;
|
||||
bool f=false;
|
||||
QMap<QString,ObjectDescriptor >::iterator i;
|
||||
for(i=Objects.begin(); i!=Objects.end(); ++i)
|
||||
{
|
||||
@ -1354,11 +1356,11 @@ void DiscoveryDruid::fillObjects()
|
||||
|
||||
void DiscoveryDruid::fillTypeChangingList()
|
||||
{
|
||||
|
||||
|
||||
ObjectDescriptor buf;
|
||||
|
||||
m_dialog->typeChangingList->clear();
|
||||
|
||||
|
||||
QMap<QString,ObjectDescriptor >::iterator i;
|
||||
for(i=Objects.begin(); i!=Objects.end(); ++i)
|
||||
{
|
||||
@ -1387,7 +1389,7 @@ void DiscoveryDruid::loadDataFromDNS()
|
||||
Objects.clear();
|
||||
|
||||
map<string,set<IPAddress> > t = q->getResult();
|
||||
|
||||
|
||||
for(map<string,set<IPAddress> >::iterator j = t.begin(); j!=t.end(); ++j)
|
||||
{
|
||||
ObjectDescriptor od;
|
||||
@ -1403,12 +1405,12 @@ void DiscoveryDruid::loadDataFromDNS()
|
||||
}
|
||||
od.type =IPv4::TYPENAME;
|
||||
od.isSelected=false;
|
||||
|
||||
|
||||
if (od.sysname.empty())
|
||||
{
|
||||
od.sysname=string("h-") + od.addr.toString();
|
||||
}
|
||||
|
||||
|
||||
Objects[od.toString().c_str()]=od;
|
||||
}
|
||||
}
|
||||
@ -1423,11 +1425,11 @@ void DiscoveryDruid::loadDataFromFile()
|
||||
if (count > 0)
|
||||
{
|
||||
int upd_max=(count > 10)?count/10:1;
|
||||
|
||||
|
||||
int updc=upd_max;
|
||||
|
||||
|
||||
QProgressDialog pd(tr("Prepare objects ..."), tr("Cancel"), 0, count,this);
|
||||
|
||||
|
||||
vector<ObjectDescriptor>::iterator i;
|
||||
for(i = himport->hosts.begin(); i != himport->hosts.end(); ++i)
|
||||
{
|
||||
@ -1436,7 +1438,7 @@ void DiscoveryDruid::loadDataFromFile()
|
||||
i->type=IPv4::TYPENAME;
|
||||
}
|
||||
i->isSelected=false;
|
||||
|
||||
|
||||
Objects[i->toString().c_str()] = *i;
|
||||
if (updc--<=0)
|
||||
{
|
||||
@ -1445,7 +1447,7 @@ void DiscoveryDruid::loadDataFromFile()
|
||||
|
||||
if (pd.wasCanceled())
|
||||
{
|
||||
break;
|
||||
break;
|
||||
}
|
||||
updc=upd_max;
|
||||
}
|
||||
@ -1463,15 +1465,7 @@ void DiscoveryDruid::loadDataFromImporter()
|
||||
{
|
||||
Firewall *fw = imp->finalize();
|
||||
|
||||
om->loadObjects();
|
||||
|
||||
if (fw)
|
||||
{
|
||||
om->updateObjName(fw,"", false);
|
||||
mw->addFirewallToList(fw);
|
||||
mw->showFirewall(fw);
|
||||
om->editObject(fw);
|
||||
}
|
||||
mw->loadDataFromFw(fw);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1481,7 +1475,7 @@ void DiscoveryDruid::loadDataFromCrawler()
|
||||
SNMPCrawler *q=(SNMPCrawler*)bop;
|
||||
Objects.clear();
|
||||
Networks.clear();
|
||||
|
||||
|
||||
set<IPNetwork>::iterator m;
|
||||
set<IPNetwork> s = q->getNetworks();
|
||||
|
||||
@ -1491,13 +1485,13 @@ void DiscoveryDruid::loadDataFromCrawler()
|
||||
for (m=s.begin(); m!=s.end(); ++m)
|
||||
{
|
||||
ObjectDescriptor od;
|
||||
|
||||
|
||||
od.sysname=(string)*m;
|
||||
od.addr=m->getAddress();
|
||||
od.netmask=m->getNetmask();
|
||||
od.type=Network::TYPENAME;
|
||||
od.isSelected=false;
|
||||
|
||||
|
||||
Networks[od.sysname.c_str()]= od ;
|
||||
}
|
||||
|
||||
@ -1511,7 +1505,7 @@ void DiscoveryDruid::loadDataFromCrawler()
|
||||
|
||||
int cntr = 0;
|
||||
map<IPAddress, CrawlerFind>::iterator j;
|
||||
for(j = t.begin(); j!=t.end(); ++j,++cntr)
|
||||
for(j = t.begin(); j!=t.end(); ++j,++cntr)
|
||||
{
|
||||
m_dialog->discoveryprogress->setValue( cntr );
|
||||
|
||||
@ -1540,7 +1534,7 @@ void DiscoveryDruid::loadDataFromCrawler()
|
||||
}
|
||||
|
||||
Objects[od.toString().c_str()]=od;
|
||||
|
||||
|
||||
set<string>::iterator si;
|
||||
for(si=od.dns_info.aliases.begin();
|
||||
si!=od.dns_info.aliases.end();
|
||||
@ -1552,9 +1546,9 @@ void DiscoveryDruid::loadDataFromCrawler()
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
(arg==0) ?
|
||||
_("Network scan completed, click 'Next' to continue") :
|
||||
_("There has been an error running the network scan. You can continue but data gathered by the scanner may be incomplete")
|
||||
(arg==0) ?
|
||||
_("Network scan completed, click 'Next' to continue") :
|
||||
_("There has been an error running the network scan. You can continue but data gathered by the scanner may be incomplete")
|
||||
*/
|
||||
}
|
||||
|
||||
@ -1568,29 +1562,29 @@ void DiscoveryDruid::fillListOfNetworks()
|
||||
if (count > 0)
|
||||
{
|
||||
int upd_max=(count > 10)?count/10:1;
|
||||
|
||||
|
||||
int updc=upd_max;
|
||||
|
||||
|
||||
QProgressDialog pd(tr("Copying results ..."), tr("Cancel"), 0, count,this);
|
||||
|
||||
|
||||
QMap<QString, ObjectDescriptor>::iterator i;
|
||||
for(i=Networks.begin();
|
||||
i!=Networks.end();
|
||||
++i)
|
||||
{
|
||||
|
||||
|
||||
if ( flt_net->test(i.value()) )
|
||||
{
|
||||
|
||||
|
||||
m_dialog->networkresultlist->addItem(new QListWidgetItem(i.key()));
|
||||
if (updc--<=0)
|
||||
{
|
||||
pd.setValue(t);
|
||||
qApp->processEvents();
|
||||
|
||||
|
||||
if (pd.wasCanceled())
|
||||
{
|
||||
break;
|
||||
break;
|
||||
}
|
||||
updc=upd_max;
|
||||
}
|
||||
@ -1602,34 +1596,34 @@ void DiscoveryDruid::fillListOfNetworks()
|
||||
|
||||
void DiscoveryDruid::fillListOfObjects()
|
||||
{
|
||||
|
||||
|
||||
m_dialog->objectresultlist->clear();
|
||||
int t=0;
|
||||
int count = Objects.size();
|
||||
if (count > 0)
|
||||
{
|
||||
int upd_max=(count > 10)?count/10:1;
|
||||
|
||||
|
||||
int updc=upd_max;
|
||||
|
||||
|
||||
QProgressDialog pd(tr("Copying results ..."),
|
||||
tr("Cancel"), 0,count,this);
|
||||
|
||||
|
||||
QMap<QString,ObjectDescriptor >::iterator i;
|
||||
for(i=Objects.begin(); i!=Objects.end(); ++i)
|
||||
{
|
||||
if ( flt_obj->test(i.value()) )
|
||||
{
|
||||
|
||||
|
||||
m_dialog->objectresultlist->addItem(new QListWidgetItem(i.key()));
|
||||
if (updc--<=0)
|
||||
{
|
||||
pd.setValue(t);
|
||||
qApp->processEvents();
|
||||
|
||||
|
||||
if (pd.wasCanceled())
|
||||
{
|
||||
break;
|
||||
break;
|
||||
}
|
||||
updc=upd_max;
|
||||
}
|
||||
@ -1638,7 +1632,7 @@ void DiscoveryDruid::fillListOfObjects()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DiscoveryDruid::customEvent(QEvent *event)
|
||||
{
|
||||
int evtype=(int)event->type();
|
||||
@ -1649,10 +1643,10 @@ void DiscoveryDruid::customEvent(QEvent *event)
|
||||
} else if (evtype == DoneEv)
|
||||
{
|
||||
cancelButton->show();
|
||||
|
||||
|
||||
timer->stop();
|
||||
disconnect(timer,SIGNAL(timeout()),0,0);
|
||||
|
||||
|
||||
updateLog();
|
||||
m_dialog->logSaveButton->setEnabled(true);
|
||||
|
||||
@ -1673,7 +1667,7 @@ void DiscoveryDruid::customEvent(QEvent *event)
|
||||
QString er = thread->getError();
|
||||
delete thread;
|
||||
thread=NULL;
|
||||
|
||||
|
||||
switch (current_task)
|
||||
{
|
||||
case BT_HOSTS:
|
||||
@ -1687,7 +1681,7 @@ void DiscoveryDruid::customEvent(QEvent *event)
|
||||
else
|
||||
{
|
||||
backButton->setEnabled(true);
|
||||
nextButton->setEnabled(false);
|
||||
nextButton->setEnabled(false);
|
||||
}
|
||||
break;
|
||||
case BT_IMPORT:
|
||||
@ -1719,7 +1713,7 @@ void DiscoveryDruid::updateLog()
|
||||
{
|
||||
if (monitorOperation() > 0)
|
||||
{
|
||||
|
||||
|
||||
//m_dialog->discoveryprogress->setValue(prg++);
|
||||
}
|
||||
else
|
||||
@ -1730,18 +1724,18 @@ void DiscoveryDruid::updateLog()
|
||||
if (fwbdebug) qDebug("Crawler finished");
|
||||
|
||||
loadDataFromCrawler();
|
||||
|
||||
|
||||
cancelButton->show();
|
||||
|
||||
|
||||
FWException * ex=bop->get_latest_error();
|
||||
if (ex!=NULL)
|
||||
{
|
||||
QMessageBox::critical(this,tr("Discovery error"), ex->toString().c_str());
|
||||
//m_dialog->discoverylog->append(QString("\nLast exception: ")+ex->toString().c_str()+"\n");
|
||||
//m_dialog->discoverylog->append(QString("\nLast exception: ")+ex->toString().c_str()+"\n");
|
||||
}
|
||||
if (Objects.size()>0 || Networks.size()>0)
|
||||
{
|
||||
if (Networks.size()==0)
|
||||
if (Networks.size()==0)
|
||||
setAppropriate( 8,0);
|
||||
nextButton->setEnabled(true);
|
||||
nextButton->setDefault(true);
|
||||
@ -1753,7 +1747,7 @@ void DiscoveryDruid::updateLog()
|
||||
nextButton->setEnabled(false);
|
||||
backButton->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
m_dialog->logSaveButton->setEnabled(true);
|
||||
|
||||
delete bop;
|
||||
@ -1776,15 +1770,15 @@ void DiscoveryDruid::updateLog()
|
||||
{
|
||||
timer->stop();
|
||||
disconnect(timer,SIGNAL(timeout()),0,0);
|
||||
|
||||
|
||||
loadDataFromDNS();
|
||||
|
||||
|
||||
cancelButton->show();
|
||||
FWException * ex=bop->get_latest_error();
|
||||
if (ex!=NULL)
|
||||
{
|
||||
{
|
||||
QMessageBox::critical(this,tr("Discovery error"), ex->toString().c_str());
|
||||
//m_dialog->discoverylog->append(QString("\nLast exception: ")+ex->toString().c_str()+"\n");
|
||||
//m_dialog->discoverylog->append(QString("\nLast exception: ")+ex->toString().c_str()+"\n");
|
||||
}
|
||||
if (Objects.size()>0)
|
||||
{
|
||||
@ -1815,7 +1809,7 @@ void DiscoveryDruid::changedSeedHost()
|
||||
userIsTyping=true;
|
||||
errMessage=m_dialog->seedhosterror_message;
|
||||
HostName=m_dialog->seedhostname->text();
|
||||
|
||||
|
||||
if (HostName.isEmpty())
|
||||
{
|
||||
timer->stop();
|
||||
@ -1839,19 +1833,19 @@ void DiscoveryDruid::changedSeedHost()
|
||||
try
|
||||
{
|
||||
IPAddress(HostName.toLatin1().constData());
|
||||
|
||||
|
||||
QPalette palette = m_dialog->seedhosterror_message->palette();
|
||||
palette.setColor(m_dialog->seedhosterror_message->foregroundRole(), Qt::darkGreen);
|
||||
m_dialog->seedhosterror_message->setPalette(palette);
|
||||
|
||||
m_dialog->seedhosterror_message->setText("Address verified");
|
||||
isSeedHostOK=true;
|
||||
} catch(const FWException &ex)
|
||||
} catch(const FWException &ex)
|
||||
{
|
||||
QPalette palette = m_dialog->seedhosterror_message->palette();
|
||||
palette.setColor(m_dialog->seedhosterror_message->foregroundRole(), Qt::darkRed);
|
||||
m_dialog->seedhosterror_message->setPalette(palette);
|
||||
|
||||
|
||||
m_dialog->seedhosterror_message->setText(ex.toString().c_str());
|
||||
// need to return focus to the input field in case of error
|
||||
//m_dialog->seedhostname->setFocus();
|
||||
@ -1863,10 +1857,10 @@ void DiscoveryDruid::changedSeedHost()
|
||||
QPalette palette = m_dialog->seedhosterror_message->palette();
|
||||
palette.setColor(m_dialog->seedhosterror_message->foregroundRole(), Qt::darkRed);
|
||||
m_dialog->seedhosterror_message->setPalette(palette);
|
||||
|
||||
|
||||
m_dialog->seedhosterror_message->setText("Wrong IPv4 format");
|
||||
isSeedHostOK=false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1887,7 +1881,7 @@ void DiscoveryDruid::changedSeedHost()
|
||||
timer->start(1000);
|
||||
}
|
||||
}
|
||||
nextButton->setEnabled(isSNMPInclNetOK && isSeedHostOK);
|
||||
nextButton->setEnabled(isSNMPInclNetOK && isSeedHostOK);
|
||||
}
|
||||
|
||||
void DiscoveryDruid::changedInclNet()
|
||||
@ -1899,7 +1893,7 @@ void DiscoveryDruid::changedInclNet()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
IPAddress a(m_dialog->snmpinaddr->text().toLatin1().constData());
|
||||
Netmask n(m_dialog->snmpinmask->text().toLatin1().constData());
|
||||
IPNetwork(a,n);
|
||||
@ -1911,7 +1905,7 @@ void DiscoveryDruid::changedInclNet()
|
||||
isSNMPInclNetOK=false;
|
||||
m_dialog->confineerror_message->setText(ex.toString().c_str());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1923,23 +1917,23 @@ void DiscoveryDruid::changedInclNet()
|
||||
else
|
||||
{
|
||||
m_dialog->confineerror_message->setText(" ");
|
||||
isSNMPInclNetOK=true;
|
||||
isSNMPInclNetOK=true;
|
||||
}
|
||||
}
|
||||
nextButton->setEnabled(isSNMPInclNetOK && isSeedHostOK);
|
||||
nextButton->setEnabled(isSNMPInclNetOK && isSeedHostOK);
|
||||
}
|
||||
|
||||
int DiscoveryDruid::monitorOperation()
|
||||
{
|
||||
QString buf;
|
||||
bool fl;
|
||||
|
||||
|
||||
if (fwbdebug) qDebug("monitorOperation bop=%p isRunning=%d",
|
||||
bop,(bop!=NULL)?bop->isRunning():-1);
|
||||
|
||||
|
||||
|
||||
fl=false;
|
||||
while( logger->ready() )
|
||||
while( logger->ready() )
|
||||
{
|
||||
buf= logger->getLine().c_str();
|
||||
if (buf.endsWith('\n'))
|
||||
@ -1963,15 +1957,15 @@ int DiscoveryDruid::monitorOperation()
|
||||
return 0; // BackgroundOp has been disconnected
|
||||
}
|
||||
|
||||
if (bop->isRunning())
|
||||
if (bop->isRunning())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
// send signal "completed", argument is 0 if ok and -1 if error
|
||||
|
||||
|
||||
|
||||
FWException *ex=bop->get_latest_error();
|
||||
if (ex)
|
||||
if (ex)
|
||||
{
|
||||
buf= ex->toString().c_str();
|
||||
if (buf.endsWith('\n'))
|
||||
@ -2018,7 +2012,7 @@ void DiscoveryDruid::checkSNMPCommunity()
|
||||
|
||||
void DiscoveryDruid::changeTargetObject(const QString &buf)
|
||||
{
|
||||
|
||||
|
||||
QTreeWidgetItem* item=m_dialog->typeChangingList->topLevelItem(0);
|
||||
|
||||
while (item!=0)
|
||||
@ -2060,14 +2054,14 @@ void DiscoveryDruid::typeFirewall()
|
||||
|
||||
void DiscoveryDruid::createRealObjects()
|
||||
{
|
||||
|
||||
|
||||
ObjectDescriptor od;
|
||||
string type,name,a;
|
||||
|
||||
|
||||
int t=0;
|
||||
m_dialog->lastprogress->setValue(0);
|
||||
m_dialog->lastprogress->setMaximum( Objects.size());
|
||||
|
||||
|
||||
QMap<QString,ObjectDescriptor >::iterator i;
|
||||
for(i=Networks.begin();
|
||||
i!=Networks.end();
|
||||
@ -2079,47 +2073,47 @@ void DiscoveryDruid::createRealObjects()
|
||||
type = od.type;
|
||||
name=od.sysname;
|
||||
a = od.addr.toString().c_str();
|
||||
|
||||
|
||||
Network *net=dynamic_cast<Network*>(
|
||||
om->createObject(type.c_str(),name.c_str())
|
||||
mw->createObject(type.c_str(),name.c_str())
|
||||
);
|
||||
assert(net!=NULL);
|
||||
net->setName(name);
|
||||
net->setAddress(IPAddress(a));
|
||||
net->setNetmask(Netmask(IPAddress(a)));
|
||||
om->moveObject(m_dialog->libs->currentText(), net);
|
||||
mw->moveObject(m_dialog->libs->currentText(), net);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(i=Objects.begin();
|
||||
i!=Objects.end();
|
||||
++i)
|
||||
{
|
||||
od=i.value();
|
||||
type=od.type;
|
||||
|
||||
|
||||
name=od.sysname;
|
||||
a=od.addr.toString();
|
||||
|
||||
if(od.isSelected)
|
||||
{
|
||||
if (type==Host::TYPENAME || type==Firewall::TYPENAME)
|
||||
if (type==Host::TYPENAME || type==Firewall::TYPENAME)
|
||||
{
|
||||
FWObject *o=NULL;
|
||||
|
||||
o=om->createObject(type.c_str(),name.c_str());
|
||||
o=mw->createObject(type.c_str(),name.c_str());
|
||||
o->setName(name);
|
||||
|
||||
if (od.interfaces.size()==0)
|
||||
if (od.interfaces.size()==0)
|
||||
{
|
||||
Interface *itf= Interface::cast(
|
||||
om->createObject(o,Interface::TYPENAME,"nic1")
|
||||
mw->createObject(o,Interface::TYPENAME,"nic1")
|
||||
);
|
||||
IPv4 *ipv4= IPv4::cast(
|
||||
om->createObject(itf,IPv4::TYPENAME,a.c_str())
|
||||
mw->createObject(itf,IPv4::TYPENAME,a.c_str())
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
ipv4->setAddress(a);
|
||||
ipv4->setNetmask("255.255.255.255");
|
||||
} else
|
||||
@ -2129,13 +2123,13 @@ void DiscoveryDruid::createRealObjects()
|
||||
{
|
||||
Interface in=i->second;
|
||||
Interface *itf=
|
||||
Interface::cast(om->createObject(
|
||||
Interface::cast(mw->createObject(
|
||||
o,
|
||||
Interface::TYPENAME,
|
||||
(i->second).getName().c_str(),
|
||||
&in));
|
||||
om->autorename(itf,IPv4::TYPENAME,"ip");
|
||||
om->autorename(itf,physAddress::TYPENAME,"mac");
|
||||
mw->autorename(itf,IPv4::TYPENAME,"ip");
|
||||
mw->autorename(itf,physAddress::TYPENAME,"mac");
|
||||
}
|
||||
}
|
||||
if (!od.descr.empty())
|
||||
@ -2145,7 +2139,7 @@ void DiscoveryDruid::createRealObjects()
|
||||
opt->setStr("snmp_location", od.location);
|
||||
opt->setStr("snmp_contact", od.contact);
|
||||
}
|
||||
om->moveObject(m_dialog->libs->currentText(), o);
|
||||
mw->moveObject(m_dialog->libs->currentText(), o);
|
||||
if (type==Firewall::TYPENAME)
|
||||
{
|
||||
map<string,string> platforms = Resources::getPlatforms();
|
||||
@ -2164,23 +2158,23 @@ void DiscoveryDruid::createRealObjects()
|
||||
}else if (type==Network::TYPENAME)
|
||||
{
|
||||
Network *net=dynamic_cast<Network*>(
|
||||
om->createObject(type.c_str(),name.c_str())
|
||||
mw->createObject(type.c_str(),name.c_str())
|
||||
);
|
||||
assert(net!=NULL);
|
||||
net->setName(name);
|
||||
net->setAddress(IPAddress(a));
|
||||
net->setNetmask(Netmask(IPAddress(a)));
|
||||
om->moveObject(m_dialog->libs->currentText(), net);
|
||||
mw->moveObject(m_dialog->libs->currentText(), net);
|
||||
}else if (type==IPv4::TYPENAME)
|
||||
{
|
||||
IPv4 *obj=dynamic_cast<IPv4*>(
|
||||
om->createObject(type.c_str(),name.c_str())
|
||||
mw->createObject(type.c_str(),name.c_str())
|
||||
);
|
||||
assert(obj!=NULL);
|
||||
obj->setName(name);
|
||||
obj->setAddress(IPAddress(a));
|
||||
obj->setNetmask("255.255.255.255");
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
}
|
||||
}
|
||||
m_dialog->lastprogress->setValue(t++);
|
||||
@ -2295,7 +2289,7 @@ ObjectDescriptor& ObjectDescriptor::operator=(const ObjectDescriptor& od) {
|
||||
type = od.type;
|
||||
isSelected = od.isSelected;
|
||||
netmask = od.netmask;
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -2315,14 +2309,14 @@ void WorkerThread::setProgress(int p)
|
||||
{
|
||||
ProgressEvent *event=new ProgressEvent();
|
||||
event->value=p;
|
||||
|
||||
|
||||
QApplication::postEvent(Widget,event);
|
||||
}
|
||||
}
|
||||
|
||||
void WorkerThread::done()
|
||||
{
|
||||
DoneEvent *event=new DoneEvent();
|
||||
|
||||
|
||||
QApplication::postEvent(Widget,event);
|
||||
}
|
||||
|
||||
@ -2338,7 +2332,7 @@ void WorkerThread::run()
|
||||
|
||||
// ================================================================
|
||||
|
||||
HostsFileImport::HostsFileImport(const QString &f) :
|
||||
HostsFileImport::HostsFileImport(const QString &f) :
|
||||
WorkerThread()
|
||||
{
|
||||
file_name = f;
|
||||
@ -2348,53 +2342,53 @@ void HostsFileImport::run()
|
||||
{
|
||||
*Log << "Discovery method:"
|
||||
<< "Read file in hosts format. \n";
|
||||
|
||||
|
||||
map<IPAddress, vector<string> > reverse_hosts;
|
||||
HostsFile *hf;
|
||||
/*
|
||||
* read hosts file here
|
||||
* read hosts file here
|
||||
*/
|
||||
hf=new HostsFile();
|
||||
last_error="";
|
||||
setProgress(10);
|
||||
|
||||
|
||||
*Log << "Parsing file: " << file_name.toLatin1().constData() << "\n";
|
||||
if (!file_name.isEmpty())
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
hf->parse( file_name.toAscii().constData() );
|
||||
} catch ( FWException &ex )
|
||||
} catch ( FWException &ex )
|
||||
{
|
||||
last_error = ex.toString().c_str();
|
||||
*Log << "Exception: " << last_error.toAscii().constData() << "\n";
|
||||
|
||||
|
||||
delete hf;
|
||||
done();
|
||||
return;
|
||||
}
|
||||
reverse_hosts=hf->getAll();
|
||||
delete hf;
|
||||
|
||||
|
||||
setProgress(50);
|
||||
*Log << "Loading the list ...\n";
|
||||
/*
|
||||
* convert map format
|
||||
*/
|
||||
hosts.clear();
|
||||
|
||||
|
||||
map<IPAddress,vector<string> >::iterator i;
|
||||
int count=reverse_hosts.size();
|
||||
int t=0;
|
||||
for (i=reverse_hosts.begin(); i!=reverse_hosts.end(); ++i)
|
||||
for (i=reverse_hosts.begin(); i!=reverse_hosts.end(); ++i)
|
||||
{
|
||||
|
||||
|
||||
ObjectDescriptor od;
|
||||
od.addr = (*i).first;
|
||||
od.sysname = ((*i).second).front();
|
||||
|
||||
|
||||
hosts.push_back( od );
|
||||
|
||||
|
||||
setProgress(50+(t++)*50/count);
|
||||
}
|
||||
}
|
||||
@ -2425,10 +2419,10 @@ void ConfigImport::run()
|
||||
|
||||
std::istringstream instream(*buffer);
|
||||
imp = NULL;
|
||||
if (platform == "iosacl") imp = new IOSImporter(om->getCurrentLib(),
|
||||
if (platform == "iosacl") imp = new IOSImporter(mw->getCurrentLib(),
|
||||
instream,
|
||||
Log);
|
||||
if (platform == "iptables") imp = new IPTImporter(om->getCurrentLib(),
|
||||
if (platform == "iptables") imp = new IPTImporter(mw->getCurrentLib(),
|
||||
instream,
|
||||
Log);
|
||||
|
||||
@ -2450,6 +2444,6 @@ void ConfigImport::run()
|
||||
{
|
||||
*Log << "Can not import configuration for choosen platform\n";
|
||||
}
|
||||
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
@ -57,589 +57,6 @@
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QFrame" name="frame13" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="mainSplitter" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame16" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QFrame" name="frame21" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QToolButton" name="infoStyleButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Click here to change amount of information shown about object selected in the tree</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="MainRes.qrc" >:/Icons/info_25.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>8</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QSplitter" name="objInfoSplitter" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="treeFrame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="infoFrame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="rightFrame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="firewallName" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Firewall Name</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Firewalls:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="fwList" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QTabWidget" name="ruleSets" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>144</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab" >
|
||||
<attribute name="title" >
|
||||
<string>Tab 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QFrame" name="auxiliaryPanel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>32767</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QFrame" name="objectEditorFrame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QStackedWidget" name="objectEditorStack" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="WStackPage" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="applyObjectEditorButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeObjectEditorButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="Line" name="line4" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar" >
|
||||
@ -1699,22 +1116,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fwList</sender>
|
||||
<signal>activated(int)</signal>
|
||||
<receiver>FWBMainWindow_q</receiver>
|
||||
<slot>openFirewall(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>helpAboutAction</sender>
|
||||
<signal>triggered()</signal>
|
||||
@ -1763,22 +1164,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>infoStyleButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>FWBMainWindow_q</receiver>
|
||||
<slot>changeInfoStyle()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>insertRuleAction</sender>
|
||||
<signal>triggered()</signal>
|
||||
@ -1971,22 +1356,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>ruleSets</sender>
|
||||
<signal>currentChanged(int)</signal>
|
||||
<receiver>FWBMainWindow_q</receiver>
|
||||
<slot>ruleSetTabChanged(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>toolbarFileNew</sender>
|
||||
<signal>triggered()</signal>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "../../config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -67,7 +69,7 @@ using namespace libfwbuilder;
|
||||
*
|
||||
* So, installation data goes to HKLM Software\NetCitadel\FirewallBuilder
|
||||
* and settings to HKCU Software\NetCitadel\FirewallBuilder2
|
||||
*
|
||||
*
|
||||
* fwbuilder-lm determines folder path for the license file by
|
||||
* reading key Install_Dir under HKLM Software\NetCitadel\FirewallBuilder
|
||||
*/
|
||||
@ -121,7 +123,7 @@ void FWBSettings::init()
|
||||
{
|
||||
bool ok=false;
|
||||
/*
|
||||
QString defwd =
|
||||
QString defwd =
|
||||
#ifdef _WIN32
|
||||
QString(getenv("HOMEPATH"))+"/Firewalls";
|
||||
#else
|
||||
@ -197,7 +199,7 @@ void FWBSettings::init()
|
||||
|
||||
ok = contains(uiFont);
|
||||
if (!ok) setUiFont(QFont("times", 11, QFont::Normal));
|
||||
|
||||
|
||||
ok = contains(clipComment);
|
||||
if (!ok) setClipComment(true);
|
||||
|
||||
@ -231,7 +233,7 @@ void FWBSettings::setBool(const QString &attribute, bool val )
|
||||
setValue(path,val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int FWBSettings::getInt(const QString &attribute)
|
||||
{
|
||||
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
|
||||
@ -244,7 +246,7 @@ void FWBSettings::setInt(const QString &attribute, int val )
|
||||
setValue(path,val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString FWBSettings::getWDir() { return value(wdirSetpath).toString();}
|
||||
void FWBSettings::setWDir( const QString &wd ) { setValue(wdirSetpath,wd);}
|
||||
@ -274,7 +276,7 @@ void FWBSettings::setObjTooltips(bool f) { setValue( objTooltips, f); }
|
||||
|
||||
int FWBSettings::getTooltipDelay() { return value( tooltipDelay ).toInt(); }
|
||||
void FWBSettings::setTooltipDelay(int v) { setValue( tooltipDelay, v); }
|
||||
|
||||
|
||||
|
||||
QString FWBSettings::getLastEdited() { return value(lastEditedSetpath).toString();}
|
||||
void FWBSettings::setLastEdited(const QString &file) { setValue(lastEditedSetpath,file);}
|
||||
@ -303,8 +305,6 @@ void FWBSettings::setSaveFileDir( const QString &d )
|
||||
void FWBSettings::save()
|
||||
{
|
||||
setLastEdited( mw->db()->getFileName().c_str() );
|
||||
|
||||
if (getInfoStyle()!=0) setInfoWindowHeight(oi->geometry().height());
|
||||
}
|
||||
|
||||
bool FWBSettings::getRCSLogState() { return value( emptyRCSLog ).toBool(); }
|
||||
@ -460,7 +460,7 @@ void FWBSettings::saveGeometry(QWidget *w)
|
||||
.arg(p.y())
|
||||
.arg(s.width())
|
||||
.arg(s.height());
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("FWBSettings::saveGeometry widget '%s' vis=%d val=%s",
|
||||
@ -473,7 +473,7 @@ void FWBSettings::saveGeometry(QWidget *w)
|
||||
|
||||
QString FWBSettings::getLabelColorStr(enum LabelColors c)
|
||||
{
|
||||
switch (c)
|
||||
switch (c)
|
||||
{
|
||||
case RED: return "red";
|
||||
case ORANGE: return "orange";
|
||||
@ -515,7 +515,7 @@ void FWBSettings::setSSHPath(const QString &path)
|
||||
{
|
||||
setValue(SSHPath,path);
|
||||
}
|
||||
|
||||
|
||||
void FWBSettings::getPrinterOptions(QPrinter *printer,int &pageWidth,int &pageHeight)
|
||||
{
|
||||
printer->setPrinterName(getStr("PrintSetup/printerName"));
|
||||
@ -549,7 +549,7 @@ void FWBSettings::setPrinterOptions(QPrinter *printer,int pageWidth,int pageH
|
||||
// setInt("PrintSetup/fromPage",printer->fromPage());
|
||||
// setInt("PrintSetup/toPage",printer->toPage());
|
||||
// setInt("PrintSetup/numCopies",printer->numCopies());
|
||||
|
||||
|
||||
setInt("PrintSetup/pageWidth",pageWidth);
|
||||
setInt("PrintSetup/pageHeight",pageHeight);
|
||||
}
|
||||
@ -627,4 +627,4 @@ bool FWBSettings::getClipComment()
|
||||
void FWBSettings::setClipComment(bool clip)
|
||||
{
|
||||
setValue(clipComment, clip);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -59,8 +61,6 @@
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
FWBTree *FWBTree::standardObjectTreeFormat=NULL;
|
||||
|
||||
const char* systemObjects[] = {
|
||||
"Objects",
|
||||
"Objects/Addresses",
|
||||
@ -91,9 +91,6 @@ map<string,bool> standardIDs;
|
||||
|
||||
FWBTree::FWBTree()
|
||||
{
|
||||
assert(standardObjectTreeFormat==NULL);
|
||||
standardObjectTreeFormat=this;
|
||||
|
||||
systemGroupPaths[Library::TYPENAME] = "";
|
||||
|
||||
systemGroupPaths[IPv4::TYPENAME] = "Objects/Addresses";
|
||||
@ -218,7 +215,7 @@ FWBTree::FWBTree()
|
||||
standardIDs["stdid18_1"]=true;
|
||||
standardIDs["stdid19"] =true;
|
||||
standardIDs["stdid19_1"]=true;
|
||||
|
||||
|
||||
|
||||
copyMenuState[""] = false;
|
||||
copyMenuState["Firewalls"] = false;
|
||||
@ -298,7 +295,7 @@ FWBTree::FWBTree()
|
||||
deleteMenuState["Services/TCP"] = false;
|
||||
deleteMenuState["Services/UDP"] = false;
|
||||
deleteMenuState["Services/TagServices"] = false;
|
||||
deleteMenuState["Time"] = false;
|
||||
deleteMenuState["Time"] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -341,8 +338,8 @@ bool FWBTree::validateForInsertion(FWObject *target,FWObject *obj)
|
||||
if (Interface::isA(target) && IPv4::isA(obj)) return true;
|
||||
if (Interface::isA(target) && physAddress::isA(obj)) return true;
|
||||
|
||||
QString parentType = standardObjectTreeFormat->systemGroupTypes[obj->getTypeName().c_str()];
|
||||
QString parentName = standardObjectTreeFormat->systemGroupNames[obj->getTypeName().c_str()];
|
||||
QString parentType = systemGroupTypes[obj->getTypeName().c_str()];
|
||||
QString parentName = systemGroupNames[obj->getTypeName().c_str()];
|
||||
|
||||
/* parentType or/and parentName are going to be empty if information
|
||||
* about object obj is missing in systemGroupTypes/Names tables
|
||||
@ -360,8 +357,8 @@ void FWBTree::getStandardSlotForObject(const QString &objType,
|
||||
QString &parentType,
|
||||
QString &parentName)
|
||||
{
|
||||
parentType = standardObjectTreeFormat->systemGroupTypes[objType];
|
||||
parentName = standardObjectTreeFormat->systemGroupNames[objType];
|
||||
parentType = systemGroupTypes[objType];
|
||||
parentName = systemGroupNames[objType];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -371,7 +368,7 @@ void FWBTree::getStandardSlotForObject(const QString &objType,
|
||||
*/
|
||||
FWObject* FWBTree::getStandardSlotForObject(FWObject* lib,const QString &objType)
|
||||
{
|
||||
QString path = standardObjectTreeFormat->systemGroupPaths[objType];
|
||||
QString path = systemGroupPaths[objType];
|
||||
|
||||
if (path.isEmpty()) return lib;
|
||||
|
||||
@ -408,11 +405,11 @@ FWObject* FWBTree::createNewLibrary(FWObjectDatabase *db)
|
||||
o2 = db->create(ObjectGroup::TYPENAME);
|
||||
o2->setName("DNS Names");
|
||||
o1->add(o2);
|
||||
|
||||
|
||||
o2 = db->create(ObjectGroup::TYPENAME);
|
||||
o2->setName("Address Tables");
|
||||
o1->add(o2);
|
||||
|
||||
|
||||
o2 = db->create(ObjectGroup::TYPENAME);
|
||||
o2->setName("Groups");
|
||||
o1->add(o2);
|
||||
|
||||
@ -46,10 +46,10 @@ class FWBTree {
|
||||
|
||||
FWBTree();
|
||||
|
||||
static bool isSystem(libfwbuilder::FWObject *obj);
|
||||
static bool isStandardId(libfwbuilder::FWObject *obj);
|
||||
bool isSystem(libfwbuilder::FWObject *obj);
|
||||
bool isStandardId(libfwbuilder::FWObject *obj);
|
||||
|
||||
static bool validateForInsertion(libfwbuilder::FWObject *target,libfwbuilder::FWObject *obj);
|
||||
bool validateForInsertion(libfwbuilder::FWObject *target,libfwbuilder::FWObject *obj);
|
||||
|
||||
/**
|
||||
* returns boolean value that defines whether menu item "Copy"
|
||||
@ -57,39 +57,37 @@ class FWBTree {
|
||||
* in the tree. By default menu items are enabled, so this method
|
||||
* returns True if object path is unknown.
|
||||
*/
|
||||
static bool getCopyMenuState(const QString &objPath) {
|
||||
if (standardObjectTreeFormat->copyMenuState.count(objPath)!=0)
|
||||
return standardObjectTreeFormat->copyMenuState[objPath];
|
||||
bool getCopyMenuState(const QString &objPath) {
|
||||
if (copyMenuState.count(objPath)!=0)
|
||||
return copyMenuState[objPath];
|
||||
else
|
||||
return true;
|
||||
}
|
||||
static bool getCutMenuState(const QString &objPath) {
|
||||
if (standardObjectTreeFormat->cutMenuState.count(objPath)!=0)
|
||||
return standardObjectTreeFormat->cutMenuState[objPath];
|
||||
bool getCutMenuState(const QString &objPath) {
|
||||
if (cutMenuState.count(objPath)!=0)
|
||||
return cutMenuState[objPath];
|
||||
else
|
||||
return true;
|
||||
}
|
||||
static bool getPasteMenuState(const QString &objPath) {
|
||||
if (standardObjectTreeFormat->pasteMenuState.count(objPath)!=0)
|
||||
return standardObjectTreeFormat->pasteMenuState[objPath];
|
||||
bool getPasteMenuState(const QString &objPath) {
|
||||
if (pasteMenuState.count(objPath)!=0)
|
||||
return pasteMenuState[objPath];
|
||||
else
|
||||
return true;
|
||||
}
|
||||
static bool getDeleteMenuState(const QString &objPath) {
|
||||
if (standardObjectTreeFormat->deleteMenuState.count(objPath)!=0)
|
||||
return standardObjectTreeFormat->deleteMenuState[objPath];
|
||||
bool getDeleteMenuState(const QString &objPath) {
|
||||
if (deleteMenuState.count(objPath)!=0)
|
||||
return deleteMenuState[objPath];
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
static void getStandardSlotForObject(const QString &objType,
|
||||
void getStandardSlotForObject(const QString &objType,
|
||||
QString &parentType,
|
||||
QString &parentName);
|
||||
static libfwbuilder::FWObject* getStandardSlotForObject(libfwbuilder::FWObject* lib,
|
||||
libfwbuilder::FWObject* getStandardSlotForObject(libfwbuilder::FWObject* lib,
|
||||
const QString &objType);
|
||||
static libfwbuilder::FWObject* createNewLibrary(libfwbuilder::FWObjectDatabase *db);
|
||||
|
||||
static FWBTree *standardObjectTreeFormat;
|
||||
libfwbuilder::FWObject* createNewLibrary(libfwbuilder::FWObjectDatabase *db);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -18,13 +18,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -65,7 +67,7 @@ FWObjectDropArea::FWObjectDropArea(QWidget*p, const char * n, Qt::WFlags f):
|
||||
setObjectName( QString(n) );
|
||||
setWindowFlags( f );
|
||||
m_objectDropArea = new Ui::FWObjectDropArea_q;
|
||||
m_objectDropArea->setupUi(this);
|
||||
m_objectDropArea->setupUi(this);
|
||||
object=NULL;
|
||||
|
||||
}
|
||||
@ -73,9 +75,9 @@ void FWObjectDropArea::paintEvent(QPaintEvent *ev)
|
||||
{
|
||||
int w=width();
|
||||
int h=height();
|
||||
|
||||
|
||||
QPainter p(this);
|
||||
|
||||
|
||||
QPixmap bufferpixmap;
|
||||
bufferpixmap = QPixmap( w , h );
|
||||
bufferpixmap.fill( Qt::white );
|
||||
@ -87,8 +89,8 @@ void FWObjectDropArea::paintEvent(QPaintEvent *ev)
|
||||
tp.drawLine(w-1,h-1,0,h-1);
|
||||
tp.drawLine(0,h-1,0,0);
|
||||
tp.fillRect(1, 1, w-2, h-2, Qt::white);
|
||||
|
||||
if (object!=NULL)
|
||||
|
||||
if (object!=NULL)
|
||||
{
|
||||
|
||||
QPixmap pm;
|
||||
@ -101,21 +103,21 @@ void FWObjectDropArea::paintEvent(QPaintEvent *ev)
|
||||
}
|
||||
|
||||
tp.drawPixmap( ((w-pm.width())/2), (h/2)-(2+pm.height()) , pm );
|
||||
|
||||
|
||||
QString t=QString::fromUtf8(object->getName().c_str());
|
||||
|
||||
|
||||
int t_x=2;
|
||||
int t_y=2+h/2;
|
||||
int t_w=w-4;
|
||||
int t_h=h/2-4;
|
||||
|
||||
|
||||
tp.drawText( t_x, t_y , t_w, t_h ,
|
||||
Qt::AlignHCenter|Qt::AlignTop|Qt::TextWordWrap, t );
|
||||
}
|
||||
else
|
||||
{
|
||||
QString t=tr("Drop object here.");
|
||||
|
||||
|
||||
int t_x=2;
|
||||
int t_y=2;
|
||||
int t_w=w-4;
|
||||
@ -124,11 +126,11 @@ void FWObjectDropArea::paintEvent(QPaintEvent *ev)
|
||||
tp.drawText( t_x, t_y , t_w, t_h ,
|
||||
Qt::AlignHCenter|Qt::AlignVCenter|Qt::TextWordWrap, t );
|
||||
|
||||
|
||||
|
||||
}
|
||||
tp.end();
|
||||
p.drawPixmap( 0, 0, bufferpixmap );
|
||||
|
||||
|
||||
}
|
||||
void FWObjectDropArea::insertObject(libfwbuilder::FWObject *o)
|
||||
{
|
||||
@ -150,15 +152,15 @@ void FWObjectDropArea::deleteObject()
|
||||
void FWObjectDropArea::contextMenuEvent (QContextMenuEvent * e)
|
||||
{
|
||||
QMenu *popup;
|
||||
|
||||
|
||||
popup=new QMenu(this);
|
||||
QAction *psAct = popup->addAction( tr("Paste") , this , SLOT( pasteObject( )) );
|
||||
popup->addSeparator();
|
||||
QAction *dlAct = popup->addAction( tr("Delete") , this , SLOT( deleteObject( )) );
|
||||
|
||||
|
||||
dlAct->setEnabled(object!=NULL);
|
||||
psAct->setEnabled(FWObjectClipboard::obj_clipboard->size()>0);
|
||||
|
||||
|
||||
popup->exec(e->globalPos ());
|
||||
delete popup;
|
||||
}
|
||||
@ -170,7 +172,7 @@ void FWObjectDropArea::dropEvent( QDropEvent *ev)
|
||||
qDebug("FWObjectDropArea::dropEvent drop event mode=%d", ev->dropAction());
|
||||
qDebug(" src widget = %p", ev->source());
|
||||
}
|
||||
|
||||
|
||||
list<FWObject*> dragol;
|
||||
if (FWObjectDrag::decode(ev, dragol))
|
||||
{
|
||||
@ -195,5 +197,5 @@ void FWObjectDropArea::pasteObject()
|
||||
FWObject *co= mw->db()->findInIndex(*i);
|
||||
insertObject(co);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils_no_qt.h"
|
||||
@ -101,7 +103,7 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
|
||||
{
|
||||
str << QObject::tr("DNS record: ")
|
||||
<< DNSName::cast(obj)->getSourceName().c_str();
|
||||
} else if (AddressTable::isA(obj))
|
||||
} else if (AddressTable::isA(obj))
|
||||
{
|
||||
str << QObject::tr("Address Table: ")
|
||||
<< AddressTable::cast(obj)->getSourceName().c_str();
|
||||
@ -120,16 +122,16 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
|
||||
|
||||
QDateTime dt;
|
||||
time_t t;
|
||||
|
||||
|
||||
t=obj->getInt("lastModified");dt.setTime_t(t);
|
||||
QString t_modified = (t)? dt.toString():"-";
|
||||
|
||||
|
||||
t=obj->getInt("lastCompiled");dt.setTime_t(t);
|
||||
QString t_compiled = (t)? dt.toString():"-";
|
||||
|
||||
|
||||
t=obj->getInt("lastInstalled");dt.setTime_t(t);
|
||||
QString t_installed = (t)? dt.toString():"-";
|
||||
|
||||
|
||||
str << platform << "(" << readableVersion << ") / " << hostOS;
|
||||
|
||||
} else if (Host::isA(obj))
|
||||
@ -137,10 +139,10 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
|
||||
str << Address::cast(obj)->getAddress().toString().c_str();
|
||||
|
||||
FWObject *co=obj->getFirstByType("Interface");
|
||||
if (co!=NULL)
|
||||
if (co!=NULL)
|
||||
{
|
||||
physAddress *paddr=(Interface::cast(co))->getPhysicalAddress();
|
||||
if (paddr!=NULL)
|
||||
if (paddr!=NULL)
|
||||
str << " " << paddr->getPhysAddress().c_str();
|
||||
}
|
||||
|
||||
@ -162,7 +164,7 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
|
||||
} else if (Interface::isA(obj))
|
||||
{
|
||||
physAddress *paddr=(Interface::cast(obj))->getPhysicalAddress();
|
||||
if (paddr!=NULL)
|
||||
if (paddr!=NULL)
|
||||
{
|
||||
str << " ";
|
||||
str << paddr->getPhysAddress().c_str();
|
||||
@ -189,7 +191,7 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
|
||||
|
||||
str << sps << ":" << spe << " / ";
|
||||
str << dps << ":" << dpe;
|
||||
} else if (TagService::isA(obj))
|
||||
} else if (TagService::isA(obj))
|
||||
{
|
||||
str << "Pattern: \"" << obj->getStr("tagcode").c_str() << "\"" ;
|
||||
} else if (Interval::isA(obj))
|
||||
@ -283,7 +285,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
str += MultiAddress::cast(obj)->getSourceName().c_str();
|
||||
str += "<br>\n";
|
||||
str += (MultiAddress::cast(obj)->isRunTime())?QObject::tr("Run-time"):QObject::tr("Compile-time");
|
||||
|
||||
|
||||
} else if (AddressRange::isA(obj))
|
||||
{
|
||||
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
|
||||
@ -298,10 +300,10 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
str += Address::cast(obj)->getAddress().toString().c_str() ;
|
||||
|
||||
FWObject *co=obj->getFirstByType("Interface");
|
||||
if (co!=NULL)
|
||||
if (co!=NULL)
|
||||
{
|
||||
physAddress *paddr=(Interface::cast(co))->getPhysicalAddress();
|
||||
if (paddr!=NULL)
|
||||
if (paddr!=NULL)
|
||||
str += QString(" ") + paddr->getPhysAddress().c_str() ;
|
||||
}
|
||||
|
||||
@ -328,7 +330,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
{
|
||||
str += " . . . ";
|
||||
break;
|
||||
} else
|
||||
} else
|
||||
{
|
||||
FWObject *o1=*i;
|
||||
if (FWReference::cast(o1)!=NULL)
|
||||
@ -343,25 +345,25 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
QString version = obj->getStr("version").c_str();
|
||||
QString readableVersion = getVersionString(platform,version);
|
||||
QString hostOS = obj->getStr("host_OS").c_str();
|
||||
|
||||
|
||||
QDateTime dt;
|
||||
time_t lm=obj->getInt("lastModified");
|
||||
time_t lc=obj->getInt("lastCompiled");
|
||||
time_t li=obj->getInt("lastInstalled");
|
||||
|
||||
|
||||
dt.setTime_t(lm);
|
||||
QString t_modified = (lm)? dt.toString():"-";
|
||||
if (lm>lc && lm>li) t_modified=QString("<b>")+t_modified+"</b>";
|
||||
|
||||
|
||||
dt.setTime_t(lc);
|
||||
QString t_compiled = (lc)? dt.toString():"-";
|
||||
if (lc>lm && lc>li) t_compiled=QString("<b>")+t_compiled+"</b>";
|
||||
|
||||
|
||||
dt.setTime_t(li);
|
||||
QString t_installed = (li)? dt.toString():"-";
|
||||
if (li>lc && li>lm) t_installed=QString("<b>")+t_installed+"</b>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
|
||||
str += "<table cellspacing=\"0\" cellpadding=\"0\">";
|
||||
@ -371,14 +373,14 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
readableVersion + "</td></tr>\n";
|
||||
str += QString("<tr><td>Host OS:</td><td>") +
|
||||
hostOS + "</td></tr>\n";
|
||||
|
||||
|
||||
str += QString("<tr><td>Modified:</td><td>") +
|
||||
t_modified + "</td></tr>\n";
|
||||
str += QString("<tr><td>Compiled:</td><td>") +
|
||||
t_compiled + "</td></tr>\n";
|
||||
str += QString("<tr><td>Installed:</td><td>") +
|
||||
t_installed + "</td></tr>\n";
|
||||
|
||||
|
||||
str += "</table>";
|
||||
} else if (Interface::isA(obj))
|
||||
{
|
||||
@ -387,7 +389,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
if (Interface::constcast(obj)->isDyn()) q=" dyn";
|
||||
if (Interface::constcast(obj)->isUnnumbered()) q=" unnum";
|
||||
if (Interface::constcast(obj)->isBridgePort()) q=" bridge port";
|
||||
|
||||
|
||||
FWObject *p=obj;
|
||||
while (p!=NULL && !Firewall::isA(p)) p=p->getParent();
|
||||
if (p!=NULL && (p->getStr("platform")=="pix" || p->getStr("platform")=="fwsm"))
|
||||
@ -400,18 +402,18 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
}
|
||||
|
||||
if (Interface::constcast(obj)->isUnprotected()) q=q+" unp";
|
||||
|
||||
|
||||
if (q!="") str += " (" + q + ")";
|
||||
str += "<br>\n";
|
||||
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
|
||||
|
||||
physAddress *paddr=(Interface::cast(obj))->getPhysicalAddress();
|
||||
if (paddr!=NULL)
|
||||
if (paddr!=NULL)
|
||||
{
|
||||
str += " ";
|
||||
str += paddr->getPhysAddress().c_str() ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (CustomService::isA(obj))
|
||||
{
|
||||
@ -466,7 +468,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
|
||||
str += QString("<tr><td>destination port range</td><td>%1:%2</td></tr>\n")
|
||||
.arg(dps).arg(dpe);
|
||||
str += "</table>";
|
||||
} else if (TagService::isA(obj))
|
||||
} else if (TagService::isA(obj))
|
||||
{
|
||||
str += QObject::tr("Pattern: \"%1\"").arg(obj->getStr("tagcode").c_str());
|
||||
} else if (Interval::isA(obj))
|
||||
@ -494,13 +496,13 @@ QString FWObjectPropertiesFactory::getRuleActionProperties(PolicyRule *rule)
|
||||
if (rule!=NULL)
|
||||
{
|
||||
string act = rule->getActionAsString();
|
||||
|
||||
|
||||
FWObject *o = rule;
|
||||
while (o!=NULL && Firewall::cast(o)==NULL) o=o->getParent();
|
||||
assert(o!=NULL);
|
||||
Firewall *f=Firewall::cast(o);
|
||||
string platform=f->getStr("platform");
|
||||
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
string editor=Resources::getActionEditor(platform,act);
|
||||
|
||||
@ -541,7 +543,7 @@ QString FWObjectPropertiesFactory::getRuleActionProperties(PolicyRule *rule)
|
||||
case PolicyRule::Pipe :
|
||||
if (platform=="ipfw")
|
||||
{
|
||||
par = QString("divert ") +
|
||||
par = QString("divert ") +
|
||||
ropt->getStr("ipfw_pipe_port_num").c_str();
|
||||
}
|
||||
break;
|
||||
@ -562,7 +564,7 @@ QString FWObjectPropertiesFactory::getRuleActionProperties(PolicyRule *rule)
|
||||
a = ropt->getStr("ipf_route_option");
|
||||
if (!a.empty())
|
||||
{
|
||||
par = par + " "+
|
||||
par = par + " "+
|
||||
getScreenName(a.c_str(),
|
||||
getRouteOptions_pf_ipf( platform.c_str() ));
|
||||
}
|
||||
@ -587,9 +589,9 @@ QString FWObjectPropertiesFactory::getRuleActionProperties(PolicyRule *rule)
|
||||
default : {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return par;
|
||||
}
|
||||
|
||||
@ -598,7 +600,7 @@ QString FWObjectPropertiesFactory::getRuleActionPropertiesRich(PolicyRule *rule)
|
||||
FWObject *p=rule;
|
||||
while (p!=NULL && !Firewall::isA(p)) p=p->getParent();
|
||||
assert(p!=NULL);
|
||||
string platform=p->getStr("platform");
|
||||
string platform=p->getStr("platform");
|
||||
QString act = getActionNameForPlatform(rule->getAction(),platform.c_str());
|
||||
|
||||
QString par = getRuleActionProperties(rule);
|
||||
@ -613,7 +615,7 @@ QString FWObjectPropertiesFactory::getRuleActionPropertiesRich(PolicyRule *rule)
|
||||
QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
{
|
||||
QString res;
|
||||
|
||||
|
||||
if (rule!=NULL)
|
||||
{
|
||||
res="";
|
||||
@ -623,7 +625,7 @@ QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
Firewall *f=Firewall::cast(o);
|
||||
string platform=f->getStr("platform");
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
|
||||
|
||||
if (platform=="iptables")
|
||||
{
|
||||
if (!ropt->getStr("log_prefix").empty())
|
||||
@ -644,26 +646,26 @@ QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
res+=QObject::tr("<b>Netlink group :</b> ");
|
||||
res+=QString(ropt->getStr("ulog_nlgroup").c_str())+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
if (ropt->getInt("limit_value")>0)
|
||||
{
|
||||
res+=QObject::tr("<b>Limit Value :</b> ");
|
||||
res+=QString(ropt->getStr("limit_value").c_str())+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
if (!ropt->getStr("limit_suffix").empty())
|
||||
{
|
||||
res+=QObject::tr("<b>Limit suffix :</b> ");
|
||||
res+=getScreenName(ropt->getStr("limit_suffix").c_str(),
|
||||
getLimitSuffixes(platform.c_str()))+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
if (ropt->getInt("limit_burst")>0)
|
||||
{
|
||||
res+=QObject::tr("<b>Limit burst :</b> ");
|
||||
res+=QString(ropt->getStr("limit_burst").c_str())+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
res+="<ul>";
|
||||
if (ropt->getBool("firewall_is_part_of_any_and_networks"))
|
||||
{
|
||||
@ -677,8 +679,8 @@ QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
res+="<br>\n";
|
||||
}
|
||||
res+="</ul>";
|
||||
|
||||
}else if (platform=="ipf")
|
||||
|
||||
}else if (platform=="ipf")
|
||||
{
|
||||
if (!ropt->getStr("ipf_log_facility").empty())
|
||||
{
|
||||
@ -686,14 +688,14 @@ QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
res+=getScreenName(ropt->getStr("ipf_log_facility").c_str(),
|
||||
getLogFacilities(platform.c_str()))+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
if (!ropt->getStr("log_level").empty())
|
||||
{
|
||||
res+=QObject::tr("<b>Log level :</b> ");
|
||||
res+=getScreenName(ropt->getStr("log_level").c_str(),
|
||||
getLogLevels(platform.c_str()))+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
res+="<ul>";
|
||||
if (ropt->getBool("ipf_return_icmp_as_dest"))
|
||||
{
|
||||
@ -713,43 +715,43 @@ QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
res+="<br>\n";
|
||||
}
|
||||
res+="</ul>";
|
||||
|
||||
|
||||
}else if (platform=="pf")
|
||||
{
|
||||
|
||||
|
||||
if (!ropt->getStr("log_prefix").empty())
|
||||
{
|
||||
res+=QObject::tr("<b>Log prefix :</b> ");
|
||||
res+=QString(ropt->getStr("log_prefix").c_str())+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
if (ropt->getInt("pf_rule_max_state")>0)
|
||||
{
|
||||
res+=QObject::tr("<b>Max state :</b> ");
|
||||
res+=QString(ropt->getStr("pf_rule_max_state").c_str())+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
res+="<ul>";
|
||||
if (ropt->getBool("stateless"))
|
||||
{
|
||||
res+=QObject::tr("<li><b>Stateless</b></li> ");
|
||||
res+="<br>\n";
|
||||
}
|
||||
|
||||
|
||||
if (ropt->getBool("pf_source_tracking"))
|
||||
{
|
||||
res+=QObject::tr("<li><b>Source tracking</b></li> ");
|
||||
res+="<br>\n";
|
||||
|
||||
|
||||
res+=QObject::tr("<b>Max src nodes :</b> ");
|
||||
res+=QString(ropt->getStr("pf_max_src_nodes").c_str())+"<br>\n";
|
||||
|
||||
|
||||
res+=QObject::tr("<b>Max src states:</b> ");
|
||||
res+=QString(ropt->getStr("pf_max_src_states").c_str())+"<br>\n";
|
||||
|
||||
|
||||
}
|
||||
res+="</ul>";
|
||||
|
||||
|
||||
}else if (platform=="ipfw")
|
||||
{
|
||||
res+="<ul>";
|
||||
@ -759,17 +761,17 @@ QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
res+="<br>\n";
|
||||
}
|
||||
res+="</ul>";
|
||||
|
||||
|
||||
}else if (platform=="pix" || platform=="fwsm")
|
||||
{
|
||||
string vers="version_"+f->getStr("version");
|
||||
|
||||
|
||||
res+=QObject::tr("<u><b>Ver:%1</b></u><br>\n").arg(vers.c_str());
|
||||
|
||||
|
||||
if ( Resources::platform_res[platform]->getResourceBool(
|
||||
"/FWBuilderResources/Target/options/"+vers+"/pix_rule_syslog_settings"))
|
||||
{
|
||||
|
||||
|
||||
if (!ropt->getStr("log_level").empty())
|
||||
{
|
||||
res+=QObject::tr("<b>Log level :</b> ");
|
||||
@ -781,7 +783,7 @@ QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
res+=QObject::tr("<b>Log interval :</b> ");
|
||||
res+=QString(ropt->getStr("log_interval").c_str())+"<br>\n";
|
||||
}
|
||||
|
||||
|
||||
res+="<ul>";
|
||||
if (ropt->getBool("disable_logging_for_this_rule"))
|
||||
{
|
||||
@ -789,19 +791,19 @@ QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
|
||||
res+="<br>\n";
|
||||
}
|
||||
res+="</ul>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QString FWObjectPropertiesFactory::getNATRuleOptions(Rule *rule)
|
||||
{
|
||||
QString res;
|
||||
|
||||
|
||||
if (rule!=NULL)
|
||||
{
|
||||
res="";
|
||||
@ -814,7 +816,7 @@ QString FWObjectPropertiesFactory::getNATRuleOptions(Rule *rule)
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug(QString("getNATRuleOptions: platform: %2").arg(platform.c_str()).toAscii().constData());
|
||||
|
||||
|
||||
if (platform=="pf")
|
||||
{
|
||||
if (ropt->getBool("pf_bitmask")) res+=QObject::tr("bitmask");
|
||||
@ -825,7 +827,7 @@ QString FWObjectPropertiesFactory::getNATRuleOptions(Rule *rule)
|
||||
if (ropt->getBool("pf_static_port")) res+=QObject::tr("static-port");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
2778
src/gui/FWWindow.cpp
2778
src/gui/FWWindow.cpp
File diff suppressed because it is too large
Load Diff
@ -30,13 +30,8 @@
|
||||
#include <ui_FWBMainWindow_q.h>
|
||||
#include "RCS.h"
|
||||
#include "ObjectEditor.h"
|
||||
#include "FindObjectWidget.h"
|
||||
#include "FindWhereUsedWidget.h"
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
#include <qstring.h>
|
||||
#include <QCloseEvent>
|
||||
#include <QShowEvent>
|
||||
#include <QHideEvent>
|
||||
|
||||
@ -48,36 +43,26 @@ namespace libfwbuilder {
|
||||
class Firewall;
|
||||
class PolicyRule;
|
||||
class RuleSet;
|
||||
class FWObject;
|
||||
|
||||
};
|
||||
|
||||
class QTabWidget;
|
||||
class RuleSetView;
|
||||
class QTimer;
|
||||
class QPrinter;
|
||||
class QTextEdit;
|
||||
class ObjectTreeView;
|
||||
class ObjectManipulator;
|
||||
class findDialog;
|
||||
class ProjectPanel;
|
||||
class QMdiArea;
|
||||
|
||||
class FWWindow : public QMainWindow {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
RCS *rcs;
|
||||
bool systemFile;
|
||||
bool editingStandardLib;
|
||||
bool editingTemplateLib;
|
||||
bool changingTabs;
|
||||
bool safeMode;
|
||||
bool ruleSetRedrawPending;
|
||||
|
||||
QString startupFileName;
|
||||
|
||||
std::vector<libfwbuilder::FWObject*> firewalls;
|
||||
std::map<libfwbuilder::FWObject*, RuleSetView*> ruleSetViews;
|
||||
int ruleSetTabIndex;
|
||||
|
||||
libfwbuilder::FWObject *visibleFirewall;
|
||||
libfwbuilder::FWObjectDatabase *objdb;
|
||||
libfwbuilder::FWObject *shownInInfo;
|
||||
|
||||
QWidget *editorOwner;
|
||||
QMdiArea *m_space;
|
||||
QWidget *instd;
|
||||
|
||||
QTimer *autosaveTimer;
|
||||
@ -86,10 +71,11 @@ class FWWindow : public QMainWindow {
|
||||
QPrinter *printer;
|
||||
libfwbuilder::FWObject *searchObject;
|
||||
libfwbuilder::FWObject *replaceObject;
|
||||
int lastFirewallIdx;
|
||||
|
||||
void clearFirewallTabs();
|
||||
//int lastFirewallIdx;
|
||||
|
||||
void clearFirewallTabs();
|
||||
ProjectPanel* activeProject();
|
||||
ProjectPanel *newProjectPanel();
|
||||
public slots:
|
||||
|
||||
virtual void search();
|
||||
@ -161,26 +147,17 @@ class FWWindow : public QMainWindow {
|
||||
virtual void closeEditorPanel();
|
||||
virtual void openEditorPanel();
|
||||
|
||||
virtual void rollBackSelectionSameWidget();
|
||||
virtual void rollBackSelectionDifferentWidget();
|
||||
|
||||
virtual void killInstDialog();
|
||||
|
||||
signals:
|
||||
void restoreSelection_sign(bool same_widget);
|
||||
|
||||
public:
|
||||
Ui::FWBMainWindow_q *m_mainWindow;
|
||||
|
||||
FindObjectWidget *findObjectWidget;
|
||||
FindWhereUsedWidget *findWhereUsedWidget;
|
||||
|
||||
FWWindow();
|
||||
~FWWindow();
|
||||
|
||||
virtual void closeEvent( QCloseEvent * );
|
||||
RCS * getRCS();
|
||||
|
||||
|
||||
libfwbuilder::FWObject* getVisibleFirewalls();
|
||||
void load(QWidget *dialogs_parent,RCS *rcs);
|
||||
void load(QWidget *dialogs_parent);
|
||||
void loadLibrary(const std::string &libfpath);
|
||||
@ -219,20 +196,19 @@ class FWWindow : public QMainWindow {
|
||||
* selects whatever is current in rules
|
||||
*/
|
||||
void selectRules();
|
||||
void disableActions(bool havePolicies);
|
||||
void setActionsEnabled(bool en);
|
||||
void setEnabledAfterRF();
|
||||
|
||||
libfwbuilder::FWObjectDatabase* db() { return objdb; }
|
||||
|
||||
libfwbuilder::FWObject* getVisibleFirewall() { return visibleFirewall; }
|
||||
QString getCurrentFileName();
|
||||
|
||||
void info(libfwbuilder::FWObject *o, bool forced = false);
|
||||
|
||||
void setupAutoSave();
|
||||
void findObject(libfwbuilder::FWObject *);
|
||||
void findWhereUsed(libfwbuilder::FWObject *);
|
||||
RuleSetView* getRuleSetViews(libfwbuilder::FWObject *o)
|
||||
{return ruleSetViews[o];};
|
||||
|
||||
void findWhereUsed(libfwbuilder::FWObject *);
|
||||
|
||||
void addPolicyBranchTab(libfwbuilder::RuleSet *subset);
|
||||
void removePolicyBranchTab(libfwbuilder::RuleSet *subset);
|
||||
void setPolicyBranchTabName(libfwbuilder::RuleSet *subset);
|
||||
@ -246,8 +222,6 @@ class FWWindow : public QMainWindow {
|
||||
libfwbuilder::FWObject *o,
|
||||
ObjectEditor::OptType otype,
|
||||
bool validate = true);
|
||||
void releaseEditor();
|
||||
void connectEditor(QWidget *w);
|
||||
bool exportLibraryTest(std::list<libfwbuilder::FWObject*> &selectedLibs);
|
||||
void exportLibraryTo(QString fname,std::list<libfwbuilder::FWObject*> &selectedLibs, bool rof);
|
||||
|
||||
@ -255,8 +229,8 @@ class FWWindow : public QMainWindow {
|
||||
libfwbuilder::FWObject *root,
|
||||
std::list<libfwbuilder::FWReference*> &extRefs);
|
||||
|
||||
void setSafeMode(bool f) { safeMode=f; }
|
||||
void setStartupFileName(const QString &fn) { startupFileName = fn; }
|
||||
void setSafeMode(bool f);
|
||||
void setStartupFileName(const QString &fn);
|
||||
|
||||
void scheduleRuleSetRedraw();
|
||||
|
||||
@ -270,7 +244,107 @@ class FWWindow : public QMainWindow {
|
||||
// is returned (however on windows and mac userDataDir is returned)
|
||||
|
||||
QString getDestDir(const QString &filename);
|
||||
|
||||
//wrapers for some ObjectManipulator functions
|
||||
libfwbuilder::FWObject* getOpened();
|
||||
|
||||
libfwbuilder::FWObject* getCurrentLib();
|
||||
|
||||
libfwbuilder::FWObject* createObject(const QString &objType,
|
||||
const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom=NULL);
|
||||
|
||||
libfwbuilder::FWObject* createObject(libfwbuilder::FWObject *parent,
|
||||
const QString &objType,
|
||||
const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom=NULL);
|
||||
|
||||
void moveObject(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj);
|
||||
|
||||
void moveObject(const QString &targetLibName,
|
||||
libfwbuilder::FWObject *obj);
|
||||
|
||||
void autorename(libfwbuilder::FWObject *obj,
|
||||
const std::string &objtype,
|
||||
const std::string &namesuffix);
|
||||
|
||||
void updateLibColor(libfwbuilder::FWObject *lib);
|
||||
void updateLibName(libfwbuilder::FWObject *lib);
|
||||
|
||||
void updateObjName(libfwbuilder::FWObject *obj,
|
||||
const QString &oldName,
|
||||
bool askForAutorename=true);
|
||||
void updateObjName(libfwbuilder::FWObject *obj,
|
||||
const QString &oldName,
|
||||
const QString &oldLabel,
|
||||
bool askForAutorename=true);
|
||||
|
||||
void updateLastModifiedTimestampForOneFirewall(libfwbuilder::FWObject *o);
|
||||
void updateLastModifiedTimestampForAllFirewalls(libfwbuilder::FWObject *o);
|
||||
void updateLastInstalledTimestamp(libfwbuilder::FWObject *o);
|
||||
void updateLastCompiledTimestamp(libfwbuilder::FWObject *o);
|
||||
|
||||
void loadDataFromFw(libfwbuilder::Firewall *fw);
|
||||
|
||||
libfwbuilder::FWObject* pasteTo(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj,
|
||||
bool openobj=true,
|
||||
bool validateOnly=false);
|
||||
void delObj(libfwbuilder::FWObject *obj,bool openobj=true);
|
||||
ObjectTreeView* getCurrentObjectTree();
|
||||
void openObject(QTreeWidgetItem *otvi);
|
||||
void openObject(libfwbuilder::FWObject *obj);
|
||||
bool editObject(libfwbuilder::FWObject *obj);
|
||||
void findAllFirewalls (std::list<libfwbuilder::Firewall *> &fws);
|
||||
|
||||
libfwbuilder::FWObject* duplicateObject(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj,
|
||||
const QString &name = QString::null,
|
||||
bool askForAutorename=true);
|
||||
void showDeletedObjects(bool f);
|
||||
void select();
|
||||
void unselect();
|
||||
void info();
|
||||
|
||||
|
||||
void setManipulatorFocus();
|
||||
void clearManipulatorFocus();
|
||||
|
||||
//wrapers for some Object Editor functions
|
||||
bool isEditorVisible();
|
||||
bool isEditorModified();
|
||||
|
||||
void showEditor();
|
||||
void hideEditor();
|
||||
void closeEditor();
|
||||
|
||||
void openEditor(libfwbuilder::FWObject *o);
|
||||
void openOptEditor(libfwbuilder::FWObject *, ObjectEditor::OptType t);
|
||||
void blankEditor();
|
||||
|
||||
libfwbuilder::FWObject* getOpenedEditor();
|
||||
ObjectEditor::OptType getOpenedOptEditor();
|
||||
|
||||
void selectObjectInEditor(libfwbuilder::FWObject *o);
|
||||
|
||||
void actionChangedEditor(libfwbuilder::FWObject *o);
|
||||
bool validateAndSaveEditor();
|
||||
//find dialog functions wrapers
|
||||
void setFDObject(libfwbuilder::FWObject *o);
|
||||
|
||||
void addToRCSActionSetEn(bool en);
|
||||
void fileDiscardActionSetEn(bool en);
|
||||
void fileCommitActionSetEn(bool en);
|
||||
void fileSaveActionSetEn(bool en);
|
||||
QPrinter* getPrinter();
|
||||
libfwbuilder::FWObjectDatabase* db();
|
||||
QString printHeader();
|
||||
listOfLibraries *getAddOnLibs();
|
||||
libfwbuilder::FWObject* getStandardSlotForObject(libfwbuilder::FWObject* lib,
|
||||
const QString &objType);
|
||||
|
||||
bool isSystem(libfwbuilder::FWObject *obj);
|
||||
protected:
|
||||
|
||||
virtual void showEvent( QShowEvent *ev);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -85,6 +87,9 @@
|
||||
#include "fwbuilder/RuleElement.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "ProjectPanel.h"
|
||||
#include <QMdiArea>
|
||||
#include <QMdiSubWindow>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
@ -127,7 +132,7 @@ list<FWObject*> findAllUsedByType(list<FWObject*> &result,FWObject *obj,const st
|
||||
{
|
||||
if (RuleElement::cast(obj)!=NULL)
|
||||
{
|
||||
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
|
||||
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
|
||||
{
|
||||
FWObject *o=*m;
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
@ -138,11 +143,11 @@ list<FWObject*> findAllUsedByType(list<FWObject*> &result,FWObject *obj,const st
|
||||
|
||||
if (RuleSet::cast(obj)!=NULL)
|
||||
{
|
||||
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
|
||||
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
|
||||
{
|
||||
if (Rule::cast(*m)!=NULL)
|
||||
{
|
||||
for (list<FWObject*>::iterator n=(*m)->begin(); n!=(*m)->end(); n++)
|
||||
for (list<FWObject*>::iterator n=(*m)->begin(); n!=(*m)->end(); n++)
|
||||
{
|
||||
if (RuleElement::cast(*n)!=NULL)
|
||||
{
|
||||
@ -228,7 +233,7 @@ int addObjectsToTable(list<FWObject*> &objects,
|
||||
//comment.replace("\n", "");
|
||||
//comment.replace(" ", "\n");
|
||||
|
||||
|
||||
|
||||
tbl->setItem(row,col+1, new QTableWidgetItem(descr));
|
||||
tbl->setItem(row,col+2, new QTableWidgetItem(comment));
|
||||
|
||||
@ -266,7 +271,8 @@ void findAllGroups(list<FWObject*> &objects,list<FWObject*> &groups)
|
||||
void printFirewall(FWObject *fw,
|
||||
printerStream &pr,
|
||||
PrintingProgressDialog *ppd,
|
||||
bool newPageForSection)
|
||||
bool newPageForSection,
|
||||
ProjectPanel *project)
|
||||
{
|
||||
|
||||
list<pixmapOrText> listPT;
|
||||
@ -291,7 +297,7 @@ void printFirewall(FWObject *fw,
|
||||
|
||||
pr.printText(QObject::tr("Global Policy"));
|
||||
|
||||
RuleSetView *ruleView=new PolicyView(
|
||||
RuleSetView *ruleView=new PolicyView(project,
|
||||
Policy::cast(fw->getFirstByType(Policy::TYPENAME)),NULL);
|
||||
ruleView->setSizePolicy( QSizePolicy( (QSizePolicy::Policy)7,
|
||||
(QSizePolicy::Policy)7) );
|
||||
@ -342,7 +348,7 @@ void printFirewall(FWObject *fw,
|
||||
|
||||
pr.printText(QObject::tr("Interface %1").arg(tabName));
|
||||
|
||||
ruleView=new InterfacePolicyView(ip,NULL);
|
||||
ruleView=new InterfacePolicyView(project, ip,NULL);
|
||||
ruleView->setSizePolicy( QSizePolicy( (QSizePolicy::Policy)7,
|
||||
(QSizePolicy::Policy)7) );
|
||||
ruleView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
@ -370,7 +376,7 @@ void printFirewall(FWObject *fw,
|
||||
|
||||
pr.printText(QObject::tr("NAT"));
|
||||
|
||||
ruleView=new NATView(nat,NULL);
|
||||
ruleView=new NATView(project, nat,NULL);
|
||||
|
||||
ruleView->setSizePolicy( QSizePolicy( (QSizePolicy::Policy)7,
|
||||
(QSizePolicy::Policy)7) );
|
||||
@ -397,7 +403,7 @@ void printFirewall(FWObject *fw,
|
||||
|
||||
pr.printText(QObject::tr("Routing"));
|
||||
|
||||
ruleView=new RoutingView(routing,NULL);
|
||||
ruleView=new RoutingView(project, routing,NULL);
|
||||
|
||||
ruleView->setSizePolicy( QSizePolicy( (QSizePolicy::Policy)7,
|
||||
(QSizePolicy::Policy)7) );
|
||||
@ -414,6 +420,12 @@ void printFirewall(FWObject *fw,
|
||||
|
||||
void FWWindow::filePrint()
|
||||
{
|
||||
if (!activeProject())
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("There isn't any selected subwindow");
|
||||
return;
|
||||
}
|
||||
int pageWidth = 0;
|
||||
int pageHeight = 0;
|
||||
bool fullPage = false;
|
||||
@ -448,7 +460,7 @@ void FWWindow::filePrint()
|
||||
|
||||
Ui::pageSetupDialog_q psd;
|
||||
QDialog dlg;
|
||||
|
||||
|
||||
psd.setupUi(&dlg);
|
||||
|
||||
psd.newPageForSection->setChecked(newPageForSection);
|
||||
@ -486,11 +498,11 @@ void FWWindow::filePrint()
|
||||
printer->setFullPage(fullPage);
|
||||
|
||||
QPrintDialog pdialog(printer, this);
|
||||
|
||||
|
||||
pdialog.addEnabledOption(QAbstractPrintDialog::PrintPageRange);
|
||||
pdialog.setMinMax(1,9999);
|
||||
pdialog.setPrintRange(QAbstractPrintDialog::AllPages);
|
||||
|
||||
|
||||
if (pdialog.exec())
|
||||
{
|
||||
int fromPage = printer->fromPage();
|
||||
@ -502,8 +514,7 @@ void FWWindow::filePrint()
|
||||
|
||||
PrintingProgressDialog *ppd = new PrintingProgressDialog(this,printer,0,false);
|
||||
|
||||
QString headerText = rcs->getFileName().section("/",-1,-1);
|
||||
if (rcs->isInRCS()) headerText = headerText + ", rev " + rcs->getSelectedRev();
|
||||
QString headerText = mw->printHeader();
|
||||
|
||||
#if defined(Q_OS_MACX)
|
||||
printerStream pr(printer,margin,printHeader,headerText,NULL);
|
||||
@ -522,16 +533,16 @@ void FWWindow::filePrint()
|
||||
|
||||
int leftMargin = printer->paperRect().left() - printer->pageRect().left();
|
||||
int topMargin = printer->paperRect().top() - printer->pageRect().top();
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("Margins: %d,%d",leftMargin,topMargin);
|
||||
}
|
||||
|
||||
// int ppdCounter = 1;
|
||||
printFirewall(activeProject()->getVisibleFirewall(),pr,ppd,
|
||||
newPageForSection, activeProject());
|
||||
|
||||
printFirewall(visibleFirewall,pr,ppd,newPageForSection);
|
||||
|
||||
if (printLegend)
|
||||
{
|
||||
if (fwbdebug) qDebug("******** Legend");
|
||||
@ -553,15 +564,15 @@ void FWWindow::filePrint()
|
||||
(QSizePolicy::Policy)7) );
|
||||
legendTbl.setShowGrid(false);
|
||||
legendTbl.setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
|
||||
|
||||
legendTbl.horizontalHeader()->hide();
|
||||
legendTbl.verticalHeader()->hide();
|
||||
//legendTbl.setTopMargin(0);
|
||||
//legendTbl.setLeftMargin(0);
|
||||
|
||||
|
||||
legendTbl.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
legendTbl.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
|
||||
|
||||
string icon_path="/FWBuilderResources/Type/";
|
||||
int row=0;
|
||||
@ -602,7 +613,7 @@ void FWWindow::filePrint()
|
||||
|
||||
bfrp.fillRect(0,0,32,32,QColor(Qt::white));
|
||||
bfrp.drawPixmap(4,4,pm);
|
||||
|
||||
|
||||
QTableWidgetItem *itm = new QTableWidgetItem;
|
||||
itm->setIcon(QIcon(bfr));
|
||||
itm->setText(objName);
|
||||
@ -650,11 +661,11 @@ void FWWindow::filePrint()
|
||||
// (QSizePolicy::Policy)7) );
|
||||
//fwObjTbl.setColumnStretchable(2, true);
|
||||
fwObjTbl.setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
|
||||
|
||||
fwObjTbl.horizontalHeader()->hide();
|
||||
fwObjTbl.verticalHeader()->hide();
|
||||
fwObjTbl.setContentsMargins(0,0,0,0);
|
||||
|
||||
|
||||
fwObjTbl.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
fwObjTbl.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
fwObjTbl.resize(pr.getWorkspaceWidth(),
|
||||
@ -668,14 +679,15 @@ void FWWindow::filePrint()
|
||||
int added = 0;
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,Firewall::TYPENAME);
|
||||
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),Firewall::TYPENAME);
|
||||
added = addObjectsToTable(objects, &fwObjTbl, row, col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d firewalls",added);
|
||||
|
||||
for (int i=0; i<fwObjTbl.columnCount(); ++i)
|
||||
fwObjTbl.resizeColumnToContents(i);
|
||||
for (int i=0; i<fwObjTbl.rowCount(); ++i)
|
||||
fwObjTbl.resizeRowToContents(i);
|
||||
fwObjTbl.resizeRowToContents(i);
|
||||
|
||||
pr.printQTable(&fwObjTbl, false, false);
|
||||
pr.printText(" ");
|
||||
@ -686,11 +698,11 @@ void FWWindow::filePrint()
|
||||
objTbl.setSizePolicy( QSizePolicy( (QSizePolicy::Policy)7,
|
||||
(QSizePolicy::Policy)7) );
|
||||
objTbl.setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
|
||||
|
||||
objTbl.horizontalHeader()->hide();
|
||||
objTbl.verticalHeader()->hide();
|
||||
setContentsMargins ( 0,0,0,0 );
|
||||
|
||||
|
||||
objTbl.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
objTbl.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
@ -699,7 +711,7 @@ void FWWindow::filePrint()
|
||||
added = 0;
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,Host::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),Host::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d hosts",added);
|
||||
if (added)
|
||||
@ -712,7 +724,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,Network::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),Network::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d networks",added);
|
||||
if (added)
|
||||
@ -725,7 +737,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,IPv4::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),IPv4::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d addresses",added);
|
||||
if (added)
|
||||
@ -738,7 +750,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,AddressRange::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),AddressRange::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d address ranges",added);
|
||||
if (added)
|
||||
@ -751,7 +763,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,ObjectGroup::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),ObjectGroup::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d obj groups",added);
|
||||
if (added)
|
||||
@ -765,7 +777,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,IPService::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),IPService::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d ip services",added);
|
||||
if (added)
|
||||
@ -778,7 +790,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,ICMPService::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),ICMPService::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d icmp services",added);
|
||||
if (added)
|
||||
@ -791,7 +803,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,TCPService::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),TCPService::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d tcp services",added);
|
||||
if (added)
|
||||
@ -804,7 +816,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,UDPService::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),UDPService::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d udp services",added);
|
||||
if (added)
|
||||
@ -817,7 +829,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,CustomService::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),CustomService::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d custom services",added);
|
||||
if (added)
|
||||
@ -830,7 +842,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,ServiceGroup::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),ServiceGroup::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d srv groups",added);
|
||||
if (added)
|
||||
@ -844,7 +856,7 @@ void FWWindow::filePrint()
|
||||
}
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,Interval::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),Interval::TYPENAME);
|
||||
added=addObjectsToTable(objects,&objTbl,row,col);
|
||||
if (fwbdebug) qDebug("Objects table: added %d time intervals",added);
|
||||
if (added)
|
||||
@ -873,11 +885,11 @@ void FWWindow::filePrint()
|
||||
list<FWObject*> groups;
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,ObjectGroup::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),ObjectGroup::TYPENAME);
|
||||
findAllGroups(objects,groups);
|
||||
|
||||
objects.clear();
|
||||
findAllUsedByType(objects,visibleFirewall,ServiceGroup::TYPENAME);
|
||||
findAllUsedByType(objects,activeProject()->getVisibleFirewall(),ServiceGroup::TYPENAME);
|
||||
findAllGroups(objects,groups);
|
||||
|
||||
for (FWObject::iterator obj=groups.begin(); obj!=groups.end(); ++obj)
|
||||
@ -886,14 +898,14 @@ void FWWindow::filePrint()
|
||||
objTbl.setSizePolicy( QSizePolicy( (QSizePolicy::Policy)7,
|
||||
(QSizePolicy::Policy)7) );
|
||||
objTbl.setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
|
||||
|
||||
objTbl.setContentsMargins(0,0,0,0);
|
||||
objTbl.horizontalHeader()->hide();
|
||||
objTbl.verticalHeader()->hide();
|
||||
|
||||
|
||||
objTbl.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
objTbl.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
|
||||
row = 0;
|
||||
col = 0;
|
||||
list<FWObject*> groupMembers;
|
||||
@ -919,7 +931,7 @@ void FWWindow::filePrint()
|
||||
for (int i=0; i<objTbl.columnCount(); ++i)
|
||||
objTbl.resizeColumnToContents(i);
|
||||
for (int i=0; i<objTbl.rowCount(); ++i)
|
||||
objTbl.resizeRowToContents(i);
|
||||
objTbl.resizeRowToContents(i);
|
||||
|
||||
pr.printText((*obj)->getName().c_str());
|
||||
pr.printQTable(&objTbl, false, false);
|
||||
@ -937,7 +949,7 @@ void FWWindow::filePrint()
|
||||
{
|
||||
statusBar()->showMessage( tr("Printing aborted"), 2000 );
|
||||
QMessageBox::information(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Printing aborted"),
|
||||
tr("&Continue"), QString::null,QString::null,
|
||||
0, 1 );
|
||||
@ -954,4 +966,4 @@ void FWWindow::filePrint()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -45,7 +47,7 @@
|
||||
#include <qlineedit.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qtextedit.h>
|
||||
#include <qcombobox.h>
|
||||
@ -60,7 +62,7 @@
|
||||
#include <qcursor.h>
|
||||
#include <qregexp.h>
|
||||
#include <qtablewidget.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
@ -87,16 +89,16 @@ void FilterDialog::setFilter(Filter * f)
|
||||
QString p_n;
|
||||
QString p_a;
|
||||
int f_a,f_n,f_w,f_c;
|
||||
|
||||
|
||||
f_w=flt->isWildcard();
|
||||
f_c=flt->isCaseSens();
|
||||
f_a=flt->flt_addr;
|
||||
f_n=flt->flt_name;
|
||||
p_a=flt->getAddrPattern();
|
||||
p_n=flt->getNamePattern();
|
||||
|
||||
|
||||
init(f_w,f_c,f_a,f_n,p_a,p_n);
|
||||
*/
|
||||
*/
|
||||
//table->setColumnStretchable(2,true);
|
||||
}
|
||||
void FilterDialog::apply()
|
||||
@ -131,8 +133,8 @@ void FilterDialog::save()
|
||||
"Save file dialog",
|
||||
dir,
|
||||
"FWBuilder filter files (*.fwf)");
|
||||
|
||||
|
||||
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
if (!s.endsWith(".fwf"))
|
||||
@ -141,10 +143,10 @@ void FilterDialog::save()
|
||||
}
|
||||
|
||||
xmlDocPtr doc;
|
||||
|
||||
|
||||
xmlNodePtr node;
|
||||
//xmlNodePtr tree;
|
||||
|
||||
|
||||
doc = xmlNewDoc(TOXMLCAST("1.0"));
|
||||
doc->children = xmlNewDocNode(doc, NULL, TOXMLCAST("FWB_FILTER"), NULL);
|
||||
|
||||
@ -164,20 +166,20 @@ void FilterDialog::save()
|
||||
buf=QString("%1").arg(((QComboBox*)m_dialog->table->cellWidget(i,0))->currentIndex());
|
||||
xmlSetProp(node,(const xmlChar*) "Target",
|
||||
TOXMLCAST(buf.toLatin1().constData()) );
|
||||
|
||||
|
||||
buf=QString("%1").arg(((QComboBox*)m_dialog->table->cellWidget(i,1))->currentIndex());
|
||||
xmlSetProp(node, (const xmlChar*) "Type",
|
||||
TOXMLCAST(buf.toLatin1().constData()) );
|
||||
|
||||
|
||||
xmlSetProp(node, (const xmlChar*) "Pattern",
|
||||
TOXMLCAST(m_dialog->table->item(i,2)->text().toLatin1().constData()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
xmlSaveFile(s.toLatin1().constData(),doc);
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
void FilterDialog::load()
|
||||
{
|
||||
@ -185,17 +187,17 @@ void FilterDialog::load()
|
||||
dir=st->getWDir();
|
||||
if (dir.isEmpty()) dir=st->getOpenFileDir();
|
||||
if (dir.isEmpty()) dir="~";
|
||||
|
||||
|
||||
QString s = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
"Open file dialog",
|
||||
dir,
|
||||
"FWBuilder filter files (*.fwf)");
|
||||
|
||||
|
||||
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
|
||||
|
||||
xmlDocPtr doc=xmlParseFile(s.toLatin1().constData());
|
||||
//TODO: use local codepage
|
||||
if (doc == NULL)
|
||||
@ -212,7 +214,7 @@ void FilterDialog::load()
|
||||
xmlFreeDoc(doc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (xmlStrcmp(node->name,(const xmlChar*) "FWB_FILTER"))
|
||||
{
|
||||
qDebug("document of the wrong type. (FWB_FILTER)");
|
||||
@ -232,7 +234,7 @@ void FilterDialog::load()
|
||||
qbuf=FROMXMLCAST(xmlbuf);
|
||||
FREEXMLBUFF(xmlbuf);
|
||||
m_dialog->combo->setCurrentIndex(qbuf.toInt());
|
||||
|
||||
|
||||
|
||||
node=node->xmlChildrenNode;
|
||||
while (node != NULL)
|
||||
@ -243,33 +245,33 @@ void FilterDialog::load()
|
||||
xmlFreeDoc(doc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
addPattern();
|
||||
int n=m_dialog->table->rowCount()-1;
|
||||
|
||||
|
||||
|
||||
|
||||
xmlbuf=xmlGetProp(node,(const xmlChar*) "Target");
|
||||
qbuf=FROMXMLCAST(xmlbuf);
|
||||
FREEXMLBUFF(xmlbuf);
|
||||
((QComboBox*)m_dialog->table->cellWidget(n,0))->setCurrentIndex(
|
||||
qbuf.toInt());
|
||||
|
||||
|
||||
xmlbuf=xmlGetProp(node,(const xmlChar*) "Type");
|
||||
qbuf=FROMXMLCAST(xmlbuf);
|
||||
FREEXMLBUFF(xmlbuf);
|
||||
((QComboBox*)m_dialog->table->cellWidget(n,1))->setCurrentIndex(
|
||||
qbuf.toInt());
|
||||
|
||||
|
||||
|
||||
xmlbuf=xmlGetProp(node,(const xmlChar*) "Pattern");
|
||||
qbuf=FROMXMLCAST(xmlbuf);
|
||||
FREEXMLBUFF(xmlbuf);
|
||||
m_dialog->table->item(n,2)->setText(qbuf);
|
||||
|
||||
|
||||
node=node->next;
|
||||
}
|
||||
}
|
||||
LastFile=s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FilterDialog::update()
|
||||
@ -280,7 +282,7 @@ void FilterDialog::update()
|
||||
newflt.setMatchAny(m_dialog->combo->currentIndex());
|
||||
newflt.setCaseSens(m_dialog->case_sensitive->isChecked());
|
||||
newflt.clear();
|
||||
|
||||
|
||||
int n=m_dialog->table->rowCount();
|
||||
for(int i=0; i<n;i++)
|
||||
{
|
||||
@ -302,16 +304,16 @@ void FilterDialog::update()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (newflt.isValid())
|
||||
{
|
||||
*flt=newflt;
|
||||
}
|
||||
/*
|
||||
bool res=false;
|
||||
|
||||
|
||||
Filter newflt;
|
||||
|
||||
|
||||
newflt.setAddrPattern( addresspattern->text());
|
||||
newflt.setNamePattern( namepattern->text());
|
||||
|
||||
@ -320,13 +322,13 @@ void FilterDialog::update()
|
||||
|
||||
newflt.flt_name = name_checkbox->isChecked();
|
||||
newflt.flt_addr = addr_checkbox->isChecked();
|
||||
|
||||
|
||||
if (newflt.isValid())
|
||||
{
|
||||
*flt=newflt;
|
||||
res=true;
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
*/
|
||||
}
|
||||
@ -345,9 +347,9 @@ bool FilterDialog::validate()
|
||||
m_dialog->table->selectRow(i);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
QRegExp FilterDialog::constructRegExp(int p)
|
||||
@ -358,13 +360,13 @@ QRegExp FilterDialog::constructRegExp(int p)
|
||||
Qt::CaseSensitive:Qt::CaseInsensitive);
|
||||
switch(((QComboBox*)m_dialog->table->cellWidget(p,1))->currentIndex())
|
||||
{
|
||||
case FWF_CONTAINS:
|
||||
case FWF_CONTAINS:
|
||||
{
|
||||
r.setPatternSyntax(QRegExp::Wildcard);
|
||||
buf=m_dialog->table->item(p,2)->text().toLatin1().constData();
|
||||
break;
|
||||
}
|
||||
case FWF_IS_EQUAL_TO:
|
||||
case FWF_IS_EQUAL_TO:
|
||||
{
|
||||
r.setPatternSyntax(QRegExp::RegExp);
|
||||
buf="^";
|
||||
@ -372,27 +374,27 @@ QRegExp FilterDialog::constructRegExp(int p)
|
||||
buf+="$";
|
||||
break;
|
||||
}
|
||||
case FWF_STARTS_WITH:
|
||||
case FWF_STARTS_WITH:
|
||||
{
|
||||
r.setPatternSyntax(QRegExp::RegExp);
|
||||
buf="^";
|
||||
buf+=m_dialog->table->item(p,2)->text().toLatin1().constData();
|
||||
break;
|
||||
}
|
||||
case FWF_ENDS_WITH:
|
||||
case FWF_ENDS_WITH:
|
||||
{
|
||||
r.setPatternSyntax(QRegExp::RegExp);
|
||||
buf=m_dialog->table->item(p,2)->text().toLatin1().constData();
|
||||
buf+="$";
|
||||
break;
|
||||
}
|
||||
case FWF_MATCHES_WILDCARD:
|
||||
case FWF_MATCHES_WILDCARD:
|
||||
{
|
||||
r.setPatternSyntax(QRegExp::Wildcard);
|
||||
buf=m_dialog->table->item(p,2)->text().toLatin1().constData();
|
||||
break;
|
||||
}
|
||||
case FWF_MATCHES_REGEXP:
|
||||
case FWF_MATCHES_REGEXP:
|
||||
{
|
||||
r.setPatternSyntax(QRegExp::RegExp);
|
||||
buf=m_dialog->table->item(p,2)->text().toLatin1().constData();
|
||||
@ -408,11 +410,11 @@ QRegExp FilterDialog::constructRegExp(int p)
|
||||
void FilterDialog::addPattern()
|
||||
{
|
||||
updateData();
|
||||
|
||||
|
||||
QStringList trg;
|
||||
trg+=tr("Name");
|
||||
trg+=tr("Address");
|
||||
|
||||
|
||||
QStringList tp;
|
||||
tp+=tr("Contains");
|
||||
tp+=tr("Is equal to");
|
||||
@ -420,22 +422,22 @@ void FilterDialog::addPattern()
|
||||
tp+=tr("Ends with");
|
||||
tp+=tr("Matches Wildcard");
|
||||
tp+=tr("Matches RegExp");
|
||||
|
||||
|
||||
int n=m_dialog->table->rowCount();
|
||||
m_dialog->table->setRowCount(n+1);
|
||||
|
||||
|
||||
QComboBox *cb = new QComboBox(m_dialog->table);
|
||||
cb->addItems(trg);
|
||||
m_dialog->table->setCellWidget(n,0,cb);
|
||||
|
||||
|
||||
cb = new QComboBox(m_dialog->table);
|
||||
cb->addItems(tp);
|
||||
m_dialog->table->setCellWidget(n,1,cb);
|
||||
|
||||
|
||||
QTableWidgetItem *itm = new QTableWidgetItem;
|
||||
itm->setFlags(itm->flags() | Qt::ItemIsEditable);
|
||||
m_dialog->table->setItem(n,2,itm);
|
||||
|
||||
|
||||
/*m_dialog->table->setItem(n,0,new QTableWidgetItem(m_dialog->table,trg));
|
||||
m_dialog->table->setItem(n,1,new QTableWidgetItem(m_dialog->table,tp));
|
||||
//table->setItem(n,2,new QTableWidgetItem(table,QTableWidgetItem::Always));
|
||||
@ -457,7 +459,7 @@ void FilterDialog::updateData()
|
||||
int row=m_dialog->table->currentRow();
|
||||
QTableWidgetItem * item=m_dialog->table->item(row,2);
|
||||
QWidget * w =m_dialog->table->cellWidget (row,2 );
|
||||
if (w) item->setText ( ((QComboBox*)w)->currentText() );
|
||||
if (w) item->setText ( ((QComboBox*)w)->currentText() );
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool Filter::isCaseSens()
|
||||
@ -472,7 +474,7 @@ void Filter::addAddrRegExp(const QRegExp &r)
|
||||
{
|
||||
addr_patterns.push_back(r);
|
||||
}
|
||||
|
||||
|
||||
QString Filter::getNamePatternString(int p)
|
||||
{
|
||||
return name_patterns[p].pattern();
|
||||
@ -506,8 +508,8 @@ Filter & Filter::operator=(const Filter& f)
|
||||
name_patterns=f.name_patterns;
|
||||
CaseSensitive=f.CaseSensitive;
|
||||
MatchAny=f.MatchAny;
|
||||
|
||||
return *this;
|
||||
|
||||
return *this;
|
||||
}
|
||||
/*
|
||||
void FilterDialog::closeEvent(QCloseEvent *e)
|
||||
@ -555,7 +557,7 @@ bool Filter::testName(const QString &s)
|
||||
{
|
||||
int cmp;
|
||||
if (name_patterns.isEmpty())
|
||||
{
|
||||
{
|
||||
return addr_patterns.isEmpty() || !MatchAny;
|
||||
}
|
||||
for (int i=0;i<name_patterns.size();i++)
|
||||
@ -580,7 +582,7 @@ bool Filter::testAddr(const QString &s)
|
||||
{
|
||||
return (name_patterns.isEmpty() || !MatchAny);
|
||||
}
|
||||
|
||||
|
||||
for (int i=0;i<addr_patterns.size();i++)
|
||||
{
|
||||
addr_patterns[i].setCaseSensitivity(Qt::CaseSensitive);
|
||||
@ -608,5 +610,5 @@ bool Filter::isValid()
|
||||
{
|
||||
bool res=true;
|
||||
//TODO: Filter validity test
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -31,10 +33,8 @@
|
||||
|
||||
#include <QLineEdit>
|
||||
#include "FindObjectWidget.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
#include "FWObjectDropArea.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWBTree.h"
|
||||
#include "FWBSettings.h"
|
||||
#include "ObjectTreeView.h"
|
||||
@ -74,17 +74,17 @@ FindObjectWidget::FindObjectWidget(QWidget*p, const char * n, Qt::WindowFlags f)
|
||||
{
|
||||
m_widget = new Ui::findObjectWidget_q;
|
||||
m_widget->setupUi(this);
|
||||
|
||||
|
||||
setObjectName(n);
|
||||
|
||||
|
||||
replaceDisable();
|
||||
m_widget->srScope->setCurrentIndex(st->getInt("/FirewallBuilder2/Search/Scope"));
|
||||
}
|
||||
void FindObjectWidget::findObject(FWObject *o)
|
||||
{
|
||||
if (fwbdebug) qDebug("FindObjectWidget::findObject");
|
||||
show();
|
||||
m_widget->findDropArea->insertObject(o);
|
||||
show();
|
||||
m_widget->findDropArea->insertObject(o);
|
||||
|
||||
}
|
||||
|
||||
@ -108,14 +108,14 @@ void FindObjectWidget::objectInserted()
|
||||
FWObject *o=m_widget->findDropArea->getObject();
|
||||
if (o==NULL) return;
|
||||
disableAll();
|
||||
|
||||
|
||||
QString n=QString::fromUtf8(o->getName().c_str());
|
||||
|
||||
|
||||
if (m_widget->findAttr->count()>=MAX_SEARCH_ITEMS_COUNT)
|
||||
m_widget->findAttr->removeItem(MAX_SEARCH_ITEMS_COUNT-1);
|
||||
|
||||
|
||||
m_widget->findAttr->lineEdit()->setText (n);
|
||||
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ bool FindObjectWidget::matchID(const QString &id)
|
||||
{
|
||||
if (m_widget->findDropArea->isEmpty()) return true;
|
||||
QString s=QString::fromUtf8(m_widget->findDropArea->getObject()->getId().c_str() );
|
||||
|
||||
|
||||
return s==id;
|
||||
}
|
||||
bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
||||
@ -173,13 +173,13 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
||||
case 0: // Name
|
||||
{
|
||||
QString name=QString::fromUtf8( obj->getName().c_str() );
|
||||
|
||||
|
||||
if (m_widget->useRegexp->isChecked()) res= ( name.indexOf( QRegExp(s) )!=-1 );
|
||||
else res= ( name == s );
|
||||
|
||||
|
||||
//res= ( name == s );
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
case 1: // Address
|
||||
{
|
||||
@ -187,10 +187,10 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
||||
if (a!=NULL)
|
||||
{
|
||||
QString addr = a->getAddress().toString().c_str();
|
||||
|
||||
|
||||
if (m_widget->useRegexp->isChecked()) res= ( addr.indexOf( QRegExp(s) )!=-1 );
|
||||
else res= ( addr == s );
|
||||
|
||||
|
||||
//res= ( addr == s );
|
||||
}
|
||||
break;
|
||||
@ -198,7 +198,7 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
||||
case 2: // port
|
||||
if (TCPService::cast(obj)!=NULL || UDPService::cast(obj)!=NULL)
|
||||
{
|
||||
if (m_widget->useRegexp->isChecked())
|
||||
if (m_widget->useRegexp->isChecked())
|
||||
{
|
||||
QString port;
|
||||
port.setNum(obj->getInt("src_range_start"));
|
||||
@ -224,7 +224,7 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
||||
case 3: // protocol num.
|
||||
if (IPService::cast(obj)!=NULL)
|
||||
{
|
||||
if (m_widget->useRegexp->isChecked())
|
||||
if (m_widget->useRegexp->isChecked())
|
||||
{
|
||||
QString proto;
|
||||
proto.setNum(obj->getInt("protocol_num"));
|
||||
@ -241,7 +241,7 @@ bool FindObjectWidget::matchAttr(libfwbuilder::FWObject *obj)
|
||||
case 4: // icmp type
|
||||
if (ICMPService::cast(obj)!=NULL)
|
||||
{
|
||||
if (m_widget->useRegexp->isChecked())
|
||||
if (m_widget->useRegexp->isChecked())
|
||||
{
|
||||
QString icmptype;
|
||||
icmptype.setNum(obj->getInt("type"));
|
||||
@ -267,7 +267,7 @@ void FindObjectWidget::findNext()
|
||||
m_widget->findAttr->currentText().isEmpty() &&
|
||||
m_widget->findDropArea->isEmpty()) return;
|
||||
|
||||
if (m_widget->findAttr->count()>MAX_SEARCH_ITEMS_COUNT)
|
||||
if (m_widget->findAttr->count()>MAX_SEARCH_ITEMS_COUNT)
|
||||
m_widget->findAttr->removeItem(0);
|
||||
|
||||
FWObject *o=NULL;
|
||||
@ -287,7 +287,7 @@ loop:
|
||||
if ( !inSelectedFirewall(RuleElement::cast(o->getParent())) )
|
||||
{
|
||||
continue;
|
||||
|
||||
|
||||
}
|
||||
} else if (m_widget->srScope->currentIndex()==0) continue ; // scope == tree only
|
||||
} else
|
||||
@ -299,7 +299,7 @@ loop:
|
||||
if (FWReference::cast(o)!=NULL)
|
||||
{
|
||||
FWReference *r=FWReference::cast(o);
|
||||
if (
|
||||
if (
|
||||
matchAttr( r->getPointer() ) &&
|
||||
matchID( QString::fromUtf8(r->getPointer()->getId().c_str()) )) break;
|
||||
} else
|
||||
@ -318,7 +318,7 @@ loop:
|
||||
if (m_widget->srScope->currentIndex()==3) // scope ==selected firewalls
|
||||
{
|
||||
if ( QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Search hit the end of the policy rules."),
|
||||
tr("&Continue at top"), tr("&Stop"), QString::null, 0, 1 )==0 ) goto loop;
|
||||
}
|
||||
@ -326,7 +326,7 @@ loop:
|
||||
{
|
||||
if (fwbdebug) qDebug("widget that has focus: %p",mw->focusWidget());
|
||||
bool r= ( QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Search hit the end of the object tree."),
|
||||
tr("&Continue at top"), tr("&Stop"), QString::null, 0, 1 )==0 );
|
||||
if (fwbdebug) qDebug("widget that has focus: %p",mw->focusWidget());
|
||||
@ -339,11 +339,11 @@ loop:
|
||||
/* found object. Shift iterator so it does not return the same object
|
||||
* when user hits 'find next'
|
||||
*/
|
||||
|
||||
|
||||
++treeSeeker;
|
||||
|
||||
|
||||
showObject(o);
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("Found object: o=%p id=%s name=%s type=%s",
|
||||
@ -353,10 +353,10 @@ loop:
|
||||
|
||||
bool FindObjectWidget::validateReplaceObject()
|
||||
{
|
||||
if (m_widget->findDropArea->isEmpty() || m_widget->replaceDropArea->isEmpty())
|
||||
if (m_widget->findDropArea->isEmpty() || m_widget->replaceDropArea->isEmpty())
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Search or Replace object ind't specified."));
|
||||
return false;
|
||||
}
|
||||
@ -366,7 +366,7 @@ bool FindObjectWidget::validateReplaceObject()
|
||||
if (findObj==replObj || findObj->getId() == replObj->getId())
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Cannot replace object by itself."));
|
||||
return false;
|
||||
}
|
||||
@ -374,9 +374,9 @@ bool FindObjectWidget::validateReplaceObject()
|
||||
(Service::cast(findObj)!=NULL && Service::cast(replObj))))
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Search and Replace objects are incompatible."));
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -384,19 +384,19 @@ bool FindObjectWidget::validateReplaceObject()
|
||||
void FindObjectWidget::replace()
|
||||
{
|
||||
if(!validateReplaceObject()) return;
|
||||
|
||||
|
||||
if (lastFound==NULL)
|
||||
|
||||
if (lastFound==NULL)
|
||||
{
|
||||
find();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );
|
||||
FWObject *res=_replaceCurrent();
|
||||
mw->updateRuleSetView();
|
||||
om->info();
|
||||
if (res)
|
||||
mw->info();
|
||||
if (res)
|
||||
{
|
||||
showObject(res);
|
||||
}
|
||||
@ -405,10 +405,10 @@ void FindObjectWidget::replace()
|
||||
// object isn't inserted
|
||||
qDebug("object isn't inserted");
|
||||
}
|
||||
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
|
||||
void FindObjectWidget::replaceAll()
|
||||
{
|
||||
if(!validateReplaceObject()) return;
|
||||
@ -416,7 +416,7 @@ void FindObjectWidget::replaceAll()
|
||||
FWObject *o=NULL;
|
||||
int count=0;
|
||||
bool f=true;
|
||||
|
||||
|
||||
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );
|
||||
while (f)
|
||||
{
|
||||
@ -430,7 +430,7 @@ void FindObjectWidget::replaceAll()
|
||||
if ( !inSelectedFirewall(RuleElement::cast(o->getParent())) )
|
||||
{
|
||||
continue;
|
||||
|
||||
|
||||
}
|
||||
} else if (m_widget->srScope->currentIndex()==0) continue ; // scope == tree only
|
||||
} else
|
||||
@ -442,7 +442,7 @@ void FindObjectWidget::replaceAll()
|
||||
if (FWReference::cast(o)!=NULL)
|
||||
{
|
||||
FWReference *r=FWReference::cast(o);
|
||||
if (
|
||||
if (
|
||||
matchAttr( r->getPointer() ) &&
|
||||
matchID( QString::fromUtf8(r->getPointer()->getId().c_str()) )) break;
|
||||
} else
|
||||
@ -453,9 +453,9 @@ void FindObjectWidget::replaceAll()
|
||||
}
|
||||
}
|
||||
if (treeSeeker==mw->db()->tree_end())
|
||||
{
|
||||
{
|
||||
f=false;
|
||||
|
||||
|
||||
} else
|
||||
{
|
||||
lastFound=o;
|
||||
@ -465,10 +465,10 @@ void FindObjectWidget::replaceAll()
|
||||
}
|
||||
}
|
||||
mw->updateRuleSetView();
|
||||
om->info();
|
||||
mw->info();
|
||||
QApplication::restoreOverrideCursor();
|
||||
QMessageBox::information(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Replaced %1 objects.").arg(count));
|
||||
|
||||
}
|
||||
@ -479,10 +479,10 @@ FWObject* FindObjectWidget::_replaceCurrent()
|
||||
|
||||
if (p==NULL || o==NULL) return NULL;
|
||||
if (FWReference::cast(o)==NULL) return NULL;
|
||||
|
||||
|
||||
p->removeRef(FWReference::cast(o)->getPointer());
|
||||
//chack for duplicates --------
|
||||
|
||||
|
||||
FWObject *ro=m_widget->replaceDropArea->getObject();
|
||||
if (RuleElement::cast(p)==NULL || !RuleElement::cast(p)->isAny())
|
||||
{
|
||||
@ -490,9 +490,9 @@ FWObject* FindObjectWidget::_replaceCurrent()
|
||||
string cp_id=ro->getId();
|
||||
FWObject *oo;
|
||||
FWReference *ref;
|
||||
|
||||
|
||||
list<FWObject*>::iterator j;
|
||||
for(j=p->begin(); j!=p->end(); ++j)
|
||||
for(j=p->begin(); j!=p->end(); ++j)
|
||||
{
|
||||
oo=*j;
|
||||
if(cp_id==oo->getId()) return NULL;
|
||||
@ -501,7 +501,7 @@ FWObject* FindObjectWidget::_replaceCurrent()
|
||||
cp_id==ref->getPointerId()) return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p->addRef(ro);
|
||||
FWObject *to;
|
||||
FWReference *ref;
|
||||
@ -526,7 +526,7 @@ bool FindObjectWidget::inSelectedFirewall( RuleElement* r)
|
||||
FWObject *f=r;
|
||||
while (f!=NULL && !Firewall::isA(f)) f=f->getParent();
|
||||
if (f==NULL) return false;
|
||||
|
||||
|
||||
return selectedFirewall==(Firewall::cast(f));
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ void FindObjectWidget::replaceEnable()
|
||||
m_widget->replaceButton->setEnabled (true);
|
||||
m_widget->repNextButton->setEnabled (true);
|
||||
m_widget->replaceAllButton->setEnabled(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void FindObjectWidget::replaceDisable()
|
||||
@ -543,18 +543,18 @@ void FindObjectWidget::replaceDisable()
|
||||
m_widget->replaceButton->setEnabled (false);
|
||||
m_widget->repNextButton->setEnabled (false);
|
||||
m_widget->replaceAllButton->setEnabled(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void FindObjectWidget::showObject(FWObject* o)
|
||||
{
|
||||
if (fwbdebug) qDebug("FindObjectWidget::showObject");
|
||||
|
||||
|
||||
FWReference* ref=FWReference::cast(o);
|
||||
if (ref!=NULL && RuleElement::cast(o->getParent())!=NULL)
|
||||
{
|
||||
oe->close();
|
||||
om->clearFocus();
|
||||
mw->closeEditor();
|
||||
mw->clearManipulatorFocus();
|
||||
mw->ensureObjectVisibleInRules( ref );
|
||||
mw->selectRules();
|
||||
return;
|
||||
@ -562,19 +562,18 @@ void FindObjectWidget::showObject(FWObject* o)
|
||||
|
||||
mw->unselectRules();
|
||||
|
||||
if (Group::cast(o->getParent())!=NULL &&
|
||||
!FWBTree::isSystem(o->getParent()))
|
||||
if (Group::cast(o->getParent())!=NULL &&
|
||||
!mw->isSystem(o->getParent()))
|
||||
{
|
||||
om->openObject( o->getParent() );
|
||||
om->editObject( o->getParent() );
|
||||
oe->selectObject( (ref) ? ref->getPointer() : o );
|
||||
//oe->setFocus();
|
||||
mw->openObject( o->getParent() );
|
||||
mw->editObject( o->getParent() );
|
||||
mw->selectObjectInEditor( (ref) ? ref->getPointer() : o );
|
||||
return;
|
||||
}
|
||||
|
||||
oe->close();
|
||||
om->openObject( o );
|
||||
om->select(); // selects an item in the tree and assigns kbd focus to it
|
||||
mw->closeEditor();
|
||||
mw->openObject( o );
|
||||
mw->select(); // selects an item in the tree and assigns kbd focus to it
|
||||
}
|
||||
|
||||
void FindObjectWidget::init()
|
||||
@ -604,5 +603,5 @@ void FindObjectWidget::replaceNext()
|
||||
void FindObjectWidget::scopeChanged()
|
||||
{
|
||||
st->setValue("/FirewallBuilder2/Search/Scope",m_widget->srScope->currentIndex ());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -31,7 +33,6 @@
|
||||
#include "definitions.h"
|
||||
|
||||
#include "FindWhereUsedWidget.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
#include "FWObjectDropArea.h"
|
||||
#include "ObjectManipulator.h"
|
||||
@ -76,14 +77,14 @@ using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
|
||||
FindWhereUsedWidget::FindWhereUsedWidget(QWidget*p, const char * n, Qt::WindowFlags f, bool f_mini) : QWidget(p)
|
||||
FindWhereUsedWidget::FindWhereUsedWidget(QWidget*p, const char * n, Qt::WindowFlags f, bool f_mini) : QWidget(p)
|
||||
{
|
||||
m_widget = new Ui::findWhereUsedWidget_q;
|
||||
m_widget->setupUi(this);
|
||||
|
||||
|
||||
setObjectName(n);
|
||||
setWindowFlags(f);
|
||||
|
||||
|
||||
flShowObject=true;
|
||||
if (f_mini)
|
||||
{
|
||||
@ -111,7 +112,7 @@ void FindWhereUsedWidget::itemActivated(QTreeWidgetItem* item)
|
||||
{
|
||||
FWObject *o;
|
||||
o=mapping[item];
|
||||
|
||||
|
||||
if (flShowObject && o!=NULL)
|
||||
{
|
||||
showObject(o);
|
||||
@ -135,8 +136,8 @@ void FindWhereUsedWidget::_find(FWObject *obj)
|
||||
m_widget->resListView->clear();
|
||||
mapping.clear();
|
||||
resset.clear();
|
||||
|
||||
|
||||
|
||||
|
||||
mw->db()->findWhereUsed(obj,mw->db(),resset);
|
||||
|
||||
set<FWObject*>::iterator i=resset.begin();
|
||||
@ -153,28 +154,28 @@ void FindWhereUsedWidget::_find(FWObject *obj)
|
||||
fw=NULL;
|
||||
r=NULL;
|
||||
rs=NULL;
|
||||
|
||||
|
||||
if (findRef(object,o)==NULL) continue;
|
||||
if (RuleElement::cast(o)!=NULL)
|
||||
if (RuleElement::cast(o)!=NULL)
|
||||
{
|
||||
fw=o->getParent();
|
||||
|
||||
while (fw!=NULL && !Firewall::isA(fw))
|
||||
|
||||
while (fw!=NULL && !Firewall::isA(fw))
|
||||
{
|
||||
if (Rule::cast(fw))
|
||||
{
|
||||
r=Rule::cast(fw);
|
||||
r=Rule::cast(fw);
|
||||
} else if (RuleSet::cast(fw))
|
||||
{
|
||||
rs=RuleSet::cast(fw);
|
||||
}
|
||||
|
||||
|
||||
fw=fw->getParent();
|
||||
}
|
||||
if (fw==NULL || r==NULL || rs==NULL) continue;
|
||||
|
||||
|
||||
c1=QString::fromUtf8(fw->getName().c_str());
|
||||
|
||||
|
||||
if (NAT::isA(rs))
|
||||
{
|
||||
c2=tr("NAT");
|
||||
@ -189,11 +190,11 @@ void FindWhereUsedWidget::_find(FWObject *obj)
|
||||
c2=tr("Unknown rule set");
|
||||
}
|
||||
c2+=tr("/Rule%1").arg(r->getPosition());
|
||||
|
||||
|
||||
} else if (
|
||||
FWBTree::isSystem(o) ||
|
||||
Rule::cast(o) ||
|
||||
RuleSet::cast(o) ||
|
||||
mw->isSystem(o) ||
|
||||
Rule::cast(o) ||
|
||||
RuleSet::cast(o) ||
|
||||
Firewall::cast(o) ||
|
||||
Library::cast(o))
|
||||
{
|
||||
@ -215,7 +216,7 @@ void FindWhereUsedWidget::_find(FWObject *obj)
|
||||
pm.load( icn_file );
|
||||
QPixmapCache::insert( icn_file, pm);
|
||||
}
|
||||
|
||||
|
||||
QStringList qsl;
|
||||
qsl << c1 << c2;
|
||||
item=new QTreeWidgetItem(m_widget->resListView, qsl);
|
||||
@ -231,7 +232,7 @@ void FindWhereUsedWidget::init()
|
||||
m_widget->resListView->clear();
|
||||
mapping.clear();
|
||||
resset.clear();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void FindWhereUsedWidget::findFromDrop()
|
||||
@ -242,23 +243,23 @@ void FindWhereUsedWidget::findFromDrop()
|
||||
void FindWhereUsedWidget::showObject(FWObject* o)
|
||||
{
|
||||
if (fwbdebug) qDebug("FindWhereUsedWidget::showObject");
|
||||
|
||||
|
||||
if (object==NULL || o==NULL) return;
|
||||
|
||||
|
||||
FWReference* ref=NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
if (RuleElement::cast(o)!=NULL)
|
||||
{
|
||||
ref=findRef(object,o);
|
||||
if (ref==NULL) return;
|
||||
|
||||
om->clearFocus();
|
||||
|
||||
mw->clearManipulatorFocus();
|
||||
mw->ensureObjectVisibleInRules( ref );
|
||||
mw->selectRules();
|
||||
if (oe->isVisible())
|
||||
if (mw->isEditorVisible())
|
||||
{
|
||||
om->editObject( object );
|
||||
mw->editObject( object );
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -267,18 +268,17 @@ void FindWhereUsedWidget::showObject(FWObject* o)
|
||||
if (Group::cast(o)!=NULL)
|
||||
{
|
||||
|
||||
om->openObject( o );
|
||||
mw->openObject( o );
|
||||
mw->unselectRules();
|
||||
|
||||
if (oe->isVisible())
|
||||
|
||||
if (mw->isEditorVisible())
|
||||
{
|
||||
om->editObject( o );
|
||||
oe->selectObject( object);
|
||||
mw->editObject( o );
|
||||
mw->selectObjectInEditor( object);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//oe->close();
|
||||
//om->openObject( o );
|
||||
//om->select(); // selects an item in the tree and assigns kbd focus to it
|
||||
//mw->closeEditor();
|
||||
//mw->openObject( o );
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,22 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "platforms.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "FirewallDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "DialogFactory.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
@ -62,16 +64,16 @@
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
FirewallDialog::~FirewallDialog()
|
||||
{
|
||||
FirewallDialog::~FirewallDialog()
|
||||
{
|
||||
delete m_dialog;
|
||||
}
|
||||
|
||||
FirewallDialog::FirewallDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
FirewallDialog::FirewallDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::FirewallDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
setFont(st->getUiFont());
|
||||
}
|
||||
|
||||
@ -141,7 +143,7 @@ void FirewallDialog::loadFWObject(FWObject *o)
|
||||
|
||||
m_dialog->inactive->setEnabled(!o->isReadOnly());
|
||||
setDisabledPalette(m_dialog->inactive);
|
||||
|
||||
|
||||
|
||||
init=false;
|
||||
}
|
||||
@ -259,14 +261,14 @@ void FirewallDialog::applyChanges()
|
||||
obj->setStr("platform", pl );
|
||||
|
||||
obj->setStr("host_OS", readHostOS(m_dialog->hostOS).toLatin1().constData() );
|
||||
|
||||
|
||||
s->setInactive(m_dialog->inactive->isChecked());
|
||||
|
||||
|
||||
saveVersion();
|
||||
|
||||
string newVer=obj->getStr("version");
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
if (oldplatform!=pl || oldname!=newname || oldVer!=newVer)
|
||||
{
|
||||
@ -290,13 +292,13 @@ void FirewallDialog::applyChanges()
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(s);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(s);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
|
||||
class ProjectPanel;
|
||||
class FirewallDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -44,10 +45,11 @@ class FirewallDialog : public QWidget
|
||||
|
||||
void fillVersion();
|
||||
void saveVersion();
|
||||
ProjectPanel *m_project;
|
||||
|
||||
|
||||
public:
|
||||
FirewallDialog(QWidget *parent);
|
||||
FirewallDialog(ProjectPanel *project, QWidget *parent);
|
||||
~FirewallDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,16 +17,19 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
#include "FWWindow.h"
|
||||
@ -36,7 +39,6 @@
|
||||
#include "GroupObjectDialog.h"
|
||||
#include "ObjectListViewItem.h"
|
||||
#include "ObjectIconViewItem.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWObjectDrag.h"
|
||||
#include "FWObjectClipboard.h"
|
||||
#include "ObjectTreeView.h"
|
||||
@ -73,13 +75,13 @@ enum GroupObjectDialog::viewType GroupObjectDialog::vt = GroupObjectDialog::Icon
|
||||
#define ICON_VIEW_MODE "icon"
|
||||
|
||||
|
||||
GroupObjectDialog::GroupObjectDialog(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
GroupObjectDialog::GroupObjectDialog(ProjectPanel *project, QWidget *parent) :
|
||||
QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::GroupObjectDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
|
||||
|
||||
obj=NULL;
|
||||
selectedObject=NULL;
|
||||
|
||||
@ -98,20 +100,20 @@ GroupObjectDialog::GroupObjectDialog(QWidget *parent) :
|
||||
m_dialog->objectViewsStack->addWidget(listView);
|
||||
m_dialog->objectViewsStack->setCurrentWidget(iconView);
|
||||
|
||||
|
||||
|
||||
setTabOrder( m_dialog->obj_name, iconView );
|
||||
setTabOrder( iconView, listView );
|
||||
setTabOrder( listView, m_dialog->comment );
|
||||
|
||||
listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
iconView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
|
||||
m_dialog->iconViewBtn->setCheckable(true);
|
||||
m_dialog->listViewBtn->setCheckable(true);
|
||||
|
||||
|
||||
//listView->hide();
|
||||
//iconView->show();
|
||||
|
||||
|
||||
|
||||
m_dialog->iconViewBtn->setAutoRaise(false);
|
||||
m_dialog->listViewBtn->setAutoRaise(false);
|
||||
@ -125,7 +127,7 @@ GroupObjectDialog::GroupObjectDialog(QWidget *parent) :
|
||||
this, SLOT( iconViewCurrentChanged(QListWidgetItem*) ) );
|
||||
|
||||
connect( iconView, SIGNAL (itemSelectionChanged()),
|
||||
this, SLOT (iconViewSelectionChanged()));
|
||||
this, SLOT (iconViewSelectionChanged()));
|
||||
|
||||
connect( iconView, SIGNAL( dropped(QDropEvent*) ),
|
||||
this, SLOT( dropped(QDropEvent*) ) );
|
||||
@ -142,7 +144,7 @@ GroupObjectDialog::GroupObjectDialog(QWidget *parent) :
|
||||
connect( listView, SIGNAL( currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*) ),
|
||||
this, SLOT( listViewCurrentChanged(QTreeWidgetItem*) ) );
|
||||
connect( listView, SIGNAL (itemSelectionChanged()),
|
||||
this, SLOT (listViewSelectionChanged()));
|
||||
this, SLOT (listViewSelectionChanged()));
|
||||
|
||||
connect( listView, SIGNAL( dropped(QDropEvent*) ),
|
||||
this, SLOT( dropped(QDropEvent*) ) );
|
||||
@ -157,7 +159,7 @@ GroupObjectDialog::GroupObjectDialog(QWidget *parent) :
|
||||
|
||||
if (col0 == 0)
|
||||
col0 = listView->width()/2;
|
||||
|
||||
|
||||
listView->setColumnWidth(0,col0);
|
||||
listView->setColumnWidth(1,col1);
|
||||
|
||||
@ -186,15 +188,15 @@ void GroupObjectDialog::iconViewSelectionChanged()
|
||||
if (o!=NULL)
|
||||
selectedObjects.push_back(o);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void GroupObjectDialog::listViewSelectionChanged()
|
||||
{
|
||||
selectedObjects.clear();
|
||||
//QTreeWidgetItemIterator it(listView);
|
||||
|
||||
|
||||
for ( int i = 0; i < listView->topLevelItemCount(); i++)
|
||||
{
|
||||
QTreeWidgetItem *itm= listView->topLevelItem(i);
|
||||
@ -272,9 +274,9 @@ void GroupObjectDialog::insertObject(FWObject *o)
|
||||
if(go==cp_id) return;
|
||||
}
|
||||
|
||||
addIcon(o, ! FWBTree::isSystem(obj) );
|
||||
addIcon(o, ! m_project->isSystem(obj) );
|
||||
|
||||
|
||||
|
||||
changed();
|
||||
}
|
||||
|
||||
@ -298,7 +300,7 @@ void GroupObjectDialog::addIcon(FWObject *o,bool ref)
|
||||
o->getTypeName() + "/hidden") ) return;
|
||||
|
||||
QString obj_name=QString::fromUtf8(o->getName().c_str());
|
||||
|
||||
|
||||
QString icn_filename =
|
||||
(":/Icons/"+o->getTypeName()+((ref)?"/icon-ref":"/icon")).c_str();
|
||||
|
||||
@ -346,9 +348,9 @@ void GroupObjectDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->obj_name->setText( QString::fromUtf8(g->getName().c_str()) );
|
||||
m_dialog->comment->setText( QString::fromUtf8(g->getComment().c_str()) );
|
||||
|
||||
m_dialog->obj_name->setEnabled( !FWBTree::isSystem(obj) );
|
||||
m_dialog->libs->setEnabled( !FWBTree::isSystem(obj) );
|
||||
m_dialog->comment->setEnabled( !FWBTree::isSystem(obj) );
|
||||
m_dialog->obj_name->setEnabled( !m_project->isSystem(obj) );
|
||||
m_dialog->libs->setEnabled( !m_project->isSystem(obj) );
|
||||
m_dialog->comment->setEnabled( !m_project->isSystem(obj) );
|
||||
|
||||
listView->clear();
|
||||
|
||||
@ -373,16 +375,16 @@ void GroupObjectDialog::loadFWObject(FWObject *o)
|
||||
for (FWObject::iterator i=g->begin(); i!=g->end(); i++)
|
||||
addIcon( *i );
|
||||
|
||||
|
||||
|
||||
//apply->setEnabled( false );
|
||||
|
||||
m_dialog->obj_name->setEnabled(!o->isReadOnly() && !FWBTree::isSystem(o));
|
||||
m_dialog->obj_name->setEnabled(!o->isReadOnly() && !m_project->isSystem(o));
|
||||
setDisabledPalette(m_dialog->obj_name);
|
||||
|
||||
m_dialog->comment->setEnabled(!o->isReadOnly() && !FWBTree::isSystem(o));
|
||||
m_dialog->comment->setEnabled(!o->isReadOnly() && !m_project->isSystem(o));
|
||||
setDisabledPalette(m_dialog->comment);
|
||||
|
||||
m_dialog->libs->setEnabled(!o->isReadOnly() && !FWBTree::isSystem(o));
|
||||
m_dialog->libs->setEnabled(!o->isReadOnly() && !m_project->isSystem(o));
|
||||
setDisabledPalette(m_dialog->libs);
|
||||
|
||||
// listView->setEnabled(!o->isReadOnly());
|
||||
@ -394,7 +396,7 @@ void GroupObjectDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void GroupObjectDialog::changed()
|
||||
{
|
||||
//if (!init) apply->setEnabled( true );
|
||||
@ -448,20 +450,20 @@ void GroupObjectDialog::applyChanges()
|
||||
|
||||
set<FWObject*> diff;
|
||||
set_difference( oldobj.begin(), oldobj.end(),
|
||||
newobj.begin(), newobj.end(),
|
||||
newobj.begin(), newobj.end(),
|
||||
inserter(diff,diff.begin()));
|
||||
/* diff contains objects present in oldobj but not in newobj - these objects
|
||||
were deleted from the group */
|
||||
|
||||
for (set<FWObject*>::iterator k=diff.begin(); k!=diff.end(); ++k)
|
||||
{
|
||||
if (FWBTree::isSystem(obj)) om->delObj(*k, false);
|
||||
if (m_project->isSystem(obj)) mw->delObj(*k, false);
|
||||
else obj->removeRef( *k );
|
||||
}
|
||||
|
||||
diff.clear();
|
||||
|
||||
set_difference( newobj.begin(), newobj.end(),
|
||||
set_difference( newobj.begin(), newobj.end(),
|
||||
oldobj.begin(), oldobj.end(),
|
||||
inserter(diff,diff.begin()));
|
||||
/* diff contains objects present in newobj but not in oldobj - these objects
|
||||
@ -469,22 +471,22 @@ void GroupObjectDialog::applyChanges()
|
||||
|
||||
for (set<FWObject*>::iterator k1=diff.begin(); k1!=diff.end(); ++k1)
|
||||
{
|
||||
if (FWBTree::isSystem(obj)) om->pasteTo(obj,*k1, false);
|
||||
if (m_project->isSystem(obj)) mw->pasteTo(obj,*k1, false);
|
||||
else obj->addRef( *k1);
|
||||
}
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("GroupObjectDialog::applyChanges done");
|
||||
@ -523,8 +525,8 @@ void GroupObjectDialog::openObject()
|
||||
{
|
||||
if (selectedObject!=NULL)
|
||||
{
|
||||
om->openObject( selectedObject );
|
||||
om->editObject( selectedObject );
|
||||
mw->openObject( selectedObject );
|
||||
mw->editObject( selectedObject );
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,8 +538,8 @@ void GroupObjectDialog::openObject(QTreeWidgetItem *itm)
|
||||
FWObject *o = otvi->getFWObject();
|
||||
if (o!=NULL)
|
||||
{
|
||||
om->openObject( o );
|
||||
om->editObject( o );
|
||||
mw->openObject( o );
|
||||
mw->editObject( o );
|
||||
}
|
||||
}
|
||||
|
||||
@ -549,8 +551,8 @@ void GroupObjectDialog::openObject(QListWidgetItem *itm)
|
||||
FWObject *o = oivi->getFWObject();
|
||||
if (o!=NULL)
|
||||
{
|
||||
om->openObject( o );
|
||||
om->editObject( o );
|
||||
mw->openObject( o );
|
||||
mw->editObject( o );
|
||||
}
|
||||
}
|
||||
|
||||
@ -569,7 +571,7 @@ void GroupObjectDialog::dropped(QDropEvent *ev)
|
||||
|
||||
// see comment in ObjectTreeView.cpp explaining the purpose of
|
||||
// flag process_mouse_release_event
|
||||
ObjectTreeView *otv = om->getCurrentObjectTree();
|
||||
ObjectTreeView *otv = mw->getCurrentObjectTree();
|
||||
otv->ignoreNextMouseReleaseEvent();
|
||||
|
||||
}
|
||||
@ -617,14 +619,14 @@ void GroupObjectDialog::setupPopupMenu(const QPoint &pos)
|
||||
QAction *delID =popup->addAction( tr("Delete") ,this , SLOT( deleteObj()) );
|
||||
|
||||
copyID->setEnabled(selectedObject!=NULL &&
|
||||
! FWBTree::isSystem(selectedObject) );
|
||||
cutID->setEnabled(selectedObject!=NULL &&
|
||||
! FWBTree::isSystem(obj) &&
|
||||
! m_project->isSystem(selectedObject) );
|
||||
cutID->setEnabled(selectedObject!=NULL &&
|
||||
! m_project->isSystem(obj) &&
|
||||
! obj->isReadOnly() );
|
||||
pasteID->setEnabled(! FWBTree::isSystem(obj) &&
|
||||
pasteID->setEnabled(! m_project->isSystem(obj) &&
|
||||
! obj->isReadOnly() );
|
||||
delID->setEnabled(selectedObject!=NULL &&
|
||||
! FWBTree::isSystem(obj) &&
|
||||
! m_project->isSystem(obj) &&
|
||||
! obj->isReadOnly() );
|
||||
|
||||
popup->exec( pos );
|
||||
@ -637,17 +639,17 @@ void GroupObjectDialog::copyObj()
|
||||
it!=selectedObjects.end(); ++it)
|
||||
{
|
||||
FWObject* selectedObject=*it;
|
||||
|
||||
if (selectedObject!=NULL && ! FWBTree::isSystem(selectedObject) )
|
||||
|
||||
if (selectedObject!=NULL && ! m_project->isSystem(selectedObject) )
|
||||
{
|
||||
FWObject *o=selectedObject;
|
||||
if (FWReference::cast(o)!=NULL)
|
||||
o=FWReference::cast(o)->getPointer();
|
||||
|
||||
|
||||
|
||||
FWObjectClipboard::obj_clipboard->add( o );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -660,7 +662,7 @@ void GroupObjectDialog::cutObj()
|
||||
void GroupObjectDialog::pasteObj()
|
||||
{
|
||||
vector<string>::iterator i;
|
||||
|
||||
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
{
|
||||
@ -676,13 +678,13 @@ void GroupObjectDialog::deleteObj()
|
||||
vector<FWObject*> tv;
|
||||
FWObject* selectedObject;
|
||||
copy (selectedObjects.begin(),selectedObjects.end(),inserter(tv,tv.begin()));
|
||||
|
||||
|
||||
for(vector<FWObject*>::iterator it=tv.begin();
|
||||
it!=tv.end(); ++it)
|
||||
{
|
||||
selectedObject=(*it);
|
||||
|
||||
if (selectedObject!=NULL && ! FWBTree::isSystem(obj) )
|
||||
|
||||
if (selectedObject!=NULL && ! m_project->isSystem(obj) )
|
||||
{
|
||||
Group *g = dynamic_cast<Group*>(obj);
|
||||
assert(g!=NULL);
|
||||
@ -703,7 +705,7 @@ void GroupObjectDialog::deleteObj()
|
||||
assert(allIconViewItems[o->getId()]!=NULL);
|
||||
delete allIconViewItems[o->getId()];
|
||||
allIconViewItems.erase(o->getId());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
changed();
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
|
||||
class ObjectIconViewItem;
|
||||
class ObjectListViewItem;
|
||||
class ProjectPanel;
|
||||
|
||||
class GroupObjectDialog : public QWidget
|
||||
{
|
||||
@ -59,6 +60,7 @@ class GroupObjectDialog : public QWidget
|
||||
|
||||
bool init;
|
||||
|
||||
ProjectPanel *m_project;
|
||||
void addIcon(libfwbuilder::FWObject *o);
|
||||
void addIcon(libfwbuilder::FWObject *o, bool ref);
|
||||
|
||||
@ -68,7 +70,7 @@ class GroupObjectDialog : public QWidget
|
||||
void saveColumnWidths();
|
||||
|
||||
public:
|
||||
GroupObjectDialog(QWidget *parent);
|
||||
GroupObjectDialog(ProjectPanel *project, QWidget *parent);
|
||||
~GroupObjectDialog();
|
||||
|
||||
enum viewType { Icon, List };
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "HostDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/Host.h"
|
||||
@ -46,15 +48,17 @@
|
||||
#include <qpushbutton.h>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
HostDialog::HostDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
HostDialog::HostDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::HostDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
HostDialog::~HostDialog()
|
||||
@ -103,7 +107,7 @@ void HostDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void HostDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -143,19 +147,19 @@ void HostDialog::applyChanges()
|
||||
// mgmt->getSNMPManagement()->setReadCommunity( snmpCommunity->text().latin1() );
|
||||
opt->setBool("use_mac_addr_filter", m_dialog->MACmatching->isChecked() );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) &&
|
||||
if (! m_project->isSystem(obj) &&
|
||||
m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void HostDialog::discardChanges()
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class ProjectPanel;
|
||||
|
||||
class HostDialog : public QWidget
|
||||
{
|
||||
@ -41,9 +42,10 @@ class HostDialog : public QWidget
|
||||
libfwbuilder::FWObject *obj;
|
||||
bool init;
|
||||
Ui::HostDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
HostDialog(QWidget *parent);
|
||||
HostDialog(ProjectPanel *project, QWidget *parent);
|
||||
~HostDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,22 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "ProjectPanel.h"
|
||||
#include "FWBTree.h"
|
||||
#include "ICMPServiceDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/ICMPService.h"
|
||||
@ -45,16 +47,17 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
ICMPServiceDialog::ICMPServiceDialog(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
ICMPServiceDialog::ICMPServiceDialog(ProjectPanel *project, QWidget *parent) :
|
||||
QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::ICMPServiceDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
ICMPServiceDialog::~ICMPServiceDialog()
|
||||
@ -96,7 +99,7 @@ void ICMPServiceDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void ICMPServiceDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -129,18 +132,18 @@ void ICMPServiceDialog::applyChanges()
|
||||
obj->setInt("type", m_dialog->icmpType->value() );
|
||||
obj->setInt("code", m_dialog->icmpCode->value() );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void ICMPServiceDialog::discardChanges()
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
|
||||
class ProjectPanel;
|
||||
class ICMPServiceDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -42,8 +43,9 @@ class ICMPServiceDialog : public QWidget
|
||||
bool init;
|
||||
Ui::ICMPServiceDialog_q *m_dialog;
|
||||
|
||||
ProjectPanel *m_project;
|
||||
public:
|
||||
ICMPServiceDialog(QWidget *parent);
|
||||
ICMPServiceDialog(ProjectPanel *project, QWidget *parent);
|
||||
~ICMPServiceDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils_no_qt.h"
|
||||
@ -263,7 +265,7 @@ int IOSImporter::convertPort(const std::string &port_str,
|
||||
str1 >> port;
|
||||
} catch (const std::exception &ex) {
|
||||
// could not convert port_spec to an integer
|
||||
markCurrentRuleBad(std::string("Port spec '") + port_str +
|
||||
markCurrentRuleBad(std::string("Port spec '") + port_str +
|
||||
"' unknown. Error " + ex.what());
|
||||
}
|
||||
}
|
||||
@ -299,7 +301,7 @@ std::pair<int,int> IOSImporter::convertPortSpec(const std::string &port_op,
|
||||
range_start = convertPort(s1, port_map);
|
||||
range_end = convertPort(s2, port_map);
|
||||
|
||||
if (portop=="lt") range_start = 0;
|
||||
if (portop=="lt") range_start = 0;
|
||||
if (portop=="gt") range_end = 65535;
|
||||
if (portop=="eq")
|
||||
{
|
||||
@ -452,7 +454,7 @@ Firewall* IOSImporter::finalize()
|
||||
{
|
||||
og = createGroupOfInterfaces(irs->name, all_in);
|
||||
std::for_each(irs->ruleset->begin(),
|
||||
irs->ruleset->end(),
|
||||
irs->ruleset->end(),
|
||||
merge_rule(irs->name,
|
||||
og,
|
||||
PolicyRule::Inbound,
|
||||
@ -464,7 +466,7 @@ Firewall* IOSImporter::finalize()
|
||||
{
|
||||
og = createGroupOfInterfaces(irs->name, all_out);
|
||||
std::for_each(irs->ruleset->begin(),
|
||||
irs->ruleset->end(),
|
||||
irs->ruleset->end(),
|
||||
merge_rule(irs->name,
|
||||
og,
|
||||
PolicyRule::Outbound,
|
||||
@ -476,7 +478,7 @@ Firewall* IOSImporter::finalize()
|
||||
{
|
||||
og = createGroupOfInterfaces(irs->name, all_both);
|
||||
std::for_each(irs->ruleset->begin(),
|
||||
irs->ruleset->end(),
|
||||
irs->ruleset->end(),
|
||||
merge_rule(irs->name,
|
||||
og,
|
||||
PolicyRule::Both,
|
||||
@ -485,7 +487,7 @@ Firewall* IOSImporter::finalize()
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
std::map<std::string,std::string>::iterator j;
|
||||
for (j=irs->intf_dir.begin(); j!=irs->intf_dir.end(); ++j)
|
||||
@ -503,7 +505,7 @@ Firewall* IOSImporter::finalize()
|
||||
qDebug(QString(" interface=%1").
|
||||
arg(intf->getName().c_str()).toAscii().constData());
|
||||
std::for_each(irs->ruleset->begin(),
|
||||
irs->ruleset->end(),
|
||||
irs->ruleset->end(),
|
||||
merge_rule(irs->name,
|
||||
intf,
|
||||
direction,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,22 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "IPServiceDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/IPService.h"
|
||||
@ -46,15 +48,16 @@
|
||||
#include <iostream>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
|
||||
IPServiceDialog::IPServiceDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
IPServiceDialog::IPServiceDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::IPServiceDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
IPServiceDialog::~IPServiceDialog()
|
||||
@ -118,7 +121,7 @@ void IPServiceDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void IPServiceDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -156,18 +159,18 @@ void IPServiceDialog::applyChanges()
|
||||
obj->setBool("fragm", m_dialog->all_fragments->isChecked() );
|
||||
obj->setBool("short_fragm", m_dialog->short_fragments->isChecked() );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void IPServiceDialog::discardChanges()
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
|
||||
class ProjectPanel;
|
||||
class IPServiceDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -43,8 +44,9 @@ class IPServiceDialog : public QWidget
|
||||
bool init;
|
||||
Ui::IPServiceDialog_q *m_dialog;
|
||||
|
||||
ProjectPanel *m_project;
|
||||
public:
|
||||
IPServiceDialog(QWidget *parent);
|
||||
IPServiceDialog(ProjectPanel *project, QWidget *parent);
|
||||
~IPServiceDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils_no_qt.h"
|
||||
@ -257,7 +259,7 @@ int IPTImporter::convertPort(const std::string &port_spec,
|
||||
str1 >> port;
|
||||
} catch (const std::exception &ex) {
|
||||
// could not convert port_spec to an integer
|
||||
markCurrentRuleBad(std::string("Port spec '") + port_spec +
|
||||
markCurrentRuleBad(std::string("Port spec '") + port_spec +
|
||||
"' unknown. Error " + ex.what());
|
||||
}
|
||||
return port;
|
||||
@ -383,7 +385,7 @@ void IPTImporter::addSrv()
|
||||
RuleElementSrv* srv = rule->getSrv();
|
||||
assert(srv!=NULL);
|
||||
|
||||
if (match_mark.empty())
|
||||
if (match_mark.empty())
|
||||
{
|
||||
Importer::addSrv();
|
||||
return;
|
||||
@ -391,7 +393,7 @@ void IPTImporter::addSrv()
|
||||
|
||||
srv->addRef( getTagService(match_mark) );
|
||||
}
|
||||
|
||||
|
||||
void IPTImporter::pushRule()
|
||||
{
|
||||
assert(current_ruleset!=NULL);
|
||||
@ -532,10 +534,10 @@ void IPTImporter::pushPolicyRule()
|
||||
ropt->setStr("branch_name", branch_ruleset_name);
|
||||
getFirewallObject()->remove(rs->ruleset, false);
|
||||
branch_rulesets[branch_ruleset_name] = rs;
|
||||
|
||||
|
||||
if (duplicate_branch)
|
||||
markCurrentRuleBad(
|
||||
std::string("Rule passes control to branch ") + target +
|
||||
std::string("Rule passes control to branch ") + target +
|
||||
std::string(
|
||||
" which \n"
|
||||
"is already used by some rule prior to this one. \n"
|
||||
@ -603,7 +605,7 @@ void IPTImporter::pushPolicyRule()
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
if (target=="CONNMARK" &&
|
||||
if (target=="CONNMARK" &&
|
||||
last_mark_rule != NULL &&
|
||||
!action_params["connmark_save_mark"].empty())
|
||||
{
|
||||
@ -617,7 +619,7 @@ void IPTImporter::pushPolicyRule()
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
if (target=="CONNMARK" &&
|
||||
if (target=="CONNMARK" &&
|
||||
!action_params["connmark_restore_mark"].empty())
|
||||
{
|
||||
// this rule is added automatically in
|
||||
@ -693,7 +695,7 @@ void IPTImporter::pushPolicyRule()
|
||||
}
|
||||
|
||||
current_rule->setComment(rule_comment);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// *Importer::logger << "Rule: " << rule->getActionAsString() << " "
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -37,7 +39,7 @@
|
||||
#ifdef HAVE_ANTLR_RUNTIME
|
||||
#include <antlr/ANTLRException.hpp>
|
||||
|
||||
// parser and lexer for files produced by iptables-save
|
||||
// parser and lexer for files produced by iptables-save
|
||||
#include "../parsers/IPTCfgLexer.hpp"
|
||||
#include "../parsers/IPTCfgParser.hpp"
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "IPv4Dialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "ProjectPanel.h"
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/IPv4.h"
|
||||
#include "fwbuilder/Interface.h"
|
||||
@ -50,15 +52,17 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "FWWindow.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
IPv4Dialog::IPv4Dialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
IPv4Dialog::IPv4Dialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::IPv4Dialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
IPv4Dialog::~IPv4Dialog()
|
||||
@ -71,7 +75,7 @@ void IPv4Dialog::loadFWObject(FWObject *o)
|
||||
obj=o;
|
||||
IPv4 *s = dynamic_cast<IPv4*>(obj);
|
||||
assert(s!=NULL);
|
||||
|
||||
|
||||
dnsBusy=false;
|
||||
init=true;
|
||||
|
||||
@ -133,7 +137,7 @@ void IPv4Dialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void IPv4Dialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -180,7 +184,7 @@ void IPv4Dialog::validate(bool *res)
|
||||
void IPv4Dialog::isChanged(bool *res)
|
||||
{
|
||||
//*res=(!init && apply->isEnabled());
|
||||
|
||||
|
||||
}
|
||||
|
||||
void IPv4Dialog::libChanged()
|
||||
@ -211,19 +215,19 @@ void IPv4Dialog::applyChanges()
|
||||
} else
|
||||
s->setNetmask( "255.255.255.255" );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if ( ! Interface::isA( obj->getParent() ) &&
|
||||
m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void IPv4Dialog::discardChanges()
|
||||
@ -273,14 +277,14 @@ void IPv4Dialog::DNSlookup()
|
||||
return;
|
||||
}
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("DNS lookup failed for both names of the address object '%1' and the name of the host '%2'.")
|
||||
.arg(m_dialog->obj_name->text()).arg(name),
|
||||
"&Continue", QString::null,QString::null, 0, 1 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("DNS lookup failed for name of the address object '%1'.")
|
||||
.arg(name),
|
||||
"&Continue", QString::null,QString::null, 0, 1 );
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
|
||||
class QDns;
|
||||
|
||||
class ProjectPanel;
|
||||
class IPv4Dialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -45,9 +46,10 @@ class IPv4Dialog : public QWidget
|
||||
bool dnsBusy;
|
||||
//QDns *lookup;
|
||||
Ui::IPv4Dialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
IPv4Dialog(QWidget *parent);
|
||||
IPv4Dialog(ProjectPanel *project, QWidget *parent);
|
||||
~IPv4Dialog();
|
||||
virtual void closeEvent(QCloseEvent *e);
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils_no_qt.h"
|
||||
@ -52,7 +54,7 @@
|
||||
#include "fwbuilder/NAT.h"
|
||||
#include "fwbuilder/RuleElement.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -60,7 +62,7 @@ FWObject* Importer::createObject(const std::string &objType,
|
||||
const std::string &objName)
|
||||
{
|
||||
assert(library!=NULL);
|
||||
FWObject *slot = FWBTree::getStandardSlotForObject(library,
|
||||
FWObject *slot = mw->getStandardSlotForObject(library,
|
||||
objType.c_str());
|
||||
return createObject(slot, objType, objName);
|
||||
}
|
||||
@ -73,7 +75,7 @@ FWObject* Importer::createObject(FWObject *parent,
|
||||
FWObject* o = library->getRoot()->create(objType);
|
||||
if (parent != NULL)
|
||||
{
|
||||
parent->add(o);
|
||||
parent->add(o);
|
||||
}
|
||||
o->setName(objName);
|
||||
return o;
|
||||
@ -124,22 +126,22 @@ Importer::Importer(FWObject *_lib,
|
||||
current_ruleset = NULL;
|
||||
current_rule = NULL;
|
||||
|
||||
tcp_flag_names[libfwbuilder::TCPService::URG]="u";
|
||||
tcp_flag_names[libfwbuilder::TCPService::ACK]="a";
|
||||
tcp_flag_names[libfwbuilder::TCPService::PSH]="p";
|
||||
tcp_flag_names[libfwbuilder::TCPService::RST]="r";
|
||||
tcp_flag_names[libfwbuilder::TCPService::SYN]="s";
|
||||
tcp_flag_names[libfwbuilder::TCPService::FIN]="f";
|
||||
tcp_flag_names[libfwbuilder::TCPService::URG]="u";
|
||||
tcp_flag_names[libfwbuilder::TCPService::ACK]="a";
|
||||
tcp_flag_names[libfwbuilder::TCPService::PSH]="p";
|
||||
tcp_flag_names[libfwbuilder::TCPService::RST]="r";
|
||||
tcp_flag_names[libfwbuilder::TCPService::SYN]="s";
|
||||
tcp_flag_names[libfwbuilder::TCPService::FIN]="f";
|
||||
tcp_flag_names[98]="N"; // NONE
|
||||
tcp_flag_names[99]="A"; // ALL
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Importer::run()
|
||||
{
|
||||
// create and run parsers in derived classes
|
||||
}
|
||||
|
||||
|
||||
|
||||
Importer::~Importer()
|
||||
{
|
||||
@ -448,7 +450,7 @@ void Importer::addSrv()
|
||||
FWObject *s = makeSrvObj();
|
||||
if (s) srv->addRef( s );
|
||||
}
|
||||
|
||||
|
||||
void Importer::addOSrc()
|
||||
{
|
||||
NATRule *rule = NATRule::cast(current_rule);
|
||||
@ -475,7 +477,7 @@ void Importer::addOSrv()
|
||||
FWObject *s= makeSrvObj();
|
||||
if (s) srv->addRef( s );
|
||||
}
|
||||
|
||||
|
||||
Firewall* Importer::finalize()
|
||||
{
|
||||
return fw;
|
||||
@ -499,7 +501,7 @@ FWObject* Importer::getIPService(int proto)
|
||||
|
||||
if ( proto==0 && !fragments)
|
||||
return NULL; // any
|
||||
|
||||
|
||||
IPService *s = IPService::cast(createObject(IPService::TYPENAME, nstr.str()));
|
||||
s->setInt("protocol_num", proto);
|
||||
s->setBool("fragm", fragments);
|
||||
@ -640,7 +642,7 @@ FWObject* Importer::getUDPService(int srs, int sre, int drs, int dre)
|
||||
<< srs << "-" << sre << ":" << drs << "-" << dre;
|
||||
|
||||
std::ostringstream nstr;
|
||||
nstr << "udp "
|
||||
nstr << "udp "
|
||||
<< srs << "-" << sre << ":" << drs << "-" << dre;
|
||||
|
||||
UDPService* s = UDPService::cast(createObject(UDPService::TYPENAME, nstr.str()));
|
||||
@ -691,7 +693,7 @@ FWObject* Importer::createICMPService()
|
||||
s1 >> type;
|
||||
} catch (std::exception& e)
|
||||
{
|
||||
// could not convert
|
||||
// could not convert
|
||||
type = -1;
|
||||
markCurrentRuleBad(std::string("ICMP type '") + icmp_type + "' unknown");
|
||||
}
|
||||
@ -705,7 +707,7 @@ FWObject* Importer::createICMPService()
|
||||
s2 >> code;
|
||||
} catch (std::exception& e)
|
||||
{
|
||||
// could not convert
|
||||
// could not convert
|
||||
code = -1;
|
||||
markCurrentRuleBad(std::string("ICMP code '") + icmp_code + "' unknown");
|
||||
}
|
||||
@ -858,7 +860,7 @@ FWObject* Importer::createAddress(const std::string &addr,
|
||||
str.exceptions(std::ios::failbit);
|
||||
int nm_len;
|
||||
try
|
||||
{
|
||||
{
|
||||
str >> nm_len;
|
||||
net->setNetmask( Netmask(nm_len) );
|
||||
} catch (std::exception& e)
|
||||
@ -936,4 +938,4 @@ void Importer::markCurrentRuleBad(const std::string &comment)
|
||||
error_counter++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "InstallFirewallViewItem.h"
|
||||
@ -11,12 +13,12 @@ using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
InstallFirewallViewItem::InstallFirewallViewItem(QTreeWidget* parent,
|
||||
const QString & st, bool slt ):
|
||||
QTreeWidgetItem(parent,QStringList(st))
|
||||
const QString & st, bool slt ):
|
||||
QTreeWidgetItem(parent,QStringList(st))
|
||||
{
|
||||
showLastTimes=slt;
|
||||
}
|
||||
|
||||
|
||||
QVariant InstallFirewallViewItem::data (int column, int role) const
|
||||
{
|
||||
/*int statCol=(showLastTimes)?4:1;
|
||||
@ -31,7 +33,7 @@ QVariant InstallFirewallViewItem::data (int column, int role) const
|
||||
return QVariant(usual);
|
||||
} else if (text(statCol)==QObject::tr("Failure"))
|
||||
return QVariant(usual);
|
||||
|
||||
|
||||
if (column==statCol)
|
||||
{
|
||||
usual.setBold (true);
|
||||
@ -48,7 +50,7 @@ QVariant InstallFirewallViewItem::data (int column, int role) const
|
||||
usual.setColor(Qt::red);
|
||||
return QVariant(usual);
|
||||
}
|
||||
|
||||
|
||||
if ((column==statCol) && (text(statCol)==QObject::tr("Success")))
|
||||
{
|
||||
usual.setColor(Qt::green);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -18,13 +18,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "InterfaceData.h"
|
||||
|
||||
#include "fwbuilder/Resources.h"
|
||||
@ -41,7 +43,7 @@ void InterfaceData::guessLabel(const string &platform)
|
||||
* automatically.
|
||||
*
|
||||
* in PIX interfaces have names like "PIX Firewall 'inside' interface"
|
||||
*
|
||||
*
|
||||
*/
|
||||
string pat1="PIX Firewall '";
|
||||
string pat2="' interface";
|
||||
@ -87,8 +89,8 @@ void InterfaceData::guessSecurityLevel(const string &platform)
|
||||
llbl=="internal_net" ||
|
||||
llbl=="internal net" ) securityLevel=100;
|
||||
|
||||
if ( address=="127.0.0.1") securityLevel=100;
|
||||
if ( name=="Null0" ) securityLevel=100;
|
||||
if ( address=="127.0.0.1") securityLevel=100;
|
||||
if ( name=="Null0" ) securityLevel=100;
|
||||
|
||||
if (securityLevel==-1 && !isDyn && !isUnnumbered && !isBridgePort)
|
||||
{
|
||||
@ -103,14 +105,14 @@ void InterfaceData::guessSecurityLevel(const string &platform)
|
||||
}
|
||||
|
||||
|
||||
class sort_order_func_adaptor
|
||||
class sort_order_func_adaptor
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
explicit sort_order_func_adaptor() {}
|
||||
|
||||
bool operator()(const InterfaceData &a, const InterfaceData &b)
|
||||
{
|
||||
|
||||
bool operator()(const InterfaceData &a, const InterfaceData &b)
|
||||
{
|
||||
if (a.label=="outside") return true;
|
||||
if (b.label=="inside") return true;
|
||||
return (a.securityLevel<b.securityLevel || a.label<b.label || a.name<b.name);
|
||||
@ -120,7 +122,7 @@ class sort_order_func_adaptor
|
||||
|
||||
|
||||
|
||||
void InterfaceData::guessSecurityLevel(const string &platform,
|
||||
void InterfaceData::guessSecurityLevel(const string &platform,
|
||||
list<InterfaceData> &ifaces)
|
||||
{
|
||||
// first pass - try to find internal and external interfaces and
|
||||
@ -139,13 +141,13 @@ void InterfaceData::guessSecurityLevel(const string &platform,
|
||||
|
||||
if (ifaces.size()==2)
|
||||
{
|
||||
if (ifaces.front().address=="127.0.0.1")
|
||||
if (ifaces.front().address=="127.0.0.1")
|
||||
{
|
||||
ifaces.front().securityLevel=100;
|
||||
ifaces.back().securityLevel=0;
|
||||
} else
|
||||
} else
|
||||
{
|
||||
if (ifaces.back().address=="127.0.0.1")
|
||||
if (ifaces.back().address=="127.0.0.1")
|
||||
{
|
||||
ifaces.front().securityLevel=0;
|
||||
ifaces.back().securityLevel=100;
|
||||
@ -158,7 +160,7 @@ void InterfaceData::guessSecurityLevel(const string &platform,
|
||||
ifaces.sort(sort_order_func_adaptor());
|
||||
return;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
for (list<InterfaceData>::iterator i=ifaces.begin(); i!=ifaces.end(); i++)
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,18 +17,20 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "InterfaceDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ProjectPanel.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
@ -57,8 +59,8 @@
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
InterfaceDialog::InterfaceDialog(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
InterfaceDialog::InterfaceDialog(ProjectPanel *project, QWidget *parent) :
|
||||
QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::InterfaceDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
@ -222,7 +224,7 @@ void InterfaceDialog::loadFWObject(FWObject *o)
|
||||
}
|
||||
}
|
||||
|
||||
m_dialog->netzone->clear();
|
||||
m_dialog->netzone->clear();
|
||||
m_dialog->netzone->addItems( netzoneObjectNames );
|
||||
|
||||
QString id=obj->getStr("network_zone").c_str();
|
||||
@ -280,7 +282,7 @@ void InterfaceDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void InterfaceDialog::changed()
|
||||
{
|
||||
if (fwbdebug)
|
||||
@ -355,12 +357,12 @@ void InterfaceDialog::applyChanges()
|
||||
|
||||
}
|
||||
|
||||
om->updateObjName(obj,
|
||||
mw->updateObjName(obj,
|
||||
QString::fromUtf8(oldname.c_str()),
|
||||
QString::fromUtf8(oldlabel.c_str()));
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void InterfaceDialog::discardChanges()
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include <qmap.h>
|
||||
#include <qstring.h>
|
||||
|
||||
class ProjectPanel;
|
||||
class InterfaceDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -46,9 +47,10 @@ class InterfaceDialog : public QWidget
|
||||
QMap<int,QString> netzoneObjectNos;
|
||||
|
||||
Ui::InterfaceDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
InterfaceDialog(QWidget *parent);
|
||||
InterfaceDialog(ProjectPanel *project, QWidget *parent);
|
||||
~InterfaceDialog();
|
||||
|
||||
virtual void closeEvent(QCloseEvent *e);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -78,7 +80,7 @@ LibExportDialog::LibExportDialog( QWidget* parent, const char* name, bool modal
|
||||
setWindowTitle(name);
|
||||
m_dialog = new Ui::LibExport_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,22 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "LibraryDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
|
||||
@ -44,18 +46,19 @@
|
||||
#include <qpainter.h>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
LibraryDialog::LibraryDialog(QWidget *parent) : QWidget(parent)
|
||||
LibraryDialog::LibraryDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::LibraryDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=NULL;
|
||||
setFont(st->getUiFont());
|
||||
//layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
|
||||
Qt::WindowFlags flags = windowFlags();
|
||||
flags &= ~Qt::WindowMaximizeButtonHint;
|
||||
flags &= ~Qt::WindowMinimizeButtonHint;
|
||||
@ -79,7 +82,7 @@ void LibraryDialog::loadFWObject(FWObject *o)
|
||||
|
||||
m_dialog->obj_name->setEnabled( obj->getId() != "syslib000" );
|
||||
// apply->setEnabled( obj->getId() != "syslib000" );
|
||||
// comment->setEnabled( !FWBTree::isSystem(obj) );
|
||||
// comment->setEnabled( !m_project->isSystem(obj) );
|
||||
|
||||
color=obj->getStr("color").c_str();
|
||||
if (color=="") color="#FFFFFF"; // white is the default
|
||||
@ -96,7 +99,7 @@ void LibraryDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void LibraryDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -105,9 +108,9 @@ void LibraryDialog::changed()
|
||||
|
||||
void LibraryDialog::changeIds(FWObject *root)
|
||||
{
|
||||
if (FWBTree::isStandardId(root))
|
||||
if (m_project->isStandardId(root))
|
||||
root->setId(FWObjectDatabase::generateUniqueId());
|
||||
|
||||
|
||||
for (FWObject::iterator i=root->begin(); i!=root->end(); i++)
|
||||
changeIds( *i );
|
||||
}
|
||||
@ -126,9 +129,9 @@ void LibraryDialog::applyChanges()
|
||||
obj->setName( oldname );
|
||||
}
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
om->updateLibName(obj);
|
||||
if (color!=oldcolor) om->updateLibColor(obj);
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateLibName(obj);
|
||||
if (color!=oldcolor) mw->updateLibColor(obj);
|
||||
|
||||
//apply->setEnabled( false );
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
|
||||
class ProjectPanel;
|
||||
class LibraryDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -44,11 +45,12 @@ class LibraryDialog : public QWidget
|
||||
|
||||
void fillColor();
|
||||
void changeIds(libfwbuilder::FWObject *root);
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
Ui::LibraryDialog_q *m_dialog;
|
||||
|
||||
LibraryDialog(QWidget *parent);
|
||||
LibraryDialog(ProjectPanel *project, QWidget *parent);
|
||||
~LibraryDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,32 +1,34 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder Routing add-on
|
||||
|
||||
Copyright (C) 2004 Compal GmbH, Germany
|
||||
|
||||
Author: Tidei Maurizio <fwbuilder-routing at compal.de>
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -54,7 +56,7 @@ MetricEditorPanel::MetricEditorPanel(QWidget *p):QWidget(p)
|
||||
{
|
||||
m_widget = new Ui::MetricEditorPanel_q;
|
||||
m_widget->setupUi(this);
|
||||
|
||||
|
||||
//spin_box->setMinValue( minValue);
|
||||
//spin_box->setMaxValue( maxValue);
|
||||
//spin_box->setValue( value);
|
||||
@ -70,7 +72,7 @@ void MetricEditorPanel::changed()
|
||||
}
|
||||
void MetricEditorPanel::applyChanges()
|
||||
{
|
||||
om->updateLastModifiedTimestampForAllFirewalls(rule);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(rule);
|
||||
rule->setMetric( value() );
|
||||
mw->updateRuleSetView();
|
||||
}
|
||||
@ -82,7 +84,7 @@ void MetricEditorPanel::loadFWObject(libfwbuilder::FWObject *obj)
|
||||
RoutingRule *r=RoutingRule::cast(obj);
|
||||
if (r==NULL) return;
|
||||
rule=r;
|
||||
|
||||
|
||||
FWObject *o = r;
|
||||
while (o!=NULL && Firewall::cast(o)==NULL) o=o->getParent();
|
||||
assert(o!=NULL);
|
||||
@ -91,7 +93,7 @@ void MetricEditorPanel::loadFWObject(libfwbuilder::FWObject *obj)
|
||||
m_widget->spin_box->setMinimum( 0);
|
||||
m_widget->spin_box->setMaximum( 255);
|
||||
m_widget->spin_box->setValue( r->getMetric());
|
||||
|
||||
|
||||
setTitle(QString("%1 / %2 / %3 ( Metric )")
|
||||
.arg(QString::fromUtf8(f->getName().c_str()))
|
||||
.arg(r->getTypeName().c_str())
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
Copyright (C) 2006 NetCitadel, LLC
|
||||
|
||||
Author: Illiya Yalovoy <yalovoy@gmail.com>
|
||||
|
||||
|
||||
This program is free software which we release under the GNU General Public
|
||||
License. You may redistribute and/or modify this program under the terms
|
||||
of that license as published by the Free Software Foundation; either
|
||||
@ -15,22 +15,24 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "NATRuleOptionsDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "RuleSetView.h"
|
||||
#include "FWWindow.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Rule.h"
|
||||
@ -53,12 +55,12 @@ NATRuleOptionsDialog::~NATRuleOptionsDialog()
|
||||
delete m_dialog;
|
||||
}
|
||||
|
||||
NATRuleOptionsDialog::NATRuleOptionsDialog(QWidget *parent) : QWidget(parent)
|
||||
NATRuleOptionsDialog::NATRuleOptionsDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::NATRuleOptionsDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
@ -105,7 +107,7 @@ void NATRuleOptionsDialog::loadFWObject(FWObject *o)
|
||||
//apply->setEnabled( false );
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void NATRuleOptionsDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
|
||||
class RuleSetView;
|
||||
|
||||
class ProjectPanel;
|
||||
class NATRuleOptionsDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -44,11 +45,12 @@ class NATRuleOptionsDialog : public QWidget
|
||||
QString platform;
|
||||
RuleSetView *rsv;
|
||||
Ui::NATRuleOptionsDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
bool init;
|
||||
|
||||
public:
|
||||
NATRuleOptionsDialog(QWidget *parent);
|
||||
NATRuleOptionsDialog(ProjectPanel *project, QWidget *parent);
|
||||
~NATRuleOptionsDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,22 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "NetworkDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "ProjectPanel.h"
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/Network.h"
|
||||
#include "fwbuilder/Interface.h"
|
||||
@ -45,15 +47,16 @@
|
||||
#include <qpushbutton.h>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
NetworkDialog::NetworkDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
NetworkDialog::NetworkDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::NetworkDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
NetworkDialog::~NetworkDialog() { delete m_dialog; }
|
||||
@ -93,7 +96,7 @@ void NetworkDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void NetworkDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -151,7 +154,7 @@ void NetworkDialog::applyChanges()
|
||||
string oldname=obj->getName();
|
||||
obj->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );
|
||||
obj->setComment( string(m_dialog->comment->toPlainText().toUtf8().constData()) );
|
||||
try
|
||||
try
|
||||
{
|
||||
s->setAddress( m_dialog->address->text().toLatin1().constData() );
|
||||
s->setNetmask( m_dialog->netmask->text().toLatin1().constData() );
|
||||
@ -160,17 +163,17 @@ void NetworkDialog::applyChanges()
|
||||
/* exception thrown if user types illegal m_dialog->address or m_dialog->netmask */
|
||||
|
||||
}
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void NetworkDialog::discardChanges()
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
|
||||
class ProjectPanel;
|
||||
class NetworkDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -41,9 +42,10 @@ class NetworkDialog : public QWidget
|
||||
libfwbuilder::FWObject *obj;
|
||||
Ui::NetworkDialog_q *m_dialog;
|
||||
bool init;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
NetworkDialog(QWidget *parent);
|
||||
NetworkDialog(ProjectPanel *project, QWidget *parent);
|
||||
~NetworkDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -59,7 +61,7 @@ ObjConflictResolutionDialog::ObjConflictResolutionDialog(QWidget *parent): QDial
|
||||
m_dialog = new Ui::ObjConflictResolutionDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setObjectName("ObjConflictResolutionDialog");
|
||||
|
||||
|
||||
alwaysCurrent=false;
|
||||
alwaysNew =false;
|
||||
m_dialog->dlgIcon->setPixmap( QMessageBox::standardIcon( QMessageBox::Warning ) );
|
||||
@ -92,9 +94,9 @@ int ObjConflictResolutionDialog::run( FWObject *o1,
|
||||
// checked checkbox that makes decision without
|
||||
// them having to click a button. This is so that
|
||||
// classes that inherit from ObjConflictResolutionDialog
|
||||
// can use data collected in this method. Particularly
|
||||
// can use data collected in this method. Particularly
|
||||
// CompareObjectsDialog::run needs it
|
||||
|
||||
|
||||
|
||||
QString leftBtnTxt, rightBtnTxt;
|
||||
bool leftCB, rightCB, leftBtn, rightBtn;
|
||||
@ -150,7 +152,7 @@ int ObjConflictResolutionDialog::run( FWObject *o1,
|
||||
true,
|
||||
false,
|
||||
false);
|
||||
|
||||
|
||||
|
||||
m_dialog->useCurrentObj->setText(leftBtnTxt);
|
||||
m_dialog->useNewObj->setText(rightBtnTxt);
|
||||
@ -186,7 +188,7 @@ int ObjConflictResolutionDialog::run( FWObject *o1,
|
||||
|
||||
m_dialog->currentObjLbl->setText(f1);
|
||||
m_dialog->newObjLbl->setText(f2);
|
||||
|
||||
|
||||
m_dialog->currentObj->clear();
|
||||
m_dialog->newObj->clear();
|
||||
|
||||
@ -230,7 +232,7 @@ void ObjConflictResolutionDialog::saveGeometry()
|
||||
* geometry (it is bad to get geometry of the window when it is hidden
|
||||
* because at that time window manager decorations do not exist
|
||||
* anymore, so window's position on the screen is shiften up and to
|
||||
* the left).
|
||||
* the left).
|
||||
*
|
||||
* It seems under certain window manager (at this time it is unknown
|
||||
* which one) in Gnome "close event" is generated after the window is
|
||||
@ -379,7 +381,7 @@ int CompareObjectsDialog::run(FWObject *o1,FWObject *o2)
|
||||
|
||||
QString k = (*i1).section(':',0,0).trimmed();
|
||||
QString v = (*i1).section(':',1).trimmed();
|
||||
if (v=="")
|
||||
if (v=="")
|
||||
{
|
||||
v = k;
|
||||
k = tstr.str().c_str();
|
||||
@ -410,7 +412,7 @@ int CompareObjectsDialog::run(FWObject *o1,FWObject *o2)
|
||||
propdict2[k] = v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QStringList::Iterator i3 = report_attributes.begin();
|
||||
for ( ; i3!=report_attributes.end(); ++i3)
|
||||
{
|
||||
@ -471,7 +473,7 @@ int CompareObjectsDialog::run(FWObject *o1,FWObject *o2)
|
||||
}
|
||||
|
||||
str << setw(78) << setfill('-') << '-' << endl;
|
||||
|
||||
|
||||
report.push_back( QString(str.str().c_str()) );
|
||||
|
||||
return res;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -41,13 +43,13 @@
|
||||
|
||||
#include "DialogFactory.h"
|
||||
#include "FWBTree.h"
|
||||
#include "FWWindow.h"
|
||||
#include "ProjectPanel.h"
|
||||
#include "FWBSettings.h"
|
||||
#include "GroupObjectDialog.h"
|
||||
#include "ActionsDialog.h"
|
||||
#include "MetricEditorPanel.h"
|
||||
#include "CommentEditorPanel.h"
|
||||
|
||||
#include "ObjectManipulator.h"
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Host.h"
|
||||
@ -84,11 +86,11 @@ using namespace libfwbuilder;
|
||||
|
||||
|
||||
|
||||
ObjectEditor::ObjectEditor( QWidget *parent ): QObject(parent)
|
||||
ObjectEditor::ObjectEditor( QWidget *parent, ProjectPanel *project):
|
||||
QObject(parent), opened(0), visible(-1),
|
||||
parentWidget(dynamic_cast<QStackedWidget*>(parent)), closeButton(0), applyButton(0),
|
||||
m_project(project), openedOpt(optNone)
|
||||
{
|
||||
opened = NULL;
|
||||
openedOpt = optNone;
|
||||
visible = -1;
|
||||
|
||||
#if defined(Q_WS_X11)
|
||||
/* do something that makes sense only on X11 */
|
||||
@ -100,102 +102,101 @@ ObjectEditor::ObjectEditor( QWidget *parent ): QObject(parent)
|
||||
|
||||
#endif
|
||||
|
||||
parentWidget=(QStackedWidget*)parent;
|
||||
QWidget *w;
|
||||
w= DialogFactory::createDialog(parent,Library::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,Library::TYPENAME);
|
||||
stackIds[Library::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[Library::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,IPv4::TYPENAME);
|
||||
|
||||
w= DialogFactory::createDialog(m_project, parent,IPv4::TYPENAME);
|
||||
stackIds[IPv4::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[IPv4::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,physAddress::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,physAddress::TYPENAME);
|
||||
stackIds[physAddress::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[physAddress::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,AddressRange::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,AddressRange::TYPENAME);
|
||||
stackIds[AddressRange::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[AddressRange::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,Firewall::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,Firewall::TYPENAME);
|
||||
stackIds[Firewall::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[Firewall::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,Host::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,Host::TYPENAME);
|
||||
stackIds[Host::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[Host::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,Interface::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,Interface::TYPENAME);
|
||||
stackIds[Interface::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[Interface::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,Network::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,Network::TYPENAME);
|
||||
stackIds[Network::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[Network::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,CustomService::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,CustomService::TYPENAME);
|
||||
stackIds[CustomService::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[CustomService::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,IPService::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,IPService::TYPENAME);
|
||||
stackIds[IPService::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[IPService::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,ICMPService::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,ICMPService::TYPENAME);
|
||||
stackIds[ICMPService::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[ICMPService::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,TCPService::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,TCPService::TYPENAME);
|
||||
stackIds[TCPService::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[TCPService::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,UDPService::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,UDPService::TYPENAME);
|
||||
stackIds[UDPService::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[UDPService::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,ObjectGroup::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,ObjectGroup::TYPENAME);
|
||||
stackIds[ObjectGroup::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[ObjectGroup::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,ServiceGroup::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,ServiceGroup::TYPENAME);
|
||||
stackIds[ServiceGroup::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[ServiceGroup::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,IntervalGroup::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,IntervalGroup::TYPENAME);
|
||||
stackIds[IntervalGroup::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[IntervalGroup::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,Interval::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,Interval::TYPENAME);
|
||||
stackIds[Interval::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[Interval::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,Rule::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,Rule::TYPENAME);
|
||||
stackIds[Rule::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[Rule::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,RoutingRule::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,RoutingRule::TYPENAME);
|
||||
stackIds[RoutingRule::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[RoutingRule::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,PolicyRule::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,PolicyRule::TYPENAME);
|
||||
stackIds[PolicyRule::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[PolicyRule::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,NATRule::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,NATRule::TYPENAME);
|
||||
stackIds[NATRule::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[NATRule::TYPENAME]] = w;
|
||||
|
||||
|
||||
w= DialogFactory::createDialog(parent,DNSName::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,DNSName::TYPENAME);
|
||||
stackIds[DNSName::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[DNSName::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,AddressTable::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,AddressTable::TYPENAME);
|
||||
stackIds[AddressTable::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[AddressTable::TYPENAME]] = w;
|
||||
|
||||
w= DialogFactory::createDialog(parent,TagService::TYPENAME);
|
||||
w= DialogFactory::createDialog(m_project, parent,TagService::TYPENAME);
|
||||
stackIds[TagService::TYPENAME] = parentWidget->addWidget(w);
|
||||
dialogs[stackIds[TagService::TYPENAME]] = w;
|
||||
|
||||
@ -229,7 +230,7 @@ void ObjectEditor::show()
|
||||
// dialogs[ visible ]->move(st->getScreenPosition("Object Editor"));
|
||||
//dialogs[ visible ]->show();
|
||||
parentWidget->setCurrentIndex(visible);
|
||||
mw->openEditorPanel();
|
||||
m_project->openEditorPanel();
|
||||
}
|
||||
|
||||
void ObjectEditor::hide()
|
||||
@ -251,7 +252,7 @@ void ObjectEditor::hide()
|
||||
//
|
||||
// dialogs[ visible ]->hide();
|
||||
// }
|
||||
mw->closeEditorPanel();
|
||||
m_project->closeEditorPanel();
|
||||
visible=-1;
|
||||
}
|
||||
|
||||
@ -274,7 +275,7 @@ QString ObjectEditor::getOptDialogName(OptType t)
|
||||
void ObjectEditor::openOpt(FWObject *obj,OptType t)
|
||||
{
|
||||
if (Rule::cast(obj)==NULL) return;
|
||||
|
||||
|
||||
disconnectSignals();
|
||||
|
||||
int wid= stackIds[getOptDialogName(t)];
|
||||
@ -290,7 +291,7 @@ void ObjectEditor::openOpt(FWObject *obj,OptType t)
|
||||
connect(this, SIGNAL(validate_sign(bool*)),
|
||||
dialogs[ wid ],
|
||||
SLOT(validate(bool*)));
|
||||
|
||||
|
||||
connect(this, SIGNAL(applyChanges_sign()),
|
||||
dialogs[ wid ],
|
||||
SLOT(applyChanges()));
|
||||
@ -307,11 +308,11 @@ void ObjectEditor::openOpt(FWObject *obj,OptType t)
|
||||
SLOT(changed()));
|
||||
|
||||
emit loadObject_sign(obj);
|
||||
|
||||
|
||||
opened = obj;
|
||||
openedOpt = t;
|
||||
applyButton->setEnabled(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ObjectEditor::open(FWObject *obj)
|
||||
@ -331,8 +332,8 @@ void ObjectEditor::open(FWObject *obj)
|
||||
// disconnect( SIGNAL(close_sign(QCloseEvent*)) );
|
||||
|
||||
//hide();
|
||||
|
||||
|
||||
|
||||
|
||||
visible=wid;
|
||||
|
||||
show();
|
||||
@ -344,11 +345,11 @@ void ObjectEditor::open(FWObject *obj)
|
||||
connect(this, SIGNAL(validate_sign(bool*)),
|
||||
dialogs[ wid ],
|
||||
SLOT(validate(bool*)));
|
||||
|
||||
|
||||
//connect(this, SIGNAL(isChanged_sign(bool*)),
|
||||
// dialogs[ wid ],
|
||||
// SLOT(isChanged(bool*)));
|
||||
|
||||
|
||||
connect(this, SIGNAL(applyChanges_sign()),
|
||||
dialogs[ wid ],
|
||||
SLOT(applyChanges()));
|
||||
@ -403,7 +404,7 @@ void ObjectEditor::validateAndClose(QCloseEvent *e)
|
||||
{
|
||||
if (e) e->accept();
|
||||
//disconnectSignals(); // all signals will be disconnected
|
||||
// in next open(...)
|
||||
// in next open(...)
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
@ -417,9 +418,9 @@ bool ObjectEditor::validateAndSave()
|
||||
bool ischanged=false;
|
||||
ischanged = isModified();
|
||||
//emit isChanged_sign(&ischanged);
|
||||
|
||||
|
||||
/* if nothing changed or tree is read-only, just close dialog */
|
||||
if (!ischanged || !isTreeReadWrite(dialogs[ visible ],mw->db()))
|
||||
if (!ischanged || !isTreeReadWrite(dialogs[ visible ],m_project->db()))
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectEditor::validateAndSave: no changes");
|
||||
@ -491,7 +492,7 @@ void ObjectEditor::setApplyButton(QPushButton * b)
|
||||
applyButton=b;
|
||||
applyButton->setEnabled(false);
|
||||
connect((QWidget*)applyButton,SIGNAL(clicked()),this,SLOT(apply()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ObjectEditor::close()
|
||||
@ -509,9 +510,9 @@ void ObjectEditor::apply()
|
||||
{
|
||||
emit applyChanges_sign();
|
||||
applyButton->setEnabled(false);
|
||||
mw->updateRuleSetView( );
|
||||
m_project->updateRuleSetView( );
|
||||
|
||||
mw->updateTreeViewItemOrder();
|
||||
m_project->updateTreeViewItemOrder();
|
||||
}
|
||||
}
|
||||
|
||||
@ -552,7 +553,7 @@ void ObjectEditor::actionChanged(FWObject *o)
|
||||
}
|
||||
//if (opened==o) return;
|
||||
openOpt (o,ObjectEditor::optAction);
|
||||
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ class ObjectTreeViewItem;
|
||||
class QComboBox;
|
||||
class QMenu;
|
||||
class QStackedWidget;
|
||||
class ProjectPanel;
|
||||
|
||||
class ObjectEditor : public QObject {
|
||||
|
||||
@ -55,6 +56,7 @@ class ObjectEditor : public QObject {
|
||||
QStackedWidget *parentWidget;
|
||||
QPushButton *closeButton;
|
||||
QPushButton *applyButton;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
void disconnectSignals();
|
||||
|
||||
@ -62,11 +64,10 @@ public:
|
||||
enum OptType{optAction,optComment,optMetric,optNone};
|
||||
private:
|
||||
OptType openedOpt;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
ObjectEditor( QWidget *parent );
|
||||
ObjectEditor( QWidget *parent, ProjectPanel *project);
|
||||
virtual ~ObjectEditor() {}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -77,12 +79,12 @@ bool ObjectIconView::event ( QEvent * event )
|
||||
if (st->getObjTooltips())
|
||||
{
|
||||
int cx = pos.x(), cy = pos.y();
|
||||
|
||||
|
||||
//viewportToContents(pos.x(),pos.y(),cx,cy);
|
||||
|
||||
|
||||
FWObject *obj=NULL;
|
||||
QRect cr;
|
||||
|
||||
|
||||
QListWidgetItem *itm = itemAt( QPoint(cx,cy) );
|
||||
QModelIndex ind = indexAt( QPoint(cx,cy) );
|
||||
if (itm==NULL) return false;
|
||||
@ -91,7 +93,7 @@ bool ObjectIconView::event ( QEvent * event )
|
||||
obj = oivi->getFWObject();
|
||||
|
||||
if (obj==NULL) return false;
|
||||
|
||||
|
||||
cr = rectForIndex(ind);
|
||||
cr = QRect(
|
||||
cr.left() - horizontalOffset(),
|
||||
@ -101,16 +103,16 @@ bool ObjectIconView::event ( QEvent * event )
|
||||
|
||||
QRect global = QRect(
|
||||
viewport()->mapToGlobal(cr.topLeft()), viewport()->mapToGlobal(cr.bottomRight()));
|
||||
|
||||
|
||||
QToolTip::showText(mapToGlobal( he->pos() ),
|
||||
FWObjectPropertiesFactory::getObjectPropertiesDetailed(obj,true,true),
|
||||
|
||||
|
||||
QToolTip::showText(mapToGlobal( he->pos() ),
|
||||
FWObjectPropertiesFactory::getObjectPropertiesDetailed(obj,true,true),
|
||||
this, global);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return QListWidget::event(event);
|
||||
}
|
||||
|
||||
@ -179,7 +181,7 @@ void ObjectIconView::mousePressEvent ( QMouseEvent * event )
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectIconView::mousePressEvent");
|
||||
|
||||
|
||||
startingDrag = true;
|
||||
QListWidget::mousePressEvent(event);
|
||||
}
|
||||
@ -190,11 +192,11 @@ void ObjectIconView::mouseMoveEvent ( QMouseEvent * event )
|
||||
{
|
||||
startingDrag = false;
|
||||
QDrag *dr = dragObject();
|
||||
|
||||
|
||||
if (dr)
|
||||
dr->start();
|
||||
}
|
||||
QListWidget::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -76,12 +78,12 @@ bool ObjectListView::event ( QEvent * event )
|
||||
if (st->getObjTooltips())
|
||||
{
|
||||
int cx = pos.x(), cy = pos.y();
|
||||
|
||||
|
||||
//viewportToContents(pos.x(),pos.y(),cx,cy);
|
||||
|
||||
|
||||
FWObject *obj=NULL;
|
||||
QRect cr;
|
||||
|
||||
|
||||
QTreeWidgetItem *itm = itemAt( QPoint(cx,cy - header()->height()) );
|
||||
if (itm==NULL) return false;
|
||||
ObjectListViewItem *oivi = dynamic_cast<ObjectListViewItem*>(itm);
|
||||
@ -89,7 +91,7 @@ bool ObjectListView::event ( QEvent * event )
|
||||
obj = oivi->getFWObject();
|
||||
|
||||
if (obj==NULL) return false;
|
||||
|
||||
|
||||
cr = visualItemRect(itm);
|
||||
|
||||
QRect global = QRect(
|
||||
@ -97,16 +99,16 @@ bool ObjectListView::event ( QEvent * event )
|
||||
|
||||
//finally stretch rect up to component's width and even more
|
||||
//(it fixes bug with horizontal scroll)
|
||||
global.setWidth(width() + horizontalOffset());
|
||||
global.setWidth(width() + horizontalOffset());
|
||||
|
||||
QToolTip::showText(mapToGlobal( he->pos() ),
|
||||
FWObjectPropertiesFactory::getObjectPropertiesDetailed(obj,true,true),
|
||||
QToolTip::showText(mapToGlobal( he->pos() ),
|
||||
FWObjectPropertiesFactory::getObjectPropertiesDetailed(obj,true,true),
|
||||
this, global);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return QTreeWidget::event(event);
|
||||
}
|
||||
|
||||
@ -132,7 +134,7 @@ QDrag* ObjectListView::dragObject()
|
||||
pm.load( icn );
|
||||
QPixmapCache::insert( icn, pm);
|
||||
}
|
||||
|
||||
|
||||
drag->setPixmap( pm );
|
||||
drag->setHotSpot( QPoint( pm.rect().width() / 2,
|
||||
pm.rect().height() / 2 ) );
|
||||
@ -159,7 +161,7 @@ void ObjectListView::dropEvent(QDropEvent *ev)
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectListView::dropEvent");
|
||||
emit dropped(ev);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectListView::keyPressEvent( QKeyEvent* ev )
|
||||
{
|
||||
@ -182,10 +184,10 @@ void ObjectListView::mouseMoveEvent ( QMouseEvent * event )
|
||||
{
|
||||
QDrag *dr = dragObject();
|
||||
dr->start();
|
||||
|
||||
|
||||
startingDrag = false;
|
||||
}
|
||||
QTreeWidget::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -42,7 +44,7 @@
|
||||
#include "newHostDialog.h"
|
||||
#include "findDialog.h"
|
||||
#include "newGroupDialog.h"
|
||||
#include "FindObjectWidget.h"
|
||||
#include "FindObjectWidget.h"
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QTime>
|
||||
@ -72,9 +74,10 @@
|
||||
#include <QPixmap>
|
||||
|
||||
|
||||
#include "DialogFactory.h"
|
||||
#include "DialogFactory.h"
|
||||
#include "FWBTree.h"
|
||||
#include "FWWindow.h"
|
||||
#include "ProjectPanel.h"
|
||||
#include "ConfirmDeleteObjectDialog.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
@ -125,18 +128,24 @@ ObjectManipulator::~ObjectManipulator()
|
||||
delete m_objectManipulator;
|
||||
}
|
||||
|
||||
ObjectManipulator::ObjectManipulator( QWidget *parent ): QWidget(parent)
|
||||
ObjectManipulator::ObjectManipulator( QWidget *parent):
|
||||
QWidget(parent), currentObj(0), current_tree_view(0)
|
||||
{
|
||||
m_objectManipulator = new Ui::ObjectManipulator_q;
|
||||
m_objectManipulator->setupUi(this);
|
||||
setObjectName(tr("Object Manipulator"));
|
||||
|
||||
QObject* par = parent;
|
||||
while(! (m_project = dynamic_cast<ProjectPanel*>(par)))
|
||||
{
|
||||
par = par->parent();
|
||||
}
|
||||
|
||||
treeWidth = -1;
|
||||
treeHeight = -1;
|
||||
currentObj = NULL;
|
||||
active = false;
|
||||
current_tree_view=NULL;
|
||||
|
||||
|
||||
// setFocusPolicy( QWidget::StrongFocus );
|
||||
|
||||
/* Adding pop-down menu to the button "New" */
|
||||
@ -146,7 +155,7 @@ ObjectManipulator::ObjectManipulator( QWidget *parent ): QWidget(parent)
|
||||
QMenu* newObjectPopup = new QMenu( this );
|
||||
|
||||
newObjectPopup->addAction(QIcon(icon_path+Library::TYPENAME+"/icon-tree"), tr( "New &Library" ), this, SLOT( newLibrary() ));
|
||||
|
||||
|
||||
newObjectPopup->addSeparator();
|
||||
|
||||
newObjectPopup->addAction(QIcon(icon_path+Firewall::TYPENAME+"/icon-tree"), tr( "New &Firewall" ), this, SLOT( newFirewall() ));
|
||||
@ -209,7 +218,7 @@ QString ObjectManipulator::getTreeLabel( FWObject *obj )
|
||||
if (q!="") name=name+" ("+q+")";
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
name=QString::fromUtf8(obj->getName().c_str());
|
||||
if (Library::isA(obj) && obj->isReadOnly())
|
||||
name=name+QObject::tr(" ( read only )");
|
||||
@ -235,7 +244,7 @@ ObjectTreeViewItem* ObjectManipulator::insertObject( ObjectTreeViewItem *itm,
|
||||
|
||||
QString icn_filename;
|
||||
|
||||
if (FWBTree::isSystem(obj)) icn_filename=":/Icons/folder1.png";
|
||||
if (m_project->isSystem(obj)) icn_filename=":/Icons/folder1.png";
|
||||
else
|
||||
icn_filename=(":/Icons/"+obj->getTypeName()+"/icon-tree").c_str();
|
||||
//icn_filename=Resources::global_res->getObjResourceStr(obj, "icon-tree").c_str();
|
||||
@ -275,9 +284,9 @@ void ObjectManipulator::insertSubtree( ObjectTreeViewItem *itm,
|
||||
ObjectTreeViewItem *nitm = insertObject(itm, obj);
|
||||
|
||||
if (nitm==NULL) return;
|
||||
if ( FWBTree::isSystem(obj) ) nitm->setExpanded( st->getExpandTree() );
|
||||
if ( m_project->isSystem(obj) ) nitm->setExpanded( st->getExpandTree() );
|
||||
|
||||
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
|
||||
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
|
||||
{
|
||||
FWObject *o1=*m;
|
||||
if (FWReference::cast(o1)!=NULL) continue;
|
||||
@ -289,18 +298,18 @@ void ObjectManipulator::showDeletedObjects(bool f)
|
||||
{
|
||||
try
|
||||
{
|
||||
FWObject *dobj = mw->db()->findInIndex( FWObjectDatabase::getDeletedObjectsId());
|
||||
FWObject *dobj = m_project->db()->findInIndex( FWObjectDatabase::getDeletedObjectsId());
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::showDeletedObjects f=%d dobj=%p",f, dobj);
|
||||
|
||||
if (dobj==NULL)
|
||||
{
|
||||
dobj=mw->db()->create(Library::TYPENAME);
|
||||
dobj->setId(mw->db()->getDeletedObjectsId());
|
||||
dobj=m_project->db()->create(Library::TYPENAME);
|
||||
dobj->setId(m_project->db()->getDeletedObjectsId());
|
||||
dobj->setName("Deleted Objects");
|
||||
dobj->setReadOnly(false);
|
||||
mw->db()->add(dobj);
|
||||
m_project->db()->add(dobj);
|
||||
}
|
||||
|
||||
int idx = getIdxForLib(dobj);
|
||||
@ -354,7 +363,7 @@ void ObjectManipulator::updateLibColor(FWObject *lib)
|
||||
|
||||
QString clr=lib->getStr("color").c_str();
|
||||
if (clr=="" || clr=="#000000" || clr=="black") clr="#FFFFFF";
|
||||
|
||||
|
||||
QPalette palette = objTreeView->palette();
|
||||
palette.setColor(QPalette::Active, QPalette::Base, QColor( clr ));
|
||||
objTreeView->setPalette(palette);
|
||||
@ -371,7 +380,7 @@ int ObjectManipulator::getIdxForLib(FWObject* lib)
|
||||
void ObjectManipulator::updateLibName(FWObject *lib)
|
||||
{
|
||||
int oldidx = getIdxForLib(lib);
|
||||
QTreeWidget *objTreeView = idxToTrees[oldidx];
|
||||
QTreeWidget *objTreeView = idxToTrees[oldidx];
|
||||
QString newlibname = QString::fromUtf8(lib->getName().c_str());
|
||||
|
||||
if (m_objectManipulator->libs->itemText(oldidx)!=newlibname)
|
||||
@ -382,7 +391,7 @@ void ObjectManipulator::updateLibName(FWObject *lib)
|
||||
// idxToTrees.erase(oldidx);
|
||||
|
||||
addLib(lib,objTreeView);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,7 +406,7 @@ void ObjectManipulator::updateObjName(FWObject *obj,
|
||||
bool askForAutorename)
|
||||
{
|
||||
info(); // need to update info in case user edited comments and other attributes.
|
||||
|
||||
|
||||
if (oldName == obj->getName().c_str()) return;
|
||||
|
||||
if (obj!=currentObj) openObject(obj);
|
||||
@ -428,21 +437,21 @@ void ObjectManipulator::updateObjName(FWObject *obj,
|
||||
/* need to update name of the firewall in the drop-down list */
|
||||
if (Firewall::isA(obj))
|
||||
{
|
||||
mw->updateFirewallName(obj,oldName);
|
||||
m_project->updateFirewallName(obj,oldName);
|
||||
}
|
||||
|
||||
// reopenFirewalls is called from FirewallDialog::applyChanges()
|
||||
//if (QString::fromUtf8(obj->getName().c_str())!=oldName)
|
||||
//if (QString::fromUtf8(obj->getName().c_str())!=oldName)
|
||||
//{
|
||||
// QTimer::singleShot( 0, mw, SLOT(reopenFirewall()) );
|
||||
// QTimer::singleShot( 0, m_project, SLOT(reopenFirewall()) );
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* variant specifically used for interfaces that have name and a label
|
||||
*/
|
||||
*/
|
||||
void ObjectManipulator::updateObjName(FWObject *obj,
|
||||
const QString &oldName,
|
||||
const QString &oldLabel,
|
||||
@ -469,8 +478,8 @@ void ObjectManipulator::updateObjName(FWObject *obj,
|
||||
if ((i!=NULL && i->getLabel()!=oldLabel.toLatin1().constData()) ||
|
||||
(QString::fromUtf8(obj->getName().c_str())!=oldName))
|
||||
{
|
||||
//mw->reopenFirewall();
|
||||
mw->scheduleRuleSetRedraw();
|
||||
//m_project->reopenFirewall();
|
||||
m_project->scheduleRuleSetRedraw();
|
||||
}
|
||||
|
||||
info(); // need to update info in case user edited comments and other attributes.
|
||||
@ -481,7 +490,7 @@ void ObjectManipulator::autorename(FWObject *obj,bool ask)
|
||||
if (Host::isA(obj) || Firewall::isA(obj))
|
||||
{
|
||||
if (!ask || QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr(
|
||||
"The name of the object '%1' has changed. The program can also\n"
|
||||
"rename IP address objects that belong to this object,\n"
|
||||
@ -510,7 +519,7 @@ void ObjectManipulator::autorename(FWObject *obj,bool ask)
|
||||
if (Interface::isA(obj))
|
||||
{
|
||||
if (!ask || QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr(
|
||||
"The name of the interface '%1' has changed. The program can also\n"
|
||||
"rename IP address objects that belong to this interface,\n"
|
||||
@ -597,7 +606,7 @@ void ObjectManipulator::clearObjects()
|
||||
|
||||
void ObjectManipulator::loadObjects()
|
||||
{
|
||||
loadObjects( mw->db() );
|
||||
loadObjects( m_project->db() );
|
||||
}
|
||||
|
||||
void ObjectManipulator::loadObjects(FWObjectDatabase *)
|
||||
@ -607,7 +616,7 @@ void ObjectManipulator::loadObjects(FWObjectDatabase *)
|
||||
if (m_objectManipulator->libs->count()!=0) clearObjects();
|
||||
|
||||
FWObject *firstUserLib=NULL;
|
||||
list<FWObject*> ll = mw->db()->getByType( Library::TYPENAME );
|
||||
list<FWObject*> ll = m_project->db()->getByType( Library::TYPENAME );
|
||||
|
||||
// ll.sort(FWObjectNameCmpPredicate());
|
||||
|
||||
@ -661,14 +670,14 @@ void ObjectManipulator::addLib( FWObject *lib,QTreeWidget* otv)
|
||||
|
||||
idxToLibs.insert(i1,lib);
|
||||
if (otv!=NULL) idxToTrees.insert(i2,otv);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ObjectManipulator::addTreePage( FWObject *lib)
|
||||
{
|
||||
if (fwbdebug) qDebug("Object Manipulator::addTreePage");
|
||||
|
||||
ObjectTreeView *objTreeView = new ObjectTreeView( m_objectManipulator->widgetStack,
|
||||
|
||||
ObjectTreeView *objTreeView = new ObjectTreeView(m_project, m_objectManipulator->widgetStack,
|
||||
OBJTREEVIEW_WIDGET_NAME );
|
||||
|
||||
addLib(lib,objTreeView);
|
||||
@ -677,7 +686,7 @@ void ObjectManipulator::addTreePage( FWObject *lib)
|
||||
policy.setHorizontalStretch(0);
|
||||
policy.setVerticalStretch(0);
|
||||
policy.setHeightForWidth(objTreeView->sizePolicy().hasHeightForWidth());
|
||||
|
||||
|
||||
objTreeView->setSizePolicy(policy);
|
||||
|
||||
m_objectManipulator->widgetStack->addWidget( objTreeView );
|
||||
@ -688,7 +697,7 @@ void ObjectManipulator::addTreePage( FWObject *lib)
|
||||
|
||||
updateLibColor( lib );
|
||||
// updateLibName( lib );
|
||||
|
||||
|
||||
//objTreeView->setContextMenuPolicy( Qt::CustomContextMenu );
|
||||
|
||||
connect(m_objectManipulator->widgetStack, SIGNAL( currentChanged(int) ),
|
||||
@ -696,7 +705,7 @@ void ObjectManipulator::addTreePage( FWObject *lib)
|
||||
|
||||
connect(objTreeView,SIGNAL( editCurrentObject_sign() ),
|
||||
this, SLOT( editSelectedObject()) );
|
||||
|
||||
|
||||
connect(objTreeView,SIGNAL( editCurrentObject_sign() ),
|
||||
this, SLOT( editSelectedObject()) );
|
||||
|
||||
@ -737,7 +746,7 @@ void ObjectManipulator::addTreePage( FWObject *lib)
|
||||
}
|
||||
itm1->setIcon(0, pm );
|
||||
} else
|
||||
{
|
||||
{
|
||||
string icn=":/Icons/"+lib->getTypeName()+"/icon-tree";
|
||||
//Resources::global_res->getObjResourceStr(lib,"icon-tree").c_str();
|
||||
QPixmap pm;
|
||||
@ -756,7 +765,7 @@ void ObjectManipulator::addTreePage( FWObject *lib)
|
||||
|
||||
// objTreeView->setSelected( itm1, true );
|
||||
|
||||
for (list<FWObject*>::iterator m=lib->begin(); m!=lib->end(); m++)
|
||||
for (list<FWObject*>::iterator m=lib->begin(); m!=lib->end(); m++)
|
||||
insertSubtree( itm1, (*m) );
|
||||
objTreeView->updateTreeItems();
|
||||
objTreeView->sortByColumn(0,Qt::AscendingOrder);
|
||||
@ -800,7 +809,7 @@ void ObjectManipulator::switchingTrees(QWidget* w)
|
||||
|
||||
if (!new_otv)
|
||||
return;//assert(new_otv)
|
||||
|
||||
|
||||
|
||||
if (current_tree_view!=NULL) current_tree_view->becomingHidden();
|
||||
new_otv->becomingVisible();
|
||||
@ -830,7 +839,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
|
||||
QTreeWidget *objTreeView = getCurrentObjectTree();
|
||||
QTreeWidgetItem *item = objTreeView->itemAt(pos);//clicked item
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::contextMenu selectedObjects.size=%d",
|
||||
getCurrentObjectTree()->getNumSelected());
|
||||
@ -849,7 +858,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
|
||||
QMenu *duptargets = new QMenu(popup);
|
||||
QMenu *movetargets = new QMenu(popup);
|
||||
|
||||
|
||||
connect ( movetargets, SIGNAL ( triggered(QAction*) ),
|
||||
this, SLOT( moveObj(QAction*) ) );
|
||||
connect ( duptargets, SIGNAL ( triggered(QAction*) ),
|
||||
@ -860,8 +869,8 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
* objects. Method moveObj knows that library should not be moved
|
||||
* into another library.
|
||||
*/
|
||||
bool libSelected =
|
||||
(getCurrentObjectTree()->getNumSelected()==1 &&
|
||||
bool libSelected =
|
||||
(getCurrentObjectTree()->getNumSelected()==1 &&
|
||||
Library::isA(getCurrentObjectTree()->getSelectedObjects().front()));
|
||||
|
||||
int libid = 0;
|
||||
@ -874,7 +883,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
FWObject *lib = *i;
|
||||
|
||||
/* can't move to the same library. Will use menu item 'create
|
||||
* here' to duplicate to the same library
|
||||
* here' to duplicate to the same library
|
||||
*/
|
||||
if (lib==cl) continue;
|
||||
|
||||
@ -889,7 +898,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
|
||||
//duptargets->connectItem( did, this, SLOT( duplicateObj(int)) ); replaced with preprevious string
|
||||
//duptargets->setItemParameter(did, libid ); replaced with next:
|
||||
dact->setData(libid);
|
||||
dact->setData(libid);
|
||||
|
||||
if (!libSelected)
|
||||
{
|
||||
@ -938,7 +947,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
popup->addSeparator();
|
||||
|
||||
if ( (Firewall::isA(currentObj) || Host::isA(currentObj)) &&
|
||||
if ( (Firewall::isA(currentObj) || Host::isA(currentObj)) &&
|
||||
! currentObj->isReadOnly() )
|
||||
newID1=popup->addAction( tr("Add Interface"), this ,
|
||||
SLOT( newInterface() ) );
|
||||
@ -1038,13 +1047,13 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
SLOT( groupObjects() ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (Firewall::cast(currentObj)!=NULL || ObjectGroup::cast(currentObj)!=NULL)
|
||||
{
|
||||
popup->addSeparator();
|
||||
popup->addAction( tr("Compile") , this , SLOT( compile()));
|
||||
popup->addAction( tr("Install") , this , SLOT( install()));
|
||||
|
||||
|
||||
// popup->addSeparator();
|
||||
// popup->addAction( tr("Simulate install") , this , SLOT( simulateInstall()));
|
||||
}
|
||||
@ -1056,7 +1065,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
SLOT( unlockObject() ) );
|
||||
lcID->setEnabled(getCurrentObjectTree()->isLockable());
|
||||
unlcID->setEnabled(getCurrentObjectTree()->isUnlockable());
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
/* keep this for debugging */
|
||||
@ -1066,7 +1075,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
|
||||
if (getCurrentObjectTree()->getNumSelected()==1)
|
||||
{
|
||||
edtID->setEnabled(! FWBTree::isSystem(currentObj) );
|
||||
edtID->setEnabled(! m_project->isSystem(currentObj) );
|
||||
} else
|
||||
edtID->setEnabled(false);
|
||||
|
||||
@ -1082,11 +1091,11 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
||||
dupMenuItem,moveMenuItem,copyMenuItem,pasteMenuItem,
|
||||
delMenuItem,newMenuItem,inDeletedObjects);
|
||||
|
||||
dupID->setEnabled(dupMenuItem);
|
||||
dupID->setEnabled(dupMenuItem);
|
||||
movID->setEnabled(moveMenuItem);
|
||||
copyID->setEnabled(copyMenuItem);
|
||||
pasteID->setEnabled(pasteMenuItem);
|
||||
|
||||
|
||||
cutID->setEnabled(copyMenuItem);
|
||||
delID->setEnabled(delMenuItem);
|
||||
|
||||
@ -1120,7 +1129,7 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
|
||||
inDeletedObjects = false;
|
||||
|
||||
FWObject *delObjLib =
|
||||
mw->db()->findInIndex( FWObjectDatabase::getDeletedObjectsId());
|
||||
m_project->db()->findInIndex( FWObjectDatabase::getDeletedObjectsId());
|
||||
|
||||
vector<FWObject*> so = getCurrentObjectTree()->getSelectedObjects();
|
||||
for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i)
|
||||
@ -1129,11 +1138,11 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
|
||||
|
||||
QString objPath = obj->getPath(true).c_str();
|
||||
|
||||
copyMenuItem = copyMenuItem && FWBTree::getCopyMenuState(objPath);
|
||||
copyMenuItem = copyMenuItem && m_project->getCopyMenuState(objPath);
|
||||
pasteMenuItem = pasteMenuItem &&
|
||||
FWBTree::getPasteMenuState(objPath) &&
|
||||
m_project->getPasteMenuState(objPath) &&
|
||||
(FWObjectClipboard::obj_clipboard->size()!=0);
|
||||
delMenuItem = delMenuItem && FWBTree::getDeleteMenuState(objPath);
|
||||
delMenuItem = delMenuItem && m_project->getDeleteMenuState(objPath);
|
||||
|
||||
if (pasteMenuItem)
|
||||
{
|
||||
@ -1144,20 +1153,20 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
{
|
||||
FWObject *co= mw->db()->findInIndex(*i);
|
||||
FWObject *co= m_project->db()->findInIndex(*i);
|
||||
FWObject *nobj=pasteTo( obj , co , false, true);
|
||||
pasteMenuItem = pasteMenuItem && (nobj!=NULL);
|
||||
}
|
||||
}
|
||||
|
||||
dupMenuItem=
|
||||
(dupMenuItem && ! FWBTree::isSystem(obj) && ! Library::isA(obj) );
|
||||
(dupMenuItem && ! m_project->isSystem(obj) && ! Library::isA(obj) );
|
||||
|
||||
inDeletedObjects = (delObjLib!=NULL && obj->isChildOf(delObjLib));
|
||||
dupMenuItem = dupMenuItem && !inDeletedObjects;
|
||||
|
||||
// can't move system objects
|
||||
moveMenuItem = moveMenuItem && ! FWBTree::isSystem(obj);
|
||||
moveMenuItem = moveMenuItem && ! m_project->isSystem(obj);
|
||||
|
||||
// can't move interfaces unless parent host object is also selected
|
||||
if ( Interface::isA(obj) &&
|
||||
@ -1183,9 +1192,9 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
|
||||
if (!haveMoveTargets && ! inDeletedObjects) moveMenuItem = false;
|
||||
|
||||
// copyMenuItem= (copyMenuItem &&
|
||||
// ! FWBTree::isSystem(currentObj) &&
|
||||
// ! m_project->isSystem(currentObj) &&
|
||||
// ! Library::isA(currentObj));
|
||||
// delMenuItem= (delMenuItem && ! FWBTree::isSystem(currentObj));
|
||||
// delMenuItem= (delMenuItem && ! m_project->isSystem(currentObj));
|
||||
|
||||
newMenuItem= (newMenuItem && ! obj->isReadOnly() );
|
||||
Interface *intf = Interface::cast(obj);
|
||||
@ -1205,8 +1214,7 @@ void ObjectManipulator::find()
|
||||
|
||||
FWObject *obj=getCurrentObjectTree()->getSelectedObjects().front();
|
||||
if (obj==NULL) return;
|
||||
fd->setObject( obj );
|
||||
fd->show();
|
||||
m_project->setFDObject(obj);
|
||||
}
|
||||
void ObjectManipulator::findObject()
|
||||
{
|
||||
@ -1214,7 +1222,7 @@ void ObjectManipulator::findObject()
|
||||
|
||||
FWObject *obj=getCurrentObjectTree()->getSelectedObjects().front();
|
||||
if (obj==NULL) return;
|
||||
mw->findObject( obj );
|
||||
m_project->findObject( obj );
|
||||
}
|
||||
|
||||
void ObjectManipulator::dumpObj()
|
||||
@ -1234,13 +1242,13 @@ void ObjectManipulator::compile()
|
||||
|
||||
set<Firewall*> fo;
|
||||
filterFirewallsFromSelection(so,fo);
|
||||
|
||||
|
||||
//FWObject *obj=getCurrentObjectTree()->getSelectedObjects().front();
|
||||
//if (obj==NULL) return;
|
||||
//mw->showFirewall(obj);
|
||||
//m_project->showFirewall(obj);
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::compile filtered %d firewalls",fo.size());
|
||||
mw->compile(fo);
|
||||
m_project->compile(fo);
|
||||
}
|
||||
void ObjectManipulator::filterFirewallsFromSelection(vector<FWObject*> &so,set<Firewall*> &fo)
|
||||
{
|
||||
@ -1260,16 +1268,16 @@ void ObjectManipulator::filterFirewallsFromSelection(vector<FWObject*> &so,set<F
|
||||
extractFirewallsFromGroup(gr,fo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void ObjectManipulator::extractFirewallsFromGroup(ObjectGroup *gr,set<Firewall*> &fo)
|
||||
{
|
||||
Firewall *f;
|
||||
set<FWObject*> oset;
|
||||
mw->db()->findObjectsInGroup(gr,oset);
|
||||
|
||||
m_project->db()->findObjectsInGroup(gr,oset);
|
||||
|
||||
set<FWObject*>::iterator i;
|
||||
for(i=oset.begin();i!=oset.end();++i)
|
||||
for(i=oset.begin();i!=oset.end();++i)
|
||||
{
|
||||
f=Firewall::cast(*i);
|
||||
if (f!=NULL) fo.insert(f);
|
||||
@ -1281,15 +1289,15 @@ void ObjectManipulator::install()
|
||||
|
||||
//FWObject *obj=getCurrentObjectTree()->getSelectedObjects().front();
|
||||
//if (obj==NULL) return;
|
||||
//mw->showFirewall(obj);
|
||||
//m_project->showFirewall(obj);
|
||||
|
||||
vector<FWObject*> so = getCurrentObjectTree()->getSimplifiedSelection();
|
||||
set<Firewall*> fo;
|
||||
filterFirewallsFromSelection(so,fo);
|
||||
|
||||
|
||||
|
||||
mw->install(fo);
|
||||
|
||||
|
||||
|
||||
m_project->install(fo);
|
||||
}
|
||||
|
||||
FWObject* ObjectManipulator::duplicateObject(FWObject *targetLib,
|
||||
@ -1331,7 +1339,7 @@ void ObjectManipulator::duplicateObj(QAction *action)
|
||||
{
|
||||
obj= *i;
|
||||
|
||||
if ( FWBTree::isSystem(obj) || Interface::isA(obj) ) continue;
|
||||
if ( m_project->isSystem(obj) || Interface::isA(obj) ) continue;
|
||||
|
||||
FWObject *cl = idxToLibs[libid];
|
||||
|
||||
@ -1339,8 +1347,8 @@ void ObjectManipulator::duplicateObj(QAction *action)
|
||||
|
||||
if (nobj->getTypeName()==Firewall::TYPENAME)
|
||||
{
|
||||
mw->addFirewallToList(nobj);
|
||||
mw->showFirewall(nobj);
|
||||
m_project->addFirewallToList(nobj);
|
||||
m_project->showFirewall(nobj);
|
||||
}
|
||||
}
|
||||
editObject(nobj);
|
||||
@ -1372,8 +1380,8 @@ void ObjectManipulator::duplicateObjUnderSameParent()
|
||||
|
||||
if (Firewall::isA(o))
|
||||
{
|
||||
mw->addFirewallToList(o);
|
||||
mw->showFirewall(o);
|
||||
m_project->addFirewallToList(o);
|
||||
m_project->showFirewall(o);
|
||||
}
|
||||
}
|
||||
if (o!=NULL) editObject(o);
|
||||
@ -1394,7 +1402,7 @@ void ObjectManipulator::moveObject(FWObject *targetLib, FWObject *obj)
|
||||
if (FWObjectDatabase::isA(targetLib)) grp = targetLib;
|
||||
else
|
||||
{
|
||||
grp=FWBTree::getStandardSlotForObject(targetLib,
|
||||
grp=m_project->getStandardSlotForObject(targetLib,
|
||||
obj->getTypeName().c_str());
|
||||
}
|
||||
|
||||
@ -1451,8 +1459,8 @@ void ObjectManipulator::moveObject(FWObject *targetLib, FWObject *obj)
|
||||
|
||||
if (Firewall::cast(obj)!=NULL)
|
||||
{
|
||||
mw->addFirewallToList(obj);
|
||||
mw->showFirewall(obj);
|
||||
m_project->addFirewallToList(obj);
|
||||
m_project->showFirewall(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1471,7 +1479,7 @@ void ObjectManipulator::moveObject(FWObject *targetLib, FWObject *obj)
|
||||
void ObjectManipulator::moveObject(const QString &targetLibName,
|
||||
FWObject *obj)
|
||||
{
|
||||
list<FWObject*> ll = mw->db()->getByType( Library::TYPENAME );
|
||||
list<FWObject*> ll = m_project->db()->getByType( Library::TYPENAME );
|
||||
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
||||
{
|
||||
FWObject *lib=*i;
|
||||
@ -1511,14 +1519,14 @@ void ObjectManipulator::moveObj(QAction* action)
|
||||
if (Library::isA(obj))
|
||||
{
|
||||
/* We can only move library to the root of the tree. This case only
|
||||
* happens when user tries to undelete a library.
|
||||
* happens when user tries to undelete a library.
|
||||
*/
|
||||
moveObject(mw->db(),obj);
|
||||
moveObject(m_project->db(),obj);
|
||||
} else
|
||||
{
|
||||
if (obj->isChildOf(targetLib)) continue;
|
||||
|
||||
if ( FWBTree::isSystem(obj) ||
|
||||
if ( m_project->isSystem(obj) ||
|
||||
Interface::isA(obj) ||
|
||||
Interface::isA(obj->getParent())) continue;
|
||||
|
||||
@ -1539,7 +1547,7 @@ void ObjectManipulator::copyObj()
|
||||
for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i)
|
||||
{
|
||||
obj= *i;
|
||||
if ( ! FWBTree::isSystem(obj) )
|
||||
if ( ! m_project->isSystem(obj) )
|
||||
FWObjectClipboard::obj_clipboard->add( obj );
|
||||
}
|
||||
}
|
||||
@ -1560,12 +1568,12 @@ void ObjectManipulator::pasteObj()
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
{
|
||||
FWObject *co= mw->db()->findInIndex(*i);
|
||||
FWObject *co= m_project->db()->findInIndex(*i);
|
||||
FWObject *nobj=pasteTo( obj , co );
|
||||
if (nobj!=NULL)
|
||||
{
|
||||
if (Firewall::isA(nobj)) mw->addFirewallToList(nobj);
|
||||
if (Firewall::isA(obj)) mw->showFirewall(obj);
|
||||
if (Firewall::isA(nobj)) m_project->addFirewallToList(nobj);
|
||||
if (Firewall::isA(obj)) m_project->showFirewall(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1583,26 +1591,26 @@ FWObject* ObjectManipulator::pasteTo(FWObject *target,FWObject *obj,
|
||||
Host *hst = Host::cast(ta); // works for firewall, too
|
||||
Interface *intf = Interface::cast(ta);
|
||||
|
||||
if (FWBTree::isSystem(ta))
|
||||
if (m_project->isSystem(ta))
|
||||
{
|
||||
if (!FWBTree::validateForInsertion(ta,obj))
|
||||
if (!m_project->validateForInsertion(ta,obj))
|
||||
{
|
||||
if (validateOnly) return NULL;
|
||||
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
QObject::tr("Impossible to insert object %1 (type %2) into %3\nbecause of incompatible type.")
|
||||
.arg(obj->getName().c_str())
|
||||
.arg(obj->getTypeName().c_str())
|
||||
.arg(target->getName().c_str()),
|
||||
"&Continue", QString::null, QString::null,
|
||||
0, 1 );
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
if ( FWBTree::isSystem(ta) ||
|
||||
|
||||
if ( m_project->isSystem(ta) ||
|
||||
(hst!=NULL && hst->validateChild(obj)) ||
|
||||
(intf!=NULL && intf->validateChild(obj))
|
||||
)
|
||||
@ -1612,7 +1620,7 @@ FWObject* ObjectManipulator::pasteTo(FWObject *target,FWObject *obj,
|
||||
/* add a copy of the object to system group */
|
||||
|
||||
FWObject *nobj=
|
||||
mw->db()->create(obj->getTypeName());
|
||||
m_project->db()->create(obj->getTypeName());
|
||||
assert (nobj!=NULL);
|
||||
nobj->ref();
|
||||
nobj->duplicate(obj,true); // creates new object ID
|
||||
@ -1635,7 +1643,7 @@ FWObject* ObjectManipulator::pasteTo(FWObject *target,FWObject *obj,
|
||||
/* check for duplicates. We just won't add an object if it is already there */
|
||||
string cp_id=obj->getId();
|
||||
list<FWObject*>::iterator j;
|
||||
for(j=grp->begin(); j!=grp->end(); ++j)
|
||||
for(j=grp->begin(); j!=grp->end(); ++j)
|
||||
{
|
||||
FWObject *o1=*j;
|
||||
if(cp_id==o1->getId()) return o1;
|
||||
@ -1654,7 +1662,7 @@ FWObject* ObjectManipulator::pasteTo(FWObject *target,FWObject *obj,
|
||||
if (validateOnly) return NULL;
|
||||
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
ex.toString().c_str(),
|
||||
"&Continue", QString::null,QString::null,
|
||||
0, 1 );
|
||||
@ -1666,7 +1674,7 @@ FWObject* ObjectManipulator::pasteTo(FWObject *target,FWObject *obj,
|
||||
|
||||
void ObjectManipulator::lockObject()
|
||||
{
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::lockObject selected %d objects ",
|
||||
getCurrentObjectTree()->getNumSelected());
|
||||
@ -1723,7 +1731,7 @@ void ObjectManipulator::deleteObj()
|
||||
bool emptyingTrash = false;
|
||||
bool emptyingTrashInLib = false;
|
||||
|
||||
FWObject *delObjLib = mw->db()->findInIndex(FWObjectDatabase::getDeletedObjectsId());
|
||||
FWObject *delObjLib = m_project->db()->findInIndex(FWObjectDatabase::getDeletedObjectsId());
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::deleteObj delObjLib=%p",delObjLib);
|
||||
|
||||
@ -1738,13 +1746,13 @@ void ObjectManipulator::deleteObj()
|
||||
}
|
||||
}
|
||||
|
||||
emptyingTrashInLib = emptyingTrash && mw->editingLibrary();
|
||||
emptyingTrashInLib = emptyingTrash && m_project->editingLibrary();
|
||||
|
||||
/* Ask user iff:
|
||||
*
|
||||
* we are emptying trash while editing library file (.fwl)
|
||||
* else
|
||||
*
|
||||
*
|
||||
* if we are not emptying Trash (i.e. not deleting "Deleted objects" library)
|
||||
* and
|
||||
* (we delete more than one object
|
||||
@ -1777,7 +1785,7 @@ void ObjectManipulator::deleteObj()
|
||||
emptyingTrash,
|
||||
so.size(),
|
||||
so.front()->getTypeName().c_str() );
|
||||
|
||||
|
||||
|
||||
if (!emptyingTrash && (so.size()>1 || !Library::isA(so.front())))
|
||||
{
|
||||
@ -1794,11 +1802,11 @@ void ObjectManipulator::deleteObj()
|
||||
*/
|
||||
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );
|
||||
ConfirmDeleteObjectDialog * dlg= new ConfirmDeleteObjectDialog(this);
|
||||
|
||||
dlg->load(so);
|
||||
|
||||
dlg->load(so);
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
if(dlg->exec()==QDialog::Rejected ) return;
|
||||
if(dlg->exec()==QDialog::Rejected ) return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1828,15 +1836,15 @@ void ObjectManipulator::deleteObj()
|
||||
|
||||
// openObject(obj,false);
|
||||
|
||||
if ( ! FWBTree::isSystem(obj) )
|
||||
if ( ! m_project->isSystem(obj) )
|
||||
{
|
||||
if (Library::isA(obj))
|
||||
{
|
||||
list<FWObject*> ll=mw->db()->getByType(Library::TYPENAME);
|
||||
list<FWObject*> ll=m_project->db()->getByType(Library::TYPENAME);
|
||||
if (ll.size()==1) return;
|
||||
|
||||
if (QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr(
|
||||
"When you delete a library, all objects that belong to it\n"
|
||||
"disappear from the tree and all groups and rules that reference them.\n"
|
||||
@ -1847,7 +1855,7 @@ void ObjectManipulator::deleteObj()
|
||||
0, 1 )!=0 ) continue;
|
||||
}
|
||||
|
||||
if (oe->isVisible() && oe->getOpened()==obj) oe->hide();
|
||||
if (m_project->isEditorVisible() && m_project->getOpenedEditor()==obj) m_project->hideEditor();
|
||||
|
||||
delObj(obj);
|
||||
}
|
||||
@ -1862,7 +1870,7 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
{
|
||||
if (obj->getId()==STANDARD_LIB || obj->getId()==DELETED_LIB) return;
|
||||
|
||||
mw->findObjectWidget->reset();
|
||||
m_project->findObjectWidget->reset();
|
||||
try
|
||||
{
|
||||
if (fwbdebug)
|
||||
@ -1870,7 +1878,7 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
obj,obj->getName().c_str(),openobj);
|
||||
|
||||
FWObject *parent=obj->getParent();
|
||||
FWObject *delObjLib = mw->db()->findInIndex( DELETED_LIB );
|
||||
FWObject *delObjLib = m_project->db()->findInIndex( DELETED_LIB );
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::delObj deleted obj lib %p",
|
||||
@ -1880,7 +1888,7 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
// bool isintf = (Interface::isA(obj) && Firewall::isA(parent));
|
||||
bool isfw = Firewall::isA(obj);
|
||||
bool isDelObj = (delObjLib!=NULL && obj->isChildOf(delObjLib));
|
||||
|
||||
|
||||
if (!islib && !isDelObj && obj->getId()!=TEMPLATE_LIB)
|
||||
updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
|
||||
@ -1907,10 +1915,10 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
list<FWObject*> fl;
|
||||
findFirewalls(obj, fl);
|
||||
for (list<FWObject*>::iterator i=fl.begin(); i!=fl.end(); i++)
|
||||
mw->deleteFirewall( *i );
|
||||
m_project->deleteFirewall( *i );
|
||||
}
|
||||
|
||||
if (isfw && !isDelObj) mw->deleteFirewall(obj);
|
||||
if (isfw && !isDelObj) m_project->deleteFirewall(obj);
|
||||
|
||||
|
||||
// removeObjectFromTreeView(obj);
|
||||
@ -1922,19 +1930,19 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
if (obj->getId()==TEMPLATE_LIB) // special case
|
||||
{
|
||||
if (fwbdebug) qDebug("ObjectManipulator::delObj: special case: deleting template library");
|
||||
mw->db()->removeAllInstances(obj);
|
||||
m_project->db()->removeAllInstances(obj);
|
||||
} else
|
||||
{
|
||||
if (fwbdebug) qDebug("ObjectManipulator::delObj: recursively deleting library and all its objects");
|
||||
mw->db()->recursivelyRemoveObjFromTree(obj, false);
|
||||
if (islib) parent=mw->db()->getFirstByType(Library::TYPENAME);
|
||||
m_project->db()->recursivelyRemoveObjFromTree(obj, false);
|
||||
if (islib) parent=m_project->db()->getFirstByType(Library::TYPENAME);
|
||||
}
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
if (fwbdebug) qDebug("ObjectManipulator::delObj: done");
|
||||
|
||||
removeObjectFromTreeView(obj);
|
||||
mw->scheduleRuleSetRedraw();
|
||||
m_project->scheduleRuleSetRedraw();
|
||||
|
||||
if (!isDelObj)
|
||||
{
|
||||
@ -1954,11 +1962,11 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
FWObject *first_fw = fwlist.front();
|
||||
if (first_fw!=NULL)
|
||||
{
|
||||
mw->showFirewall( first_fw );
|
||||
m_project->showFirewall( first_fw );
|
||||
openObject( first_fw );
|
||||
}
|
||||
}
|
||||
//QTimer::singleShot( 0, mw, SLOT(reopenFirewall()) );
|
||||
//QTimer::singleShot( 0, m_project, SLOT(reopenFirewall()) );
|
||||
} else {
|
||||
openObject(parent);
|
||||
}
|
||||
@ -1969,7 +1977,7 @@ void ObjectManipulator::delObj(FWObject *obj,bool openobj)
|
||||
if (fwbdebug) qDebug("ObjectManipulator::delObj: catch: restoreOverrideCursor");
|
||||
QApplication::restoreOverrideCursor();
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
ex.toString().c_str(),
|
||||
"&Continue", QString::null,QString::null,
|
||||
0, 1 );
|
||||
@ -1983,7 +1991,7 @@ void ObjectManipulator::groupObjects()
|
||||
|
||||
FWObject *co = getCurrentObjectTree()->getSelectedObjects().front();
|
||||
|
||||
newGroupDialog ngd( this );
|
||||
newGroupDialog ngd( this );
|
||||
|
||||
if (ngd.exec()==QDialog::Accepted)
|
||||
{
|
||||
@ -1996,7 +2004,7 @@ void ObjectManipulator::groupObjects()
|
||||
|
||||
FWObject *newgrp=NULL;
|
||||
|
||||
list<FWObject*> ll = mw->db()->getByType( Library::TYPENAME );
|
||||
list<FWObject*> ll = m_project->db()->getByType( Library::TYPENAME );
|
||||
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
||||
{
|
||||
FWObject *lib=*i;
|
||||
@ -2007,7 +2015,7 @@ void ObjectManipulator::groupObjects()
|
||||
* only with names of read-write libraries
|
||||
*/
|
||||
if (lib->isReadOnly()) return;
|
||||
FWObject *parent = FWBTree::getStandardSlotForObject(lib,type);
|
||||
FWObject *parent = m_project->getStandardSlotForObject(lib,type);
|
||||
if (parent==NULL)
|
||||
{
|
||||
if (fwbdebug)
|
||||
@ -2035,10 +2043,10 @@ void ObjectManipulator::groupObjects()
|
||||
newgrp->addRef(obj);
|
||||
}
|
||||
ot->freezeSelection(false);
|
||||
|
||||
|
||||
openObject(newgrp);
|
||||
editObject(newgrp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectManipulator::info()
|
||||
@ -2047,9 +2055,10 @@ void ObjectManipulator::info()
|
||||
|
||||
if (currentObj)
|
||||
{
|
||||
mw->info(currentObj, true); //forcing info window update
|
||||
m_project->info(currentObj, true); //forcing info window update
|
||||
active=true;
|
||||
}
|
||||
if (fwbdebug) qDebug("/ObjectManipulator::info()");
|
||||
}
|
||||
|
||||
|
||||
@ -2059,7 +2068,7 @@ void ObjectManipulator::restoreSelection(bool same_widget)
|
||||
qDebug("ObjectManipulator::restoreSelection same_widget=%d",same_widget);
|
||||
|
||||
select();
|
||||
openObject( oe->getOpened(), false);
|
||||
openObject( m_project->getOpenedEditor(), false);
|
||||
}
|
||||
|
||||
void ObjectManipulator::editSelectedObject()
|
||||
@ -2073,7 +2082,7 @@ void ObjectManipulator::editSelectedObject()
|
||||
|
||||
bool ObjectManipulator::editObject(FWObject *obj)
|
||||
{
|
||||
if (!oe->isVisible()) oe->show();
|
||||
if (!m_project->isEditorVisible()) m_project->showEditor();
|
||||
return switchObjectInEditor(obj);
|
||||
}
|
||||
|
||||
@ -2081,26 +2090,26 @@ bool ObjectManipulator::switchObjectInEditor(FWObject *obj)
|
||||
{
|
||||
if (fwbdebug) qDebug("ObjectManipulator::switchObjectInEditor");
|
||||
|
||||
mw->unselectRules();
|
||||
m_project->unselectRules();
|
||||
|
||||
if (!oe->isVisible()) return false;
|
||||
if (!m_project->isEditorVisible()) return false;
|
||||
|
||||
if (!mw->requestEditorOwnership(this,
|
||||
if (!m_project->requestEditorOwnership(this,
|
||||
obj,
|
||||
ObjectEditor::optNone,
|
||||
true))
|
||||
return false;
|
||||
return false;
|
||||
|
||||
select();
|
||||
|
||||
if (obj!=oe->getOpened())
|
||||
if (obj!=m_project->getOpenedEditor())
|
||||
{
|
||||
oe->open(obj);
|
||||
m_project->openEditor(obj);
|
||||
currentObj=obj;
|
||||
active=true;
|
||||
openObject(obj); // position the tree so that obj is visible
|
||||
}
|
||||
return true; // successfully (re)opened obj in the editor
|
||||
return true; // successfully (re)opened obj in the editor
|
||||
}
|
||||
|
||||
|
||||
@ -2138,7 +2147,7 @@ void ObjectManipulator::selectionChanged(QTreeWidgetItem *cur)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("ObjectManipulator::selectionChanged");
|
||||
|
||||
|
||||
QTreeWidget *qlv= getCurrentObjectTree();
|
||||
if (qlv==NULL) return;
|
||||
|
||||
@ -2180,10 +2189,10 @@ void ObjectManipulator::selectionChanged(QTreeWidgetItem *cur)
|
||||
active=true;
|
||||
|
||||
/*
|
||||
mw->unselectRules();
|
||||
if (oe->validateAndSave())
|
||||
m_project->unselectRules();
|
||||
if (m_project->validateAndSaveEditor())
|
||||
{
|
||||
oe->selectionChanged(obj);
|
||||
//oe->selectionChanged(obj);
|
||||
}
|
||||
*/
|
||||
info();
|
||||
@ -2234,7 +2243,7 @@ void ObjectManipulator::libChanged(int ln)
|
||||
assert(lv!=NULL);
|
||||
|
||||
ObjectTreeViewItem *otvi=dynamic_cast<ObjectTreeViewItem*>(lv->currentItem());
|
||||
|
||||
|
||||
if (otvi == NULL)
|
||||
if (lv->invisibleRootItem()->childCount() > 0)
|
||||
otvi = dynamic_cast<ObjectTreeViewItem*>(lv->invisibleRootItem()->child(0));
|
||||
@ -2274,7 +2283,7 @@ void ObjectManipulator::back()
|
||||
/* skip objects that have been deleted */
|
||||
while ( ! history.empty())
|
||||
{
|
||||
if (mw->db()->findInIndex( history.top().id().toLatin1().constData() )!=NULL) break;
|
||||
if (m_project->db()->findInIndex( history.top().id().toLatin1().constData() )!=NULL) break;
|
||||
history.pop();
|
||||
}
|
||||
|
||||
@ -2286,11 +2295,11 @@ void ObjectManipulator::back()
|
||||
|
||||
openObject( history.top().item(), false );
|
||||
|
||||
if (oe->isVisible())
|
||||
if (m_project->isEditorVisible())
|
||||
{
|
||||
ObjectTreeViewItem *otvi=history.top().item();
|
||||
switchObjectInEditor(otvi->getFWObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2311,7 +2320,7 @@ void ObjectManipulator::openLib(FWObject *obj)
|
||||
|
||||
void ObjectManipulator::newObject()
|
||||
{
|
||||
// QToolButton *btn = (QToolButton*)(mw->toolBar)->child("newObjectAction_action_button");
|
||||
// QToolButton *btn = (QToolButton*)(m_project->toolBar)->child("newObjectAction_action_button");
|
||||
m_objectManipulator->newButton->showMenu();
|
||||
}
|
||||
|
||||
@ -2330,7 +2339,7 @@ FWObject* ObjectManipulator::createObject(const QString &objType,
|
||||
{
|
||||
qDebug("lib: %s %s",lib->getName().c_str(), lib->getId().c_str());
|
||||
qDebug("lib: isReadOnly=%d isLoaded=%d",
|
||||
lib->isReadOnly(), addOnLibs->isLoaded( lib->getName().c_str() ) );
|
||||
lib->isReadOnly(), m_project->getAddOnLibs()->isLoaded( lib->getName().c_str() ) );
|
||||
qDebug("libs->count()=%d", m_objectManipulator->libs->count() );
|
||||
}
|
||||
|
||||
@ -2355,16 +2364,16 @@ FWObject* ObjectManipulator::createObject(const QString &objType,
|
||||
qDebug("i=%d",i);
|
||||
qDebug("lib: %s %s",lib->getName().c_str(), lib->getId().c_str());
|
||||
qDebug("lib: isReadOnly=%d isLoaded=%d",
|
||||
lib->isReadOnly(), addOnLibs->isLoaded( lib->getName().c_str() ) );
|
||||
lib->isReadOnly(), m_project->getAddOnLibs()->isLoaded( lib->getName().c_str() ) );
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
FWObject *parent=FWBTree::getStandardSlotForObject(lib, objType);
|
||||
FWObject *parent=m_project->getStandardSlotForObject(lib, objType);
|
||||
if (parent==NULL)
|
||||
{
|
||||
|
||||
QMessageBox::warning(this,"Firewall Builder",
|
||||
QMessageBox::warning(this,"Firewall Builder",
|
||||
QObject::tr(
|
||||
"Type '%1': new object can not be created because\n"
|
||||
"corresponding branch is missing in the object tree.\n"
|
||||
@ -2372,7 +2381,7 @@ FWObject* ObjectManipulator::createObject(const QString &objType,
|
||||
.arg(objType),
|
||||
"&Continue", QString::null, QString::null,
|
||||
0, 1 );
|
||||
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -2424,15 +2433,15 @@ FWObject* ObjectManipulator::actuallyCreateObject(FWObject *parent,
|
||||
FWObject *copyFrom)
|
||||
{
|
||||
if (!isTreeReadWrite(this, parent)) return NULL;
|
||||
FWObject *nobj = mw->db()->create(objType.toLatin1().constData());
|
||||
FWObject *nobj = m_project->db()->create(objType.toLatin1().constData());
|
||||
assert(nobj!=NULL);
|
||||
|
||||
if (copyFrom!=NULL) nobj->duplicate(copyFrom,true);
|
||||
if (nobj->isReadOnly()) nobj->setReadOnly(false);
|
||||
|
||||
|
||||
nobj->setName( string(objName.toUtf8().constData()) );
|
||||
makeNameUnique(parent,nobj);
|
||||
|
||||
|
||||
parent->add(nobj);
|
||||
insertSubtree(allItems[parent], nobj);
|
||||
|
||||
@ -2443,7 +2452,7 @@ void ObjectManipulator::newLibrary()
|
||||
{
|
||||
if (!validateDialog()) return;
|
||||
|
||||
FWObject *nlib = FWBTree::createNewLibrary(mw->db());
|
||||
FWObject *nlib = m_project->createNewLibrary(m_project->db());
|
||||
|
||||
addTreePage( nlib );
|
||||
|
||||
@ -2454,7 +2463,7 @@ void ObjectManipulator::newLibrary()
|
||||
void ObjectManipulator::newFirewall()
|
||||
{
|
||||
newFirewallDialog *nfd=new newFirewallDialog();
|
||||
if (oe->isVisible()) oe->hide();
|
||||
if (m_project->isEditorVisible()) m_project->hideEditor();
|
||||
nfd->exec();
|
||||
FWObject *o = nfd->getNewFirewall();
|
||||
delete nfd;
|
||||
@ -2463,18 +2472,18 @@ void ObjectManipulator::newFirewall()
|
||||
{
|
||||
openObject(o);
|
||||
|
||||
mw->addFirewallToList(o);
|
||||
mw->showFirewall(o);
|
||||
m_project->addFirewallToList(o);
|
||||
m_project->showFirewall(o);
|
||||
// updateLastModifiedTimestampForAllFirewalls(o);
|
||||
|
||||
editObject(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectManipulator::newHost()
|
||||
{
|
||||
newHostDialog *nhd=new newHostDialog();
|
||||
if (oe->isVisible()) oe->hide();
|
||||
if (m_project->isEditorVisible()) m_project->hideEditor();
|
||||
nhd->exec();
|
||||
FWObject *o = nhd->getNewHost();
|
||||
delete nhd;
|
||||
@ -2483,7 +2492,7 @@ void ObjectManipulator::newHost()
|
||||
{
|
||||
openObject(o);
|
||||
editObject(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectManipulator::newInterface()
|
||||
@ -2505,11 +2514,11 @@ void ObjectManipulator::newInterface()
|
||||
#endif
|
||||
|
||||
openObject( i );
|
||||
|
||||
if (Firewall::isA(i->getParent())) mw->showFirewall(i->getParent());
|
||||
|
||||
if (Firewall::isA(i->getParent())) m_project->showFirewall(i->getParent());
|
||||
updateLastModifiedTimestampForAllFirewalls(i);
|
||||
|
||||
editObject(i);
|
||||
editObject(i);
|
||||
}
|
||||
|
||||
void ObjectManipulator::newNetwork()
|
||||
@ -2750,8 +2759,8 @@ void ObjectManipulator::newInterval()
|
||||
bool ObjectManipulator::validateDialog()
|
||||
{
|
||||
if (currentObj==NULL) return true;
|
||||
if (!oe->isVisible()) return true;
|
||||
return oe->validateAndSave();
|
||||
if (!m_project->isEditorVisible()) return true;
|
||||
return m_project->validateAndSaveEditor();
|
||||
}
|
||||
|
||||
void ObjectManipulator::select()
|
||||
@ -2768,8 +2777,11 @@ void ObjectManipulator::select()
|
||||
otvi->treeWidget()->setFocus();
|
||||
otvi->treeWidget()->update();
|
||||
}
|
||||
|
||||
m_project->updateRuleSetViewSelection();
|
||||
|
||||
mw->updateRuleSetViewSelection();
|
||||
if (fwbdebug)
|
||||
qDebug("/ObjectManipulator::select()");
|
||||
}
|
||||
|
||||
void ObjectManipulator::unselect()
|
||||
@ -2799,28 +2811,28 @@ list<Firewall *> ObjectManipulator::findFirewallsForObject(FWObject *o)
|
||||
FWObject *f=o;
|
||||
while (f!=NULL && !Firewall::isA(f)) f=f->getParent();
|
||||
if (f) fws.push_back(Firewall::cast(f));
|
||||
mw->db()->findWhereUsed(o,mw->db(),resset);
|
||||
|
||||
m_project->db()->findWhereUsed(o,m_project->db(),resset);
|
||||
|
||||
set<FWObject *>::iterator i=resset.begin();
|
||||
for ( ;i!=resset.end();++i)
|
||||
{
|
||||
RuleElement *re=RuleElement::cast(*i);
|
||||
if (re==NULL) continue;
|
||||
|
||||
|
||||
Rule *r=Rule::cast(re->getParent());
|
||||
if (r && !r->isDisabled())
|
||||
{
|
||||
f=r;
|
||||
while (f!=NULL && !Firewall::isA(f)) f=f->getParent();
|
||||
if (f && std::find(fws.begin(),fws.end(),f)==fws.end())
|
||||
if (f && std::find(fws.begin(),fws.end(),f)==fws.end())
|
||||
fws.push_back(Firewall::cast(f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug(QString("Program spent %1 ms searching for firewalls.")
|
||||
.arg(tt.elapsed()).toAscii().constData());
|
||||
|
||||
|
||||
return fws;
|
||||
}
|
||||
|
||||
@ -2847,7 +2859,7 @@ void ObjectManipulator::updateLastModifiedTimestampForAllFirewalls(FWObject *o)
|
||||
|
||||
QStatusBar *sb = mw->statusBar();
|
||||
sb->showMessage( tr("Searching for firewalls affected by the change...") );
|
||||
|
||||
|
||||
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents,100);
|
||||
|
||||
if (fwbdebug) qDebug("ObjectManipulator::updateLastModifiedTimestampForAllFirewalls: setOverrideCursor");
|
||||
@ -2864,14 +2876,14 @@ void ObjectManipulator::updateLastModifiedTimestampForAllFirewalls(FWObject *o)
|
||||
f=*i;
|
||||
f->updateLastModifiedTimestamp();
|
||||
}
|
||||
|
||||
|
||||
getCurrentObjectTree()->updateTreeItems ();
|
||||
info();
|
||||
}
|
||||
if (fwbdebug) qDebug("ObjectManipulator::updateLastModifiedTimestampForAllFirewalls: restoreOverrideCursor");
|
||||
QApplication::restoreOverrideCursor();
|
||||
sb->clearMessage();
|
||||
|
||||
|
||||
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents,100);
|
||||
}
|
||||
|
||||
@ -2884,7 +2896,7 @@ void ObjectManipulator::updateLastInstalledTimestamp(FWObject *o)
|
||||
{
|
||||
bool visualUpdate=f->needsInstall();
|
||||
f->updateLastInstalledTimestamp();
|
||||
if (visualUpdate)
|
||||
if (visualUpdate)
|
||||
{
|
||||
getCurrentObjectTree()->updateTreeItems ();
|
||||
}
|
||||
@ -2907,9 +2919,9 @@ void ObjectManipulator::updateLastCompiledTimestamp(FWObject *o)
|
||||
void ObjectManipulator::simulateInstall()
|
||||
{
|
||||
if (fwbdebug) qDebug("ObjectManipulator::simulateInstall");
|
||||
|
||||
|
||||
if (getCurrentObjectTree()->getNumSelected()==0) return;
|
||||
|
||||
|
||||
Firewall *fw;
|
||||
|
||||
vector<FWObject*> so = getCurrentObjectTree()->getSimplifiedSelection();
|
||||
@ -2922,8 +2934,8 @@ void ObjectManipulator::simulateInstall()
|
||||
fw->updateLastInstalledTimestamp();
|
||||
}
|
||||
}
|
||||
getCurrentObjectTree()->updateTreeItems ();
|
||||
|
||||
getCurrentObjectTree()->updateTreeItems ();
|
||||
|
||||
}
|
||||
|
||||
void ObjectManipulator::findAllFirewalls (list<Firewall *> &fws)
|
||||
@ -2931,7 +2943,7 @@ void ObjectManipulator::findAllFirewalls (list<Firewall *> &fws)
|
||||
if (fwbdebug) qDebug("ObjectManipulator::findAllFirewalls");
|
||||
|
||||
std::list<FWObject*> fwlist;
|
||||
findByObjectType(mw->db(),Firewall::TYPENAME,fwlist);
|
||||
findByObjectType(m_project->db(),Firewall::TYPENAME,fwlist);
|
||||
for (list<FWObject*>::iterator m=fwlist.begin(); m!=fwlist.end(); m++)
|
||||
fws.push_back( Firewall::cast(*m) );
|
||||
}
|
||||
@ -2947,8 +2959,8 @@ void ObjectManipulator::findWhereUsedSlot()
|
||||
|
||||
FWObject *obj=getCurrentObjectTree()->getSelectedObjects().front();
|
||||
if (obj==NULL) return;
|
||||
mw->findWhereUsed(obj);
|
||||
|
||||
m_project->findWhereUsed(obj);
|
||||
|
||||
}
|
||||
|
||||
void ObjectManipulator::reopenCurrentItemParent()
|
||||
|
||||
@ -48,6 +48,8 @@ class ObjectTreeView;
|
||||
class ObjectTreeViewItem;
|
||||
class QComboBox;
|
||||
class QMenu;
|
||||
class ProjectPanel;
|
||||
|
||||
namespace libfwbuilder
|
||||
{
|
||||
class Firewall;
|
||||
@ -123,6 +125,7 @@ class ObjectManipulator : public QWidget/*ObjectManipulator_q*/ {
|
||||
libfwbuilder::ObjectGroup *gr,
|
||||
std::set<libfwbuilder::Firewall*> &fo);
|
||||
|
||||
ProjectPanel *m_project;
|
||||
public slots:
|
||||
virtual void libChanged(int l);
|
||||
virtual void switchingTrees(QWidget* w);
|
||||
@ -219,7 +222,7 @@ public slots:
|
||||
const std::string &objtype,
|
||||
const std::string &namesuffix);
|
||||
|
||||
ObjectManipulator( QWidget *parent );
|
||||
ObjectManipulator( QWidget *parent);
|
||||
~ObjectManipulator();
|
||||
void loadObjects();
|
||||
void loadObjects(libfwbuilder::FWObjectDatabase *db);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -33,7 +35,6 @@
|
||||
#include "ObjectTreeViewItem.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWObjectDrag.h"
|
||||
#include "FWWindow.h"
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWObjectPropertiesFactory.h"
|
||||
@ -59,6 +60,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
@ -74,9 +76,9 @@ ObjectTreeView* ObjectTreeViewItem::getTree()
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ObjectTreeView::ObjectTreeView(QWidget* parent, const char * name, Qt::WFlags f) :
|
||||
QTreeWidget(parent),
|
||||
singleClickTimer(this)
|
||||
ObjectTreeView::ObjectTreeView(ProjectPanel* project, QWidget* parent, const char * name, Qt::WFlags f) :
|
||||
QTreeWidget(parent),
|
||||
singleClickTimer(this), m_project(project)
|
||||
{
|
||||
setObjectName(name);
|
||||
this->setParent(parent, f);
|
||||
@ -124,10 +126,10 @@ ObjectTreeView::ObjectTreeView(QWidget* parent, const char * name, Qt::WFlags f)
|
||||
this, SLOT( resetSelection() ) );
|
||||
|
||||
connect( this, SIGNAL( itemActivated(QTreeWidgetItem *, int)),
|
||||
this, SLOT( itemOpened() ));
|
||||
this, SLOT( itemOpened() ));
|
||||
|
||||
setColumnCount(1);
|
||||
|
||||
|
||||
QStringList qsl;
|
||||
qsl.push_back(tr("Object"));
|
||||
setHeaderLabels(qsl);
|
||||
@ -137,7 +139,7 @@ ObjectTreeView::ObjectTreeView(QWidget* parent, const char * name, Qt::WFlags f)
|
||||
setMinimumSize( QSize( 100, 0 ) );
|
||||
|
||||
// QFont objTreeView_font( font() );
|
||||
// setFont( objTreeView_font );
|
||||
// setFont( objTreeView_font );
|
||||
// setCursor( QCursor( 0 ) );
|
||||
|
||||
// setColumnWidthMode(0, QTreeWidget::Maximum);
|
||||
@ -161,10 +163,10 @@ bool ObjectTreeView::event( QEvent *event )
|
||||
if (st->getObjTooltips())
|
||||
{
|
||||
int cx = pos.x(), cy = pos.y();
|
||||
|
||||
|
||||
FWObject *obj=NULL;
|
||||
QRect cr;
|
||||
|
||||
|
||||
QTreeWidgetItem *itm = itemAt( QPoint(cx,cy - header()->height()) );
|
||||
if (itm==NULL) return false;
|
||||
ObjectTreeViewItem *oivi = dynamic_cast<ObjectTreeViewItem*>(itm);
|
||||
@ -172,7 +174,7 @@ bool ObjectTreeView::event( QEvent *event )
|
||||
obj = oivi->getFWObject();
|
||||
|
||||
if (obj==NULL) return false;
|
||||
|
||||
|
||||
cr = visualItemRect(itm);
|
||||
|
||||
QRect global = QRect(
|
||||
@ -180,16 +182,16 @@ bool ObjectTreeView::event( QEvent *event )
|
||||
|
||||
//finally stretch rect up to component's width and even more
|
||||
//(it fixes bug with horizontal scroll)
|
||||
global.setWidth(width() + horizontalOffset());
|
||||
global.setWidth(width() + horizontalOffset());
|
||||
|
||||
QToolTip::showText(mapToGlobal( he->pos() ),
|
||||
FWObjectPropertiesFactory::getObjectPropertiesDetailed(obj,true,true),
|
||||
QToolTip::showText(mapToGlobal( he->pos() ),
|
||||
FWObjectPropertiesFactory::getObjectPropertiesDetailed(obj,true,true),
|
||||
this, global);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return QTreeWidget::event(event);
|
||||
}
|
||||
|
||||
@ -293,18 +295,18 @@ void ObjectTreeView::updateTreeItems()
|
||||
pm_lock.load( ":/Icons/lock.png" );
|
||||
QPixmapCache::insert( ":/Icons/lock.png", pm_lock);
|
||||
}
|
||||
|
||||
while ( *it )
|
||||
|
||||
while ( *it )
|
||||
{
|
||||
itm= *it;
|
||||
otvi=dynamic_cast<ObjectTreeViewItem*>(itm);
|
||||
obj=otvi->getFWObject();
|
||||
|
||||
if (FWBTree::isSystem(obj))
|
||||
|
||||
if (m_project->isSystem(obj))
|
||||
icn=":/Icons/folder1.png";
|
||||
else
|
||||
icn=(":/Icons/"+obj->getTypeName()+"/icon-tree").c_str();
|
||||
|
||||
|
||||
QPixmap pm_obj;
|
||||
if ( ! QPixmapCache::find( icn, pm_obj) )
|
||||
{
|
||||
@ -314,7 +316,7 @@ void ObjectTreeView::updateTreeItems()
|
||||
|
||||
if (obj->getBool("ro")) itm->setIcon(0, pm_lock);//setPixmap(0, pm_lock );
|
||||
else itm->setIcon(0, pm_obj );
|
||||
|
||||
|
||||
Firewall *fw=Firewall::cast(obj);
|
||||
if (fw!=NULL)
|
||||
{
|
||||
@ -322,7 +324,7 @@ void ObjectTreeView::updateTreeItems()
|
||||
QString::fromUtf8(fw->getName().c_str())+" *":
|
||||
QString::fromUtf8(fw->getName().c_str()));
|
||||
}
|
||||
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
@ -339,7 +341,7 @@ void ObjectTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
|
||||
FWObject *current_obj = getCurrentObject();
|
||||
|
||||
/* can't drag system folders
|
||||
/* can't drag system folders
|
||||
|
||||
in fact, I have to allow to drag system folders because otherwise
|
||||
QListView triggers highlighting of objects in the tree when user
|
||||
@ -348,7 +350,7 @@ void ObjectTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
the end of void QListView::mouseMoveEvent( QMouseEvent * e)
|
||||
(See code after they decided that they do not need to call startDrag())
|
||||
|
||||
if (FWBTree::isSystem(obj)) return NULL;
|
||||
if (m_project->isSystem(obj)) return NULL;
|
||||
*/
|
||||
QString icn = (":/Icons/"+current_obj->getTypeName()+"/icon-ref").c_str();
|
||||
|
||||
@ -413,14 +415,14 @@ void ObjectTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
* changes the object opened in the editor panel. To make things
|
||||
* worse, this event is only delivered to the tree object on Mac OS X.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if (fwbdebug) qDebug("ObjectTreeView::dragObject() this=%p visible=%d",
|
||||
this,visible);
|
||||
|
||||
FWObject *edit_obj = oe->getOpened();
|
||||
FWObject *edit_obj = m_project->getOpenedEditor();
|
||||
|
||||
if (oe->isVisible() &&
|
||||
if (m_project->isEditorVisible() &&
|
||||
dragobj.size()==1 &&
|
||||
edit_obj!=NULL &&
|
||||
current_obj->getLibrary()==edit_obj->getLibrary() )
|
||||
@ -428,7 +430,7 @@ void ObjectTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
if (fwbdebug) qDebug("ObjectTreeView::dragObject() reset selection");
|
||||
otvi->setSelected(false);
|
||||
resetSelection();
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
@ -438,7 +440,7 @@ void ObjectTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
* we are dragging one object, and
|
||||
* object opened in editor is not the same as the one we are dragging
|
||||
*/
|
||||
if (oe->isVisible() && dragobj.size()==1 && oe->getOpened()!=obj)
|
||||
if (m_project->isEditorVisible() && dragobj.size()==1 && m_project->getOpenedEditor()!=obj)
|
||||
{
|
||||
setSelected(otvi,false);
|
||||
resetSelection();
|
||||
@ -458,10 +460,10 @@ void ObjectTreeView::dragEnterEvent( QDragEnterEvent *ev)
|
||||
void ObjectTreeView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
{
|
||||
bool acceptE = false;
|
||||
|
||||
|
||||
if (ev->mimeData()->hasFormat(FWObjectDrag::FWB_MIME_TYPE))
|
||||
{
|
||||
|
||||
|
||||
int hy;
|
||||
|
||||
// hy=header()->height(); // if header is shown
|
||||
@ -471,7 +473,7 @@ void ObjectTreeView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
|
||||
ObjectTreeViewItem *otvi=dynamic_cast<ObjectTreeViewItem*>(ovi);
|
||||
if (otvi==NULL)
|
||||
{
|
||||
{
|
||||
ev->setAccepted(acceptE);
|
||||
return;
|
||||
}
|
||||
@ -481,8 +483,8 @@ void ObjectTreeView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
/* the tree can accept drop only if it goes into a group and if that group
|
||||
* validates the object and tree is not read-only
|
||||
*/
|
||||
if (Group::cast(trobj)!=NULL &&
|
||||
!FWBTree::isSystem(trobj) &&
|
||||
if (Group::cast(trobj)!=NULL &&
|
||||
!m_project->isSystem(trobj) &&
|
||||
!trobj->isReadOnly()
|
||||
)
|
||||
{
|
||||
@ -498,7 +500,7 @@ void ObjectTreeView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
FWObject *dragobj = *i;
|
||||
assert(dragobj!=NULL);
|
||||
|
||||
if (FWBTree::isSystem(dragobj))
|
||||
if (m_project->isSystem(dragobj))
|
||||
{
|
||||
/* can not drop system folder anywhere */
|
||||
acceptE = false;
|
||||
@ -534,8 +536,8 @@ void ObjectTreeView::dropEvent(QDropEvent *ev)
|
||||
/* the tree can accept drop only if it goes into a group and if that group
|
||||
* validates the object and the tree is not read-only
|
||||
*/
|
||||
if (Group::cast(trobj)!=NULL &&
|
||||
!FWBTree::isSystem(trobj) &&
|
||||
if (Group::cast(trobj)!=NULL &&
|
||||
!m_project->isSystem(trobj) &&
|
||||
!trobj->isReadOnly()
|
||||
)
|
||||
{
|
||||
@ -555,7 +557,7 @@ void ObjectTreeView::dropEvent(QDropEvent *ev)
|
||||
/* check for duplicates */
|
||||
string cp_id=dragobj->getId();
|
||||
list<FWObject*>::iterator j;
|
||||
for(j=g->begin(); j!=g->end(); ++j)
|
||||
for(j=g->begin(); j!=g->end(); ++j)
|
||||
{
|
||||
FWObject *o1=*j;
|
||||
if(cp_id==o1->getId()) continue;
|
||||
@ -593,7 +595,7 @@ void ObjectTreeView::mouseMoveEvent( QMouseEvent * e )
|
||||
}
|
||||
else*/
|
||||
QTreeWidget::mouseMoveEvent(e);
|
||||
|
||||
|
||||
if (e==NULL) return;
|
||||
}
|
||||
|
||||
@ -618,12 +620,12 @@ void ObjectTreeView::mousePressEvent( QMouseEvent *e )
|
||||
lastSelected = currentItem();
|
||||
|
||||
QTreeWidget::mousePressEvent(e);
|
||||
|
||||
|
||||
if (e->button() == Qt::LeftButton)
|
||||
{
|
||||
startingDrag = true;
|
||||
}
|
||||
|
||||
|
||||
if (e->button() == Qt::RightButton)
|
||||
emit contextMenuRequested_sign(e->pos());
|
||||
}
|
||||
@ -677,7 +679,7 @@ void ObjectTreeView::mouseReleaseEvent( QMouseEvent *e )
|
||||
selectedObjects.size(),
|
||||
getCurrentObject(),
|
||||
(getCurrentObject()!=NULL)?getCurrentObject()->getName().c_str():"nil");
|
||||
|
||||
|
||||
if (expandOrCollapse) return; // user expanded or collapsed subtree,
|
||||
// no need to change object in the editor
|
||||
|
||||
@ -687,11 +689,11 @@ void ObjectTreeView::mouseReleaseEvent( QMouseEvent *e )
|
||||
{
|
||||
// user selected multiple objects
|
||||
// do not let them if editor has unsaved changes
|
||||
//
|
||||
if (oe->isVisible() && oe->isModified())
|
||||
//
|
||||
if (m_project->isEditorVisible() && m_project->isEditorModified())
|
||||
emit switchObjectInEditor_sign( getCurrentObject() );
|
||||
else
|
||||
oe->blank();
|
||||
m_project->blankEditor();
|
||||
}
|
||||
}
|
||||
|
||||
@ -722,9 +724,9 @@ void ObjectTreeView::mouseDoubleClickEvent( QMouseEvent *e )
|
||||
FWObject *obj = getCurrentObject();
|
||||
|
||||
/* system folders open on doubleclick, while for regular objects it
|
||||
* opens an editor
|
||||
* opens an editor
|
||||
*/
|
||||
if (FWBTree::isSystem(obj))
|
||||
if (m_project->isSystem(obj))
|
||||
QTreeWidget::mouseDoubleClickEvent(e);
|
||||
else
|
||||
editCurrentObject();
|
||||
@ -745,7 +747,7 @@ void ObjectTreeView::keyPressEvent( QKeyEvent* ev )
|
||||
emit deleteObject_sign(obj);
|
||||
ev->accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
QTreeWidget::keyPressEvent(ev);
|
||||
}
|
||||
|
||||
@ -762,11 +764,11 @@ void ObjectTreeView::keyReleaseEvent( QKeyEvent* ev )
|
||||
{
|
||||
// user selected multiple objects
|
||||
// do not let them if editor has unsaved changes
|
||||
//
|
||||
if (oe->isVisible() && oe->isModified())
|
||||
//
|
||||
if (m_project->isEditorVisible() && m_project->isEditorModified())
|
||||
emit switchObjectInEditor_sign( getCurrentObject() );
|
||||
else
|
||||
oe->blank();
|
||||
m_project->blankEditor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,8 @@ namespace libfwbuilder {
|
||||
class FWObject;
|
||||
};
|
||||
|
||||
class ProjectPanel;
|
||||
|
||||
class ObjectTreeView : public QTreeWidget {
|
||||
|
||||
Q_OBJECT
|
||||
@ -66,7 +68,7 @@ class ObjectTreeView : public QTreeWidget {
|
||||
bool process_mouse_release_event;
|
||||
|
||||
std::vector<libfwbuilder::FWObject*> selectedObjects;
|
||||
|
||||
ProjectPanel* m_project;
|
||||
protected:
|
||||
|
||||
bool event( QEvent *event );
|
||||
@ -91,7 +93,7 @@ class ObjectTreeView : public QTreeWidget {
|
||||
|
||||
public:
|
||||
|
||||
ObjectTreeView(QWidget* parent = 0, const char * name = 0, Qt::WFlags f = 0);
|
||||
ObjectTreeView(ProjectPanel* project, QWidget* parent = 0, const char * name = 0, Qt::WFlags f = 0);
|
||||
|
||||
void freezeSelection(bool f) { selectionFrozen=f; }
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "ObjectTreeViewItem.h"
|
||||
@ -16,18 +18,18 @@ QVariant ObjectTreeViewItem::data (int column, int role) const
|
||||
if (role == Qt::FontRole)
|
||||
{
|
||||
QFont usual = QTreeWidgetItem::data(column, role).value<QFont>();
|
||||
|
||||
|
||||
FWObject * obj=getFWObject();
|
||||
Firewall * o=NULL;
|
||||
|
||||
if (obj!=NULL || getProperty("type")==Firewall::TYPENAME)
|
||||
|
||||
if (obj!=NULL || getProperty("type")==Firewall::TYPENAME)
|
||||
{
|
||||
o=Firewall::cast( obj );
|
||||
}
|
||||
|
||||
|
||||
if (o!=NULL)
|
||||
{
|
||||
bool mf= !o->getInactive() && (o->needsInstall()) ;
|
||||
bool mf= !o->getInactive() && (o->needsInstall()) ;
|
||||
usual.setBold (mf);
|
||||
return QVariant(usual);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "PhysicalAddressDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/physAddress.h"
|
||||
@ -48,15 +50,16 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
PhysicalAddressDialog::PhysicalAddressDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
PhysicalAddressDialog::PhysicalAddressDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::PhysAddressDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
PhysicalAddressDialog::~PhysicalAddressDialog()
|
||||
@ -97,7 +100,7 @@ void PhysicalAddressDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void PhysicalAddressDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -132,18 +135,18 @@ void PhysicalAddressDialog::applyChanges()
|
||||
obj->setComment( string(m_dialog->comment->toPlainText().toUtf8().constData()) );
|
||||
s->setPhysAddress( m_dialog->pAddress->text().toLatin1().constData() );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void PhysicalAddressDialog::discardChanges()
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class ProjectPanel;
|
||||
|
||||
class PhysicalAddressDialog : public QWidget
|
||||
{
|
||||
@ -42,9 +43,10 @@ class PhysicalAddressDialog : public QWidget
|
||||
bool init;
|
||||
bool showNetmask;
|
||||
Ui::PhysAddressDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
PhysicalAddressDialog(QWidget *parent);
|
||||
PhysicalAddressDialog(ProjectPanel *project, QWidget *parent);
|
||||
~PhysicalAddressDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
but WITHOUT ANY WARRANTY; without even the implied wdarranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -32,7 +34,6 @@
|
||||
#include "FWBSettings.h"
|
||||
#include "listOfLibraries.h"
|
||||
#include "FWWindow.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include <qlineedit.h>
|
||||
#include <qfiledialog.h>
|
||||
@ -88,7 +89,7 @@ PrefsDialog::PrefsDialog(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
m_dialog = new Ui::prefsDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
m_dialog->wDir->setText( st->getWDir() );
|
||||
int sa_itm = st->getStartupAction();
|
||||
if (sa_itm < 0 || sa_itm > 1) sa_itm = 0;
|
||||
@ -110,8 +111,8 @@ PrefsDialog::PrefsDialog(QWidget *parent) : QDialog(parent)
|
||||
// dontSaveStdLib->setChecked( st->getDontSaveStdLib() );
|
||||
|
||||
m_dialog->sshPath->setText( st->getSSHPath() );
|
||||
|
||||
for (list<libData>::iterator i=addOnLibs->begin(); i!=addOnLibs->end(); ++i)
|
||||
|
||||
for (list<libData>::iterator i=mw->getAddOnLibs()->begin(); i!=mw->getAddOnLibs()->end(); ++i)
|
||||
{
|
||||
QStringList qsl;
|
||||
qsl << i->name << "" << i->path; //fromUtf8
|
||||
@ -183,7 +184,7 @@ PrefsDialog::PrefsDialog(QWidget *parent) : QDialog(parent)
|
||||
else
|
||||
m_dialog->rb16->setChecked(true);
|
||||
changeShowIcons();
|
||||
|
||||
|
||||
rulesFont = st->getRulesFont();
|
||||
treeFont = st->getTreeFont();
|
||||
uiFont = st->getUiFont();
|
||||
@ -300,8 +301,8 @@ void PrefsDialog::libClick(QTreeWidgetItem* itm, int col)
|
||||
{
|
||||
if (itm->text(0)=="Standard") return;
|
||||
|
||||
for (list<libData>::iterator i=addOnLibs->begin();
|
||||
i!=addOnLibs->end(); ++i)
|
||||
for (list<libData>::iterator i=mw->getAddOnLibs()->begin();
|
||||
i!=mw->getAddOnLibs()->end(); ++i)
|
||||
{
|
||||
if (i->name == itm->text(0)) //fromUtf8
|
||||
{
|
||||
@ -326,7 +327,7 @@ void PrefsDialog::libClick(QTreeWidgetItem* itm, int col)
|
||||
if (i->load)
|
||||
{
|
||||
mw->loadLibrary( i->path.latin1() );
|
||||
om->loadObjects();
|
||||
mw->loadObjects();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -338,15 +339,15 @@ void PrefsDialog::libClick(QTreeWidgetItem* itm, int col)
|
||||
void PrefsDialog::addLibrary()
|
||||
{
|
||||
QString fp = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
this,
|
||||
tr("Find add-on library"),
|
||||
st->getWDir(),
|
||||
"Firewall Builder 2 files (*.fwl)");
|
||||
|
||||
if (!fp.isEmpty())
|
||||
{
|
||||
list<libData>::iterator i = addOnLibs->add( fp.toLatin1().constData(), true );
|
||||
if (i==addOnLibs->end())
|
||||
list<libData>::iterator i = mw->getAddOnLibs()->add( fp.toLatin1().constData(), true );
|
||||
if (i==mw->getAddOnLibs()->end())
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("PrefsDialog::addLibrary(): library addition failed");
|
||||
@ -369,7 +370,7 @@ void PrefsDialog::addLibrary()
|
||||
// commented out for bug #1620284
|
||||
//
|
||||
//mw->loadLibrary( i->path.latin1() );
|
||||
//om->loadObjects();
|
||||
//mw->loadObjects();
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,11 +385,11 @@ void PrefsDialog::remLibrary()
|
||||
|
||||
if (itm->text(0)=="Standard") return;
|
||||
|
||||
for (list<libData>::iterator i=addOnLibs->begin(); i!=addOnLibs->end(); ++i)
|
||||
for (list<libData>::iterator i=mw->getAddOnLibs()->begin(); i!=mw->getAddOnLibs()->end(); ++i)
|
||||
{
|
||||
if (i->name == itm->text(0)) //fromUtf8
|
||||
{
|
||||
addOnLibs->erase(i);
|
||||
mw->getAddOnLibs()->erase(i);
|
||||
delete itm;
|
||||
break;
|
||||
}
|
||||
@ -436,25 +437,25 @@ void PrefsDialog::accept()
|
||||
st->setLabelText (FWBSettings::BLUE, m_dialog->blueText->text() );
|
||||
st->setLabelText (FWBSettings::PURPLE, m_dialog->purpleText->text() );
|
||||
st->setLabelText (FWBSettings::GRAY, m_dialog->grayText->text() );
|
||||
|
||||
|
||||
st->setShowIconsInRules(m_dialog->chShowIcons->isChecked());
|
||||
FWBSettings::IconSize sz = m_dialog->rb25->isChecked() ?
|
||||
FWBSettings::IconSize sz = m_dialog->rb25->isChecked() ?
|
||||
FWBSettings::SIZE25X25 : FWBSettings::SIZE16X16;
|
||||
st->setIconsInRulesSize(sz);
|
||||
|
||||
|
||||
st->setRulesFont(rulesFont);
|
||||
st->setTreeFont(treeFont);
|
||||
st->setUiFont(uiFont);
|
||||
|
||||
st->setClipComment(m_dialog->chClipComment->isChecked());
|
||||
|
||||
|
||||
st->setSSHPath( m_dialog->sshPath->text() );
|
||||
|
||||
|
||||
QDir d;
|
||||
d.mkdir( wd );
|
||||
|
||||
mw->setupAutoSave();
|
||||
om->showDeletedObjects(st->getBool("UI/ShowDeletedObjects"));
|
||||
mw->showDeletedObjects(st->getBool("UI/ShowDeletedObjects"));
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "PrintingProgressDialog.h"
|
||||
|
||||
#include <qstring.h>
|
||||
@ -41,9 +43,9 @@ PrintingProgressDialog::PrintingProgressDialog(QWidget *parent,QPrinter *p,int n
|
||||
|
||||
connect( m_dialog->Cancel, SIGNAL( clicked() ),
|
||||
this, SLOT( abortPrinting() ) );
|
||||
|
||||
|
||||
printer=p;
|
||||
|
||||
|
||||
setNPages(nPages);
|
||||
m_dialog->text->setText("");
|
||||
if (disableCancel) m_dialog->Cancel->hide();
|
||||
|
||||
3025
src/gui/ProjectPanel.cpp
Normal file
3025
src/gui/ProjectPanel.cpp
Normal file
File diff suppressed because it is too large
Load Diff
357
src/gui/ProjectPanel.h
Normal file
357
src/gui/ProjectPanel.h
Normal file
@ -0,0 +1,357 @@
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
Copyright (C) 2003 NetCitadel, LLC
|
||||
|
||||
Author: Vadim Kurland vadim@fwbuilder.org
|
||||
|
||||
$Id$
|
||||
|
||||
This program is free software which we release under the GNU General Public
|
||||
License. You may redistribute and/or modify this program under the terms
|
||||
of that 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.
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PROJECTPANEL_H
|
||||
#define PROJECTPANEL_H
|
||||
|
||||
#include "ObjectEditor.h"
|
||||
#include "ui_projectpanel_q.h"
|
||||
|
||||
namespace libfwbuilder {
|
||||
class FWObjectDatabase;
|
||||
class Firewall;
|
||||
class PolicyRule;
|
||||
class RuleSet;
|
||||
class FWObject;
|
||||
class FWReference;
|
||||
};
|
||||
|
||||
class QWidget;
|
||||
class QTextEdit;
|
||||
class ObjectTreeView;
|
||||
class ObjectManipulator;
|
||||
class findDialog;
|
||||
class FWWindow;
|
||||
class RuleSetView;
|
||||
class RCS;
|
||||
|
||||
class FindObjectWidget;
|
||||
class FindWhereUsedWidget;
|
||||
class listOfLibraries;
|
||||
class FWBTree;
|
||||
|
||||
class ProjectPanel: public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
FWWindow *mainW;
|
||||
RCS *rcs;
|
||||
listOfLibraries *addOnLibs;
|
||||
FWBTree *objectTreeFormat;
|
||||
bool systemFile;
|
||||
bool safeMode;
|
||||
bool editingStandardLib;
|
||||
bool editingTemplateLib;
|
||||
bool ruleSetRedrawPending;
|
||||
QString startupFileName;
|
||||
|
||||
libfwbuilder::FWObjectDatabase *objdb;
|
||||
QWidget *editorOwner;
|
||||
|
||||
//QTextEdit *oi;
|
||||
//ObjectManipulator *om;
|
||||
ObjectEditor *oe;
|
||||
findDialog *fd;
|
||||
libfwbuilder::FWObject *shownInInfo;
|
||||
|
||||
QTimer *autosaveTimer;
|
||||
std::map<libfwbuilder::FWObject*, RuleSetView*> ruleSetViews;
|
||||
int ruleSetTabIndex;
|
||||
|
||||
libfwbuilder::FWObject *visibleFirewall;
|
||||
std::vector<libfwbuilder::FWObject*> firewalls;
|
||||
int lastFirewallIdx;
|
||||
|
||||
bool changingTabs;
|
||||
void initOE();
|
||||
void initFD();
|
||||
|
||||
QString noFirewalls;
|
||||
public:
|
||||
Ui::ProjectPanel_q *m_panel;
|
||||
FindObjectWidget *findObjectWidget;
|
||||
FindWhereUsedWidget *findWhereUsedWidget;
|
||||
|
||||
ProjectPanel(QWidget *parent);
|
||||
|
||||
~ProjectPanel();
|
||||
void initMain(FWWindow *main);
|
||||
void loadObjects();
|
||||
void loadObjects(libfwbuilder::FWObjectDatabase *db);
|
||||
void clearObjects();
|
||||
libfwbuilder::FWObjectDatabase* db() { return objdb; }
|
||||
//wrapers for some ObjectManipulator functions
|
||||
libfwbuilder::FWObject* getOpened();
|
||||
|
||||
libfwbuilder::FWObject* getCurrentLib();
|
||||
|
||||
libfwbuilder::FWObject* createObject(const QString &objType,
|
||||
const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom=NULL);
|
||||
|
||||
libfwbuilder::FWObject* createObject(libfwbuilder::FWObject *parent,
|
||||
const QString &objType,
|
||||
const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom=NULL);
|
||||
|
||||
void moveObject(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj);
|
||||
|
||||
void moveObject(const QString &targetLibName,
|
||||
libfwbuilder::FWObject *obj);
|
||||
|
||||
void autorename(libfwbuilder::FWObject *obj,
|
||||
const std::string &objtype,
|
||||
const std::string &namesuffix);
|
||||
|
||||
void updateLibColor(libfwbuilder::FWObject *lib);
|
||||
void updateLibName(libfwbuilder::FWObject *lib);
|
||||
|
||||
void updateObjName(libfwbuilder::FWObject *obj,
|
||||
const QString &oldName,
|
||||
bool askForAutorename=true);
|
||||
void updateObjName(libfwbuilder::FWObject *obj,
|
||||
const QString &oldName,
|
||||
const QString &oldLabel,
|
||||
bool askForAutorename=true);
|
||||
|
||||
void updateLastModifiedTimestampForOneFirewall(libfwbuilder::FWObject *o);
|
||||
void updateLastModifiedTimestampForAllFirewalls(libfwbuilder::FWObject *o);
|
||||
void updateLastInstalledTimestamp(libfwbuilder::FWObject *o);
|
||||
void updateLastCompiledTimestamp(libfwbuilder::FWObject *o);
|
||||
|
||||
void loadDataFromFw(libfwbuilder::Firewall *fw);
|
||||
|
||||
libfwbuilder::FWObject* pasteTo(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj,
|
||||
bool openobj=true,
|
||||
bool validateOnly=false);
|
||||
void delObj(libfwbuilder::FWObject *obj,bool openobj=true);
|
||||
ObjectTreeView* getCurrentObjectTree();
|
||||
void openObject(QTreeWidgetItem *otvi);
|
||||
void openObject(libfwbuilder::FWObject *obj);
|
||||
bool editObject(libfwbuilder::FWObject *obj);
|
||||
void findAllFirewalls (std::list<libfwbuilder::Firewall *> &fws);
|
||||
|
||||
libfwbuilder::FWObject* duplicateObject(libfwbuilder::FWObject *target,
|
||||
libfwbuilder::FWObject *obj,
|
||||
const QString &name = QString::null,
|
||||
bool askForAutorename=true);
|
||||
void showDeletedObjects(bool f);
|
||||
void select();
|
||||
void unselect();
|
||||
|
||||
void copyObj();
|
||||
bool isManipulatorSelected();
|
||||
void cutObj();
|
||||
void pasteObj();
|
||||
|
||||
void deleteObj();
|
||||
libfwbuilder::FWObject* getSelectedObject();
|
||||
void reopenCurrentItemParent();
|
||||
|
||||
void setManipulatorFocus();
|
||||
void clearManipulatorFocus();
|
||||
|
||||
//wrapers for some Object Editor functions
|
||||
bool isEditorVisible();
|
||||
bool isEditorModified();
|
||||
|
||||
void showEditor();
|
||||
void hideEditor();
|
||||
void closeEditor();
|
||||
|
||||
void openEditor(libfwbuilder::FWObject *o);
|
||||
void openOptEditor(libfwbuilder::FWObject *, ObjectEditor::OptType t);
|
||||
void blankEditor();
|
||||
|
||||
libfwbuilder::FWObject* getOpenedEditor();
|
||||
ObjectEditor::OptType getOpenedOptEditor();
|
||||
|
||||
void selectObjectInEditor(libfwbuilder::FWObject *o);
|
||||
|
||||
void actionChangedEditor(libfwbuilder::FWObject *o);
|
||||
bool validateAndSaveEditor();
|
||||
//find dialog functions wrapers
|
||||
void setFDObject(libfwbuilder::FWObject *o);
|
||||
|
||||
void info(libfwbuilder::FWObject *o, bool forced = false);
|
||||
void prefsEdited();
|
||||
|
||||
void resetFD();
|
||||
|
||||
void clearFirewallTabs();
|
||||
void ensureObjectVisibleInRules(libfwbuilder::FWReference *obj);
|
||||
|
||||
libfwbuilder::FWObject* getVisibleFirewall() { return visibleFirewall; }
|
||||
RuleSetView* getRuleSetViews(libfwbuilder::FWObject *o)
|
||||
{return ruleSetViews[o];};
|
||||
|
||||
void updateRuleSetViewSelection();
|
||||
void updateRuleSetView();
|
||||
void updateRuleOptions();
|
||||
void updateTreeViewItemOrder();
|
||||
|
||||
void setPolicyBranchTabName(libfwbuilder::RuleSet *subset);
|
||||
void addPolicyBranchTab(libfwbuilder::RuleSet *subset);
|
||||
void removePolicyBranchTab(libfwbuilder::RuleSet *subset);
|
||||
|
||||
void showFirewalls(bool open_first_firewall=true);
|
||||
void showFirewall(libfwbuilder::FWObject *f);
|
||||
int findFirewallInList(libfwbuilder::FWObject *f);
|
||||
void addFirewallToList(libfwbuilder::FWObject *o);
|
||||
void removeFirewallFromList(libfwbuilder::FWObject *o);
|
||||
void updateFirewallName(libfwbuilder::FWObject *obj,const QString &str);
|
||||
void showFirewallRuleSets(libfwbuilder::FWObject *fw );
|
||||
void scheduleRuleSetRedraw();
|
||||
void selectRules();
|
||||
void unselectRules();
|
||||
void editCopy();
|
||||
void editCut();
|
||||
void editDelete();
|
||||
void editPaste();
|
||||
|
||||
bool saveIfModified();
|
||||
QString getDestDir(const QString &fname);
|
||||
QString chooseNewFileName(const QString &fname, bool checkPresence,const QString &title);
|
||||
void setFileName(const QString &fname);
|
||||
|
||||
public slots:
|
||||
void newObject();
|
||||
void info();
|
||||
|
||||
virtual void back();
|
||||
virtual void lockObject();
|
||||
virtual void unlockObject();
|
||||
|
||||
virtual void insertRule();
|
||||
virtual void addRuleAfterCurrent();
|
||||
virtual void moveRule();
|
||||
virtual void moveRuleUp();
|
||||
virtual void moveRuleDown();
|
||||
virtual void removeRule();
|
||||
|
||||
virtual void copyRule();
|
||||
virtual void cutRule();
|
||||
virtual void pasteRuleAbove();
|
||||
virtual void pasteRuleBelow();
|
||||
|
||||
virtual void openFirewall( int idx );
|
||||
virtual void reopenFirewall();
|
||||
virtual void redrawRuleSets();
|
||||
virtual void deleteFirewall(libfwbuilder::FWObject *fw);
|
||||
virtual void changeInfoStyle();
|
||||
virtual void ruleSetTabChanged(int tab);
|
||||
virtual void restoreRuleSetTab();
|
||||
|
||||
virtual void fileProp();
|
||||
virtual void fileNew();
|
||||
virtual void fileOpen();
|
||||
|
||||
virtual void fileClose();
|
||||
virtual void fileSave();
|
||||
virtual void fileSaveAs();
|
||||
virtual void fileExit();
|
||||
virtual void fileCommit();
|
||||
virtual void fileDiscard();
|
||||
virtual void fileAddToRCS();
|
||||
|
||||
virtual void startupLoad();
|
||||
|
||||
virtual void fileImport();
|
||||
virtual void fileCompare();
|
||||
virtual void fileExport();
|
||||
|
||||
virtual void closeAuxiliaryPanel();
|
||||
virtual void closeEditorPanel();
|
||||
virtual void openEditorPanel();
|
||||
|
||||
virtual void search();
|
||||
|
||||
virtual void compile(std::set<libfwbuilder::Firewall * > vf);
|
||||
virtual void compile();
|
||||
virtual void install(std::set<libfwbuilder::Firewall * > vf);
|
||||
virtual void install();
|
||||
|
||||
virtual void rollBackSelectionSameWidget();
|
||||
virtual void rollBackSelectionDifferentWidget();
|
||||
|
||||
signals:
|
||||
void restoreSelection_sign(bool same_widget);
|
||||
public:
|
||||
bool editingLibrary();
|
||||
void createRCS( const QString &filename);
|
||||
void load(QWidget *dialogs_parent,RCS *rcs);
|
||||
void load(QWidget *dialogs_parent);
|
||||
void save();
|
||||
bool checkin(bool unlock);
|
||||
void loadLibrary(const std::string &libfpath);
|
||||
|
||||
bool exportLibraryTest(std::list<libfwbuilder::FWObject*> &selectedLibs);
|
||||
void exportLibraryTo(QString fname,std::list<libfwbuilder::FWObject*> &selectedLibs, bool rof);
|
||||
|
||||
void findExternalRefs(libfwbuilder::FWObject *lib,
|
||||
libfwbuilder::FWObject *root,
|
||||
std::list<libfwbuilder::FWReference*> &extRefs);
|
||||
|
||||
void setSafeMode(bool f) { safeMode=f; }
|
||||
void setStartupFileName(const QString &fn) { startupFileName = fn; }
|
||||
void setupAutoSave();
|
||||
QString getCurrentFileName();
|
||||
RCS * getRCS();
|
||||
void findObject(libfwbuilder::FWObject *);
|
||||
void findWhereUsed(libfwbuilder::FWObject *);
|
||||
QString printHeader();
|
||||
bool requestEditorOwnership(QWidget *w,
|
||||
libfwbuilder::FWObject *o,
|
||||
ObjectEditor::OptType otype,
|
||||
bool validate = true);
|
||||
void releaseEditor();
|
||||
void connectEditor(QWidget *w);
|
||||
listOfLibraries *getAddOnLibs();
|
||||
|
||||
|
||||
bool isSystem(libfwbuilder::FWObject *obj);
|
||||
bool isStandardId(libfwbuilder::FWObject *obj);
|
||||
bool validateForInsertion(libfwbuilder::FWObject *target,libfwbuilder::FWObject *obj);
|
||||
bool getCopyMenuState(const QString &objPath);
|
||||
bool getCutMenuState(const QString &objPath);
|
||||
bool getPasteMenuState(const QString &objPath);
|
||||
bool getDeleteMenuState(const QString &objPath);
|
||||
void getStandardSlotForObject(const QString &objType,
|
||||
QString &parentType,
|
||||
QString &parentName);
|
||||
libfwbuilder::FWObject* getStandardSlotForObject(libfwbuilder::FWObject* lib,
|
||||
const QString &objType);
|
||||
libfwbuilder::FWObject* createNewLibrary(libfwbuilder::FWObjectDatabase *db);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual void showEvent( QShowEvent *ev);
|
||||
virtual void hideEvent( QHideEvent *ev);
|
||||
virtual void closeEvent( QCloseEvent * );
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -62,7 +64,7 @@ void PrototypeDialog::loadFWObject(FWObject *o)
|
||||
apply->setEnabled( false );
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void PrototypeDialog::changed()
|
||||
{
|
||||
apply->setEnabled( true );
|
||||
@ -92,13 +94,13 @@ void PrototypeDialog::applyChanges()
|
||||
obj->setComment( string(comment->text().utf8()) );
|
||||
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -145,9 +147,9 @@ RCSEnvFix::RCSEnvFix()
|
||||
int tzoffset;
|
||||
QString tzsign = "";
|
||||
|
||||
time_t clock;
|
||||
struct tm *ltm;
|
||||
time(&clock);
|
||||
time_t clock;
|
||||
struct tm *ltm;
|
||||
time(&clock);
|
||||
ltm = (struct tm *) localtime(&clock);
|
||||
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE)
|
||||
@ -170,7 +172,7 @@ RCSEnvFix::RCSEnvFix()
|
||||
} else {
|
||||
tzsign = "+";
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
// global variable timezone has seconds West of GMT (positive in
|
||||
// timezones west of GMT)
|
||||
@ -292,7 +294,7 @@ RCS::RCS(const QString &file)
|
||||
*/
|
||||
QString rl = rlog();
|
||||
QStringList split_log = rl.split(QRegExp("------|======"));
|
||||
|
||||
|
||||
QString head_section = split_log[0];
|
||||
|
||||
QRegExp head_rx("head:\\s+([0-9\\.]+)\\s*\\n");
|
||||
@ -385,7 +387,7 @@ RCS::RCS(const QString &file)
|
||||
r.rev = (*i).section(QRegExp("\\s+"),1,1);
|
||||
QString lb = (*i).section(QRegExp("[\\s;]+"),4,4);
|
||||
if (lb!="")
|
||||
{
|
||||
{
|
||||
r.locked_by = lb;
|
||||
locked = true;
|
||||
locked_by = lb;
|
||||
@ -491,7 +493,7 @@ void RCS::abandon()
|
||||
proc->setEnvironment(*rcsenvfix->getEnv());
|
||||
proc->start( co_file_name, arglist );
|
||||
proc->waitForStarted();
|
||||
|
||||
|
||||
if (fwbdebug) qDebug("running co");
|
||||
|
||||
if (proc->state() == QProcess::Running)
|
||||
@ -511,7 +513,7 @@ void RCS::abandon()
|
||||
selectedRev = "";
|
||||
|
||||
checked_out=false;
|
||||
|
||||
|
||||
QString err = tr("Error checking file out: %1").arg(stderrBuffer);
|
||||
QMessageBox::critical(app->activeWindow(), "Firewall Builder", err, tr("&Continue") );
|
||||
|
||||
@ -531,7 +533,7 @@ void RCS::add() throw(libfwbuilder::FWException)
|
||||
if (!rcsdir.exists("RCS")) rcsdir.mkdir("RCS");
|
||||
|
||||
QStringList arglist;
|
||||
|
||||
|
||||
arglist << "-q" << "-i" << "-kb" << QString("-z") + rcsenvfix->getTZOffset() << "-t-\"Initial checkin\"" << filename;
|
||||
|
||||
stdoutBuffer="";
|
||||
@ -547,7 +549,7 @@ void RCS::add() throw(libfwbuilder::FWException)
|
||||
if (proc->state() == QProcess::NotRunning && proc->exitCode()==0)
|
||||
{
|
||||
arglist.clear();
|
||||
|
||||
|
||||
arglist << "-q" << "-u" << QString("-z") + rcsenvfix->getTZOffset() << filename;
|
||||
|
||||
stdoutBuffer="";
|
||||
@ -581,14 +583,14 @@ bool RCS::isInRCS()
|
||||
if (tracking_file) return inrcs;
|
||||
|
||||
QStringList arglist;
|
||||
|
||||
|
||||
arglist << QString("-z") + rcsenvfix->getTZOffset() << "-R" << filename;
|
||||
|
||||
stdoutBuffer="";
|
||||
stderrBuffer="";
|
||||
|
||||
proc->setEnvironment(*rcsenvfix->getEnv());
|
||||
|
||||
|
||||
proc->start( rlog_file_name, arglist );
|
||||
proc->waitForStarted();
|
||||
if (proc->state() != QProcess::Running)
|
||||
@ -654,7 +656,7 @@ bool RCS::co(const QString &rev,bool force) throw(libfwbuilder::FWException)
|
||||
{
|
||||
if (rev==head || rev=="") return true;
|
||||
|
||||
/* check out requested revision to stdout
|
||||
/* check out requested revision to stdout
|
||||
*
|
||||
* TODO: right now it loads the whole file into memory, then writes it
|
||||
* to the temp file. It should be more efficient to read and write in
|
||||
@ -663,7 +665,7 @@ bool RCS::co(const QString &rev,bool force) throw(libfwbuilder::FWException)
|
||||
*/
|
||||
QStringList arglist;
|
||||
|
||||
arglist << QString("-q") << QString("-kb") <<
|
||||
arglist << QString("-q") << QString("-kb") <<
|
||||
QString("-z") + rcsenvfix->getTZOffset() << QString("-p")+rev << filename;
|
||||
|
||||
stdoutBuffer="";
|
||||
@ -678,7 +680,7 @@ bool RCS::co(const QString &rev,bool force) throw(libfwbuilder::FWException)
|
||||
proc->setEnvironment(*rcsenvfix->getEnv());
|
||||
proc->start( co_file_name, arglist );
|
||||
proc->waitForStarted();
|
||||
|
||||
|
||||
if (fwbdebug) qDebug("running co");
|
||||
|
||||
if (proc->state() == QProcess::Running)
|
||||
@ -699,7 +701,7 @@ bool RCS::co(const QString &rev,bool force) throw(libfwbuilder::FWException)
|
||||
strncpy(tname, filename.toLatin1().constData(), sizeof(tname)-20 );
|
||||
strcat(tname,"_temp_XXXXXX");
|
||||
int fd = mkstemp(tname);
|
||||
#endif
|
||||
#endif
|
||||
if (fd<0)
|
||||
{
|
||||
QString err = tr("Error creating temporary file ")+tname+QString(" :\n")+strerror(errno);
|
||||
@ -746,7 +748,7 @@ bool RCS::co(const QString &rev,bool force) throw(libfwbuilder::FWException)
|
||||
if (me!=locked_by)
|
||||
{
|
||||
switch (QMessageBox::warning(
|
||||
app->activeWindow(),"Firewall Builder",
|
||||
app->activeWindow(),"Firewall Builder",
|
||||
tr("File is opened and locked by %1.\nYou can only open it read-only.")
|
||||
.arg(locked_by),
|
||||
"Open &read-only", "&Cancel", QString::null,
|
||||
@ -875,7 +877,7 @@ bool RCS::ci( const QString &_lm,
|
||||
* Also it seems on windows all data is sent to the process and slot
|
||||
* is called while we still are inside launch, so that once we exit
|
||||
* from it, all is done and there is no need to enter event loop.
|
||||
*/
|
||||
*/
|
||||
ciRunning=true;
|
||||
ciproc->setEnvironment(*rcsenvfix->getEnv());
|
||||
ciproc->start( ci_file_name, arglist );
|
||||
@ -895,9 +897,9 @@ bool RCS::ci( const QString &_lm,
|
||||
rcslogCopy = rcslog;
|
||||
|
||||
ciproc->write((const char*)rcslogCopy, rcslog.length());
|
||||
|
||||
|
||||
QByteArray arr;
|
||||
arr = "\n.\n";
|
||||
arr = "\n.\n";
|
||||
ciproc->write((const char*)(arr),arr.length());
|
||||
|
||||
if (fwbdebug) qDebug("all data sent to ci");
|
||||
@ -940,7 +942,7 @@ QString RCS::rlog() throw(libfwbuilder::FWException)
|
||||
|
||||
arglist << QString("-z") + rcsenvfix->getTZOffset() << filename;
|
||||
// proc->addArgument( "-zLT" );
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("Running rlog: %s %s",rlog_file_name.toAscii().constData(),arglist.join(" ").toAscii().constData());
|
||||
|
||||
@ -950,7 +952,7 @@ QString RCS::rlog() throw(libfwbuilder::FWException)
|
||||
//proc->setEnvironment(*rcsenvfix->getEnv());
|
||||
proc->start( rlog_file_name, arglist );
|
||||
proc->waitForStarted();
|
||||
|
||||
|
||||
if (proc->state() != QProcess::Running)
|
||||
throw(FWException("Fatal error running rlog "));
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -44,15 +46,15 @@ RCSFileDialog::RCSFileDialog( const QString& dirName, const QString& filter,
|
||||
if (fwbdebug) qDebug("RCSFileDialog: constructor 1");
|
||||
|
||||
QStringList qsl;
|
||||
|
||||
|
||||
qsl << "Firewall Builder 4 (2) files (*.fwb)"
|
||||
<< "Firewall Builder 4 (2) library files (*.fwl)"
|
||||
<< "Old Firewall Builder files (*.xml)";
|
||||
|
||||
|
||||
setFilters(qsl);
|
||||
|
||||
setFileMode( QFileDialog::ExistingFile );
|
||||
|
||||
|
||||
resize( QSize(700, 350) );
|
||||
|
||||
QString dir;
|
||||
@ -72,13 +74,13 @@ RCSFileDialog::RCSFileDialog( QWidget* parent, const char* name, bool modal )
|
||||
if (fwbdebug) qDebug("RCSFileDialog: constructor 2");
|
||||
|
||||
QStringList qsl;
|
||||
|
||||
|
||||
qsl << "Firewall Builder 4 (2) files (*.fwb)"
|
||||
<< "Firewall Builder 4 (2) library files (*.fwl)"
|
||||
<< "Old Firewall Builder files (*.xml)";
|
||||
|
||||
|
||||
setFilters(qsl);
|
||||
|
||||
|
||||
resize( QSize(700, 350) );
|
||||
|
||||
QString dir;
|
||||
@ -104,5 +106,5 @@ RCS* RCSFileDialog::getSelectedRev()
|
||||
return preview_rcs; */
|
||||
|
||||
RCS *rcs = new RCS(selectedFiles()[0]);
|
||||
return rcs;
|
||||
return rcs;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -71,7 +73,7 @@ RCSFilePreview::RCSFilePreview(QWidget *parent): QDialog(parent)
|
||||
|
||||
m_widget = new Ui::RCSFilePreview_q;
|
||||
m_widget->setupUi(this);
|
||||
|
||||
|
||||
|
||||
connect( m_widget->cancelButton, SIGNAL( clicked() ),
|
||||
this, SLOT( reject() ) );
|
||||
@ -192,7 +194,7 @@ bool RCSFilePreview::showFileRLog( const QString &filename )
|
||||
m_widget->RCSTreeView->sortByColumn(0, Qt::AscendingOrder);
|
||||
m_widget->RCSTreeView->resizeColumnToContents ( 0 );
|
||||
m_widget->RCSTreeView->resizeColumnToContents ( 1 );
|
||||
|
||||
|
||||
|
||||
lastItem->setSelected( true );
|
||||
m_widget->RCSTreeView->setCurrentItem( lastItem );
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Copyright (C) 2005 Compal GmbH, Germany
|
||||
|
||||
@ -24,13 +24,15 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "platforms.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "RoutingRuleOptionsDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "RuleSetView.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
@ -58,7 +60,7 @@ RoutingRuleOptionsDialog::~RoutingRuleOptionsDialog()
|
||||
delete m_dialog;
|
||||
}
|
||||
|
||||
RoutingRuleOptionsDialog::RoutingRuleOptionsDialog(QWidget *parent) : QWidget(parent)
|
||||
RoutingRuleOptionsDialog::RoutingRuleOptionsDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::RoutingRuleOptionsDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
@ -108,7 +110,7 @@ void RoutingRuleOptionsDialog::loadFWObject(FWObject *o)
|
||||
//apply->setEnabled( false );
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void RoutingRuleOptionsDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -141,7 +143,7 @@ void RoutingRuleOptionsDialog::applyChanges()
|
||||
mw->updateRuleOptions();
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void RoutingRuleOptionsDialog::discardChanges()
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class RuleSetView;
|
||||
class ProjectPanel;
|
||||
|
||||
class RoutingRuleOptionsDialog : public QWidget
|
||||
{
|
||||
@ -48,9 +49,10 @@ class RoutingRuleOptionsDialog : public QWidget
|
||||
Ui::RoutingRuleOptionsDialog_q *m_dialog;
|
||||
|
||||
bool init;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
RoutingRuleOptionsDialog(QWidget *parent);
|
||||
RoutingRuleOptionsDialog(ProjectPanel *project, QWidget *parent);
|
||||
~RoutingRuleOptionsDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,22 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "platforms.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "RuleOptionsDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "RuleSetView.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
@ -61,12 +63,12 @@ RuleOptionsDialog::~RuleOptionsDialog()
|
||||
delete m_dialog;
|
||||
}
|
||||
|
||||
RuleOptionsDialog::RuleOptionsDialog(QWidget *parent) : QWidget(parent)
|
||||
RuleOptionsDialog::RuleOptionsDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::RuleOptionsDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
@ -79,10 +81,10 @@ void RuleOptionsDialog::loadFWObject(FWObject *o)
|
||||
while ( !Firewall::isA(p) ) p=p->getParent();
|
||||
platform=p->getStr("platform").c_str();
|
||||
|
||||
|
||||
|
||||
Rule *rule = dynamic_cast<Rule*>(o);
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
|
||||
|
||||
m_dialog->editorTitle->setText(QString("%1 / %2 / %3 ")
|
||||
.arg(QString::fromUtf8(p->getName().c_str()))
|
||||
.arg(rule->getTypeName().c_str())
|
||||
@ -109,14 +111,14 @@ void RuleOptionsDialog::loadFWObject(FWObject *o)
|
||||
|
||||
QStringList logFacilities=getLogFacilities( obj->getStr("platform").c_str() );
|
||||
m_dialog->ipf_logFacility->clear();
|
||||
m_dialog->ipf_logFacility->addItems(getScreenNames(logFacilities));
|
||||
m_dialog->ipf_logFacility->addItems(getScreenNames(logFacilities));
|
||||
QStringList limitSuffixes=getLimitSuffixes( obj->getStr("platform").c_str() );
|
||||
m_dialog->ipt_limitSuffix->clear();
|
||||
m_dialog->ipt_limitSuffix->addItems(getScreenNames(limitSuffixes));
|
||||
|
||||
|
||||
|
||||
|
||||
data.clear();
|
||||
|
||||
|
||||
if (platform=="iptables")
|
||||
{
|
||||
data.registerOption( m_dialog->ipt_logPrefix , ropt, "log_prefix" );
|
||||
@ -214,7 +216,7 @@ void RuleOptionsDialog::loadFWObject(FWObject *o)
|
||||
//apply->setEnabled( false );
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void RuleOptionsDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -259,7 +261,7 @@ void RuleOptionsDialog::applyChanges()
|
||||
mw->updateRuleOptions();
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void RuleOptionsDialog::cancelChanges()
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class RuleSetView;
|
||||
class ProjectPanel;
|
||||
|
||||
class RuleOptionsDialog : public QWidget
|
||||
{
|
||||
@ -49,8 +50,9 @@ class RuleOptionsDialog : public QWidget
|
||||
|
||||
bool init;
|
||||
|
||||
ProjectPanel *m_project;
|
||||
public:
|
||||
RuleOptionsDialog(QWidget *parent);
|
||||
RuleOptionsDialog(ProjectPanel *project, QWidget *parent);
|
||||
~RuleOptionsDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,20 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "FWWindow.h"
|
||||
#include "RuleSetView.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ObjectEditor.h"
|
||||
#include "platforms.h"
|
||||
#include "FWObjectDrag.h"
|
||||
@ -78,6 +79,7 @@
|
||||
#include <qstyle.h>
|
||||
#include <qtimer.h>
|
||||
#include <qpixmapcache.h>
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
@ -98,12 +100,12 @@ RuleTableModel::RuleTableModel(const int rows, const int columns, RuleSetView *r
|
||||
ruleSetView(ruleView)
|
||||
{};
|
||||
RuleTableModel::~RuleTableModel() {};
|
||||
|
||||
|
||||
int RuleTableModel::rowCount ( const QModelIndex & ) const
|
||||
{
|
||||
return m_rowCount;
|
||||
}
|
||||
|
||||
|
||||
int RuleTableModel::columnCount ( const QModelIndex & ) const
|
||||
{
|
||||
return m_columnCount;
|
||||
@ -122,12 +124,12 @@ void RuleTableModel::setRowCount ( const int &value )
|
||||
reset();
|
||||
//need to reset model for RuleSetView::iinit (two is)
|
||||
}
|
||||
|
||||
|
||||
QVariant RuleTableModel::data ( const QModelIndex &, int role) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
QVariant RuleTableModel::headerData(int section, Qt::Orientation orientation, int role ) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal)
|
||||
@ -137,7 +139,7 @@ QVariant RuleTableModel::headerData(int section, Qt::Orientation orientation, in
|
||||
if (role == Qt::DisplayRole)
|
||||
return QString(header.value(section));
|
||||
}
|
||||
|
||||
|
||||
if (orientation == Qt::Vertical)
|
||||
{
|
||||
if (role == Qt::SizeHintRole)
|
||||
@ -148,7 +150,7 @@ QVariant RuleTableModel::headerData(int section, Qt::Orientation orientation, in
|
||||
{
|
||||
//QFont f = QAbstractTableModel::headerData(section, orientation, role ).value<QFont>();
|
||||
QFont f = st->getRulesFont();
|
||||
|
||||
|
||||
if ((section >= ruleSetView->firstSelectedRule) && (section <= ruleSetView->lastSelectedRule))
|
||||
f.setBold(true);
|
||||
|
||||
@ -194,11 +196,11 @@ void RuleTableModel::insertRow( const int before_pos )
|
||||
if (before_pos > 0)
|
||||
for (int i = before_pos-1; i < m_rowCount; i++)
|
||||
//step back a little because of another QTableView bug
|
||||
ruleSetView->verticalHeader()->resizeSection(i,
|
||||
ruleSetView->verticalHeader()->resizeSection(i,
|
||||
ruleSetView->rowHeights[i]);
|
||||
else
|
||||
for (int i = before_pos; i < m_rowCount; i++)
|
||||
ruleSetView->verticalHeader()->resizeSection(i,
|
||||
ruleSetView->verticalHeader()->resizeSection(i,
|
||||
ruleSetView->rowHeights[i]);
|
||||
|
||||
ruleSetView->unfreezeRowSizing();
|
||||
@ -219,9 +221,9 @@ void RuleTableModel::removeRows ( const int row1, const int row2 )
|
||||
{
|
||||
//(row2-row1)+1 rows deleted
|
||||
m_rowCount -= (row2-row1)+1;
|
||||
|
||||
|
||||
ruleSetView->freezeRowSizing();
|
||||
|
||||
|
||||
for (int i = row1; i < static_cast<int>(ruleSetView->rowHeights.size())-((row2-row1)+1); i++)
|
||||
ruleSetView->rowHeights[i] = ruleSetView->rowHeights[i+1+(row2-row1)];
|
||||
for (int i = row1; i <= row2; i++)
|
||||
@ -230,11 +232,11 @@ void RuleTableModel::removeRows ( const int row1, const int row2 )
|
||||
QAbstractTableModel::beginRemoveRows( QModelIndex(), row1, row2 );
|
||||
QAbstractTableModel::removeRows(row1, (row2-row1)+1);
|
||||
QAbstractTableModel::endRemoveRows();
|
||||
|
||||
|
||||
for (int i = row1; i < m_rowCount; i++)
|
||||
ruleSetView->verticalHeader()->resizeSection(i,
|
||||
ruleSetView->verticalHeader()->resizeSection(i,
|
||||
ruleSetView->rowHeights[i]);
|
||||
|
||||
|
||||
ruleSetView->unfreezeRowSizing();
|
||||
}
|
||||
|
||||
@ -263,7 +265,7 @@ QRect RuleDelegate::cellGeometry(const int row, const int col) const
|
||||
left += ruleSetView->getColumnWidth(i);
|
||||
cr.setLeft(left);
|
||||
cr.setWidth(ruleSetView->getColumnWidth(col));
|
||||
|
||||
|
||||
return cr;
|
||||
}
|
||||
|
||||
@ -336,7 +338,7 @@ class mouseEventFilter : public QObject
|
||||
cerr << "event type=" << event->type() << endl;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -348,18 +350,18 @@ bool headerMouseEventInterceptor::eventFilter( QObject *, QEvent *event)
|
||||
if (event->type() == QEvent::ContextMenu )
|
||||
{
|
||||
QContextMenuEvent *e = (QContextMenuEvent*)(event);
|
||||
|
||||
|
||||
int row = rsv->rowAt( e->pos().y() );
|
||||
|
||||
rsv->contextMenu(row, -1, e->globalPos());
|
||||
rsv->contextMenu(row, -1, e->globalPos());
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RuleSetView::freezeRowSizing()
|
||||
{
|
||||
rowSizingFrozen = true;
|
||||
rowSizingFrozen = true;
|
||||
}
|
||||
|
||||
void RuleSetView::unfreezeRowSizing()
|
||||
@ -397,52 +399,40 @@ QPixmap LoadPixmap(const QString path)
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
RuleSetView::RuleSetView( int r, int c, QWidget *parent ) : QTableView( /*r, c,*/ parent ), hme(this)
|
||||
RuleSetView::RuleSetView(ProjectPanel *project, int r, int c, QWidget *parent):
|
||||
QTableView( /*r, c,*/ parent ), hme(this),
|
||||
ncols(c), RuleElementSpacing(4), selectedObject(0),
|
||||
selectedObjectCol(0), prevSelectedObject(0),
|
||||
kbdGoingUp(false), changingSelection(false), changingRules(false),
|
||||
firstSelectedRule(-1), lastSelectedRule(-1), ruleModel(new RuleTableModel(r, c, this)),
|
||||
ruleDelegate(new RuleDelegate(this)), m_project(project)
|
||||
{
|
||||
firstSelectedRule = -1;
|
||||
lastSelectedRule = -1;
|
||||
setFont(st->getRulesFont());
|
||||
rowSizingFrozen = false;
|
||||
|
||||
ruleModel = new RuleTableModel(r, c, this);
|
||||
|
||||
setModel(ruleModel);
|
||||
|
||||
ruleDelegate = new RuleDelegate(this);
|
||||
setItemDelegate(ruleDelegate);
|
||||
|
||||
setCurrentCell(0,0);
|
||||
|
||||
kbdGoingUp = false;
|
||||
RuleElementSpacing=4;
|
||||
changingSelection = false;
|
||||
changingRules = false;
|
||||
setCurrentCell(0,0);
|
||||
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
|
||||
ncols=c;
|
||||
selectedObject = NULL;
|
||||
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
|
||||
setSelectionMode( QAbstractItemView::ContiguousSelection );
|
||||
setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||
|
||||
|
||||
int lm, tm, rm, bm;
|
||||
getContentsMargins(&lm, &tm, &rm, &bm);
|
||||
setContentsMargins(fontMetrics().width( "W999W" ), tm, rm, bm);
|
||||
|
||||
|
||||
horizontalHeader()->setResizeMode(QHeaderView::Interactive);
|
||||
verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
||||
|
||||
horizontalHeader()->setClickable(false);
|
||||
verticalHeader()->setClickable(true);
|
||||
|
||||
|
||||
horizontalHeader()->setMovable(false);
|
||||
|
||||
setContextMenuPolicy( Qt::CustomContextMenu );
|
||||
@ -457,10 +447,10 @@ RuleSetView::RuleSetView( int r, int c, QWidget *parent ) : QTableView( /*r, c,*
|
||||
|
||||
connect( horizontalHeader(), SIGNAL( sectionResized ( int, int, int ) ),
|
||||
this, SLOT( horzSectionResized ( int, int, int ) ) );
|
||||
|
||||
|
||||
connect( verticalHeader(), SIGNAL( sectionResized ( int, int, int ) ),
|
||||
this, SLOT( vertSectionResized ( int, int, int ) ) );
|
||||
|
||||
|
||||
connect( this, SIGNAL( customContextMenuRequested(const QPoint&) ),
|
||||
this, SLOT( contextMenuRequested(const QPoint&) ) );
|
||||
|
||||
@ -481,11 +471,11 @@ bool RuleSetView::showCommentTip(QPoint pos, QHelpEvent *he)
|
||||
return false;
|
||||
int col = columnAt(pos.x() - verticalHeader()->width());
|
||||
if((pos.y() >= horizontalHeader()->height()) && RuleSetView::Comment == getColType(col))
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
QString t="";
|
||||
int row = rowAt(pos.y() - horizontalHeader()->height());
|
||||
|
||||
|
||||
QRect cr;
|
||||
|
||||
cr=ruleDelegate->cellGeometry(row,col);
|
||||
@ -499,7 +489,7 @@ bool RuleSetView::showCommentTip(QPoint pos, QHelpEvent *he)
|
||||
cr.left() - horizontalOffset() - 2,
|
||||
cr.top() - verticalOffset() - 2,
|
||||
cr.width() + 4,
|
||||
cr.height() + 4);
|
||||
cr.height() + 4);
|
||||
|
||||
QRect global = QRect(
|
||||
viewport()->mapToGlobal(cr.topLeft()), viewport()->mapToGlobal(cr.bottomRight()));
|
||||
@ -508,7 +498,7 @@ bool RuleSetView::showCommentTip(QPoint pos, QHelpEvent *he)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool RuleSetView::event ( QEvent * event )
|
||||
{
|
||||
if (event->type() == QEvent::ToolTip)
|
||||
@ -520,7 +510,7 @@ bool RuleSetView::event ( QEvent * event )
|
||||
if ((st->getObjTooltips()) && (pos.y() >= horizontalHeader()->height()))
|
||||
{
|
||||
int col = columnAt(pos.x() - verticalHeader()->width());
|
||||
int row = rowAt(pos.y() - horizontalHeader()->height());
|
||||
int row = rowAt(pos.y() - horizontalHeader()->height());
|
||||
|
||||
if ((row < 0) || (col < 0)) return true;
|
||||
|
||||
@ -561,7 +551,7 @@ bool RuleSetView::event ( QEvent * event )
|
||||
else
|
||||
{
|
||||
FWObject *obj = getObj(row,col,contentsMouse.y(),&cr);
|
||||
if (obj==NULL)
|
||||
if (obj==NULL)
|
||||
return true;
|
||||
t=FWObjectPropertiesFactory::getObjectPropertiesDetailed(obj,true,true);
|
||||
}
|
||||
@ -570,7 +560,7 @@ bool RuleSetView::event ( QEvent * event )
|
||||
cr.left() - horizontalOffset() - 2,
|
||||
cr.top() - verticalOffset() - 2,
|
||||
cr.width() + 4,
|
||||
cr.height() + 4);
|
||||
cr.height() + 4);
|
||||
|
||||
QRect global = QRect(
|
||||
viewport()->mapToGlobal(cr.topLeft()), viewport()->mapToGlobal(cr.bottomRight()));
|
||||
@ -580,7 +570,7 @@ bool RuleSetView::event ( QEvent * event )
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return QTableView::event(event);
|
||||
}
|
||||
|
||||
@ -595,7 +585,7 @@ void RuleSetView::currentChanged( const QModelIndex ¤t )
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::currentChanged to row %d, col %d",current.row(),current.column());
|
||||
changeCurrentCell(current.row(), current.column());
|
||||
changeCurrentCell(current.row(), current.column());
|
||||
}
|
||||
|
||||
void RuleSetView::updateCell( const int row, const int col )
|
||||
@ -627,7 +617,7 @@ int RuleSetView::currentColumn() const
|
||||
{
|
||||
return m_currentColumn;
|
||||
}
|
||||
|
||||
|
||||
void RuleSetView::setCurrentRow(const int value)
|
||||
{
|
||||
m_currentRow = value;
|
||||
@ -658,12 +648,12 @@ void RuleSetView::changeCurrentCell(const int row, const int col, bool fullrefre
|
||||
if (fullrefresh)
|
||||
setCurrentIndex(ruleModel->index(row,col));
|
||||
}
|
||||
|
||||
|
||||
void RuleSetView::unselect()
|
||||
{
|
||||
clearSelection();
|
||||
selectedObject=NULL;
|
||||
|
||||
|
||||
updateCell(currentRow(),currentColumn());
|
||||
}
|
||||
|
||||
@ -680,18 +670,18 @@ void RuleSetView::hideEvent(QHideEvent *)
|
||||
QString k = settingsKey();
|
||||
QString v;
|
||||
|
||||
for (int col=0; col<ncols; col++)
|
||||
for (int col=0; col<ncols; col++)
|
||||
v = v + QString("%1 ").arg( columnWidth(col) );
|
||||
/* disabled because we need to remember the width for columns in
|
||||
* association with their names, not just sequentially. Since
|
||||
* different firewall types have different number of columns, doing it
|
||||
* just by numbers causes the last column to disappear when user
|
||||
* switches from a firewall with 6 columns to firewall with 7 columns
|
||||
* switches from a firewall with 6 columns to firewall with 7 columns
|
||||
* (e.g. from pf to iptables)
|
||||
*/
|
||||
// st->setStr(k,v);
|
||||
|
||||
mw->unselectRules();
|
||||
m_project->unselectRules();
|
||||
}
|
||||
|
||||
QString RuleSetView::settingsKey()
|
||||
@ -750,14 +740,14 @@ void RuleSetView::init()
|
||||
if (!v.isEmpty())
|
||||
{
|
||||
userColWidth=true;
|
||||
for (int col=0; col<ncols; col++)
|
||||
for (int col=0; col<ncols; col++)
|
||||
colW[col]=v.section(' ',col,col).toInt();
|
||||
} else
|
||||
{
|
||||
for (int col=0; col<ncols; col++)
|
||||
{
|
||||
QString lbl = ruleModel->headerData(col, Qt::Horizontal, Qt::DisplayRole).toString();//horzHeaderLabels->stringList()[col];
|
||||
|
||||
|
||||
|
||||
QRect br=p.boundingRect(QRect(0,0,1000,1000),
|
||||
Qt::AlignLeft|Qt::AlignVCenter,
|
||||
@ -783,12 +773,12 @@ void RuleSetView::init()
|
||||
QRect cr = calculateCellSize(row,col);
|
||||
h = QMAX(h, cr.height());
|
||||
if (!userColWidth)
|
||||
colW[col]=QMAX(colW[col],cr.width());
|
||||
colW[col]=QMAX(colW[col],cr.width());
|
||||
}
|
||||
adjustRow_int(row,h);
|
||||
}
|
||||
|
||||
for (int col=0; col<ncols; col++)
|
||||
for (int col=0; col<ncols; col++)
|
||||
{
|
||||
// ruleDelegate->setColumnWidth(col,colW[col]);
|
||||
horizontalHeader()->resizeSection(col, colW[col]);
|
||||
@ -810,16 +800,16 @@ QSize RuleSetView::getPMSize()
|
||||
QString icn="icon-ref";
|
||||
if (FWBSettings::SIZE16X16 == st->getIconsInRulesSize())
|
||||
icn="icon-tree";
|
||||
// return QPixmap::fromMimeSource(
|
||||
// return QPixmap::fromMimeSource(
|
||||
// Resources::global_res->getObjResourceStr(obj, icn).c_str() );
|
||||
|
||||
QString icn_file = QString(":/Icons/AddressTable/")+icn;
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::getPMSize() icn=%s",icn.toAscii().constData());
|
||||
QPixmap pm;
|
||||
LoadPixmap(icn_file, pm);
|
||||
|
||||
|
||||
pixmap_h = pm.height();
|
||||
pixmap_w = pm.width();
|
||||
return pm.size();
|
||||
@ -856,7 +846,7 @@ void RuleSetView::iinit()
|
||||
Resources::getTargetCapabilityBool(f->getStr("platform"),
|
||||
"supports_time");
|
||||
} catch (FWException &ex) { }
|
||||
|
||||
|
||||
update();
|
||||
|
||||
return;
|
||||
@ -897,7 +887,7 @@ QRect RuleSetView::calculateCellSize( int row, int col )
|
||||
if (re==NULL)
|
||||
{
|
||||
/* broken rule element, fix it */
|
||||
FWObject *nre=mw->db()->create("When");
|
||||
FWObject *nre=m_project->db()->create("When");
|
||||
assert(nre!=NULL);
|
||||
rule->add(nre);
|
||||
}
|
||||
@ -924,7 +914,7 @@ QRect RuleSetView::calculateCellSize( int row, int col )
|
||||
Qt::AlignLeft|Qt::AlignVCenter,
|
||||
ot);
|
||||
hc += item_h;
|
||||
int itmW = RuleElementSpacing/2 + pixmap_w +
|
||||
int itmW = RuleElementSpacing/2 + pixmap_w +
|
||||
RuleElementSpacing + br.width();
|
||||
wc = QMAX(wc, itmW);
|
||||
}
|
||||
@ -972,8 +962,8 @@ QRect RuleSetView::calculateCellSize( int row, int col )
|
||||
QRect br=p.boundingRect(QRect(0,0,1000,1000),
|
||||
Qt::AlignLeft|Qt::AlignVCenter,
|
||||
QString::fromUtf8(rule->getComment().c_str()) );
|
||||
|
||||
hc = st->getClipComment() ? item_h : (br.height() + RuleElementSpacing/2);
|
||||
|
||||
hc = st->getClipComment() ? item_h : (br.height() + RuleElementSpacing/2);
|
||||
wc = RuleElementSpacing/2 + br.width();
|
||||
break;
|
||||
}
|
||||
@ -994,7 +984,7 @@ QRect RuleSetView::calculateCellSize( int row, int col )
|
||||
|
||||
h = QMAX(h, hc);
|
||||
h = QMAX(h, pixmap_h+RuleElementSpacing);
|
||||
|
||||
|
||||
wc = QMAX(wc, QApplication::globalStrut().width());
|
||||
wc += RuleElementSpacing/2; // some padding
|
||||
|
||||
@ -1039,7 +1029,7 @@ QPixmap RuleSetView::getPixmap(FWObject *obj, PixmapAttr pmattr) const
|
||||
if (pmattr == Ref) icn="icon-ref";
|
||||
if (pmattr == Tree) icn="icon-tree";
|
||||
|
||||
// return QPixmap::fromMimeSource(
|
||||
// return QPixmap::fromMimeSource(
|
||||
// Resources::global_res->getObjResourceStr(obj, icn).c_str() );
|
||||
|
||||
QString icn_file = (":/Icons/"+obj->getTypeName()+"/"+icn).c_str();// = Resources::global_res->getObjResourceStr(obj, icn).c_str();
|
||||
@ -1073,11 +1063,11 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
qDebug("Draw cell: row=%d col=%d current palette=%d",
|
||||
row,col,palette().serialNumber());*/
|
||||
if (ruleIndex.count(row)==0) return;
|
||||
|
||||
|
||||
QString rclr;
|
||||
Rule *rule = Rule::cast( ruleIndex[row] );
|
||||
if (rule==NULL) return;
|
||||
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
rclr = ropt->getStr("color").c_str();
|
||||
@ -1132,7 +1122,7 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
RuleElement *re = getRE(row,col);
|
||||
if (re==NULL) return;
|
||||
re_size = re->size();
|
||||
|
||||
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
FWObject *o1= *i;
|
||||
@ -1157,17 +1147,17 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
x = r.left()+1;
|
||||
|
||||
QSize sz = drawIconInRule(p, x, y, re, o1);
|
||||
|
||||
|
||||
x += sz.width()+1;
|
||||
|
||||
|
||||
|
||||
|
||||
p.drawText( x, y + RuleElementSpacing/2,
|
||||
cr.width()-sz.width()-1, item_h,
|
||||
Qt::AlignLeft|Qt::AlignVCenter, objectText(re,o1) );
|
||||
|
||||
|
||||
FWObject *mwSelObj = selectedObject;
|
||||
std::vector<libfwbuilder::FWObject*> om_selected_objects =
|
||||
om->getCurrentObjectTree()->getSelectedObjects();
|
||||
m_project->getCurrentObjectTree()->getSelectedObjects();
|
||||
|
||||
if (mwSelObj==NULL && om_selected_objects.size()!=0)
|
||||
mwSelObj = om_selected_objects.front();
|
||||
@ -1186,7 +1176,7 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
p.drawLine( 1, y+item_h-3, cr.width()-3, y+item_h-3 );
|
||||
p.drawLine( 1, y+1, 1, y+item_h-3 );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
y += item_h;
|
||||
}
|
||||
@ -1217,7 +1207,7 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
if (rule==NULL) return;
|
||||
|
||||
QString platform=getPlatform();
|
||||
string act = rule->getActionAsString();
|
||||
string act = rule->getActionAsString();
|
||||
|
||||
QString icn = chooseIcon((":/Icons/" + act).c_str()); //for example :/Icons/Continue
|
||||
QString res="";
|
||||
@ -1243,7 +1233,7 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
string dir = rule->getDirectionAsString();
|
||||
if (dir.empty()) dir = "Both";
|
||||
QString icn = chooseIcon((":/Icons/" + dir).c_str());
|
||||
|
||||
|
||||
QPixmap pm;
|
||||
LoadPixmap(icn, pm);
|
||||
|
||||
@ -1310,11 +1300,11 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
break;
|
||||
} // switch
|
||||
}
|
||||
|
||||
|
||||
p.end();
|
||||
|
||||
|
||||
pntr->drawPixmap( cr.left() - horizontalOffset(), cr.top() - verticalOffset(), bufferpixmap );
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1370,24 +1360,24 @@ QSize RuleSetView::drawIconInRule(QPainter &p, int x, int y, RuleElement *re, FW
|
||||
|
||||
if (!st->getShowIconsInRules())
|
||||
return QSize();
|
||||
QPixmap pm;
|
||||
if (FWBSettings::SIZE16X16 == st->getIconsInRulesSize())
|
||||
QPixmap pm;
|
||||
if (FWBSettings::SIZE16X16 == st->getIconsInRulesSize())
|
||||
pm = getPixmap(o1, Tree);
|
||||
|
||||
if (FWBSettings::SIZE25X25 == st->getIconsInRulesSize())
|
||||
|
||||
if (FWBSettings::SIZE25X25 == st->getIconsInRulesSize())
|
||||
pm = getPixmap(o1, Normal);
|
||||
if (!re->isAny())
|
||||
p.drawPixmap( x, y + RuleElementSpacing/2, pm );
|
||||
|
||||
return pm.size();
|
||||
}
|
||||
|
||||
|
||||
QString RuleSetView::getPlatform()
|
||||
{
|
||||
return getFirewall()->getStr("platform").c_str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
libfwbuilder::PolicyRule* RuleSetView::getRule(int row)
|
||||
{
|
||||
return PolicyRule::cast( ruleIndex[row] );
|
||||
@ -1395,7 +1385,7 @@ libfwbuilder::PolicyRule* RuleSetView::getRule(int row)
|
||||
|
||||
void RuleSetView::selectRE( int row, int col)
|
||||
{
|
||||
mw->selectRules();
|
||||
m_project->selectRules();
|
||||
|
||||
if (row!=currentRow() || col!=currentColumn())
|
||||
{
|
||||
@ -1406,7 +1396,7 @@ void RuleSetView::selectRE( int row, int col)
|
||||
|
||||
void RuleSetView::selectRE(libfwbuilder::FWReference *ref)
|
||||
{
|
||||
mw->selectRules();
|
||||
m_project->selectRules();
|
||||
|
||||
setSelectedObject( ref->getPointer() );
|
||||
|
||||
@ -1446,8 +1436,8 @@ void RuleSetView::selectionChanged(const QItemSelection &, const QItemSelection
|
||||
//unselect();
|
||||
setCurrentIndex(QModelIndex());
|
||||
|
||||
mw->unselectRules();
|
||||
|
||||
m_project->unselectRules();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1457,7 +1447,7 @@ void RuleSetView::selectionChanged(const QItemSelection &, const QItemSelection
|
||||
lastSelectedRule=itemSelectionRange.bottom();
|
||||
|
||||
if (fwbdebug) qDebug("RuleSetView::selectionChanged New selection rows: %d - %d", firstSelectedRule, lastSelectedRule);
|
||||
|
||||
|
||||
if (lastSelectedRule < firstSelectedRule)
|
||||
{
|
||||
int i = lastSelectedRule;
|
||||
@ -1477,27 +1467,27 @@ void RuleSetView::selectionChanged(const QItemSelection &, const QItemSelection
|
||||
mw->m_mainWindow->pasteRuleAboveAction->setEnabled( selectionSize==1 );
|
||||
mw->m_mainWindow->pasteRuleBelowAction->setEnabled( selectionSize==1 );
|
||||
|
||||
mw->selectRules();
|
||||
m_project->selectRules();
|
||||
}
|
||||
|
||||
void RuleSetView::adjustColumn( int col )
|
||||
{
|
||||
QString lbl = ruleModel->headerData(col, Qt::Horizontal, Qt::DisplayRole).toString();
|
||||
|
||||
|
||||
QFontMetrics p(st->getRulesFont());//(this);
|
||||
QRect br=p.boundingRect(QRect(0, 0, 1000, 1000),
|
||||
Qt::AlignLeft|Qt::AlignVCenter,
|
||||
lbl );
|
||||
|
||||
int w = br.width() + 10;
|
||||
|
||||
|
||||
int row=0;
|
||||
for (FWObject::iterator i=ruleset->begin(); i!=ruleset->end(); i++,row++)
|
||||
{
|
||||
QRect cr = calculateCellSize(row,col);
|
||||
w=QMAX(w,cr.width());
|
||||
}
|
||||
|
||||
|
||||
horizontalHeader()->resizeSection(col, w);
|
||||
}
|
||||
|
||||
@ -1529,7 +1519,7 @@ void RuleSetView::adjustRow( int row )
|
||||
h = QMAX(h, cr.height());
|
||||
int w = cr.width();
|
||||
|
||||
if (columnWidth(col)<w)
|
||||
if (columnWidth(col)<w)
|
||||
horizontalHeader()->resizeSection(col, w);
|
||||
|
||||
}
|
||||
@ -1539,11 +1529,11 @@ void RuleSetView::adjustRow( int row )
|
||||
|
||||
Rule* RuleSetView::insertRule(int pos, FWObject *r)
|
||||
{
|
||||
if (r!=NULL &&
|
||||
ruleset->getTypeName()==Policy::TYPENAME &&
|
||||
if (r!=NULL &&
|
||||
ruleset->getTypeName()==Policy::TYPENAME &&
|
||||
r->getTypeName()!=PolicyRule::TYPENAME) return NULL;
|
||||
if (r!=NULL &&
|
||||
ruleset->getTypeName()==NAT::TYPENAME &&
|
||||
if (r!=NULL &&
|
||||
ruleset->getTypeName()==NAT::TYPENAME &&
|
||||
r->getTypeName()!=NATRule::TYPENAME ) return NULL;
|
||||
|
||||
if (pos<0) pos=0;
|
||||
@ -1601,7 +1591,7 @@ Rule* RuleSetView::insertRule(int pos, FWObject *r)
|
||||
setCurrentCell( pos, currentColumn() );
|
||||
updateCell(pos,currentColumn());
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: insertRule");
|
||||
if (fwbdebug) qDebug("Firewall changed: insertRule");
|
||||
|
||||
return newrule;
|
||||
}
|
||||
@ -1621,7 +1611,7 @@ void RuleSetView::insertRule()
|
||||
insertRule(0,NULL);
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
FWObject* RuleSetView::getSelectedObject()
|
||||
@ -1631,7 +1621,7 @@ FWObject* RuleSetView::getSelectedObject()
|
||||
|
||||
void RuleSetView::addRuleBranch(PolicyRule *rule)
|
||||
{
|
||||
if (fwbdebug) qDebug("RuleSetView::addRuleBranch");
|
||||
if (fwbdebug) qDebug("RuleSetView::addRuleBranch");
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
QString branchName = ropt->getStr("branch_name").c_str();
|
||||
@ -1674,7 +1664,7 @@ void RuleSetView::copyRuleContent(Rule *dst, Rule *src)
|
||||
{
|
||||
string dtype= (*j)->getTypeName();
|
||||
FWObject *selem= src->getFirstByType(dtype);
|
||||
if (selem!=NULL)
|
||||
if (selem!=NULL)
|
||||
(*j)->duplicate(selem);
|
||||
}
|
||||
|
||||
@ -1750,7 +1740,7 @@ void RuleSetView::mousePressEvent( QMouseEvent* ev )
|
||||
int row=rowAt(ev->y());
|
||||
int col=columnAt(ev->x());
|
||||
|
||||
FWObject *obj=getObj(row,col,ev->y()+verticalOffset());
|
||||
FWObject *obj=getObj(row,col,ev->y()+verticalOffset());
|
||||
bool needUpdate= (row==currentRow() && col==currentColumn() && selectedObject!=obj);
|
||||
|
||||
if (fwbdebug)
|
||||
@ -1780,18 +1770,18 @@ void RuleSetView::mousePressEvent( QMouseEvent* ev )
|
||||
|
||||
changeCurrentCell(row, col, true); //forget old selection by setting View's current cell
|
||||
setSelectedObject(obj);
|
||||
|
||||
|
||||
//verticalHeader()->update();
|
||||
}
|
||||
|
||||
void RuleSetView::mouseReleaseEvent( QMouseEvent* ev )
|
||||
{
|
||||
QTableView::mouseReleaseEvent(ev);
|
||||
|
||||
QTableView::mouseReleaseEvent(ev);
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::contentsMouseReleaseEvent");
|
||||
|
||||
if (oe->isVisible() && !switchObjectInEditor( columnAt(ev->x()) ))
|
||||
|
||||
if (mw->isEditorVisible() && !switchObjectInEditor( columnAt(ev->x()) ))
|
||||
{
|
||||
ev->accept();
|
||||
};
|
||||
@ -1820,9 +1810,9 @@ void RuleSetView::openObjectInTree(FWObject *obj)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::openObjectInTree happens");
|
||||
|
||||
|
||||
if (gui_experiment1) return;
|
||||
|
||||
|
||||
FWObject *oo = obj;
|
||||
if (obj==NULL || Rule::cast(obj)!=NULL)
|
||||
oo = getFirewall();
|
||||
@ -1831,9 +1821,9 @@ void RuleSetView::openObjectInTree(FWObject *obj)
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
//bool f = hasFocus();
|
||||
om->setFocus();
|
||||
om->openObject(oo);
|
||||
om->clearFocus();
|
||||
mw->setManipulatorFocus();
|
||||
mw->openObject(oo);
|
||||
mw->clearManipulatorFocus();
|
||||
setFocus();
|
||||
setUpdatesEnabled(true);
|
||||
update();
|
||||
@ -1844,7 +1834,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::contextMenu() at row=%d, col=%d", row, col);
|
||||
|
||||
if (fwbdebug)
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::contextMenu() selected rows: %d - %d", firstSelectedRule, lastSelectedRule);
|
||||
|
||||
if (col > 0)
|
||||
@ -1863,10 +1853,10 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
if (row<0 && ruleset->size()==0)
|
||||
{
|
||||
QMenu *popup=new QMenu(this);
|
||||
|
||||
|
||||
popup->addAction( tr("Insert Rule"), this, SLOT( insertRule() ));
|
||||
popup->addAction( tr("Paste Rule"), this, SLOT( pasteRuleAbove() ));
|
||||
|
||||
|
||||
popup->exec( pos );
|
||||
delete popup;
|
||||
return;
|
||||
@ -1880,7 +1870,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
|
||||
QMenu *popup=new QMenu(this);
|
||||
popup->addAction( tr("Paste Rule"), this, SLOT( pasteRuleBelow() ));
|
||||
|
||||
|
||||
popup->exec( pos );
|
||||
delete popup;
|
||||
return;
|
||||
@ -1888,7 +1878,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
|
||||
// QPoint rp = mapFromGlobal( pos);
|
||||
// QHeader *hh = horizontalHeader();
|
||||
// QHeader *vh = verticalHeader();
|
||||
// QHeader *vh = verticalHeader();
|
||||
// int nx = rp.x()-vh->width()-1;
|
||||
// int ny = rp.y()-hh->height()-1;
|
||||
// objectClicked(row,col,0,QPoint(nx,ny));
|
||||
@ -1902,91 +1892,91 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
case Action:
|
||||
{
|
||||
Firewall *f = getFirewall();
|
||||
string platform=f->getStr("platform");
|
||||
string platform=f->getStr("platform");
|
||||
QString action_name;
|
||||
|
||||
|
||||
if (Resources::isTargetActionSupported(platform,"Accept"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Accept,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Accept")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Accept")),
|
||||
action_name, this, SLOT( changeActionToAccept() ));
|
||||
}
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Deny"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Deny,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Deny")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Deny")),
|
||||
action_name, this, SLOT( changeActionToDeny() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Reject"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Reject,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Reject")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Reject")),
|
||||
action_name, this, SLOT( changeActionToReject() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Accounting"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Accounting,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Accounting")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Accounting")),
|
||||
action_name, this, SLOT( changeActionToAccounting() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Pipe"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Pipe,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Pipe")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Pipe")),
|
||||
action_name, this, SLOT( changeActionToPipe() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Tag"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Tag,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Tag")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Tag")),
|
||||
action_name, this, SLOT( changeActionToTag() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Classify"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Classify,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Classify")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Classify")),
|
||||
action_name, this, SLOT( changeActionToClassify() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Custom"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Custom,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Custom")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Custom")),
|
||||
action_name, this, SLOT( changeActionToCustom() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Branch"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Branch,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Branch")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Branch")),
|
||||
action_name, this, SLOT( changeActionToBranch() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Route"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Route,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Route")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Route")),
|
||||
action_name, this, SLOT( changeActionToRoute() ));
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Continue"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Continue,
|
||||
platform.c_str());
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Continue")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Continue")),
|
||||
action_name, this, SLOT( changeActionToContinue() ));
|
||||
}
|
||||
|
||||
|
||||
popup->addSeparator ();
|
||||
QAction *paramID;
|
||||
paramID = popup->addAction( tr("Parameters"), this, SLOT( editSelected() ));
|
||||
|
||||
|
||||
PolicyRule *rule = PolicyRule::cast( ruleIndex[row] );
|
||||
if (rule!=NULL)
|
||||
{
|
||||
@ -1999,26 +1989,26 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
}
|
||||
case Direction:
|
||||
{
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Inbound")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Inbound")),
|
||||
tr("Inbound"), this, SLOT( changeDirectionToIn() ));
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Outbound")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Outbound")),
|
||||
tr("Outbound"), this, SLOT( changeDirectionToOut() ));
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Both")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Both")),
|
||||
tr("Both"), this, SLOT( changeDirectionToBoth() ));
|
||||
|
||||
break;
|
||||
}
|
||||
case Options:
|
||||
{
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Options")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Options")),
|
||||
tr("Rule Options"), this, SLOT( editSelected() ));
|
||||
|
||||
if (fwbdebug) qDebug(ruleset->getTypeName().c_str());
|
||||
if (ruleset->getTypeName() == Policy::TYPENAME) {
|
||||
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Log")),
|
||||
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Log")),
|
||||
tr("Logging On"), this, SLOT( changeLogToOn() ));
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Blank")),
|
||||
popup->addAction( QIcon(LoadPixmap(":/Icons/Blank")),
|
||||
tr("Logging Off"), this, SLOT( changeLogToOff() ));
|
||||
}
|
||||
break;
|
||||
@ -2099,31 +2089,31 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
else
|
||||
popup->addAction( tr("Rule %1").
|
||||
arg(firstSelectedRule) )->setEnabled(false);
|
||||
|
||||
|
||||
QMenu *subcolor = popup->addMenu( tr("Change color") );
|
||||
|
||||
|
||||
QPixmap pcolor(16,16);
|
||||
pcolor.fill(QColor(255,255,255));
|
||||
subcolor->addAction( QIcon(pcolor), tr("No color"), this, SLOT ( setColorEmpty() ));
|
||||
|
||||
|
||||
pcolor.fill(st->getLabelColor(FWBSettings::RED));
|
||||
subcolor->addAction( QIcon(pcolor), tr("Red"), this, SLOT ( setColorRed() ));
|
||||
|
||||
|
||||
pcolor.fill(st->getLabelColor(FWBSettings::ORANGE));
|
||||
subcolor->addAction( QIcon(pcolor), tr("Orange"), this, SLOT ( setColorOrange() ));
|
||||
|
||||
|
||||
pcolor.fill(st->getLabelColor(FWBSettings::YELLOW));
|
||||
subcolor->addAction( QIcon(pcolor), tr("Yellow"), this, SLOT ( setColorYellow() ));
|
||||
|
||||
|
||||
pcolor.fill(st->getLabelColor(FWBSettings::GREEN));
|
||||
subcolor->addAction( QIcon(pcolor), tr("Green"), this, SLOT ( setColorGreen() ));
|
||||
|
||||
|
||||
pcolor.fill(st->getLabelColor(FWBSettings::BLUE));
|
||||
subcolor->addAction( QIcon(pcolor), tr("Blue"), this, SLOT ( setColorBlue() ));
|
||||
|
||||
|
||||
pcolor.fill(st->getLabelColor(FWBSettings::PURPLE));
|
||||
subcolor->addAction( QIcon(pcolor), tr("Purple"), this, SLOT ( setColorPurple() ));
|
||||
|
||||
|
||||
pcolor.fill(st->getLabelColor(FWBSettings::GRAY));
|
||||
subcolor->addAction( QIcon(pcolor), tr("Gray"), this, SLOT ( setColorGray() ));
|
||||
|
||||
@ -2184,10 +2174,10 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
|
||||
default:
|
||||
popup->addAction( tr("Edit") , this , SLOT( editRE() ) );
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
popup->exec( pos );
|
||||
|
||||
@ -2197,7 +2187,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
void RuleSetView::revealObjectInTree()
|
||||
{
|
||||
if ( selectedObject!=NULL)
|
||||
om->openObject(selectedObject);
|
||||
mw->openObject(selectedObject);
|
||||
}
|
||||
|
||||
void RuleSetView::findWhereUsedSlot()
|
||||
@ -2283,12 +2273,12 @@ void RuleSetView::changeAction(PolicyRule::Action act)
|
||||
|
||||
rule->setAction( act );
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
ruleopt->setBool("stateless", getStatelessFlagForAction(rule));
|
||||
|
||||
oe->actionChanged(rule);
|
||||
mw->actionChangedEditor(rule);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2296,7 +2286,7 @@ void RuleSetView::changeActionToAccept()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall action: changeActionToAccept");
|
||||
if (fwbdebug) qDebug("Firewall action: changeActionToAccept");
|
||||
changeAction( PolicyRule::Accept );
|
||||
}
|
||||
|
||||
@ -2304,7 +2294,7 @@ void RuleSetView::changeActionToDeny()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToDeny");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToDeny");
|
||||
changeAction( PolicyRule::Deny );
|
||||
}
|
||||
|
||||
@ -2312,7 +2302,7 @@ void RuleSetView::changeActionToReject()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToReject");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToReject");
|
||||
changeAction( PolicyRule::Reject );
|
||||
}
|
||||
|
||||
@ -2320,7 +2310,7 @@ void RuleSetView::changeActionToAccounting()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToAccounting");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToAccounting");
|
||||
changeAction( PolicyRule::Accounting );
|
||||
}
|
||||
|
||||
@ -2328,7 +2318,7 @@ void RuleSetView::changeActionToPipe()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToPipe");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToPipe");
|
||||
changeAction( PolicyRule::Pipe );
|
||||
}
|
||||
|
||||
@ -2336,7 +2326,7 @@ void RuleSetView::changeActionToTag()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToTag");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToTag");
|
||||
changeAction( PolicyRule::Tag );
|
||||
}
|
||||
|
||||
@ -2344,7 +2334,7 @@ void RuleSetView::changeActionToClassify()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToClassify");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToClassify");
|
||||
changeAction( PolicyRule::Classify );
|
||||
}
|
||||
|
||||
@ -2352,7 +2342,7 @@ void RuleSetView::changeActionToCustom()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToCustom");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToCustom");
|
||||
changeAction( PolicyRule::Custom );
|
||||
}
|
||||
|
||||
@ -2360,7 +2350,7 @@ void RuleSetView::changeActionToRoute()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToRoute");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToRoute");
|
||||
changeAction( PolicyRule::Route );
|
||||
}
|
||||
|
||||
@ -2368,7 +2358,7 @@ void RuleSetView::changeActionToContinue()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToContinue");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToContinue");
|
||||
changeAction( PolicyRule::Continue );
|
||||
}
|
||||
|
||||
@ -2378,7 +2368,7 @@ void RuleSetView::changeActionToBranch()
|
||||
|
||||
if ( currentRow()!=-1 && currentColumn()!=-1 )
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall action: changeActionToBranch");
|
||||
if (fwbdebug) qDebug("Firewall action: changeActionToBranch");
|
||||
changeAction( PolicyRule::Branch );
|
||||
|
||||
addRuleBranch( PolicyRule::cast( ruleIndex[currentRow()] ) );
|
||||
@ -2396,7 +2386,7 @@ void RuleSetView::changeDitection(PolicyRule::Direction dir)
|
||||
if (dir!=old_dir)
|
||||
{
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
rule->setDirection( dir );
|
||||
}
|
||||
}
|
||||
@ -2404,19 +2394,19 @@ void RuleSetView::changeDitection(PolicyRule::Direction dir)
|
||||
|
||||
void RuleSetView::changeDirectionToIn()
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToIn");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToIn");
|
||||
changeDitection( PolicyRule::Inbound );
|
||||
}
|
||||
|
||||
void RuleSetView::changeDirectionToOut()
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToOut");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToOut");
|
||||
changeDitection( PolicyRule::Outbound );
|
||||
}
|
||||
|
||||
void RuleSetView::changeDirectionToBoth()
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToBoth");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToBoth");
|
||||
changeDitection( PolicyRule::Both );
|
||||
}
|
||||
|
||||
@ -2427,9 +2417,9 @@ void RuleSetView::changeLogToOn()
|
||||
if ( currentRow()!=-1 && currentColumn()!=-1 )
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast( ruleIndex[currentRow()] );
|
||||
if (fwbdebug) qDebug("Firewall changed: changeLogToOn");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeLogToOn");
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
rule->setLogging( true );
|
||||
}
|
||||
}
|
||||
@ -2441,9 +2431,9 @@ void RuleSetView::changeLogToOff()
|
||||
if ( currentRow()!=-1 && currentColumn()!=-1 )
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast( ruleIndex[currentRow()] );
|
||||
if (fwbdebug) qDebug("Firewall changed: changeLogToOff");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeLogToOff");
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
rule->setLogging( false );
|
||||
}
|
||||
}
|
||||
@ -2489,22 +2479,22 @@ void RuleSetView::deleteObject(int row, int col, FWObject *obj)
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("RuleSetView::deleteObject row=%d col=%d id=%s",
|
||||
row,col,id.c_str());
|
||||
row,col,id.c_str());
|
||||
qDebug("obj = %p",re->getRoot()->findInIndex(id));
|
||||
int rc = obj->ref()-1; obj->unref();
|
||||
qDebug("obj->ref_counter=%d",rc);
|
||||
}
|
||||
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
|
||||
re->removeRef(obj);
|
||||
|
||||
if (re->isAny()) re->setNeg(false);
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("RuleSetView::deleteObject re->size()=%d",re->size());
|
||||
qDebug("RuleSetView::deleteObject re->size()=%d",re->size());
|
||||
qDebug("obj = %p",re->getRoot()->findInIndex(id));
|
||||
int rc = obj->ref()-1; obj->unref();
|
||||
qDebug("obj->ref_counter=%d",rc);
|
||||
@ -2513,7 +2503,7 @@ void RuleSetView::deleteObject(int row, int col, FWObject *obj)
|
||||
adjustColumn(col);
|
||||
adjustRow(row);
|
||||
updateCell(row,col);
|
||||
mw->findObjectWidget->reset();
|
||||
m_project->findObjectWidget->reset();
|
||||
}
|
||||
|
||||
bool RuleSetView::insertObject(int row, int col, FWObject *obj)
|
||||
@ -2536,19 +2526,19 @@ bool RuleSetView::insertObject(int row, int col, FWObject *obj)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::insertObject -- validation failed");
|
||||
|
||||
if (RuleElementRItf::cast(re))
|
||||
|
||||
|
||||
if (RuleElementRItf::cast(re))
|
||||
|
||||
QMessageBox::information( NULL , "Firewall Builder",
|
||||
"A single interface belonging to this firewall is expected in this field.",
|
||||
QString::null,QString::null);
|
||||
|
||||
|
||||
else if (RuleElementRGtw::cast(re))
|
||||
|
||||
|
||||
QMessageBox::information( NULL , "Firewall Builder",
|
||||
"A single ip adress is expected here. You may also insert a host or a network adapter leading to a single ip adress.",
|
||||
QString::null,QString::null);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2562,7 +2552,7 @@ bool RuleSetView::insertObject(int row, int col, FWObject *obj)
|
||||
/* avoid duplicates */
|
||||
string cp_id=obj->getId();
|
||||
list<FWObject*>::iterator j;
|
||||
for(j=re->begin(); j!=re->end(); ++j)
|
||||
for(j=re->begin(); j!=re->end(); ++j)
|
||||
{
|
||||
FWObject *o=*j;
|
||||
if(cp_id==o->getId()) return false;
|
||||
@ -2585,9 +2575,9 @@ bool RuleSetView::insertObject(int row, int col, FWObject *obj)
|
||||
adjustRow(row);
|
||||
updateCell(row, col);
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: insertObject");
|
||||
if (fwbdebug) qDebug("Firewall changed: insertObject");
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2599,7 +2589,7 @@ void RuleSetView::pasteObject()
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i)
|
||||
{
|
||||
FWObject *co= mw->db()->findInIndex(*i);
|
||||
FWObject *co= m_project->db()->findInIndex(*i);
|
||||
if (Rule::cast(co)!=NULL) pasteRuleAbove();
|
||||
else
|
||||
{
|
||||
@ -2623,10 +2613,10 @@ void RuleSetView::negateRE()
|
||||
{
|
||||
RuleElement *re = getRE(currentRow(),currentColumn());
|
||||
if (re==NULL) return;
|
||||
if (fwbdebug) qDebug("Firewall changed: negateRE");
|
||||
if (fwbdebug) qDebug("Firewall changed: negateRE");
|
||||
re->toggleNeg();
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
|
||||
updateCell(currentRow(),currentColumn());
|
||||
}
|
||||
@ -2644,10 +2634,10 @@ void RuleSetView::editRE()
|
||||
|
||||
void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
{
|
||||
mw->selectRules();
|
||||
m_project->selectRules();
|
||||
|
||||
RuleElement *re;
|
||||
|
||||
|
||||
int oldRow = currentRow();
|
||||
int oldColumn = currentColumn();
|
||||
|
||||
@ -2675,15 +2665,15 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
re = getRE(currentRow(),currentColumn() + shift);
|
||||
if (re==NULL)
|
||||
{
|
||||
if (oe->isVisible() && !switchObjectInEditor(currentColumn() + shift))
|
||||
if (m_project->isEditorVisible() && !switchObjectInEditor(currentColumn() + shift))
|
||||
{
|
||||
ev->accept();
|
||||
} else
|
||||
} else
|
||||
//QTableView::keyPressEvent(ev);
|
||||
changeCurrentCell(currentRow(), currentColumn()+shift);
|
||||
|
||||
|
||||
openObjectInTree(getFirewall());
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2710,16 +2700,16 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
|
||||
changeCurrentCell(currentRow(),currentColumn() + shift);
|
||||
|
||||
if (oe->isVisible() && !switchObjectInEditor(currentColumn()))
|
||||
if (m_project->isEditorVisible() && !switchObjectInEditor(currentColumn()))
|
||||
{
|
||||
ev->accept();
|
||||
} /*else
|
||||
} /*else
|
||||
QTableView::keyPressEvent(ev);*/
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev->key()==Qt::Key_Down || ev->key()==Qt::Key_Up ||
|
||||
ev->key()==Qt::Key_PageDown || ev->key()==Qt::Key_PageUp ||
|
||||
if (ev->key()==Qt::Key_Down || ev->key()==Qt::Key_Up ||
|
||||
ev->key()==Qt::Key_PageDown || ev->key()==Qt::Key_PageUp ||
|
||||
ev->key()==Qt::Key_End || ev->key()==Qt::Key_Home)
|
||||
{
|
||||
re = getRE(currentRow(),currentColumn());
|
||||
@ -2756,7 +2746,7 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
if ((newrow < 0) || (newrow >= ruleModel->rowCount()))
|
||||
return;
|
||||
|
||||
if (ev->key()==Qt::Key_PageDown || ev->key()==Qt::Key_PageUp ||
|
||||
if (ev->key()==Qt::Key_PageDown || ev->key()==Qt::Key_PageUp ||
|
||||
ev->key()==Qt::Key_End || ev->key()==Qt::Key_Home)
|
||||
{
|
||||
re = getRE(newrow,currentColumn());
|
||||
@ -2765,11 +2755,11 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
o1=re->front();
|
||||
if (FWReference::cast(o1)!=NULL) o1=FWReference::cast(o1)->getPointer();
|
||||
setSelectedObject(o1);
|
||||
if (oe->isVisible() && !switchObjectInEditor(currentColumn()))
|
||||
if (m_project->isEditorVisible() && !switchObjectInEditor(currentColumn()))
|
||||
{
|
||||
ev->accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
changeCurrentCell(newrow, currentColumn());
|
||||
return;
|
||||
@ -2790,10 +2780,10 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
/* going up and down in a column that does not contain objects (action/direction etc) */
|
||||
//QTableView::keyPressEvent(ev); // to make new row current
|
||||
changeCurrentCell(newrow, currentColumn());
|
||||
if (oe->isVisible() && !switchObjectInEditor(currentColumn()))
|
||||
if (m_project->isEditorVisible() && !switchObjectInEditor(currentColumn()))
|
||||
{
|
||||
ev->accept();
|
||||
}
|
||||
}
|
||||
openObjectInTree(getFirewall());
|
||||
return;
|
||||
}
|
||||
@ -2812,11 +2802,11 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
o1=re->back();
|
||||
if (FWReference::cast(o1)!=NULL) o1=FWReference::cast(o1)->getPointer();
|
||||
setSelectedObject(o1);
|
||||
if (oe->isVisible() && !switchObjectInEditor(currentColumn()))
|
||||
if (m_project->isEditorVisible() && !switchObjectInEditor(currentColumn()))
|
||||
{
|
||||
ev->accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
changeCurrentCell(newrow, currentColumn());
|
||||
//QTableView::keyPressEvent(ev);
|
||||
@ -2837,7 +2827,7 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
o1=re->front();
|
||||
if (FWReference::cast(o1)!=NULL) o1=FWReference::cast(o1)->getPointer();
|
||||
setSelectedObject(o1);
|
||||
if (oe->isVisible() && !switchObjectInEditor(currentColumn()))
|
||||
if (m_project->isEditorVisible() && !switchObjectInEditor(currentColumn()))
|
||||
{
|
||||
ev->accept();
|
||||
return;
|
||||
@ -2849,7 +2839,7 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
}
|
||||
/* switching to another object in the same cell */
|
||||
setSelectedObject((ev->key()==Qt::Key_Up) ? prev : o1);
|
||||
if (oe->isVisible() && !switchObjectInEditor(currentColumn()))
|
||||
if (m_project->isEditorVisible() && !switchObjectInEditor(currentColumn()))
|
||||
{
|
||||
ev->accept();
|
||||
return;
|
||||
@ -2865,10 +2855,10 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
{
|
||||
deleteSelectedObject();
|
||||
}
|
||||
|
||||
|
||||
updateCell(currentRow(),currentColumn());
|
||||
updateCell(oldRow,oldColumn);
|
||||
|
||||
|
||||
QTableView::keyPressEvent(ev);
|
||||
}
|
||||
|
||||
@ -2893,17 +2883,17 @@ QDrag* RuleSetView::dragObject()
|
||||
|
||||
void RuleSetView::dragEnterEvent( QDragEnterEvent *ev)
|
||||
{
|
||||
if (fwbdebug)
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::dragEnterEvent");
|
||||
ev->setAccepted( ev->mimeData()->hasFormat(FWObjectDrag::FWB_MIME_TYPE) );
|
||||
}
|
||||
|
||||
void RuleSetView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
{
|
||||
if (fwbdebug)
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::dragMoveEvent");
|
||||
QWidget *fromWidget = ev->source();
|
||||
|
||||
|
||||
// The source of DnD object must be the same instance of fwbuilder
|
||||
if (fromWidget)
|
||||
{
|
||||
@ -2913,7 +2903,7 @@ void RuleSetView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
ev->setDropAction(Qt::CopyAction);
|
||||
else
|
||||
ev->setDropAction(Qt::MoveAction);
|
||||
|
||||
|
||||
int row = rowAt( ev->pos().y() );
|
||||
int col = columnAt( ev->pos().x() );
|
||||
|
||||
@ -2968,14 +2958,14 @@ void RuleSetView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ev->setAccepted(false);
|
||||
}
|
||||
|
||||
|
||||
void RuleSetView::dropEvent( QDropEvent *ev)
|
||||
{
|
||||
if (fwbdebug)
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::dropEvent");
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
@ -2989,7 +2979,7 @@ void RuleSetView::dropEvent( QDropEvent *ev)
|
||||
/* without this check the user can drag and drop an object inside the
|
||||
* same rule element. This is bad because it is considered a change,
|
||||
* even though nothing really changes. With this check, we can not
|
||||
* drag and drop an object from the tree into a selected cell...
|
||||
* drag and drop an object from the tree into a selected cell...
|
||||
|
||||
if (row==currentRow() && col==currentColumn()) return;
|
||||
*/
|
||||
@ -3024,7 +3014,7 @@ void RuleSetView::dropEvent( QDropEvent *ev)
|
||||
}
|
||||
else //move
|
||||
{
|
||||
if (insertObject(row,col,dragobj) )
|
||||
if (insertObject(row,col,dragobj) )
|
||||
{
|
||||
deleteObject(oldRow,oldCol,dragobj);
|
||||
|
||||
@ -3046,18 +3036,19 @@ void RuleSetView::removeRule()
|
||||
*/
|
||||
changingRules = true;
|
||||
|
||||
mw->findObjectWidget->reset();
|
||||
|
||||
m_project->findObjectWidget->reset();
|
||||
|
||||
/* remove rules firstSelectedRule through lastSelectedRule */
|
||||
|
||||
if ( firstSelectedRule!=-1 )
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall changed: removeRule");
|
||||
if (fwbdebug) qDebug("Firewall changed: removeRule");
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
for (int rn=lastSelectedRule; rn>=firstSelectedRule; --rn)
|
||||
{
|
||||
if (oe->isVisible() && oe->getOpened()==ruleIndex[rn]) oe->close();
|
||||
if (m_project->isEditorVisible() && m_project->getOpenedEditor()==ruleIndex[rn])
|
||||
m_project->closeEditor();
|
||||
|
||||
bool delete_branch_tab = false;
|
||||
PolicyRule *r = PolicyRule::cast( ruleIndex[rn] );
|
||||
@ -3086,18 +3077,18 @@ void RuleSetView::removeRule()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ruleModel->removeRows( firstSelectedRule, lastSelectedRule );
|
||||
|
||||
|
||||
setUpdatesEnabled(true);
|
||||
|
||||
|
||||
clearSelection();
|
||||
|
||||
setCurrentCell( firstSelectedRule, currentColumn() );
|
||||
update();
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3109,7 +3100,7 @@ void RuleSetView::addRuleAfterCurrent()
|
||||
changingRules = true;
|
||||
insertRule(lastSelectedRule+1,NULL);
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
void RuleSetView::moveRule()
|
||||
@ -3122,12 +3113,12 @@ void RuleSetView::moveRule()
|
||||
int minRN=0;
|
||||
int maxRN=ruleset->size()-selectionSize;
|
||||
|
||||
Ui::askRuleNumberDialog_q d;
|
||||
Ui::askRuleNumberDialog_q d;
|
||||
QDialog ddialog;
|
||||
d.setupUi(&ddialog);
|
||||
d.newRuleNum->setMinimum(minRN);
|
||||
d.newRuleNum->setMaximum(maxRN);
|
||||
|
||||
|
||||
if (ddialog.exec()==QDialog::Accepted)
|
||||
{
|
||||
int newN = d.newRuleNum->value();
|
||||
@ -3164,7 +3155,7 @@ void RuleSetView::moveRule()
|
||||
}
|
||||
nn++;
|
||||
}
|
||||
} else
|
||||
} else
|
||||
{ // moving block of rules down
|
||||
for (int i=lastSelectedRule; i>=firstSelectedRule; i--)
|
||||
{
|
||||
@ -3179,7 +3170,7 @@ void RuleSetView::moveRule()
|
||||
|
||||
//swapping row sizes j+1 and j
|
||||
int t = verticalHeader()->sectionSize(j+1);
|
||||
verticalHeader()->resizeSection(j+1,
|
||||
verticalHeader()->resizeSection(j+1,
|
||||
verticalHeader()->sectionSize(j));
|
||||
verticalHeader()->resizeSection(j, t);
|
||||
|
||||
@ -3200,7 +3191,7 @@ void RuleSetView::moveRule()
|
||||
changeCurrentCell( newN, currentColumn(), true );
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3222,7 +3213,7 @@ void RuleSetView::moveRuleUp()
|
||||
|
||||
setCurrentCell( rn-1, currentColumn() );
|
||||
selectRE( rn-1 , currentColumn() );
|
||||
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
@ -3245,7 +3236,7 @@ void RuleSetView::moveRuleDown()
|
||||
|
||||
setCurrentCell( rn+1, currentColumn() );
|
||||
selectRE( rn+1 , currentColumn() );
|
||||
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
@ -3303,25 +3294,25 @@ void RuleSetView::pasteRuleAbove()
|
||||
|
||||
changingRules = true;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall: pasteRuleAbove");
|
||||
|
||||
if (fwbdebug) qDebug("Firewall: pasteRuleAbove");
|
||||
|
||||
/* pick rules in reverse order */
|
||||
vector<string>::reverse_iterator i;
|
||||
for (i= FWObjectClipboard::obj_clipboard->rbegin();
|
||||
i!=FWObjectClipboard::obj_clipboard->rend(); ++i)
|
||||
{
|
||||
FWObject *co= mw->db()->findInIndex(*i);
|
||||
FWObject *co= m_project->db()->findInIndex(*i);
|
||||
if (!Rule::cast(co)) continue;
|
||||
insertRule( firstSelectedRule, co);
|
||||
}
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RuleSetView::pasteRuleBelow()
|
||||
{
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
/*int firstSelectedRule=-1;
|
||||
@ -3341,7 +3332,7 @@ void RuleSetView::pasteRuleBelow()
|
||||
firstSelectedRule=currentRow();
|
||||
lastSelectedRule=currentRow();
|
||||
}*/
|
||||
|
||||
|
||||
int position;
|
||||
if (lastSelectedRule != -1)
|
||||
position = lastSelectedRule;
|
||||
@ -3353,13 +3344,13 @@ void RuleSetView::pasteRuleBelow()
|
||||
for (i= FWObjectClipboard::obj_clipboard->begin();
|
||||
i!=FWObjectClipboard::obj_clipboard->end(); ++i,++n)
|
||||
{
|
||||
FWObject *co= mw->db()->findInIndex(*i);
|
||||
FWObject *co= m_project->db()->findInIndex(*i);
|
||||
if (!Rule::cast(co)) continue;
|
||||
insertRule( position+1+n, co);
|
||||
}
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
|
||||
// if (FWObjectClipboard::obj_clipboard->getObject()!=NULL)
|
||||
// insertRule( rn+1, Rule::cast(FWObjectClipboard::obj_clipboard->getObject()) );
|
||||
@ -3374,14 +3365,14 @@ void RuleSetView::enableRule()
|
||||
for (int rn=lastSelectedRule; rn>=firstSelectedRule; --rn)
|
||||
{
|
||||
Rule *r = Rule::cast( ruleIndex[rn] );
|
||||
if (fwbdebug) qDebug("Firewall changed: enableRule");
|
||||
if (fwbdebug) qDebug("Firewall changed: enableRule");
|
||||
r->enable();
|
||||
setRuleNumber(rn,r);
|
||||
}
|
||||
}
|
||||
|
||||
//changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
void RuleSetView::disableRule()
|
||||
@ -3394,20 +3385,20 @@ void RuleSetView::disableRule()
|
||||
for (int rn=lastSelectedRule; rn>=firstSelectedRule; --rn)
|
||||
{
|
||||
Rule *r = Rule::cast( ruleIndex[rn] );
|
||||
if (fwbdebug) qDebug("Firewall changed: disableRule");
|
||||
if (fwbdebug) qDebug("Firewall changed: disableRule");
|
||||
r->disable();
|
||||
setRuleNumber(rn,r);
|
||||
}
|
||||
}
|
||||
|
||||
//changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
m_project->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
void RuleSetView::editSelected()
|
||||
{
|
||||
if (!oe->isVisible()) oe->show();
|
||||
switchObjectInEditor(currentColumn());
|
||||
if (!m_project->isEditorVisible()) m_project->showEditor();
|
||||
switchObjectInEditor(currentColumn());
|
||||
}
|
||||
|
||||
bool RuleSetView::switchObjectInEditor(int col,bool validate)
|
||||
@ -3415,24 +3406,24 @@ bool RuleSetView::switchObjectInEditor(int col,bool validate)
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::switchObjectInEditor col=%d validate=%d",col,validate);
|
||||
|
||||
|
||||
|
||||
if (!isTreeReadWrite(this,ruleset)) return false;
|
||||
if ( currentRow()==-1 || currentColumn()==-1 ) return false;
|
||||
|
||||
|
||||
FWObject *Object=NULL;
|
||||
ObjectEditor::OptType Operation=ObjectEditor::optNone;
|
||||
|
||||
/*
|
||||
* We need to know WHAT we are going to edit
|
||||
|
||||
|
||||
1. Object
|
||||
2. OptType
|
||||
|
||||
|
||||
* Object == null, OptType = optNone => blank
|
||||
* Object == Rule, OptType = optNone => Rule Options
|
||||
* Object == Rule, OptType != optNone => Virtual Object (Action, Comment ...)
|
||||
* Object != Rule, OptType = optNone => Regular Object Editor
|
||||
|
||||
|
||||
Then we compare our object 'obj' and OptType with what we already
|
||||
have in ObjectEditor/ If they are the same, then we do nothing,
|
||||
otherwise we open obj in the Object Editor
|
||||
@ -3482,13 +3473,13 @@ bool RuleSetView::switchObjectInEditor(int col,bool validate)
|
||||
}
|
||||
}
|
||||
|
||||
if (!mw->requestEditorOwnership(this,Object,Operation,validate))
|
||||
if (!m_project->requestEditorOwnership(this,Object,Operation,validate))
|
||||
return false;
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::switchObjectInEditor editor ownership granted");
|
||||
|
||||
if (Object==oe->getOpened() && Operation==oe->getOpenedOpt())
|
||||
if (Object==m_project->getOpenedEditor() && Operation==m_project->getOpenedOptEditor())
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::switchObjectInEditor same object is already opened in the editor");
|
||||
@ -3497,16 +3488,16 @@ bool RuleSetView::switchObjectInEditor(int col,bool validate)
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::switchObjectInEditor opening object in the editor");
|
||||
|
||||
|
||||
if (Object == NULL)
|
||||
{
|
||||
oe->blank();
|
||||
m_project->blankEditor();
|
||||
} else if (Operation==ObjectEditor::optNone)
|
||||
{
|
||||
oe->open(Object);
|
||||
m_project->openEditor(Object);
|
||||
} else if(Rule::cast(Object)!=NULL)
|
||||
{
|
||||
oe->openOpt(Object,Operation);
|
||||
m_project->openOptEditor(Object,Operation);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -3524,8 +3515,8 @@ void RuleSetView::restoreSelection(bool same_widget)
|
||||
prevSelectedObjectCol);
|
||||
else
|
||||
qDebug("RuleSetView::restoreSelection() prevSelectedObject==NULL");
|
||||
FWObject *o = oe->getOpened();
|
||||
qDebug("RuleSetView::restoreSelection() oe->getOpened=%s",
|
||||
FWObject *o = m_project->getOpenedEditor();
|
||||
qDebug("RuleSetView::restoreSelection() m_project->getOpenedEditor=%s",
|
||||
(o)?o->getName().c_str():"NULL");
|
||||
}
|
||||
|
||||
@ -3566,7 +3557,8 @@ void RuleSetView::updateCurrentCell()
|
||||
|
||||
|
||||
|
||||
PolicyView::PolicyView(Policy *p, QWidget *parent) : RuleSetView(1, 7, parent)
|
||||
PolicyView::PolicyView(ProjectPanel *project, Policy *p, QWidget *parent) :
|
||||
RuleSetView(project, 1, 7, parent)
|
||||
{
|
||||
setName("PolicyView");
|
||||
ruleset=p;
|
||||
@ -3577,7 +3569,7 @@ PolicyView::PolicyView(Policy *p, QWidget *parent) : RuleSetView(1, 7, parent)
|
||||
void PolicyView::init()
|
||||
{
|
||||
ncols=7 +
|
||||
((supports_time)?1:0) +
|
||||
((supports_time)?1:0) +
|
||||
((supports_logging && supports_rule_options)?1:0);
|
||||
|
||||
ruleModel->setColumnCount(ncols);
|
||||
@ -3586,7 +3578,7 @@ void PolicyView::init()
|
||||
|
||||
int col=0;
|
||||
QStringList qsl;
|
||||
|
||||
|
||||
qsl << "Source"; // 0
|
||||
colTypes[col++]=Object;
|
||||
|
||||
@ -3619,9 +3611,9 @@ void PolicyView::init()
|
||||
|
||||
qsl << "Comment";
|
||||
colTypes[col]=Comment;
|
||||
|
||||
|
||||
ruleModel->setHeader(qsl);
|
||||
|
||||
|
||||
/*horizontalHeader()->setModel(static_cast<QAbstractItemModel*>(horzHeaderLabels));
|
||||
verticalHeader()->setModel(static_cast<QAbstractItemModel*>(vertHeaderLabels));*/
|
||||
// setColumnStretchable(col, true);
|
||||
@ -3629,7 +3621,7 @@ void PolicyView::init()
|
||||
RuleSetView::init();
|
||||
}
|
||||
|
||||
RuleElement* PolicyView::getRE( int row, int col )
|
||||
RuleElement* PolicyView::getRE( int row, int col )
|
||||
{
|
||||
if (row<0) return NULL;
|
||||
|
||||
@ -3639,7 +3631,7 @@ RuleElement* PolicyView::getRE( int row, int col )
|
||||
return getRE(r, col);
|
||||
}
|
||||
|
||||
RuleElement* PolicyView::getRE( Rule* r, int col )
|
||||
RuleElement* PolicyView::getRE( Rule* r, int col )
|
||||
{
|
||||
string ret;
|
||||
|
||||
@ -3662,8 +3654,8 @@ RuleElement* PolicyView::getRE( Rule* r, int col )
|
||||
return RuleElement::cast( r->getFirstByType(ret) );
|
||||
}
|
||||
|
||||
InterfacePolicyView::InterfacePolicyView(InterfacePolicy *p, QWidget *parent) :
|
||||
RuleSetView(1,7,parent)
|
||||
InterfacePolicyView::InterfacePolicyView(ProjectPanel *project, InterfacePolicy *p, QWidget *parent) :
|
||||
RuleSetView(project, 1,7,parent)
|
||||
{
|
||||
setName("InterfacePolicyView");
|
||||
ruleset=p;
|
||||
@ -3674,7 +3666,7 @@ InterfacePolicyView::InterfacePolicyView(InterfacePolicy *p, QWidget *parent) :
|
||||
void InterfacePolicyView::init()
|
||||
{
|
||||
ncols=6 +
|
||||
((supports_time)?1:0) +
|
||||
((supports_time)?1:0) +
|
||||
((supports_logging && supports_rule_options)?1:0);
|
||||
|
||||
ruleModel->setColumnCount(ncols);
|
||||
@ -3712,7 +3704,7 @@ void InterfacePolicyView::init()
|
||||
|
||||
qsl << "Comment";
|
||||
colTypes[col]=Comment;
|
||||
|
||||
|
||||
ruleModel->setHeader(qsl);
|
||||
// setColumnStretchable(col, true);
|
||||
|
||||
@ -3721,7 +3713,7 @@ void InterfacePolicyView::init()
|
||||
RuleSetView::init();
|
||||
}
|
||||
|
||||
RuleElement* InterfacePolicyView::getRE( int row, int col )
|
||||
RuleElement* InterfacePolicyView::getRE( int row, int col )
|
||||
{
|
||||
if (row<0) return NULL;
|
||||
PolicyRule *r = PolicyRule::cast( ruleIndex[row] );
|
||||
@ -3729,7 +3721,7 @@ RuleElement* InterfacePolicyView::getRE( int row, int col )
|
||||
return getRE(r,col);
|
||||
}
|
||||
|
||||
RuleElement* InterfacePolicyView::getRE( Rule *r, int col )
|
||||
RuleElement* InterfacePolicyView::getRE( Rule *r, int col )
|
||||
{
|
||||
string ret;
|
||||
|
||||
@ -3754,7 +3746,8 @@ RuleElement* InterfacePolicyView::getRE( Rule *r, int col )
|
||||
|
||||
|
||||
|
||||
NATView::NATView(NAT *p, QWidget *parent) : RuleSetView(1,8,parent)
|
||||
NATView::NATView(ProjectPanel *project, NAT *p, QWidget *parent) :
|
||||
RuleSetView(project, 1,8,parent)
|
||||
{
|
||||
setName("NATView");
|
||||
ruleset=p;
|
||||
@ -3794,7 +3787,7 @@ void NATView::init()
|
||||
|
||||
qsl << "Comment";
|
||||
colTypes[col]=Comment;
|
||||
|
||||
|
||||
ruleModel->setHeader(qsl);
|
||||
// setColumnStretchable(col, true);
|
||||
|
||||
@ -3803,7 +3796,7 @@ void NATView::init()
|
||||
RuleSetView::init();
|
||||
}
|
||||
|
||||
RuleElement* NATView::getRE( int row, int col )
|
||||
RuleElement* NATView::getRE( int row, int col )
|
||||
{
|
||||
if (row<0) return NULL;
|
||||
NATRule *r = NATRule::cast( ruleIndex[row] );
|
||||
@ -3811,7 +3804,7 @@ RuleElement* NATView::getRE( int row, int col )
|
||||
return getRE(r,col);
|
||||
}
|
||||
|
||||
RuleElement* NATView::getRE( Rule *r, int col )
|
||||
RuleElement* NATView::getRE( Rule *r, int col )
|
||||
{
|
||||
string ret;
|
||||
|
||||
@ -3834,9 +3827,8 @@ RuleElement* NATView::getRE( Rule *r, int col )
|
||||
return RuleElement::cast( r->getFirstByType(ret) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
RoutingView::RoutingView(Routing *p, QWidget *parent) : RuleSetView(1,5,parent)
|
||||
RoutingView::RoutingView(ProjectPanel *project, Routing *p, QWidget *parent) :
|
||||
RuleSetView(project, 1,5,parent)
|
||||
{
|
||||
setName("RoutingView");
|
||||
ruleset=p;
|
||||
@ -3851,7 +3843,7 @@ void RoutingView::init()
|
||||
ruleModel->setColumnCount(ncols);
|
||||
|
||||
int col=0;
|
||||
|
||||
|
||||
QStringList qsl;
|
||||
qsl << "Destination";
|
||||
colTypes[col++]=Object;
|
||||
@ -3879,7 +3871,7 @@ void RoutingView::init()
|
||||
RuleSetView::init();
|
||||
}
|
||||
|
||||
RuleElement* RoutingView::getRE( int row, int col )
|
||||
RuleElement* RoutingView::getRE( int row, int col )
|
||||
{
|
||||
if (row<0) return NULL;
|
||||
RoutingRule *r = RoutingRule::cast( ruleIndex[row] );
|
||||
@ -3887,7 +3879,7 @@ RuleElement* RoutingView::getRE( int row, int col )
|
||||
return getRE(r,col);
|
||||
}
|
||||
|
||||
RuleElement* RoutingView::getRE( Rule *r, int col )
|
||||
RuleElement* RoutingView::getRE( Rule *r, int col )
|
||||
{
|
||||
string ret;
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ namespace libfwbuilder {
|
||||
};
|
||||
|
||||
class RuleSetView;
|
||||
|
||||
class ProjectPanel;
|
||||
/**
|
||||
* this class is used to intercept mouse clicks on the vertical header
|
||||
* of the table so we could open a context menu
|
||||
@ -366,7 +366,7 @@ class RuleSetView : public QTableView
|
||||
|
||||
public:
|
||||
|
||||
RuleSetView( int r, int c, QWidget *parent);
|
||||
RuleSetView(ProjectPanel *project, int r, int c, QWidget *parent);
|
||||
virtual ~RuleSetView();
|
||||
virtual void init();
|
||||
|
||||
@ -416,7 +416,7 @@ class RuleSetView : public QTableView
|
||||
REType getColType(int col) const;
|
||||
|
||||
private:
|
||||
|
||||
ProjectPanel *m_project;
|
||||
virtual libfwbuilder::RuleElement* getRE( int row, int col ) = 0;
|
||||
virtual libfwbuilder::RuleElement* getRE( libfwbuilder::Rule* r, int col ) = 0;
|
||||
|
||||
@ -441,7 +441,7 @@ class PolicyView : public RuleSetView
|
||||
|
||||
public:
|
||||
|
||||
PolicyView(libfwbuilder::Policy *p, QWidget *parent);
|
||||
PolicyView(ProjectPanel *project, libfwbuilder::Policy *p, QWidget *parent);
|
||||
virtual ~PolicyView() {}
|
||||
|
||||
virtual void init();
|
||||
@ -455,7 +455,7 @@ class InterfacePolicyView : public RuleSetView
|
||||
|
||||
public:
|
||||
|
||||
InterfacePolicyView(libfwbuilder::InterfacePolicy *p, QWidget *parent);
|
||||
InterfacePolicyView(ProjectPanel *project, libfwbuilder::InterfacePolicy *p, QWidget *parent);
|
||||
virtual ~InterfacePolicyView() {}
|
||||
|
||||
virtual void init();
|
||||
@ -470,7 +470,7 @@ class NATView : public RuleSetView
|
||||
|
||||
public:
|
||||
|
||||
NATView(libfwbuilder::NAT *p, QWidget *parent);
|
||||
NATView(ProjectPanel *project, libfwbuilder::NAT *p, QWidget *parent);
|
||||
virtual ~NATView() {}
|
||||
|
||||
virtual void init();
|
||||
@ -485,7 +485,7 @@ class RoutingView : public RuleSetView
|
||||
|
||||
public:
|
||||
|
||||
RoutingView(libfwbuilder::Routing *p, QWidget *parent);
|
||||
RoutingView(ProjectPanel *project, libfwbuilder::Routing *p, QWidget *parent);
|
||||
virtual ~RoutingView() {}
|
||||
|
||||
virtual void init();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -36,7 +38,7 @@
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -43,7 +45,7 @@
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -178,7 +180,7 @@ void SSHPIX::stateMachine()
|
||||
* user account is configured with "privilege 15"
|
||||
*/
|
||||
if ( cmpPrompt(stdoutBuffer,QRegExp(enable_prompt)) )
|
||||
{
|
||||
{
|
||||
state=WAITING_FOR_ENABLE;
|
||||
stateMachine();
|
||||
break;
|
||||
@ -248,7 +250,7 @@ void SSHPIX::stateMachine()
|
||||
break;
|
||||
}
|
||||
if ( cmpPrompt(stdoutBuffer,QRegExp(enable_prompt)) )
|
||||
{
|
||||
{
|
||||
emit printStdout_sign( tr("In enable mode."));
|
||||
emit printStdout_sign( "\n");
|
||||
state=ENABLE; // and go to ENABLE target in switch
|
||||
@ -327,7 +329,7 @@ void SSHPIX::stateMachine()
|
||||
|
||||
case EXECUTING_COMMAND:
|
||||
if ( cmpPrompt(stdoutBuffer,QRegExp(enable_prompt)) )
|
||||
{
|
||||
{
|
||||
//QApplication::eventLoop()->exitLoop();
|
||||
QCoreApplication::exit();
|
||||
state=COMMAND_DONE;
|
||||
@ -596,9 +598,9 @@ void SSHPIX::clearACLs()
|
||||
emit printStdout_sign( "\n");
|
||||
emit printStdout_sign(tr("*** Clearing unused access lists"));
|
||||
emit printStdout_sign( "\n");
|
||||
|
||||
|
||||
QString ca;
|
||||
|
||||
|
||||
while (currentAcls.size()!=0)
|
||||
{
|
||||
ca=currentAcls.front();
|
||||
@ -661,9 +663,9 @@ void SSHPIX::clearObjectGroups()
|
||||
emit printStdout_sign( "\n");
|
||||
emit printStdout_sign(tr("*** Clearing unused object groups"));
|
||||
emit printStdout_sign( "\n");
|
||||
|
||||
|
||||
QString ca;
|
||||
|
||||
|
||||
while (currentObjectGroups.size()!=0)
|
||||
{
|
||||
ca=currentObjectGroups.front();
|
||||
@ -734,7 +736,7 @@ void SSHPIX::PIXincrementalInstall()
|
||||
emit printStdout_sign( "\n");
|
||||
switch (errno)
|
||||
{
|
||||
case EAGAIN:
|
||||
case EAGAIN:
|
||||
case ENOMEM:
|
||||
emit printStdout_sign(tr("Not enough memory.") + "\n");
|
||||
break;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -113,7 +115,7 @@ QString SSHSession::findKeyFingerprint(QString &buffer)
|
||||
int n1,n2;
|
||||
|
||||
if ( (n1=buffer.indexOf(fp))==-1)
|
||||
{
|
||||
{
|
||||
fp = fingerprintPrompt2;
|
||||
if ( (n1=buffer.indexOf(fp))==-1)
|
||||
return QString("");
|
||||
@ -143,7 +145,7 @@ void SSHSession::startSession()
|
||||
this, SLOT(finished( int ) ) );
|
||||
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("latin1"));
|
||||
|
||||
|
||||
assert(args.size() > 0);
|
||||
|
||||
QStringList arguments;
|
||||
@ -186,7 +188,7 @@ void SSHSession::startSession()
|
||||
// emit printStdout_sign( tr("Running command %1\n").arg(cmd) );
|
||||
|
||||
proc->setEnvironment(env);
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("Launch external ssh client %s", program.toAscii().constData());
|
||||
@ -197,7 +199,7 @@ void SSHSession::startSession()
|
||||
}
|
||||
|
||||
proc->start(program, arguments);
|
||||
|
||||
|
||||
if ( !proc->waitForStarted() )
|
||||
{
|
||||
emit printStdout_sign( tr("Failed to start ssh") + "\n" );
|
||||
@ -272,7 +274,7 @@ void SSHSession::terminate()
|
||||
QString s=QString(proc->readAllStandardOutput());
|
||||
if (!quiet)
|
||||
{
|
||||
s.replace('\r',"");
|
||||
s.replace('\r',"");
|
||||
emit printStdout_sign(s);
|
||||
}
|
||||
proc->kill();
|
||||
@ -342,7 +344,7 @@ void SSHSession::sendLine()
|
||||
n++;
|
||||
}
|
||||
emit updateProgressBar_sign(input.size(),false);
|
||||
|
||||
|
||||
if (input.size()==0)
|
||||
{
|
||||
if (fwbdebug) qDebug("SSHUnx::sendLine - entire file sent, closeStdin=%d",
|
||||
@ -385,7 +387,7 @@ void SSHSession::heartBeat()
|
||||
if (fwbdebug) qDebug("SSHSession::heartBeat");
|
||||
readFromStderr();
|
||||
readFromStdout();
|
||||
if (endOfCopy && closeStdin)
|
||||
if (endOfCopy && closeStdin)
|
||||
{
|
||||
allDataSent();
|
||||
endOfCopy = false;
|
||||
@ -453,7 +455,7 @@ void SSHSession::readFromStdout()
|
||||
QString s = pendingLogLine + *i + "\n";
|
||||
if (!quiet)
|
||||
{
|
||||
s.replace('\r',"");
|
||||
s.replace('\r',"");
|
||||
emit printStdout_sign(s);
|
||||
}
|
||||
pendingLogLine = "";
|
||||
@ -517,7 +519,7 @@ void SSHSession::finished(int retcode)
|
||||
proc=NULL;
|
||||
|
||||
QString exitStatus = (retcode)?QObject::tr("ERROR"):QObject::tr("OK");
|
||||
|
||||
|
||||
emit printStdout_sign(tr("SSH session terminated, exit status: %1").arg(retcode) + "\n");
|
||||
sessionComplete( retcode!=0 );
|
||||
// if (retcode) error=true;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -135,7 +137,7 @@ void SSHUnx::stateMachine()
|
||||
stdoutBuffer.lastIndexOf(passphrase_prompt,-1)!=-1 ||
|
||||
|
||||
cmpPrompt(stdoutBuffer,sudo_pwd_prompt) ||
|
||||
cmpPrompt(stderrBuffer,sudo_pwd_prompt) )
|
||||
cmpPrompt(stderrBuffer,sudo_pwd_prompt) )
|
||||
{
|
||||
stdoutBuffer="";
|
||||
proc->write( pwd.toAscii() );
|
||||
@ -204,7 +206,7 @@ void SSHUnx::stateMachine()
|
||||
case PUSHING_CONFIG:
|
||||
push_files:
|
||||
if ( cmpPrompt(stdoutBuffer,sudo_pwd_prompt) ||
|
||||
cmpPrompt(stderrBuffer,sudo_pwd_prompt) )
|
||||
cmpPrompt(stderrBuffer,sudo_pwd_prompt) )
|
||||
{
|
||||
stdoutBuffer="";
|
||||
proc->write( pwd.toAscii() );
|
||||
@ -212,7 +214,7 @@ void SSHUnx::stateMachine()
|
||||
break;
|
||||
}
|
||||
/*
|
||||
if (!quiet && !verbose)
|
||||
if (!quiet && !verbose)
|
||||
{
|
||||
emit printStdout_sign( stdoutBuffer );
|
||||
}
|
||||
|
||||
@ -1,32 +1,34 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder Routing add-on
|
||||
|
||||
Copyright (C) 2004 Compal GmbH, Germany
|
||||
|
||||
Author: Tidei Maurizio <fwbuilder-routing at compal.de>
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -45,9 +47,9 @@ SimpleIntEditor::SimpleIntEditor(int minValue, int maxValue, int value, const QS
|
||||
{
|
||||
m_dialog = new Ui::SimpleIntEditor_q;
|
||||
m_dialog->setupUi(static_cast<QDialog*>(this));
|
||||
|
||||
|
||||
if (!title.isEmpty()) setWindowTitle(title);
|
||||
|
||||
|
||||
m_dialog->spin_box->setMinimum( minValue);
|
||||
m_dialog->spin_box->setMaximum( maxValue);
|
||||
m_dialog->spin_box->setValue( value);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -47,7 +49,7 @@ SimpleTextEditor::SimpleTextEditor(QWidget *parent,
|
||||
{
|
||||
m_dialog = new Ui::SimpleTextEditor_q;
|
||||
m_dialog->setupUi(static_cast<QDialog*>(this));
|
||||
|
||||
|
||||
if (enableLoadFromFile) m_dialog->inputFromFileButton->show();
|
||||
else m_dialog->inputFromFileButton->hide();
|
||||
|
||||
@ -70,7 +72,7 @@ QString SimpleTextEditor::text()
|
||||
void SimpleTextEditor::loadFromFile()
|
||||
{
|
||||
if ( QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Warning: loading from file discards current contents of the script."),
|
||||
"&Load", "&Cancel", QString::null, 0, 1 )==0)
|
||||
{
|
||||
@ -83,7 +85,7 @@ void SimpleTextEditor::loadFromFile()
|
||||
if (!ifile)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Could not open file %1").arg(filename),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "SimpleTextView.h"
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
@ -45,17 +47,17 @@
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
|
||||
|
||||
void SimpleTextView::setText(QString s)
|
||||
{
|
||||
m_dialog->textview->setText(s);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SimpleTextView::setName(QString s)
|
||||
{
|
||||
m_dialog->objectname->setText(s);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "../../config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -54,14 +56,14 @@ StartWizard::StartWizard()
|
||||
{
|
||||
m_dialog = new Ui::startWizard_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
m_dialog->nextButton,
|
||||
m_dialog->finishButton,
|
||||
m_dialog->backButton,
|
||||
m_dialog->cancelButton,
|
||||
m_dialog->titleLabel);
|
||||
|
||||
|
||||
/*connect( m_dialog->nextButton, SIGNAL( clicked() ),
|
||||
this, SLOT( nextClicked() ));
|
||||
connect( m_dialog->backButton, SIGNAL( clicked() ),
|
||||
@ -70,7 +72,7 @@ StartWizard::StartWizard()
|
||||
this, SLOT( finishClicked() ));
|
||||
connect( m_dialog->cancelButton, SIGNAL( clicked() ),
|
||||
this, SLOT( cancelClicked() ));*/
|
||||
|
||||
|
||||
wantRCS=false;
|
||||
oldfile=false;
|
||||
newfile=false;
|
||||
@ -124,7 +126,7 @@ void StartWizard::newFile()
|
||||
if (QFileInfo(fname).exists() && ! QFileInfo(fname).isWritable() )
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("File %1 is read-only, you can not save changes to it.")
|
||||
.arg(fname),
|
||||
"&Continue", QString::null, QString::null,
|
||||
@ -175,12 +177,12 @@ void StartWizard::finishClicked()
|
||||
catch (FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Error adding file to RCS:\n%1").arg(ex.toString().c_str()),
|
||||
"&Continue", QString::null,QString::null,
|
||||
0, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
rcs->co();
|
||||
@ -189,7 +191,7 @@ void StartWizard::finishClicked()
|
||||
catch (FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Error opening file:\n%1").arg(ex.toString().c_str()),
|
||||
"&Continue", QString::null,QString::null,
|
||||
0, 1 );
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,21 +17,23 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "TCPServiceDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "ProjectPanel.h"
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/TCPService.h"
|
||||
|
||||
@ -45,16 +47,17 @@
|
||||
#include <qlabel.h>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
TCPServiceDialog::TCPServiceDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
TCPServiceDialog::TCPServiceDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::TCPServiceDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
|
||||
obj=NULL;
|
||||
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
TCPServiceDialog::~TCPServiceDialog()
|
||||
@ -163,7 +166,7 @@ void TCPServiceDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void TCPServiceDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -243,18 +246,18 @@ void TCPServiceDialog::applyChanges()
|
||||
|
||||
obj->setBool("established", m_dialog->established->isChecked());
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void TCPServiceDialog::discardChanges()
|
||||
@ -283,7 +286,7 @@ void TCPServiceDialog::toggleEstablished()
|
||||
m_dialog->rst_m->setEnabled( !using_established );
|
||||
m_dialog->syn_m->setEnabled( !using_established );
|
||||
m_dialog->fin_m->setEnabled( !using_established );
|
||||
|
||||
|
||||
m_dialog->urg_s->setEnabled( !using_established );
|
||||
m_dialog->ack_s->setEnabled( !using_established );
|
||||
m_dialog->psh_s->setEnabled( !using_established );
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class ProjectPanel;
|
||||
|
||||
class TCPServiceDialog : public QWidget
|
||||
{
|
||||
@ -41,9 +42,10 @@ class TCPServiceDialog : public QWidget
|
||||
libfwbuilder::FWObject *obj;
|
||||
Ui::TCPServiceDialog_q *m_dialog;
|
||||
bool init;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
TCPServiceDialog(QWidget *parent);
|
||||
TCPServiceDialog(ProjectPanel *project, QWidget *parent);
|
||||
~TCPServiceDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,18 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "TagServiceDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ProjectPanel.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/TagService.h"
|
||||
@ -58,12 +61,12 @@ TagServiceDialog::~TagServiceDialog()
|
||||
delete m_dialog;
|
||||
}
|
||||
|
||||
TagServiceDialog::TagServiceDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
TagServiceDialog::TagServiceDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::TagServiceDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
obj=NULL;
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
void TagServiceDialog::loadFWObject(FWObject *o)
|
||||
@ -71,8 +74,8 @@ void TagServiceDialog::loadFWObject(FWObject *o)
|
||||
obj=o;
|
||||
TagService *s = dynamic_cast<TagService*>(obj);
|
||||
assert(s!=NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
init=true;
|
||||
|
||||
fillLibraries(m_dialog->libs,obj);
|
||||
@ -81,7 +84,7 @@ void TagServiceDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->comment->setText( QString::fromUtf8(s->getComment().c_str()) );
|
||||
|
||||
m_dialog->tagcode->setText( s->getCode().c_str() );
|
||||
|
||||
|
||||
//apply->setEnabled( false );
|
||||
|
||||
m_dialog->obj_name->setEnabled(!o->isReadOnly());
|
||||
@ -100,7 +103,7 @@ void TagServiceDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void TagServiceDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -138,19 +141,19 @@ void TagServiceDialog::applyChanges()
|
||||
|
||||
s->setCode( m_dialog->tagcode->text().toLatin1().constData() );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if ( ! Interface::isA( obj->getParent() ) &&
|
||||
m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void TagServiceDialog::discardChanges()
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class ProjectPanel;
|
||||
|
||||
class TagServiceDialog : public QWidget
|
||||
{
|
||||
@ -41,10 +42,11 @@ class TagServiceDialog : public QWidget
|
||||
libfwbuilder::FWObject *obj;
|
||||
Ui::TagServiceDialog_q *m_dialog;
|
||||
bool init;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
~TagServiceDialog();
|
||||
TagServiceDialog(QWidget *parent);
|
||||
TagServiceDialog(ProjectPanel *project, QWidget *parent);
|
||||
virtual void closeEvent(QCloseEvent *e);
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,24 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "TimeDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/Interval.h"
|
||||
@ -50,12 +54,12 @@
|
||||
using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
|
||||
TimeDialog::TimeDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
TimeDialog::TimeDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::TimeDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
|
||||
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
@ -113,7 +117,7 @@ void TimeDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->startDate->setDate( (using_start_date)?QDate( y, m, d ):QDate() );
|
||||
m_dialog->useStartDate->setChecked(using_start_date);
|
||||
|
||||
// from_weekday is -1 for "All days"
|
||||
// from_weekday is -1 for "All days"
|
||||
m_dialog->startDOW->setCurrentIndex( obj->getInt("from_weekday") + 1 );
|
||||
|
||||
int toH = obj->getInt("to_hour");
|
||||
@ -129,7 +133,7 @@ void TimeDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->endDate->setDate( (using_end_date)?QDate( y, m, d ):QDate() );
|
||||
m_dialog->useEndDate->setChecked(using_end_date);
|
||||
|
||||
// to_weekday is -1 for "All days"
|
||||
// to_weekday is -1 for "All days"
|
||||
m_dialog->endDOW->setCurrentIndex( obj->getInt("to_weekday") + 1 );
|
||||
|
||||
|
||||
@ -169,7 +173,7 @@ void TimeDialog::enableAllWidgets()
|
||||
m_dialog->endDate->setEnabled(!obj->isReadOnly() && m_dialog->useEndDate->isChecked());
|
||||
m_dialog->endDOW->setEnabled(!obj->isReadOnly() && !m_dialog->useEndDate->isChecked());
|
||||
}
|
||||
|
||||
|
||||
void TimeDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -204,7 +208,7 @@ void TimeDialog::applyChanges()
|
||||
string oldname=obj->getName();
|
||||
obj->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );
|
||||
obj->setComment( string(m_dialog->comment->toPlainText().toUtf8().constData()) );
|
||||
|
||||
|
||||
if (m_dialog->useStartDate->isChecked())
|
||||
{
|
||||
obj->setInt( "from_day" , m_dialog->startDate->date().day() );
|
||||
@ -236,18 +240,18 @@ void TimeDialog::applyChanges()
|
||||
obj->setInt( "to_hour" , m_dialog->endTime->time().hour() );
|
||||
obj->setInt( "to_weekday" , m_dialog->endDOW->currentIndex() - 1 );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void TimeDialog::discardChanges()
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class ProjectPanel;
|
||||
|
||||
class TimeDialog : public QWidget
|
||||
{
|
||||
@ -44,8 +45,9 @@ class TimeDialog : public QWidget
|
||||
|
||||
void enableAllWidgets();
|
||||
|
||||
ProjectPanel *m_project;
|
||||
public:
|
||||
TimeDialog(QWidget *parent);
|
||||
TimeDialog(ProjectPanel *project, QWidget *parent);
|
||||
~TimeDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,22 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "FWBTree.h"
|
||||
#include "UDPServiceDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "ProjectPanel.h"
|
||||
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/UDPService.h"
|
||||
@ -44,16 +46,17 @@
|
||||
#include <qmessagebox.h>
|
||||
#include "FWBSettings.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
UDPServiceDialog::UDPServiceDialog(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
UDPServiceDialog::UDPServiceDialog(ProjectPanel *project, QWidget *parent) : QWidget(parent), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::UDPServiceDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
setFont(st->getUiFont());
|
||||
|
||||
obj=NULL;
|
||||
|
||||
obj=NULL;
|
||||
}
|
||||
|
||||
UDPServiceDialog::~UDPServiceDialog()
|
||||
@ -105,7 +108,7 @@ void UDPServiceDialog::loadFWObject(FWObject *o)
|
||||
|
||||
init=false;
|
||||
}
|
||||
|
||||
|
||||
void UDPServiceDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
@ -169,18 +172,18 @@ void UDPServiceDialog::applyChanges()
|
||||
obj->setInt("dst_range_start", m_dialog->ds->value() );
|
||||
obj->setInt("dst_range_end", m_dialog->de->value() );
|
||||
|
||||
om->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
init=true;
|
||||
|
||||
/* move to another lib if we have to */
|
||||
if (! FWBTree::isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
om->moveObject(m_dialog->libs->currentText(), obj);
|
||||
if (! m_project->isSystem(obj) && m_dialog->libs->currentText() != QString(obj->getLibrary()->getName().c_str()))
|
||||
mw->moveObject(m_dialog->libs->currentText(), obj);
|
||||
|
||||
init=false;
|
||||
|
||||
//apply->setEnabled( false );
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
}
|
||||
|
||||
void UDPServiceDialog::discardChanges()
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
|
||||
class ProjectPanel;
|
||||
class UDPServiceDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -41,9 +42,10 @@ class UDPServiceDialog : public QWidget
|
||||
libfwbuilder::FWObject *obj;
|
||||
bool init;
|
||||
Ui::UDPServiceDialog_q *m_dialog;
|
||||
ProjectPanel *m_project;
|
||||
|
||||
public:
|
||||
UDPServiceDialog(QWidget *parent);
|
||||
UDPServiceDialog(ProjectPanel *project, QWidget *parent);
|
||||
~UDPServiceDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -47,8 +49,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
debugDialog::debugDialog(QWidget *parent) : QDialog(parent)
|
||||
|
||||
debugDialog::debugDialog(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
m_dialog = new Ui::debugDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
@ -118,7 +120,7 @@ debugDialog::debugDialog(QWidget *parent) : QDialog(parent)
|
||||
m_dialog->debugText->append( "\n" );
|
||||
|
||||
m_dialog->debugText->append( QString("FWObjectDatabase index statistics:"));
|
||||
|
||||
|
||||
int s,h,m;
|
||||
mw->db()->getIndexStats(s,h,m);
|
||||
m_dialog->debugText->append( QString(" index size: %1 records").arg(s) );
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -59,7 +61,7 @@ execDialog::execDialog(QWidget *parent,const QStringList &args, const QString &c
|
||||
{
|
||||
m_dialog = new Ui::execDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
m_dialog->output->setWordWrapMode( QTextOption::NoWrap );
|
||||
res=-1;
|
||||
|
||||
@ -104,20 +106,20 @@ int execDialog::run()
|
||||
m_dialog->output->append("\n");
|
||||
|
||||
QStringList args = arguments;
|
||||
|
||||
|
||||
assert(!args.empty());
|
||||
QString command = args[0];
|
||||
args.pop_front();
|
||||
|
||||
|
||||
proc.start(command, args);
|
||||
|
||||
|
||||
if ( !proc.waitForStarted() )
|
||||
{
|
||||
m_dialog->output->append( tr("Error: Failed to start program") );
|
||||
return exec();
|
||||
}
|
||||
m_dialog->saveLogButton->hide();
|
||||
m_dialog->stopButton->show();
|
||||
m_dialog->stopButton->show();
|
||||
m_dialog->stopButton->setFocus();
|
||||
m_dialog->buttonOk->setEnabled( false );
|
||||
exec();
|
||||
@ -129,14 +131,14 @@ void execDialog::saveLog()
|
||||
dir=st->getWDir();
|
||||
if (dir.isEmpty()) dir=st->getOpenFileDir();
|
||||
if (dir.isEmpty()) dir="~";
|
||||
|
||||
|
||||
QString s = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
"Choose a file",
|
||||
dir,
|
||||
"Text file (*.txt)");
|
||||
|
||||
|
||||
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
if (!s.endsWith(".txt"))
|
||||
@ -149,5 +151,5 @@ void execDialog::saveLog()
|
||||
QTextStream (&f) << m_dialog->output->toPlainText();
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "fakeWizard.h"
|
||||
|
||||
FakeWizard::FakeWizard()
|
||||
@ -9,7 +11,7 @@ FakeWizard::~FakeWizard()
|
||||
}
|
||||
|
||||
void FakeWizard::setControlWidgets(QWidget *_mainWidget,
|
||||
QStackedWidget *_stackedWidget,
|
||||
QStackedWidget *_stackedWidget,
|
||||
QPushButton *_nextButton,
|
||||
QPushButton *_finishButton,
|
||||
QPushButton *_backButton,
|
||||
@ -25,7 +27,7 @@ void FakeWizard::setControlWidgets(QWidget *_mainWidget,
|
||||
cancelButton = _cancelButton;
|
||||
|
||||
m_pageCount = stackedWidget->count();
|
||||
|
||||
|
||||
QObject::connect( nextButton, SIGNAL( clicked() ),
|
||||
mainWidget, SLOT( nextClicked() ));
|
||||
QObject::connect( backButton, SIGNAL( clicked() ),
|
||||
@ -103,7 +105,7 @@ int FakeWizard::previousRelevant(const int page) const
|
||||
for (int i = page-1; i >= 0; i--)
|
||||
if (appropriates[i] && appropriate(i))
|
||||
return i;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -112,24 +114,24 @@ int FakeWizard::nextRelevant(const int page) const
|
||||
for (int i = page+1; i < m_pageCount; i++)
|
||||
if (appropriates[i] && appropriate(i))
|
||||
return i;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void FakeWizard::showPage(const int page)
|
||||
{
|
||||
if (page >= m_pageCount) return;
|
||||
|
||||
|
||||
if (finishEnabled[page])
|
||||
finishButton->show();
|
||||
else
|
||||
finishButton->hide();
|
||||
|
||||
|
||||
nextButton->setEnabled( nextEnabled[page] &&
|
||||
(nextRelevant(page) > -1) );
|
||||
backButton->setEnabled( backEnabled[page] &&
|
||||
(previousRelevant(page) > -1) );
|
||||
|
||||
|
||||
if (titleLabel)
|
||||
if (!pageTitles[page].isEmpty())
|
||||
{
|
||||
@ -140,7 +142,7 @@ void FakeWizard::showPage(const int page)
|
||||
titleLabel->hide();
|
||||
|
||||
setCurrentPage(page);
|
||||
|
||||
|
||||
stackedWidget->setCurrentIndex(page);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -58,21 +60,21 @@ filePropDialog::~filePropDialog()
|
||||
}
|
||||
|
||||
filePropDialog::filePropDialog(QWidget *parent, RCS *rcs) :
|
||||
QDialog(parent)
|
||||
QDialog(parent)
|
||||
{
|
||||
m_dialog = new Ui::filePropDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
// we have to get a reference to the printer
|
||||
// or we can create a new one ...
|
||||
|
||||
|
||||
m_dialog->fileLocation->setText( rcs->getFileName() );
|
||||
if (rcs->isRO()) m_dialog->fileRO->setText( tr("Opened read-only") );
|
||||
else m_dialog->fileRO->setText("");
|
||||
|
||||
time_t lm = mw->db()->getTimeLastModified();
|
||||
QString s = ctime( &lm );
|
||||
s.truncate( s.length()-1 ); // chop newline
|
||||
s.truncate( s.length()-1 ); // chop newline
|
||||
|
||||
m_dialog->lastModified->setText( QString("%1 (%2)").arg(s).arg(lm) );
|
||||
|
||||
@ -96,23 +98,23 @@ filePropDialog::filePropDialog(QWidget *parent, RCS *rcs) :
|
||||
m_dialog->fileLockedBy->setText("");
|
||||
m_dialog->fileRevHistory->setText("");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void filePropDialog::setPrinter(QPrinter *p)
|
||||
{
|
||||
printer=p;
|
||||
}
|
||||
|
||||
|
||||
void filePropDialog::printRevHistory()
|
||||
{
|
||||
// Revision history printing:
|
||||
//
|
||||
// 1. setup printer properties
|
||||
// 2. create a stream
|
||||
// 3. split text from the QTextBrowser (fileRevHistory) into the lines
|
||||
// 3. split text from the QTextBrowser (fileRevHistory) into the lines
|
||||
// 4. send lines to the stream
|
||||
//
|
||||
|
||||
|
||||
//int pageWidth = 0;
|
||||
//int pageHeight = 0;
|
||||
bool fullPage = false;
|
||||
@ -129,9 +131,9 @@ void filePropDialog::printRevHistory()
|
||||
//bool printObjects = true;
|
||||
//bool newPageForSection = false;
|
||||
//int tableResolution = 2; // 50%, 75%, 100%, 150%, 200%, default 100%
|
||||
|
||||
|
||||
QPrintDialog printDialog(printer, this);
|
||||
|
||||
|
||||
#if (QT_VERSION > 0x030200)
|
||||
printDialog.addEnabledOption(QAbstractPrintDialog::PrintPageRange);
|
||||
printDialog.setPrintRange(QAbstractPrintDialog::AllPages);
|
||||
@ -140,17 +142,17 @@ void filePropDialog::printRevHistory()
|
||||
|
||||
printer->setResolution(resolution);
|
||||
printer->setFullPage(fullPage);
|
||||
|
||||
if (printDialog.exec() == QDialog::Accepted)
|
||||
|
||||
if (printDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
int fromPage = printer->fromPage();
|
||||
int toPage = printer->toPage();
|
||||
if (fromPage==0) fromPage=1;
|
||||
if (toPage==0) toPage=9999;
|
||||
|
||||
|
||||
PrintingProgressDialog *ppd = new PrintingProgressDialog(this,printer,0,false);
|
||||
QString headerText = "Revision History:";
|
||||
|
||||
|
||||
#if defined(Q_OS_MACX)
|
||||
printerStream pr(printer,margin,printHeader,headerText,NULL);
|
||||
#else
|
||||
@ -171,7 +173,7 @@ void filePropDialog::printRevHistory()
|
||||
QStringList sl;
|
||||
sl=m_dialog->fileRevHistory->toPlainText().split('\n');
|
||||
|
||||
for ( QStringList::Iterator it = sl.begin(); it != sl.end(); ++it )
|
||||
for ( QStringList::Iterator it = sl.begin(); it != sl.end(); ++it )
|
||||
{
|
||||
pr.printText(*it);
|
||||
}
|
||||
@ -181,6 +183,6 @@ void filePropDialog::printRevHistory()
|
||||
|
||||
pr.end();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,20 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "findDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
#include "ProjectPanel.h"
|
||||
#include "FWBTree.h"
|
||||
#include "FWBSettings.h"
|
||||
|
||||
@ -61,14 +62,14 @@ using namespace std;
|
||||
|
||||
#define MAX_SEARCH_ITEMS_COUNT 10
|
||||
|
||||
findDialog::findDialog(QWidget *p) : QDialog(p), treeSeeker()
|
||||
findDialog::findDialog(QWidget *p, ProjectPanel *project) : QDialog(p), treeSeeker(), m_project(project)
|
||||
{
|
||||
m_dialog = new Ui::findDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
lastFound=NULL;
|
||||
lastTextSearch="";
|
||||
lastAttrSearch="";
|
||||
lastTextSearch="";
|
||||
lastAttrSearch="";
|
||||
|
||||
m_dialog->findText->setFocus();
|
||||
}
|
||||
@ -83,7 +84,7 @@ void findDialog::reset()
|
||||
{
|
||||
lastFound=NULL;
|
||||
lastTextSearch="";
|
||||
treeSeeker=mw->db()->tree_begin();
|
||||
treeSeeker=m_project->db()->tree_begin();
|
||||
}
|
||||
|
||||
void findDialog::findTextChanged(const QString &ns)
|
||||
@ -167,7 +168,7 @@ bool findDialog::matchAttr(libfwbuilder::FWObject *obj)
|
||||
case 1: // port
|
||||
if (TCPService::cast(obj)!=NULL || UDPService::cast(obj)!=NULL)
|
||||
{
|
||||
if (m_dialog->useRegexp->isChecked())
|
||||
if (m_dialog->useRegexp->isChecked())
|
||||
{
|
||||
QString port;
|
||||
port.setNum(obj->getInt("src_range_start"));
|
||||
@ -191,7 +192,7 @@ bool findDialog::matchAttr(libfwbuilder::FWObject *obj)
|
||||
case 2: // protocol num.
|
||||
if (IPService::cast(obj)!=NULL)
|
||||
{
|
||||
if (m_dialog->useRegexp->isChecked())
|
||||
if (m_dialog->useRegexp->isChecked())
|
||||
{
|
||||
QString proto;
|
||||
proto.setNum(obj->getInt("protocol_num"));
|
||||
@ -206,7 +207,7 @@ bool findDialog::matchAttr(libfwbuilder::FWObject *obj)
|
||||
case 3: // icmp type
|
||||
if (ICMPService::cast(obj)!=NULL)
|
||||
{
|
||||
if (m_dialog->useRegexp->isChecked())
|
||||
if (m_dialog->useRegexp->isChecked())
|
||||
{
|
||||
QString icmptype;
|
||||
icmptype.setNum(obj->getInt("type"));
|
||||
@ -236,7 +237,7 @@ void findDialog::findNext()
|
||||
loop:
|
||||
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );
|
||||
|
||||
for (; treeSeeker!=mw->db()->tree_end(); ++treeSeeker)
|
||||
for (; treeSeeker!=m_project->db()->tree_end(); ++treeSeeker)
|
||||
{
|
||||
o = *treeSeeker;
|
||||
|
||||
@ -263,12 +264,12 @@ loop:
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
if (treeSeeker==mw->db()->tree_end())
|
||||
if (treeSeeker==m_project->db()->tree_end())
|
||||
{
|
||||
reset();
|
||||
|
||||
if ( QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Search hit the end of the object tree."),
|
||||
tr("&Continue at top"), tr("&Stop"), QString::null, 0, 1 )==0 ) goto loop;
|
||||
|
||||
@ -279,21 +280,21 @@ loop:
|
||||
/* found object. Shift iterator so it does not return the same object
|
||||
* when user hits 'find next'
|
||||
*/
|
||||
|
||||
|
||||
++treeSeeker;
|
||||
|
||||
if (FWReference::cast(o)!=NULL && RuleElement::cast(o->getParent())!=NULL)
|
||||
{
|
||||
mw->ensureObjectVisibleInRules( FWReference::cast(o) );
|
||||
m_project->ensureObjectVisibleInRules( FWReference::cast(o) );
|
||||
QTimer::singleShot(200, this, SLOT(makeActive()) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Group::cast(o->getParent())!=NULL &&
|
||||
!FWBTree::isSystem(o->getParent()))
|
||||
if (Group::cast(o->getParent())!=NULL &&
|
||||
!m_project->isSystem(o->getParent()))
|
||||
{
|
||||
om->openObject( o->getParent() );
|
||||
om->editObject( o->getParent() );
|
||||
m_project->openObject( o->getParent() );
|
||||
m_project->editObject( o->getParent() );
|
||||
QTimer::singleShot(200, this, SLOT(makeActive()) );
|
||||
return;
|
||||
}
|
||||
@ -304,8 +305,8 @@ loop:
|
||||
o, o->getId().c_str(),o->getName().c_str(),o->getTypeName().c_str());
|
||||
}
|
||||
|
||||
om->openObject( o );
|
||||
om->editObject( o );
|
||||
m_project->openObject( o );
|
||||
m_project->editObject( o );
|
||||
|
||||
QTimer::singleShot(200, this, SLOT(makeActive()) );
|
||||
}
|
||||
@ -319,7 +320,7 @@ void findDialog::showEvent( QShowEvent *ev)
|
||||
{
|
||||
st->restoreGeometry(this, QRect(200,100,330,140) );
|
||||
QDialog::showEvent(ev);
|
||||
|
||||
|
||||
m_dialog->useRegexp->setChecked( st->getBool("Search/useRegexp") );
|
||||
m_dialog->searchInTree->setChecked( st->getBool("Search/findInTree" ) );
|
||||
m_dialog->searchInRules->setChecked( st->getBool("Search/findInRules") );
|
||||
@ -336,4 +337,4 @@ void findDialog::hideEvent( QHideEvent *ev)
|
||||
st->setBool("Search/findInTree", m_dialog->searchInTree->isChecked() );
|
||||
st->setBool("Search/findInRules", m_dialog->searchInRules->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
#include <ui_finddialog_q.h>
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
|
||||
class ProjectPanel;
|
||||
|
||||
class findDialog : public QDialog
|
||||
{
|
||||
@ -44,10 +44,10 @@ class findDialog : public QDialog
|
||||
|
||||
bool matchName(const QString &name);
|
||||
bool matchAttr(libfwbuilder::FWObject* obj);
|
||||
|
||||
ProjectPanel *m_project;
|
||||
public:
|
||||
Ui::findDialog_q *m_dialog;
|
||||
findDialog(QWidget *p);
|
||||
findDialog(QWidget *p, ProjectPanel *project);
|
||||
|
||||
void setObject(libfwbuilder::FWObject *o);
|
||||
~findDialog() { delete m_dialog; };
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,18 +17,19 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "freebsdAdvancedDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -40,6 +41,7 @@
|
||||
#include <qlineedit.h>
|
||||
#include <qregexp.h>
|
||||
|
||||
#include "FWWindow.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
@ -54,7 +56,7 @@ freebsdAdvancedDialog::freebsdAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
{
|
||||
m_dialog = new Ui::freebsdAdvancedDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=o;
|
||||
|
||||
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
|
||||
@ -107,7 +109,7 @@ void freebsdAdvancedDialog::accept()
|
||||
assert(mgmt!=NULL);
|
||||
|
||||
data.saveAll();
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
171
src/gui/fwbuilder_ph.h
Executable file
171
src/gui/fwbuilder_ph.h
Executable file
@ -0,0 +1,171 @@
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "config.h"
|
||||
#include <iostream>
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlineedit.h>
|
||||
#include "fwbuilder/FWObject.h"
|
||||
#include <qpushbutton.h>
|
||||
#include <qmessagebox.h>
|
||||
#include "fwbuilder/Resources.h"
|
||||
#include <qspinbox.h>
|
||||
#include <qtextedit.h>
|
||||
#include "fwbuilder/Library.h"
|
||||
#include <qlabel.h>
|
||||
#include <qregexp.h>
|
||||
#include <qapplication.h>
|
||||
#include "fwbuilder/Interface.h"
|
||||
#include <qstring.h>
|
||||
#include <qradiobutton.h>
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
#include <qpixmapcache.h>
|
||||
#include <QWidget>
|
||||
#include <map>
|
||||
#include "fwbuilder/Management.h"
|
||||
#include <QDialog>
|
||||
#include <string>
|
||||
#include <qstackedwidget.h>
|
||||
#include "fwbuilder/Rule.h"
|
||||
#include "fwbuilder/FWException.h"
|
||||
#include <qcursor.h>
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <qlistwidget.h>
|
||||
#include "fwbuilder/RuleElement.h"
|
||||
#include <qobject.h>
|
||||
#include "fwbuilder/TCPService.h"
|
||||
#include "fwbuilder/UDPService.h"
|
||||
#include <vector>
|
||||
#include "fwbuilder/IPService.h"
|
||||
#include "fwbuilder/ICMPService.h"
|
||||
#include <qtimer.h>
|
||||
#include "../../config.h"
|
||||
#include "fwbuilder/Policy.h"
|
||||
#include "fwbuilder/FWReference.h"
|
||||
#include <qtooltip.h>
|
||||
#include <errno.h>
|
||||
#include "fwbuilder/Network.h"
|
||||
#include <stdlib.h>
|
||||
#include "fwbuilder/Host.h"
|
||||
#include <qfiledialog.h>
|
||||
#if defined(Q_OS_WIN32)
|
||||
# include <stdio.h>
|
||||
# include <sys/timeb.h>
|
||||
# include <windows.h>
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <time.h>
|
||||
#include "fwbuilder/RuleSet.h"
|
||||
#include <qfile.h>
|
||||
#include "fwbuilder/AddressRange.h"
|
||||
#include <qlayout.h>
|
||||
#include <sstream>
|
||||
#include <qstringlist.h>
|
||||
#include "fwbuilder/IPv4.h"
|
||||
#include <qtextbrowser.h>
|
||||
#include "fwbuilder/ObjectGroup.h"
|
||||
#include "fwbuilder/NAT.h"
|
||||
#include "fwbuilder/Interval.h"
|
||||
#include "fwbuilder/XMLTools.h"
|
||||
#include "definitions.h"
|
||||
#include "fwbuilder/InterfacePolicy.h"
|
||||
#include <qmenu.h>
|
||||
#include <fcntl.h>
|
||||
#include <qprocess.h>
|
||||
#include <sys/stat.h>
|
||||
#include "fwbuilder/CustomService.h"
|
||||
#include <qeventloop.h>
|
||||
#include "fwbuilder/ServiceGroup.h"
|
||||
#include "fwbuilder/TagService.h"
|
||||
#include <qtextstream.h>
|
||||
#include <qtreewidget.h>
|
||||
#include "fwbuilder/AddressTable.h"
|
||||
#include "fwbuilder/IntervalGroup.h"
|
||||
#include "fwbuilder/DNSName.h"
|
||||
#include <fstream>
|
||||
#include <qtabwidget.h>
|
||||
#include <qdir.h>
|
||||
#include <QDropEvent>
|
||||
#include "fwbuilder/Routing.h"
|
||||
#include <qdrag.h>
|
||||
#include <qmap.h>
|
||||
#include "VERSION.h"
|
||||
#include <qfont.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <functional>
|
||||
#include <qprinter.h>
|
||||
#include <qrect.h>
|
||||
#include "fwbuilder/IPAddress.h"
|
||||
#include <ios>
|
||||
#include <qwidget.h>
|
||||
#include <qtablewidget.h>
|
||||
#include <set>
|
||||
#include "fwbuilder/Logger.h"
|
||||
#include <sys/types.h>
|
||||
#include <QDragEnterEvent>
|
||||
#include <qcolor.h>
|
||||
#include "fwbuilder/FWOptions.h"
|
||||
#include <qaction.h>
|
||||
#include <QHeaderView>
|
||||
#include <QPixmap>
|
||||
#include <qtoolbutton.h>
|
||||
#include <utility>
|
||||
#include <qevent.h>
|
||||
#include <qdialog.h>
|
||||
#include <qsplitter.h>
|
||||
#include <QMenu>
|
||||
#include <string.h>
|
||||
#include <qlistview.h>
|
||||
#include "fwbuilder/Tools.h"
|
||||
#include <QStackedWidget>
|
||||
#include <QMimeData>
|
||||
#include "fwbuilder/Address.h"
|
||||
#include <QTreeWidget>
|
||||
#include <qdatetime.h>
|
||||
#include "fwbuilder/Group.h"
|
||||
#include <QCloseEvent>
|
||||
#include <qhostinfo.h>
|
||||
#include <qstatusbar.h>
|
||||
#include "fwbuilder/physAddress.h"
|
||||
#include <qfileinfo.h>
|
||||
#include <qcolordialog.h>
|
||||
#include <QContextMenuEvent>
|
||||
#include "fwbuilder/Constants.h"
|
||||
#include <qprintdialog.h>
|
||||
#include <QKeyEvent>
|
||||
#include <QDragLeaveEvent>
|
||||
#include <qvariant.h>
|
||||
#include "qobject.h"
|
||||
#include <QHideEvent>
|
||||
#include <qglobal.h>
|
||||
#include <QDragMoveEvent>
|
||||
#include <qstyle.h>
|
||||
#include <QPaintEvent>
|
||||
#include <cctype>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <QFocusEvent>
|
||||
#include "fwbuilder/BackgroundOp.h"
|
||||
#include <qimage.h>
|
||||
#include <QList>
|
||||
#include <QMouseEvent>
|
||||
#include <qframe.h>
|
||||
#include <qsettings.h>
|
||||
#include "fwbuilder/libfwbuilder-config.h"
|
||||
#include <qhostaddress.h>
|
||||
#include <qprogressbar.h>
|
||||
#include <qheaderview.h>
|
||||
#include "build_num"
|
||||
#include <assert.h>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QShowEvent>
|
||||
#include <qvector.h>
|
||||
#include <qtableview.h>
|
||||
@ -30,26 +30,16 @@
|
||||
|
||||
class QApplication;
|
||||
class FWWindow;
|
||||
class ObjectManipulator;
|
||||
class ObjectEditor;
|
||||
class ObjectInfo;
|
||||
class QTextEdit;
|
||||
class FWBSettings;
|
||||
class findDialog;
|
||||
class listOfLibraries;
|
||||
class ActionsDialog;
|
||||
//class ActionsDialog;
|
||||
|
||||
extern QApplication *app;
|
||||
extern FWWindow *mw;
|
||||
extern ObjectManipulator *om;
|
||||
extern ObjectEditor *oe;
|
||||
extern ActionsDialog *ap;
|
||||
extern QTextEdit *oi;
|
||||
//extern ActionsDialog *ap;
|
||||
extern FWBSettings *st;
|
||||
extern findDialog *fd;
|
||||
|
||||
extern listOfLibraries *addOnLibs;
|
||||
|
||||
//extern listOfLibraries *addOnLibs;
|
||||
|
||||
extern std::string appRootDir;
|
||||
extern std::string userDataDir;
|
||||
|
||||
@ -1,20 +1,24 @@
|
||||
#-*- mode: makefile; tab-width: 4; -*-
|
||||
#
|
||||
#
|
||||
TEMPLATE = app
|
||||
LANGUAGE = C++
|
||||
QT += network
|
||||
TEMPLATE = app
|
||||
LANGUAGE = C++
|
||||
QT += network
|
||||
|
||||
TARGET = fwbuilder
|
||||
|
||||
include(../../qmake.inc)
|
||||
|
||||
exists(qmake.inc) {
|
||||
include( qmake.inc)
|
||||
exists(qmake.inc){
|
||||
include( qmake.inc)
|
||||
}
|
||||
|
||||
PRECOMPILED_HEADER = fwbuilder_ph.h
|
||||
CONFIG += debug_and_release precompile_header
|
||||
|
||||
HEADERS += ../../config.h \
|
||||
HEADERS += ../../config.h \
|
||||
FWWindow.h \
|
||||
ProjectPanel.h \
|
||||
utils.h \
|
||||
utils_no_qt.h \
|
||||
Importer.h \
|
||||
@ -42,7 +46,6 @@ HEADERS += ../../config.h \
|
||||
FWObjectClipboard.h \
|
||||
platforms.h \
|
||||
global.h \
|
||||
FWWindow.h \
|
||||
printerStream.h \
|
||||
PrintingProgressDialog.h \
|
||||
FWObjectPropertiesFactory.h \
|
||||
@ -115,9 +118,12 @@ HEADERS += ../../config.h \
|
||||
FindWhereUsedWidget.h \
|
||||
ConfirmDeleteObjectDialog.h \
|
||||
FakeWizard.h \
|
||||
FWBAboutDialog.h
|
||||
FWBAboutDialog.h \
|
||||
fwbuilder_ph.h
|
||||
|
||||
SOURCES += main.cpp \
|
||||
SOURCES += ProjectPanel.cpp \
|
||||
FWWindow.cpp \
|
||||
main.cpp \
|
||||
utils.cpp \
|
||||
utils_no_qt.cpp \
|
||||
Importer.cpp \
|
||||
@ -146,7 +152,6 @@ SOURCES += main.cpp \
|
||||
RCSFilePreview.cpp \
|
||||
FWObjectClipboard.cpp \
|
||||
platforms.cpp \
|
||||
FWWindow.cpp \
|
||||
FWWindowPrint.cpp \
|
||||
printerStream.cpp \
|
||||
PrintingProgressDialog.cpp \
|
||||
@ -218,9 +223,9 @@ SOURCES += main.cpp \
|
||||
MetricEditorPanel.cpp \
|
||||
FindWhereUsedWidget.cpp \
|
||||
ConfirmDeleteObjectDialog.cpp \
|
||||
FakeWizard.cpp
|
||||
FakeWizard.cpp
|
||||
|
||||
FORMS = FWBMainWindow_q.ui \
|
||||
FORMS = FWBMainWindow_q.ui \
|
||||
execdialog_q.ui \
|
||||
customservicedialog_q.ui \
|
||||
ipservicedialog_q.ui \
|
||||
@ -288,21 +293,22 @@ FORMS = FWBMainWindow_q.ui \
|
||||
commenteditorpanel_q.ui \
|
||||
metriceditorpanel_q.ui \
|
||||
findwhereusedwidget_q.ui \
|
||||
confirmdeleteobjectdialog_q.ui
|
||||
confirmdeleteobjectdialog_q.ui\
|
||||
projectpanel_q.ui
|
||||
|
||||
contains( HAVE_ANTLR_RUNTIME, 1 ) {
|
||||
INCLUDEPATH += $$ANTLR_INCLUDEPATH
|
||||
LIBS += $$FWBPARSER_LIB $$ANTLR_LIBS
|
||||
DEFINES += $$ANTLR_DEFINES
|
||||
contains( HAVE_ANTLR_RUNTIME, 1 ){
|
||||
INCLUDEPATH += $$ANTLR_INCLUDEPATH
|
||||
LIBS += $$FWBPARSER_LIB $$ANTLR_LIBS
|
||||
DEFINES += $$ANTLR_DEFINES
|
||||
}
|
||||
|
||||
QMAKE_COPY = ../../install.sh -m 0755 -s
|
||||
QMAKE_COPY = ../../install.sh -m 0755 -s
|
||||
|
||||
RESOURCES += MainRes.qrc
|
||||
|
||||
TRANSLATIONS = fwbuilder_ru.ts
|
||||
|
||||
ru.path = $$PKGLOCALEDIR
|
||||
ru.path = $$PKGLOCALEDIR
|
||||
ru.files = fwbuilder_ru.qm
|
||||
|
||||
INSTALLS += ru
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "inplaceComboBox.h"
|
||||
|
||||
#include <qvariant.h>
|
||||
@ -33,12 +35,12 @@
|
||||
inplaceComboBox::inplaceComboBox( QWidget* parent, const char* name, Qt::WindowFlags fl )
|
||||
: QFrame( parent, fl )
|
||||
{
|
||||
|
||||
if ( !name )
|
||||
|
||||
if ( !name )
|
||||
setObjectName( "inplaceComboBox" );
|
||||
else
|
||||
setObjectName(name);
|
||||
|
||||
|
||||
// setPaletteBackgroundColor( QColor( 255, 255, 255 ) );
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
qLayout = new QGridLayout( this );
|
||||
@ -49,21 +51,21 @@ inplaceComboBox::inplaceComboBox( QWidget* parent, const char* name, Qt::WindowF
|
||||
layout1 = new QVBoxLayout( 0 );
|
||||
layout1->setMargin( 0 );
|
||||
layout1->setSpacing( 0 );
|
||||
layout1->setObjectName( "layout1" );
|
||||
layout1->setObjectName( "layout1" );
|
||||
|
||||
comboBox = new QComboBox( this );
|
||||
comboBox->setEditable( FALSE );
|
||||
comboBox->setObjectName( "comboBox" );
|
||||
|
||||
|
||||
QSizePolicy p = QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); //5, 5
|
||||
p.setHorizontalStretch(0);
|
||||
p.setVerticalStretch(0);
|
||||
p.setHeightForWidth(comboBox->sizePolicy().hasHeightForWidth());
|
||||
|
||||
p.setHeightForWidth(comboBox->sizePolicy().hasHeightForWidth());
|
||||
|
||||
comboBox->setSizePolicy( p );
|
||||
|
||||
|
||||
comboBox->setFocusPolicy( Qt::WheelFocus );
|
||||
|
||||
|
||||
layout1->addWidget( comboBox );
|
||||
QSpacerItem* spacer = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
|
||||
layout1->addItem( spacer );
|
||||
@ -79,7 +81,7 @@ void inplaceComboBox::insertItem( const QPixmap &pm, const QString &txt, int ind
|
||||
comboBox->insertItem(index, QIcon(pm), txt);
|
||||
else
|
||||
comboBox->addItem(QIcon(pm), txt);
|
||||
|
||||
|
||||
comboBox->setFixedHeight(pm.height()+4);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -53,6 +55,6 @@ instBatchOptionsDialog::instBatchOptionsDialog(QWidget *parent, instConf *_cnf)
|
||||
m_dialog->altAddress->setText("");
|
||||
m_dialog->altAddressLabel->hide();
|
||||
m_dialog->altAddress->hide();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "../../config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "../../config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -33,7 +35,6 @@
|
||||
#include "SSHUnx.h"
|
||||
#include "SSHPIX.h"
|
||||
#include "SSHIOS.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
#include "InstallFirewallViewItem.h"
|
||||
#include "instOptionsDialog.h"
|
||||
@ -84,8 +85,8 @@ instDialog::instDialog(QWidget* p, BatchOperation op, t_fwSet reqFirewalls_) : Q
|
||||
{
|
||||
m_dialog = new Ui::instDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
m_dialog->nextButton,
|
||||
m_dialog->finishButton,
|
||||
m_dialog->backButton,
|
||||
@ -97,7 +98,7 @@ instDialog::instDialog(QWidget* p, BatchOperation op, t_fwSet reqFirewalls_) : Q
|
||||
session=NULL;
|
||||
dlg=NULL;
|
||||
currentLog = NULL;
|
||||
currentSaveButton = NULL;
|
||||
currentSaveButton = NULL;
|
||||
currentStopButton = NULL;
|
||||
showSelectedFlag=false;
|
||||
pendingLogLine = "";
|
||||
@ -116,16 +117,16 @@ instDialog::instDialog(QWidget* p, BatchOperation op, t_fwSet reqFirewalls_) : Q
|
||||
* SSHSession. Perhaps also rename SSHSession to BackgroundSession
|
||||
* or something.
|
||||
*/
|
||||
|
||||
|
||||
connect(&proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readFromStdout()) );
|
||||
connect(&proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExited(int)) );
|
||||
|
||||
proc.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
|
||||
m_dialog->listView4->setSortingEnabled(false);
|
||||
|
||||
setFinishEnabled(pageCount()-1,true);
|
||||
|
||||
|
||||
lastPage=-1;
|
||||
reqFirewalls = reqFirewalls_;
|
||||
|
||||
@ -145,9 +146,9 @@ instDialog::instDialog(QWidget* p, BatchOperation op, t_fwSet reqFirewalls_) : Q
|
||||
operation=op;
|
||||
|
||||
creatingTable = false;
|
||||
|
||||
|
||||
showPage(0);
|
||||
|
||||
|
||||
switch(op)
|
||||
{
|
||||
case BATCH_COMPILE:
|
||||
@ -155,8 +156,8 @@ instDialog::instDialog(QWidget* p, BatchOperation op, t_fwSet reqFirewalls_) : Q
|
||||
m_dialog->selectInfoLabel->setText(tr("<p align=\"center\"><b><font size=\"+2\">Select firewalls for compilation.</font></b></p>"));
|
||||
m_dialog->batchInstFlagFrame->hide();
|
||||
setAppropriate(2,false);
|
||||
|
||||
|
||||
|
||||
|
||||
m_dialog->selectTable->hideColumn(1);
|
||||
break;
|
||||
}
|
||||
@ -170,7 +171,7 @@ instDialog::instDialog(QWidget* p, BatchOperation op, t_fwSet reqFirewalls_) : Q
|
||||
for (int i=0;i<pageCount()-1;i++)
|
||||
{
|
||||
setAppropriate(i,false);
|
||||
}
|
||||
}
|
||||
showPage(pageCount()-1);
|
||||
}
|
||||
}
|
||||
@ -188,7 +189,7 @@ instDialog::instDialog(QWidget* p, BatchOperation op, t_fwSet reqFirewalls_) : Q
|
||||
instDialog::~instDialog()
|
||||
{
|
||||
delete m_dialog;
|
||||
if (dlg)
|
||||
if (dlg)
|
||||
{
|
||||
delete dlg;
|
||||
dlg=NULL;
|
||||
@ -268,7 +269,7 @@ void instDialog::togleDetailMC()
|
||||
void instDialog::prepareInstConf(Firewall *)
|
||||
{
|
||||
if (fwbdebug) qDebug("instDialog::prepareInstConf");
|
||||
|
||||
|
||||
}
|
||||
|
||||
void instDialog::prepareInstallerOptions()
|
||||
@ -300,7 +301,7 @@ void instDialog::prepareInstallerOptions()
|
||||
/* TODO: set cnf.pgm to ssh path here */
|
||||
|
||||
QString platform = cnf.fwobj->getStr("platform").c_str();
|
||||
|
||||
|
||||
//bool f = dlg->testRun->isChecked();
|
||||
|
||||
//QSize pix_options_frame_size = dlg->PIXgroupBox->sizeHint();
|
||||
@ -332,7 +333,7 @@ void instDialog::prepareInstallerOptions()
|
||||
saveDiff->setEnabled(false);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (cnf.fwobj!=NULL && ! cnf.fwbfile.isEmpty())
|
||||
@ -383,7 +384,7 @@ void instDialog::storeInstallerOptions()
|
||||
st->setValue("/FirewallBuilder2/Installer/testRun", cnf.testRun);
|
||||
st->setValue("/FirewallBuilder2/Installer/rollback", cnf.rollback);
|
||||
st->setValue("/FirewallBuilder2/Installer/rollbackTime", cnf.rollbackTime);
|
||||
st->setValue("/FirewallBuilder2/Installer/canceRollbackIfSuccess",
|
||||
st->setValue("/FirewallBuilder2/Installer/canceRollbackIfSuccess",
|
||||
cnf.cancelRollbackIfSuccess);
|
||||
}
|
||||
|
||||
@ -446,35 +447,35 @@ void instDialog::summary()
|
||||
void instDialog::fillCompileSelectList()
|
||||
{
|
||||
if (fwbdebug) qDebug("instDialog::fillCompileSelectList");
|
||||
|
||||
|
||||
compileMapping.clear();
|
||||
installMapping.clear();
|
||||
|
||||
m_dialog->selectTable->setRowCount(firewalls.size());
|
||||
|
||||
|
||||
QTableWidgetItem * citem;
|
||||
|
||||
m_dialog->selectTable->setRowCount(firewalls.size());
|
||||
|
||||
|
||||
QTableWidgetItem * citem;
|
||||
|
||||
Firewall* f;
|
||||
QDateTime dt;
|
||||
int row=0;
|
||||
|
||||
|
||||
bool show_library=false;
|
||||
string tmp_libname="";
|
||||
|
||||
if (fwbdebug && reqFirewalls.empty())
|
||||
qDebug("instDialog::fillCompileSelectList reqFirewalls is empty");
|
||||
|
||||
|
||||
creatingTable = true;
|
||||
for (std::list<libfwbuilder::Firewall *>::iterator i=firewalls.begin();
|
||||
i!=firewalls.end(); ++i)
|
||||
{
|
||||
f=*i;
|
||||
|
||||
|
||||
time_t lm=f->getInt("lastModified");
|
||||
time_t lc=f->getInt("lastCompiled");
|
||||
time_t li=f->getInt("lastInstalled");
|
||||
|
||||
|
||||
citem=new QTableWidgetItem;
|
||||
citem->setText(QString::fromUtf8(f->getName().c_str()));
|
||||
m_dialog->selectTable->setItem(row,2,citem);
|
||||
@ -486,19 +487,19 @@ void instDialog::fillCompileSelectList()
|
||||
if (!show_library && tmp_libname != "" && tmp_libname != f->getLibraryName())
|
||||
show_library = true;
|
||||
tmp_libname = f->getLibraryName();
|
||||
|
||||
|
||||
citem=new QTableWidgetItem;
|
||||
citem->setText(QString::fromUtf8(tmp_libname.c_str()));
|
||||
m_dialog->selectTable->setItem(row,3,citem);
|
||||
//m_dialog->selectTable->setColumnReadOnly(3,true);
|
||||
|
||||
|
||||
citem=new QTableWidgetItem; //usual type
|
||||
bool checked = (f->needsCompile() && reqFirewalls.empty() && !f->getInactive()) ||
|
||||
bool checked = (f->needsCompile() && reqFirewalls.empty() && !f->getInactive()) ||
|
||||
(!reqFirewalls.empty() && reqFirewalls.find(f)!=reqFirewalls.end());
|
||||
citem->setCheckState(checked?Qt::Checked:Qt::Unchecked);
|
||||
m_dialog->selectTable->setItem(row,0,citem);
|
||||
compileMapping[f]=citem;
|
||||
|
||||
|
||||
citem=new QTableWidgetItem; //usual type
|
||||
checked = (operation==BATCH_INSTALL) &&
|
||||
((f->needsInstall() && reqFirewalls.empty() && !f->getInactive()) ||
|
||||
@ -506,22 +507,22 @@ void instDialog::fillCompileSelectList()
|
||||
citem->setCheckState(checked?Qt::Checked:Qt::Unchecked);
|
||||
m_dialog->selectTable->setItem(row,1,citem);
|
||||
installMapping[f]=citem;
|
||||
|
||||
|
||||
|
||||
QLabel *l;
|
||||
QFont font;
|
||||
|
||||
|
||||
|
||||
|
||||
dt.setTime_t(lm);
|
||||
l=new QLabel(m_dialog->selectTable);
|
||||
QPalette temp = l->palette();
|
||||
temp.setColor(QPalette::Window, Qt::white);
|
||||
l->setPalette(temp);
|
||||
|
||||
|
||||
if (lm>lc && lm>li) {font=l->font();font.setBold(true);l->setFont(font);}
|
||||
l->setText((lm)?dt.toString():QString("---"));
|
||||
m_dialog->selectTable->setCellWidget(row,4,l);
|
||||
|
||||
|
||||
dt.setTime_t(lc);
|
||||
l=new QLabel(m_dialog->selectTable);
|
||||
temp = l->palette();
|
||||
@ -530,7 +531,7 @@ void instDialog::fillCompileSelectList()
|
||||
if (lc>lm && lc>li) {font=l->font();font.setBold(true);l->setFont(font);}
|
||||
l->setText((lm)?dt.toString():QString("---"));
|
||||
m_dialog->selectTable->setCellWidget(row,5,l);
|
||||
|
||||
|
||||
dt.setTime_t(li);
|
||||
l=new QLabel(m_dialog->selectTable);
|
||||
temp = l->palette();
|
||||
@ -539,23 +540,23 @@ void instDialog::fillCompileSelectList()
|
||||
if (li>lc && li>lm) {font=l->font();font.setBold(true);l->setFont(font);}
|
||||
l->setText((lm)?dt.toString():QString("---"));
|
||||
m_dialog->selectTable->setCellWidget(row,6,l);
|
||||
|
||||
row++;
|
||||
|
||||
row++;
|
||||
}
|
||||
creatingTable = false;
|
||||
if (show_library)
|
||||
m_dialog->selectTable->showColumn(3);
|
||||
else
|
||||
m_dialog->selectTable->hideColumn(3);
|
||||
|
||||
|
||||
for (int i=0;i<m_dialog->selectTable->columnCount();i++)
|
||||
{
|
||||
if (i<4)
|
||||
if (i<4)
|
||||
m_dialog->selectTable->resizeColumnToContents (i);
|
||||
else
|
||||
m_dialog->selectTable->setColumnWidth(i,200);
|
||||
}
|
||||
|
||||
|
||||
//selectTable->setColumnStretchable(2,true);
|
||||
//selectTable->sortColumn(2,true,true);
|
||||
}
|
||||
@ -563,7 +564,7 @@ void instDialog::fillCompileSelectList()
|
||||
void instDialog::showPage(const int page)
|
||||
{
|
||||
FakeWizard::showPage(page);
|
||||
|
||||
|
||||
if (fwbdebug && reqFirewalls.empty())
|
||||
qDebug("instDialog::showPage reqFirewalls is empty");
|
||||
|
||||
@ -578,7 +579,7 @@ void instDialog::showPage(const int page)
|
||||
{
|
||||
if (lastPage<0) fillCompileSelectList();
|
||||
setNextEnabled(0, isTableHasChecked());
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case 1: // compiling (installing) firewalls
|
||||
{
|
||||
@ -593,7 +594,7 @@ void instDialog::showPage(const int page)
|
||||
// what about installation?
|
||||
|
||||
compileFlag=false;
|
||||
|
||||
|
||||
fillInstallOpList();
|
||||
opListIterator=opList.begin();
|
||||
if(opList.size()==0)
|
||||
@ -625,13 +626,13 @@ void instDialog::showPage(const int page)
|
||||
if (stopProcessFlag) return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // fin
|
||||
{
|
||||
setBackEnabled(2,false);
|
||||
if (compileFlag && operation==BATCH_INSTALL)
|
||||
if (compileFlag && operation==BATCH_INSTALL)
|
||||
{
|
||||
fillInstallOpList();
|
||||
initInstall();
|
||||
@ -649,8 +650,8 @@ void instDialog::showPage(const int page)
|
||||
}
|
||||
|
||||
if (
|
||||
!compileFlag &&
|
||||
opList.end()!=opListIterator &&
|
||||
!compileFlag &&
|
||||
opList.end()!=opListIterator &&
|
||||
operation==BATCH_INSTALL &&
|
||||
!stopProcessFlag)
|
||||
{
|
||||
@ -676,7 +677,7 @@ QString instDialog::getFullPath(instConf &cnf, const QString &file )
|
||||
bool instDialog::doInstallPage(Firewall* f)
|
||||
{
|
||||
if (fwbdebug) qDebug("instDialog::doInstallPage");
|
||||
|
||||
|
||||
/* change of the page when flag ready is 'true' means we should start
|
||||
* operation */
|
||||
cnf.fwobj = f;
|
||||
@ -709,7 +710,7 @@ bool instDialog::doInstallPage(Firewall* f)
|
||||
qDebug(
|
||||
QString("instDialog::doInstallPage: alternative address %1")
|
||||
.arg(aaddr).toAscii().constData());
|
||||
|
||||
|
||||
} else
|
||||
{
|
||||
FWOptions *fwopt = cnf.fwobj->getOptionsObject();
|
||||
@ -717,7 +718,7 @@ bool instDialog::doInstallPage(Firewall* f)
|
||||
if (!aaddr.isEmpty())
|
||||
cnf.maddr = aaddr;
|
||||
else
|
||||
cnf.maddr =
|
||||
cnf.maddr =
|
||||
cnf.fwobj->getManagementAddress().toString().c_str();
|
||||
}
|
||||
|
||||
@ -778,7 +779,7 @@ bool instDialog::doInstallPage(Firewall* f)
|
||||
if (cnf.copyFWB)
|
||||
{
|
||||
QFileInfo fwbfile_base(cnf.fwbfile);
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug( QString("Will copy data file: %1").arg(fwbfile_base.fileName()).toAscii().constData());
|
||||
|
||||
@ -917,7 +918,7 @@ bool instDialog::doInstallPage(Firewall* f)
|
||||
* and "post_config" hooks in SSHPIX / SSHIOS classes. Need to
|
||||
* do the same for Unix firewalls.
|
||||
*/
|
||||
|
||||
|
||||
QString cmd = "";
|
||||
QStringList pre_config_commands;
|
||||
QStringList post_config_commands;
|
||||
@ -1036,7 +1037,7 @@ void instDialog::stopSessionAndDisconnectSignals()
|
||||
}
|
||||
|
||||
/*
|
||||
* This method builds and returns activation command
|
||||
* This method builds and returns activation command
|
||||
* This method is used for all firewall platforms but PIX
|
||||
*/
|
||||
QString instDialog::getActivationCmd()
|
||||
@ -1054,7 +1055,7 @@ QString instDialog::getActivationCmd()
|
||||
else optpath += "reg_user/";
|
||||
|
||||
if (cnf.testRun)
|
||||
{
|
||||
{
|
||||
optpath += "test/";
|
||||
if (cnf.rollback) optpath += "rollback/";
|
||||
else optpath += "no_rollback/";
|
||||
@ -1116,7 +1117,7 @@ void instDialog::initiateCopy(const QString &file)
|
||||
//if (platform!="pix" && platform!="fwsm") progressBar->show();
|
||||
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("latin1"));
|
||||
|
||||
|
||||
std::ifstream *wfile;
|
||||
|
||||
QString file_with_path = getFullPath(cnf,file);
|
||||
@ -1232,7 +1233,7 @@ void instDialog::initiateCopy(const QString &file)
|
||||
cmd.replace("%FWBPROMPT%", fwb_prompt);
|
||||
|
||||
args.push_back(cmd);
|
||||
|
||||
|
||||
addToLog( tr("\nCopying %1 -> %2:%3\n")
|
||||
.arg(file_with_path).arg(cnf.maddr).arg(cnf.fwdir) );
|
||||
|
||||
@ -1248,7 +1249,7 @@ void instDialog::initiateCopy(const QString &file)
|
||||
cnf.pwd,
|
||||
"",
|
||||
allConfig);
|
||||
|
||||
|
||||
s->setCloseStdin(true);
|
||||
runSSH(s);
|
||||
}
|
||||
@ -1273,10 +1274,10 @@ void instDialog::displayCommand(const QStringList &args)
|
||||
void instDialog::finishInstall(bool success)
|
||||
{
|
||||
if (fwbdebug) qDebug("instDialog::finishInstall");
|
||||
|
||||
if (success)
|
||||
|
||||
if (success)
|
||||
{
|
||||
om->updateLastInstalledTimestamp(*opListIterator);
|
||||
mw->updateLastInstalledTimestamp(*opListIterator);
|
||||
opListMapping[*opListIterator]->setText(1,tr("Success"));
|
||||
processedFirewalls[*opListIterator].second=tr("Success");
|
||||
setSuccessState(opListMapping[*opListIterator]);
|
||||
@ -1287,10 +1288,10 @@ void instDialog::finishInstall(bool success)
|
||||
processedFirewalls[*opListIterator].second=tr("Error");
|
||||
setErrorState(opListMapping[*opListIterator]);
|
||||
}
|
||||
|
||||
|
||||
opListIterator++;
|
||||
|
||||
if(opListIterator!=opList.end() && m_dialog->batchInstall->isChecked() && !stopProcessFlag)
|
||||
|
||||
if(opListIterator!=opList.end() && m_dialog->batchInstall->isChecked() && !stopProcessFlag)
|
||||
{
|
||||
// installSelected();
|
||||
QTimer::singleShot( 0, this, SLOT(installSelected()));
|
||||
@ -1311,7 +1312,7 @@ void instDialog::finishInstall(bool success)
|
||||
void instDialog::continueRun()
|
||||
{
|
||||
if (fwbdebug) qDebug("instDialog::continueRun");
|
||||
|
||||
|
||||
if (activationCommandDone)
|
||||
{
|
||||
if (fwbdebug) qDebug("activationCommandDone");
|
||||
@ -1464,7 +1465,7 @@ void instDialog::hideEvent( QHideEvent *ev)
|
||||
st->saveGeometry(this);
|
||||
QDialog::hideEvent(ev);
|
||||
}
|
||||
|
||||
|
||||
void instDialog::testRunRequested()
|
||||
{
|
||||
#if 0
|
||||
@ -1493,7 +1494,7 @@ void instDialog::saveLog()
|
||||
"Choose a file",
|
||||
dir,
|
||||
"Text file (*.txt)");
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug( "Saving log to file %s", s.toAscii().constData() );
|
||||
|
||||
@ -1511,13 +1512,13 @@ void instDialog::saveLog()
|
||||
str << logText;
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void instDialog::findFirewalls()
|
||||
{
|
||||
firewalls.clear();
|
||||
om->findAllFirewalls(firewalls);
|
||||
mw->findAllFirewalls(firewalls);
|
||||
firewalls.sort(FWObjectNameCmpPredicate());
|
||||
m_dialog->saveMCLogButton->setEnabled(true);
|
||||
}
|
||||
@ -1531,8 +1532,8 @@ bool instDialog::runCompile(Firewall *fw)
|
||||
qDebug(("Firewall:"+fw->getName()).c_str());
|
||||
}
|
||||
|
||||
|
||||
addToLog( QString("\n") +
|
||||
|
||||
addToLog( QString("\n") +
|
||||
QObject::tr("Compiling rule sets for firewall: %1").arg(
|
||||
fw->getName().c_str()
|
||||
)
|
||||
@ -1551,7 +1552,7 @@ bool instDialog::runCompile(Firewall *fw)
|
||||
return false;
|
||||
}
|
||||
args.push_front(path);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1600,11 +1601,11 @@ bool instDialog::testFirewall(Firewall *fw)
|
||||
if (fwbdebug) qDebug("Firewall isn't compiled.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
args.clear();
|
||||
|
||||
|
||||
|
||||
|
||||
if ( /*! pis->isEnabled() || */ pis->getCommand()=="" )
|
||||
{
|
||||
//instConf cnf;
|
||||
@ -1669,7 +1670,7 @@ bool instDialog::testFirewall(Firewall *fw)
|
||||
|
||||
//int exec_result=dlg.run();
|
||||
//qDebug(QString("Result: %1").arg(exec_result));
|
||||
//if (exec_result==0) om->updateLastInstalledTimestamp(fw);
|
||||
//if (exec_result==0) mw->updateLastInstalledTimestamp(fw);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1683,7 +1684,7 @@ bool instDialog::prepareArgForCompiler(Firewall *fw)
|
||||
* no platform (e.g. for experiments)
|
||||
*/
|
||||
string compiler=fwopt->getStr("compiler");
|
||||
if (compiler=="")
|
||||
if (compiler=="")
|
||||
{
|
||||
compiler=Resources::platform_res[fw->getStr("platform")]->getCompiler();
|
||||
}
|
||||
@ -1691,7 +1692,7 @@ bool instDialog::prepareArgForCompiler(Firewall *fw)
|
||||
if (compiler=="")
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Firewall platform is not specified in this object.\n\
|
||||
Can't compile firewall policy."),
|
||||
tr("&Continue"), QString::null,QString::null,
|
||||
@ -1757,7 +1758,7 @@ Can't compile firewall policy."),
|
||||
}
|
||||
|
||||
QString ofname = QString::fromUtf8(fwopt->getStr("output_file").c_str());
|
||||
if (!ofname.isEmpty())
|
||||
if (!ofname.isEmpty())
|
||||
{
|
||||
args.push_back("-o");
|
||||
args.push_back(ofname);
|
||||
@ -1767,7 +1768,7 @@ Can't compile firewall policy."),
|
||||
* directory /usr/share/fwbuilder-2.1 (it used to be just
|
||||
* /usr/share/fwbuilder) Compilers that are packaged separately need
|
||||
* to know about this but I do not want to hard-code it. It is easier
|
||||
* to pass the path on the command line
|
||||
* to pass the path on the command line
|
||||
*
|
||||
* Update 01/16/06:
|
||||
*
|
||||
@ -1802,17 +1803,17 @@ void instDialog::addToLog(const QString &line)
|
||||
|
||||
QStringList words=line.split(" ");
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
// although it is nice to be able to print errors in red, this
|
||||
// will break because of localization
|
||||
QColor oc=currentLog->color();
|
||||
if (words.first().find("Error")>=0) currentLog->setColor(Qt::red);
|
||||
if (words.first().find("Abnormal")>=0) currentLog->setColor(Qt::red);
|
||||
if (words.first().find("Warning")>=0) currentLog->setColor(Qt::blue);
|
||||
#endif
|
||||
#endif
|
||||
// currentLog->insert( line );
|
||||
currentLog->append( line );
|
||||
|
||||
|
||||
if (words.first().indexOf("rule")>=0)
|
||||
{
|
||||
currentProgressBar->setValue(++processedRules);
|
||||
@ -1845,7 +1846,7 @@ void instDialog::addToLog(const QString &line)
|
||||
if (fwbdebug)
|
||||
qDebug( QString("instDialog::addToLog Current log buffer contents %3").
|
||||
arg(currentLog->toPlainText()).toAscii().constData() );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1920,7 +1921,7 @@ void instDialog::installerFinished()
|
||||
// session object is destroyed in stopSessionAndDisconnectSignals()
|
||||
QTimer::singleShot( 0, this, SLOT(stopSessionAndDisconnectSignals()));
|
||||
}
|
||||
|
||||
|
||||
QTimer::singleShot( 0, this, SLOT(continueRun()) );
|
||||
}
|
||||
|
||||
@ -1940,25 +1941,25 @@ void instDialog::processExited(int res)
|
||||
if (!compileFlag && customScriptFlag)
|
||||
{
|
||||
if( fwbdebug) qDebug("Custom script installer");
|
||||
|
||||
|
||||
if(res==0)
|
||||
{
|
||||
om->updateLastInstalledTimestamp(*opListIterator);
|
||||
mw->updateLastInstalledTimestamp(*opListIterator);
|
||||
processedFirewalls[*opListIterator].second="Success";
|
||||
opListMapping[*opListIterator]->setText(1,tr("Success"));
|
||||
setSuccessState(opListMapping[*opListIterator]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
processedFirewalls[*opListIterator].second="Error";
|
||||
opListMapping[*opListIterator]->setText(1,tr("Error"));
|
||||
setErrorState(opListMapping[*opListIterator]);
|
||||
}
|
||||
currentProgressBar->setValue(currentProgressBar->maximum () );
|
||||
currentProgressBar->setValue(currentProgressBar->maximum () );
|
||||
qApp->processEvents();
|
||||
|
||||
|
||||
opListIterator++;
|
||||
|
||||
|
||||
if (opListIterator!=opList.end() && m_dialog->batchInstall->isChecked() && !stopProcessFlag)
|
||||
{
|
||||
QTimer::singleShot( 0, this, SLOT(installSelected()));
|
||||
@ -1972,10 +1973,10 @@ void instDialog::processExited(int res)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(res==0 && proc.state()==QProcess::NotRunning && !stopProcessFlag)
|
||||
|
||||
if(res==0 && proc.state()==QProcess::NotRunning && !stopProcessFlag)
|
||||
{
|
||||
om->updateLastCompiledTimestamp(*opListIterator);
|
||||
mw->updateLastCompiledTimestamp(*opListIterator);
|
||||
processedFirewalls[*opListIterator].first=tr("Success");
|
||||
opListMapping[*opListIterator]->setText(1,tr("Success"));
|
||||
setSuccessState(opListMapping[*opListIterator]);
|
||||
@ -2006,9 +2007,9 @@ void instDialog::processExited(int res)
|
||||
|
||||
Firewall *f;
|
||||
QTreeWidgetItem* item;
|
||||
|
||||
|
||||
opListIterator++;
|
||||
|
||||
|
||||
while (opListIterator!=opList.end() && !stopProcessFlag)
|
||||
{
|
||||
if (currentFirewallsBar) currentFirewallsBar->setValue(++progress);
|
||||
@ -2017,10 +2018,10 @@ void instDialog::processExited(int res)
|
||||
f=*opListIterator;
|
||||
item=opListMapping[f];
|
||||
currentFWLabel->setText(QString::fromUtf8(f->getName().c_str()));
|
||||
|
||||
|
||||
|
||||
m_dialog->listView4->scrollToItem( opListMapping[f] );
|
||||
|
||||
|
||||
if(runCompile(f))
|
||||
{
|
||||
item->setText(1,tr("Compiling ..."));
|
||||
@ -2036,18 +2037,18 @@ void instDialog::processExited(int res)
|
||||
setFailureState(item);
|
||||
|
||||
}
|
||||
++opListIterator;
|
||||
++opListIterator;
|
||||
}
|
||||
if (currentFirewallsBar)
|
||||
currentFirewallsBar->setValue(currentFirewallsBar->maximum());
|
||||
|
||||
|
||||
if (currentStopButton)
|
||||
{
|
||||
currentStopButton->setText(tr("Recompile"));
|
||||
disconnect (currentStopButton , SIGNAL(clicked()), this ,SLOT(stopCompile()));
|
||||
connect(currentStopButton,SIGNAL(clicked()),this,SLOT(compileSelected()));
|
||||
currentStopButton->setEnabled(true);
|
||||
|
||||
|
||||
}
|
||||
currentSaveButton->setEnabled(true);
|
||||
if (operation==BATCH_COMPILE)
|
||||
@ -2078,11 +2079,11 @@ void instDialog::deselectAllFirewalls()
|
||||
void instDialog::selectAll(t_tableMap &mapping)
|
||||
{
|
||||
if (fwbdebug) qDebug("instDialog::selectAll");
|
||||
|
||||
|
||||
t_tableMap::iterator i;
|
||||
|
||||
QTableWidgetItem *item;
|
||||
|
||||
|
||||
for(i=mapping.begin();i!=mapping.end();++i)
|
||||
{
|
||||
item=(*i).second;
|
||||
@ -2106,7 +2107,7 @@ void instDialog::fillCompileOpList()
|
||||
opList.clear();
|
||||
processedFirewalls.clear();
|
||||
opListMapping.clear();
|
||||
|
||||
|
||||
Firewall * f;
|
||||
InstallFirewallViewItem * item;
|
||||
t_fwList::reverse_iterator i;
|
||||
@ -2120,19 +2121,19 @@ void instDialog::fillCompileOpList()
|
||||
QString::fromUtf8(f->getName().c_str()),
|
||||
false);
|
||||
m_dialog->listView4->insertTopLevelItem(0, item);
|
||||
|
||||
|
||||
opListMapping[f]=item;
|
||||
|
||||
processedFirewalls[f]=make_pair("","");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void instDialog::compileSelected()
|
||||
{
|
||||
if (fwbdebug) qDebug("instDialog::compileSelected");
|
||||
setTitle(1,tr("Batch policy rules compilation"));
|
||||
|
||||
|
||||
currentLog = m_dialog->procLogDisplay;
|
||||
currentSaveButton = m_dialog->saveMCLogButton;
|
||||
currentSaveButton->setEnabled(true);
|
||||
@ -2143,7 +2144,7 @@ void instDialog::compileSelected()
|
||||
currentFWLabel = m_dialog->fwMCLabel;
|
||||
currentSearchString="Compiling rule sets for firewall: ";
|
||||
setNextEnabled(0,false);
|
||||
|
||||
|
||||
mw->fileSave();
|
||||
compileFlag=true;
|
||||
|
||||
@ -2153,23 +2154,23 @@ void instDialog::compileSelected()
|
||||
progress=0;
|
||||
stopProcessFlag=false;
|
||||
|
||||
|
||||
|
||||
currentLog->clear();
|
||||
|
||||
if (currentStopButton)
|
||||
if (currentStopButton)
|
||||
{
|
||||
disconnect(currentStopButton,SIGNAL(clicked()),this,SLOT(compileSelected()));
|
||||
connect(currentStopButton,SIGNAL(clicked()),this,SLOT(stopCompile()));
|
||||
currentStopButton->setText(tr("Stop"));
|
||||
currentStopButton->setEnabled(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Firewall *f;
|
||||
QTreeWidgetItem* item;
|
||||
|
||||
|
||||
opListIterator=opList.begin();
|
||||
|
||||
|
||||
while (opListIterator!=opList.end() && !stopProcessFlag)
|
||||
{
|
||||
if (currentFirewallsBar) currentFirewallsBar->setValue(++progress);
|
||||
@ -2178,10 +2179,10 @@ void instDialog::compileSelected()
|
||||
f=*opListIterator;
|
||||
item=opListMapping[f];
|
||||
currentFWLabel->setText(QString::fromUtf8(f->getName().c_str()));
|
||||
|
||||
|
||||
|
||||
m_dialog->listView4->scrollToItem( opListMapping[f] );
|
||||
|
||||
|
||||
if(runCompile(f))
|
||||
{
|
||||
setInProcessState(item);
|
||||
@ -2194,18 +2195,18 @@ void instDialog::compileSelected()
|
||||
item->setText(1,tr("Failure"));
|
||||
setFailureState(item);
|
||||
}
|
||||
++opListIterator;
|
||||
++opListIterator;
|
||||
|
||||
m_dialog->listView4->update();
|
||||
/*m_dialog->listView4->dataChanged ( m_dialog->listView4->indexFromItem(item,0), m_dialog->listView4->indexFromItem(item,1) );*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void instDialog::stopCompile()
|
||||
{
|
||||
if( fwbdebug) qDebug("instDialog::stopCompile");
|
||||
stopProcessFlag=true;
|
||||
|
||||
|
||||
currentStopButton->setEnabled(false);
|
||||
|
||||
proc.terminate(); //try to close proc.
|
||||
@ -2221,26 +2222,26 @@ void instDialog::stopInstall()
|
||||
void instDialog::fillLastList()
|
||||
{
|
||||
m_dialog->lastListView->clear();
|
||||
|
||||
|
||||
QTreeWidgetItem *item;
|
||||
Firewall* f;
|
||||
t_procMess m;
|
||||
|
||||
|
||||
for (map<libfwbuilder::Firewall *, t_procMess>::iterator i=processedFirewalls.begin();
|
||||
i!=processedFirewalls.end(); ++i)
|
||||
{
|
||||
f=(*i).first;
|
||||
m=(*i).second;
|
||||
|
||||
|
||||
item=new QTreeWidgetItem(m_dialog->lastListView,
|
||||
QStringList(QString::fromUtf8(f->getName().c_str())));
|
||||
|
||||
|
||||
|
||||
|
||||
item->setText(1,m.first);
|
||||
item->setText(2,m.second);
|
||||
|
||||
}
|
||||
|
||||
|
||||
m_dialog->lastListView->setSortingEnabled(true);
|
||||
m_dialog->lastListView->sortByColumn(0, Qt::AscendingOrder);
|
||||
}
|
||||
@ -2252,19 +2253,19 @@ bool instDialog::runInstall(Firewall *fw)
|
||||
{
|
||||
if (fwbdebug) qDebug("custom script");
|
||||
summary();
|
||||
|
||||
|
||||
addToLog(args.join(" "));
|
||||
|
||||
|
||||
QString path = args[0];
|
||||
args.pop_front();
|
||||
proc.start(path, args);
|
||||
|
||||
|
||||
if (!proc.waitForStarted())
|
||||
{
|
||||
addToLog( tr("Error: Failed to start program") );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
args.push_front(path); //return to previous state
|
||||
}
|
||||
else
|
||||
@ -2281,10 +2282,10 @@ void instDialog::fillInstallOpList()
|
||||
m_dialog->listView4->clear();
|
||||
opListMapping.clear();
|
||||
opList.clear();
|
||||
|
||||
|
||||
InstallFirewallViewItem * item;
|
||||
Firewall * f;
|
||||
|
||||
|
||||
t_fwList::reverse_iterator i;
|
||||
for(i=firewalls.rbegin();i!=firewalls.rend();++i)
|
||||
{
|
||||
@ -2298,7 +2299,7 @@ void instDialog::fillInstallOpList()
|
||||
false);
|
||||
|
||||
m_dialog->listView4->insertTopLevelItem(0, item);
|
||||
|
||||
|
||||
opListMapping[f]=item;
|
||||
if (processedFirewalls.find(f)==processedFirewalls.end())
|
||||
processedFirewalls[f]=make_pair("","");
|
||||
@ -2316,7 +2317,7 @@ void instDialog::initInstall()
|
||||
currentFirewallsBar->setMaximum(opList.size());
|
||||
currentStopButton = m_dialog->controlMCButton;
|
||||
currentStopButton->setText(tr("Stop"));
|
||||
|
||||
|
||||
disconnect(currentStopButton,SIGNAL(clicked()));
|
||||
connect(currentStopButton,SIGNAL(clicked()),this,SLOT(stopInstall()));
|
||||
|
||||
@ -2339,7 +2340,7 @@ void instDialog::installSelected()
|
||||
setNextEnabled(1,false);
|
||||
|
||||
bool fPix=false,fCustInst=true;
|
||||
|
||||
|
||||
if (opListIterator==opList.begin() && m_dialog->batchInstall->isChecked())
|
||||
{
|
||||
// check if this is PIX and if we use custom
|
||||
@ -2351,10 +2352,10 @@ void instDialog::installSelected()
|
||||
currentSaveButton->setEnabled(true);
|
||||
currentProgressBar->reset();
|
||||
currentProgressBar->setMaximum(100);
|
||||
|
||||
|
||||
currentLabel->setText(QString::fromUtf8((*opListIterator)->getName().c_str()));
|
||||
compileFlag=false;
|
||||
|
||||
|
||||
resetInstallSSHSession();
|
||||
currentFirewallsBar->setValue(++progress);
|
||||
|
||||
@ -2363,14 +2364,14 @@ void instDialog::installSelected()
|
||||
QString::fromUtf8((*opListIterator)->getName().c_str())+"</b>");
|
||||
appendRich("\n");
|
||||
//qApp->processEvents();
|
||||
|
||||
|
||||
|
||||
|
||||
if (testFirewall(*opListIterator))
|
||||
{
|
||||
opListMapping[*opListIterator]->setText(1,tr("Installing ..."));
|
||||
setInProcessState(opListMapping[*opListIterator]);
|
||||
//qApp->processEvents();
|
||||
|
||||
|
||||
if (customScriptFlag && fCustInst)
|
||||
{ // custom installer
|
||||
if (fwbdebug) qDebug("custom install script.");
|
||||
@ -2383,19 +2384,19 @@ void instDialog::installSelected()
|
||||
if (!m_dialog->batchInstall->isChecked() ||
|
||||
opListIterator==opList.begin())
|
||||
{
|
||||
if (dlg)
|
||||
if (dlg)
|
||||
{
|
||||
delete dlg;
|
||||
dlg=NULL;
|
||||
}
|
||||
|
||||
|
||||
prepareInstallerOptions();
|
||||
|
||||
|
||||
if (m_dialog->batchInstall->isChecked())
|
||||
dlg=new instBatchOptionsDialog(this, &cnf);
|
||||
else
|
||||
dlg=new instOptionsDialog(this, &cnf);
|
||||
|
||||
|
||||
if (dlg->exec()==QDialog::Rejected)
|
||||
{
|
||||
delete dlg;
|
||||
@ -2418,7 +2419,7 @@ void instDialog::installSelected()
|
||||
//if (opList.end()!=opListIterator && batchInstall->isChecked())
|
||||
// showPage(page(2));
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// clear aternative address in the dialog if this is batch install.
|
||||
@ -2440,7 +2441,7 @@ void instDialog::installSelected()
|
||||
if (opList.end()!=opListIterator && m_dialog->batchInstall->isChecked())
|
||||
showPage(2);
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
@ -2491,10 +2492,10 @@ Firewall * instDialog::findFirewallbyListItem(QTreeWidgetItem *item)
|
||||
{
|
||||
Firewall * res=NULL;
|
||||
t_listMap::iterator i;
|
||||
|
||||
|
||||
for(i=opListMapping.begin();i!=opListMapping.end();++i)
|
||||
{
|
||||
if ((*i).second==item)
|
||||
if ((*i).second==item)
|
||||
{
|
||||
res=(*i).first;
|
||||
break;
|
||||
@ -2507,10 +2508,10 @@ Firewall * instDialog::findFirewallbyTableItem(QTableWidgetItem *item)
|
||||
{
|
||||
Firewall * res=NULL;
|
||||
t_tableMap::iterator i;
|
||||
|
||||
|
||||
for(i=compileMapping.begin();i!=compileMapping.end();++i)
|
||||
{
|
||||
if ((*i).second==item)
|
||||
if ((*i).second==item)
|
||||
{
|
||||
res=(*i).first;
|
||||
return res;
|
||||
@ -2519,35 +2520,35 @@ Firewall * instDialog::findFirewallbyTableItem(QTableWidgetItem *item)
|
||||
|
||||
for(i=installMapping.begin();i!=installMapping.end();++i)
|
||||
{
|
||||
if ((*i).second==item)
|
||||
if ((*i).second==item)
|
||||
{
|
||||
res=(*i).first;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
void instDialog::showSelected()
|
||||
{
|
||||
|
||||
|
||||
QTableWidgetItem* item;
|
||||
Firewall *f;
|
||||
|
||||
|
||||
t_fwList::iterator i;
|
||||
bool sel;
|
||||
|
||||
|
||||
for(i=firewalls.begin();i!=firewalls.end();++i)
|
||||
{
|
||||
sel=false;
|
||||
|
||||
|
||||
f=(*i);
|
||||
item=compileMapping[f];
|
||||
sel|=item->checkState()==Qt::Checked;
|
||||
|
||||
item=installMapping[f];
|
||||
sel|=item->checkState()==Qt::Checked;
|
||||
|
||||
|
||||
if(!sel )
|
||||
{
|
||||
if (showSelectedFlag)
|
||||
@ -2560,7 +2561,7 @@ void instDialog::showSelected()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showSelectedFlag)
|
||||
if (showSelectedFlag)
|
||||
{
|
||||
m_dialog->showSelButton->setText(tr("Show selected"));
|
||||
m_dialog->pushButton16->setEnabled(true);
|
||||
@ -2573,7 +2574,7 @@ void instDialog::showSelected()
|
||||
m_dialog->pushButton17->setEnabled(false);
|
||||
}
|
||||
showSelectedFlag=!showSelectedFlag;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void instDialog::tableValueChanged(int row, int col)
|
||||
@ -2582,16 +2583,16 @@ void instDialog::tableValueChanged(int row, int col)
|
||||
if (fwbdebug) qDebug("instDialog::tableValueChanged");
|
||||
QTableWidgetItem *item;
|
||||
Firewall *f;
|
||||
|
||||
|
||||
item=m_dialog->selectTable->item(row,col);
|
||||
f=findFirewallbyTableItem(item);
|
||||
|
||||
|
||||
|
||||
if (col==0)
|
||||
{ // Compilation flag has been changed
|
||||
if (
|
||||
(item->checkState()==Qt::Unchecked) &&
|
||||
f->getInt("lastCompiled")==0 &&
|
||||
(item->checkState()==Qt::Unchecked) &&
|
||||
f->getInt("lastCompiled")==0 &&
|
||||
(installMapping[f]->checkState()==Qt::Checked))
|
||||
{
|
||||
installMapping[f]->setCheckState(Qt::Unchecked);
|
||||
@ -2600,14 +2601,14 @@ void instDialog::tableValueChanged(int row, int col)
|
||||
else if (col==1)
|
||||
{ // Installation flag has been changed
|
||||
if (
|
||||
(item->checkState()==Qt::Checked) &&
|
||||
f->getInt("lastCompiled")==0)
|
||||
(item->checkState()==Qt::Checked) &&
|
||||
f->getInt("lastCompiled")==0)
|
||||
{
|
||||
compileMapping[f]->setCheckState(Qt::Checked);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
setNextEnabled(0, isTableHasChecked());
|
||||
}
|
||||
|
||||
@ -2615,18 +2616,18 @@ bool instDialog::isTableHasChecked()
|
||||
{
|
||||
QTableWidgetItem *item;
|
||||
Firewall *f;
|
||||
|
||||
|
||||
t_fwList::iterator i;
|
||||
|
||||
|
||||
bool res=false;
|
||||
|
||||
|
||||
for(i=firewalls.begin();i!=firewalls.end();++i)
|
||||
{
|
||||
f=(*i);
|
||||
item=compileMapping[f];
|
||||
if(!item) return false;
|
||||
if(item->checkState()==Qt::Checked) res = true;
|
||||
|
||||
|
||||
item=installMapping[f];
|
||||
if(!item) return false;
|
||||
if(item->checkState()==Qt::Checked) res = true;
|
||||
@ -2641,10 +2642,10 @@ void instDialog::analyseInstallQueue(bool &fPix, bool &fCustInst)
|
||||
//FWOptions *fwopt;
|
||||
Management *mgmt;
|
||||
PolicyInstallScript *pis;
|
||||
|
||||
|
||||
fPix=false;
|
||||
fCustInst=true;
|
||||
|
||||
|
||||
t_fwList::iterator i;
|
||||
for(i=opList.begin(); i!=opList.end(); ++i)
|
||||
{
|
||||
@ -2652,17 +2653,17 @@ void instDialog::analyseInstallQueue(bool &fPix, bool &fCustInst)
|
||||
//fwopt=f->getOptionsObject();
|
||||
mgmt=f->getManagementObject();
|
||||
pis = mgmt->getPolicyInstallScript();
|
||||
|
||||
|
||||
fPix = fPix || f->getStr("platform")=="pix" || f->getStr("platform")=="fwsm" || f->getStr("platform")=="iosacl";
|
||||
fCustInst = fCustInst && !( pis->getCommand()=="" );
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug(("f:"+f->getName()).c_str());
|
||||
qDebug(("p:"+f->getStr("platform")).c_str());
|
||||
qDebug((QString("fPix:")+(fPix?"true":"false")).toAscii().constData());
|
||||
}
|
||||
|
||||
|
||||
if (fPix && !fCustInst) return;// nothing can change if we continue loop
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -85,7 +87,7 @@ instOptionsDialog::instOptionsDialog(QWidget *parent, instConf *_cnf) :
|
||||
m_dialog->rollback->setChecked( cnf->rollback );
|
||||
m_dialog->rollbackTime->setValue( cnf->rollbackTime );
|
||||
m_dialog->cancelRollbackIfSuccess->setChecked( cnf->cancelRollbackIfSuccess );
|
||||
|
||||
|
||||
if (platform=="pix" || platform=="fwsm" || platform=="iosacl")
|
||||
{
|
||||
m_dialog->copyFWB->hide();
|
||||
@ -137,7 +139,7 @@ instOptionsDialog::instOptionsDialog(QWidget *parent, instConf *_cnf) :
|
||||
|
||||
//progressBar->hide();
|
||||
//dlg->hideOption( dlg->stripComments );
|
||||
m_dialog->stripComments->hide();
|
||||
m_dialog->stripComments->hide();
|
||||
//dlg->compressScript->hide();
|
||||
|
||||
//if (platform=="pix" || platform=="fwsm")
|
||||
@ -178,7 +180,7 @@ instOptionsDialog::instOptionsDialog(QWidget *parent, instConf *_cnf) :
|
||||
}
|
||||
|
||||
//resize( minimumSizeHint() );
|
||||
|
||||
|
||||
//adjustSize();
|
||||
|
||||
//dlg->setFixedHeight( dlg->minimumSizeHint().height() );
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,12 +25,14 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "iosAdvancedDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -78,7 +80,7 @@ iosAdvancedDialog::iosAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
void iosAdvancedDialog::accept()
|
||||
{
|
||||
data.saveAll();
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,13 +25,14 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "iosaclAdvancedDialog.h"
|
||||
#include "SimpleTextEditor.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
#include "FWBSettings.h"
|
||||
|
||||
@ -73,13 +74,13 @@ iosaclAdvancedDialog::iosaclAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
{
|
||||
m_dialog = new Ui::iosaclAdvancedDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=o;
|
||||
|
||||
Firewall *fw=Firewall::cast(obj);
|
||||
FWOptions *fwopt=fw->getOptionsObject();
|
||||
string compiler=fwopt->getStr("compiler");
|
||||
if (compiler=="")
|
||||
if (compiler=="")
|
||||
{
|
||||
compiler=Resources::platform_res[fw->getStr("platform")]->getCompiler();
|
||||
}
|
||||
@ -139,27 +140,27 @@ iosaclAdvancedDialog::iosaclAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
s=QObject::tr("3 - Error Message");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("3");
|
||||
logLevelMapping.push_back("3");
|
||||
|
||||
s=QObject::tr("4 - Warning Message");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("4");
|
||||
logLevelMapping.push_back("4");
|
||||
|
||||
s=QObject::tr("5 - Normal but significant condition");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("5");
|
||||
logLevelMapping.push_back("5");
|
||||
|
||||
s=QObject::tr("6 - Informational");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("6");
|
||||
logLevelMapping.push_back("6");
|
||||
|
||||
s=QObject::tr("7 - Debug Message");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("7");
|
||||
logLevelMapping.push_back("7");
|
||||
|
||||
/* do not need to translate syslog facilities, but will use the same
|
||||
* method just in case */
|
||||
@ -213,7 +214,7 @@ iosaclAdvancedDialog::iosaclAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
/*
|
||||
* If none of the new iosacl_acl_* options is set and old iosacl_add_clear_statements
|
||||
* option is true, set iosacl_acl_basic to true.
|
||||
*
|
||||
*
|
||||
* If old option iosacl_add_clear_statements iss false, set
|
||||
* iosacl_acl_no_clear to true
|
||||
*/
|
||||
@ -231,33 +232,33 @@ iosaclAdvancedDialog::iosaclAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
data.registerOption( m_dialog->outputFileName , fwoptions,
|
||||
"output_file" );
|
||||
|
||||
data.registerOption( m_dialog->iosacl_acl_basic , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_acl_basic , fwoptions,
|
||||
"iosacl_acl_basic" );
|
||||
|
||||
/*
|
||||
data.registerOption( m_dialog->iosacl_acl_alwaysNew , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_acl_alwaysNew , fwoptions,
|
||||
"iosacl_acl_always_new" );
|
||||
*/
|
||||
|
||||
data.registerOption( m_dialog->iosacl_acl_no_clear , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_acl_no_clear , fwoptions,
|
||||
"iosacl_acl_no_clear" );
|
||||
|
||||
data.registerOption( m_dialog->iosacl_acl_substitution , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_acl_substitution , fwoptions,
|
||||
"iosacl_acl_substitution" );
|
||||
|
||||
data.registerOption( m_dialog->iosacl_acl_temp_addr , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_acl_temp_addr , fwoptions,
|
||||
"iosacl_acl_temp_addr" );
|
||||
|
||||
data.registerOption( m_dialog->iosacl_include_comments , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_include_comments , fwoptions,
|
||||
"iosacl_include_comments" );
|
||||
|
||||
data.registerOption( m_dialog->iosacl_regroup_commands , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_regroup_commands , fwoptions,
|
||||
"iosacl_regroup_commands" );
|
||||
|
||||
data.registerOption( m_dialog->iosacl_check_shadowing , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_check_shadowing , fwoptions,
|
||||
"check_shading" );
|
||||
|
||||
data.registerOption( m_dialog->iosacl_ignore_empty_groups , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_ignore_empty_groups , fwoptions,
|
||||
"ignore_empty_groups" );
|
||||
|
||||
data.registerOption( m_dialog->mgmt_ssh , fwoptions, "mgmt_ssh" );
|
||||
@ -276,10 +277,10 @@ iosaclAdvancedDialog::iosaclAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
|
||||
|
||||
/* page "Prolog/Epilog" */
|
||||
data.registerOption( m_dialog->iosacl_prolog_script , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_prolog_script , fwoptions,
|
||||
"iosacl_prolog_script" );
|
||||
|
||||
data.registerOption( m_dialog->iosacl_epilog_script , fwoptions,
|
||||
data.registerOption( m_dialog->iosacl_epilog_script , fwoptions,
|
||||
"iosacl_epilog_script" );
|
||||
|
||||
/* page Logging */
|
||||
@ -333,7 +334,7 @@ void iosaclAdvancedDialog::accept()
|
||||
// PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
|
||||
// pis->setCommand( installScript->text() );
|
||||
// pis->setArguments( installScriptArgs->text() );
|
||||
|
||||
|
||||
mgmt->setAddress( (Firewall::cast(obj))->getAddress() );
|
||||
|
||||
|
||||
@ -341,7 +342,7 @@ void iosaclAdvancedDialog::accept()
|
||||
pis->setCommand( m_dialog->installScript->text().toLatin1().constData() );
|
||||
pis->setArguments( m_dialog->installScriptArgs->text().toLatin1().constData() );
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "ipfAdvancedDialog.h"
|
||||
#include "SimpleTextEditor.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -58,7 +60,7 @@ ipfAdvancedDialog::ipfAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
{
|
||||
m_dialog = new Ui::ipfAdvancedDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=o;
|
||||
QStringList slm;
|
||||
|
||||
@ -114,7 +116,7 @@ ipfAdvancedDialog::ipfAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
|
||||
slm = getLogFacilities( obj->getStr("platform").c_str() );
|
||||
m_dialog->logFacility->clear();
|
||||
m_dialog->logFacility->addItems( getScreenNames( slm ));
|
||||
m_dialog->logFacility->addItems( getScreenNames( slm ));
|
||||
data.registerOption( m_dialog->logFacility , fwopt, "ipf_log_facility", slm);
|
||||
|
||||
data.registerOption( m_dialog->compiler , fwopt, "compiler" );
|
||||
@ -159,7 +161,7 @@ void ipfAdvancedDialog::accept()
|
||||
pis->setCommand( m_dialog->installScript->text().toLatin1().constData() );
|
||||
pis->setArguments( m_dialog->installScriptArgs->text().toLatin1().constData() );
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "ipfwAdvancedDialog.h"
|
||||
#include "SimpleTextEditor.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -57,7 +59,7 @@ ipfwAdvancedDialog::ipfwAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
{
|
||||
m_dialog = new Ui::ipfwAdvancedDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=o;
|
||||
|
||||
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
|
||||
@ -134,7 +136,7 @@ void ipfwAdvancedDialog::accept()
|
||||
pis->setCommand( m_dialog->installScript->text().toLatin1().constData() );
|
||||
pis->setArguments( m_dialog->installScriptArgs->text().toLatin1().constData() );
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,11 +17,13 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
#include "config.h"
|
||||
@ -30,7 +32,7 @@
|
||||
|
||||
#include "iptAdvancedDialog.h"
|
||||
#include "SimpleTextEditor.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -59,7 +61,7 @@ iptAdvancedDialog::iptAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
{
|
||||
m_dialog = new Ui::iptAdvancedDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=o;
|
||||
QStringList slm;
|
||||
|
||||
@ -79,7 +81,7 @@ iptAdvancedDialog::iptAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
m_dialog->ipt_fw_dir->setEnabled(false);
|
||||
fwoptions->setStr("firewall_dir","");
|
||||
}
|
||||
|
||||
|
||||
data.registerOption(m_dialog->logTCPseq, fwoptions, "log_tcp_seq" );
|
||||
data.registerOption(m_dialog->logTCPopt, fwoptions, "log_tcp_opt" );
|
||||
data.registerOption(m_dialog->logIPopt, fwoptions, "log_ip_opt" );
|
||||
@ -88,19 +90,19 @@ iptAdvancedDialog::iptAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
slm = getLogLevels( obj->getStr("platform").c_str() );
|
||||
m_dialog->logLevel->clear();
|
||||
m_dialog->logLevel->addItems( getScreenNames(slm));
|
||||
data.registerOption(m_dialog-> logLevel, fwoptions, "log_level", slm);
|
||||
|
||||
data.registerOption(m_dialog-> logLevel, fwoptions, "log_level", slm);
|
||||
|
||||
data.registerOption(m_dialog->useULOG, fwoptions, "use_ULOG" );
|
||||
data.registerOption(m_dialog->cprange, fwoptions, "ulog_cprange" );
|
||||
data.registerOption(m_dialog->qthreshold, fwoptions, "ulog_qthreshold" );
|
||||
data.registerOption(m_dialog->nlgroup, fwoptions, "ulog_nlgroup" );
|
||||
data.registerOption(m_dialog->logprefix, fwoptions, "log_prefix" );
|
||||
|
||||
|
||||
slm=getLimitSuffixes( obj->getStr("platform").c_str() );
|
||||
m_dialog->logLimitSuffix->clear();
|
||||
m_dialog->logLimitSuffix->addItems(getScreenNames(slm));
|
||||
data.registerOption(m_dialog-> logLimitSuffix, fwoptions, "limit_suffix", slm);
|
||||
|
||||
data.registerOption(m_dialog-> logLimitSuffix, fwoptions, "limit_suffix", slm);
|
||||
|
||||
data.registerOption(m_dialog->logLimitVal, fwoptions, "limit_value");
|
||||
data.registerOption(m_dialog->logAll, fwoptions, "log_all");
|
||||
data.registerOption(m_dialog->compiler, fwoptions, "compiler");
|
||||
@ -126,8 +128,8 @@ iptAdvancedDialog::iptAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
m_dialog->actionOnReject->clear();
|
||||
m_dialog->actionOnReject->addItems(getScreenNames(slm));
|
||||
data.registerOption(m_dialog-> actionOnReject,
|
||||
fwoptions,"action_on_reject", slm);
|
||||
|
||||
fwoptions,"action_on_reject", slm);
|
||||
|
||||
data.registerOption(m_dialog->mgmt_ssh, fwoptions, "mgmt_ssh" );
|
||||
data.registerOption(m_dialog->mgmt_addr, fwoptions, "mgmt_addr" );
|
||||
data.registerOption(m_dialog->addVirtualsforNAT,
|
||||
@ -151,25 +153,25 @@ iptAdvancedDialog::iptAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
m_dialog->installScript->setText( pis->getCommand().c_str() );
|
||||
m_dialog->installScriptArgs->setText( pis->getArguments().c_str() );
|
||||
|
||||
|
||||
|
||||
/* page "Prolog/Epilog" */
|
||||
|
||||
data.registerOption(m_dialog->prolog_script ,fwoptions, "prolog_script" );
|
||||
|
||||
|
||||
slm = getPrologPlaces( obj->getStr("platform").c_str() );
|
||||
m_dialog->prologPlace->clear();
|
||||
m_dialog->prologPlace->addItems(getScreenNames(slm));
|
||||
data.registerOption(m_dialog-> prologPlace, fwoptions, "prolog_place", slm);
|
||||
|
||||
data.registerOption(m_dialog-> prologPlace, fwoptions, "prolog_place", slm);
|
||||
|
||||
data.registerOption(m_dialog->epilog_script ,fwoptions, "epilog_script" );
|
||||
|
||||
|
||||
data.loadAll();
|
||||
switchLOG_ULOG();
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
|
||||
// int port=fwbdm->getPort();
|
||||
// if (port==-1)
|
||||
// if (port==-1)
|
||||
// port= Resources::global_res->getResourceInt("/FWBuilderResources/FWBD/port");
|
||||
// mgmt_fwbd_port->set_value( port );
|
||||
//
|
||||
@ -206,18 +208,18 @@ void iptAdvancedDialog::accept()
|
||||
|
||||
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
|
||||
assert(mgmt!=NULL);
|
||||
|
||||
|
||||
data.saveAll();
|
||||
|
||||
/********************* data for fwbd and install script **************/
|
||||
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
|
||||
|
||||
mgmt->setAddress( (Firewall::cast(obj))->getAddress() );
|
||||
|
||||
|
||||
pis->setCommand( m_dialog->installScript->text().toLatin1().constData() );
|
||||
pis->setArguments( m_dialog->installScriptArgs->text().toLatin1().constData() );
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,18 +17,20 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "linksysAdvancedDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -49,13 +51,13 @@ linksysAdvancedDialog::~linksysAdvancedDialog()
|
||||
{
|
||||
delete m_dialog;
|
||||
}
|
||||
|
||||
|
||||
linksysAdvancedDialog::linksysAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
: QDialog(parent)
|
||||
{
|
||||
m_dialog = new Ui::linksysAdvancedDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=o;
|
||||
|
||||
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
|
||||
@ -81,14 +83,14 @@ linksysAdvancedDialog::linksysAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
threeStateMapping.push_back("0");
|
||||
|
||||
/* set default prompts */
|
||||
if (fwopt->getStr("prompt1").empty())
|
||||
if (fwopt->getStr("prompt1").empty())
|
||||
Resources::os_res["linksys"]->Resources::setDefaultOption(fwopt,
|
||||
"/FWBuilderResources/Target/options/default/prompt1");
|
||||
|
||||
if (fwopt->getStr("prompt2").empty())
|
||||
if (fwopt->getStr("prompt2").empty())
|
||||
Resources::os_res["linksys"]->Resources::setDefaultOption(fwopt,
|
||||
"/FWBuilderResources/Target/options/default/prompt2");
|
||||
|
||||
|
||||
data.registerOption( m_dialog->linksys_prompt1,
|
||||
fwopt,
|
||||
"prompt1" );
|
||||
@ -129,7 +131,7 @@ void linksysAdvancedDialog::accept()
|
||||
|
||||
data.saveAll();
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@ -142,9 +144,9 @@ void linksysAdvancedDialog::setDefaultPrompts()
|
||||
{
|
||||
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
|
||||
assert(fwopt!=NULL);
|
||||
m_dialog->linksys_prompt1->setText(
|
||||
m_dialog->linksys_prompt1->setText(
|
||||
Resources::getTargetOptionStr("linksys","default/prompt1").c_str() );
|
||||
m_dialog->linksys_prompt2->setText(
|
||||
m_dialog->linksys_prompt2->setText(
|
||||
Resources::getTargetOptionStr("linksys","default/prompt2").c_str() );
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,18 +17,19 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "linux24AdvancedDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -41,6 +42,7 @@
|
||||
#include <qstackedwidget.h>
|
||||
#include <qregexp.h>
|
||||
|
||||
#include "FWWindow.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
@ -77,25 +79,25 @@ linux24AdvancedDialog::linux24AdvancedDialog(QWidget *parent,FWObject *o)
|
||||
|
||||
|
||||
data.registerOption( m_dialog->linux24_log_martians,
|
||||
fwopt,
|
||||
fwopt,
|
||||
"linux24_log_martians", threeStateMapping);
|
||||
data.registerOption( m_dialog->linux24_accept_redirects,
|
||||
fwopt,
|
||||
fwopt,
|
||||
"linux24_accept_redirects", threeStateMapping);
|
||||
data.registerOption( m_dialog->linux24_icmp_echo_ignore_all,
|
||||
fwopt,
|
||||
fwopt,
|
||||
"linux24_icmp_echo_ignore_all", threeStateMapping);
|
||||
data.registerOption( m_dialog->linux24_icmp_echo_ignore_broadcasts,
|
||||
fwopt,
|
||||
fwopt,
|
||||
"linux24_icmp_echo_ignore_broadcasts", threeStateMapping);
|
||||
data.registerOption( m_dialog->linux24_icmp_ignore_bogus_error_responses,
|
||||
fwopt,
|
||||
fwopt,
|
||||
"linux24_icmp_ignore_bogus_error_responses", threeStateMapping);
|
||||
data.registerOption( m_dialog->linux24_ip_dynaddr,
|
||||
fwopt,
|
||||
fwopt,
|
||||
"linux24_ip_dynaddr", threeStateMapping);
|
||||
data.registerOption( m_dialog->linux24_rp_filter,
|
||||
fwopt,
|
||||
fwopt,
|
||||
"linux24_rp_filter", threeStateMapping);
|
||||
data.registerOption( m_dialog->linux24_accept_source_route,
|
||||
fwopt,
|
||||
@ -163,7 +165,7 @@ void linux24AdvancedDialog::accept()
|
||||
|
||||
data.saveAll();
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -134,10 +136,10 @@ class MessageBoxNeverUpgradePredicate: public libfwbuilder::XMLTools::UpgradePre
|
||||
{
|
||||
public:
|
||||
MessageBoxNeverUpgradePredicate() {}
|
||||
|
||||
virtual bool operator()(const std::string &msg) const
|
||||
{
|
||||
QMessageBox::information( NULL , "Firewall Builder",
|
||||
|
||||
virtual bool operator()(const std::string &msg) const
|
||||
{
|
||||
QMessageBox::information( NULL , "Firewall Builder",
|
||||
QObject::tr(
|
||||
"The library file you are trying to open\n\
|
||||
has been saved in an older version of\n\
|
||||
@ -182,7 +184,7 @@ list<libData>::iterator listOfLibraries::add(const QString &path, bool load)
|
||||
} catch(FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
NULL,"Firewall Builder",
|
||||
NULL,"Firewall Builder",
|
||||
QObject::tr("Error loading file %1:\n%2").
|
||||
arg(path).arg(ex.toString().c_str()),
|
||||
QObject::tr("&Continue"), QString::null,QString::null,
|
||||
@ -210,7 +212,7 @@ list<libData>::iterator listOfLibraries::add(const QString &path, bool load)
|
||||
)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
NULL,"Firewall Builder",
|
||||
NULL,"Firewall Builder",
|
||||
QObject::tr("Duplicate library '%1'").arg(QString::fromUtf8(name)),
|
||||
QObject::tr("&Continue"), QString::null,QString::null,
|
||||
0, 1 );
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -47,11 +49,11 @@ longTextDialog::~longTextDialog()
|
||||
|
||||
longTextDialog::longTextDialog(QWidget *p,
|
||||
const QString &txt,const QString <xt)
|
||||
: QDialog(p)
|
||||
: QDialog(p)
|
||||
{
|
||||
m_dialog = new Ui::longTextDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
setWindowTitle("Firewall Builder");
|
||||
|
||||
m_dialog->dlgText->setText(txt);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,18 +17,20 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "macosxAdvancedDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -54,7 +56,7 @@ macosxAdvancedDialog::macosxAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
{
|
||||
m_dialog = new Ui::macosxAdvancedDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=o;
|
||||
|
||||
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
|
||||
@ -107,7 +109,7 @@ void macosxAdvancedDialog::accept()
|
||||
|
||||
data.saveAll();
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
188
src/gui/main.cpp
188
src/gui/main.cpp
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -18,13 +18,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "VERSION.h"
|
||||
@ -59,9 +61,8 @@
|
||||
*/
|
||||
|
||||
#include "FWBSettings.h"
|
||||
#include "RCS.h"
|
||||
#include "RCS.h"
|
||||
#include "FWWindow.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWObjectClipboard.h"
|
||||
#include "FWBTree.h"
|
||||
#include "platforms.h"
|
||||
@ -130,19 +131,12 @@ static QString objid;
|
||||
|
||||
QApplication *app = NULL;
|
||||
FWWindow *mw = NULL;
|
||||
ObjectManipulator *om = NULL;
|
||||
ObjectEditor *oe = NULL;
|
||||
QTextEdit *oi = NULL;
|
||||
FWBSettings *st = NULL;
|
||||
findDialog *fd = NULL;
|
||||
int fwbdebug = 0;
|
||||
int fwbdebug = 1;
|
||||
bool safemode = false;
|
||||
bool registered = false;
|
||||
bool gui_experiment1 = false;
|
||||
|
||||
listOfLibraries *addOnLibs;
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#ifndef HAVE_CFMAKERAW
|
||||
@ -158,83 +152,83 @@ static inline void cfmakeraw(struct termios *termios_p)
|
||||
|
||||
#ifndef HAVE_FORKPTY
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
//#include <sys/stream.h>
|
||||
#include <sys/stropts.h>
|
||||
#include <sys/stropts.h>
|
||||
|
||||
/* fork_pty() remplacement for Solaris.
|
||||
* ignore the last two arguments
|
||||
* for the moment
|
||||
*/
|
||||
/* fork_pty() remplacement for Solaris.
|
||||
* ignore the last two arguments
|
||||
* for the moment
|
||||
*/
|
||||
int forkpty (int *amaster, char *name, void *unused1, void *unused2)
|
||||
{
|
||||
int master, slave;
|
||||
char *slave_name;
|
||||
pid_t pid;
|
||||
int master, slave;
|
||||
char *slave_name;
|
||||
pid_t pid;
|
||||
|
||||
master = open("/dev/ptmx", O_RDWR);
|
||||
if (master < 0)
|
||||
return -1;
|
||||
master = open("/dev/ptmx", O_RDWR);
|
||||
if (master < 0)
|
||||
return -1;
|
||||
|
||||
if (grantpt (master) < 0)
|
||||
{
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
if (grantpt (master) < 0)
|
||||
{
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (unlockpt (master) < 0)
|
||||
{
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
if (unlockpt (master) < 0)
|
||||
{
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
|
||||
slave_name = ptsname (master);
|
||||
if (slave_name == NULL)
|
||||
{
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
slave_name = ptsname (master);
|
||||
if (slave_name == NULL)
|
||||
{
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
|
||||
slave = open (slave_name, O_RDWR);
|
||||
if (slave < 0)
|
||||
{
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
slave = open (slave_name, O_RDWR);
|
||||
if (slave < 0)
|
||||
{
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ioctl (slave, I_PUSH, "ptem") < 0
|
||||
|| ioctl (slave, I_PUSH, "ldterm") < 0)
|
||||
{
|
||||
close (slave);
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
if (ioctl (slave, I_PUSH, "ptem") < 0
|
||||
|| ioctl (slave, I_PUSH, "ldterm") < 0)
|
||||
{
|
||||
close (slave);
|
||||
close (master);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (amaster)
|
||||
*amaster = master;
|
||||
if (amaster)
|
||||
*amaster = master;
|
||||
|
||||
if (name)
|
||||
strcpy (name, slave_name);
|
||||
if (name)
|
||||
strcpy (name, slave_name);
|
||||
|
||||
pid = fork ();
|
||||
switch (pid)
|
||||
{
|
||||
case -1: /* Error */
|
||||
return -1;
|
||||
case 0: /* Child */
|
||||
close (master);
|
||||
dup2 (slave, STDIN_FILENO);
|
||||
dup2 (slave, STDOUT_FILENO);
|
||||
dup2 (slave, STDERR_FILENO);
|
||||
return 0;
|
||||
default: /* Parent */
|
||||
close (slave);
|
||||
return pid;
|
||||
}
|
||||
pid = fork ();
|
||||
switch (pid)
|
||||
{
|
||||
case -1: /* Error */
|
||||
return -1;
|
||||
case 0: /* Child */
|
||||
close (master);
|
||||
dup2 (slave, STDIN_FILENO);
|
||||
dup2 (slave, STDOUT_FILENO);
|
||||
dup2 (slave, STDERR_FILENO);
|
||||
return 0;
|
||||
default: /* Parent */
|
||||
close (slave);
|
||||
return pid;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -340,17 +334,19 @@ void usage()
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
bool ssh_wrapper=false;
|
||||
const char *arg[64];
|
||||
int i, j;
|
||||
|
||||
filename="";
|
||||
objid="";
|
||||
fwbdebug=0;
|
||||
fwbdebug=1;
|
||||
safemode=false;
|
||||
|
||||
if(fwbdebug)
|
||||
qDebug("main()");
|
||||
/*
|
||||
* I am using njamd a lot, but gtkmm and probably some other libs
|
||||
* generate trap in their global static initialization code. Therefore
|
||||
@ -399,11 +395,11 @@ int main( int argc, char ** argv )
|
||||
*
|
||||
* So, installation data goes to HKLM Software\NetCitadel\FirewallBuilder
|
||||
* and settings to HKCU Software\NetCitadel\FirewallBuilder2
|
||||
*
|
||||
*
|
||||
* fwbuilder-lm determines folder path for the license file by
|
||||
* reading key Install_Dir under HKLM Software\NetCitadel\FirewallBuilder
|
||||
*/
|
||||
st = new FWBSettings();
|
||||
st = new FWBSettings();
|
||||
|
||||
/* initialize preferences */
|
||||
st->init();
|
||||
@ -412,7 +408,7 @@ int main( int argc, char ** argv )
|
||||
QString sshcmd=st->getSSHPath();
|
||||
|
||||
if (sshcmd.isEmpty()) sshcmd="ssh";
|
||||
|
||||
|
||||
arg[0]=strdup( sshcmd.toLatin1().constData() );
|
||||
|
||||
if (fwbdebug)
|
||||
@ -576,7 +572,7 @@ int main( int argc, char ** argv )
|
||||
case 's':
|
||||
safemode = true;
|
||||
break;
|
||||
|
||||
|
||||
case 'g':
|
||||
gui_experiment1 = true;
|
||||
break;
|
||||
@ -589,13 +585,13 @@ int main( int argc, char ** argv )
|
||||
{
|
||||
|
||||
if (fwbdebug) qDebug("initializing ...");
|
||||
|
||||
|
||||
/* need to initialize in order to be able to use FWBSettings */
|
||||
init(argv);
|
||||
init_platforms();
|
||||
|
||||
if (fwbdebug) qDebug("creating app ...");
|
||||
|
||||
|
||||
//QApplication::setDesktopSettingsAware(desktopaware);
|
||||
app = new QApplication( argc, argv );
|
||||
app->setOrganizationName(QLatin1String("NetCitadel LLC"));
|
||||
@ -605,7 +601,7 @@ int main( int argc, char ** argv )
|
||||
|
||||
if (fwbdebug) qDebug("reading settings ...");
|
||||
|
||||
st = new FWBSettings();
|
||||
st = new FWBSettings();
|
||||
|
||||
if (fwbdebug) qDebug("creating pixmap factory ...");
|
||||
|
||||
@ -645,7 +641,6 @@ int main( int argc, char ** argv )
|
||||
|
||||
if (fwbdebug) qDebug("creating widgets ...");
|
||||
|
||||
new FWBTree();
|
||||
new FWObjectDatabase();
|
||||
new FWObjectClipboard();
|
||||
|
||||
@ -653,7 +648,7 @@ int main( int argc, char ** argv )
|
||||
|
||||
QString local = QLocale::system().name();
|
||||
QTranslator translator(0);
|
||||
translator.load(QLatin1String("fwbuilder_") +
|
||||
translator.load(QLatin1String("fwbuilder_") +
|
||||
QString(local), localepath.c_str());
|
||||
app->installTranslator (&translator);
|
||||
|
||||
@ -672,17 +667,7 @@ int main( int argc, char ** argv )
|
||||
|
||||
if (fwbdebug) qDebug("loading libraries ...");
|
||||
|
||||
addOnLibs = new listOfLibraries();
|
||||
|
||||
mw = new FWWindow();
|
||||
oe = new ObjectEditor((QWidget*)mw->m_mainWindow->objectEditorStack);
|
||||
// oe->open(mw->db());
|
||||
oe->setCloseButton(mw->m_mainWindow->closeObjectEditorButton);
|
||||
oe->setApplyButton(mw->m_mainWindow->applyObjectEditorButton);
|
||||
oe->hide();
|
||||
fd = new findDialog(mw);
|
||||
fd->hide();
|
||||
|
||||
mw->setSafeMode(safemode);
|
||||
mw->setStartupFileName(filename);
|
||||
|
||||
@ -698,23 +683,20 @@ int main( int argc, char ** argv )
|
||||
|
||||
app->exec();
|
||||
|
||||
|
||||
oe->hide();
|
||||
fd->hide();
|
||||
mw->hide(); // must do this before settings object is destroyed
|
||||
|
||||
addOnLibs->save(); // ditto
|
||||
mw->getAddOnLibs()->save(); // ditto
|
||||
|
||||
if ( st->getStartupAction()==1 )
|
||||
{
|
||||
/* save the state of the GUI (opened firewall, opened object tree page, etc */
|
||||
FWObject *o=mw->getVisibleFirewall();
|
||||
FWObject *o=mw->getVisibleFirewalls();
|
||||
if (fwbdebug)
|
||||
qDebug("Main: closing. VisibleFirewall = %p",o);
|
||||
|
||||
if (o) st->setStr("UI/visibleFirewall", o->getId().c_str() );
|
||||
|
||||
o=om->getOpened();
|
||||
o=mw->getOpened();
|
||||
if (o) st->setStr("UI/visibleObject", o->getId().c_str() );
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -31,7 +33,6 @@
|
||||
|
||||
#include "newFirewallDialog.h"
|
||||
#include "InterfaceData.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
#include "ObjConflictResolutionDialog.h"
|
||||
#include "upgradePredicate.h"
|
||||
@ -72,14 +73,14 @@ newFirewallDialog::newFirewallDialog() : QDialog()
|
||||
{
|
||||
m_dialog = new Ui::newFirewallDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
m_dialog->nextButton,
|
||||
m_dialog->finishButton,
|
||||
m_dialog->backButton,
|
||||
m_dialog->cancelButton,
|
||||
m_dialog->titleLabel);
|
||||
|
||||
|
||||
/*connect( m_dialog->nextButton, SIGNAL( clicked() ),
|
||||
this, SLOT( nextClicked() ));
|
||||
connect( m_dialog->backButton, SIGNAL( clicked() ),
|
||||
@ -88,8 +89,8 @@ newFirewallDialog::newFirewallDialog() : QDialog()
|
||||
this, SLOT( finishClicked() ));
|
||||
connect( m_dialog->cancelButton, SIGNAL( clicked() ),
|
||||
this, SLOT( cancelClicked() ));*/
|
||||
|
||||
nfw = NULL;
|
||||
|
||||
nfw = NULL;
|
||||
tmpldb = NULL;
|
||||
snmpPollCompleted = false;
|
||||
q = NULL;
|
||||
@ -117,7 +118,7 @@ newFirewallDialog::newFirewallDialog() : QDialog()
|
||||
m_dialog->iface_dyn->setToolTip(wordWrap(tr("Check option 'dynamic address' for the interface that gets its IP address dynamically via DHCP or PPP protocol.") ,80 ));
|
||||
m_dialog->iface_unnum->setToolTip(wordWrap(tr("Check option 'Unnumbered interface' for the interface that does not have an IP address. Examples of interfaces of this kind are those used to terminate PPPoE or VPN tunnels.") ,80 ));
|
||||
m_dialog->obj_name->setFocus();
|
||||
|
||||
|
||||
showPage(0);
|
||||
}
|
||||
|
||||
@ -198,7 +199,7 @@ void newFirewallDialog::monitor()
|
||||
const map<int, Interface> &intf = q->getInterfaces();
|
||||
for(map<int, Interface>::const_iterator i=intf.begin();i!=intf.end(); ++i)
|
||||
{
|
||||
if ( i->second.isUp() )
|
||||
if ( i->second.isUp() )
|
||||
{
|
||||
InterfaceData idata( i->second );
|
||||
|
||||
@ -210,7 +211,7 @@ void newFirewallDialog::monitor()
|
||||
if (idata.isBridgePort) dn+="bridge";
|
||||
|
||||
QStringList qsl;
|
||||
qsl << idata.name.c_str()
|
||||
qsl << idata.name.c_str()
|
||||
<< idata.label.c_str()
|
||||
<< idata.address.c_str()
|
||||
<< idata.netmask.c_str()
|
||||
@ -244,10 +245,10 @@ void newFirewallDialog::getInterfacesViaSNMP()
|
||||
|
||||
string rcomm=m_dialog->snmp_community->text().toLatin1().constData();
|
||||
|
||||
if ( rcomm.empty() )
|
||||
if ( rcomm.empty() )
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Missing SNMP community string."),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return ;
|
||||
@ -257,7 +258,7 @@ void newFirewallDialog::getInterfacesViaSNMP()
|
||||
|
||||
IPAddress addr;
|
||||
QString name=m_dialog->obj_name->text().toLatin1().constData();
|
||||
try
|
||||
try
|
||||
{
|
||||
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );
|
||||
QString a = getAddrByName(name);
|
||||
@ -266,7 +267,7 @@ void newFirewallDialog::getInterfacesViaSNMP()
|
||||
} catch (FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Address of %1 could not be obtained via DNS")
|
||||
.arg(m_dialog->obj_name->text()),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
@ -283,7 +284,7 @@ void newFirewallDialog::getInterfacesViaSNMP()
|
||||
|
||||
timer->setSingleShot(false);
|
||||
timer->start(0);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
logger = q->start_operation();
|
||||
@ -336,7 +337,7 @@ void newFirewallDialog::backClicked()
|
||||
void newFirewallDialog::showPage(const int page)
|
||||
{
|
||||
FakeWizard::showPage(page);
|
||||
|
||||
|
||||
int p = page;
|
||||
|
||||
// p is a page number _after_ it changed
|
||||
@ -397,13 +398,13 @@ void newFirewallDialog::showPage(const int page)
|
||||
FWObject *tlib = mw->db()->getById(TEMPLATE_LIB);
|
||||
if (tlib==NULL)
|
||||
{
|
||||
FWObject *cl = om->getCurrentLib();
|
||||
FWObject *cl = mw->getCurrentLib();
|
||||
mw->loadLibrary(tempfname);
|
||||
unloadTemplatesLib = true;
|
||||
om->loadObjects();
|
||||
mw->loadObjects();
|
||||
tlib = mw->db()->getById(TEMPLATE_LIB);
|
||||
/* restore library that was opened prior loading templates */
|
||||
om->openLib(cl);
|
||||
mw->openLib(cl);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -429,7 +430,7 @@ void newFirewallDialog::showPage(const int page)
|
||||
QListWidgetItem *twi = new QListWidgetItem;
|
||||
twi->setIcon( QIcon(pm) );
|
||||
twi->setText( QString(o->getName().c_str()) );
|
||||
|
||||
|
||||
m_dialog->templateList->addItem( twi );
|
||||
templates[ m_dialog->templateList->item( m_dialog->templateList->count()-1 ) ]=o;
|
||||
}
|
||||
@ -444,7 +445,7 @@ void newFirewallDialog::fillInterfaceSLList()
|
||||
{
|
||||
|
||||
QTreeWidgetItem *itm = m_dialog->iface_list->topLevelItem(0);// firstChild();
|
||||
|
||||
|
||||
int itm_index = 0;
|
||||
|
||||
m_dialog->iface_sl_list->clear();
|
||||
@ -464,7 +465,7 @@ void newFirewallDialog::fillInterfaceSLList()
|
||||
else
|
||||
idata.address = QObject::tr("dynamic").toLatin1().constData();
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
idata.guessSecurityLevel( readPlatform(m_dialog->platform).toLatin1().constData() );
|
||||
}
|
||||
@ -473,7 +474,7 @@ void newFirewallDialog::fillInterfaceSLList()
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder", ex.toString().c_str(),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
|
||||
|
||||
showPage( 2 );
|
||||
return;
|
||||
}
|
||||
@ -484,7 +485,7 @@ void newFirewallDialog::fillInterfaceSLList()
|
||||
<< idata.address.c_str()
|
||||
<< QString::number(idata.securityLevel);
|
||||
new QTreeWidgetItem(m_dialog->iface_sl_list, qsl);
|
||||
|
||||
|
||||
itm_index++;
|
||||
itm=m_dialog->iface_list->topLevelItem(itm_index);
|
||||
}
|
||||
@ -597,7 +598,7 @@ void newFirewallDialog::addInterface()
|
||||
catch (FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Illegal address '%1/%2'").arg(addr).arg(netm),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return;
|
||||
@ -608,14 +609,14 @@ void newFirewallDialog::addInterface()
|
||||
<< m_dialog->iface_label->text()
|
||||
<< addr << netm << dn
|
||||
<< m_dialog->iface_physaddr->text();
|
||||
|
||||
|
||||
new QTreeWidgetItem(m_dialog->iface_list, qsl);
|
||||
}
|
||||
|
||||
void newFirewallDialog::selectedInterface(QTreeWidgetItem*cur,QTreeWidgetItem*)
|
||||
{
|
||||
QTreeWidgetItem *itm = cur; //current item
|
||||
|
||||
|
||||
m_dialog->iface_name->setText( itm->text(0) );
|
||||
m_dialog->iface_label->setText( itm->text(1) );
|
||||
m_dialog->iface_addr->setText( itm->text(2) );
|
||||
@ -649,7 +650,7 @@ void newFirewallDialog::deleteInterface()
|
||||
{
|
||||
QTreeWidgetItem *itm = m_dialog->iface_list->currentItem();
|
||||
if (itm==NULL) return;
|
||||
m_dialog->iface_list->takeTopLevelItem(
|
||||
m_dialog->iface_list->takeTopLevelItem(
|
||||
m_dialog->iface_list->indexOfTopLevelItem(itm) );
|
||||
}
|
||||
|
||||
@ -657,9 +658,9 @@ void newFirewallDialog::adjustSL(QTreeWidgetItem *itm1)
|
||||
{
|
||||
// interface 1 is above 2. Adjust their security levels accordingly
|
||||
int sl1 = itm1->text(3).toInt();
|
||||
|
||||
|
||||
int index = itm1->treeWidget()->indexOfTopLevelItem(itm1);
|
||||
|
||||
|
||||
QTreeWidgetItem *itm2 = itm1->treeWidget()->topLevelItem(index+1);
|
||||
QTreeWidgetItem *itm3 = itm1->treeWidget()->topLevelItem(index-1);
|
||||
|
||||
@ -682,7 +683,7 @@ void newFirewallDialog::upInterface()
|
||||
QTreeWidgetItem *itm1 = m_dialog->iface_sl_list->currentItem();
|
||||
if (itm1==NULL) return;
|
||||
int index = m_dialog->iface_sl_list->indexOfTopLevelItem(itm1);
|
||||
|
||||
|
||||
QTreeWidgetItem *itm2 = m_dialog->iface_sl_list->topLevelItem(index-1);
|
||||
if (itm2==NULL) return;
|
||||
m_dialog->iface_sl_list->takeTopLevelItem(index);
|
||||
@ -692,11 +693,11 @@ void newFirewallDialog::upInterface()
|
||||
|
||||
void newFirewallDialog::downInterface()
|
||||
{
|
||||
|
||||
|
||||
QTreeWidgetItem *itm1 = m_dialog->iface_sl_list->currentItem();
|
||||
if (itm1==NULL) return;
|
||||
int index = m_dialog->iface_sl_list->indexOfTopLevelItem(itm1);
|
||||
|
||||
|
||||
QTreeWidgetItem *itm2 = m_dialog->iface_sl_list->topLevelItem(index+1);
|
||||
if (itm2==NULL) return;
|
||||
m_dialog->iface_sl_list->takeTopLevelItem(index);
|
||||
@ -712,7 +713,7 @@ void newFirewallDialog::cancelClicked()
|
||||
void newFirewallDialog::finishClicked()
|
||||
{
|
||||
int p = currentPage();
|
||||
|
||||
|
||||
if (p==2) fillInterfaceSLList();
|
||||
|
||||
if (p==4)
|
||||
@ -721,7 +722,7 @@ void newFirewallDialog::finishClicked()
|
||||
FWObject *template_fw=templates[itm];
|
||||
assert (template_fw!=NULL);
|
||||
|
||||
FWObject *no = om->duplicateObject(om->getCurrentLib(),
|
||||
FWObject *no = mw->duplicateObject(mw->getCurrentLib(),
|
||||
template_fw,
|
||||
m_dialog->obj_name->text(),
|
||||
false ); // do not ask to autorename
|
||||
@ -747,7 +748,7 @@ void newFirewallDialog::finishClicked()
|
||||
} else
|
||||
{
|
||||
FWObject *o;
|
||||
o=om->createObject(Firewall::TYPENAME, m_dialog->obj_name->text() );
|
||||
o=mw->createObject(Firewall::TYPENAME, m_dialog->obj_name->text() );
|
||||
|
||||
if (o==NULL)
|
||||
{
|
||||
@ -792,7 +793,7 @@ void newFirewallDialog::finishClicked()
|
||||
|
||||
int sl = itm2->text(3).toInt();
|
||||
|
||||
Interface *oi = Interface::cast(om->createObject(nfw,Interface::TYPENAME,
|
||||
Interface *oi = Interface::cast(mw->createObject(nfw,Interface::TYPENAME,
|
||||
name));
|
||||
#ifdef USE_INTERFACE_POLICY
|
||||
oi->add(new InterfacePolicy());
|
||||
@ -807,13 +808,13 @@ void newFirewallDialog::finishClicked()
|
||||
if (!dyn && !unnum && !bridgeport)
|
||||
{
|
||||
QString addrname=QString("%1:%2:ip").arg(m_dialog->obj_name->text()).arg(name);
|
||||
IPv4 *oa = IPv4::cast(om->createObject(oi, IPv4::TYPENAME,addrname));
|
||||
IPv4 *oa = IPv4::cast(mw->createObject(oi, IPv4::TYPENAME,addrname));
|
||||
oa->setAddress( addr.toLatin1().constData() );
|
||||
oa->setNetmask( netmask.toLatin1().constData() );
|
||||
}
|
||||
// updateObjName has a side effect: it causes redraw of the ruleset
|
||||
// views in the main window
|
||||
om->updateObjName(oi,"","",false);
|
||||
mw->updateObjName(oi,"","",false);
|
||||
|
||||
itm_index++;
|
||||
itm=m_dialog->iface_list->topLevelItem(itm_index);
|
||||
@ -827,7 +828,7 @@ void newFirewallDialog::finishClicked()
|
||||
string tlibID = tlib->getId();
|
||||
if (fwbdebug)
|
||||
qDebug("newFirewallDialog::accept Delete template library");
|
||||
om->delObj(tlib,false);
|
||||
mw->delObj(tlib,false);
|
||||
|
||||
/*
|
||||
* deleting an object places it in the "Deleted objects" library, so
|
||||
@ -840,7 +841,7 @@ void newFirewallDialog::finishClicked()
|
||||
if (delObjLib!=NULL && delObjLib->getById(tlibID)!=NULL)
|
||||
{
|
||||
if (fwbdebug) qDebug("newFirewallDialog::accept Delete library of templates from 'Deleted objects'");
|
||||
om->delObj(tlib,false); // this time from deleted objects lib
|
||||
mw->delObj(tlib,false); // this time from deleted objects lib
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -50,7 +52,7 @@ newGroupDialog::newGroupDialog(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
m_dialog = new Ui::newGroupDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
fillLibraries(m_dialog->libs,mw->db(),true); // only read-write libs
|
||||
m_dialog->obj_name->setFocus();
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -32,7 +34,6 @@
|
||||
|
||||
#include "newHostDialog.h"
|
||||
#include "InterfaceData.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
#include "ObjConflictResolutionDialog.h"
|
||||
#include "upgradePredicate.h"
|
||||
@ -76,15 +77,15 @@ newHostDialog::newHostDialog() : QDialog()
|
||||
{
|
||||
m_dialog = new Ui::newHostDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
|
||||
setControlWidgets(this, m_dialog->stackedWidget,
|
||||
m_dialog->nextButton,
|
||||
m_dialog->finishButton,
|
||||
m_dialog->backButton,
|
||||
m_dialog->cancelButton,
|
||||
m_dialog->titleLabel);
|
||||
|
||||
nhst=NULL;
|
||||
|
||||
nhst=NULL;
|
||||
tmpldb = NULL;
|
||||
snmpPollCompleted=false;
|
||||
q=NULL;
|
||||
@ -191,7 +192,7 @@ void newHostDialog::monitor()
|
||||
const map<int, Interface> &intf = q->getInterfaces();
|
||||
for(map<int, Interface>::const_iterator i=intf.begin();i!=intf.end(); ++i)
|
||||
{
|
||||
if ( i->second.isUp() )
|
||||
if ( i->second.isUp() )
|
||||
{
|
||||
InterfaceData idata( i->second );
|
||||
|
||||
@ -236,10 +237,10 @@ void newHostDialog::getInterfacesViaSNMP()
|
||||
|
||||
string rcomm=m_dialog->snmp_community->text().toLatin1().constData();
|
||||
|
||||
if ( rcomm.empty() )
|
||||
if ( rcomm.empty() )
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Missing SNMP community string."),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return ;
|
||||
@ -249,7 +250,7 @@ void newHostDialog::getInterfacesViaSNMP()
|
||||
|
||||
IPAddress addr;
|
||||
QString name=m_dialog->obj_name->text().toLatin1().constData();
|
||||
try
|
||||
try
|
||||
{
|
||||
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );
|
||||
QString a = getAddrByName(name);
|
||||
@ -258,7 +259,7 @@ void newHostDialog::getInterfacesViaSNMP()
|
||||
} catch (FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Address of %1 could not be obtained via DNS")
|
||||
.arg(m_dialog->obj_name->text()),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
@ -275,7 +276,7 @@ void newHostDialog::getInterfacesViaSNMP()
|
||||
|
||||
timer->setSingleShot(false);
|
||||
timer->start(0);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
logger = q->start_operation();
|
||||
@ -358,13 +359,13 @@ void newHostDialog::showPage(const int page)
|
||||
FWObject *tlib = mw->db()->getById(TEMPLATE_LIB);
|
||||
if (tlib==NULL)
|
||||
{
|
||||
FWObject *cl = om->getCurrentLib();
|
||||
FWObject *cl = mw->getCurrentLib();
|
||||
mw->loadLibrary(tempfname);
|
||||
unloadTemplatesLib = true;
|
||||
om->loadObjects();
|
||||
mw->loadObjects();
|
||||
tlib = mw->db()->getById(TEMPLATE_LIB);
|
||||
/* restore library that was opened prior loading templates */
|
||||
om->openLib(cl);
|
||||
mw->openLib(cl);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -390,7 +391,7 @@ void newHostDialog::showPage(const int page)
|
||||
QListWidgetItem *item = new QListWidgetItem(
|
||||
QIcon(pm), QString(o->getName().c_str()));
|
||||
m_dialog->templateList->addItem(item);
|
||||
|
||||
|
||||
templates[ m_dialog->templateList->item( m_dialog->templateList->count()-1 ) ]=o;
|
||||
}
|
||||
m_dialog->templateList->setCurrentItem(0);
|
||||
@ -504,19 +505,19 @@ void newHostDialog::addInterface()
|
||||
catch (FWException &ex)
|
||||
{
|
||||
QMessageBox::warning(
|
||||
this,"Firewall Builder",
|
||||
this,"Firewall Builder",
|
||||
tr("Illegal address '%1/%2'").arg(addr).arg(netm),
|
||||
"&Continue", QString::null, QString::null, 0, 1 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
QStringList sl;
|
||||
sl << m_dialog->iface_name->text()
|
||||
<< m_dialog->iface_label->text()
|
||||
sl << m_dialog->iface_name->text()
|
||||
<< m_dialog->iface_label->text()
|
||||
<< addr
|
||||
<< netm
|
||||
<< m_dialog->iface_physaddr->text();
|
||||
|
||||
|
||||
new QTreeWidgetItem(m_dialog->iface_list, sl);
|
||||
}
|
||||
|
||||
@ -553,7 +554,7 @@ void newHostDialog::deleteInterface()
|
||||
{
|
||||
QTreeWidgetItem *itm = m_dialog->iface_list->currentItem();
|
||||
if (itm==NULL) return;
|
||||
m_dialog->iface_list->takeTopLevelItem(
|
||||
m_dialog->iface_list->takeTopLevelItem(
|
||||
m_dialog->iface_list->indexOfTopLevelItem(itm) );
|
||||
}
|
||||
|
||||
@ -565,14 +566,14 @@ void newHostDialog::cancelClicked()
|
||||
void newHostDialog::finishClicked()
|
||||
{
|
||||
int p = currentPage();
|
||||
|
||||
|
||||
if (p==TEMPLATES_PAGE)
|
||||
{
|
||||
QListWidgetItem *itm = m_dialog->templateList->currentItem();
|
||||
FWObject *o=templates[itm];
|
||||
assert (o!=NULL);
|
||||
|
||||
FWObject *no = om->duplicateObject(om->getCurrentLib(),
|
||||
FWObject *no = mw->duplicateObject(mw->getCurrentLib(),
|
||||
o,
|
||||
m_dialog->obj_name->text(),
|
||||
false ); // do not ask to autorename
|
||||
@ -585,7 +586,7 @@ void newHostDialog::finishClicked()
|
||||
} else
|
||||
{
|
||||
FWObject *o;
|
||||
o=om->createObject(Host::TYPENAME, m_dialog->obj_name->text() );
|
||||
o=mw->createObject(Host::TYPENAME, m_dialog->obj_name->text() );
|
||||
if (o==NULL)
|
||||
{
|
||||
QDialog::accept();
|
||||
@ -608,7 +609,7 @@ void newHostDialog::finishClicked()
|
||||
QString physaddr= itm->text(5);
|
||||
|
||||
Interface *oi = Interface::cast(
|
||||
om->createObject(nhst,Interface::TYPENAME, name)
|
||||
mw->createObject(nhst,Interface::TYPENAME, name)
|
||||
);
|
||||
#ifdef USE_INTERFACE_POLICY
|
||||
oi->add(new InterfacePolicy());
|
||||
@ -624,13 +625,13 @@ void newHostDialog::finishClicked()
|
||||
QString addrname=QString("%1:%2:ip")
|
||||
.arg(m_dialog->obj_name->text()).arg(name);
|
||||
IPv4 *oa = IPv4::cast(
|
||||
om->createObject(oi, IPv4::TYPENAME,addrname)
|
||||
mw->createObject(oi, IPv4::TYPENAME,addrname)
|
||||
);
|
||||
oa->setAddress( addr.toLatin1().constData() );
|
||||
oa->setNetmask( netmask.toLatin1().constData() );
|
||||
}
|
||||
|
||||
om->updateObjName(oi,"","",false);
|
||||
mw->updateObjName(oi,"","",false);
|
||||
}
|
||||
}
|
||||
if (unloadTemplatesLib)
|
||||
@ -640,7 +641,7 @@ void newHostDialog::finishClicked()
|
||||
assert (tlib!=NULL);
|
||||
string tlibID = tlib->getId();
|
||||
if (fwbdebug) qDebug(" Delete library of templates");
|
||||
om->delObj(tlib,false);
|
||||
mw->delObj(tlib,false);
|
||||
|
||||
/*
|
||||
* deleting an object places it in the "Deleted objects" library, so
|
||||
@ -653,7 +654,7 @@ void newHostDialog::finishClicked()
|
||||
if (delObjLib!=NULL && delObjLib->getById(tlibID)!=NULL)
|
||||
{
|
||||
if (fwbdebug) qDebug(" Delete library of templates from 'Deleted objects'");
|
||||
om->delObj(tlib,false); // this time from deleted objects lib
|
||||
mw->delObj(tlib,false); // this time from deleted objects lib
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -26,6 +26,8 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -95,7 +97,7 @@ class mouseEventFilter : public QObject
|
||||
cerr << "event type=" << event->type() << endl;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -107,7 +109,7 @@ bool headerMouseEventInterceptor::eventFilter( QObject *object, QEvent *event)
|
||||
if (event->type() == QEvent::ContextMenu )
|
||||
{
|
||||
QContextMenuEvent *e = (QContextMenuEvent*)(event);
|
||||
|
||||
|
||||
int row = rsv->rowAt( rsv->contentsY()+e->pos().y() );
|
||||
rsv->contextMenu(row, -1, e->globalPos());
|
||||
|
||||
@ -135,9 +137,9 @@ void RuleObjToolTip::maybeTip(const QPoint &pos)
|
||||
|
||||
QRect cr;
|
||||
QString t="";
|
||||
|
||||
|
||||
cr=rsv->cellGeometry(row,col);
|
||||
|
||||
|
||||
if ( RuleSetView::Options == rsv->getColType(col) )
|
||||
{
|
||||
Rule *rule = rsv->getRule(row);
|
||||
@ -167,7 +169,7 @@ void RuleObjToolTip::maybeTip(const QPoint &pos)
|
||||
else
|
||||
{
|
||||
FWObject *obj = rsv->getObj(row,col,cy,&cr);
|
||||
if (obj==NULL)
|
||||
if (obj==NULL)
|
||||
return;
|
||||
t=FWObjectPropertiesFactory::getObjectPropertiesDetailed(obj,true,true);
|
||||
}
|
||||
@ -272,13 +274,13 @@ void RuleSetView::hideEvent(QHideEvent *ev)
|
||||
QString k = settingsKey();
|
||||
QString v;
|
||||
|
||||
for (int col=0; col<ncols; col++)
|
||||
for (int col=0; col<ncols; col++)
|
||||
v = v + QString("%1 ").arg( columnWidth(col) );
|
||||
/* disabled because we need to remember the width for columns in
|
||||
* association with their names, not just sequentially. Since
|
||||
* different firewall types have different number of columns, doing it
|
||||
* just by numbers causes the last column to disappear when user
|
||||
* switches from a firewall with 6 columns to firewall with 7 columns
|
||||
* switches from a firewall with 6 columns to firewall with 7 columns
|
||||
* (e.g. from pf to iptables)
|
||||
*/
|
||||
// st->setStr(k,v);
|
||||
@ -356,7 +358,7 @@ void RuleSetView::init()
|
||||
if (!v.isEmpty())
|
||||
{
|
||||
userColWidth=true;
|
||||
for (int col=0; col<ncols; col++)
|
||||
for (int col=0; col<ncols; col++)
|
||||
colW[col]=v.section(' ',col,col).toInt();
|
||||
} else
|
||||
{
|
||||
@ -459,7 +461,7 @@ void RuleSetView::focusInEvent(QFocusEvent* ev)
|
||||
{
|
||||
if (fwbdebug) qDebug("RuleSetView::focusInEvent");
|
||||
|
||||
//om->unselect();
|
||||
//mw->unselect();
|
||||
QTable::focusInEvent(ev);
|
||||
repaintSelections();
|
||||
|
||||
@ -498,7 +500,7 @@ void RuleSetView::adjustColumn( int col )
|
||||
lbl );
|
||||
|
||||
int w = br.width() + 10;
|
||||
|
||||
|
||||
int row=0;
|
||||
for (FWObject::iterator i=ruleset->begin(); i!=ruleset->end(); i++,row++)
|
||||
{
|
||||
@ -520,7 +522,7 @@ void RuleSetView::adjustRow_int( int row, int h )
|
||||
h = QMAX(h, QApplication::globalStrut().height());
|
||||
|
||||
/ * setRowHeight causes redraw. Beware of loops 'cause we call adjustRow from
|
||||
* cellPaint! * /
|
||||
* cellPaint! * /
|
||||
setRowHeight(row, h);
|
||||
|
||||
dirtyRows[row]=0;
|
||||
@ -594,7 +596,7 @@ QRect RuleSetView::calculateCellSize( int row, int col )
|
||||
Qt::AlignLeft|Qt::AlignVCenter,
|
||||
ot);
|
||||
hc += item_h;
|
||||
int itmW = RuleElementSpacing/2 + pixmap_w +
|
||||
int itmW = RuleElementSpacing/2 + pixmap_w +
|
||||
RuleElementSpacing + br.width();
|
||||
wc = QMAX(wc, itmW);
|
||||
}
|
||||
@ -677,7 +679,7 @@ QPixmap RuleSetView::getPixmap(FWObject *obj, PixmapAttr pmattr) const
|
||||
if (pmattr == Ref) icn="icon-ref";
|
||||
if (pmattr == Tree) icn="icon-tree";
|
||||
|
||||
// return QPixmap::fromMimeSource(
|
||||
// return QPixmap::fromMimeSource(
|
||||
// Resources::global_res->getObjResourceStr(obj, icn).c_str() );
|
||||
|
||||
QString icn_file = Resources::global_res->getObjResourceStr(obj, icn).c_str();
|
||||
@ -749,19 +751,19 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
|
||||
if (ruleIndex.count(row)==0) return;
|
||||
|
||||
if (dirtyRows[row]!=0)
|
||||
{
|
||||
if (dirtyRows[row]!=0)
|
||||
{
|
||||
// if (fwbdebug) qDebug("RuleSetView::paintCell dirty row %d",row);
|
||||
|
||||
dirtyRows[row]=0;
|
||||
adjustRow(row); // this causes repaint
|
||||
adjustRow(row); // this causes repaint
|
||||
return;
|
||||
}
|
||||
|
||||
QString rclr;
|
||||
Rule *rule = Rule::cast( ruleIndex[row] );
|
||||
if (rule==NULL) return;
|
||||
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
rclr = ropt->getStr("color").c_str();
|
||||
@ -853,10 +855,10 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
p.drawText( x, y + RuleElementSpacing/2,
|
||||
cr.width()-pm.width()-1, item_h,
|
||||
Qt::AlignLeft|Qt::AlignVCenter, objectText(re,o1) );
|
||||
|
||||
|
||||
FWObject *mwSelObj = selectedObject;
|
||||
std::vector<libfwbuilder::FWObject*> om_selected_objects =
|
||||
om->getCurrentObjectTree()->getSelectedObjects();
|
||||
mw->getCurrentObjectTree()->getSelectedObjects();
|
||||
|
||||
if (mwSelObj==NULL && om_selected_objects.size()!=0)
|
||||
mwSelObj = om_selected_objects.front();
|
||||
@ -875,7 +877,7 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
p.drawLine( 1, y+item_h-3, cr.width()-3, y+item_h-3 );
|
||||
p.drawLine( 1, y+1, 1, y+item_h-3 );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
y += item_h;
|
||||
}
|
||||
@ -1045,7 +1047,7 @@ QString RuleSetView::getPlatform()
|
||||
return getFirewall()->getStr("platform").c_str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
libfwbuilder::PolicyRule* RuleSetView::getRule(int row)
|
||||
{
|
||||
return PolicyRule::cast( ruleIndex[row] );
|
||||
@ -1216,7 +1218,7 @@ void RuleSetView::selectionChanged()
|
||||
mw->cutRuleAction->setEnabled( selectionSize==1 );
|
||||
mw->pasteRuleAboveAction->setEnabled( selectionSize==1 );
|
||||
mw->pasteRuleBelowAction->setEnabled( selectionSize==1 );
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1230,7 +1232,7 @@ FWObject* RuleSetView::getSelectedObject()
|
||||
void RuleSetView::openObjectInTree(FWObject *obj)
|
||||
{
|
||||
if (gui_experiment1) return;
|
||||
|
||||
|
||||
FWObject *oo = obj;
|
||||
if (obj==NULL || Rule::cast(obj)!=NULL)
|
||||
oo = getFirewall();
|
||||
@ -1239,9 +1241,9 @@ void RuleSetView::openObjectInTree(FWObject *obj)
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
//bool f = hasFocus();
|
||||
om->setFocus();
|
||||
om->openObject(oo);
|
||||
om->clearFocus();
|
||||
mw->setFocus();
|
||||
mw->openObject(oo);
|
||||
mw->clearFocus();
|
||||
setFocus();
|
||||
setUpdatesEnabled(true);
|
||||
updateContents();
|
||||
@ -1310,24 +1312,24 @@ bool RuleSetView::switchObjectInEditor(int col,bool validate)
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::switchObjectInEditor col=%d validate=%d",col,validate);
|
||||
|
||||
|
||||
|
||||
if (!isTreeReadWrite(this,ruleset)) return false;
|
||||
if ( currentRow()==-1 || currentColumn()==-1 ) return false;
|
||||
|
||||
|
||||
FWObject *Object=NULL;
|
||||
ObjectEditor::OptType Operation=ObjectEditor::optNone;
|
||||
|
||||
/*
|
||||
* We need to know WHAT we are going to edit
|
||||
|
||||
|
||||
1. Object
|
||||
2. OptType
|
||||
|
||||
|
||||
* Object == null, OptType = optNone => blank
|
||||
* Object == Rule, OptType = optNone => Rule Options
|
||||
* Object == Rule, OptType != optNone => Virtual Object (Action, Comment ...)
|
||||
* Object != Rule, OptType = optNone => Regular Object Editor
|
||||
|
||||
|
||||
Then we compare our object 'obj' and OptType with what we already
|
||||
have in ObjectEditor/ If they are the same, then we do nothing,
|
||||
otherwise we open obj in the Object Editor
|
||||
@ -1392,7 +1394,7 @@ bool RuleSetView::switchObjectInEditor(int col,bool validate)
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::switchObjectInEditor opening object in the editor");
|
||||
|
||||
|
||||
if (Object == NULL)
|
||||
{
|
||||
oe->blank();
|
||||
@ -1479,7 +1481,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
|
||||
// QPoint rp = mapFromGlobal( pos);
|
||||
// QHeader *hh = horizontalHeader();
|
||||
// QHeader *vh = verticalHeader();
|
||||
// QHeader *vh = verticalHeader();
|
||||
// int nx = rp.x()-vh->width()-1;
|
||||
// int ny = rp.y()-hh->height()-1;
|
||||
// objectClicked(row,col,0,QPoint(nx,ny));
|
||||
@ -1493,9 +1495,9 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
case Action:
|
||||
{
|
||||
Firewall *f = getFirewall();
|
||||
string platform=f->getStr("platform");
|
||||
string platform=f->getStr("platform");
|
||||
QString action_name;
|
||||
|
||||
|
||||
if (Resources::isTargetActionSupported(platform,"Accept"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Accept,
|
||||
@ -1504,7 +1506,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
"/FWBuilderResources/UI/Icons/Accept",
|
||||
action_name,
|
||||
SLOT( changeActionToAccept() ) );
|
||||
}
|
||||
}
|
||||
if (Resources::isTargetActionSupported(platform,"Deny"))
|
||||
{
|
||||
action_name = getActionNameForPlatform(PolicyRule::Deny,
|
||||
@ -1595,14 +1597,14 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
action_name,
|
||||
SLOT( changeActionToContinue() ) );
|
||||
}
|
||||
|
||||
|
||||
popup->insertSeparator ();
|
||||
int paramID;
|
||||
paramID = addPopupMenuItem( this, popup,
|
||||
"",
|
||||
tr("Parameters"),
|
||||
SLOT( editSelected() ) );
|
||||
|
||||
|
||||
PolicyRule *rule = PolicyRule::cast( ruleIndex[row] );
|
||||
if (rule!=NULL)
|
||||
{
|
||||
@ -1638,7 +1640,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
SLOT( editSelected() ) );
|
||||
if (fwbdebug) qDebug(ruleset->getTypeName().c_str());
|
||||
if (ruleset->getTypeName() == Policy::TYPENAME) {
|
||||
|
||||
|
||||
addPopupMenuItem( this, popup,
|
||||
"/FWBuilderResources/UI/Icons/Log",
|
||||
tr("Logging On"),
|
||||
@ -1798,7 +1800,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
popup->exec( pos );
|
||||
|
||||
@ -1809,7 +1811,7 @@ void RuleSetView::contextMenu(int row, int col, const QPoint &pos)
|
||||
void RuleSetView::revealObjectInTree()
|
||||
{
|
||||
if ( selectedObject!=NULL)
|
||||
om->openObject(selectedObject);
|
||||
mw->openObject(selectedObject);
|
||||
}
|
||||
|
||||
void RuleSetView::findWhereUsedSlot()
|
||||
@ -1871,12 +1873,12 @@ void RuleSetView::changeAction(PolicyRule::Action act)
|
||||
|
||||
rule->setAction( act );
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
ruleopt->setBool("stateless", getStatelessFlagForAction(rule));
|
||||
|
||||
oe->actionChanged(rule);
|
||||
oe->actionChanged(rule);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1884,7 +1886,7 @@ void RuleSetView::changeActionToAccept()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall action: changeActionToAccept");
|
||||
if (fwbdebug) qDebug("Firewall action: changeActionToAccept");
|
||||
changeAction( PolicyRule::Accept );
|
||||
}
|
||||
|
||||
@ -1892,7 +1894,7 @@ void RuleSetView::changeActionToDeny()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToDeny");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToDeny");
|
||||
changeAction( PolicyRule::Deny );
|
||||
}
|
||||
|
||||
@ -1900,7 +1902,7 @@ void RuleSetView::changeActionToReject()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToReject");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToReject");
|
||||
changeAction( PolicyRule::Reject );
|
||||
}
|
||||
|
||||
@ -1908,7 +1910,7 @@ void RuleSetView::changeActionToAccounting()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToAccounting");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToAccounting");
|
||||
changeAction( PolicyRule::Accounting );
|
||||
}
|
||||
|
||||
@ -1916,7 +1918,7 @@ void RuleSetView::changeActionToPipe()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToPipe");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToPipe");
|
||||
changeAction( PolicyRule::Pipe );
|
||||
}
|
||||
|
||||
@ -1924,7 +1926,7 @@ void RuleSetView::changeActionToTag()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToTag");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToTag");
|
||||
changeAction( PolicyRule::Tag );
|
||||
}
|
||||
|
||||
@ -1932,7 +1934,7 @@ void RuleSetView::changeActionToClassify()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToClassify");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToClassify");
|
||||
changeAction( PolicyRule::Classify );
|
||||
}
|
||||
|
||||
@ -1940,7 +1942,7 @@ void RuleSetView::changeActionToCustom()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToCustom");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToCustom");
|
||||
changeAction( PolicyRule::Custom );
|
||||
}
|
||||
|
||||
@ -1948,7 +1950,7 @@ void RuleSetView::changeActionToRoute()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToRoute");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToRoute");
|
||||
changeAction( PolicyRule::Route );
|
||||
}
|
||||
|
||||
@ -1956,7 +1958,7 @@ void RuleSetView::changeActionToContinue()
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToContinue");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeActionToContinue");
|
||||
changeAction( PolicyRule::Continue );
|
||||
}
|
||||
|
||||
@ -1966,7 +1968,7 @@ void RuleSetView::changeActionToBranch()
|
||||
|
||||
if ( currentRow()!=-1 && currentColumn()!=-1 )
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall action: changeActionToBranch");
|
||||
if (fwbdebug) qDebug("Firewall action: changeActionToBranch");
|
||||
changeAction( PolicyRule::Branch );
|
||||
|
||||
addRuleBranch( PolicyRule::cast( ruleIndex[currentRow()] ) );
|
||||
@ -1975,7 +1977,7 @@ void RuleSetView::changeActionToBranch()
|
||||
|
||||
void RuleSetView::addRuleBranch(PolicyRule *rule)
|
||||
{
|
||||
if (fwbdebug) qDebug("RuleSetView::addRuleBranch");
|
||||
if (fwbdebug) qDebug("RuleSetView::addRuleBranch");
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
QString branchName = ropt->getStr("branch_name").c_str();
|
||||
@ -2007,7 +2009,7 @@ void RuleSetView::changeDitection(PolicyRule::Direction dir)
|
||||
if (dir!=old_dir)
|
||||
{
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
rule->setDirection( dir );
|
||||
}
|
||||
}
|
||||
@ -2015,19 +2017,19 @@ void RuleSetView::changeDitection(PolicyRule::Direction dir)
|
||||
|
||||
void RuleSetView::changeDirectionToIn()
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToIn");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToIn");
|
||||
changeDitection( PolicyRule::Inbound );
|
||||
}
|
||||
|
||||
void RuleSetView::changeDirectionToOut()
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToOut");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToOut");
|
||||
changeDitection( PolicyRule::Outbound );
|
||||
}
|
||||
|
||||
void RuleSetView::changeDirectionToBoth()
|
||||
{
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToBoth");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeDirectionToBoth");
|
||||
changeDitection( PolicyRule::Both );
|
||||
}
|
||||
|
||||
@ -2053,9 +2055,9 @@ void RuleSetView::changeLogToOn()
|
||||
if ( currentRow()!=-1 && currentColumn()!=-1 )
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast( ruleIndex[currentRow()] );
|
||||
if (fwbdebug) qDebug("Firewall changed: changeLogToOn");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeLogToOn");
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
rule->setLogging( true );
|
||||
}
|
||||
}
|
||||
@ -2067,9 +2069,9 @@ void RuleSetView::changeLogToOff()
|
||||
if ( currentRow()!=-1 && currentColumn()!=-1 )
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast( ruleIndex[currentRow()] );
|
||||
if (fwbdebug) qDebug("Firewall changed: changeLogToOff");
|
||||
if (fwbdebug) qDebug("Firewall changed: changeLogToOff");
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
rule->setLogging( false );
|
||||
}
|
||||
}
|
||||
@ -2115,22 +2117,22 @@ void RuleSetView::deleteObject(int row, int col, FWObject *obj)
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("RuleSetView::deleteObject row=%d col=%d id=%s",
|
||||
row,col,id.c_str());
|
||||
row,col,id.c_str());
|
||||
qDebug("obj = %p",re->getRoot()->findInIndex(id));
|
||||
int rc = obj->ref()-1; obj->unref();
|
||||
qDebug("obj->ref_counter=%d",rc);
|
||||
}
|
||||
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
|
||||
re->removeRef(obj);
|
||||
|
||||
if (re->isAny()) re->setNeg(false);
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("RuleSetView::deleteObject re->size()=%d",re->size());
|
||||
qDebug("RuleSetView::deleteObject re->size()=%d",re->size());
|
||||
qDebug("obj = %p",re->getRoot()->findInIndex(id));
|
||||
int rc = obj->ref()-1; obj->unref();
|
||||
qDebug("obj->ref_counter=%d",rc);
|
||||
@ -2163,19 +2165,19 @@ bool RuleSetView::insertObject(int row, int col, FWObject *obj)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::insertObject -- validation failed");
|
||||
|
||||
if (RuleElementRItf::cast(re))
|
||||
|
||||
|
||||
if (RuleElementRItf::cast(re))
|
||||
|
||||
QMessageBox::information( NULL , "Firewall Builder",
|
||||
"A single interface belonging to this firewall is expected in this field.",
|
||||
QString::null,QString::null);
|
||||
|
||||
|
||||
else if (RuleElementRGtw::cast(re))
|
||||
|
||||
|
||||
QMessageBox::information( NULL , "Firewall Builder",
|
||||
"A single ip adress is expected here. You may also insert a host or a network adapter leading to a single ip adress.",
|
||||
QString::null,QString::null);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2189,7 +2191,7 @@ bool RuleSetView::insertObject(int row, int col, FWObject *obj)
|
||||
/* avoid duplicates */
|
||||
string cp_id=obj->getId();
|
||||
list<FWObject*>::iterator j;
|
||||
for(j=re->begin(); j!=re->end(); ++j)
|
||||
for(j=re->begin(); j!=re->end(); ++j)
|
||||
{
|
||||
FWObject *o=*j;
|
||||
if(cp_id==o->getId()) return false;
|
||||
@ -2213,9 +2215,9 @@ bool RuleSetView::insertObject(int row, int col, FWObject *obj)
|
||||
adjustRow(row);
|
||||
updateCell(row,col);
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: insertObject");
|
||||
if (fwbdebug) qDebug("Firewall changed: insertObject");
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2251,10 +2253,10 @@ void RuleSetView::negateRE()
|
||||
{
|
||||
RuleElement *re = getRE(currentRow(),currentColumn());
|
||||
if (re==NULL) return;
|
||||
if (fwbdebug) qDebug("Firewall changed: negateRE");
|
||||
if (fwbdebug) qDebug("Firewall changed: negateRE");
|
||||
re->toggleNeg();
|
||||
if (!changingRules)
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
|
||||
updateCell(currentRow(),currentColumn());
|
||||
}
|
||||
@ -2349,7 +2351,7 @@ void RuleSetView::contentsMouseReleaseEvent( QMouseEvent* ev )
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView::contentsMouseReleaseEvent");
|
||||
|
||||
|
||||
if (oe->isVisible() && !switchObjectInEditor( columnAt(ev->x()) ))
|
||||
{
|
||||
ev->accept();
|
||||
@ -2405,7 +2407,7 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
} else
|
||||
QTable::keyPressEvent(ev);
|
||||
openObjectInTree(getFirewall());
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2531,7 +2533,7 @@ void RuleSetView::keyPressEvent( QKeyEvent* ev )
|
||||
{
|
||||
deleteSelectedObject();
|
||||
}
|
||||
|
||||
|
||||
QTable::keyPressEvent(ev);
|
||||
}
|
||||
|
||||
@ -2583,7 +2585,7 @@ void RuleSetView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
{
|
||||
QHeader *hh = horizontalHeader();
|
||||
QHeader *vh = verticalHeader();
|
||||
|
||||
|
||||
int row = rowAt( ev->pos().y() + contentsY() - hh->height() );
|
||||
int col = columnAt( ev->pos().x() + contentsX() - vh->width() );
|
||||
|
||||
@ -2657,7 +2659,7 @@ void RuleSetView::dropEvent( QDropEvent *ev)
|
||||
/* without this check the user can drag and drop an object inside the
|
||||
* same rule element. This is bad because it is considered a change,
|
||||
* even though nothing really changes. With this check, we can not
|
||||
* drag and drop an object from the tree into a selected cell...
|
||||
* drag and drop an object from the tree into a selected cell...
|
||||
|
||||
if (row==currentRow() && col==currentColumn()) return;
|
||||
*/
|
||||
@ -2710,7 +2712,7 @@ void RuleSetView::removeRule()
|
||||
changingRules = true;
|
||||
|
||||
mw->findObjectWidget->reset();
|
||||
|
||||
|
||||
int firstSelectedRule=-1;
|
||||
int lastSelectedRule=-1;
|
||||
|
||||
@ -2734,7 +2736,7 @@ void RuleSetView::removeRule()
|
||||
{
|
||||
clearSelection();
|
||||
verticalHeader()->update();
|
||||
if (fwbdebug) qDebug("Firewall changed: removeRule");
|
||||
if (fwbdebug) qDebug("Firewall changed: removeRule");
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
for (int rn=lastSelectedRule; rn>=firstSelectedRule; --rn)
|
||||
@ -2776,7 +2778,7 @@ void RuleSetView::removeRule()
|
||||
updateContents();
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2805,7 +2807,7 @@ void RuleSetView::insertRule()
|
||||
changingRules = true;
|
||||
insertRule(firstSelectedRule,NULL);
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}*/
|
||||
|
||||
void RuleSetView::addRuleAfterCurrent()
|
||||
@ -2832,17 +2834,17 @@ void RuleSetView::addRuleAfterCurrent()
|
||||
changingRules = true;
|
||||
insertRule(lastSelectedRule+1,NULL);
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
/*CWP DONE:
|
||||
Rule* RuleSetView::insertRule(int pos, FWObject *r)
|
||||
{
|
||||
if (r!=NULL &&
|
||||
ruleset->getTypeName()==Policy::TYPENAME &&
|
||||
if (r!=NULL &&
|
||||
ruleset->getTypeName()==Policy::TYPENAME &&
|
||||
r->getTypeName()!=PolicyRule::TYPENAME) return NULL;
|
||||
if (r!=NULL &&
|
||||
ruleset->getTypeName()==NAT::TYPENAME &&
|
||||
if (r!=NULL &&
|
||||
ruleset->getTypeName()==NAT::TYPENAME &&
|
||||
r->getTypeName()!=NATRule::TYPENAME ) return NULL;
|
||||
|
||||
if (pos<0) pos=0;
|
||||
@ -2902,7 +2904,7 @@ Rule* RuleSetView::insertRule(int pos, FWObject *r)
|
||||
setCurrentCell( pos, currentColumn() );
|
||||
updateCell(pos,currentColumn());
|
||||
|
||||
if (fwbdebug) qDebug("Firewall changed: insertRule");
|
||||
if (fwbdebug) qDebug("Firewall changed: insertRule");
|
||||
|
||||
return newrule;
|
||||
}
|
||||
@ -2930,7 +2932,7 @@ void RuleSetView::copyRuleContent(Rule *dst, Rule *src)
|
||||
{
|
||||
string dtype= (*j)->getTypeName();
|
||||
FWObject *selem= src->getFirstByType(dtype);
|
||||
if (selem!=NULL)
|
||||
if (selem!=NULL)
|
||||
(*j)->duplicate(selem);
|
||||
}
|
||||
|
||||
@ -2964,7 +2966,7 @@ void RuleSetView::moveRule()
|
||||
askRuleNumberDialog_q d(this);
|
||||
d.newRuleNum->setMinValue(minRN);
|
||||
d.newRuleNum->setMaxValue(maxRN);
|
||||
|
||||
|
||||
if (d.exec()==QDialog::Accepted)
|
||||
{
|
||||
int newN = d.newRuleNum->value();
|
||||
@ -3004,7 +3006,7 @@ void RuleSetView::moveRule()
|
||||
}
|
||||
nn++;
|
||||
}
|
||||
} else
|
||||
} else
|
||||
{ // moving block of rules down
|
||||
for (int i=lastSelectedRule; i>=firstSelectedRule; i--)
|
||||
{
|
||||
@ -3041,7 +3043,7 @@ void RuleSetView::moveRule()
|
||||
updateContents();
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3157,8 +3159,8 @@ void RuleSetView::pasteRuleAbove()
|
||||
firstSelectedRule=currentRow();
|
||||
lastSelectedRule=currentRow();
|
||||
}
|
||||
if (fwbdebug) qDebug("Firewall: pasteRuleAbove");
|
||||
|
||||
if (fwbdebug) qDebug("Firewall: pasteRuleAbove");
|
||||
|
||||
/* pick rules in reverse order */
|
||||
vector<string>::reverse_iterator i;
|
||||
for (i= FWObjectClipboard::obj_clipboard->rbegin();
|
||||
@ -3170,12 +3172,12 @@ void RuleSetView::pasteRuleAbove()
|
||||
}
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RuleSetView::pasteRuleBelow()
|
||||
{
|
||||
{
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
int firstSelectedRule=-1;
|
||||
@ -3207,7 +3209,7 @@ void RuleSetView::pasteRuleBelow()
|
||||
}
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
|
||||
// if (FWObjectClipboard::obj_clipboard->getObject()!=NULL)
|
||||
// insertRule( rn+1, Rule::cast(FWObjectClipboard::obj_clipboard->getObject()) );
|
||||
@ -3238,14 +3240,14 @@ void RuleSetView::enableRule()
|
||||
for (int rn=lastSelectedRule; rn>=firstSelectedRule; --rn)
|
||||
{
|
||||
Rule *r = Rule::cast( ruleIndex[rn] );
|
||||
if (fwbdebug) qDebug("Firewall changed: enableRule");
|
||||
if (fwbdebug) qDebug("Firewall changed: enableRule");
|
||||
r->enable();
|
||||
setRuleNumber(rn,r);
|
||||
}
|
||||
}
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
void RuleSetView::disableRule()
|
||||
@ -3273,14 +3275,14 @@ void RuleSetView::disableRule()
|
||||
for (int rn=lastSelectedRule; rn>=firstSelectedRule; --rn)
|
||||
{
|
||||
Rule *r = Rule::cast( ruleIndex[rn] );
|
||||
if (fwbdebug) qDebug("Firewall changed: disableRule");
|
||||
if (fwbdebug) qDebug("Firewall changed: disableRule");
|
||||
r->disable();
|
||||
setRuleNumber(rn,r);
|
||||
}
|
||||
}
|
||||
|
||||
changingRules = false;
|
||||
om->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
mw->updateLastModifiedTimestampForOneFirewall(getFirewall());
|
||||
}
|
||||
|
||||
|
||||
@ -3298,7 +3300,7 @@ PolicyView::PolicyView(Policy *p, QWidget *parent) : RuleSetView(1, 7, parent)
|
||||
void PolicyView::init()
|
||||
{
|
||||
ncols=7 +
|
||||
((supports_time)?1:0) +
|
||||
((supports_time)?1:0) +
|
||||
((supports_logging && supports_rule_options)?1:0);
|
||||
|
||||
setNumCols(ncols);
|
||||
@ -3343,7 +3345,7 @@ void PolicyView::init()
|
||||
RuleSetView::init();
|
||||
}
|
||||
|
||||
RuleElement* PolicyView::getRE( int row, int col )
|
||||
RuleElement* PolicyView::getRE( int row, int col )
|
||||
{
|
||||
if (row<0) return NULL;
|
||||
|
||||
@ -3353,7 +3355,7 @@ RuleElement* PolicyView::getRE( int row, int col )
|
||||
return getRE(r, col);
|
||||
}
|
||||
|
||||
RuleElement* PolicyView::getRE( Rule* r, int col )
|
||||
RuleElement* PolicyView::getRE( Rule* r, int col )
|
||||
{
|
||||
string ret;
|
||||
|
||||
@ -3388,7 +3390,7 @@ InterfacePolicyView::InterfacePolicyView(InterfacePolicy *p, QWidget *parent) :
|
||||
void InterfacePolicyView::init()
|
||||
{
|
||||
ncols=6 +
|
||||
((supports_time)?1:0) +
|
||||
((supports_time)?1:0) +
|
||||
((supports_logging && supports_rule_options)?1:0);
|
||||
|
||||
setNumCols(ncols);
|
||||
@ -3432,7 +3434,7 @@ void InterfacePolicyView::init()
|
||||
RuleSetView::init();
|
||||
}
|
||||
|
||||
RuleElement* InterfacePolicyView::getRE( int row, int col )
|
||||
RuleElement* InterfacePolicyView::getRE( int row, int col )
|
||||
{
|
||||
if (row<0) return NULL;
|
||||
PolicyRule *r = PolicyRule::cast( ruleIndex[row] );
|
||||
@ -3440,7 +3442,7 @@ RuleElement* InterfacePolicyView::getRE( int row, int col )
|
||||
return getRE(r,col);
|
||||
}
|
||||
|
||||
RuleElement* InterfacePolicyView::getRE( Rule *r, int col )
|
||||
RuleElement* InterfacePolicyView::getRE( Rule *r, int col )
|
||||
{
|
||||
string ret;
|
||||
|
||||
@ -3511,7 +3513,7 @@ void NATView::init()
|
||||
RuleSetView::init();
|
||||
}
|
||||
|
||||
RuleElement* NATView::getRE( int row, int col )
|
||||
RuleElement* NATView::getRE( int row, int col )
|
||||
{
|
||||
if (row<0) return NULL;
|
||||
NATRule *r = NATRule::cast( ruleIndex[row] );
|
||||
@ -3519,7 +3521,7 @@ RuleElement* NATView::getRE( int row, int col )
|
||||
return getRE(r,col);
|
||||
}
|
||||
|
||||
RuleElement* NATView::getRE( Rule *r, int col )
|
||||
RuleElement* NATView::getRE( Rule *r, int col )
|
||||
{
|
||||
string ret;
|
||||
|
||||
@ -3584,7 +3586,7 @@ void RoutingView::init()
|
||||
RuleSetView::init();
|
||||
}
|
||||
|
||||
RuleElement* RoutingView::getRE( int row, int col )
|
||||
RuleElement* RoutingView::getRE( int row, int col )
|
||||
{
|
||||
if (row<0) return NULL;
|
||||
RoutingRule *r = RoutingRule::cast( ruleIndex[row] );
|
||||
@ -3592,7 +3594,7 @@ RuleElement* RoutingView::getRE( int row, int col )
|
||||
return getRE(r,col);
|
||||
}
|
||||
|
||||
RuleElement* RoutingView::getRE( Rule *r, int col )
|
||||
RuleElement* RoutingView::getRE( Rule *r, int col )
|
||||
{
|
||||
string ret;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,18 +17,20 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "openbsdAdvancedDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -110,7 +112,7 @@ void openbsdAdvancedDialog::accept()
|
||||
|
||||
data.saveAll();
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "pfAdvancedDialog.h"
|
||||
#include "SimpleTextEditor.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -106,8 +108,8 @@ pfAdvancedDialog::pfAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
slm.push_back("Normal");
|
||||
m_dialog->pf_optimization->clear();
|
||||
m_dialog->pf_optimization->addItems(getScreenNames(slm));
|
||||
data.registerOption( m_dialog->pf_optimization, fwopt, "pf_optimization", slm);
|
||||
|
||||
data.registerOption( m_dialog->pf_optimization, fwopt, "pf_optimization", slm);
|
||||
|
||||
data.registerOption( m_dialog->pf_check_shadowing ,fwopt, "check_shading" );
|
||||
data.registerOption( m_dialog->pf_pass_all_out ,fwopt, "pass_all_out" );
|
||||
data.registerOption( m_dialog->pf_in_out_code ,fwopt, "in_out_code" );
|
||||
@ -190,7 +192,7 @@ pfAdvancedDialog::pfAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
slm = getPrologPlaces( obj->getStr("platform").c_str() );
|
||||
m_dialog->prologPlace->clear();
|
||||
m_dialog->prologPlace->addItems(getScreenNames(slm));
|
||||
data.registerOption( m_dialog->prologPlace, fwopt, "prolog_place", slm);
|
||||
data.registerOption( m_dialog->prologPlace, fwopt, "prolog_place", slm);
|
||||
|
||||
data.registerOption( m_dialog->prolog_script , fwopt, "prolog_script" );
|
||||
data.registerOption( m_dialog->epilog_script , fwopt, "epilog_script" );
|
||||
@ -232,23 +234,23 @@ void pfAdvancedDialog::ltToggled()
|
||||
m_dialog->pf_timeout_interval->setEnabled( m_dialog->pf_do_timeout_interval->isChecked() );
|
||||
m_dialog->pf_timeout_frag->setEnabled( m_dialog->pf_do_timeout_frag->isChecked() );
|
||||
|
||||
m_dialog->pf_tcp_first->setEnabled( m_dialog->pf_set_tcp_first->isChecked() );
|
||||
m_dialog->pf_tcp_opening->setEnabled( m_dialog->pf_set_tcp_opening->isChecked() );
|
||||
m_dialog->pf_tcp_established->setEnabled( m_dialog->pf_set_tcp_established->isChecked() );
|
||||
m_dialog->pf_tcp_closing->setEnabled( m_dialog->pf_set_tcp_closing->isChecked() );
|
||||
m_dialog->pf_tcp_finwait->setEnabled( m_dialog->pf_set_tcp_finwait->isChecked() );
|
||||
m_dialog->pf_tcp_closed->setEnabled( m_dialog->pf_set_tcp_closed->isChecked() );
|
||||
m_dialog->pf_udp_first->setEnabled( m_dialog->pf_set_udp_first->isChecked() );
|
||||
m_dialog->pf_udp_single->setEnabled( m_dialog->pf_set_udp_single->isChecked() );
|
||||
m_dialog->pf_udp_multiple->setEnabled( m_dialog->pf_set_udp_multiple->isChecked() );
|
||||
m_dialog->pf_icmp_first->setEnabled( m_dialog->pf_set_icmp_first->isChecked() );
|
||||
m_dialog->pf_icmp_error->setEnabled( m_dialog->pf_set_icmp_error->isChecked() );
|
||||
m_dialog->pf_other_first->setEnabled( m_dialog->pf_set_other_first->isChecked() );
|
||||
m_dialog->pf_other_single->setEnabled( m_dialog->pf_set_other_single->isChecked() );
|
||||
m_dialog->pf_other_multiple->setEnabled( m_dialog->pf_set_other_multiple->isChecked() );
|
||||
m_dialog->pf_tcp_first->setEnabled( m_dialog->pf_set_tcp_first->isChecked() );
|
||||
m_dialog->pf_tcp_opening->setEnabled( m_dialog->pf_set_tcp_opening->isChecked() );
|
||||
m_dialog->pf_tcp_established->setEnabled( m_dialog->pf_set_tcp_established->isChecked() );
|
||||
m_dialog->pf_tcp_closing->setEnabled( m_dialog->pf_set_tcp_closing->isChecked() );
|
||||
m_dialog->pf_tcp_finwait->setEnabled( m_dialog->pf_set_tcp_finwait->isChecked() );
|
||||
m_dialog->pf_tcp_closed->setEnabled( m_dialog->pf_set_tcp_closed->isChecked() );
|
||||
m_dialog->pf_udp_first->setEnabled( m_dialog->pf_set_udp_first->isChecked() );
|
||||
m_dialog->pf_udp_single->setEnabled( m_dialog->pf_set_udp_single->isChecked() );
|
||||
m_dialog->pf_udp_multiple->setEnabled( m_dialog->pf_set_udp_multiple->isChecked() );
|
||||
m_dialog->pf_icmp_first->setEnabled( m_dialog->pf_set_icmp_first->isChecked() );
|
||||
m_dialog->pf_icmp_error->setEnabled( m_dialog->pf_set_icmp_error->isChecked() );
|
||||
m_dialog->pf_other_first->setEnabled( m_dialog->pf_set_other_first->isChecked() );
|
||||
m_dialog->pf_other_single->setEnabled( m_dialog->pf_set_other_single->isChecked() );
|
||||
m_dialog->pf_other_multiple->setEnabled( m_dialog->pf_set_other_multiple->isChecked() );
|
||||
|
||||
m_dialog->pf_adaptive_start->setEnabled( m_dialog->pf_set_adaptive->isChecked() );
|
||||
m_dialog->pf_adaptive_end->setEnabled( m_dialog->pf_set_adaptive->isChecked() );
|
||||
m_dialog->pf_adaptive_start->setEnabled( m_dialog->pf_set_adaptive->isChecked() );
|
||||
m_dialog->pf_adaptive_end->setEnabled( m_dialog->pf_set_adaptive->isChecked() );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -268,7 +270,7 @@ void pfAdvancedDialog::accept()
|
||||
pis->setCommand( m_dialog->installScript->text().toLatin1().constData() );
|
||||
pis->setArguments( m_dialog->installScriptArgs->text().toLatin1().constData() );
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,13 +25,14 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "pixAdvancedDialog.h"
|
||||
#include "SimpleTextEditor.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
#include "FWBSettings.h"
|
||||
|
||||
@ -73,7 +74,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
Firewall *fw=Firewall::cast(obj);
|
||||
FWOptions *fwopt=fw->getOptionsObject();
|
||||
string compiler=fwopt->getStr("compiler");
|
||||
if (compiler=="")
|
||||
if (compiler=="")
|
||||
{
|
||||
compiler=Resources::platform_res[fw->getStr("platform")]->getCompiler();
|
||||
}
|
||||
@ -109,7 +110,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
connect(fwb_pix_proc, SIGNAL(readyReadStandardError()), this, SLOT(readFromStderr() ) );
|
||||
connect(fwb_pix_proc, SIGNAL(stateChanged( QProcess::ProcessState )), this, SLOT(fwb_pix_Finished( QProcess::ProcessState ) ) );
|
||||
connect(fwb_pix_proc, SIGNAL(bytesWritten(qint64)), this, SLOT(allXMLSent() ) );
|
||||
|
||||
|
||||
compilerPath = compiler.c_str();
|
||||
argumentList << "-f" << "-" << "-i" << fw->getName().c_str();
|
||||
|
||||
@ -143,27 +144,27 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
s=QObject::tr("3 - Error Message");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("3");
|
||||
logLevelMapping.push_back("3");
|
||||
|
||||
s=QObject::tr("4 - Warning Message");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("4");
|
||||
logLevelMapping.push_back("4");
|
||||
|
||||
s=QObject::tr("5 - Normal but significant condition");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("5");
|
||||
logLevelMapping.push_back("5");
|
||||
|
||||
s=QObject::tr("6 - Informational");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("6");
|
||||
logLevelMapping.push_back("6");
|
||||
|
||||
s=QObject::tr("7 - Debug Message");
|
||||
logLevels.push_back(s);
|
||||
logLevelMapping.push_back(s);
|
||||
logLevelMapping.push_back("7");
|
||||
logLevelMapping.push_back("7");
|
||||
|
||||
/* do not need to translate syslog facilities, but will use the same
|
||||
* method just in case */
|
||||
@ -219,7 +220,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
/*
|
||||
* If none of the new pix_acl_* options is set and old pix_add_clear_statements
|
||||
* option is true, set pix_acl_basic to true.
|
||||
*
|
||||
*
|
||||
* If old option pix_add_clear_statements iss false, set
|
||||
* pix_acl_no_clear to true
|
||||
*/
|
||||
@ -245,75 +246,75 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
data.registerOption( m_dialog->outputFileName , fwoptions,
|
||||
"output_file" );
|
||||
|
||||
data.registerOption( m_dialog->pix_assume_fw_part_of_any , fwoptions,
|
||||
data.registerOption( m_dialog->pix_assume_fw_part_of_any , fwoptions,
|
||||
"pix_assume_fw_part_of_any" );
|
||||
|
||||
data.registerOption( m_dialog->pix_replace_natted_objects , fwoptions,
|
||||
data.registerOption( m_dialog->pix_replace_natted_objects , fwoptions,
|
||||
"pix_replace_natted_objects" );
|
||||
|
||||
data.registerOption( m_dialog->pix_emulate_out_acl , fwoptions,
|
||||
data.registerOption( m_dialog->pix_emulate_out_acl , fwoptions,
|
||||
"pix_emulate_out_acl" );
|
||||
|
||||
data.registerOption( m_dialog->pix_generate_out_acl , fwoptions,
|
||||
data.registerOption( m_dialog->pix_generate_out_acl , fwoptions,
|
||||
"pix_generate_out_acl" );
|
||||
|
||||
|
||||
data.registerOption( m_dialog->pix_acl_basic , fwoptions,
|
||||
data.registerOption( m_dialog->pix_acl_basic , fwoptions,
|
||||
"pix_acl_basic" );
|
||||
|
||||
/*
|
||||
data.registerOption( m_dialog->pix_acl_alwaysNew , fwoptions,
|
||||
data.registerOption( m_dialog->pix_acl_alwaysNew , fwoptions,
|
||||
"pix_acl_always_new" );
|
||||
*/
|
||||
|
||||
data.registerOption( m_dialog->pix_acl_no_clear , fwoptions,
|
||||
data.registerOption( m_dialog->pix_acl_no_clear , fwoptions,
|
||||
"pix_acl_no_clear" );
|
||||
|
||||
data.registerOption( m_dialog->pix_acl_substitution , fwoptions,
|
||||
data.registerOption( m_dialog->pix_acl_substitution , fwoptions,
|
||||
"pix_acl_substitution" );
|
||||
|
||||
data.registerOption( m_dialog->pix_acl_temp_addr , fwoptions,
|
||||
data.registerOption( m_dialog->pix_acl_temp_addr , fwoptions,
|
||||
"pix_acl_temp_addr" );
|
||||
|
||||
|
||||
data.registerOption( m_dialog->pix_include_comments , fwoptions,
|
||||
data.registerOption( m_dialog->pix_include_comments , fwoptions,
|
||||
"pix_include_comments" );
|
||||
|
||||
data.registerOption( m_dialog->pix_use_acl_remarks , fwoptions,
|
||||
data.registerOption( m_dialog->pix_use_acl_remarks , fwoptions,
|
||||
"pix_use_acl_remarks" );
|
||||
|
||||
data.registerOption( m_dialog->pix_regroup_commands , fwoptions,
|
||||
data.registerOption( m_dialog->pix_regroup_commands , fwoptions,
|
||||
"pix_regroup_commands" );
|
||||
|
||||
data.registerOption( m_dialog->pix_use_manual_commit , fwoptions,
|
||||
data.registerOption( m_dialog->pix_use_manual_commit , fwoptions,
|
||||
"pix_use_manual_commit" );
|
||||
|
||||
m_dialog->pix_use_manual_commit->setEnabled(platform=="fwsm");
|
||||
/*
|
||||
data.registerOption( m_dialog->pix_add_clear_statements , fwoptions,
|
||||
data.registerOption( m_dialog->pix_add_clear_statements , fwoptions,
|
||||
"pix_add_clear_statements" );
|
||||
*/
|
||||
|
||||
data.registerOption( m_dialog->pix_optimize_default_nat , fwoptions,
|
||||
data.registerOption( m_dialog->pix_optimize_default_nat , fwoptions,
|
||||
"pix_optimize_default_nat" );
|
||||
|
||||
data.registerOption( m_dialog->pix_check_shadowing , fwoptions,
|
||||
data.registerOption( m_dialog->pix_check_shadowing , fwoptions,
|
||||
"check_shading" );
|
||||
|
||||
data.registerOption( m_dialog->pix_ignore_empty_groups , fwoptions,
|
||||
data.registerOption( m_dialog->pix_ignore_empty_groups , fwoptions,
|
||||
"ignore_empty_groups" );
|
||||
|
||||
|
||||
data.registerOption( m_dialog->pix_check_duplicate_nat , fwoptions,
|
||||
data.registerOption( m_dialog->pix_check_duplicate_nat , fwoptions,
|
||||
"pix_check_duplicate_nat" );
|
||||
|
||||
data.registerOption( m_dialog->pix_check_overlapping_global_pools , fwoptions,
|
||||
data.registerOption( m_dialog->pix_check_overlapping_global_pools , fwoptions,
|
||||
"pix_check_overlapping_global_pools" );
|
||||
|
||||
data.registerOption( m_dialog->pix_check_overlapping_statics , fwoptions,
|
||||
data.registerOption( m_dialog->pix_check_overlapping_statics , fwoptions,
|
||||
"pix_check_overlapping_statics" );
|
||||
|
||||
data.registerOption( m_dialog->pix_check_overlapping_global_statics , fwoptions,
|
||||
data.registerOption( m_dialog->pix_check_overlapping_global_statics , fwoptions,
|
||||
"pix_check_overlapping_global_statics" );
|
||||
|
||||
data.registerOption( m_dialog->mgmt_ssh , fwoptions, "mgmt_ssh" );
|
||||
@ -332,10 +333,10 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
|
||||
|
||||
/* page "Prolog/Epilog" */
|
||||
data.registerOption( m_dialog->pix_prolog_script , fwoptions,
|
||||
data.registerOption( m_dialog->pix_prolog_script , fwoptions,
|
||||
"pix_prolog_script" );
|
||||
|
||||
data.registerOption( m_dialog->pix_epilog_script , fwoptions,
|
||||
data.registerOption( m_dialog->pix_epilog_script , fwoptions,
|
||||
"pix_epilog_script" );
|
||||
|
||||
/* page "Timeouts" */
|
||||
@ -366,7 +367,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
data.registerOption( m_dialog->sip_media_hh , fwoptions, "sip_media_hh" );
|
||||
data.registerOption( m_dialog->sip_media_mm , fwoptions, "sip_media_mm" );
|
||||
data.registerOption( m_dialog->sip_media_ss , fwoptions, "sip_media_ss" );
|
||||
|
||||
|
||||
data.registerOption( m_dialog->half_closed_hh , fwoptions, "half-closed_hh");
|
||||
data.registerOption( m_dialog->half_closed_mm , fwoptions, "half-closed_mm");
|
||||
data.registerOption( m_dialog->half_closed_ss , fwoptions, "half-closed_ss");
|
||||
@ -407,7 +408,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("pixAdvancedDialog::pixAdvancedDialog lst = %s",lst.c_str());
|
||||
|
||||
|
||||
|
||||
for (list<fixupControl>::iterator fi=allFixups.begin(); fi!=allFixups.end(); fi++)
|
||||
{
|
||||
@ -431,7 +432,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
while ( i<lst.size() )
|
||||
{
|
||||
j=lst.find(",",i);
|
||||
if (QString(lst.substr(i,j-i).c_str())==fi->fwoption)
|
||||
if (QString(lst.substr(i,j-i).c_str())==fi->fwoption)
|
||||
{ present=true; break; }
|
||||
if (j==string::npos) break;
|
||||
i=j+1;
|
||||
@ -481,7 +482,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget *parent,FWObject *o)//(parent)
|
||||
|
||||
QStringList interfaces;
|
||||
list<FWObject*> l2=obj->getByType(Interface::TYPENAME);
|
||||
for (list<FWObject*>::iterator i=l2.begin(); i!=l2.end(); ++i)
|
||||
for (list<FWObject*>::iterator i=l2.begin(); i!=l2.end(); ++i)
|
||||
interfaces.push_back( (Interface::cast(*i))->getLabel().c_str() );
|
||||
|
||||
m_dialog->syslog_device_id_interface_val->addItems(interfaces);
|
||||
@ -595,7 +596,7 @@ void pixAdvancedDialog::changeAllFixups(int state)
|
||||
if (!fi->active) continue;
|
||||
|
||||
fi->switch_widget->setCurrentIndex(
|
||||
translateFixupSwitchFromOptionToWidget(state) );
|
||||
translateFixupSwitchFromOptionToWidget(state) );
|
||||
}
|
||||
updateFixupCommandsDisplay();
|
||||
}
|
||||
@ -683,7 +684,7 @@ void pixAdvancedDialog::displayCommands()
|
||||
FREEXMLBUFF(buffer);
|
||||
|
||||
fwb_pix_proc->start(compilerPath, argumentList);
|
||||
if ( !fwb_pix_proc->waitForStarted() )
|
||||
if ( !fwb_pix_proc->waitForStarted() )
|
||||
{
|
||||
m_dialog->pix_generated_fixup->append(
|
||||
tr("Error: Policy compiler for PIX is not installed") );
|
||||
@ -710,7 +711,7 @@ void pixAdvancedDialog::readFromStderr()
|
||||
void pixAdvancedDialog::fwb_pix_Finished( QProcess::ProcessState newState )
|
||||
{
|
||||
if (newState != QProcess::NotRunning) return;
|
||||
|
||||
|
||||
if (fwb_pix_proc->exitStatus() != QProcess::NormalExit)
|
||||
m_dialog->pix_generated_fixup->append( tr("Compiler error") );
|
||||
}
|
||||
@ -733,7 +734,7 @@ void pixAdvancedDialog::updateFixupCommandsDisplay()
|
||||
}
|
||||
|
||||
void pixAdvancedDialog::fixupCmdChanged()
|
||||
{
|
||||
{
|
||||
updateFixupCommandsDisplay();
|
||||
}
|
||||
|
||||
@ -754,7 +755,7 @@ void pixAdvancedDialog::accept()
|
||||
// PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
|
||||
// pis->setCommand( installScript->text() );
|
||||
// pis->setArguments( installScriptArgs->text() );
|
||||
|
||||
|
||||
mgmt->setAddress( (Firewall::cast(obj))->getAddress() );
|
||||
|
||||
|
||||
@ -783,7 +784,7 @@ void pixAdvancedDialog::accept()
|
||||
pis->setCommand( m_dialog->installScript->text().toLatin1().constData() );
|
||||
pis->setArguments( m_dialog->installScriptArgs->text().toLatin1().constData() );
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@ -815,7 +816,7 @@ void pixAdvancedDialog::setDefaultTimeoutValue(const QString &option)
|
||||
string platform = obj->getStr("platform"); // could be 'pix' or 'fwsm'
|
||||
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
|
||||
assert(fwoptions!=NULL);
|
||||
|
||||
|
||||
string vers="version_"+obj->getStr("version");
|
||||
|
||||
if (option=="uauth_abs" || option=="uauth_inact")
|
||||
@ -832,7 +833,7 @@ void pixAdvancedDialog::defaultTimeouts()
|
||||
{
|
||||
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
|
||||
assert(fwoptions!=NULL);
|
||||
|
||||
|
||||
string vers="version_"+obj->getStr("version");
|
||||
|
||||
setDefaultTimeoutValue("xlate_hh" );
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -25,12 +25,14 @@
|
||||
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "pixosAdvancedDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
@ -57,7 +59,7 @@ pixosAdvancedDialog::pixosAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
{
|
||||
m_dialog = new Ui::pixosAdvancedDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
|
||||
|
||||
obj=o;
|
||||
|
||||
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
|
||||
@ -106,7 +108,7 @@ pixosAdvancedDialog::pixosAdvancedDialog(QWidget *parent,FWObject *o)
|
||||
void pixosAdvancedDialog::accept()
|
||||
{
|
||||
data.saveAll();
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
|
||||
@ -144,7 +146,7 @@ void init_platforms()
|
||||
routeOptions_pf_ipf.push_back("route_reply_through");
|
||||
routeOptions_pf_ipf.push_back(QObject::tr("Route a copy through"));
|
||||
routeOptions_pf_ipf.push_back("route_copy_through");
|
||||
|
||||
|
||||
routeLoadOptions_pf.push_back(QObject::tr("None"));
|
||||
routeLoadOptions_pf.push_back("none");
|
||||
routeLoadOptions_pf.push_back(QObject::tr("Random"));
|
||||
@ -153,14 +155,14 @@ void init_platforms()
|
||||
routeLoadOptions_pf.push_back("source_hash");
|
||||
routeLoadOptions_pf.push_back(QObject::tr("Round Robin"));
|
||||
routeLoadOptions_pf.push_back("round_robin");
|
||||
|
||||
|
||||
prologPlaces_ipt.push_back(QObject::tr("on top of the script"));
|
||||
prologPlaces_ipt.push_back("top");
|
||||
prologPlaces_ipt.push_back(QObject::tr("after interface configuration"));
|
||||
prologPlaces_ipt.push_back("after_interfaces");
|
||||
prologPlaces_ipt.push_back(QObject::tr("after policy reset"));
|
||||
prologPlaces_ipt.push_back("after_flush");
|
||||
|
||||
|
||||
prologPlaces_pf.push_back(QObject::tr("in the activation shell script"));
|
||||
prologPlaces_pf.push_back("fw_file");
|
||||
|
||||
@ -175,7 +177,7 @@ void init_platforms()
|
||||
|
||||
prologPlaces_pf.push_back(QObject::tr("in the pf rule file, after table definitions"));
|
||||
prologPlaces_pf.push_back("pf_file_after_tables");
|
||||
|
||||
|
||||
limitSuffixes.push_back("");
|
||||
limitSuffixes.push_back("");
|
||||
limitSuffixes.push_back(QObject::tr("/day"));
|
||||
@ -217,10 +219,10 @@ bool isDefaultPolicyRuleOptions(FWOptions *opt)
|
||||
if (PolicyRuleOptions::isA(opt))
|
||||
{
|
||||
|
||||
if (platform=="iptables")
|
||||
if (platform=="iptables")
|
||||
{
|
||||
res= ( opt->getStr("log_prefix").empty() &&
|
||||
opt->getStr("log_level").empty() &&
|
||||
res= ( opt->getStr("log_prefix").empty() &&
|
||||
opt->getStr("log_level").empty() &&
|
||||
opt->getInt("limit_value")<=0 &&
|
||||
opt->getInt("limit_burst")<=0 &&
|
||||
opt->getInt("connlimit_value")<=0 &&
|
||||
@ -239,13 +241,13 @@ bool isDefaultPolicyRuleOptions(FWOptions *opt)
|
||||
! opt->getBool("firewall_is_part_of_any_and_networks"));
|
||||
}
|
||||
|
||||
if (platform=="pix" || platform=="fwsm")
|
||||
if (platform=="pix" || platform=="fwsm")
|
||||
{
|
||||
string vers="version_"+p->getStr("version");
|
||||
if ( Resources::platform_res[platform.toAscii().constData()]->getResourceBool(
|
||||
"/FWBuilderResources/Target/options/"+vers+"/pix_rule_syslog_settings"))
|
||||
{
|
||||
res= ( opt->getStr("log_level").empty() &&
|
||||
res= ( opt->getStr("log_level").empty() &&
|
||||
opt->getInt("log_interval")<=0 &&
|
||||
! opt->getBool("disable_logging_for_this_rule") );
|
||||
}
|
||||
@ -255,12 +257,12 @@ bool isDefaultPolicyRuleOptions(FWOptions *opt)
|
||||
}
|
||||
}
|
||||
|
||||
if (platform=="pf")
|
||||
if (platform=="pf")
|
||||
{
|
||||
string vers=p->getStr("version");
|
||||
if (vers=="4.x")
|
||||
{
|
||||
res= ( opt->getStr("log_prefix").empty() &&
|
||||
res= ( opt->getStr("log_prefix").empty() &&
|
||||
opt->getInt("pf_rule_max_state")<=0 &&
|
||||
! opt->getBool("pf_source_tracking") &&
|
||||
opt->getInt("pf_max_src_conn")<=0 &&
|
||||
@ -270,7 +272,7 @@ bool isDefaultPolicyRuleOptions(FWOptions *opt)
|
||||
);
|
||||
}else
|
||||
{
|
||||
res= ( opt->getStr("log_prefix").empty() &&
|
||||
res= ( opt->getStr("log_prefix").empty() &&
|
||||
opt->getInt("pf_rule_max_state")<=0 &&
|
||||
! opt->getBool("pf_source_tracking") &&
|
||||
opt->getInt("pf_max_src_conn")<=0 &&
|
||||
@ -280,15 +282,15 @@ bool isDefaultPolicyRuleOptions(FWOptions *opt)
|
||||
}
|
||||
}
|
||||
|
||||
if (platform=="ipf")
|
||||
if (platform=="ipf")
|
||||
{
|
||||
res= ( opt->getStr("ipf_log_facility").empty() &&
|
||||
opt->getStr("log_level").empty() &&
|
||||
res= ( opt->getStr("ipf_log_facility").empty() &&
|
||||
opt->getStr("log_level").empty() &&
|
||||
! opt->getBool("ipf_keep_frags") &&
|
||||
! opt->getBool("ipf_return_icmp_as_dest") );
|
||||
}
|
||||
|
||||
if (platform=="ipfw")
|
||||
if (platform=="ipfw")
|
||||
{
|
||||
//res= ( ! opt->getBool("stateless") );
|
||||
res = true;
|
||||
@ -315,7 +317,7 @@ bool isDefaultPolicyRuleOptions(FWOptions *opt)
|
||||
}
|
||||
|
||||
}
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool isDefaultNATRuleOptions(FWOptions *opt)
|
||||
@ -336,22 +338,22 @@ bool isDefaultNATRuleOptions(FWOptions *opt)
|
||||
|
||||
if (NATRuleOptions::isA(opt))
|
||||
{
|
||||
if (platform=="pf")
|
||||
if (platform=="pf")
|
||||
{
|
||||
// if "pf_pool_type_none" is undefined, then all others
|
||||
// if "pf_pool_type_none" is undefined, then all others
|
||||
// should not be defined too because they all are set by
|
||||
// the same dialog
|
||||
// In this case consider options default.
|
||||
res = (opt->getStr("pf_pool_type_none") == "" ||
|
||||
( opt->getBool("pf_pool_type_none") &&
|
||||
! opt->getBool("pf_bitmask") &&
|
||||
! opt->getBool("pf_random") &&
|
||||
! opt->getBool("pf_source_hash") &&
|
||||
! opt->getBool("pf_round_robin") &&
|
||||
! opt->getBool("pf_random") &&
|
||||
! opt->getBool("pf_source_hash") &&
|
||||
! opt->getBool("pf_round_robin") &&
|
||||
! opt->getBool("pf_static_port") ) );
|
||||
}
|
||||
}
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool isDefaultRoutingRuleOptions(FWOptions *opt)
|
||||
@ -364,7 +366,7 @@ bool isDefaultRoutingRuleOptions(FWOptions *opt)
|
||||
if (RoutingRuleOptions::isA(opt))
|
||||
{
|
||||
res= ( ! opt->getBool("no_fail") );
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -407,7 +409,7 @@ list<QStringPair> getVersionsForPlatform(const QString &platform)
|
||||
res.push_back(QStringPair(*i,*i));
|
||||
} else
|
||||
{
|
||||
if (platform=="pf")
|
||||
if (platform=="pf")
|
||||
{
|
||||
res.push_back(QStringPair("","- any -"));
|
||||
res.push_back(QStringPair("3.x", QObject::tr("3.x")));
|
||||
@ -416,13 +418,13 @@ list<QStringPair> getVersionsForPlatform(const QString &platform)
|
||||
/* add pf versions here */
|
||||
} else
|
||||
{
|
||||
if (platform=="ipf")
|
||||
if (platform=="ipf")
|
||||
{
|
||||
res.push_back(QStringPair("","- any -"));
|
||||
/* add ipf versions here */
|
||||
} else
|
||||
{
|
||||
if (platform=="ipfw")
|
||||
if (platform=="ipfw")
|
||||
{
|
||||
res.push_back(QStringPair("","- any -"));
|
||||
/* add ipfw versions here */
|
||||
@ -494,8 +496,8 @@ const QStringList& getLimitSuffixes(const QString &platform)
|
||||
QStringList getScreenNames(const QStringList &sl)
|
||||
{
|
||||
QStringList res;
|
||||
|
||||
for( QStringList::const_iterator it = sl.begin();
|
||||
|
||||
for( QStringList::const_iterator it = sl.begin();
|
||||
it!=sl.end();
|
||||
++it,++it)
|
||||
{
|
||||
@ -507,7 +509,7 @@ QStringList getScreenNames(const QStringList &sl)
|
||||
QString getScreenName(QString s, const QStringList &sl)
|
||||
{
|
||||
QString res;
|
||||
for( QStringList::const_iterator it = sl.begin();
|
||||
for( QStringList::const_iterator it = sl.begin();
|
||||
it!=sl.end();
|
||||
++it)
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -101,7 +103,7 @@ bool printerStream::begin()
|
||||
|
||||
yPos = 0;
|
||||
pageNo = 1;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -214,7 +216,7 @@ void printerStream::printPixmap(const QPixmap &pm, bool newLine)
|
||||
void printerStream::printQTable(QTableView *tbl, bool left_margin, bool top_margin)
|
||||
{
|
||||
if (fwbdebug)
|
||||
{
|
||||
{
|
||||
qDebug("printQTable ----------------------------------------------");
|
||||
qDebug("Size: %dx%d",tbl->width(),tbl->height());
|
||||
qDebug("Visible: %dx%d",tbl->contentsRect().width(),tbl->contentsRect().height());
|
||||
@ -263,7 +265,7 @@ void printerStream::printQTable(QTableView *tbl, bool left_margin, bool top_marg
|
||||
|
||||
int firstRowPos = tbl->verticalHeader()->sectionPosition(firstRow);
|
||||
int lastRowPos = tbl->verticalHeader()->sectionPosition(lastRow);
|
||||
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("Page %d -- %d rows (%d-%d) tblHeight: %d firstRowPos: %d lastRowPos: %d",
|
||||
pageNo, rowCount,
|
||||
@ -287,7 +289,7 @@ void printerStream::printQTable(QTableView *tbl, bool left_margin, bool top_marg
|
||||
tbl->horizontalHeader()->height());
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
{
|
||||
qDebug(" After resize:");
|
||||
qDebug(" Size: %dx%d",tbl->width(),tbl->height());
|
||||
qDebug(" Visible: %dx%d",
|
||||
|
||||
634
src/gui/projectpanel_q.ui
Normal file
634
src/gui/projectpanel_q.ui
Normal file
@ -0,0 +1,634 @@
|
||||
<ui version="4.0" >
|
||||
<class>ProjectPanel_q</class>
|
||||
<widget class="QWidget" name="ProjectPanel_q" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>627</width>
|
||||
<height>456</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QFrame" name="frame1" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="mainSplitter" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="childrenCollapsible" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame16" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QFrame" name="frame21" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QToolButton" name="infoStyleButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Click here to change amount of information shown about object selected in the tree</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="MainRes.qrc" >:/Icons/info_25.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>8</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QSplitter" name="objInfoSplitter" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="childrenCollapsible" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="ObjectManipulator" native="1" name="om" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="oi" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="rightFrame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="firewallName" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Firewall Name</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Firewalls:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="fwList" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QTabWidget" name="ruleSets" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>144</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_3" >
|
||||
<attribute name="title" >
|
||||
<string>Tab 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QFrame" name="auxiliaryPanel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>32767</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QFrame" name="objectEditorFrame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QStackedWidget" name="objectEditorStack" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="WStackPage" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="applyObjectEditorButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeObjectEditorButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ObjectManipulator</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ObjectManipulator.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,19 +17,20 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "platforms.h"
|
||||
|
||||
#include "solarisAdvancedDialog.h"
|
||||
#include "ObjectManipulator.h"
|
||||
|
||||
#include "FWWindow.h"
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Management.h"
|
||||
|
||||
@ -119,7 +120,7 @@ void solarisAdvancedDialog::accept()
|
||||
|
||||
data.saveAll();
|
||||
|
||||
om->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
mw->updateLastModifiedTimestampForAllFirewalls(obj);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,12 +17,14 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
@ -99,7 +101,7 @@ QAction* addPopupMenuItem(QObject *res,
|
||||
// pm = QPixmap::fromMimeSource( icn.c_str() );
|
||||
if ( ! QPixmapCache::find( icn.c_str(), pm) )
|
||||
{
|
||||
pm.load( (":/"+icn).c_str() );//fromMimeSource( icn.c_str() );
|
||||
pm.load( (":/"+icn).c_str() );//fromMimeSource( icn.c_str() );
|
||||
QPixmapCache::insert( icn.c_str(), pm);
|
||||
}
|
||||
act = menu->addAction( pm, itemName , res , member, accel ); //insertItem
|
||||
@ -144,7 +146,7 @@ void fillLibraries(QComboBox *libs, libfwbuilder::FWObject *obj, bool rw)
|
||||
if (lib==QString((*i)->getName().c_str())) cn=n;
|
||||
QPixmap icon;
|
||||
icon.load( (libicn).c_str() );
|
||||
|
||||
|
||||
libs->addItem(icon,
|
||||
QString::fromUtf8((*i)->getName().c_str()) );
|
||||
n++;
|
||||
@ -187,14 +189,14 @@ void fillLibraries(QListWidget *libs, libfwbuilder::FWObject *obj, bool rw)
|
||||
|
||||
if (rw && (*i)->isReadOnly()) continue;
|
||||
if (lib==QString((*i)->getName().c_str())) cn=n;
|
||||
|
||||
|
||||
QPixmap icon;
|
||||
icon.load( (":/"+libicn).c_str() );
|
||||
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem(icon, (*i)->getName().c_str());
|
||||
|
||||
|
||||
libs->addItem(item);
|
||||
|
||||
|
||||
n++;
|
||||
}
|
||||
libs->setCurrentRow(cn);
|
||||
@ -265,7 +267,7 @@ DWORD bufCharCount = INFO_BUFFER_SIZE;
|
||||
#else
|
||||
|
||||
char *lname = getenv("LOGNAME");
|
||||
if (lname!=NULL)
|
||||
if (lname!=NULL)
|
||||
uname = QString(lname);
|
||||
else
|
||||
{
|
||||
@ -374,10 +376,10 @@ void setDisabledPalette(QWidget *w)
|
||||
|
||||
pal.setCurrentColorGroup( QPalette::Active );
|
||||
pal.setColor( QPalette::Text, Qt::black );
|
||||
|
||||
|
||||
pal.setCurrentColorGroup( QPalette::Inactive );
|
||||
pal.setColor( QPalette::Text, Qt::black );
|
||||
|
||||
|
||||
pal.setCurrentColorGroup( QPalette::Disabled );
|
||||
pal.setColor( QPalette::Text, Qt::black );
|
||||
|
||||
@ -387,17 +389,17 @@ void setDisabledPalette(QWidget *w)
|
||||
QString getAddrByName(const QString &name)
|
||||
{
|
||||
QHostInfo a = QHostInfo::fromName(name);
|
||||
|
||||
|
||||
QList<QHostAddress> alist = a.addresses();
|
||||
|
||||
/*while (a.isWorking())
|
||||
{
|
||||
app->processEvents(200);
|
||||
}
|
||||
alist = a.addresses();*/
|
||||
//we're using the blocking-type function
|
||||
alist = a.addresses();*/
|
||||
//we're using the blocking-type function
|
||||
//"fromName" so we don't have to wait
|
||||
|
||||
|
||||
if (alist.empty()) return "";
|
||||
return alist.front().toString();
|
||||
}
|
||||
@ -406,9 +408,9 @@ QString getNameByAddr(const QString &addr)
|
||||
{
|
||||
/*QHostAddress ha;
|
||||
ha.setAddress(addr);
|
||||
|
||||
|
||||
Q3Dns qry( ha, Q3Dns::Ptr);
|
||||
|
||||
|
||||
QStringList nlist = qry.hostNames();
|
||||
|
||||
while (qry.isWorking())
|
||||
@ -417,10 +419,10 @@ QString getNameByAddr(const QString &addr)
|
||||
}
|
||||
nlist = qry.hostNames();
|
||||
if (nlist.empty()) return "";
|
||||
|
||||
|
||||
return nlist.front();*/
|
||||
QHostInfo a = QHostInfo::fromName(addr);
|
||||
|
||||
|
||||
return a.hostName();
|
||||
}
|
||||
|
||||
@ -433,7 +435,7 @@ QString wordWrap(const QString& s, int maxchinline)
|
||||
/*unsigned*/ int pos=0;
|
||||
QString res="";
|
||||
QChar ch;
|
||||
|
||||
|
||||
for ( ; pos < s.length(); pos++,chcount++)
|
||||
{
|
||||
ch = s.at(pos);
|
||||
@ -457,7 +459,7 @@ QString wordWrap(const QString& s, int maxchinline)
|
||||
res.append(s.mid(linestart,lastwdpos-linestart));
|
||||
linestart=lastwdpos;
|
||||
pos=lastwdpos;
|
||||
|
||||
|
||||
}else
|
||||
{
|
||||
res.append(s.mid(linestart,pos-linestart));
|
||||
@ -472,7 +474,7 @@ QString wordWrap(const QString& s, int maxchinline)
|
||||
if (pos<s.length())
|
||||
{
|
||||
linestart=pos--;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
@ -17,13 +17,15 @@
|
||||
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.
|
||||
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
//#include "config.h" <- TAPIR: wasn't commented
|
||||
#include "fwbuilder_ph.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "utils_no_qt.h"
|
||||
|
||||
@ -82,7 +84,7 @@ void findByObjectType(FWObject *o,
|
||||
if (o->getId()==DELETED_LIB) return;
|
||||
if (o->getId()==TEMPLATE_LIB) return;
|
||||
}
|
||||
|
||||
|
||||
for (list<FWObject*>::iterator m=o->begin(); m!=o->end(); m++)
|
||||
{
|
||||
FWObject *o1=*m;
|
||||
@ -95,7 +97,7 @@ void findByObjectType(FWObject *o,
|
||||
|
||||
FWReference* findRef(FWObject *o,FWObject *p)
|
||||
{
|
||||
|
||||
|
||||
FWReference* ref=NULL;
|
||||
FWObject::iterator i=p->begin();
|
||||
for(;i!=p->end();++i)
|
||||
@ -107,7 +109,7 @@ FWReference* findRef(FWObject *o,FWObject *p)
|
||||
}
|
||||
ref=NULL;
|
||||
}
|
||||
return ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
string strip(const string &s)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user