summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/macrowindow.cc25
-rw-r--r--client/netcom.cc8
-rw-r--r--client/netcom.h4
3 files changed, 23 insertions, 14 deletions
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()
diff --git a/client/netcom.cc b/client/netcom.cc
index 3d2acf0..4deba49 100644
--- a/client/netcom.cc
+++ b/client/netcom.cc
@@ -146,8 +146,8 @@ QDomDocument NetCom::send(QString templ, QString macro, bool lockgui)
return makeTransfer(doc, false, lockgui);
}
-void NetCom::send(QVector< Widget* > widgets, QString templ,
- QString macro, QString version)
+QDomDocument NetCom::send(QVector< Widget* > widgets, QString templ,
+ QString macro, QString version)
{
QDomDocument doc;
@@ -182,6 +182,6 @@ void NetCom::send(QVector< Widget* > widgets, QString templ,
i++;
}
-
- makeTransfer(doc, false, true);
+
+ return makeTransfer(doc, false, true);
}
diff --git a/client/netcom.h b/client/netcom.h
index 32f5982..d890cb0 100644
--- a/client/netcom.h
+++ b/client/netcom.h
@@ -46,8 +46,8 @@ public:
~NetCom();
QDomDocument send(QString templ, QString macro = "", bool lockgui = true);
- void send(QVector< Widget* > widgets, QString templ, QString macro,
- QString version);
+ QDomDocument send(QVector< Widget* > widgets, QString templ, QString macro,
+ QString version);
public slots:
void replyFinished(QNetworkReply*);