void NetworkBookTree::BookItemWrapper::onCoverLoaded(ZLUserDataHolder &data, const std::string &error) { BookItemWrapperScope &scope = static_cast<BookItemWrapperScope&>(*data.getUserData("scope")); if (error.empty()) { myIsInitialized = true; } scope.listener->finished(error); }
void NetworkBookBuyDirectlyAction::onPurchased(ZLUserDataHolder &data, const std::string &error) { if (!error.empty()) { ZLDialogManager::Instance().errorBox( ZLResourceKey("networkError"), error ); // finished(error); return; } if (data.getUserData("downloadBook").isNull()) {} // finished(std::string()); else NetworkBookDownloadAction::run(); }
void LitResBookshelfItem::onReloaded(ZLUserDataHolder &data, const std::string &error) { LitResBookshelfItemLoaderScope &scope = static_cast<LitResBookshelfItemLoaderScope&>(*data.getUserData("scope")); LitResAuthenticationManager &mgr = static_cast<LitResAuthenticationManager&>(*Link.authenticationManager()); myForceReload = true; NetworkItem::List tmpChildren; mgr.collectPurchasedBooks(tmpChildren); std::sort(tmpChildren.begin(), tmpChildren.end(), NetworkBookItemComparator()); NetworkItem::List &children = scope.Children; if (tmpChildren.size() <= 5) { children.assign(tmpChildren.begin(), tmpChildren.end()); std::sort(children.begin(), children.end(), NetworkBookItemComparator()); } else { children.push_back(SortedCatalogItem::create(*this, "byDate", tmpChildren, FLAG_SHOW_AUTHOR)); children.push_back(SortedCatalogItem::create(*this, "byAuthor", tmpChildren, FLAG_GROUP_BY_AUTHOR, NetworkBookItemComparator())); children.push_back(SortedCatalogItem::create(*this, "byTitle", tmpChildren, FLAG_SHOW_AUTHOR, NetworkBookItemByTitleComparator())); SortedCatalogItem* bySeries = SortedCatalogItem::create(*this, "bySeries", tmpChildren, FLAG_SHOW_AUTHOR | FLAG_GROUP_BY_SERIES, NetworkBookItemBySeriesComparator(), SortedCatalogItem::BySeriesFilter()); if (!bySeries->isEmpty()) { children.push_back(bySeries); } else { delete bySeries; } } scope.listener->finished(error); }