summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/ZText.h
authorllornkcor <llornkcor>2002-12-20 01:35:01 (UTC)
committer llornkcor <llornkcor>2002-12-20 01:35:01 (UTC)
commit876e1a4724a7bd75dc642e295de354241096e028 (patch) (side-by-side diff)
treea37c5dcc9d78e04bb6b859ab89d8cf81e6745087 /noncore/apps/opie-reader/ZText.h
parent5fd6636ba3d94b48dd543887316c47c5388a43c2 (diff)
downloadopie-876e1a4724a7bd75dc642e295de354241096e028.zip
opie-876e1a4724a7bd75dc642e295de354241096e028.tar.gz
opie-876e1a4724a7bd75dc642e295de354241096e028.tar.bz2
update - sorry it took so long. hope this works correctly
Diffstat (limited to 'noncore/apps/opie-reader/ZText.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/ZText.h35
1 files changed, 32 insertions, 3 deletions
diff --git a/noncore/apps/opie-reader/ZText.h b/noncore/apps/opie-reader/ZText.h
index debfe8c..22d3733 100644
--- a/noncore/apps/opie-reader/ZText.h
+++ b/noncore/apps/opie-reader/ZText.h
@@ -10,14 +10,43 @@ class Text: public CExpander {
gzFile file;
unsigned long fsize;
public:
+ virtual void suspend()
+ {
+ bSuspended = true;
+ suspos = gztell(file);
+ gzclose(file);
+ file = NULL;
+ sustime = time(NULL);
+ }
+ virtual void unsuspend()
+ {
+ if (bSuspended)
+ {
+ bSuspended = false;
+ int delay = time(NULL) - sustime;
+ if (delay < 10) sleep(10-delay);
+ file = gzopen(fname, "rb");
+ for (int i = 0; file == NULL && i < 5; i++)
+ {
+ sleep(5);
+ file = gzopen(fname, "rb");
+ }
+ if (file == NULL)
+ {
+ QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file");
+ exit(0);
+ }
+ suspos = gzseek(file, suspos, SEEK_SET);
+ }
+ }
Text() : file(NULL) {};
virtual ~Text()
{
if (file != NULL) gzclose(file);
}
- virtual int openfile(const char *src)
+ virtual int OpenFile(const char *src)
{
- if (file != NULL) gzclose(file);
+ if (file != NULL) gzclose(file);
struct stat _stat;
stat(src,&_stat);
fsize = _stat.st_size;
@@ -33,7 +62,7 @@ public:
}
virtual MarkupType PreferredMarkup()
{
- return cTEXT;
+ return cTEXT;
}
};
#endif