diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-31 18:38:20 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-31 18:38:20 +0800 |
commit | 438bcd2d5fc49fdeec642f06647a7a7ee758f6f6 (patch) | |
tree | 2302606b9cd32c62fd3e3c18ac5a933dafa32df5 | |
parent | b8ef74e598edca39ab68c5319308a881c526e8f1 (diff) |
Interface for setting order page
-rw-r--r-- | interchange/ord.hxx | 3 | ||||
-rw-r--r-- | ord.cxx | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/interchange/ord.hxx b/interchange/ord.hxx index a0cb885..422d634 100644 --- a/interchange/ord.hxx +++ b/interchange/ord.hxx @@ -48,7 +48,8 @@ namespace QInterchange { void setProfile(QString const& profile); public slots: void remove(const QString &name, - const QString &nextPage); + const QString &orderPage = "", + const QString &nextPage = ""); void checkout(const Member& member); signals: void rowCountChanged(); @@ -6,7 +6,7 @@ namespace QInterchange { static Ord* ord; - static char *item_name, *next_page; + static char *item_name, *order_page, *next_page; static char* order_profile; static char *fname, *lname, *address1, *address2, *city, *state, *zip, *phone_day, *email; @@ -89,19 +89,27 @@ namespace QInterchange { if (this->profile != profile) this->profile = profile; } - void Ord::remove(const QString &name, const QString &nextPage) + void Ord::remove(const QString &name, const QString &orderPage, + const QString &nextPage) { item_name = (char *)malloc(name.size() + 1); strcpy(item_name, name.toLatin1().constData()); + if (orderPage.isEmpty()) + order_page = nullptr; + else { + order_page = (char *)malloc(orderPage.size() + 1); + strcpy(order_page, orderPage.toLatin1().constData()); + } if (nextPage.isEmpty()) next_page = nullptr; else { next_page = (char *)malloc(nextPage.size() + 1); strcpy(next_page, nextPage.toLatin1().constData()); } - interchange_ord_remove(item_name, next_page, + interchange_ord_remove(item_name, order_page, next_page, [](interchange_response *response) { free(item_name); + if (order_page) free(order_page); if (next_page) free(next_page); ord->emitRemoval(QString{response->data}); interchange_free_response(response); |