summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/ZText.h
Unidiff
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 {
10 gzFile file; 10 gzFile file;
11 unsigned long fsize; 11 unsigned long fsize;
12public: 12public:
13 virtual void suspend()
14 {
15 bSuspended = true;
16 suspos = gztell(file);
17 gzclose(file);
18 file = NULL;
19 sustime = time(NULL);
20 }
21 virtual void unsuspend()
22 {
23 if (bSuspended)
24 {
25 bSuspended = false;
26 int delay = time(NULL) - sustime;
27 if (delay < 10) sleep(10-delay);
28 file = gzopen(fname, "rb");
29 for (int i = 0; file == NULL && i < 5; i++)
30 {
31 sleep(5);
32 file = gzopen(fname, "rb");
33 }
34 if (file == NULL)
35 {
36 QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file");
37 exit(0);
38 }
39 suspos = gzseek(file, suspos, SEEK_SET);
40 }
41 }
13 Text() : file(NULL) {}; 42 Text() : file(NULL) {};
14 virtual ~Text() 43 virtual ~Text()
15 { 44 {
16 if (file != NULL) gzclose(file); 45 if (file != NULL) gzclose(file);
17 } 46 }
18 virtual int openfile(const char *src) 47 virtual int OpenFile(const char *src)
19 { 48 {
20 if (file != NULL) gzclose(file); 49 if (file != NULL) gzclose(file);
21 struct stat _stat; 50 struct stat _stat;
22 stat(src,&_stat); 51 stat(src,&_stat);
23 fsize = _stat.st_size; 52 fsize = _stat.st_size;
@@ -33,7 +62,7 @@ public:
33 } 62 }
34 virtual MarkupType PreferredMarkup() 63 virtual MarkupType PreferredMarkup()
35 { 64 {
36 return cTEXT; 65 return cTEXT;
37 } 66 }
38}; 67};
39#endif 68#endif