From 3488ab9a9526b1d999beb354b5318fb28cf917de Mon Sep 17 00:00:00 2001
From: Bent Bisballe Nyeng <deva@aasimon.org>
Date: Thu, 19 Jan 2012 13:52:58 +0100
Subject: Make client block on error response from server. Both on macro
 commits and on template commit.

---
 client/mainwindow.cc | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

(limited to 'client')

diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index 4cb721f..2345644 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -170,7 +170,7 @@ void MainWindow::closeCommit()
     return;
   }
   netcom.commit();
-  isStored = true;
+  //  isStored = true;
   closing = true;
 }
 
@@ -182,7 +182,7 @@ void MainWindow::closeNoCommit()
     return;
   }
   netcom.nocommit();
-  isStored = true;
+  //  isStored = true;
   closing = true;
 }
 
@@ -204,7 +204,7 @@ void MainWindow::closeDiscard()
   
   if(res == MessageBox::Yes) {
     netcom.discard();
-    isStored = true;
+    //    isStored = true;
     closing = true;
   }
 }
@@ -227,7 +227,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
      == MessageBox::Yes) {
     if(!isStored) {
       netcom.discard();
-      isStored = true;
+      //      isStored = true;
       closing = true;
       event->ignore();
       return;
@@ -388,8 +388,6 @@ void MainWindow::setTemplate(QString name)
 
 void MainWindow::handle(QDomDocument &doc)
 {
-  if(closing) close();
-
   DEBUG(mainwindow, "Handle %s\n",
         doc.toString().toStdString().c_str());
 
@@ -400,6 +398,7 @@ void MainWindow::handle(QDomDocument &doc)
 
     if(element.tagName() == "error") {
       showError("Pracro Server Error", element.text());
+      closing = false;
       continue;
     }
 
@@ -430,4 +429,9 @@ void MainWindow::handle(QDomDocument &doc)
     }
 
   }
+
+  if(closing) {
+    isStored = true;
+    close();
+  }
 }
-- 
cgit v1.2.3