123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- /**
- * Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- *
- * For the applicable distribution terms see the license.txt -file, included in
- * the distribution.
- */
- #ifndef DECLARATIVEPURCHASELISTMODEL_H
- #define DECLARATIVEPURCHASELISTMODEL_H
- #include <QAbstractListModel>
- #include <QDeclarativeParserStatus>
- #include <QImage>
- #include <iapclient.h>
- class PurchasableItemBase;
- /**
- * @class DeclarativePurchaseListModel
- *
- * @brief Implementents Catalog list model
- *
- */
- class DeclarativePurchaseListModel : public QAbstractListModel, public QDeclarativeParserStatus
- {
- Q_OBJECT
- Q_INTERFACES(QDeclarativeParserStatus)
- public:
- Q_PROPERTY(bool drmFilter READ drmFilter WRITE setDrmFilter)
- Q_PROPERTY(bool isApplicationBusy READ isApplicationBusy NOTIFY applicationBusyChanged)
- /**
- * @see QAbstractListModel
- *
- * @brief base class abstract method implementation
- *
- * @param parent
- */
- int rowCount(const QModelIndex & parent = QModelIndex()) const;
- /**
- * @see QAbstractListModel
- *
- * @brief base class abstract method implementation
- *
- * @param index
- * @param role
- */
- QVariant data(const QModelIndex &index, int role) const;
- /**
- * @see QAbstractListModel
- *
- * @brief base class abstract method implementation
- *
- * @param index
- * @param value
- * @param role
- */
- bool setData (const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
- //property accesors
- /**
- * @brief
- *
- */
- bool drmFilter() const;
- /**
- * @brief
- *
- * @param val
- */
- void setDrmFilter(bool val);
- /**
- * @brief
- *
- */
- bool isApplicationBusy() const;
- /**
- * @brief
- *
- * @param index
- */
- Q_INVOKABLE void buy(int index);
- /**
- * @brief
- *
- */
- Q_INVOKABLE void restoreProducts();
- /**
- * @brief
- *
- */
- Q_INVOKABLE void getUserInfo();
- /**
- * @brief
- *
- */
- Q_INVOKABLE void purgeProducts();
- public:
- Q_DISABLE_COPY(DeclarativePurchaseListModel)
- /**
- * @brief
- *
- * @param
- */
- explicit DeclarativePurchaseListModel(QObject *parent = 0);
- /**
- * @brief
- *
- */
- ~DeclarativePurchaseListModel();
- //QDeclarativeParserStatus interface
- /**
- * @brief
- *
- */
- void classBegin();
- /**
- * @brief
- *
- */
- void componentComplete();
- public:
- // for model items to use only
- /**
- * @brief
- *
- */
- void beginModelUpdate();
- /**
- * @brief
- *
- */
- void commitModelUpdate();
- /**
- * @brief
- *
- */
- IAPClient& client();
- /**
- * @brief
- *
- * @param index
- */
- PurchasableItemBase* record(int index) const;
- signals:
- /**
- * @brief
- *
- */
- void applicationBusyChanged();
- protected slots:
- /*
- * In-Application Purchase specific slots
- */
- /**
- * @brief
- *
- * @param requestId
- * @param status
- * @param items
- */
- void restorableProductsReceived( int requestId, QString status,
- IAPClient::ProductDataList items);
- /**
- * @brief
- *
- * @param requestId
- * @param status
- * @param userdata
- */
- void userAndDeviceDataReceived (int requestId, QString status,
- IAPClient::UserAndDeviceDataHash userdata);
- private:
- //utility functions
- /**
- * @brief
- *
- */
- void readNonProtectedCatalog();
- /**
- * @brief
- *
- */
- void readDRMCatalog();
- private:
- // In-Application Purchase API
- IAPClient m_client; /**< TODO */
- //for aggregate query to product list getRestorableProducts()
- int m_requestId; /**< TODO */
- QList<PurchasableItemBase*> m_data; /**< TODO */
- int m_modelCommitRefCounter; /**< TODO */
- // enables the whole application busy indicator
- bool m_isApplicationBusy; /**< TODO */
- };
- #endif // DECLARATIVEPURCHASELISTMODEL_H
|