Diffstat (limited to 'noncore/apps/opie-reader/CHM.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CHM.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/noncore/apps/opie-reader/CHM.cpp b/noncore/apps/opie-reader/CHM.cpp index 88d53bf..ace5abc 100644 --- a/noncore/apps/opie-reader/CHM.cpp +++ b/noncore/apps/opie-reader/CHM.cpp @@ -6,4 +6,7 @@ #include <qimage.h> #include <qpixmap.h> +#ifdef USEQPE +#include <qpe/global.h> +#endif #ifndef __STATIC @@ -50,5 +53,5 @@ CHM::~CHM() { } -void CHM::suspend() {
+void CHM::suspend() { #ifdef USEQPE bSuspended = true; @@ -56,9 +59,9 @@ void CHM::suspend() { chm_close(chmFile); chmFile = NULL; - sustime = time(NULL);
+ sustime = time(NULL); #endif } -void CHM::unsuspend() {
+void CHM::unsuspend() { #ifdef USEQPE if (bSuspended) @@ -66,8 +69,12 @@ void CHM::unsuspend() { bSuspended = false; int delay = time(NULL) - sustime; - if (delay < 10)
- sleep(10-delay);
+ if (delay < 10) + { + Global::statusMessage("Stalling"); + sleep(10-delay); + } chmFile = chm_open(fname); for (int i = 0; chmFile == NULL && i < 5; i++) { + Global::statusMessage("Stalling"); sleep(5); chmFile = chm_open(fname); @@ -78,5 +85,5 @@ void CHM::unsuspend() { } //suspos = gzseek(file, suspos, SEEK_SET); - }
+ } #endif } @@ -87,4 +94,5 @@ void CHM::addContent(QString content) { void CHM::FillHomeContent() { +unsuspend(); if (chmHHCPath != "") { const char *ext; @@ -163,4 +171,5 @@ void CHM::FillHomeContent() { bool CHM::FillBuffer() { +unsuspend(); bool bRetVal = false; char buffer[65536]; @@ -197,4 +206,5 @@ bool CHM::FillBuffer() bool CHM::FillContent() { +unsuspend(); bool bRetVal = false; if (chmPath != "") { @@ -240,5 +250,6 @@ bool CHM::FillContent() { } -bool CHM::getFile(const QString& href) { +bool CHM::getFile(const QString& _href, const QString& ) { + QString href = "/" + _href; qDebug("Got:%s", (const char*)href); bool bRetVal = false; @@ -320,9 +331,9 @@ int CHM::getch() { if ( (bufpos+1) >= chmBuffer.length() ) return EOF; -#ifdef _WINDOWS
- QChar letter = chmBuffer.at(bufpos++);
-#else
- QChar letter = chmBuffer[bufpos++];
-#endif
+#ifdef _WINDOWS + QChar letter = chmBuffer.at(bufpos++); +#else + QChar letter = chmBuffer[bufpos++]; +#endif return (int)(char)letter; } |