Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/BuffDoc.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/noncore/apps/opie-reader/BuffDoc.cpp b/noncore/apps/opie-reader/BuffDoc.cpp index e37b136..d4541ea 100644 --- a/noncore/apps/opie-reader/BuffDoc.cpp +++ b/noncore/apps/opie-reader/BuffDoc.cpp | |||
@@ -13,8 +13,8 @@ bool BuffDoc::hyperlink(unsigned int n) | |||
13 | lastispara = false; | 13 | lastispara = false; |
14 | if (exp != NULL) | 14 | if (exp != NULL) |
15 | { | 15 | { |
16 | bRet = exp->hyperlink(n); | 16 | bRet = exp->hyperlink(n); |
17 | lastsizes[0] = laststartline = exp->locate(); | 17 | lastsizes[0] = laststartline = exp->locate(); |
18 | } | 18 | } |
19 | return bRet; | 19 | return bRet; |
20 | } | 20 | } |
@@ -37,9 +37,9 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w) | |||
37 | buff->empty(); | 37 | buff->empty(); |
38 | if (exp == NULL) | 38 | if (exp == NULL) |
39 | { | 39 | { |
40 | //(*buff)[0] = '\0'; | 40 | // (*buff)[0] = '\0'; |
41 | buff->empty(); | 41 | buff->empty(); |
42 | return false; | 42 | return false; |
43 | } | 43 | } |
44 | int len = 0, lastcheck = 0; | 44 | int len = 0, lastcheck = 0; |
45 | if (lastword.length() > 0) | 45 | if (lastword.length() > 0) |
@@ -54,9 +54,9 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w) | |||
54 | if (slen > w) | 54 | if (slen > w) |
55 | { | 55 | { |
56 | for ( ; len > 0; len--) | 56 | for ( ; len > 0; len--) |
57 | { | 57 | { |
58 | if (buff->width(len) < w) break; | 58 | if (buff->width(len) < w) break; |
59 | } | 59 | } |
60 | // lastword = buff->data() + len - 1; | 60 | // lastword = buff->data() + len - 1; |
61 | laststartline = lastsizes[len-1]; | 61 | laststartline = lastsizes[len-1]; |
62 | lastword.setright(*buff, len - 1); | 62 | lastword.setright(*buff, len - 1); |
@@ -88,10 +88,10 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w) | |||
88 | getch(ch, cs); | 88 | getch(ch, cs); |
89 | while (ch != ' ' && ch != '\012' && ch != UEOF && len < 128) | 89 | while (ch != ' ' && ch != '\012' && ch != UEOF && len < 128) |
90 | { | 90 | { |
91 | len++; | 91 | len++; |
92 | buff->addch(ch,cs); | 92 | buff->addch(ch,cs); |
93 | allsizes[len] = exp->locate(); | 93 | allsizes[len] = exp->locate(); |
94 | getch(ch, cs); | 94 | getch(ch, cs); |
95 | } | 95 | } |
96 | (*buff)[len] = 0; | 96 | (*buff)[len] = 0; |
97 | slen = buff->width(len); | 97 | slen = buff->width(len); |
@@ -100,8 +100,8 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w) | |||
100 | allsizes[len] = exp->locate(); | 100 | allsizes[len] = exp->locate(); |
101 | if (slen < w && ch != ' ') | 101 | if (slen < w && ch != ' ') |
102 | { | 102 | { |
103 | lastcheck = len; | 103 | lastcheck = len; |
104 | break; | 104 | break; |
105 | } | 105 | } |
106 | lastispara = (ch == '\012'); | 106 | lastispara = (ch == '\012'); |
107 | } | 107 | } |
@@ -130,17 +130,17 @@ bool BuffDoc::getline(CDrawBuffer* buff, int w, int cw) | |||
130 | buff->empty(); | 130 | buff->empty(); |
131 | if (exp == NULL) | 131 | if (exp == NULL) |
132 | { | 132 | { |
133 | return false; | 133 | return false; |
134 | } | 134 | } |
135 | tchar ch; | 135 | tchar ch; |
136 | CStyle cs; | 136 | CStyle cs; |
137 | int i = 0; | 137 | int i = 0; |
138 | while (i*cw < w) | 138 | while (i*cw < w) |
139 | { | 139 | { |
140 | getch(ch, cs); | 140 | getch(ch, cs); |
141 | if (ch == '\12' || ch == UEOF) break; | 141 | if (ch == '\12' || ch == UEOF) break; |
142 | buff->addch(ch,cs); | 142 | buff->addch(ch,cs); |
143 | i++; | 143 | i++; |
144 | } | 144 | } |
145 | buff->truncate(i); | 145 | buff->truncate(i); |
146 | laststartline = exp->locate(); | 146 | laststartline = exp->locate(); |
@@ -164,53 +164,53 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
164 | int ret = exp->openfile(src); | 164 | int ret = exp->openfile(src); |
165 | if (ret == -1) | 165 | if (ret == -1) |
166 | { | 166 | { |
167 | delete exp; | 167 | delete exp; |
168 | exp = NULL; | 168 | exp = NULL; |
169 | return ret; | 169 | return ret; |
170 | } | 170 | } |
171 | if (ret == -2) | 171 | if (ret == -2) |
172 | { | 172 | { |
173 | 173 | ||
174 | delete exp; | 174 | delete exp; |
175 | exp = new ztxt; | 175 | exp = new ztxt; |
176 | ret = exp->openfile(src); | 176 | ret = exp->openfile(src); |
177 | } | 177 | } |
178 | if (ret != 0) | 178 | if (ret != 0) |
179 | { | 179 | { |
180 | 180 | ||
181 | delete exp; | 181 | delete exp; |
182 | exp = new CPlucker; | 182 | exp = new CPlucker; |
183 | ret = exp->openfile(src); | 183 | ret = exp->openfile(src); |
184 | } | 184 | } |
185 | #ifndef SMALL | 185 | #ifndef SMALL |
186 | if (ret != 0) | 186 | if (ret != 0) |
187 | { | 187 | { |
188 | delete exp; | 188 | delete exp; |
189 | qDebug("Trying ppms"); | 189 | qDebug("Trying ppms"); |
190 | exp = new ppm_expander; | 190 | exp = new ppm_expander; |
191 | ret = exp->openfile(src); | 191 | ret = exp->openfile(src); |
192 | } | 192 | } |
193 | 193 | ||
194 | if (ret != 0) | 194 | if (ret != 0) |
195 | { | 195 | { |
196 | delete exp; | 196 | delete exp; |
197 | exp = new Text; | 197 | exp = new Text; |
198 | // qDebug("Trying text"); | 198 | // qDebug("Trying text"); |
199 | ret = exp->openfile(src); | 199 | ret = exp->openfile(src); |
200 | } | 200 | } |
201 | #else | 201 | #else |
202 | if (ret != 0) | 202 | if (ret != 0) |
203 | { | 203 | { |
204 | delete exp; | 204 | delete exp; |
205 | exp = new Text; | 205 | exp = new Text; |
206 | ret = exp->openfile(src); | 206 | ret = exp->openfile(src); |
207 | } | 207 | } |
208 | #endif | 208 | #endif |
209 | if (ret != 0) | 209 | if (ret != 0) |
210 | { | 210 | { |
211 | delete exp; | 211 | delete exp; |
212 | QMessageBox::information(_parent, "QTReader", "Unknown file compression type","Try another file"); | 212 | QMessageBox::information(_parent, "OpieReader", "Unknown file compression type","Try another file"); |
213 | return ret; | 213 | return ret; |
214 | } | 214 | } |
215 | // qDebug("Doing final open:%x:%x",exp,filt); | 215 | // qDebug("Doing final open:%x:%x",exp,filt); |
216 | 216 | ||