Changeset View
Changeset View
Standalone View
Standalone View
generators/mobipocket/mobidocument.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 49 | { | |||
---|---|---|---|---|---|
50 | delete doc; | 50 | delete doc; | ||
51 | delete file; | 51 | delete file; | ||
52 | } | 52 | } | ||
53 | 53 | | |||
54 | QVariant MobiDocument::loadResource(int type, const QUrl &name) | 54 | QVariant MobiDocument::loadResource(int type, const QUrl &name) | ||
55 | { | 55 | { | ||
56 | if (type!=QTextDocument::ImageResource || name.scheme()!=QString(QStringLiteral("pdbrec"))) return QVariant(); | 56 | if (type!=QTextDocument::ImageResource || name.scheme()!=QString(QStringLiteral("pdbrec"))) return QVariant(); | ||
57 | bool ok; | 57 | bool ok; | ||
58 | quint16 recnum=name.path().mid(1).toUShort(&ok); | 58 | quint16 recnum=name.path().midRef(1).toUShort(&ok); | ||
59 | if (!ok || recnum>=doc->imageCount()) return QVariant(); | 59 | if (!ok || recnum>=doc->imageCount()) return QVariant(); | ||
60 | 60 | | |||
61 | QVariant resource; | 61 | QVariant resource; | ||
62 | resource.setValue(doc->getImage(recnum-1)); | 62 | resource.setValue(doc->getImage(recnum-1)); | ||
63 | addResource(type, name, resource); | 63 | addResource(type, name, resource); | ||
64 | 64 | | |||
65 | return resource; | 65 | return resource; | ||
66 | } | 66 | } | ||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |