mirror of
https://github.com/fwbuilder/fwbuilder
synced 2025-10-17 07:57:43 +02:00
Bug 2413 fixed
This commit is contained in:
parent
aa112942b6
commit
6d0194c5f2
@ -2430,7 +2430,7 @@ FWObject* ObjectManipulator::createObject(FWObject *parent,
|
||||
|
||||
|
||||
FWObject* ObjectManipulator::copyObj2Tree(const QString &objType, const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom, bool askLib)
|
||||
libfwbuilder::FWObject *copyFrom, FWObject *parent, bool askLib)
|
||||
{
|
||||
if (!validateDialog()) return NULL;
|
||||
|
||||
@ -2439,8 +2439,9 @@ FWObject* ObjectManipulator::copyObj2Tree(const QString &objType, const QString
|
||||
lib = AskLibForCopyDialog::askLibForCopyDialog(m_project, m_project->db(), lib);
|
||||
if (!lib)
|
||||
return 0;
|
||||
FWObject *parent=m_project->getStandardSlotForObject(lib, objType);
|
||||
return actuallyCreateObject(parent, objType, objName, copyFrom);
|
||||
if (!parent)
|
||||
parent=m_project->getStandardSlotForObject(lib, objType);
|
||||
return pasteTo (parent, copyFrom);
|
||||
}
|
||||
|
||||
FWObject* ObjectManipulator::actuallyCreateObject(FWObject *parent,
|
||||
|
@ -163,7 +163,7 @@ public slots:
|
||||
const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom=NULL);
|
||||
libfwbuilder::FWObject * copyObj2Tree(const QString &objType, const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom, bool ask4Lib=true);
|
||||
libfwbuilder::FWObject *copyFrom, libfwbuilder::FWObject *parent=NULL, bool ask4Lib=true);
|
||||
|
||||
void newLibrary();
|
||||
void newObject();
|
||||
|
@ -171,7 +171,7 @@ bool ObjectTreeView::event( QEvent *event )
|
||||
if (itm==NULL) return false;
|
||||
ObjectTreeViewItem *oivi = dynamic_cast<ObjectTreeViewItem*>(itm);
|
||||
assert(oivi!=NULL);
|
||||
obj = oivi->getFWObject();
|
||||
obj = oivi->getFWObject();
|
||||
|
||||
if (obj==NULL) return false;
|
||||
|
||||
@ -507,11 +507,25 @@ void ObjectTreeView::dropEvent(QDropEvent *ev)
|
||||
assert(dragobj);
|
||||
|
||||
QString n=QString::fromUtf8(dragobj->getName().c_str());
|
||||
m_project->copyObj2Tree(dragobj->getTypeName().c_str(), n, dragobj, false);
|
||||
m_project->copyObj2Tree(dragobj->getTypeName().c_str(), n, dragobj,
|
||||
getDropTarget(ev, dragobj), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FWObject *ObjectTreeView::getDropTarget(QDropEvent *ev, FWObject* dragobj)
|
||||
{//If dag object is an interface or IPv4 object it should be paste to node on which it is dropped
|
||||
QTreeWidgetItem *ovi = itemAt(ev->pos());
|
||||
|
||||
ObjectTreeViewItem *otvi=dynamic_cast<ObjectTreeViewItem*>(ovi);
|
||||
FWObject *trobj;
|
||||
if (otvi && (trobj = otvi->getFWObject()) && !trobj->isReadOnly() &&
|
||||
((Interface::isA(dragobj)) //Firewall::isA(trobj) &&
|
||||
|| (Interface::isA(trobj) && IPv4::isA(dragobj))))
|
||||
return trobj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ObjectTreeView::dragLeaveEvent( QDragLeaveEvent *ev)
|
||||
{
|
||||
QTreeWidget::dragLeaveEvent(ev);
|
||||
|
@ -70,6 +70,7 @@ class ObjectTreeView : public QTreeWidget {
|
||||
std::vector<libfwbuilder::FWObject*> selectedObjects;
|
||||
ProjectPanel* m_project;
|
||||
bool isCurrReadOnly(QDragMoveEvent *ev);
|
||||
libfwbuilder::FWObject *getDropTarget(QDropEvent *ev, libfwbuilder::FWObject* dragobj);
|
||||
protected:
|
||||
|
||||
bool event( QEvent *event );
|
||||
|
@ -1228,9 +1228,9 @@ libfwbuilder::FWObject* ProjectPanel::createObject(libfwbuilder::FWObject *paren
|
||||
|
||||
|
||||
FWObject* ProjectPanel::copyObj2Tree(const QString &objType, const QString &objName,
|
||||
FWObject *copyFrom, bool ask4Lib)
|
||||
FWObject *copyFrom, FWObject *parent, bool ask4Lib)
|
||||
{
|
||||
return m_panel->om->copyObj2Tree(objType, objName, copyFrom, ask4Lib);
|
||||
return m_panel->om->copyObj2Tree(objType, objName, copyFrom, parent, ask4Lib);
|
||||
}
|
||||
|
||||
void ProjectPanel::moveObject(libfwbuilder::FWObject *target,
|
||||
|
@ -119,6 +119,7 @@ public:
|
||||
libfwbuilder::FWObject* copyObj2Tree(const QString &objType,
|
||||
const QString &objName,
|
||||
libfwbuilder::FWObject *copyFrom=NULL,
|
||||
libfwbuilder::FWObject *parent=NULL,
|
||||
bool ask4Lib = true);
|
||||
|
||||
void moveObject(libfwbuilder::FWObject *target,
|
||||
|
Loading…
x
Reference in New Issue
Block a user