Diffstat (limited to 'noncore/apps/opie-reader/ZText.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ZText.h | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/noncore/apps/opie-reader/ZText.h b/noncore/apps/opie-reader/ZText.h index ab81a5e..06e3bf8 100644 --- a/noncore/apps/opie-reader/ZText.h +++ b/noncore/apps/opie-reader/ZText.h | |||
@@ -15,2 +15,4 @@ public: | |||
15 | #ifdef USEQPE | 15 | #ifdef USEQPE |
16 | if (!bSuspended) | ||
17 | { | ||
16 | bSuspended = true; | 18 | bSuspended = true; |
@@ -20,2 +22,3 @@ public: | |||
20 | sustime = time(NULL); | 22 | sustime = time(NULL); |
23 | } | ||
21 | #endif | 24 | #endif |
@@ -28,4 +31,7 @@ public: | |||
28 | bSuspended = false; | 31 | bSuspended = false; |
32 | if (sustime != ((time_t)-1)) | ||
33 | { | ||
29 | int delay = time(NULL) - sustime; | 34 | int delay = time(NULL) - sustime; |
30 | if (delay < 10) sleep(10-delay); | 35 | if (delay < 10) sleep(10-delay); |
36 | } | ||
31 | file = gzopen(fname, "rb"); | 37 | file = gzopen(fname, "rb"); |
@@ -48,3 +54,9 @@ public: | |||
48 | { | 54 | { |
49 | if (file != NULL) gzclose(file); | 55 | if (file != NULL) |
56 | { | ||
57 | #ifdef USEQPE | ||
58 | unsuspend(); | ||
59 | #endif | ||
60 | gzclose(file); | ||
61 | } | ||
50 | } | 62 | } |
@@ -58,5 +70,23 @@ public: | |||
58 | } | 70 | } |
59 | int getch() { return gzgetc(file); } | 71 | int getch() |
60 | unsigned int locate() { return gztell(file); } | 72 | { |
61 | void locate(unsigned int n) { gzseek(file,n,SEEK_SET); } | 73 | #ifdef USEQPE |
74 | unsuspend(); | ||
75 | #endif | ||
76 | return gzgetc(file); | ||
77 | } | ||
78 | unsigned int locate() | ||
79 | { | ||
80 | #ifdef USEQPE | ||
81 | unsuspend(); | ||
82 | #endif | ||
83 | return gztell(file); | ||
84 | } | ||
85 | void locate(unsigned int n) | ||
86 | { | ||
87 | #ifdef USEQPE | ||
88 | unsuspend(); | ||
89 | #endif | ||
90 | gzseek(file,n,SEEK_SET); | ||
91 | } | ||
62 | bool hasrandomaccess() { return true; } | 92 | bool hasrandomaccess() { return true; } |
@@ -83,2 +113,3 @@ public: | |||
83 | } | 113 | } |
114 | QString about() { return QString("Text/gzipped text codec (c) Tim Wentford"); } | ||
84 | }; | 115 | }; |