Diffstat (limited to 'noncore/apps/opie-reader/ZText.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ZText.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/ZText.h b/noncore/apps/opie-reader/ZText.h index 06e3bf8..199c7da 100644 --- a/noncore/apps/opie-reader/ZText.h +++ b/noncore/apps/opie-reader/ZText.h | |||
@@ -1,54 +1,53 @@ | |||
1 | #ifndef __Text_h | 1 | #ifndef __Text_h |
2 | #define __Text_h | 2 | #define __Text_h |
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <zlib.h> | 4 | #include <zlib.h> |
5 | #include <sys/stat.h> | 5 | #include <sys/stat.h> |
6 | #include "useqpe.h" | ||
7 | #include "CExpander.h" | 6 | #include "CExpander.h" |
8 | 7 | ||
9 | class Text: public CExpander { | 8 | class Text: public CExpander { |
10 | gzFile file; | 9 | gzFile file; |
11 | unsigned long fsize; | 10 | unsigned long fsize; |
12 | public: | 11 | public: |
13 | void suspend() | 12 | void suspend() |
14 | { | 13 | { |
15 | #ifdef USEQPE | 14 | #ifdef USEQPE |
16 | if (!bSuspended) | 15 | if (!bSuspended) |
17 | { | 16 | { |
18 | bSuspended = true; | 17 | bSuspended = true; |
19 | suspos = gztell(file); | 18 | suspos = gztell(file); |
20 | gzclose(file); | 19 | gzclose(file); |
21 | file = NULL; | 20 | file = NULL; |
22 | sustime = time(NULL); | 21 | sustime = time(NULL); |
23 | } | 22 | } |
24 | #endif | 23 | #endif |
25 | } | 24 | } |
26 | void unsuspend() | 25 | void unsuspend() |
27 | { | 26 | { |
28 | #ifdef USEQPE | 27 | #ifdef USEQPE |
29 | if (bSuspended) | 28 | if (bSuspended) |
30 | { | 29 | { |
31 | bSuspended = false; | 30 | bSuspended = false; |
32 | if (sustime != ((time_t)-1)) | 31 | if (sustime != ((time_t)-1)) |
33 | { | 32 | { |
34 | int delay = time(NULL) - sustime; | 33 | int delay = time(NULL) - sustime; |
35 | if (delay < 10) sleep(10-delay); | 34 | if (delay < 10) sleep(10-delay); |
36 | } | 35 | } |
37 | file = gzopen(fname, "rb"); | 36 | file = gzopen(fname, "rb"); |
38 | for (int i = 0; file == NULL && i < 5; i++) | 37 | for (int i = 0; file == NULL && i < 5; i++) |
39 | { | 38 | { |
40 | sleep(5); | 39 | sleep(5); |
41 | file = gzopen(fname, "rb"); | 40 | file = gzopen(fname, "rb"); |
42 | } | 41 | } |
43 | if (file == NULL) | 42 | if (file == NULL) |
44 | { | 43 | { |
45 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); | 44 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); |
46 | exit(0); | 45 | exit(0); |
47 | } | 46 | } |
48 | suspos = gzseek(file, suspos, SEEK_SET); | 47 | suspos = gzseek(file, suspos, SEEK_SET); |
49 | } | 48 | } |
50 | #endif | 49 | #endif |
51 | } | 50 | } |
52 | Text() : file(NULL) {}; | 51 | Text() : file(NULL) {}; |
53 | virtual ~Text() | 52 | virtual ~Text() |
54 | { | 53 | { |