1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-06-25 02:19:37 +02:00

fixed bug 2624, fixed "QString::arg - missing argument" error messages

This commit is contained in:
Vadim Kurland
2008-06-05 23:33:59 +00:00
parent ece0df1e07
commit 401d1c3320
5 changed files with 39 additions and 85 deletions

View File

@@ -384,28 +384,14 @@ void ActionsDialog::setRule(PolicyRule *r )
else if (editor=="TagInt")
{
w=m_dialog->TagIntPage;
std::string id = ropt->getStr("tagobject_id");
FWObject * o = rule->getRoot()->getById(id,true);
if (o!=NULL&&QString(id.c_str())!="")
{
TagIntArea->setObject(o);
}
// FWObjectDropArea * fwoda = new FWObjectDropArea(m_dialog->TagIntFrame);
// m_dialog->TagIntFrame->addWidget(fwoda);
//! data.registerOption(m_dialog->tagvalue_int , ropt , "tagvalue");
FWObject *o = rule->getTagObject();
TagIntArea->setObject(o);
}
else if (editor=="TagStr")
{
w=m_dialog->TagStrPage;
std::string id = ropt->getStr("tagobject_id");
FWObject * o = rule->getRoot()->getById(id,true);
if (o!=NULL&&QString(id.c_str())!="")
{
TagStrArea->setObject(o);
}
// FWObjectDropArea * fwoda = new FWObjectDropArea(m_dialog->TagStrFrame);
// m_dialog->TagStrFrame->addWidget(fwoda);
//! data.registerOption(m_dialog->tagvalue_str , ropt , "tagvalue");
FWObject *o = rule->getTagObject();
TagStrArea->setObject(o);
}
else if (editor=="AccountingStr")
{
@@ -431,19 +417,16 @@ void ActionsDialog::setRule(PolicyRule *r )
{
w=m_dialog->BranchChainPage;
RuleSet *ruleset = r->getBranch();
if (ruleset!=NULL) BranchChainArea->setObject(ruleset);
BranchChainArea->setObject(ruleset);
//data.registerOption ( m_dialog->branchChainName , ropt , "branch_name" );
data.registerOption ( m_dialog->ipt_branch_in_mangle, ropt , "ipt_branch_in_mangle" );
data.registerOption(
m_dialog->ipt_branch_in_mangle, ropt , "ipt_branch_in_mangle" );
}
else if (editor=="BranchAnchor")
{
w=m_dialog->BranchAnchorPage;
RuleSet *ruleset = r->getBranch();
if (ruleset!=NULL) BranchChainArea->setObject(ruleset);
//int idx = ropt->getInt("branch_id");
//data.registerOption ( m_dialog->branchAnchorName , ropt , "branch_name" );
BranchChainArea->setObject(ruleset);
}
else if (editor=="RouteIPT")
{

View File

@@ -48,18 +48,20 @@ class QDragEnterEvent;
class FWObjectDropArea : public QWidget//Ui::FWObjectDropArea_q
{
Q_OBJECT
private:
libfwbuilder::FWObject *object;
QVector <QString> acceptedTypes ;
QString helperText ;
protected:
void paintEvent(QPaintEvent *ev);
void contextMenuEvent (QContextMenuEvent * e);
void dropEvent( QDropEvent *ev);
void dragEnterEvent( QDragEnterEvent *ev);
private:
libfwbuilder::FWObject *object;
QVector <QString> acceptedTypes ;
QString helperText ;
protected:
void paintEvent(QPaintEvent *ev);
void contextMenuEvent (QContextMenuEvent * e);
void dropEvent( QDropEvent *ev);
void dragEnterEvent( QDragEnterEvent *ev);
public:
Ui::FWObjectDropArea_q *m_objectDropArea;
public:
Ui::FWObjectDropArea_q *m_objectDropArea;
FWObjectDropArea(QWidget*p, const char * n = 0, Qt::WFlags f = 0);
~FWObjectDropArea();
libfwbuilder::FWObject * getObject(){return object;};
@@ -67,12 +69,12 @@ class FWObjectDropArea : public QWidget//Ui::FWObjectDropArea_q
void addAcceptedTypes (QString type){acceptedTypes.push_back(type);};
bool isEmpty() {return object==NULL;};
void setHelperText (QString text){helperText=text;}
public slots:
public slots:
void insertObject(libfwbuilder::FWObject *o);
void deleteObject();
void pasteObject();
signals:
signals:
void objectDeleted();
void objectInserted();

View File

@@ -572,9 +572,7 @@ void ObjectManipulator::autorename(FWObject *obj,bool ask)
{
if (Host::isA(obj) || Firewall::isA(obj))
{
if (!ask || QMessageBox::warning(
this,"Firewall Builder",
tr(
QString dialog_txt = tr(
"The name of the object '%1' has changed. The program can also\n"
"rename IP address objects that belong to this object,\n"
"using standard naming scheme 'host_name:interface_name:ip'.\n"
@@ -584,9 +582,12 @@ void ObjectManipulator::autorename(FWObject *obj,bool ask)
"objects using scheme 'host_name:interface_name:mac'.\n"
"Do you want to rename child IP and MAC address objects now?\n"
"(If you click 'No', names of all address objects that belong to\n"
"%1 will stay the same.)")
.arg(QString::fromUtf8(obj->getName().c_str()))
.arg(QString::fromUtf8(obj->getName().c_str())),
"%2 will stay the same.)")
.arg(QString::fromUtf8(obj->getName().c_str()))
.arg(QString::fromUtf8(obj->getName().c_str()));
if (!ask || QMessageBox::warning(
this,"Firewall Builder", dialog_txt,
tr("&Yes"), tr("&No"), QString::null,
0, 1 )==0 )
{
@@ -603,9 +604,7 @@ void ObjectManipulator::autorename(FWObject *obj,bool ask)
if (Interface::isA(obj))
{
if (!ask || QMessageBox::warning(
this,"Firewall Builder",
tr(
QString dialog_txt = tr(
"The name of the interface '%1' has changed. The program can also\n"
"rename IP address objects that belong to this interface,\n"
"using standard naming scheme 'host_name:interface_name:ip'.\n"
@@ -615,8 +614,12 @@ void ObjectManipulator::autorename(FWObject *obj,bool ask)
"objects using scheme 'host_name:interface_name:mac'.\n"
"Do you want to rename child IP and MAC address objects now?\n"
"(If you click 'No', names of all address objects that belong to\n"
"interface '%1' will stay the same.)")
.arg(QString::fromUtf8(obj->getName().c_str())),
"interface '%2' will stay the same.)")
.arg(QString::fromUtf8(obj->getName().c_str()))
.arg(QString::fromUtf8(obj->getName().c_str()));
if (!ask || QMessageBox::warning(
this,"Firewall Builder", dialog_txt,
tr("&Yes"), tr("&No"), QString::null,
0, 1 )==0 )
{

View File

@@ -2152,10 +2152,6 @@ Rule* RuleSetView::insertRule(int pos, FWObject *r)
for (int i=ruleIndex.size(); i>=pos; --i)
setRuleNumber(i, Rule::cast(ruleIndex[i]));
if (newrule_as_policy_rule!=NULL &&
newrule_as_policy_rule->getAction()==PolicyRule::Branch )
addRuleBranch( newrule_as_policy_rule );
ruleModel->insertRow(pos);
rowsInfo.insert(pos,NULL);
adjustRow(pos);
@@ -2198,28 +2194,6 @@ FWObject* RuleSetView::getSelectedObject()
return selectedObject;
}
void RuleSetView::addRuleBranch(PolicyRule *rule)
{
if (fwbdebug) qDebug("RuleSetView::addRuleBranch");
FWOptions *ropt = rule->getOptionsObject();
QString branchName = ropt->getStr("branch_name").c_str();
if (branchName.isEmpty())
{
QString bn = QString("rule%1_branch").arg(rule->getPosition());
ropt->setStr("branch_name",bn.toAscii().constData());
}
RuleSet *subset = rule->getBranch();
if (subset==NULL)
{
// can change action only for the policy rule, therefore
// branch can only be a Policy (i.e. can not be NAT)
subset = new Policy();
rule->add(subset);
}
mw->addPolicyBranchTab(subset);
}
void RuleSetView::copyRuleContent(Rule *dst, Rule *src)
{
string id=dst->getId();
@@ -3266,14 +3240,8 @@ void RuleSetView::changeActionToContinue()
void RuleSetView::changeActionToBranch()
{
if (!isTreeReadWrite(this,ruleset)) return;
if ( currentRow()!=-1 && currentColumn()!=-1 )
{
if (fwbdebug) qDebug("Firewall action: changeActionToBranch");
changeAction( PolicyRule::Branch );
addRuleBranch( PolicyRule::cast( ruleIndex[currentRow()] ) );
}
if (fwbdebug) qDebug("Firewall action: changeActionToBranch");
changeAction( PolicyRule::Branch );
}
void RuleSetView::changeDitection(PolicyRule::Direction dir)

View File

@@ -377,8 +377,6 @@ class RuleSetView : public QTableView
virtual void adjustRow( int row );
virtual void adjustColumn( int col );
void addRuleBranch(libfwbuilder::PolicyRule *rule);
QString getPlatform();
QRect calculateCellSize( int row, int col );