[qet] [3106] element editor: check properties for folio report

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3106
Author:   blacksun
Date:     2014-06-05 11:06:57 +0200 (Thu, 05 Jun 2014)
Log Message:
-----------
element editor: check properties for folio report

Modified Paths:
--------------
    trunk/sources/editor/qetelementeditor.cpp

Modified: trunk/sources/editor/qetelementeditor.cpp
===================================================================
--- trunk/sources/editor/qetelementeditor.cpp	2014-06-04 19:19:43 UTC (rev 3105)
+++ trunk/sources/editor/qetelementeditor.cpp	2014-06-05 09:06:57 UTC (rev 3106)
@@ -39,6 +39,9 @@
 #include "texteditor.h"
 #include "textfieldeditor.h"
 
+#include "partterminal.h"
+#include "parttextfield.h"
+
 #include <QMessageBox>
 /*
 	Nombre maximum de primitives affichees par la "liste des parties"
@@ -668,12 +671,13 @@
 		);
 	}
 
-	///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") {
 		bool wrng = true;
 		foreach (CustomElementPart *cep, ce_scene->primitives()) {
 			if (cep->property("tagg").toString() == "label") wrng = false;
 		}
+		///Error #1: element is slave or master but havent got input tagged 'label'
 		if (wrng) {
 			errors << qMakePair(
 							tr("Absence de champ texte 'label'", "warning title"),
@@ -681,6 +685,30 @@
 							   "un champ texte comportant le tagg 'label'", "warning description"));
 		}
 	}
+
+	/// 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);
 	QList<QETWarning> total = warnings << errors;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/