Changeset View
Changeset View
Standalone View
Standalone View
dataengines/comic/comicproviderwrapper.cpp
Show First 20 Lines • Show All 713 Lines • ▼ Show 20 Line(s) | |||||
714 | 714 | | |||
715 | void ComicProviderWrapper::pageRetrieved(int id, const QByteArray &data) | 715 | void ComicProviderWrapper::pageRetrieved(int id, const QByteArray &data) | ||
716 | { | 716 | { | ||
717 | --mRequests; | 717 | --mRequests; | ||
718 | if (id == Image) { | 718 | if (id == Image) { | ||
719 | mKrossImage = new ImageWrapper(this, data); | 719 | mKrossImage = new ImageWrapper(this, data); | ||
720 | callFunction(QLatin1String("pageRetrieved"), QVariantList() << id << | 720 | callFunction(QLatin1String("pageRetrieved"), QVariantList() << id << | ||
721 | qVariantFromValue(qobject_cast<QObject*>(mKrossImage))); | 721 | qVariantFromValue(qobject_cast<QObject*>(mKrossImage))); | ||
722 | if (mRequests < 1) { // Don't finish if we still have pageRequests | | |||
723 | finished(); | | |||
724 | } | | |||
725 | } else { | 722 | } else { | ||
726 | QTextCodec *codec = nullptr; | 723 | QTextCodec *codec = nullptr; | ||
727 | if (!mTextCodec.isEmpty()) { | 724 | if (!mTextCodec.isEmpty()) { | ||
728 | codec = QTextCodec::codecForName(mTextCodec); | 725 | codec = QTextCodec::codecForName(mTextCodec); | ||
729 | } | 726 | } | ||
730 | if (!codec) { | 727 | if (!codec) { | ||
731 | codec = QTextCodec::codecForHtml(data); | 728 | codec = QTextCodec::codecForHtml(data); | ||
732 | } | 729 | } | ||
733 | QString html = codec->toUnicode(data); | 730 | QString html = codec->toUnicode(data); | ||
734 | 731 | | |||
735 | callFunction(QLatin1String("pageRetrieved"), QVariantList() << id << html); | 732 | callFunction(QLatin1String("pageRetrieved"), QVariantList() << id << html); | ||
736 | } | 733 | } | ||
734 | if (mRequests < 1) { // Don't finish if we still have pageRequests | ||||
735 | finished(); | ||||
736 | } | ||||
737 | } | 737 | } | ||
738 | 738 | | |||
739 | void ComicProviderWrapper::pageError(int id, const QString &message) | 739 | void ComicProviderWrapper::pageError(int id, const QString &message) | ||
740 | { | 740 | { | ||
741 | --mRequests; | 741 | --mRequests; | ||
742 | callFunction(QLatin1String("pageError"), QVariantList() << id << message); | 742 | callFunction(QLatin1String("pageError"), QVariantList() << id << message); | ||
743 | if (!functionCalled()) { | 743 | if (!functionCalled()) { | ||
744 | emit mProvider->error(mProvider); | 744 | emit mProvider->error(mProvider); | ||
▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines |