summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client.cxx6
-rw-r--r--qicclient/client.hxx6
2 files changed, 7 insertions, 5 deletions
diff --git a/client.cxx b/client.cxx
index 4e832ce..168a0fc 100644
--- a/client.cxx
+++ b/client.cxx
@@ -14,11 +14,13 @@ namespace ICClient {
icclient_cleanup();
}
- void Client::allProducts(size_t (*handler)(void*, size_t, size_t, void*))
+ void Client::allProducts(Catalog* qCatalog, size_t (*handler)(void*, size_t
+ , size_t, void*))
{
icclient_catalog* catalog = nullptr;
icclient_allproducts(&catalog, handler);
- emit gotAllProducts(catalog);
+ if (catalog) qCatalog->update(catalog);
+ icclient_product_freecatalog(catalog);
}
void Client::logIn(QString const& username, QString const& password)
diff --git a/qicclient/client.hxx b/qicclient/client.hxx
index bccd665..5531d53 100644
--- a/qicclient/client.hxx
+++ b/qicclient/client.hxx
@@ -3,8 +3,8 @@
#include <QObject>
#include <icclient/product.h>
+#include "catalog.hxx"
-struct icclient_catalog;
struct icclient_order;
namespace ICClient {
@@ -17,7 +17,8 @@ namespace ICClient {
Client(char const* url, char const* certificate = nullptr);
~Client();
- void allProducts(size_t (*handler)(void* contents
+ void allProducts(Catalog* catalog
+ , size_t (*handler)(void* contents
, size_t size, size_t nmemb
, void* userdata));
@@ -52,7 +53,6 @@ namespace ICClient {
*/
signals:
- void gotAllProducts(icclient_catalog* catalog);
void ordered(icclient_order* order);
void loggedIn(QString const& userName);
void loggedOut();