diff options
-rw-r--r-- | basket.cxx | 10 | ||||
-rw-r--r-- | client.cxx | 4 | ||||
-rw-r--r-- | qicclient/basket.hxx | 1 |
3 files changed, 11 insertions, 4 deletions
@@ -59,11 +59,17 @@ namespace ICClient { items << item; endInsertRows(); emit rowCountChanged(); + } - /* + void Basket::update(icclient_ord_order* order) + { + if (order) + for (size_t i = 0; i < order->nitems; i++) + addItem(Item{order->items[i]}); m_subtotal = order->subtotal; + emit subtotalChanged(); m_totalCost = order->total_cost; - */ + emit totalCostChanged(); } } @@ -47,8 +47,8 @@ namespace ICClient { void Client::order(QString const& sku, Catalog const& catalog, Basket& order) { auto c_order = order.c_order(); - icclient_order(sku.toLatin1().constData(), catalog.c_catalog(), - &c_order); + icclient_order(sku.toLatin1().constData(), catalog.c_catalog(), &c_order); + order.update(c_order); } void Client::logIn(size_t (*handler)(void*, size_t, size_t, void*) diff --git a/qicclient/basket.hxx b/qicclient/basket.hxx index f5665cd..8d697e6 100644 --- a/qicclient/basket.hxx +++ b/qicclient/basket.hxx @@ -55,6 +55,7 @@ namespace ICClient { double shipping() const { return m_shipping; } double totalCost() const { return m_totalCost; } icclient_ord_order* c_order() { return order; } + void update(icclient_ord_order* order); signals: void rowCountChanged(); |