[qet] [1314] Modification of the qmessagebox during the open of project

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


Revision: 1314
Author:   nishiki
Date:     2011-08-26 21:06:35 +0200 (Fri, 26 Aug 2011)
Log Message:
-----------
Modification of the qmessagebox during the open of project 
more recently than the qet's version used.
The qmessagebox request if we want continue or cancel
the open of project

Modified Paths:
--------------
    branches/0.3/sources/qetdiagrameditor.cpp
    branches/0.3/sources/qetproject.cpp
    branches/0.3/sources/qetproject.h

Modified: branches/0.3/sources/qetdiagrameditor.cpp
===================================================================
--- branches/0.3/sources/qetdiagrameditor.cpp	2011-08-22 11:17:10 UTC (rev 1313)
+++ branches/0.3/sources/qetdiagrameditor.cpp	2011-08-26 19:06:35 UTC (rev 1314)
@@ -794,7 +794,7 @@
 	// cree le projet a partir du fichier
 	QETProject *project = new QETProject(filepath);
 	if (project -> state() != QETProject::Ok) {
-		if (interactive) {
+		if (interactive && project -> state() != QETProject::FileOpenDiscard) {
 			QET::MessageBox::warning(
 				this,
 				tr("\311chec de l'ouverture du projet", "message box title"),
@@ -807,6 +807,7 @@
 				).arg(filepath)
 			);
 		}
+		delete project;
 		return(false);
 	}
 	

Modified: branches/0.3/sources/qetproject.cpp
===================================================================
--- branches/0.3/sources/qetproject.cpp	2011-08-22 11:17:10 UTC (rev 1313)
+++ branches/0.3/sources/qetproject.cpp	2011-08-26 19:06:35 UTC (rev 1314)
@@ -827,17 +827,26 @@
 			bool conv_ok;
 			project_qet_version_ = root_elmt.attribute("version").toDouble(&conv_ok);
 			if (conv_ok && QET::version.toDouble() < project_qet_version_) {
-				QET::MessageBox::warning(
+				
+				int ret = QET::MessageBox::warning(
 					0,
 					tr("Avertissement", "message box title"),
 					tr(
 						"Ce document semble avoir \351t\351 enregistr\351 avec "
 						"une version ult\351rieure de QElectroTech. Il est "
 						"possible que l'ouverture de tout ou partie de ce "
-						"document \351choue.",
+						"document \351choue.\n"
+						"Que d\351sirez vous faire ?",
 						"message box content"
-					)
+					),
+					QMessageBox::Open | QMessageBox::Cancel
 				);
+				
+				if (ret == QMessageBox::Cancel) {
+					state_ = FileOpenDiscard;
+					return;
+				}
+				
 			}
 		}
 		

Modified: branches/0.3/sources/qetproject.h
===================================================================
--- branches/0.3/sources/qetproject.h	2011-08-22 11:17:10 UTC (rev 1313)
+++ branches/0.3/sources/qetproject.h	2011-08-26 19:06:35 UTC (rev 1314)
@@ -65,7 +65,8 @@
 		FileOpenFailed        = 1, /// l'ouverture d'un fichier a echoue
 		XmlParsingFailed      = 2, /// l'analyse XML a echoue
 		ProjectParsingRunning = 3, /// la lecture du projet est en cours
-		ProjectParsingFailed  = 4  /// la lecture en tant que projet a echoue
+		ProjectParsingFailed  = 4, /// la lecture en tant que projet a echoue
+		FileOpenDiscard       = 5  /// the user cancelled the file opening
 	};
 	
 	// methodes


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