summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2010-05-06 12:31:40 +0000
committerdeva <deva>2010-05-06 12:31:40 +0000
commit3241d29dec9beb0c367340465bd8d9bcab863692 (patch)
treed1f2bdd5b6c625519ac8bafcb5f06947193881e5 /client
parent770335df63d0a42653aaf53bbf2c5532b52bd367 (diff)
Add error box on server error. (on commit).
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*);