diff options
author | senator <senator> | 2008-03-18 12:38:10 +0000 |
---|---|---|
committer | senator <senator> | 2008-03-18 12:38:10 +0000 |
commit | b275f9c20d283c4d45fb08d4c306c8481d54565d (patch) | |
tree | 1f440431d637e42659f7f6afc37b38c7f6aa3322 /client/macro.cc | |
parent | a6c5f2f2db35be2bc3052c02f75f20729ce4f923 (diff) |
set command line behaviour to use macro, cpr and user
Diffstat (limited to 'client/macro.cc')
-rw-r--r-- | client/macro.cc | 23 |
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>"); |