1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-23 03:37:15 +01:00

fixed #1759 "Use default template library" button seems to do

nothing. This button should only be enabled if user switched to
      their own library of template objects. The button should be
      disabled if they switched back to the standard template library
      or never switched to their own one.
This commit is contained in:
Vadim Kurland 2010-10-01 01:38:06 +00:00
parent 73752d58d9
commit 7a389e9c7d
6 changed files with 49 additions and 17 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 3296
#define BUILD_NUM 3297

View File

@ -1,5 +1,11 @@
2010-09-30 Vadim Kurland <vadim@vk.crocodile.org>
* newFirewallDialog.cpp (browseTemplate): fixed #1759 "Use default
template library" button seems to do nothing. This button should
only be enabled if user switched to their own library of template
objects. The button should be disabled if they switched back to
the standard template library or never switched to their own one.
* newHostDialog.cpp (finishClicked): fixed #1761 "blank interface
name is possible in new host wizard"

View File

@ -116,13 +116,19 @@ newFirewallDialog::newFirewallDialog(QWidget *parentw, FWObject *_p) : QDialog(p
getInterfacesBusy = false;
timer = new QTimer(this);
connect( timer, SIGNAL(timeout()), this, SLOT(monitor()) );
connect( m_dialog->templaterBrowseButton, SIGNAL(pressed()),this,SLOT(browseTemplate()));
connect( m_dialog->templateUseStandart, SIGNAL(pressed()),this,SLOT(useStandartTemplate()));
connect( m_dialog->useTemplate, SIGNAL(released()),this,SLOT(showHideTemplatePanel()));
connect( timer, SIGNAL(timeout()), this, SLOT(monitor()));
connect( m_dialog->templaterBrowseButton, SIGNAL(pressed()),
this, SLOT(browseTemplate()));
connect( m_dialog->templateUseStandard, SIGNAL(pressed()),
this, SLOT(useStandardTemplate()));
connect( m_dialog->useTemplate, SIGNAL(released()),
this, SLOT(showHideTemplatePanel()));
m_dialog->templaterFilePath->setText(tempfname.c_str());
m_dialog->templaterFrame->setVisible(false);
m_dialog->templateUseStandard->setEnabled(false);
/* fill in platform. Since iptables is the most popular, start with
* it.
*/
@ -170,19 +176,25 @@ newFirewallDialog::newFirewallDialog(QWidget *parentw, FWObject *_p) : QDialog(p
void newFirewallDialog::browseTemplate()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("FWBuilder template files"), "", tr("FWBuilder template files (*.xml *.fwb *.fwl)"));
if (fileName=="")
return ;
QDir dir (fileName);
QString fileName = QFileDialog::getOpenFileName(
this, tr("FWBuilder template files"), "",
tr("FWBuilder template files (*.xml *.fwb *.fwl)"));
if (fileName=="") return ;
// QDir dir (fileName);
// if (dir.exists ())
// {
m_dialog->templaterFilePath->setText(fileName);
m_dialog->templaterFilePath->setText(fileName);
// }
m_dialog->templateUseStandard->setEnabled(fileName != tempfname.c_str());
}
void newFirewallDialog::useStandartTemplate()
void newFirewallDialog::useStandardTemplate()
{
m_dialog->templaterFilePath->setText(tempfname.c_str());
m_dialog->templateUseStandard->setEnabled(false);
}
void newFirewallDialog::showHideTemplatePanel()
@ -522,14 +534,16 @@ void newFirewallDialog::showPage(const int page)
tmpldb->setReadOnly( false );
try
{
tmpldb->load( m_dialog->templaterFilePath->text().toAscii().data(),
&upgrade_predicate, librespath);
tmpldb->load(
m_dialog->templaterFilePath->text().toAscii().data(),
&upgrade_predicate, librespath);
}
catch (FWException &ex)
{
QMessageBox::critical(
this,"Firewall Builder",
tr("Error loading template library:\n%1").arg(ex.toString().c_str()),
tr("Error loading template library:\n%1")
.arg(ex.toString().c_str()),
tr("&Continue"), QString::null,QString::null,
0, 1 );
}
@ -537,7 +551,8 @@ void newFirewallDialog::showPage(const int page)
list<FWObject*> fl;
FWObjectTypedChildIterator libiter = tmpldb->findByType(Library::TYPENAME);
FWObjectTypedChildIterator libiter =
tmpldb->findByType(Library::TYPENAME);
for ( ; libiter!=libiter.end(); ++libiter)
findFirewalls(*libiter, fl, false);

View File

@ -115,7 +115,7 @@ public slots:
virtual void monitor();
virtual void templateSelected(QListWidgetItem *itm);
void browseTemplate();
void useStandartTemplate();
void useStandardTemplate();
void showHideTemplatePanel();
protected slots:

View File

@ -172,7 +172,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="templateUseStandart">
<widget class="QPushButton" name="templateUseStandard">
<property name="text">
<string>Use standard template library</string>
</property>

View File

@ -271,6 +271,17 @@
should not allow the name of any object to be blank.
</p>
</li>
<li>
<p>
fixed #1759 "Use default template library" button seems to do
nothing. This button should only be enabled if user switched to
their own library of template objects. The button should be
disabled if they switched back to the standard template library
or never switched to their own one.
</p>
</li>
</ul>