author | llornkcor <llornkcor> | 2002-12-20 01:35:01 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-20 01:35:01 (UTC) |
commit | 876e1a4724a7bd75dc642e295de354241096e028 (patch) (side-by-side diff) | |
tree | a37c5dcc9d78e04bb6b859ab89d8cf81e6745087 /noncore/apps/opie-reader/ZText.h | |
parent | 5fd6636ba3d94b48dd543887316c47c5388a43c2 (diff) | |
download | opie-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.h | 35 |
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 @@ -11,4 +11,33 @@ class Text: public CExpander { 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() @@ -16,7 +45,7 @@ public: 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); @@ -34,5 +63,5 @@ public: virtual MarkupType PreferredMarkup() { - return cTEXT; + return cTEXT; } }; |