diff --git a/elements/renvoi/next_folio.elmt b/elements/renvoi/next_folio.elmt index c78127a14..cdc49ee63 100644 --- a/elements/renvoi/next_folio.elmt +++ b/elements/renvoi/next_folio.elmt @@ -1,5 +1,5 @@ +link_type="next_report"> الصفحة التالية Nächste Seite diff --git a/elements/renvoi/previous_folio.elmt b/elements/renvoi/previous_folio.elmt index f8139541c..f83b4d80f 100644 --- a/elements/renvoi/previous_folio.elmt +++ b/elements/renvoi/previous_folio.elmt @@ -1,5 +1,5 @@ +link_type="previous_report"> الصفحة السابقة Vorherige Seite diff --git a/sources/factory/elementfactory.cpp b/sources/factory/elementfactory.cpp index 36e72220e..a1bba3f43 100644 --- a/sources/factory/elementfactory.cpp +++ b/sources/factory/elementfactory.cpp @@ -45,7 +45,7 @@ Element * ElementFactory::createElement(const ElementsLocation &location, QGraph if (element_definition->xml().hasAttribute("link_type")) { QString link_type = element_definition->xml().attribute("link_type"); - if (link_type == "folio_report") return (new ReportElement(location, qgi, s, state)); + if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, s, state)); } //default if nothing match for link_type return (new SimpleElement(location, qgi, s, state)); diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 7a47bfbf9..7f5fc0b0d 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -1382,7 +1382,7 @@ QSet Conductor::relatedPotentialConductors(QList *t_li */ Terminal * Conductor::relatedPotentialTerminal (Terminal *t) { //terminal must have a folio report parent. - if (t->parentElement()->linkType() & Element::Report) { + if (t->parentElement()->linkType() & Element::AllReport) { QList elmt_list = t->parentElement()->linkedElements(); if (!elmt_list.isEmpty()) { return (elmt_list.first()->terminals().first()); diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index f1dda6dc3..3a9e1e6f4 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -46,12 +46,14 @@ class Element : public QetGraphicsItem { // this enum is use to know the kind of element and // to use flag for element provider class enum {Simple = 1, - Report = 2, - Master = 4, - SlaveNO = 8, - SlaveNC = 16, - AllSlave = 24, - Bornier = 32}; + NextReport = 2, + PreviousReport = 4, + AllReport = 6, + Master = 8, + SlaveNO = 16, + SlaveNC = 32, + AllSlave = 48, + Bornier = 64}; protected: QList connected_elements; diff --git a/sources/qetgraphicsitem/reportelement.cpp b/sources/qetgraphicsitem/reportelement.cpp index 51e177ee9..2b1eca73e 100644 --- a/sources/qetgraphicsitem/reportelement.cpp +++ b/sources/qetgraphicsitem/reportelement.cpp @@ -20,10 +20,12 @@ #include "diagramposition.h" #include "qetproject.h" -ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) : +ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, Diagram *s, int *state) : CustomElement(location, qgi, s, state) { texts().at(0)->setNoEditable(); + link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport; + link_type == "next_report"? inverse_report=PreviousReport : inverse_report=NextReport; } ReportElement::~ReportElement() { @@ -43,8 +45,8 @@ void ReportElement::linkToElement(Element * elmt) { if (connected_elements.first() == elmt) i = false; } - //ensure elmt is a report - if (elmt->linkType() == Report && i) { + //ensure elmt is a inverse report of this element + if ((elmt->linkType() == inverse_report) && i) { unlinkAllElements(); connected_elements << elmt; connect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(updateLabel())); @@ -81,7 +83,7 @@ void ReportElement::unlinkAllElements(){ * @return the kind of link type */ int ReportElement::linkType() const { - return Report; + return link_type_; } /** diff --git a/sources/qetgraphicsitem/reportelement.h b/sources/qetgraphicsitem/reportelement.h index c9c28d881..99d7a6538 100644 --- a/sources/qetgraphicsitem/reportelement.h +++ b/sources/qetgraphicsitem/reportelement.h @@ -30,13 +30,15 @@ class ReportElement : public CustomElement { Q_OBJECT public : - explicit ReportElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0); + explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = 0, Diagram * = 0, int * = 0); ~ReportElement(); virtual void linkToElement(Element *); virtual void unlinkAllElements(); virtual int linkType() const; private: + int link_type_; + int inverse_report; signals: diff --git a/sources/ui/elementpropertieswidget.cpp b/sources/ui/elementpropertieswidget.cpp index ef79c7e15..cfa24fe50 100644 --- a/sources/ui/elementpropertieswidget.cpp +++ b/sources/ui/elementpropertieswidget.cpp @@ -93,7 +93,11 @@ void elementpropertieswidget::buildInterface() { switch (element_ -> linkType()) { case Element::Simple: break; - case Element::Report: + case Element::NextReport: + frp_ = new FolioReportProperties(element_, this); + tab_ -> addTab(frp_, tr("Report de folio")); + break; + case Element::PreviousReport: frp_ = new FolioReportProperties(element_, this); tab_ -> addTab(frp_, tr("Report de folio")); break; diff --git a/sources/ui/folioreportproperties.cpp b/sources/ui/folioreportproperties.cpp index 1c79626eb..ed3372891 100644 --- a/sources/ui/folioreportproperties.cpp +++ b/sources/ui/folioreportproperties.cpp @@ -36,8 +36,10 @@ FolioReportProperties::~FolioReportProperties() * @brief FolioReportProperties::BuildRadioList : build the radio list for each available folio report */ void FolioReportProperties::BuildRadioList() { + //Research the invert report of @element_ + int rep = element_->linkType() == Element::NextReport? Element::PreviousReport : Element::NextReport; ElementProvider ep(element_->diagram()->project(), element_->diagram()); - QList elmt_list = ep.freeElement(Element::Report); + QList elmt_list = ep.freeElement(rep); foreach (Element *elmt, elmt_list) { if (elmt != element_) {