1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-24 20:27:22 +01:00

2009-12-14 vadim <vadim@vk.crocodile.org>

* PrefsDialog.cpp (PrefsDialog::accept): Added a place in the
global Preferences dialog for options specific for different
object types. First parameters include options for DNSName and
AddressTable to let the user decide if the newly created objects
of these types should be automatically configured with "Compile
Time" or "Run Time" mode. Also, added an option that makes DNSName
object editor copy the name of the object into the DNS record
input field when new object is created or whenever the name
changes.  This is useful when the user does not want to keep
object name and dns record different because they need to enter
the name only once.

* DNSNameDialog.cpp (DNSNameDialog::applyChanges): If global
Preferences option "Use DNS Name object name for the DNS record"
is turned on, copy the name into the record on every name change.
Fixes #866
This commit is contained in:
Vadim Kurland 2009-12-14 21:07:39 +00:00
parent ad8e480bba
commit dbd9ab11f0
11 changed files with 353 additions and 111 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 2133
#define BUILD_NUM 2134

View File

@ -1,3 +1,22 @@
2009-12-14 vadim <vadim@vk.crocodile.org>
* PrefsDialog.cpp (PrefsDialog::accept): Added a place in the
global Preferences dialog for options specific for different
object types. First parameters include options for DNSName and
AddressTable to let the user decide if the newly created objects
of these types should be automatically configured with "Compile
Time" or "Run Time" mode. Also, added an option that makes DNSName
object editor copy the name of the object into the DNS record
input field when new object is created or whenever the name
changes. This is useful when the user does not want to keep
object name and dns record different because they need to enter
the name only once.
* DNSNameDialog.cpp (DNSNameDialog::applyChanges): If global
Preferences option "Use DNS Name object name for the DNS record"
is turned on, copy the name into the record on every name change.
Fixes #866
2009-12-11 vadim <vadim@vk.crocodile.org>
* GroupObjectDialog.cpp (GroupObjectDialog::newObject):

View File

@ -29,6 +29,7 @@
#include "DNSNameDialog.h"
#include "ProjectPanel.h"
#include "FWBSettings.h"
#include "FWCmdChange.h"
#include "fwbuilder/Library.h"
@ -101,6 +102,8 @@ void DNSNameDialog::loadFWObject(FWObject *o)
m_dialog->comment->setReadOnly(o->isReadOnly());
setDisabledPalette(m_dialog->comment);
if (st->getBool("Objects/DNSName/useNameForDNSRecord"))
m_dialog->dnsrec->setEnabled(false);
init=false;
@ -129,9 +132,14 @@ void DNSNameDialog::applyChanges()
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );
new_state->setComment( string(m_dialog->comment->toPlainText().toUtf8().constData()) );
s->setSourceName( m_dialog->dnsrec->text().toLatin1().constData() );
s->setRunTime(m_dialog->r_runtime->isChecked() );
if (st->getBool("Objects/DNSName/useNameForDNSRecord") &&
m_dialog->obj_name->text() != m_dialog->dnsrec->text())
m_dialog->dnsrec->setText(m_dialog->obj_name->text());
s->setSourceName( m_dialog->dnsrec->text().toLatin1().constData() );
if (!cmd->getOldState()->cmp(new_state, true))
{
if (obj->isReadOnly()) return;

View File

@ -52,7 +52,6 @@ public slots:
virtual void validate(bool*);
virtual void getHelpName(QString*);
};
#endif

View File

