summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/CHM.cpp
authorpohly <pohly>2005-05-05 14:39:33 (UTC)
committer pohly <pohly>2005-05-05 14:39:33 (UTC)
commit39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91 (patch) (side-by-side diff)
tree96e66fdc18dca4d4ab8611133e072f57dea224b9 /noncore/apps/opie-reader/CHM.cpp
parent279fc4fd1986074acbadd3a8e86fcf3968a8dd5c (diff)
downloadopie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.zip
opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.gz
opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.bz2
new opie-reader sources with support for ArriereGo, Reb input and flite output plugins
Diffstat (limited to 'noncore/apps/opie-reader/CHM.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/CHM.cpp35
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
@@ -5,6 +5,9 @@
#include <stdio.h>
#include <qimage.h>
#include <qpixmap.h>
+#ifdef USEQPE
+#include <qpe/global.h>
+#endif
#ifndef __STATIC
extern "C"
@@ -49,26 +52,30 @@ CHM::~CHM() {
chm_close(chmFile);
}
-void CHM::suspend() {
+void CHM::suspend() {
#ifdef USEQPE
bSuspended = true;
//suspos = gztell(file);
chm_close(chmFile);
chmFile = NULL;
- sustime = time(NULL);
+ sustime = time(NULL);
#endif
}
-void CHM::unsuspend() {
+void CHM::unsuspend() {
#ifdef USEQPE
if (bSuspended)
{
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);
}
@@ -77,7 +84,7 @@ void CHM::unsuspend() {
exit(0);
}
//suspos = gzseek(file, suspos, SEEK_SET);
- }
+ }
#endif
}
@@ -86,6 +93,7 @@ void CHM::addContent(QString content) {
}
void CHM::FillHomeContent() {
+unsuspend();
if (chmHHCPath != "") {
const char *ext;
char buffer[65536];
@@ -162,6 +170,7 @@ void CHM::FillHomeContent() {
bool CHM::FillBuffer()
{
+unsuspend();
bool bRetVal = false;
char buffer[65536];
int swath, offset;
@@ -196,6 +205,7 @@ bool CHM::FillBuffer()
}
bool CHM::FillContent() {
+unsuspend();
bool bRetVal = false;
if (chmPath != "") {
/* try to find the file */
@@ -239,7 +249,8 @@ bool CHM::FillContent() {
return bRetVal;
}
-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;
QString temp = chmPath;
@@ -319,11 +330,11 @@ int CHM::OpenFile(const char *src) {
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;
}