1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-25 12:47:44 +01:00

fixed #1746 "Force user to change interface name in New Firewall

wizard". When user creates interfaces for the new firewall or host
using manual method and clicks on the "+" button to add a tab for
the new interface in the wizard page, the interface tab is created
with blank name. Wizard later checks the name when user clicks
Finish to create new firewall or host object and does not let them
do this while interface name is still blank. Error dialog reminds
that the name of the interface must match the name of the
interface on the machine.
This commit is contained in:
Vadim Kurland 2010-09-29 20:40:42 +00:00
parent 239bb3bd74
commit d4a96c48f8
4 changed files with 34 additions and 3 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 3281
#define BUILD_NUM 3282

View File

@ -1,5 +1,16 @@
2010-09-29 Vadim Kurland <vadim@vk.crocodile.org>
* InterfaceEditorWidget.cpp (InterfaceEditorWidget::isValid):
fixed #1746 "Force user to change interface name in New Firewall
wizard". When user creates interfaces for the new firewall or host
using manual method and clicks on the "+" button to add a tab for
the new interface in the wizard page, the interface tab is created
with blank name. Wizard later checks the name when user clicks
Finish to create new firewall or host object and does not let them
do this while interface name is still blank. Error dialog reminds
that the name of the interface must match the name of the
interface on the machine.
* ProjectPanel.cpp (ProjectPanel::updateFirewallName): fixed #1745
"Remove path data from text above rules window that shows firewall
name".

View File

@ -28,6 +28,7 @@
#include "fwbuilder/IPv4.h"
#include "fwbuilder/IPv6.h"
#include <QLineEdit>
#include <QDebug>
using namespace libfwbuilder;
@ -43,6 +44,12 @@ InterfaceEditorWidget::InterfaceEditorWidget(QWidget *parent, Interface *iface)
setClusterMode(false);
this->m_ui->name->setText(interfacep->getName().c_str());
this->m_ui->label->setText(interfacep->getLabel().c_str());
#if (QT_VERSION > 0x040700)
this->m_ui->name->setPlaceholderText(tr("\"eth0\", \"en0\" etc"));
this->m_ui->label->setPlaceholderText(tr("\"outside\", \"inside\" etc"));
#endif
if (iface->getPhysicalAddress() != NULL)
m_ui->mac->setText(iface->getPhysicalAddress()->getPhysAddress().c_str());
this->m_ui->comment->setPlainText(iface->getComment().c_str());
@ -135,7 +142,7 @@ InterfaceEditorWidget::InterfaceEditorWidget(QWidget *parent) :
this->interfacep = NULL;
m_ui->setupUi(this);
setClusterMode(false);
this->m_ui->name->setText(tr("New interface"));
this->m_ui->name->setText(""); // blank interface name
this->m_ui->label->clear();
this->m_ui->comment->clear();
addNewAddress();
@ -330,6 +337,19 @@ bool InterfaceEditorWidget::isValid()
#endif
if (this->m_ui->name->text().isEmpty())
{
QMessageBox::warning(
this, "Firewall Builder",
tr("<html>Interface name can not be blank."
"<br/> "
"<br/>"
"Interface name must match the name of the physical interface, "
"such as 'eth0', 'fxp0', 'ethernet0' etc</html>"),
"&Continue", QString::null, QString::null, 0, 1 );
return false;
}
for (int i = 0; i < this->m_ui->addresses->rowCount(); i++)
{
if (types[i] == NULL) continue; // deleted row

View File

@ -120,7 +120,7 @@ void InterfacesTabWidget::addNewInterface()
}
InterfaceEditorWidget *w = new InterfaceEditorWidget(this);
w->setClusterMode(clusterMode);
addTab(w, tr("New interface"));
addTab(w, ""); // deliberately create new interface with blank name
setCurrentIndex(count() - 1);
}