Diffstat (limited to 'noncore/apps/opie-reader/ebookcodec.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ebookcodec.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/noncore/apps/opie-reader/ebookcodec.h b/noncore/apps/opie-reader/ebookcodec.h index f6e2daf..4229fb9 100644 --- a/noncore/apps/opie-reader/ebookcodec.h +++ b/noncore/apps/opie-reader/ebookcodec.h | |||
@@ -1,42 +1,51 @@ | |||
1 | #include "CExpander.h" | 1 | #include "CExpander.h" |
2 | 2 | ||
3 | #include <qfileinfo.h> | 3 | #include <qfileinfo.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | 5 | ||
6 | #ifdef USEQPE | 6 | #ifdef USEQPE |
7 | #include <qpe/global.h> | 7 | #include <qpe/global.h> |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | #include "util.h" | ||
11 | |||
12 | #ifndef __STATIC | 10 | #ifndef __STATIC |
13 | #include <dlfcn.h> | 11 | #include <dlfcn.h> |
14 | class ebookcodec : public CExpander_Interface | 12 | class ebookcodec : public CExpander_Interface |
15 | { | 13 | { |
16 | CExpander *codec; | 14 | CExpander *codec; |
17 | void *handle; | 15 | void *handle; |
18 | int status; | 16 | int status; |
19 | public: | 17 | public: |
18 | QString getTableAsHtml(unsigned long loc) { return codec->getTableAsHtml(loc); } | ||
20 | QString about() | 19 | QString about() |
21 | { | 20 | { |
22 | return QString("Plug-in ebook codec interface (c) Tim Wentford\n")+codec->about(); | 21 | return QString("Plug-in ebook codec interface (c) Tim Wentford\n")+codec->about(); |
23 | } | 22 | } |
24 | ebookcodec(const QString& _s) : codec(NULL), handle(NULL), status(0) | 23 | ebookcodec(const QString& _s) : codec(NULL), handle(NULL), status(0) |
25 | { | 24 | { |
26 | QString codecpath(QTReaderUtil::getPluginPath()); | 25 | #ifdef USEQPE |
26 | #ifdef OPIE | ||
27 | QString codecpath(getenv("OPIEDIR")); | ||
28 | #else | ||
29 | QString codecpath(getenv("QTDIR")); | ||
30 | #endif | ||
31 | codecpath += "/plugins/reader/codecs/"; | ||
32 | #else | ||
33 | QString codecpath(getenv("READERDIR")); | ||
34 | codecpath += "/codecs/"; | ||
35 | #endif | ||
27 | codecpath += _s; | 36 | codecpath += _s; |
28 | if (QFile::exists(codecpath)) | 37 | if (QFile::exists(codecpath)) |
29 | { | 38 | { |
30 | qDebug("Codec:%s", (const char*)codecpath); | 39 | qDebug("Codec:%s", (const char*)codecpath); |
31 | handle = dlopen(codecpath, RTLD_LAZY); | 40 | handle = dlopen(codecpath, RTLD_LAZY); |
32 | if (handle == 0) | 41 | if (handle == 0) |
33 | { | 42 | { |
34 | /* | 43 | /* |
35 | QString wrn(dlerror()); | 44 | QString wrn(dlerror()); |
36 | QString fmt; | 45 | QString fmt; |
37 | while (wrn.length() > 10) | 46 | while (wrn.length() > 10) |
38 | { | 47 | { |
39 | fmt += wrn.left(10); | 48 | fmt += wrn.left(10); |
40 | fmt += '\n'; | 49 | fmt += '\n'; |
41 | wrn = wrn.right(wrn.length()-10); | 50 | wrn = wrn.right(wrn.length()-10); |
42 | } | 51 | } |
@@ -100,19 +109,23 @@ class ebookcodec : public CExpander_Interface | |||
100 | bool hasnavigation() { return codec->hasnavigation(); } | 109 | bool hasnavigation() { return codec->hasnavigation(); } |
101 | void start2endSection() { codec->start2endSection(); } | 110 | void start2endSection() { codec->start2endSection(); } |
102 | QImage* getPicture(unsigned long tgt) { return codec->getPicture(tgt); } | 111 | QImage* getPicture(unsigned long tgt) { return codec->getPicture(tgt); } |
103 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) { return codec->setSaveData(data, len, src, srclen); } | 112 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) { return codec->setSaveData(data, len, src, srclen); } |
104 | void putSaveData(unsigned char*& src, unsigned short& srclen) { codec->putSaveData(src, srclen); } | 113 | void putSaveData(unsigned char*& src, unsigned short& srclen) { codec->putSaveData(src, srclen); } |
105 | void setContinuous(bool _b) { codec->setContinuous(_b); } | 114 | void setContinuous(bool _b) { codec->setContinuous(_b); } |
106 | void setwidth(int w) { codec->setwidth(w); } | 115 | void setwidth(int w) { codec->setwidth(w); } |
107 | unsigned long startSection() { return codec->startSection(); } | 116 | unsigned long startSection() { return codec->startSection(); } |
108 | unsigned long endSection() { return codec->endSection(); } | 117 | unsigned long endSection() { return codec->endSection(); } |
109 | int openfile(const char *src) | 118 | int openfile(const char *src) |
110 | { | 119 | { |
111 | //qDebug("ebook openfile:%s", src); | 120 | //qDebug("ebook openfile:%s", src); |
112 | return (status != 0) ? status : codec->openfile(src); | 121 | return (status != 0) ? status : codec->openfile(src); |
113 | } | 122 | } |
114 | int getwidth() { return codec->getwidth(); } | 123 | int getwidth() { return codec->getwidth(); } |
115 | QImage* getPicture(const QString& href) { return codec->getPicture(href); } | 124 | QImage* getPicture(const QString& href) { return codec->getPicture(href); } |
116 | bool getFile(const QString& href) { return codec->getFile(href); } | 125 | bool getFile(const QString& href, const QString& nm) { return codec->getFile(href, nm); } |
126 | bool findanchor(const QString& nm) | ||
127 | { | ||
128 | return codec->findanchor(nm); | ||
129 | } | ||
117 | }; | 130 | }; |
118 | #endif | 131 | #endif |