element editor: check properties for folio report

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3106 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-06-05 09:06:57 +00:00
parent 54135627d8
commit aeb8e22a0b

View File

@@ -39,6 +39,9 @@
#include "texteditor.h" #include "texteditor.h"
#include "textfieldeditor.h" #include "textfieldeditor.h"
#include "partterminal.h"
#include "parttextfield.h"
#include <QMessageBox> #include <QMessageBox>
/* /*
Nombre maximum de primitives affichees par la "liste des parties" Nombre maximum de primitives affichees par la "liste des parties"
@@ -668,12 +671,13 @@ bool QETElementEditor::checkElement() {
); );
} }
///Error #1: element is slave or master but havent got input tagged 'label' /// Check master and slave element
if(ce_scene -> elementType() == "master" || ce_scene -> elementType() == "slave") { if(ce_scene -> elementType() == "master" || ce_scene -> elementType() == "slave") {
bool wrng = true; bool wrng = true;
foreach (CustomElementPart *cep, ce_scene->primitives()) { foreach (CustomElementPart *cep, ce_scene->primitives()) {
if (cep->property("tagg").toString() == "label") wrng = false; if (cep->property("tagg").toString() == "label") wrng = false;
} }
///Error #1: element is slave or master but havent got input tagged 'label'
if (wrng) { if (wrng) {
errors << qMakePair( errors << qMakePair(
tr("Absence de champ texte 'label'", "warning title"), tr("Absence de champ texte 'label'", "warning title"),
@@ -682,6 +686,30 @@ bool QETElementEditor::checkElement() {
} }
} }
/// Check folio report element
if (ce_scene -> elementType().contains("report")) {
int text =0, terminal =0;
foreach(QGraphicsItem *qgi, ce_scene->items()) {
if (qgraphicsitem_cast<PartTerminal *>(qgi)) terminal ++;
else if (qgraphicsitem_cast<PartTextField *>(qgi)) text ++;
}
///Error #2 folio report must have only one terminal
if (terminal != 1) {
errors << qMakePair (
tr("Absence de borne"),
tr("Les reports de folio doivent poss\351der une seul borne."));
}
///Error #3 folio report must have at least one text
if (text <= 0) {
errors << qMakePair (
tr("Absence de champ texte"),
tr("Les reports de folio doivent poss\351der au moins un champ texte \351ditable."));
}
}
if (!errors.count() && !warnings.count()) return(true); if (!errors.count() && !warnings.count()) return(true);
QList<QETWarning> total = warnings << errors; QList<QETWarning> total = warnings << errors;