From 3241d29dec9beb0c367340465bd8d9bcab863692 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 6 May 2010 12:31:40 +0000 Subject: Add error box on server error. (on commit). --- client/macrowindow.cc | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'client/macrowindow.cc') diff --git a/client/macrowindow.cc b/client/macrowindow.cc index 98262fd..d9060b0 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -151,11 +151,26 @@ bool MacroWindow::doCommit() // If all entries passed validation, continue commit if(faulty == 0) { - netcom.send(widgets, templ, macro, version); + QDomDocument doc = netcom.send(widgets, templ, macro, version); + + QDomNodeList nl = doc.documentElement().childNodes(); + QDomNode n = nl.at(0); // There can be only one! (Swush, flomp) + + if(n.toElement().tagName() == "error") { + QMessageBox::critical(this, "Server Error", "Server Error: " + + n.toElement().text()); + return false; + } + emit updateOnCommit(); setCollapsed(true); return true; } else { + MessageBox::critical(NULL, "Fejl", + "Makroen " + macrotitle + + " er ikke udfyldt korrekt, prøv igen.\n", + MessageBox::Ok); + return false; } } @@ -168,13 +183,7 @@ void MacroWindow::close() void MacroWindow::commit() { - if(doCommit()) { - // close(); - } else { - MessageBox::critical(NULL, "Fejl", - "Makroen " + macrotitle + " er ikke udfyldt korrekt, prøv igen.\n", - MessageBox::Ok); - } + doCommit(); } void MacroWindow::reset() -- cgit v1.2.3