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
@@ -12,2 +12,31 @@ class Text: public CExpander {
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) {};
@@ -17,5 +46,5 @@ public:
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;
@@ -35,3 +64,3 @@ public:
35 { 64 {
36 return cTEXT; 65 return cTEXT;
37 } 66 }