summaryrefslogtreecommitdiff
path: root/client/macro.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/macro.cc')
-rw-r--r--client/macro.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/client/macro.cc b/client/macro.cc
index 654557d..669674b 100644
--- a/client/macro.cc
+++ b/client/macro.cc
@@ -34,19 +34,23 @@
class MyEvent : public QEvent {
public:
- MyEvent(QString macro) : QEvent((QEvent::Type)MY_EVENT_ID)
+ MyEvent(QString macro, QString cpr, QString user) : QEvent((QEvent::Type)MY_EVENT_ID)
{
this->macro = macro;
+ this->cpr = cpr;
+ this->user = user;
}
QString macro;
+ QString cpr;
+ QString user;
};
-static QDomDocument xml_request(QString name);
+static QDomDocument xml_request(QString name, QString cpr, QString user);
-void create_macro(QString name)
+void create_macro(QString name, QString cpr, QString user)
{
// Build the XML request
- QDomDocument xml_req = xml_request(name);
+ QDomDocument xml_req = xml_request(name, cpr, user);
// Fetch the XML document
SendRecieve xml_acquire;
@@ -72,7 +76,7 @@ bool MyEventHandler::eventFilter( QObject *o, QEvent *e )
if ( e->type() == MY_EVENT_ID ) {
MyEvent *event = (MyEvent*)e;
- create_macro(event->macro);
+ create_macro(event->macro, event->cpr, event->user);
// ... DO SOMETHING WITH EVENT
return TRUE; // eat event
} else {
@@ -81,18 +85,19 @@ bool MyEventHandler::eventFilter( QObject *o, QEvent *e )
}
}
-void new_macro(QString macro)
+void new_macro(QString macro, QString cpr, QString user)
{
- MyEvent *event = new MyEvent(macro);
+ MyEvent *event = new MyEvent(macro, cpr, user);
qApp->postEvent(qApp, event);
}
-static QDomDocument xml_request(QString name)
+static QDomDocument xml_request(QString name, QString cpr, QString user)
{
// Create the xml request array
QByteArray xml_array;
+ printf("macro: %s, cpr: %s, user: %s\n", name.toStdString().c_str(), cpr.toStdString().c_str(), user.toStdString().c_str());
xml_array.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- xml_array.append("<pracro version=\"1.0\" cpr=\"1505050505\" user=\"tux\">\n");
+ xml_array.append("<pracro version=\"1.0\" cpr=\"" + cpr + "\" user=\"" + user + "\">\n");
xml_array.append(" <request macro=\"" + name + "\"/>\n");
xml_array.append("</pracro>");