@ -210,8 +210,8 @@ void FWBSettings::init()
if (!ok) setCompilerOutputFont(QApplication::font());
if (fwbdebug)
qDebug("Default application font: %s",
QApplication::font().toString().toLatin1().constData());
qDebug() << "Default application font:"
<< QApplication::font();
ok = contains(clipComment);
if (!ok) setClipComment(true);
@ -227,7 +227,23 @@ void FWBSettings::init()
if (getSCPPath().isEmpty()) setSCPPath("scp");
#endif
if (!contains("Window/maximized")) setInt("Window/maximized", 1);
// Note: hasKey calls QSettings::contains using path given as
// argument, prepended with SETTINGS_PATH_PREFIX
if (!hasKey("Window/maximized")) setInt("Window/maximized", 1);
if (!hasKey("Objects/DNSName/useCompileTimeForNewObjects"))
setBool("Objects/DNSName/useCompileTimeForNewObjects", true);
if (!hasKey("Objects/DNSName/useNameForDNSRecord"))
setBool("Objects/DNSName/useNameForDNSRecord", false);
if (!hasKey("Objects/AddressTable/useCompileTimeForNewObjects"))
setBool("Objects/AddressTable/useCompileTimeForNewObjects", true);
}
bool FWBSettings::hasKey(const QString &attribute)
{
return QSettings::contains(SETTINGS_PATH_PREFIX "/" + attribute);
}
QString FWBSettings::getAppGUID()
@ -237,50 +253,50 @@ QString FWBSettings::getAppGUID()
QString FWBSettings::getStr(const QString &attribute)
{
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
QString path = SETTINGS_PATH_PREFIX "/" + attribute;
return value(path).toString();
}
void FWBSettings::setStr(const QString &attribute,
const QString &val)
{
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
QString path = SETTINGS_PATH_PREFIX "/" + attribute;
setValue(path,val);
}
bool FWBSettings::getBool(const QString &attribute)
{
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
QString path = SETTINGS_PATH_PREFIX "/" + attribute;
return value(path).toBool();
}
void FWBSettings::setBool(const QString &attribute, bool val )
{
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
QString path = SETTINGS_PATH_PREFIX "/" + attribute;
setValue(path,val);
}
int FWBSettings::getInt(const QString &attribute)
{
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
QString path = SETTINGS_PATH_PREFIX "/" + attribute;
return value(path).toInt();
}
void FWBSettings::setInt(const QString &attribute, int val )
{
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
QString path = SETTINGS_PATH_PREFIX "/" + attribute;
setValue(path,val);
}
QStringList FWBSettings::getList(const QString &attribute)
{
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
QString path = SETTINGS_PATH_PREFIX "/" + attribute;
return value(path).toStringList();
}
void FWBSettings::setList(const QString &attribute, QStringList &list)
{
QString path=SETTINGS_PATH_PREFIX "/"+attribute;
QString path = SETTINGS_PATH_PREFIX "/" + attribute;
setValue(path, list);
}

View File

@ -122,6 +122,8 @@ class FWBSettings : public QSettings {
bool getDontSaveStdLib();
void setDontSaveStdLib( bool f);
bool hasKey(const QString &attribute);
QString getStr(const QString &attribute);
void setStr(const QString &attribute, const QString &val);

View File

@ -337,6 +337,24 @@ FWObject* ObjectManipulator::actuallyCreateObject(FWObject *parent,
if (nobj->isReadOnly()) nobj->setReadOnly(false);
nobj->setName( string(objName.toUtf8().constData()) );
if (objType == DNSName::TYPENAME)
{
if (st->getBool("Objects/DNSName/useCompileTimeForNewObjects"))
DNSName::cast(nobj)->setRunTime(false);
else
DNSName::cast(nobj)->setRunTime(true);
if (st->getBool("Objects/DNSName/useNameForDNSRecord"))
DNSName::cast(nobj)->setSourceName(nobj->getName());
}
if (objType == AddressTable::TYPENAME)
{
if (st->getBool("Objects/AddressTable/useCompileTimeForNewObjects"))
AddressTable::cast(nobj)->setRunTime(false);
else
AddressTable::cast(nobj)->setRunTime(true);
}
FWCmdAddObject *cmd = new FWCmdAddObject(
m_project, parent, nobj,
QObject::tr("Create new %1").arg(objType));

View File

@ -118,6 +118,19 @@ PrefsDialog::PrefsDialog(QWidget *parent) : QDialog(parent)
m_dialog->deletedObj->setChecked( st->getBool("UI/ShowDeletedObjects") );
m_dialog->attributesInTree->setChecked( st->getBool("UI/ShowObjectsAttributesInTree") );
m_dialog->new_dns_name_compile_tm->setChecked(
st->getBool("Objects/DNSName/useCompileTimeForNewObjects"));
m_dialog->new_dns_name_run_tm->setChecked(
! st->getBool("Objects/DNSName/useCompileTimeForNewObjects"));
m_dialog->use_name_for_dns_record->setChecked(
st->getBool("Objects/DNSName/useNameForDNSRecord"));
m_dialog->new_addr_tbl_compile_tm->setChecked(
st->getBool("Objects/AddressTable/useCompileTimeForNewObjects"));
m_dialog->new_addr_tbl_run_tm->setChecked(
! st->getBool("Objects/AddressTable/useCompileTimeForNewObjects"));
m_dialog->emptyRCSLog->setChecked( st->getRCSLogState() );
m_dialog->autosaveFile->setChecked(st->getBool("Environment/autoSaveFile"));
@ -403,6 +416,14 @@ void PrefsDialog::accept()
pp->m_panel->om->loadSectionSizes();
}
st->setBool("Objects/DNSName/useCompileTimeForNewObjects",
m_dialog->new_dns_name_compile_tm->isChecked());
st->setBool("Objects/DNSName/useNameForDNSRecord",
m_dialog->use_name_for_dns_record->isChecked());
st->setBool("Objects/AddressTable/useCompileTimeForNewObjects",
m_dialog->new_addr_tbl_compile_tm->isChecked());
// QToolTip::setWakeUpDelay( st->getTooltipDelay()*1000 );
st->setRCSLogState( m_dialog->emptyRCSLog->isChecked() );

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>638</width>
<height>215</height>
<width>712</width>
<height>239</height>
</rect>
</property>
<property name="windowTitle" >
@ -48,10 +48,7 @@
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" >
<property name="spacing" >
<number>12</number>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="QLabel" name="textLabel1" >
<property name="text" >
@ -62,7 +59,7 @@
</property>
</widget>
</item>
<item row="0" column="1" >
<item row="0" column="1" colspan="2" >
<widget class="QLineEdit" name="obj_name" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
@ -88,7 +85,7 @@
</property>
</widget>
</item>
<item row="1" column="1" >
<item row="1" column="1" colspan="2" >
<widget class="QLineEdit" name="dnsrec" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
@ -102,16 +99,24 @@
<height>0</height>
</size>
</property>
<property name="toolTip" >
<string>DNS 'A' record name entered in this input field will be converted to
IP address using DNS query during policy compilation if checkbox
"Compile time" is turned on, or during firewall policy activation if
"Run Time" mode is used. This field can be automatically populated
using object name, this is controlled by an option in the global
Preferences dialog, tab "Objects"</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<item row="2" column="0" colspan="3" >
<widget class="QRadioButton" name="r_compiletime" >
<property name="text" >
<string>Compile Time</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<item row="3" column="0" colspan="3" >
<widget class="QRadioButton" name="r_runtime" >
<property name="text" >
<string>Run Time</string>
@ -167,11 +172,6 @@
<extends>QTextEdit</extends>
<header>TextEditWidget.h</header>
</customwidget>
<customwidget>
<class>QLineEdit</class>
<extends>QLineEdit</extends>
<header>QLineEdit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>obj_name</tabstop>
@ -248,4 +248,7 @@
</hints>
</connection>
</connections>
<slots>
<slot>copyNameToRecord()</slot>
</slots>
</ui>

View File

@ -19,10 +19,59 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonOk" >
<property name="text" >
<string>&amp;OK</string>
</property>
<property name="shortcut" >
<string/>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonCancel" >
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="shortcut" >
<string/>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" >
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabGeneral" >
<attribute name="title" >
@ -187,9 +236,6 @@
<string>Objects</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2" >
<property name="verticalSpacing" >
<number>20</number>
</property>
<property name="topMargin" >
<number>20</number>
</property>
@ -201,19 +247,6 @@
</widget>
</item>
<item row="0" column="1" >
<spacer name="horizontalSpacer_3" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>106</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="textLabel1_6" >
<property name="text" >
<string>Tooltip delay:</string>
@ -223,14 +256,14 @@
</property>
</widget>
</item>
<item row="0" column="3" >
<item row="0" column="2" >
<widget class="QSpinBox" name="tooltipDelay" >
<property name="minimum" >
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="4" >
<item row="0" column="3" >
<spacer name="spacer_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@ -246,39 +279,195 @@
</property>
</spacer>
</item>
<item row="1" column="0" colspan="5" >
<item row="1" column="0" colspan="3" >
<widget class="QCheckBox" name="deletedObj" >
<property name="text" >
<string>Show deleted objects</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="5" >
<item row="1" column="3" >
<widget class="QCheckBox" name="attributesInTree" >
<property name="text" >
<string>Show object attributes in the tree</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="5" >
<item row="2" column="0" colspan="4" >
<widget class="QCheckBox" name="chClipComment" >
<property name="text" >
<string>Clip comments in rules</string>
</property>
</widget>
</item>
<item row="4" column="2" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
<item row="3" column="0" colspan="4" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Properties of specific object types</string>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>183</height>
</size>
</widget>
</item>
<item row="4" column="0" colspan="4" >
<widget class="QTabWidget" name="tabWidget_2" >
<property name="currentIndex" >
<number>0</number>
</property>
</spacer>
<widget class="QWidget" name="DNSName" >
<attribute name="title" >
<string>DNS Name</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_11" >
<property name="horizontalSpacing" >
<number>20</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="MainRes.qrc" >:/Icons/DNSName/icon-big</pixmap>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_10" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>19</number>
</property>
<item row="0" column="0" >
<widget class="QRadioButton" name="new_dns_name_compile_tm" >
<property name="text" >
<string>Create new objects in "Compile Time" mode by default</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QRadioButton" name="new_dns_name_run_tm" >
<property name="text" >
<string>Create new objects in "Run Time" mode by default</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1" >
<widget class="QCheckBox" name="use_name_for_dns_record" >
<property name="text" >
<string>Use object name for the DNS record in all objects of this type</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>106</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="AddressTable" >
<attribute name="title" >
<string>Address Table</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_13" >
<property name="horizontalSpacing" >
<number>20</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label_11" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="MainRes.qrc" >:/Icons/AddressTable/icon-big</pixmap>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QFrame" name="frame_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_12" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>19</number>
</property>
<item row="0" column="0" >
<widget class="QRadioButton" name="new_addr_tbl_compile_tm" >
<property name="text" >
<string>Create new objects in "Compile Time" mode by default</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QRadioButton" name="new_addr_tbl_run_tm" >
<property name="text" >
<string>Create new objects in "Run Time" mode by default</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1" >
<spacer name="verticalSpacer_4" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>136</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
@ -1028,55 +1217,6 @@ are never stored permanently)</string>
</widget>
</widget>
</item>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonOk" >
<property name="text" >
<string>&amp;OK</string>
</property>
<property name="shortcut" >
<string/>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonCancel" >
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="shortcut" >
<string/>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
@ -1103,7 +1243,9 @@ are never stored permanently)</string>
<tabstop>grayBtn</tabstop>
<tabstop>grayText</tabstop>
</tabstops>
<resources/>
<resources>
<include location="MainRes.qrc" />
</resources>
<connections>
<connection>
<sender>buttonOk</sender>

View File

@ -196,6 +196,20 @@
checkbox in the "Find" dialog.
</p>
<p>
Added a <b>place in the global Preferences dialog for options
specific for different object types</b>. First parameters include
options for DNSName and AddressTable to let the user decide if the
newly created objects of these types should be automatically
configured with "Compile Time" or "Run Time" mode. Also, added an
option that makes <b>DNSName object editor copy the name of the
object into the DNS record input field</b> when new object is
created or whenever the name changes. This is useful when the user
does not want to keep object name and dns record different because
they need to enter the name only once.
</p>
<a name="cluster"></a>
<h2>Support for High Availability configurations</h2>