summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basket.cxx10
-rw-r--r--client.cxx4
-rw-r--r--qicclient/basket.hxx1
3 files changed, 11 insertions, 4 deletions
diff --git a/basket.cxx b/basket.cxx
index 7b3336a..b730bf6 100644
--- a/basket.cxx
+++ b/basket.cxx
@@ -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();
}
}
diff --git a/client.cxx b/client.cxx
index 5ca3ce6..0d3316d 100644
--- a/client.cxx
+++ b/client.cxx
@@ -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();