summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/CHM.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-reader/CHM.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/CHM.cpp13
1 files changed, 12 insertions, 1 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
@@ -2,12 +2,15 @@
#include "chm_lib.h"
#include <qstring.h>
#include <qstringlist.h>
#include <stdio.h>
#include <qimage.h>
#include <qpixmap.h>
+#ifdef USEQPE
+#include <qpe/global.h>
+#endif
#ifndef __STATIC
extern "C"
{
CExpander* newcodec() { return new CHM; }
}
@@ -63,15 +66,19 @@ void CHM::unsuspend() {
#ifdef USEQPE
if (bSuspended)
{
bSuspended = false;
int delay = time(NULL) - sustime;
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);
}
if (chmFile == NULL) {
QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file");
exit(0);
@@ -83,12 +90,13 @@ void CHM::unsuspend() {
void CHM::addContent(QString content) {
chmBuffer += content;
}
void CHM::FillHomeContent() {
+unsuspend();
if (chmHHCPath != "") {
const char *ext;
char buffer[65536];
unsigned int swath, offset;
QString tmp="";
QString HTML="";
@@ -159,12 +167,13 @@ void CHM::FillHomeContent() {
m_currentend = m_currentstart+chmBuffer.length();
}
}
bool CHM::FillBuffer()
{
+unsuspend();
bool bRetVal = false;
char buffer[65536];
int swath, offset;
chmBuffer = "";
swath = 65536;
offset = 0;
@@ -193,12 +202,13 @@ bool CHM::FillBuffer()
m_currentstart = m_ui.start;
m_currentend = m_currentstart+chmBuffer.length();
return bRetVal;
}
bool CHM::FillContent() {
+unsuspend();
bool bRetVal = false;
if (chmPath != "") {
/* try to find the file */
const char *filename = (const char *)chmPath;
if (chm_resolve_object(chmFile, filename, &m_ui) != CHM_RESOLVE_SUCCESS)
{
@@ -236,13 +246,14 @@ bool CHM::FillContent() {
m_currentend = m_currentstart+chmBuffer.length();
bRetVal = true;
}
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;
chmPath = href;
if (FillContent()) {
qDebug("Got it");