From 876e1a4724a7bd75dc642e295de354241096e028 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Fri, 20 Dec 2002 01:35:01 +0000 Subject: update - sorry it took so long. hope this works correctly --- (limited to 'noncore/apps/opie-reader/ZText.h') 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 -- cgit v0.9.0.2