mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-23 19:57:21 +01:00
2009-05-31 vadim <vadim@vk.crocodile.org>
* newFirewallDialog.cpp (newFirewallDialog::selectedInterface): fixed bug #2799163: "crash on correcting an error". The GUI crashed if user tried to add, then delete interfaces in the new firewall wizard. The crash occurred when the last interface was deleted on the page where interfaces can be configured manually. * ObjectTreeView.cpp (ObjectTreeView::dragMoveEvent): fixed bug #2799174: "Multiple instance crashes a bug". The GUI crashed if user tried to drag and drop an object between two different running copies. Copy/Paste and Drag&Drop between separate copies are not supported at this time. ;
This commit is contained in:
parent
95776701ce
commit
2592bada0a
@ -1,3 +1,17 @@
|
||||
2009-05-31 vadim <vadim@vk.crocodile.org>
|
||||
|
||||
* newFirewallDialog.cpp (newFirewallDialog::selectedInterface):
|
||||
fixed bug #2799163: "crash on correcting an error". The GUI
|
||||
crashed if user tried to add, then delete interfaces in the new
|
||||
firewall wizard. The crash occurred when the last interface was
|
||||
deleted on the page where interfaces can be configured manually.
|
||||
|
||||
* ObjectTreeView.cpp (ObjectTreeView::dragMoveEvent): fixed bug
|
||||
#2799174: "Multiple instance crashes a bug". The GUI crashed if
|
||||
user tried to drag and drop an object between two different
|
||||
running copies. Copy/Paste and Drag&Drop between separate copies
|
||||
are not supported at this time.
|
||||
|
||||
2009-05-29 vadim <vadim@vk.crocodile.org>
|
||||
|
||||
* newFirewallDialog.cpp (newFirewallDialog::finishClicked): better
|
||||
|
||||
@ -491,15 +491,24 @@ bool ObjectTreeView::isCurrReadOnly(QDragMoveEvent *ev)
|
||||
|
||||
void ObjectTreeView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
{
|
||||
QWidget *fromWidget = ev->source();
|
||||
|
||||
// The source of DnD object must be the same instance of fwbuilder
|
||||
if (!fromWidget)
|
||||
{
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCurrReadOnly(ev) ||
|
||||
!ev->mimeData()->hasFormat(FWObjectDrag::FWB_MIME_TYPE))
|
||||
!ev->mimeData()->hasFormat(FWObjectDrag::FWB_MIME_TYPE))
|
||||
{
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
list<FWObject*> dragol;
|
||||
if (!FWObjectDrag::decode(ev, dragol))
|
||||
ev->setAccepted(false);
|
||||
ev->setAccepted(false);
|
||||
for (list<FWObject*>::iterator i=dragol.begin();i!=dragol.end(); ++i)
|
||||
{
|
||||
FWObject *dragobj = *i;
|
||||
@ -512,13 +521,22 @@ void ObjectTreeView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ev->setAccepted(true);
|
||||
}
|
||||
|
||||
void ObjectTreeView::dropEvent(QDropEvent *ev)
|
||||
{
|
||||
if (fwbdebug) qDebug("ObjectTreeView::dropEvent");
|
||||
QWidget *fromWidget = ev->source();
|
||||
|
||||
// The source of DnD object must be the same instance of fwbuilder
|
||||
if (!fromWidget)
|
||||
{
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
list<FWObject*> dragol;
|
||||
if (FWObjectDrag::decode(ev, dragol))
|
||||
{
|
||||
|
||||
@ -4339,63 +4339,66 @@ void RuleSetView::dragMoveEvent( QDragMoveEvent *ev)
|
||||
QWidget *fromWidget = ev->source();
|
||||
|
||||
// The source of DnD object must be the same instance of fwbuilder
|
||||
if (fromWidget)
|
||||
if (!fromWidget)
|
||||
{
|
||||
if (ev->mimeData()->hasFormat(FWObjectDrag::FWB_MIME_TYPE) && !ruleset->isReadOnly())
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev->mimeData()->hasFormat(FWObjectDrag::FWB_MIME_TYPE) && !ruleset->isReadOnly())
|
||||
{
|
||||
if (ev->keyboardModifiers() & Qt::ControlModifier)
|
||||
ev->setDropAction(Qt::CopyAction);
|
||||
else
|
||||
ev->setDropAction(Qt::MoveAction);
|
||||
|
||||
int row = rowAt( ev->pos().y() );
|
||||
int col = columnAt( ev->pos().x() );
|
||||
|
||||
if (col<0 || ( getColType(col)!=Object && getColType(col)!=Time) )
|
||||
{
|
||||
if (ev->keyboardModifiers() & Qt::ControlModifier)
|
||||
ev->setDropAction(Qt::CopyAction);
|
||||
else
|
||||
ev->setDropAction(Qt::MoveAction);
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
int row = rowAt( ev->pos().y() );
|
||||
int col = columnAt( ev->pos().x() );
|
||||
RuleElement *re = getRE(row,col);
|
||||
if (re==NULL)
|
||||
{
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (col<0 || ( getColType(col)!=Object && getColType(col)!=Time) )
|
||||
bool acceptE = true;
|
||||
list<FWObject*> dragol;
|
||||
|
||||
/*
|
||||
* See bug 1226069 Segfault: Drag&Drop between two instances
|
||||
*
|
||||
* v3.0: we do not permit d&d of an object from one data
|
||||
* file to another. mostly just to avoid confusing side
|
||||
* effects because such operation requires copy of all
|
||||
* object's dependencies. This means simple d&d operation
|
||||
* can in fact silently copy whole bunch of objects into
|
||||
* the tree, which is may not be even visible for the user
|
||||
* if parts of the tree are collapsed or obscured by other
|
||||
* windows.
|
||||
*/
|
||||
|
||||
if (FWObjectDrag::decode(ev, dragol))
|
||||
{
|
||||
for (list<FWObject*>::iterator i=dragol.begin();
|
||||
i!=dragol.end(); ++i)
|
||||
{
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
RuleElement *re = getRE(row,col);
|
||||
if (re==NULL)
|
||||
{
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
bool acceptE = true;
|
||||
list<FWObject*> dragol;
|
||||
|
||||
/*
|
||||
* See bug 1226069 Segfault: Drag&Drop between two instances
|
||||
*
|
||||
* v3.0: we do not permit d&d of an object from one data
|
||||
* file to another. mostly just to avoid confusing side
|
||||
* effects because such operation requires copy of all
|
||||
* object's dependencies. This means simple d&d operation
|
||||
* can in fact silently copy whole bunch of objects into
|
||||
* the tree, which is may not be even visible for the user
|
||||
* if parts of the tree are collapsed or obscured by other
|
||||
* windows.
|
||||
*/
|
||||
|
||||
if (FWObjectDrag::decode(ev, dragol))
|
||||
{
|
||||
for (list<FWObject*>::iterator i=dragol.begin();
|
||||
i!=dragol.end(); ++i)
|
||||
FWObject *dragobj = NULL;
|
||||
dragobj = dynamic_cast<FWObject*>(*i);
|
||||
if(dragobj!=NULL)
|
||||
{
|
||||
FWObject *dragobj = NULL;
|
||||
dragobj = dynamic_cast<FWObject*>(*i);
|
||||
if(dragobj!=NULL)
|
||||
{
|
||||
acceptE &= (dragobj->getRoot()==ruleset->getRoot());
|
||||
acceptE &= re->validateChild(dragobj);
|
||||
}
|
||||
acceptE &= (dragobj->getRoot()==ruleset->getRoot());
|
||||
acceptE &= re->validateChild(dragobj);
|
||||
}
|
||||
ev->setAccepted( acceptE );
|
||||
return;
|
||||
}
|
||||
ev->setAccepted( acceptE );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4407,6 +4410,16 @@ void RuleSetView::dropEvent(QDropEvent *ev)
|
||||
{
|
||||
if (fwbdebug) qDebug("RuleSetView::dropEvent");
|
||||
|
||||
QWidget *fromWidget = ev->source();
|
||||
|
||||
// The source of DnD object must be the same instance of fwbuilder
|
||||
if (!fromWidget)
|
||||
{
|
||||
ev->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!isTreeReadWrite(this,ruleset)) return;
|
||||
|
||||
int row = rowAt( ev->pos().y() );
|
||||
|
||||
@ -686,16 +686,18 @@ void newFirewallDialog::addInterface()
|
||||
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) );
|
||||
m_dialog->iface_netmask->setText( itm->text(3) );
|
||||
m_dialog->iface_reg->setChecked( itm->text(4).isEmpty() );
|
||||
m_dialog->iface_dyn->setChecked( itm->text(4).indexOf("Dyn")!=-1 );
|
||||
m_dialog->iface_unnum->setChecked( itm->text(4).indexOf("Unn")!=-1 );
|
||||
m_dialog->iface_bridgeport->setChecked( itm->text(4).indexOf("Bridge")!=-1 );
|
||||
m_dialog->iface_physaddr->setText( itm->text(5) );
|
||||
if (itm)
|
||||
{
|
||||
m_dialog->iface_name->setText( itm->text(0) );
|
||||
m_dialog->iface_label->setText( itm->text(1) );
|
||||
m_dialog->iface_addr->setText( itm->text(2) );
|
||||
m_dialog->iface_netmask->setText( itm->text(3) );
|
||||
m_dialog->iface_reg->setChecked( itm->text(4).isEmpty() );
|
||||
m_dialog->iface_dyn->setChecked( itm->text(4).indexOf("Dyn")!=-1 );
|
||||
m_dialog->iface_unnum->setChecked( itm->text(4).indexOf("Unn")!=-1 );
|
||||
m_dialog->iface_bridgeport->setChecked( itm->text(4).indexOf("Bridge")!=-1 );
|
||||
m_dialog->iface_physaddr->setText( itm->text(5) );
|
||||
}
|
||||
}
|
||||
|
||||
void newFirewallDialog::updateInterface()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user