summaryrefslogtreecommitdiff
path: root/client/netcom.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/netcom.cc')
-rw-r--r--client/netcom.cc46
1 files changed, 33 insertions, 13 deletions
diff --git a/client/netcom.cc b/client/netcom.cc
index d04493f..d2d3cdd 100644
--- a/client/netcom.cc
+++ b/client/netcom.cc
@@ -81,22 +81,36 @@ void NetCom::replyFinished(QNetworkReply *reply)
finished[reply] = true;
}
-QDomDocument NetCom::makeTransfer(QDomDocument &doc,
- bool commit, bool lockgui, bool discard)
+QDomDocument NetCom::makeTransfer(QDomDocument &doc, bool lockgui,
+ session_state_t state)
{
DEBUG(netcom, "Making transfer:\n%s", doc.toString().toStdString().c_str());
if(lockgui && qApp->activeWindow()) qApp->activeWindow()->setEnabled(false);
if(lockgui) QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- if(sessionid != "") request.setRawHeader("SessionID",
- sessionid.toStdString().c_str());
- if(commit) {
- request.setRawHeader("SessionCommit", "yes");
+ LOG(netcom, "SESSION ID: %s\n", sessionid.toStdString().c_str());
+
+ if(sessionid != "") {
+ request.setRawHeader("SessionID", sessionid.toStdString().c_str());
+ } else {
+ request.setRawHeader("SessionPatientID", patientid.toStdString().c_str());
+ request.setRawHeader("SessionTemplate", templ.toStdString().c_str());
}
- if(discard) {
+ switch(state) {
+ case ::commit:
+ request.setRawHeader("SessionCommit", "yes");
+ break;
+ case ::discard:
request.setRawHeader("SessionDiscard", "yes");
+ break;
+ case ::nocommit:
+ request.setRawHeader("SessionNoCommit", "yes");
+ break;
+ default:
+ case ::none:
+ break;
}
// QNetworkReply *reply = manager->get(request);
@@ -117,7 +131,7 @@ QDomDocument NetCom::makeTransfer(QDomDocument &doc,
if(reply->hasRawHeader("SessionID")) {
sessionid = reply->rawHeader("SessionID");
- LOG(netcom, "SESSION ID: %s\n", sessionid.toStdString().c_str());
+ LOG(netcom, "Reply SESSION ID: %s\n", sessionid.toStdString().c_str());
}
if(lockgui) QApplication::restoreOverrideCursor();
@@ -129,19 +143,25 @@ QDomDocument NetCom::makeTransfer(QDomDocument &doc,
QDomDocument NetCom::initConnection()
{
QDomDocument doc;
- return makeTransfer(doc, false, true);
+ return makeTransfer(doc, true);
}
QDomDocument NetCom::commit()
{
QDomDocument doc;
- return makeTransfer(doc, true, true);
+ return makeTransfer(doc, true, ::commit);
+}
+
+QDomDocument NetCom::nocommit()
+{
+ QDomDocument doc;
+ return makeTransfer(doc, true, ::nocommit);
}
QDomDocument NetCom::discard()
{
QDomDocument doc;
- return makeTransfer(doc, false, true, true);
+ return makeTransfer(doc, true, ::discard);
}
QDomDocument NetCom::send(QString templ, QString macro, bool lockgui)
@@ -163,7 +183,7 @@ QDomDocument NetCom::send(QString templ, QString macro, bool lockgui)
if(macro != "") request_elem.setAttribute("macro", macro);
pracro_elem.appendChild(request_elem);
- return makeTransfer(doc, false, lockgui);
+ return makeTransfer(doc, lockgui);
}
QDomDocument NetCom::send(QVector< Widget* > widgets, QString templ,
@@ -206,5 +226,5 @@ QDomDocument NetCom::send(QVector< Widget* > widgets, QString templ,
i++;
}
- return makeTransfer(doc, false, true);
+ return makeTransfer(doc, true);
}