summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2008-09-10 09:03:48 +0000
committerdeva <deva>2008-09-10 09:03:48 +0000
commit0c366ed6b09c06439f3349b220e803b21e4547b9 (patch)
tree0c8c241f12c310360e5e23f6f005274ae1055977 /client
parentb1175cefcd9d9e67ee0f9e1b0b91bb8360b510b7 (diff)
Added continue without commit action to buttons.
Diffstat (limited to 'client')
-rw-r--r--client/macrowindow.cc30
-rw-r--r--client/macrowindow.h1
-rw-r--r--client/widgetbuilder.cc2
-rw-r--r--client/widgets/button.cc8
-rw-r--r--client/widgets/button.h2
5 files changed, 43 insertions, 0 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index 583a8a0..3638ea2 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -213,6 +213,36 @@ void MacroWindow::cont(QString name)
printf("%s : MacroWindow -> continuing...\n", macro.toStdString().c_str());
}
+void MacroWindow::cont_nocommit(QString name)
+{
+ QString macro;
+ QVector< Widget* >::iterator i=widgets.begin();
+ while (i != widgets.end()) {
+ Widget* w = *i;
+ if(w->getName() == name) {
+ macro = w->getValue();
+ }
+ i++;
+ }
+ if(true/*doCommit()*/) {
+
+ // FIXME: Hack to prevent XML clotching.
+ // The server could not differentiate the commit and the request.
+ delete Global::netcom;
+ Global::netcom = new NetCom(host, port, user, cpr);
+
+
+ // TODO: Where to get the course var??
+ new_macro("example", macro);
+ close();
+ } else {
+ QMessageBox::critical(NULL, "Fejl",
+ "Makroen er ikke udfyldt korrekt, prøv igen.\n",
+ QMessageBox::Ok);
+ }
+ printf("%s : MacroWindow -> continuing...\n", macro.toStdString().c_str());
+}
+
bool MacroWindow::isClosed()
{
return isclosed || mainwidget->isVisible() == false;
diff --git a/client/macrowindow.h b/client/macrowindow.h
index 322d514..f1388b2 100644
--- a/client/macrowindow.h
+++ b/client/macrowindow.h
@@ -58,6 +58,7 @@ public slots:
void reset();
void cancel();
void cont(QString name);
+ void cont_nocommit(QString name);
private:
void initMacro(QDomNode &node);
diff --git a/client/widgetbuilder.cc b/client/widgetbuilder.cc
index a6b815c..e688f60 100644
--- a/client/widgetbuilder.cc
+++ b/client/widgetbuilder.cc
@@ -66,6 +66,8 @@ QVector< Widget* > widgetBuilder(QDomNode xml_node, QWidget *parent, MacroWindow
macrowindow->connect(button, SIGNAL(act_reset()), macrowindow, SLOT(reset()));
macrowindow->connect(button, SIGNAL(act_cancel()), macrowindow, SLOT(cancel()));
macrowindow->connect(button, SIGNAL(act_continue(QString)), macrowindow, SLOT(cont(QString)));
+ macrowindow->connect(button, SIGNAL(act_continue_nocommit(QString)),
+ macrowindow, SLOT(cont_nocommit(QString)));
widget = button;
} else if(xml_elem.tagName() == "textedit") {
diff --git a/client/widgets/button.cc b/client/widgets/button.cc
index 2eee811..c524084 100644
--- a/client/widgets/button.cc
+++ b/client/widgets/button.cc
@@ -55,6 +55,8 @@ Button::Button(QDomNode &node, MacroWindow *macrowindow)
connect(this, SIGNAL(clicked()), this, SLOT(cancel()));
} else if(elem.attribute("action") == "continue") {
connect(this, SIGNAL(clicked()), this, SLOT(cont()));
+ } else if(elem.attribute("action") == "continue_nocommit") {
+ connect(this, SIGNAL(clicked()), this, SLOT(cont_nocommit()));
}
} else {
setEnabled(false);
@@ -84,3 +86,9 @@ void Button::cont()
emit act_continue(field);
printf("Emit: continue\n");
}
+
+void Button::cont_nocommit()
+{
+ emit act_continue_nocommit(field);
+ printf("Emit: continue_nocommit\n");
+}
diff --git a/client/widgets/button.h b/client/widgets/button.h
index effcd79..aba7ac7 100644
--- a/client/widgets/button.h
+++ b/client/widgets/button.h
@@ -44,12 +44,14 @@ public slots:
void reset();
void cancel();
void cont();
+ void cont_nocommit();
signals:
void act_commit();
void act_reset();
void act_cancel();
void act_continue(QString);
+ void act_continue_nocommit(QString);
private: